Logo ROOT   6.10/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 #ifndef ROOT_TGeoMaterial
13 #define ROOT_TGeoMaterial
14 
15 #include "TNamed.h"
16 
17 #include "TAttFill.h"
18 
19 #include "TGeoElement.h"
20 
21 
22 // forward declarations
23 class TGeoExtension;
24 
25 // Some units used in G4
26 static const Double_t STP_temperature = 273.15; // [K]
27 static const Double_t STP_pressure = 6.32420e+8; // [MeV/mm3]
28 
29 class TGeoMaterial : public TNamed,
30  public TAttFill
31 {
32 public:
33  enum EGeoMaterial {
34  kMatUsed = BIT(17),
36  };
42  };
43 
44 protected:
45  Int_t fIndex; // material index
46  Double_t fA; // A of material
47  Double_t fZ; // Z of material
48  Double_t fDensity; // density of material
49  Double_t fRadLen; // radiation length
50  Double_t fIntLen; // interaction length
51  Double_t fTemperature; // temperature
52  Double_t fPressure; // pressure
53  EGeoMaterialState fState; // material state
54  TObject *fShader; // shader with optical properties
55  TObject *fCerenkov; // pointer to class with Cerenkov properties
56  TGeoElement *fElement; // pointer to element composing the material
57  TGeoExtension *fUserExtension; //! Transient user-defined extension to materials
58  TGeoExtension *fFWExtension; //! Transient framework-defined extension to materials
59 
60 // methods
61  TGeoMaterial(const TGeoMaterial&);
63 
64 
65 public:
66  // constructors
67  TGeoMaterial();
68  TGeoMaterial(const char *name);
69  TGeoMaterial(const char *name, Double_t a, Double_t z,
70  Double_t rho, Double_t radlen=0, Double_t intlen=0);
71  TGeoMaterial(const char *name, Double_t a, Double_t z, Double_t rho,
72  EGeoMaterialState state, Double_t temperature=STP_temperature, Double_t pressure=STP_pressure);
73  TGeoMaterial(const char *name, TGeoElement *elem, Double_t rho);
74 
75  // destructor
76  virtual ~TGeoMaterial();
77  // methods
78  static Double_t Coulomb(Double_t z);
79  // radioactive mixture evolution
80  virtual TGeoMaterial *DecayMaterial(Double_t time, Double_t precision=0.001);
81  virtual void FillMaterialEvolution(TObjArray *population, Double_t precision=0.001);
82  // getters & setters
83  virtual Int_t GetByteCount() const {return sizeof(*this);}
84  virtual Double_t GetA() const {return fA;}
85  virtual Double_t GetZ() const {return fZ;}
86  virtual Int_t GetDefaultColor() const;
87  virtual Double_t GetDensity() const {return fDensity;}
88  virtual Int_t GetNelements() const {return 1;}
89  virtual TGeoElement *GetElement(Int_t i=0) const;
90  virtual void GetElementProp(Double_t &a, Double_t &z, Double_t &w, Int_t i=0);
91  TGeoElement *GetBaseElement() const {return fElement;}
92  char *GetPointerName() const;
93  virtual Double_t GetRadLen() const {return fRadLen;}
94  virtual Double_t GetIntLen() const {return fIntLen;}
95  Int_t GetIndex();
96  virtual TObject *GetCerenkovProperties() const {return fCerenkov;}
97  Char_t GetTransparency() const {return (fFillStyle<3000 || fFillStyle>3100)?0:Char_t(fFillStyle-3000);}
99  Double_t GetPressure() const {return fPressure;}
101  virtual Double_t GetSpecificActivity(Int_t) const {return 0.;}
106  virtual Bool_t IsEq(const TGeoMaterial *other) const;
108  virtual Bool_t IsMixture() const {return kFALSE;}
109  virtual void Print(const Option_t *option="") const;
110  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
111  virtual void SetA(Double_t a) {fA = a; SetRadLen(0);}
112  virtual void SetZ(Double_t z) {fZ = z; SetRadLen(0);}
113  virtual void SetDensity(Double_t density) {fDensity = density; SetRadLen(0);}
114  void SetIndex(Int_t index) {fIndex=index;}
115  virtual void SetCerenkovProperties(TObject* cerenkov) {fCerenkov = cerenkov;}
116  void SetRadLen(Double_t radlen, Double_t intlen=0.);
118  void SetTransparency(Char_t transparency=0) {fFillStyle = 3000+transparency;}
119  void SetTemperature(Double_t temperature) {fTemperature = temperature;}
120  void SetPressure(Double_t pressure) {fPressure = pressure;}
121  void SetState(EGeoMaterialState state) {fState = state;}
122  void SetUserExtension(TGeoExtension *ext);
123  void SetFWExtension(TGeoExtension *ext);
124  static Double_t ScreenFactor(Double_t z);
125 
126 
127 
128  ClassDef(TGeoMaterial, 5) // base material class
129 
130 //***** Need to add classes and globals to LinkDef.h *****
131 };
132 
133 ////////////////////////////////////////////////////////////////////////////
134 // //
135 // TGeoMixture - mixtures of elements //
136 // //
137 ////////////////////////////////////////////////////////////////////////////
138 
139 class TGeoMixture : public TGeoMaterial
140 {
141 protected :
142 // data members
143  Int_t fNelements; // number of elements
144  Double_t *fZmixture; // [fNelements] array of Z of the elements
145  Double_t *fAmixture; // [fNelements] array of A of the elements
146  Double_t *fWeights; // [fNelements] array of relative proportions by mass
147  Int_t *fNatoms; // [fNelements] array of numbers of atoms
148  TObjArray *fElements; // array of elements composing the mixture
149 // methods
150  TGeoMixture(const TGeoMixture&); // Not implemented
151  TGeoMixture& operator=(const TGeoMixture&); // Not implemented
152  void AverageProperties();
153 
154 public:
155  // constructors
156  TGeoMixture();
157  TGeoMixture(const char *name, Int_t nel, Double_t rho=-1);
158  // destructor
159  virtual ~TGeoMixture();
160  // methods for adding elements
161  void AddElement(Double_t a, Double_t z, Double_t weight);
162  void AddElement(TGeoMaterial *mat, Double_t weight);
163  void AddElement(TGeoElement *elem, Double_t weight);
164  void AddElement(TGeoElement *elem, Int_t natoms);
165  // backward compatibility for defining elements
166  void DefineElement(Int_t iel, Double_t a, Double_t z, Double_t weight);
167  void DefineElement(Int_t iel, TGeoElement *elem, Double_t weight);
168  void DefineElement(Int_t iel, Int_t z, Int_t natoms);
169  // radioactive mixture evolution
170  virtual TGeoMaterial *DecayMaterial(Double_t time, Double_t precision=0.001);
171  virtual void FillMaterialEvolution(TObjArray *population, Double_t precision=0.001);
172  // getters
173  virtual Int_t GetByteCount() const {return 48+12*fNelements;}
174  virtual TGeoElement *GetElement(Int_t i=0) const;
175  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];}
176  virtual Int_t GetNelements() const {return fNelements;}
177  Double_t *GetZmixt() const {return fZmixture;}
178  Double_t *GetAmixt() const {return fAmixture;}
179  Double_t *GetWmixt() const {return fWeights;}
180  Int_t *GetNmixt() const {return fNatoms;}
181  virtual Double_t GetSpecificActivity(Int_t i=-1) const;
182  // utilities
183  virtual Bool_t IsEq(const TGeoMaterial *other) const;
184  virtual Bool_t IsMixture() const {return kTRUE;}
185  virtual void Print(const Option_t *option="") const;
186  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
187  virtual void SetA(Double_t a) {fA = a;}
188  virtual void SetZ(Double_t z) {fZ = z;}
189  virtual void SetDensity(Double_t density) {fDensity = density; AverageProperties();}
190 
191  ClassDef(TGeoMixture, 2) // material mixtures
192 };
193 
195  {return AddElement(a,z,weight);}
197  {return AddElement(elem,weight);}
198 
199 
200 #endif
201 
Int_t * fNatoms
Definition: TGeoMaterial.h:147
An array of TObjects.
Definition: TObjArray.h:37
void DefineElement(Int_t iel, Double_t a, Double_t z, Double_t weight)
Definition: TGeoMaterial.h:194
virtual void SetA(Double_t a)
Definition: TGeoMaterial.h:187
EGeoMaterialState GetState() const
Definition: TGeoMaterial.h:100
virtual Bool_t IsMixture() const
Definition: TGeoMaterial.h:184
Double_t * fWeights
Definition: TGeoMaterial.h:146
TGeoExtension * fFWExtension
Transient user-defined extension to materials.
Definition: TGeoMaterial.h:58
TObject * fCerenkov
Definition: TGeoMaterial.h:55
virtual Double_t GetDensity() const
Definition: TGeoMaterial.h:87
const char Option_t
Definition: RtypesCore.h:62
Int_t * GetNmixt() const
Definition: TGeoMaterial.h:180
Int_t fNelements
Definition: TGeoMaterial.h:143
Bool_t TestBit(UInt_t f) const
Definition: TObject.h:159
#define BIT(n)
Definition: Rtypes.h:75
Bool_t IsUsed() const
Definition: TGeoMaterial.h:107
virtual void SetA(Double_t a)
Definition: TGeoMaterial.h:111
virtual Double_t GetSpecificActivity(Int_t) const
Definition: TGeoMaterial.h:101
Double_t * GetWmixt() const
Definition: TGeoMaterial.h:179
void SetRadLen(Double_t radlen, Double_t intlen=0.)
Set radiation/absorption lengths.
Base class describing materials.
Definition: TGeoMaterial.h:29
virtual void SetZ(Double_t z)
Definition: TGeoMaterial.h:112
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TArc * a
Definition: textangle.C:12
virtual ~TGeoMaterial()
Destructor.
TGeoExtension * GetFWExtension() const
Definition: TGeoMaterial.h:103
static const Double_t STP_pressure
Definition: TGeoMaterial.h:27
TGeoElement * GetBaseElement() const
Definition: TGeoMaterial.h:91
virtual Int_t GetByteCount() const
Definition: TGeoMaterial.h:173
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:687
EGeoMaterialState fState
Definition: TGeoMaterial.h:53
Fill Area Attributes class.
Definition: TAttFill.h:19
#define ClassDef(name, id)
Definition: Rtypes.h:297
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:29
void SetUserExtension(TGeoExtension *ext)
Connect user-defined extension to the material.
Char_t GetTransparency() const
Definition: TGeoMaterial.h:97
Base class for chemical elements.
Definition: TGeoElement.h:36
virtual Double_t GetA() const
Definition: TGeoMaterial.h:84
virtual Double_t GetIntLen() const
Definition: TGeoMaterial.h:94
void SetIndex(Int_t index)
Definition: TGeoMaterial.h:114
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:175
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:85
Int_t GetIndex()
Retrieve material index in the list of materials.
virtual Int_t GetNelements() const
Definition: TGeoMaterial.h:88
Double_t fIntLen
Definition: TGeoMaterial.h:50
TGeoMaterial()
Default constructor.
Double_t GetPressure() const
Definition: TGeoMaterial.h:99
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:48
virtual TObject * GetCerenkovProperties() const
Definition: TGeoMaterial.h:96
Double_t GetTemperature() const
Definition: TGeoMaterial.h:98
ABC for user objects attached to TGeoVolume or TGeoNode.
Definition: TGeoExtension.h:19
TGeoExtension * GetUserExtension() const
Definition: TGeoMaterial.h:102
char * GetPointerName() const
Provide a pointer name containing uid.
virtual Int_t GetNelements() const
Definition: TGeoMaterial.h:176
Double_t fTemperature
Definition: TGeoMaterial.h:51
TGeoElement * fElement
Definition: TGeoMaterial.h:56
void SetFWExtension(TGeoExtension *ext)
Connect framework defined extension to the material.
void SetPressure(Double_t pressure)
Definition: TGeoMaterial.h:120
virtual void SetDensity(Double_t density)
Definition: TGeoMaterial.h:189
static const Double_t STP_temperature
Definition: TGeoMaterial.h:26
const Bool_t kFALSE
Definition: RtypesCore.h:92
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:144
Double_t fZ
Definition: TGeoMaterial.h:47
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:178
virtual Bool_t IsMixture() const
Definition: TGeoMaterial.h:108
void SetState(EGeoMaterialState state)
Definition: TGeoMaterial.h:121
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:52
char Char_t
Definition: RtypesCore.h:29
TObjArray * fElements
Definition: TGeoMaterial.h:148
void SetTemperature(Double_t temperature)
Definition: TGeoMaterial.h:119
Double_t fRadLen
Definition: TGeoMaterial.h:49
void SetUsed(Bool_t flag=kTRUE)
Definition: TGeoMaterial.h:117
TGeoExtension * fUserExtension
Definition: TGeoMaterial.h:57
virtual void SetZ(Double_t z)
Definition: TGeoMaterial.h:188
virtual void SetDensity(Double_t density)
Definition: TGeoMaterial.h:113
Double_t fA
Definition: TGeoMaterial.h:46
Double_t * GetZmixt() const
Definition: TGeoMaterial.h:177
virtual Int_t GetByteCount() const
Definition: TGeoMaterial.h:83
TGeoMaterial & operator=(const TGeoMaterial &)
assignment operator
virtual void SetCerenkovProperties(TObject *cerenkov)
Definition: TGeoMaterial.h:115
virtual Double_t GetRadLen() const
Definition: TGeoMaterial.h:93
Double_t * fAmixture
Definition: TGeoMaterial.h:145
TObject * fShader
Definition: TGeoMaterial.h:54
void SetTransparency(Char_t transparency=0)
Definition: TGeoMaterial.h:118
const Bool_t kTRUE
Definition: RtypesCore.h:91
TGeoExtension * GrabUserExtension() const
Get a copy of the user extension pointer.
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:23