File indexing completed on 2025-01-18 09:55:25
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef DDREC_MATERIALMANAGER_H
0014 #define DDREC_MATERIALMANAGER_H
0015
0016 #include "DD4hep/Detector.h"
0017 #include "DD4hep/Objects.h"
0018 #include "DDRec/Vector3D.h"
0019 #include "DDRec/Material.h"
0020 #include "DD4hep/DD4hepUnits.h"
0021
0022 #include <vector>
0023
0024
0025 class TGeoManager ;
0026
0027 namespace dd4hep {
0028 namespace rec {
0029
0030 typedef std::vector< std::pair< Material, double > > MaterialVec;
0031 typedef std::vector< std::pair< PlacedVolume, double > > PlacementVec;
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041 class MaterialManager {
0042
0043 public:
0044
0045
0046 MaterialManager(Volume world);
0047
0048 #if defined(G__ROOT)
0049 MaterialManager() = default ;
0050 #else
0051 MaterialManager() = delete ;
0052 #endif
0053
0054 ~MaterialManager();
0055
0056
0057
0058
0059
0060
0061 const MaterialVec& materialsBetween(const Vector3D& p0, const Vector3D& p1 , double epsilon=1e-4 );
0062
0063
0064
0065 const PlacementVec& placementsBetween(const Vector3D& p0, const Vector3D& p1 , double epsilon=1e-4 );
0066
0067
0068
0069 const Material& materialAt(const Vector3D& pos );
0070
0071
0072
0073 PlacedVolume placementAt(const Vector3D& pos );
0074
0075
0076
0077
0078
0079 MaterialData createAveragedMaterial( const MaterialVec& materials ) ;
0080
0081 protected :
0082
0083 MaterialVec _mV ;
0084 Material _m ;
0085
0086 PlacedVolume _pv;
0087 PlacementVec _placeV;
0088
0089 Vector3D _p0 , _p1, _pos ;
0090
0091 TGeoManager* _tgeoMgr ;
0092 };
0093
0094
0095 inline std::ostream& operator<<( std::ostream& os , const Material& m ) {
0096 os << " " << m.name() << " Z: " << m.Z() << " A: " << m.A() << " density: " << m.density()
0097 << " radiationLength: " << m.radLength()
0098 << " interactionLength: " << m.intLength() ;
0099 return os ;
0100 }
0101
0102
0103 inline std::ostream& operator<<( std::ostream& os , const MaterialVec& m ) {
0104 for( unsigned i=0,n=m.size() ; i<n ; ++i ) {
0105 os << " material: " << m[i].first << " thickness: " << m[i].second << std::endl ;
0106 }
0107 return os ;
0108 }
0109
0110 }
0111 }
0112
0113
0114
0115 #endif