DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Material.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_MATERIAL_H
14 #define DDREC_MATERIAL_H
15 
16 #include "DD4hep/Detector.h"
17 #include "DDRec/IMaterial.h"
18 #include "DD4hep/Objects.h"
19 
20 #include <list>
21 
22 namespace dd4hep {
23  namespace rec {
24 
25 
33  class MaterialData : public IMaterial{
34 
35  protected:
36  std::string _name ;
37  double _Z ;
38  double _A ;
39  double _rho ;
40  double _x0 ;
41  double _lambda ;
42 
43  public:
44 
47 
48  _name("unknown"),
49  _Z( -1. ),
50  _A( 0. ),
51  _rho( 0. ),
52  _x0( 0. ),
53  _lambda( 0.) {
54 
55  if( m.isValid() ) {
56 
57  _name= m.name() ;
58  _Z = m.Z() ;
59  _A = m.A() ;
60  _rho = m.density() ;
61  _x0 = m.radLength() ;
62  _lambda = m.intLength() ;
63 
64  }
65  }
66 
68  MaterialData() : _name("unknown"),
69  _Z( -1. ),
70  _A( 0. ),
71  _rho( 0. ),
72  _x0( 0. ),
73  _lambda( 0.) {}
74 
76  MaterialData( const std::string& nam, double Z_val, double A_val, double density_val, double radLength, double intLength )
77  : _name( nam ),
78  _Z( Z_val ),
79  _A( A_val ),
80  _rho( density_val ),
81  _x0( radLength ),
82  _lambda( intLength ) {}
83 
85  MaterialData( const MaterialData& m ) : _name( m.name() ),
86  _Z( m.Z() ),
87  _A( m.A() ),
88  _rho( m.density() ),
89  _x0( m.radiationLength() ),
90  _lambda( m.interactionLength() ) {}
91 
93  MaterialData( const IMaterial& m ) : _name( m.name() ),
94  _Z( m.Z() ),
95  _A( m.A() ),
96  _rho( m.density() ),
97  _x0( m.radiationLength() ),
98  _lambda( m.interactionLength() ) {}
99 
102  if ( this != &m ) {
103  _name = m._name ;
104  _Z = m._Z ;
105  _A = m._A ;
106  _rho = m._rho ;
107  _x0 = m._x0 ;
108  _lambda = m._lambda ;
109  }
110  return *this ;
111  }
112 
115  if ( this != &m ) {
116  _name = m.name() ;
117  _Z = m.Z() ;
118  _A = m.A() ;
119  _rho = m.density() ;
120  _x0 = m.radiationLength() ;
121  _lambda = m.interactionLength() ;
122  }
123  return *this ;
124  }
125 
128 
129  if( m.isValid() ) {
130 
131  _name = m.name() ;
132  _Z = m.Z() ;
133  _A = m.A() ;
134  _rho = m.density() ;
135  _x0 = m.radLength() ;
136  _lambda = m.intLength() ;
137 
138  } else {
139 
140  _name= "unknown";
141  _Z = -1. ;
142  _A = 0. ;
143  _rho = 0. ;
144  _x0 = 0. ;
145  _lambda = 0. ;
146  }
147 
148  return *this ;
149  }
150 
152  bool isValid() const { return ( _Z > 0. ) ; }
153 
155  virtual ~MaterialData() {}
156 
158  virtual std::string name() const { return _name ; }
159 
161  virtual double Z() const { return _Z ; }
162 
164  virtual double A() const { return _A ; }
165 
167  virtual double density() const { return _rho ; }
168 
170  virtual double radiationLength() const { return _x0 ; }
171 
173  virtual double interactionLength() const { return _lambda ; }
174 
175  };
176 
177 
178  } /* namespace */
179 } /* namespace */
180 
181 
182 
183 #endif // DDREC_MATERIAL_H
Objects.h
dd4hep::rec::IMaterial::interactionLength
virtual double interactionLength() const =0
interaction length - units ?
dd4hep::rec::MaterialData::MaterialData
MaterialData(const IMaterial &m)
Definition: Material.h:93
dd4hep::rec::MaterialData::name
virtual std::string name() const
material name
Definition: Material.h:158
dd4hep::rec::MaterialData::radiationLength
virtual double radiationLength() const
radiation length - tgeo units
Definition: Material.h:170
dd4hep::rec::MaterialData::density
virtual double density() const
density
Definition: Material.h:167
dd4hep::rec::MaterialData::operator=
MaterialData & operator=(const MaterialData &m)
copy assignement
Definition: Material.h:101
dd4hep::rec::IMaterial::radiationLength
virtual double radiationLength() const =0
radiation length - units ?
Detector.h
dd4hep::rec::MaterialData::interactionLength
virtual double interactionLength() const
interaction length - tgeo units
Definition: Material.h:173
dd4hep::Handle::isValid
bool isValid() const
Check the validity of the object held by the handle.
Definition: Handle.h:128
dd4hep::rec::MaterialData::MaterialData
MaterialData()
Definition: Material.h:68
dd4hep::Handle::name
const char * name() const
Access the object name (or "" if not supported by the object)
IMaterial.h
dd4hep::Material::intLength
double intLength() const
Access the interaction length of the underlying material.
Definition: Objects.cpp:221
dd4hep::Material::A
double A() const
atomic number of the underlying material
Definition: Objects.cpp:188
dd4hep::Material::density
double density() const
density of the underlying material
Definition: Objects.cpp:199
dd4hep::Material
Handle class describing a material.
Definition: Objects.h:272
dd4hep::rec::MaterialData::_rho
double _rho
Definition: Material.h:39
dd4hep::rec::MaterialData::_Z
double _Z
Definition: Material.h:37
dd4hep::rec::MaterialData::_lambda
double _lambda
Definition: Material.h:41
dd4hep::rec::MaterialData::MaterialData
MaterialData(const MaterialData &m)
Definition: Material.h:85
dd4hep::rec::MaterialData::~MaterialData
virtual ~MaterialData()
Definition: Material.h:155
dd4hep::rec::MaterialData::MaterialData
MaterialData(const std::string &nam, double Z_val, double A_val, double density_val, double radLength, double intLength)
Definition: Material.h:76
dd4hep::rec::MaterialData::_name
std::string _name
Definition: Material.h:36
dd4hep::Material::Z
double Z() const
proton number of the underlying material
Definition: Objects.cpp:176
dd4hep::rec::MaterialData::_x0
double _x0
Definition: Material.h:40
dd4hep::rec::IMaterial::A
virtual double A() const =0
averaged atomic number
dd4hep::rec::IMaterial::name
virtual std::string name() const =0
material name
dd4hep::rec::MaterialData::isValid
bool isValid() const
true if initialized
Definition: Material.h:152
dd4hep::rec::MaterialData::A
virtual double A() const
averaged atomic number
Definition: Material.h:164
dd4hep::rec::MaterialData
Definition: Material.h:33
dd4hep::rec::MaterialData::Z
virtual double Z() const
averaged proton number
Definition: Material.h:161
dd4hep::rec::MaterialData::_A
double _A
Definition: Material.h:38
dd4hep::rec::IMaterial::density
virtual double density() const =0
density - units ?
dd4hep::rec::IMaterial::Z
virtual double Z() const =0
averaged proton number
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::Material::radLength
double radLength() const
Access the radiation length of the underlying material.
Definition: Objects.cpp:210
dd4hep::rec::IMaterial
Definition: IMaterial.h:28
dd4hep::rec::MaterialData::MaterialData
MaterialData(Material m)
Definition: Material.h:46
dd4hep::rec::MaterialData::operator=
MaterialData & operator=(const Material &m)
assignment from Material
Definition: Material.h:127
dd4hep::rec::MaterialData::operator=
MaterialData & operator=(const IMaterial &m)
assignment from Material
Definition: Material.h:114