DD4hep  01.18
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
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:
37  double _Z ;
38  double _A ;
39  double _rho ;
40  double _x0 ;
41  double _lambda ;
42 
43  public:
44 
46  MaterialData( Material m ) :
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 
127  MaterialData& operator=(const Material& m){
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
virtual double radiationLength() const
radiation length - tgeo units
Definition: Material.h:170
virtual double interactionLength() const
interaction length - tgeo units
Definition: Material.h:173
MaterialData & operator=(const Material &m)
assignment from Material
Definition: Material.h:127
MaterialData & operator=(const IMaterial &m)
assignment from Material
Definition: Material.h:114
MaterialData()
Default c&#39;tor .
Definition: Material.h:68
MaterialData(const MaterialData &m)
Copy c&#39;tor .
Definition: Material.h:85
bool isValid() const
true if initialized
Definition: Material.h:152
STL class.
virtual ~MaterialData()
D&#39;tor.
Definition: Material.h:155
MaterialData(const std::string &nam, double Z_val, double A_val, double density_val, double radLength, double intLength)
C&#39;tor setting all attributes .
Definition: Material.h:76
virtual double Z() const =0
averaged proton number
virtual std::string name() const
material name
Definition: Material.h:158
virtual double density() const
density
Definition: Material.h:167
virtual double radiationLength() const =0
radiation length - units ?
virtual double interactionLength() const =0
interaction length - units ?
virtual double A() const
averaged atomic number
Definition: Material.h:164
virtual std::string name() const =0
material name
Simple data class that implements the IMaterial interface and is used in the Surface implementation...
Definition: Material.h:33
virtual double A() const =0
averaged atomic number
virtual double density() const =0
density - units ?
MaterialData(const IMaterial &m)
Copy c&#39;tor .
Definition: Material.h:93
virtual double Z() const
averaged proton number
Definition: Material.h:161
MaterialData & operator=(const MaterialData &m)
copy assignement
Definition: Material.h:101
Interface for material description for tracking.
Definition: IMaterial.h:28
MaterialData(Material m)
Instantiate from Material - default initialization if handle is not valid.
Definition: Material.h:46