DD4hep - The AIDA detector description toolkit for high energy physics experiments
DD4hep  Rev:Unversioneddirectory
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MaterialManager.h
Go to the documentation of this file.
1 #ifndef DDRec_MaterialManager_H_
2 #define DDRec_MaterialManager_H_
3 
4 #include "DD4hep/Objects.h"
5 #include "DDSurfaces/Vector3D.h"
6 #include "DDRec/Material.h"
7 #include "DD4hep/DD4hepUnits.h"
8 
9 #include <vector>
10 
11 
12 class TGeoManager ;
13 
14 namespace DD4hep {
15  namespace DDRec {
16 
17  // export Geometry::Material to this namespace ;
18  using Geometry::Material ;
19 
20  typedef std::vector< std::pair< Material, double > > MaterialVec ;
21 
31 
32  public:
33 
35 
37 
43  const MaterialVec& materialsBetween(const DDSurfaces::Vector3D& p0, const DDSurfaces::Vector3D& p1 , double epsilon=1e-4 ) ;
44 
47  const Material& materialAt(const DDSurfaces::Vector3D& pos );
48 
49 
54  MaterialData createAveragedMaterial( const MaterialVec& materials ) ;
55 
56  protected :
57 
58  //cached materials
61 
62  // cached last points
64 
65  TGeoManager* _tgeoMgr ;
66  };
67 
68 
70  inline std::ostream& operator<<( std::ostream& os , const Material& m ) {
71  os << " " << m.name() << " Z: " << m.Z() << " A: " << m.A() << " density: " << m.density()
72  << " radiationLength: " << m.radLength()
73  << " interactionLength: " << m.intLength() ;
74  return os ;
75  }
76 
77 
79  inline std::ostream& operator<<( std::ostream& os , const MaterialVec& m ) {
80 
81  for( unsigned i=0,n=m.size() ; i<n ; ++i ) {
82  os << " material: " << m[i].first << " thickness: " << m[i].second << std::endl ;
83  }
84  return os ;
85  }
86 
87  } /* namespace DDRec */
88 } /* namespace DD4hep */
89 
90 #endif // DDRec_MaterialManager_H_
const char * name() const
Access the object name (or "" if not supported by the object)
Definition: Handle.inl:36
Handle class describing a material.
Definition: Objects.h:300
double intLength() const
Access the interaction length of the underlying material.
Definition: Objects.cpp:225
return e
Definition: Volumes.cpp:297
std::vector< std::pair< Material, double > > MaterialVec
const Material & materialAt(const DDSurfaces::Vector3D &pos)
const MaterialVec & materialsBetween(const DDSurfaces::Vector3D &p0, const DDSurfaces::Vector3D &p1, double epsilon=1e-4)
MaterialData createAveragedMaterial(const MaterialVec &materials)
double radLength() const
Access the radiation length of the underlying material.
Definition: Objects.cpp:213
double A() const
atomic number of the underlying material
Definition: Objects.cpp:189
std::ostream & operator<<(std::ostream &io, const FixedPadSizeTPCData &d)
Definition: DetectorData.cpp:7
double Z() const
proton number of the underlying material
Definition: Objects.cpp:178
double density() const
density of the underlying material
Definition: Objects.cpp:201
TGeoShape TGeoMedium * m
Definition: Volumes.cpp:294