DD4hep  01.18
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
MaterialManager.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : F.Gaede
11 //
12 //==========================================================================
13 #ifndef DDREC_MATERIALMANAGER_H
14 #define DDREC_MATERIALMANAGER_H
15 
16 #include "DD4hep/Detector.h"
17 #include "DD4hep/Objects.h"
18 #include "DDRec/Vector3D.h"
19 #include "DDRec/Material.h"
20 #include "DD4hep/DD4hepUnits.h"
21 
22 #include <vector>
23 
24 
25 class TGeoManager ;
26 
27 namespace dd4hep {
28  namespace rec {
29 
32 
42 
43  public:
44 
46  MaterialManager(Volume world);
47 
48 #if defined(G__ROOT)
49  MaterialManager() = default ;
50 #else
51  MaterialManager() = delete ;
52 #endif
53 
55 
61  const MaterialVec& materialsBetween(const Vector3D& p0, const Vector3D& p1 , double epsilon=1e-4 );
62 
65  const PlacementVec& placementsBetween(const Vector3D& p0, const Vector3D& p1 , double epsilon=1e-4 );
66 
69  const Material& materialAt(const Vector3D& pos );
70 
73  PlacedVolume placementAt(const Vector3D& pos );
74 
79  MaterialData createAveragedMaterial( const MaterialVec& materials ) ;
80 
81  protected :
84  Material _m ;
86  PlacedVolume _pv;
91  TGeoManager* _tgeoMgr ;
92  };
93 
95  inline std::ostream& operator<<( std::ostream& os , const Material& m ) {
96  os << " " << m.name() << " Z: " << m.Z() << " A: " << m.A() << " density: " << m.density()
97  << " radiationLength: " << m.radLength()
98  << " interactionLength: " << m.intLength() ;
99  return os ;
100  }
101 
103  inline std::ostream& operator<<( std::ostream& os , const MaterialVec& m ) {
104  for( unsigned i=0,n=m.size() ; i<n ; ++i ) {
105  os << " material: " << m[i].first << " thickness: " << m[i].second << std::endl ;
106  }
107  return os ;
108  }
109 
110  } /* namespace rec */
111 } /* namespace dd4hep */
112 
113 
114 
115 #endif // DDREC_MATERIALMANAGER_H
std::vector< std::pair< Material, double > > MaterialVec
const Material & materialAt(const Vector3D &pos)
Get the material at the given position.
T endl(T...args)
std::ostream & operator<<(std::ostream &io, const FixedPadSizeTPCData &d)
const PlacementVec & placementsBetween(const Vector3D &p0, const Vector3D &p1, double epsilon=1e-4)
Get a vector with all the placements between the two points p0 and p1.
Simple three dimensional vector providing the components for cartesian, cylindrical and spherical coo...
Definition: Vector3D.h:32
PlacedVolume placementAt(const Vector3D &pos)
Get the placed volume at the given position.
const MaterialVec & materialsBetween(const Vector3D &p0, const Vector3D &p1, double epsilon=1e-4)
Get a vector with all the materials between the two points p0 and p1 with the corresponding thickness...
Vector3D _p0
cached last points
MaterialData createAveragedMaterial(const MaterialVec &materials)
Create a material with averaged properties from all materials in the list.
MaterialVec _mV
Cached materials.
TGeoManager * _tgeoMgr
Reference to the TGeoManager.
T size(T...args)
Simple data class that implements the IMaterial interface and is used in the Surface implementation...
Definition: Material.h:33
std::vector< std::pair< PlacedVolume, double > > PlacementVec
STL class.
PlacedVolume _pv
Cached nodes.
Material manager provides access to the material properties of the detector.