diff --git a/DDCore/include/DD4hep/Objects.h b/DDCore/include/DD4hep/Objects.h index f7a8d5358b47a07eb1914e33c93a50f34efcaf5e..c711533c142c072193bf72abb88b5e4d2503876c 100644 --- a/DDCore/include/DD4hep/Objects.h +++ b/DDCore/include/DD4hep/Objects.h @@ -221,8 +221,10 @@ namespace DD4hep { Material(const Handle<Q>& e) : Handle<TGeoMedium>(e) {} /// String representation of this object std::string toString() const; - /// Access the radiation length of the undrelying material + /// Access the radiation length of the underlying material double radLength() const; + /// Access the interaction length of the underlying material + double intLength() const; }; /** @class VisAttr Objects.h diff --git a/DDCore/src/Objects.cpp b/DDCore/src/Objects.cpp index 1f68daf77c7f95fa6dfdbadfce595ad0afedd572..e0f33722481937d4497f8446c3afccd785e32b61 100644 --- a/DDCore/src/Objects.cpp +++ b/DDCore/src/Objects.cpp @@ -167,7 +167,7 @@ Atom::Atom(const string& name, const string& formula, int Z, int N, double densi m_element = e; } -/// Access the radiation length of the undrelying material +/// Access the radiation length of the underlying material double Material::radLength() const { Handle<TGeoMedium> val(*this); if ( val.isValid() ) { @@ -178,6 +178,17 @@ double Material::radLength() const { throw runtime_error("Attempt to access radiation length from invalid material handle!"); } +/// Access the radiation length of the underlying material +double Material::intLength() const { + Handle<TGeoMedium> val(*this); + if ( val.isValid() ) { + TGeoMaterial* m = val->GetMaterial(); + if ( m ) return m->GetIntLen(); + throw runtime_error("The medium "+string(val->GetName())+" has an invalid material reference!"); + } + throw runtime_error("Attempt to access interaction length from invalid material handle!"); +} + /// String representation of this object string Material::toString() const { Handle<TGeoMedium> val(*this);