File indexing completed on 2025-12-16 10:12:44
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 static constexpr const double epsilon = 1e-4;
0045
0046 public:
0047
0048
0049 MaterialManager(Volume world);
0050
0051 #if defined(G__ROOT)
0052 MaterialManager() = default ;
0053 #else
0054 MaterialManager() = delete ;
0055 #endif
0056
0057 ~MaterialManager();
0058
0059 class ScanData {
0060 public:
0061 const MaterialVec& materials;
0062 const PlacementVec& places;
0063 };
0064
0065
0066
0067
0068
0069
0070 const MaterialVec& materialsBetween(const Vector3D& p0,
0071 const Vector3D& p1,
0072 double eps = MaterialManager::epsilon);
0073
0074 const ScanData entriesBetween(const Vector3D& p0,
0075 const Vector3D& p1,
0076 double eps = MaterialManager::epsilon);
0077
0078
0079
0080 const PlacementVec& placementsBetween(const Vector3D& p0, const Vector3D& p1 , double eps = MaterialManager::epsilon );
0081
0082
0083
0084 const Material& materialAt(const Vector3D& pos );
0085
0086
0087
0088 PlacedVolume placementAt(const Vector3D& pos );
0089
0090
0091
0092
0093
0094 MaterialData createAveragedMaterial( const MaterialVec& materials ) ;
0095
0096 protected :
0097
0098 MaterialVec _mV ;
0099 Material _m ;
0100
0101 PlacedVolume _pv;
0102 PlacementVec _placeV;
0103
0104 Vector3D _p0 , _p1, _pos ;
0105
0106 TGeoManager* _tgeoMgr ;
0107 };
0108
0109
0110 inline std::ostream& operator<<( std::ostream& os , const Material& m ) {
0111 os << " " << m.name() << " Z: " << m.Z() << " A: " << m.A() << " density: " << m.density()
0112 << " radiationLength: " << m.radLength()
0113 << " interactionLength: " << m.intLength() ;
0114 return os ;
0115 }
0116
0117
0118 inline std::ostream& operator<<( std::ostream& os , const MaterialVec& m ) {
0119 for( unsigned i=0,n=m.size() ; i<n ; ++i ) {
0120 os << " material: " << m[i].first << " thickness: " << m[i].second << std::endl ;
0121 }
0122 return os ;
0123 }
0124
0125 }
0126 }
0127
0128
0129
0130 #endif