ROOT  6.06/09
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 /*************************************************************************
13  * TGeoMaterial - package description
14  *
15  *
16  *
17  *************************************************************************/
18 
19 #ifndef ROOT_TGeoMaterial
20 #define ROOT_TGeoMaterial
21 
22 #ifndef ROOT_TNamed
23 #include "TNamed.h"
24 #endif
25 
26 #ifndef ROOT_TAttFill
27 #include "TAttFill.h"
28 #endif
29 
30 #ifndef ROOT_TGeoElement
31 #include "TGeoElement.h"
32 #endif
33 
34 
35 // forward declarations
36 class TGeoExtension;
37 
38 ////////////////////////////////////////////////////////////////////////////
39 // //
40 // TGeoMaterial - base class describing materials //
41 // //
42 ////////////////////////////////////////////////////////////////////////////
43 
44 // Some units used in G4
45 static const Double_t STP_temperature = 273.15; // [K]
46 static const Double_t STP_pressure = 6.32420e+8; // [MeV/mm3]
47 
48 class TGeoMaterial : public TNamed,
49  public TAttFill
50 {
51 public:
52  enum EGeoMaterial {
53  kMatUsed = BIT(17),
55  };
61  };
62 
63 protected:
64  Int_t fIndex; // material index
65  Double_t fA; // A of material
66  Double_t fZ; // Z of material
67  Double_t fDensity; // density of material
68  Double_t fRadLen; // radiation length
69  Double_t fIntLen; // interaction length
70  Double_t fTemperature; // temperature
71  Double_t fPressure; // pressure
72  EGeoMaterialState fState; // material state
73  TObject *fShader; // shader with optical properties
74  TObject *fCerenkov; // pointer to class with Cerenkov properties
75  TGeoElement *fElement; // pointer to element composing the material
76  TGeoExtension *fUserExtension; //! Transient user-defined extension to materials
77  TGeoExtension *fFWExtension; //! Transient framework-defined extension to materials
78 
79 // methods
80  TGeoMaterial(const TGeoMaterial&);
82 
83 
84 public:
85  // constructors
86  TGeoMaterial();
87  TGeoMaterial(const char *name);
88  TGeoMaterial(const char *name, Double_t a, Double_t z,
89  Double_t rho, Double_t radlen=0, Double_t intlen=0);
90  TGeoMaterial(const char *name, Double_t a, Double_t z, Double_t rho,
91  EGeoMaterialState state, Double_t temperature=STP_temperature, Double_t pressure=STP_pressure);
92  TGeoMaterial(const char *name, TGeoElement *elem, Double_t rho);
93 
94  // destructor
95  virtual ~TGeoMaterial();
96  // methods
97  static Double_t Coulomb(Double_t z);
98  // radioactive mixture evolution
99  virtual TGeoMaterial *DecayMaterial(Double_t time, Double_t precision=0.001);
100  virtual void FillMaterialEvolution(TObjArray *population, Double_t precision=0.001);
101  // getters & setters
102  virtual Int_t GetByteCount() const {return sizeof(*this);}
103  virtual Double_t GetA() const {return fA;}
104  virtual Double_t GetZ() const {return fZ;}
105  virtual Int_t GetDefaultColor() const;
106  virtual Double_t GetDensity() const {return fDensity;}
107  virtual Int_t GetNelements() const {return 1;}
108  virtual TGeoElement *GetElement(Int_t i=0) const;
109  virtual void GetElementProp(Double_t &a, Double_t &z, Double_t &w, Int_t i=0);
111  char *GetPointerName() const;
112  virtual Double_t GetRadLen() const {return fRadLen;}
113  virtual Double_t GetIntLen() const {return fIntLen;}
114  Int_t GetIndex();
115  virtual TObject *GetCerenkovProperties() const {return fCerenkov;}
116  Char_t GetTransparency() const {return (fFillStyle<3000 || fFillStyle>3100)?0:Char_t(fFillStyle-3000);}
118  Double_t GetPressure() const {return fPressure;}
120  virtual Double_t GetSpecificActivity(Int_t) const {return 0.;}
125  virtual Bool_t IsEq(const TGeoMaterial *other) const;
127  virtual Bool_t IsMixture() const {return kFALSE;}
128  virtual void Print(const Option_t *option="") const;
129  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
130  void SetA(Double_t a) {fA = a; SetRadLen(0);}
131  void SetZ(Double_t z) {fZ = z; SetRadLen(0);}
132  void SetDensity(Double_t density) {fDensity = density; SetRadLen(0);}
133  void SetIndex(Int_t index) {fIndex=index;}
134  virtual void SetCerenkovProperties(TObject* cerenkov) {fCerenkov = cerenkov;}
135  void SetRadLen(Double_t radlen, Double_t intlen=0.);
137  void SetTransparency(Char_t transparency=0) {fFillStyle = 3000+transparency;}
138  void SetTemperature(Double_t temperature) {fTemperature = temperature;}
139  void SetPressure(Double_t pressure) {fPressure = pressure;}
140  void SetState(EGeoMaterialState state) {fState = state;}
141  void SetUserExtension(TGeoExtension *ext);
142  void SetFWExtension(TGeoExtension *ext);
143  static Double_t ScreenFactor(Double_t z);
144 
145 
146 
147  ClassDef(TGeoMaterial, 5) // base material class
148 
149 //***** Need to add classes and globals to LinkDef.h *****
150 };
151 
152 ////////////////////////////////////////////////////////////////////////////
153 // //
154 // TGeoMixture - mixtures of elements //
155 // //
156 ////////////////////////////////////////////////////////////////////////////
157 
158 class TGeoMixture : public TGeoMaterial
159 {
160 protected :
161 // data members
162  Int_t fNelements; // number of elements
163  Double_t *fZmixture; // [fNelements] array of Z of the elements
164  Double_t *fAmixture; // [fNelements] array of A of the elements
165  Double_t *fWeights; // [fNelements] array of relative proportions by mass
166  Int_t *fNatoms; // [fNelements] array of numbers of atoms
167  TObjArray *fElements; // array of elements composing the mixture
168 // methods
169  TGeoMixture(const TGeoMixture&); // Not implemented
170  TGeoMixture& operator=(const TGeoMixture&); // Not implemented
171  void AverageProperties();
172 
173 public:
174  // constructors
175  TGeoMixture();
176  TGeoMixture(const char *name, Int_t nel, Double_t rho=-1);
177  // destructor
178  virtual ~TGeoMixture();
179  // methods for adding elements
180  void AddElement(Double_t a, Double_t z, Double_t weight);
181  void AddElement(TGeoMaterial *mat, Double_t weight);
182  void AddElement(TGeoElement *elem, Double_t weight);
183  void AddElement(TGeoElement *elem, Int_t natoms);
184  // backward compatibility for defining elements
185  void DefineElement(Int_t iel, Double_t a, Double_t z, Double_t weight);
186  void DefineElement(Int_t iel, TGeoElement *elem, Double_t weight);
187  void DefineElement(Int_t iel, Int_t z, Int_t natoms);
188  // radioactive mixture evolution
189  virtual TGeoMaterial *DecayMaterial(Double_t time, Double_t precision=0.001);
190  virtual void FillMaterialEvolution(TObjArray *population, Double_t precision=0.001);
191  // getters
192  virtual Int_t GetByteCount() const {return 48+12*fNelements;}
193  virtual TGeoElement *GetElement(Int_t i=0) const;
194  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];}
195  virtual Int_t GetNelements() const {return fNelements;}
196  Double_t *GetZmixt() const {return fZmixture;}
197  Double_t *GetAmixt() const {return fAmixture;}
198  Double_t *GetWmixt() const {return fWeights;}
199  Int_t *GetNmixt() const {return fNatoms;}
200  virtual Double_t GetSpecificActivity(Int_t i=-1) const;
201  // utilities
202  virtual Bool_t IsEq(const TGeoMaterial *other) const;
203  virtual Bool_t IsMixture() const {return kTRUE;}
204  virtual void Print(const Option_t *option="") const;
205  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
206  void SetA(Double_t a) {fA = a;}
207  void SetZ(Double_t z) {fZ = z;}
208 
209  ClassDef(TGeoMixture, 2) // material mixtures
210 };
211 
213  {return AddElement(a,z,weight);}
215  {return AddElement(elem,weight);}
216 
217 
218 #endif
219 
Int_t * fNatoms
Definition: TGeoMaterial.h:166
virtual Int_t GetNelements() const
Definition: TGeoMaterial.h:107
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:212
Double_t * fWeights
Definition: TGeoMaterial.h:165
TGeoExtension * GetFWExtension() const
Definition: TGeoMaterial.h:122
TGeoExtension * fFWExtension
Transient user-defined extension to materials.
Definition: TGeoMaterial.h:77
TObject * fCerenkov
Definition: TGeoMaterial.h:74
const char Option_t
Definition: RtypesCore.h:62
Int_t fNelements
Definition: TGeoMaterial.h:162
Double_t * GetZmixt() const
Definition: TGeoMaterial.h:196
#define BIT(n)
Definition: Rtypes.h:120
Double_t GetPressure() const
Definition: TGeoMaterial.h:118
void SetRadLen(Double_t radlen, Double_t intlen=0.)
Set radiation/absorbtion lengths.
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 Int_t GetDefaultColor() const
Get some default color related to this material.
virtual ~TGeoMaterial()
Destructor.
void AverageProperties()
Compute effective A/Z and radiation length.
static const Double_t STP_pressure
Definition: TGeoMaterial.h:46
virtual TGeoElement * GetElement(Int_t i=0) const
Get a pointer to the element this material is made of.
virtual Bool_t IsMixture() const
Definition: TGeoMaterial.h:203
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:732
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 elements composi...
virtual Double_t GetSpecificActivity(Int_t i=-1) const
Get specific activity (in Bq/gram) for the whole mixture (no argument) or for a given component...
EGeoMaterialState fState
Definition: TGeoMaterial.h:72
Fill Area Attributes class.
Definition: TAttFill.h:32
#define ClassDef(name, id)
Definition: Rtypes.h:254
Double_t * GetWmixt() const
Definition: TGeoMaterial.h:198
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:206
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual Bool_t IsMixture() const
Definition: TGeoMaterial.h:127
void SetIndex(Int_t index)
Definition: TGeoMaterial.h:133
virtual TGeoElement * GetElement(Int_t i=0) const
Retreive the pointer to the element corresponding to component I.
TGeoElement * GetBaseElement() const
Definition: TGeoMaterial.h:110
virtual Int_t GetByteCount() const
Definition: TGeoMaterial.h:192
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:194
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...
char * out
Definition: TBase64.cxx:29
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 GetA() const
Definition: TGeoMaterial.h:103
EGeoMaterialState GetState() const
Definition: TGeoMaterial.h:119
Int_t GetIndex()
Retreive material index in the list of materials.
void AddElement(Double_t a, Double_t z, Double_t weight)
add an element to the mixture using fraction by weight Check if the element is already defined ...
virtual Double_t GetIntLen() const
Definition: TGeoMaterial.h:113
Double_t fIntLen
Definition: TGeoMaterial.h:69
Char_t GetTransparency() const
Definition: TGeoMaterial.h:116
virtual Int_t GetNelements() const
Definition: TGeoMaterial.h:195
virtual Bool_t IsEq(const TGeoMaterial *other) const
Return true if the other material has the same physical properties.
Int_t * GetNmixt() const
Definition: TGeoMaterial.h:199
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:67
char * GetPointerName() const
Provide a pointer name containing uid.
TGeoMixture & operator=(const TGeoMixture &)
assignment operator
TGeoExtension * GrabUserExtension() const
Get a copy of the user extension pointer.
Double_t GetTemperature() const
Definition: TGeoMaterial.h:117
Double_t fTemperature
Definition: TGeoMaterial.h:70
Bool_t TestBit(UInt_t f) const
Definition: TObject.h:173
TGeoElement * fElement
Definition: TGeoMaterial.h:75
void SetDensity(Double_t density)
Definition: TGeoMaterial.h:132
void SetFWExtension(TGeoExtension *ext)
Connect framework defined extension to the material.
void SetPressure(Double_t pressure)
Definition: TGeoMaterial.h:139
Bool_t IsUsed() const
Definition: TGeoMaterial.h:126
void SetZ(Double_t z)
Definition: TGeoMaterial.h:207
static const Double_t STP_temperature
Definition: TGeoMaterial.h:45
virtual TObject * GetCerenkovProperties() const
Definition: TGeoMaterial.h:115
Double_t * fZmixture
Definition: TGeoMaterial.h:163
Double_t fZ
Definition: TGeoMaterial.h:66
static Double_t ScreenFactor(Double_t z)
static function Compute screening factor for pair production and Bremstrahlung REFERENCE : EGS MANUAL...
virtual ~TGeoMixture()
Destructor.
void SetState(EGeoMaterialState state)
Definition: TGeoMaterial.h:140
double Double_t
Definition: RtypesCore.h:55
virtual Double_t GetSpecificActivity(Int_t) const
Definition: TGeoMaterial.h:120
virtual void Print(const Option_t *option="") const
print characteristics of this material
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".
Double_t * GetAmixt() const
Definition: TGeoMaterial.h:197
#define name(a, b)
Definition: linkTestLib0.cpp:5
virtual Double_t GetZ() const
Definition: TGeoMaterial.h:104
Mother of all ROOT objects.
Definition: TObject.h:58
Double_t fPressure
Definition: TGeoMaterial.h:71
char Char_t
Definition: RtypesCore.h:29
virtual Double_t GetRadLen() const
Definition: TGeoMaterial.h:112
TObjArray * fElements
Definition: TGeoMaterial.h:167
void SetZ(Double_t z)
Definition: TGeoMaterial.h:131
void SetTemperature(Double_t temperature)
Definition: TGeoMaterial.h:138
TGeoExtension * GetUserExtension() const
Definition: TGeoMaterial.h:121
Double_t fRadLen
Definition: TGeoMaterial.h:68
virtual Double_t GetDensity() const
Definition: TGeoMaterial.h:106
void SetUsed(Bool_t flag=kTRUE)
Definition: TGeoMaterial.h:136
TGeoExtension * fUserExtension
Definition: TGeoMaterial.h:76
Double_t fA
Definition: TGeoMaterial.h:65
void SetA(Double_t a)
Definition: TGeoMaterial.h:130
TGeoMaterial & operator=(const TGeoMaterial &)
assignment operator
virtual TGeoMaterial * DecayMaterial(Double_t time, Double_t precision=0.001)
Create the mixture representing the decay product of this material at a given time.
virtual void SetCerenkovProperties(TObject *cerenkov)
Definition: TGeoMaterial.h:134
Double_t * fAmixture
Definition: TGeoMaterial.h:164
TObject * fShader
Definition: TGeoMaterial.h:73
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual void Print(const Option_t *option="") const
print characteristics of this material
void SetTransparency(Char_t transparency=0)
Definition: TGeoMaterial.h:137
virtual Bool_t IsEq(const TGeoMaterial *other) const
return true if the other material has the same physical properties
TGeoExtension * GrabFWExtension() const
Get a copy of the framework extension pointer.
virtual Int_t GetByteCount() const
Definition: TGeoMaterial.h:102
Style_t fFillStyle
Definition: TAttFill.h:36