DD4hep  1.30.0
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 
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 :
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
dd4hep::rec::MaterialManager::materialAt
const Material & materialAt(const Vector3D &pos)
Definition: MaterialManager.cpp:166
dd4hep::rec::MaterialManager::_mV
MaterialVec _mV
Cached materials.
Definition: MaterialManager.h:83
Objects.h
dd4hep::rec::Vector3D
Definition: Vector3D.h:32
Detector.h
dd4hep::rec::MaterialManager::createAveragedMaterial
MaterialData createAveragedMaterial(const MaterialVec &materials)
Definition: MaterialManager.cpp:196
dd4hep::PlacedVolume
Handle class holding a placed volume (also called physical volume)
Definition: Volumes.h:173
dd4hep::rec::MaterialManager::_p1
Vector3D _p1
Definition: MaterialManager.h:89
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::Material::intLength
double intLength() const
Access the interaction length of the underlying material.
Definition: Objects.cpp:221
dd4hep::rec::MaterialManager::_pv
PlacedVolume _pv
Cached nodes.
Definition: MaterialManager.h:86
dd4hep::Material::A
double A() const
atomic number of the underlying material
Definition: Objects.cpp:188
dd4hep::rec::MaterialManager::_pos
Vector3D _pos
Definition: MaterialManager.h:89
epsilon
const double epsilon
Definition: test_cellid_position_converter.cpp:41
dd4hep::Material::density
double density() const
density of the underlying material
Definition: Objects.cpp:199
dd4hep::rec::MaterialManager::~MaterialManager
~MaterialManager()
Definition: MaterialManager.cpp:31
dd4hep::Material
Handle class describing a material.
Definition: Objects.h:272
dd4hep::Volume
Handle class holding a placed volume (also called physical volume)
Definition: Volumes.h:378
dd4hep::rec::MaterialManager::_m
Material _m
Definition: MaterialManager.h:84
dd4hep::Material::Z
double Z() const
proton number of the underlying material
Definition: Objects.cpp:176
dd4hep::rec::MaterialManager
Definition: MaterialManager.h:41
dd4hep::rec::MaterialManager::placementsBetween
const PlacementVec & placementsBetween(const Vector3D &p0, const Vector3D &p1, double epsilon=1e-4)
Definition: MaterialManager.cpp:35
dd4hep::rec::MaterialManager::_p0
Vector3D _p0
cached last points
Definition: MaterialManager.h:89
dd4hep::rec::MaterialManager::_placeV
PlacementVec _placeV
Definition: MaterialManager.h:87
dd4hep::rec::MaterialManager::placementAt
PlacedVolume placementAt(const Vector3D &pos)
Definition: MaterialManager.cpp:181
dd4hep::rec::MaterialManager::materialsBetween
const MaterialVec & materialsBetween(const Vector3D &p0, const Vector3D &p1, double epsilon=1e-4)
Definition: MaterialManager.cpp:40
dd4hep::rec::MaterialData
Definition: Material.h:33
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::operator<<
std::ostream & operator<<(std::ostream &io, const DCH_info &d)
Definition: DCH_info.h:186
dd4hep::rec::MaterialManager::_tgeoMgr
TGeoManager * _tgeoMgr
Reference to the TGeoManager.
Definition: MaterialManager.h:91
dd4hep::Material::radLength
double radLength() const
Access the radiation length of the underlying material.
Definition: Objects.cpp:210
DD4hepUnits.h
Vector3D.h
Material.h