DD4hep  1.32.1
Detector Description Toolkit for High Energy Physics
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 
30  typedef std::vector< std::pair< Material, double > > MaterialVec;
31  typedef std::vector< std::pair< PlacedVolume, double > > PlacementVec;
32 
42 
43  public:
44  static constexpr const double epsilon = 1e-4;
45 
46  public:
47 
49  MaterialManager(Volume world);
50 
51 #if defined(G__ROOT)
52  MaterialManager() = default ;
53 #else
54  MaterialManager() = delete ;
55 #endif
56 
58 
59  class ScanData {
60  public:
63  };
64 
70  const MaterialVec& materialsBetween(const Vector3D& p0,
71  const Vector3D& p1,
72  double eps = MaterialManager::epsilon);
74  const ScanData entriesBetween(const Vector3D& p0,
75  const Vector3D& p1,
76  double eps = MaterialManager::epsilon);
77 
80  const PlacementVec& placementsBetween(const Vector3D& p0, const Vector3D& p1 , double eps = MaterialManager::epsilon );
81 
84  const Material& materialAt(const Vector3D& pos );
85 
88  PlacedVolume placementAt(const Vector3D& pos );
89 
94  MaterialData createAveragedMaterial( const MaterialVec& materials ) ;
95 
96  protected :
106  TGeoManager* _tgeoMgr ;
107  };
108 
110  inline std::ostream& operator<<( std::ostream& os , const Material& m ) {
111  os << " " << m.name() << " Z: " << m.Z() << " A: " << m.A() << " density: " << m.density()
112  << " radiationLength: " << m.radLength()
113  << " interactionLength: " << m.intLength() ;
114  return os ;
115  }
116 
118  inline std::ostream& operator<<( std::ostream& os , const MaterialVec& m ) {
119  for( unsigned i=0,n=m.size() ; i<n ; ++i ) {
120  os << " material: " << m[i].first << " thickness: " << m[i].second << std::endl ;
121  }
122  return os ;
123  }
124 
125  } /* namespace rec */
126 } /* namespace dd4hep */
127 
128 
129 
130 #endif // DDREC_MATERIALMANAGER_H
dd4hep::rec::MaterialManager::ScanData
Definition: MaterialManager.h:59
dd4hep::rec::MaterialManager::materialAt
const Material & materialAt(const Vector3D &pos)
Definition: MaterialManager.cpp:178
dd4hep::rec::MaterialManager::_mV
MaterialVec _mV
Cached materials.
Definition: MaterialManager.h:98
Objects.h
dd4hep::rec::MaterialManager::placementsBetween
const PlacementVec & placementsBetween(const Vector3D &p0, const Vector3D &p1, double eps=MaterialManager::epsilon)
Definition: MaterialManager.cpp:35
dd4hep::rec::Vector3D
Definition: Vector3D.h:32
dd4hep::rec::MaterialManager::materialsBetween
const MaterialVec & materialsBetween(const Vector3D &p0, const Vector3D &p1, double eps=MaterialManager::epsilon)
Definition: MaterialManager.cpp:47
Detector.h
dd4hep::rec::MaterialManager::createAveragedMaterial
MaterialData createAveragedMaterial(const MaterialVec &materials)
Definition: MaterialManager.cpp:208
dd4hep::PlacedVolume
Handle class holding a placed volume (also called physical volume)
Definition: Volumes.h:164
dd4hep::rec::MaterialManager::_p1
Vector3D _p1
Definition: MaterialManager.h:104
dd4hep::rec::MaterialVec
std::vector< std::pair< Material, double > > MaterialVec
Definition: MaterialManager.h:30
dd4hep::Handle::name
const char * name() const
Access the object name (or "" if not supported by the object)
dd4hep::rec::MaterialManager::epsilon
static constexpr const double epsilon
Definition: MaterialManager.h:44
dd4hep::Material::intLength
double intLength() const
Access the interaction length of the underlying material.
Definition: Objects.cpp:220
dd4hep::rec::MaterialManager::_pv
PlacedVolume _pv
Cached nodes.
Definition: MaterialManager.h:101
dd4hep::Material::A
double A() const
atomic number of the underlying material
Definition: Objects.cpp:187
dd4hep::rec::MaterialManager::_pos
Vector3D _pos
Definition: MaterialManager.h:104
dd4hep::Material::density
double density() const
density of the underlying material
Definition: Objects.cpp:198
dd4hep::rec::MaterialManager::~MaterialManager
~MaterialManager()
Definition: MaterialManager.cpp:31
dd4hep::Material
Handle class describing a material.
Definition: Objects.h:271
dd4hep::Volume
Handle class holding a placed volume (also called physical volume)
Definition: Volumes.h:371
dd4hep::rec::MaterialManager::_m
Material _m
Definition: MaterialManager.h:99
dd4hep::Material::Z
double Z() const
proton number of the underlying material
Definition: Objects.cpp:175
dd4hep::rec::MaterialManager
Definition: MaterialManager.h:41
dd4hep::rec::MaterialManager::_p0
Vector3D _p0
cached last points
Definition: MaterialManager.h:104
dd4hep::rec::MaterialManager::_placeV
PlacementVec _placeV
Definition: MaterialManager.h:102
dd4hep::rec::MaterialManager::placementAt
PlacedVolume placementAt(const Vector3D &pos)
Definition: MaterialManager.cpp:193
dd4hep::rec::MaterialData
Definition: Material.h:33
dd4hep::rec::MaterialManager::entriesBetween
const ScanData entriesBetween(const Vector3D &p0, const Vector3D &p1, double eps=MaterialManager::epsilon)
As above, but optionally allow access to traversed placements.
Definition: MaterialManager.cpp:40
dd4hep::rec::PlacementVec
std::vector< std::pair< PlacedVolume, double > > PlacementVec
Definition: MaterialManager.h:31
dd4hep::rec::MaterialManager::MaterialManager
MaterialManager()=delete
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::rec::MaterialManager::ScanData::places
const PlacementVec & places
Definition: MaterialManager.h:62
dd4hep::rec::operator<<
std::ostream & operator<<(std::ostream &io, const DCH_info &d)
Definition: DCH_info.h:197
dd4hep::rec::MaterialManager::_tgeoMgr
TGeoManager * _tgeoMgr
Reference to the TGeoManager.
Definition: MaterialManager.h:106
dd4hep::Material::radLength
double radLength() const
Access the radiation length of the underlying material.
Definition: Objects.cpp:209
dd4hep::rec::MaterialManager::ScanData::materials
const MaterialVec & materials
Definition: MaterialManager.h:61
DD4hepUnits.h
Vector3D.h
Material.h