Logo ROOT   6.08/07
Reference Guide
TGeoMaterial.h
Go to the documentation of this file.
1 // @(#)root/geom:$Id$
2 // Author: Andrei Gheata 25/10/01
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TGeoMaterial
13 #define ROOT_TGeoMaterial
14 
15 #ifndef ROOT_TNamed
16 #include "TNamed.h"
17 #endif
18 
19 #ifndef ROOT_TAttFill
20 #include "TAttFill.h"
21 #endif
22 
23 #ifndef ROOT_TGeoElement
24 #include "TGeoElement.h"
25 #endif
26 
27 
28 // forward declarations
29 class TGeoExtension;
30 
31 // Some units used in G4
32 static const Double_t STP_temperature = 273.15; // [K]
33 static const Double_t STP_pressure = 6.32420e+8; // [MeV/mm3]
34 
35 class TGeoMaterial : public TNamed,
36  public TAttFill
37 {
38 public:
39  enum EGeoMaterial {
40  kMatUsed = BIT(17),
42  };
48  };
49 
50 protected:
51  Int_t fIndex; // material index
52  Double_t fA; // A of material
53  Double_t fZ; // Z of material
54  Double_t fDensity; // density of material
55  Double_t fRadLen; // radiation length
56  Double_t fIntLen; // interaction length
57  Double_t fTemperature; // temperature
58  Double_t fPressure; // pressure
59  EGeoMaterialState fState; // material state
60  TObject *fShader; // shader with optical properties
61  TObject *fCerenkov; // pointer to class with Cerenkov properties
62  TGeoElement *fElement; // pointer to element composing the material
63  TGeoExtension *fUserExtension; //! Transient user-defined extension to materials
64  TGeoExtension *fFWExtension; //! Transient framework-defined extension to materials
65 
66 // methods
67  TGeoMaterial(const TGeoMaterial&);
69 
70 
71 public:
72  // constructors
73  TGeoMaterial();
74  TGeoMaterial(const char *name);
75  TGeoMaterial(const char *name, Double_t a, Double_t z,
76  Double_t rho, Double_t radlen=0, Double_t intlen=0);
77  TGeoMaterial(const char *name, Double_t a, Double_t z, Double_t rho,
78  EGeoMaterialState state, Double_t temperature=STP_temperature, Double_t pressure=STP_pressure);
79  TGeoMaterial(const char *name, TGeoElement *elem, Double_t rho);
80 
81  // destructor
82  virtual ~TGeoMaterial();
83  // methods
84  static Double_t Coulomb(Double_t z);
85  // radioactive mixture evolution
86  virtual TGeoMaterial *DecayMaterial(Double_t time, Double_t precision=0.001);
87  virtual void FillMaterialEvolution(TObjArray *population, Double_t precision=0.001);
88  // getters & setters
89  virtual Int_t GetByteCount() const {return sizeof(*this);}
90  virtual Double_t GetA() const {return fA;}
91  virtual Double_t GetZ() const {return fZ;}
92  virtual Int_t GetDefaultColor() const;
93  virtual Double_t GetDensity() const {return fDensity;}
94  virtual Int_t GetNelements() const {return 1;}
95  virtual TGeoElement *GetElement(Int_t i=0) const;
96  virtual void GetElementProp(Double_t &a, Double_t &z, Double_t &w, Int_t i=0);
97  TGeoElement *GetBaseElement() const {return fElement;}
98  char *GetPointerName() const;
99  virtual Double_t GetRadLen() const {return fRadLen;}
100  virtual Double_t GetIntLen() const {return fIntLen;}
101  Int_t GetIndex();
102  virtual TObject *GetCerenkovProperties() const {return fCerenkov;}
103  Char_t GetTransparency() const {return (fFillStyle<3000 || fFillStyle>3100)?0:Char_t(fFillStyle-3000);}
105  Double_t GetPressure() const {return fPressure;}
107  virtual Double_t GetSpecificActivity(Int_t) const {return 0.;}
112  virtual Bool_t IsEq(const TGeoMaterial *other) const;
114  virtual Bool_t IsMixture() const {return kFALSE;}
115  virtual void Print(const Option_t *option="") const;
116  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
117  void SetA(Double_t a) {fA = a; SetRadLen(0);}
118  void SetZ(Double_t z) {fZ = z; SetRadLen(0);}
119  void SetDensity(Double_t density) {fDensity = density; SetRadLen(0);}
120  void SetIndex(Int_t index) {fIndex=index;}
121  virtual void SetCerenkovProperties(TObject* cerenkov) {fCerenkov = cerenkov;}
122  void SetRadLen(Double_t radlen, Double_t intlen=0.);
124  void SetTransparency(Char_t transparency=0) {fFillStyle = 3000+transparency;}
125  void SetTemperature(Double_t temperature) {fTemperature = temperature;}
126  void SetPressure(Double_t pressure) {fPressure = pressure;}
127  void SetState(EGeoMaterialState state) {fState = state;}
128  void SetUserExtension(TGeoExtension *ext);
129  void SetFWExtension(TGeoExtension *ext);
130  static Double_t ScreenFactor(Double_t z);
131 
132 
133 
134  ClassDef(TGeoMaterial, 5) // base material class
135 
136 //***** Need to add classes and globals to LinkDef.h *****
137 };
138 
139 ////////////////////////////////////////////////////////////////////////////
140 // //
141 // TGeoMixture - mixtures of elements //
142 // //
143 ////////////////////////////////////////////////////////////////////////////
144 
145 class TGeoMixture : public TGeoMaterial
146 {
147 protected :
148 // data members
149  Int_t fNelements; // number of elements
150  Double_t *fZmixture; // [fNelements] array of Z of the elements
151  Double_t *fAmixture; // [fNelements] array of A of the elements
152  Double_t *fWeights; // [fNelements] array of relative proportions by mass
153  Int_t *fNatoms; // [fNelements] array of numbers of atoms
154  TObjArray *fElements; // array of elements composing the mixture
155 // methods
156  TGeoMixture(const TGeoMixture&); // Not implemented
157  TGeoMixture& operator=(const TGeoMixture&); // Not implemented
158  void AverageProperties();
159 
160 public:
161  // constructors
162  TGeoMixture();
163  TGeoMixture(const char *name, Int_t nel, Double_t rho=-1);
164  // destructor
165  virtual ~TGeoMixture();
166  // methods for adding elements
167  void AddElement(Double_t a, Double_t z, Double_t weight);
168  void AddElement(TGeoMaterial *mat, Double_t weight);
169  void AddElement(TGeoElement *elem, Double_t weight);
170  void AddElement(TGeoElement *elem, Int_t natoms);
171  // backward compatibility for defining elements
172  void DefineElement(Int_t iel, Double_t a, Double_t z, Double_t weight);
173  void DefineElement(Int_t iel, TGeoElement *elem, Double_t weight);
174  void DefineElement(Int_t iel, Int_t z, Int_t natoms);
175  // radioactive mixture evolution
176  virtual TGeoMaterial *DecayMaterial(Double_t time, Double_t precision=0.001);
177  virtual void FillMaterialEvolution(TObjArray *population, Double_t precision=0.001);
178  // getters
179  virtual Int_t GetByteCount() const {return 48+12*fNelements;}
180  virtual TGeoElement *GetElement(Int_t i=0) const;
181  virtual void GetElementProp(Double_t &a, Double_t &z, Double_t &w, Int_t i=0) {a=fAmixture[i]; z=fZmixture[i]; w=fWeights[i];}
182  virtual Int_t GetNelements() const {return fNelements;}
183  Double_t *GetZmixt() const {return fZmixture;}
184  Double_t *GetAmixt() const {return fAmixture;}
185  Double_t *GetWmixt() const {return fWeights;}
186  Int_t *GetNmixt() const {return fNatoms;}
187  virtual Double_t GetSpecificActivity(Int_t i=-1) const;
188  // utilities
189  virtual Bool_t IsEq(const TGeoMaterial *other) const;
190  virtual Bool_t IsMixture() const {return kTRUE;}
191  virtual void Print(const Option_t *option="") const;
192  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
193  void SetA(Double_t a) {fA = a;}
194  void SetZ(Double_t z) {fZ = z;}
195 
196  ClassDef(TGeoMixture, 2) // material mixtures
197 };
198 
200  {return AddElement(a,z,weight);}
202  {return AddElement(elem,weight);}
203 
204 
205 #endif
206 
Int_t * fNatoms
Definition: TGeoMaterial.h:153
An array of TObjects.
Definition: TObjArray.h:39
void DefineElement(Int_t iel, Double_t a, Double_t z, Double_t weight)
Definition: TGeoMaterial.h:199
EGeoMaterialState GetState() const
Definition: TGeoMaterial.h:106
virtual Bool_t IsMixture() const
Definition: TGeoMaterial.h:190
Double_t * fWeights
Definition: TGeoMaterial.h:152
TGeoExtension * fFWExtension
Transient user-defined extension to materials.
Definition: TGeoMaterial.h:64
TObject * fCerenkov
Definition: TGeoMaterial.h:61
virtual Double_t GetDensity() const
Definition: TGeoMaterial.h:93
const char Option_t
Definition: RtypesCore.h:62
Int_t * GetNmixt() const
Definition: TGeoMaterial.h:186
Int_t fNelements
Definition: TGeoMaterial.h:149
Bool_t TestBit(UInt_t f) const
Definition: TObject.h:157
#define BIT(n)
Definition: Rtypes.h:120
Bool_t IsUsed() const
Definition: TGeoMaterial.h:113
virtual Double_t GetSpecificActivity(Int_t) const
Definition: TGeoMaterial.h:107
Double_t * GetWmixt() const
Definition: TGeoMaterial.h:185
void SetRadLen(Double_t radlen, Double_t intlen=0.)
Set radiation/absorption lengths.
Base class describing materials.
Definition: TGeoMaterial.h:35
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TArc * a
Definition: textangle.C:12
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual ~TGeoMaterial()
Destructor.
TGeoExtension * GetFWExtension() const
Definition: TGeoMaterial.h:109
static const Double_t STP_pressure
Definition: TGeoMaterial.h:33
TGeoElement * GetBaseElement() const
Definition: TGeoMaterial.h:97
virtual Int_t GetByteCount() const
Definition: TGeoMaterial.h:179
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:739
EGeoMaterialState fState
Definition: TGeoMaterial.h:59
Fill Area Attributes class.
Definition: TAttFill.h:24
#define ClassDef(name, id)
Definition: Rtypes.h:254
TGeoExtension * GrabFWExtension() const
Get a copy of the framework extension pointer.
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
void SetUserExtension(TGeoExtension *ext)
Connect user-defined extension to the material.
void SetA(Double_t a)
Definition: TGeoMaterial.h:193
Char_t GetTransparency() const
Definition: TGeoMaterial.h:103
Base class for chemical elements.
Definition: TGeoElement.h:46
virtual Double_t GetA() const
Definition: TGeoMaterial.h:90
virtual Double_t GetIntLen() const
Definition: TGeoMaterial.h:100
void SetIndex(Int_t index)
Definition: TGeoMaterial.h:120
virtual void GetElementProp(Double_t &a, Double_t &z, Double_t &w, Int_t i=0)
Single interface to get element properties.
Definition: TGeoMaterial.h:181
virtual void FillMaterialEvolution(TObjArray *population, Double_t precision=0.001)
Fills a user array with all the elements deriving from the possible decay of the top element composin...
static Double_t Coulomb(Double_t z)
static function Compute Coulomb correction for pair production and Brem REFERENCE : EGS MANUAL SLAC 2...
virtual Double_t GetZ() const
Definition: TGeoMaterial.h:91
Int_t GetIndex()
Retrieve material index in the list of materials.
virtual Int_t GetNelements() const
Definition: TGeoMaterial.h:94
Double_t fIntLen
Definition: TGeoMaterial.h:56
TGeoMaterial()
Default constructor.
Double_t GetPressure() const
Definition: TGeoMaterial.h:105
virtual TGeoMaterial * DecayMaterial(Double_t time, Double_t precision=0.001)
Create the material representing the decay product of this material at a given time.
Double_t fDensity
Definition: TGeoMaterial.h:54
virtual TObject * GetCerenkovProperties() const
Definition: TGeoMaterial.h:102
Double_t GetTemperature() const
Definition: TGeoMaterial.h:104
ABC for user objects attached to TGeoVolume or TGeoNode.
Definition: TGeoExtension.h:21
TGeoExtension * GetUserExtension() const
Definition: TGeoMaterial.h:108
char * GetPointerName() const
Provide a pointer name containing uid.
virtual Int_t GetNelements() const
Definition: TGeoMaterial.h:182
Double_t fTemperature
Definition: TGeoMaterial.h:57
TGeoElement * fElement
Definition: TGeoMaterial.h:62
void SetDensity(Double_t density)
Definition: TGeoMaterial.h:119
void SetFWExtension(TGeoExtension *ext)
Connect framework defined extension to the material.
void SetPressure(Double_t pressure)
Definition: TGeoMaterial.h:126
void SetZ(Double_t z)
Definition: TGeoMaterial.h:194
static const Double_t STP_temperature
Definition: TGeoMaterial.h:32
virtual TGeoElement * GetElement(Int_t i=0) const
Get a pointer to the element this material is made of.
Double_t * fZmixture
Definition: TGeoMaterial.h:150
Double_t fZ
Definition: TGeoMaterial.h:53
static Double_t ScreenFactor(Double_t z)
static function Compute screening factor for pair production and Bremsstrahlung REFERENCE : EGS MANUA...
Double_t * GetAmixt() const
Definition: TGeoMaterial.h:184
virtual Bool_t IsMixture() const
Definition: TGeoMaterial.h:114
void SetState(EGeoMaterialState state)
Definition: TGeoMaterial.h:127
double Double_t
Definition: RtypesCore.h:55
virtual void GetElementProp(Double_t &a, Double_t &z, Double_t &w, Int_t i=0)
Single interface to get element properties.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual Int_t GetDefaultColor() const
Get some default color related to this material.
Mother of all ROOT objects.
Definition: TObject.h:37
you should not use this method at all Int_t Int_t z
Definition: TRolke.cxx:630
Double_t fPressure
Definition: TGeoMaterial.h:58
char Char_t
Definition: RtypesCore.h:29
TObjArray * fElements
Definition: TGeoMaterial.h:154
void SetZ(Double_t z)
Definition: TGeoMaterial.h:118
void SetTemperature(Double_t temperature)
Definition: TGeoMaterial.h:125
Double_t fRadLen
Definition: TGeoMaterial.h:55
void SetUsed(Bool_t flag=kTRUE)
Definition: TGeoMaterial.h:123
TGeoExtension * fUserExtension
Definition: TGeoMaterial.h:63
Double_t fA
Definition: TGeoMaterial.h:52
void SetA(Double_t a)
Definition: TGeoMaterial.h:117
Double_t * GetZmixt() const
Definition: TGeoMaterial.h:183
virtual Int_t GetByteCount() const
Definition: TGeoMaterial.h:89
TGeoMaterial & operator=(const TGeoMaterial &)
assignment operator
virtual void SetCerenkovProperties(TObject *cerenkov)
Definition: TGeoMaterial.h:121
virtual Double_t GetRadLen() const
Definition: TGeoMaterial.h:99
Double_t * fAmixture
Definition: TGeoMaterial.h:151
TObject * fShader
Definition: TGeoMaterial.h:60
const Bool_t kTRUE
Definition: Rtypes.h:91
void SetTransparency(Char_t transparency=0)
Definition: TGeoMaterial.h:124
TGeoExtension * GrabUserExtension() const
Get a copy of the user extension pointer.
char name[80]
Definition: TGX11.cxx:109
virtual void Print(const Option_t *option="") const
print characteristics of this material
virtual Bool_t IsEq(const TGeoMaterial *other) const
return true if the other material has the same physical properties
Style_t fFillStyle
Fill area style.
Definition: TAttFill.h:28