Logo ROOT  
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#include <TAttFill.h>
17#include <TList.h>
18
19#ifdef R__LESS_INCLUDES
20class TGeoElement;
22#else
23#include "TGeoElement.h"
24#endif
25
26// forward declarations
27class TGeoExtension;
28class TGDMLMatrix;
29
30// Some units used in G4
31static const Double_t STP_temperature = 273.15; // [K]
32static const Double_t STP_pressure = 6.32420e+8; // [MeV/mm3]
33
34class TGeoMaterial : public TNamed,
35 public TAttFill
36{
37public:
41 };
47 };
48
49protected:
50 Int_t fIndex; // material index
51 Double_t fA; // A of material
52 Double_t fZ; // Z of material
53 Double_t fDensity; // density of material
54 Double_t fRadLen; // radiation length
55 Double_t fIntLen; // interaction length
56 Double_t fTemperature; // temperature
57 Double_t fPressure; // pressure
58 EGeoMaterialState fState; // material state
59 TObject *fShader; // shader with optical properties
60 TObject *fCerenkov; // pointer to class with Cerenkov properties
61 TGeoElement *fElement; // pointer to element composing the material
62 TList fProperties; // user-defined properties
63 TList fConstProperties; // user-defined constant properties
64 TGeoExtension *fUserExtension; //! Transient user-defined extension to materials
65 TGeoExtension *fFWExtension; //! Transient framework-defined extension to materials
66
67// methods
70
71
72public:
73 // constructors
75 TGeoMaterial(const char *name);
76 TGeoMaterial(const char *name, Double_t a, Double_t z,
77 Double_t rho, Double_t radlen=0, Double_t intlen=0);
78 TGeoMaterial(const char *name, Double_t a, Double_t z, Double_t rho,
80 TGeoMaterial(const char *name, TGeoElement *elem, Double_t rho);
81
82 // destructor
83 virtual ~TGeoMaterial();
84 // methods
85 static Double_t Coulomb(Double_t z);
86 // radioactive mixture evolution
87 virtual TGeoMaterial *DecayMaterial(Double_t time, Double_t precision=0.001);
88 virtual void FillMaterialEvolution(TObjArray *population, Double_t precision=0.001);
89 // getters & setters
90 bool AddProperty(const char *property, const char *ref);
91 bool AddConstProperty(const char *property, const char *ref);
94 const char *GetPropertyRef(const char *property) const;
95 const char *GetPropertyRef(Int_t i) const { return (fProperties.At(i) ? fProperties.At(i)->GetTitle() : nullptr); }
96 Double_t GetConstProperty(const char *property, Bool_t *error = nullptr) const;
97 Double_t GetConstProperty(Int_t i, Bool_t *error = nullptr) const;
98 const char *GetConstPropertyRef(const char *property) const;
99 const char *GetConstPropertyRef(Int_t i) const { return (fConstProperties.At(i) ? fConstProperties.At(i)->GetTitle() : nullptr); }
100 TList const &GetProperties() const { return fProperties; }
101 TList const &GetConstProperties() const { return fConstProperties; }
102 TGDMLMatrix* GetProperty(const char* name) const;
103 TGDMLMatrix* GetProperty(Int_t i) const;
104 virtual Int_t GetByteCount() const {return sizeof(*this);}
105 virtual Double_t GetA() const {return fA;}
106 virtual Double_t GetZ() const {return fZ;}
107 virtual Int_t GetDefaultColor() const;
108 virtual Double_t GetDensity() const {return fDensity;}
109 virtual Int_t GetNelements() const {return 1;}
110 TGeoElement *GetElement() const;
111 virtual TGeoElement *GetElement(Int_t i) const;
112 virtual void GetElementProp(Double_t &a, Double_t &z, Double_t &w, Int_t i=0);
114 char *GetPointerName() const;
115 virtual Double_t GetRadLen() const {return fRadLen;}
116 virtual Double_t GetIntLen() const {return fIntLen;}
117 Int_t GetIndex();
118 virtual TObject *GetCerenkovProperties() const {return fCerenkov;}
119 Char_t GetTransparency() const {return (fFillStyle<3000 || fFillStyle>3100)?0:Char_t(fFillStyle-3000);}
123 virtual Double_t GetSpecificActivity(Int_t) const {return 0.;}
128 virtual Bool_t IsEq(const TGeoMaterial *other) const;
130 virtual Bool_t IsMixture() const {return kFALSE;}
131 virtual void Print(const Option_t *option="") const;
132 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
133 virtual void SetA(Double_t a) {fA = a; SetRadLen(0);}
134 virtual void SetZ(Double_t z) {fZ = z; SetRadLen(0);}
135 virtual void SetDensity(Double_t density) {fDensity = density; SetRadLen(0);}
136 void SetIndex(Int_t index) {fIndex=index;}
137 virtual void SetCerenkovProperties(TObject* cerenkov) {fCerenkov = cerenkov;}
138 void SetRadLen(Double_t radlen, Double_t intlen=0.);
140 void SetTransparency(Char_t transparency=0) {fFillStyle = 3000+transparency;}
141 void SetTemperature(Double_t temperature) {fTemperature = temperature;}
142 void SetPressure(Double_t pressure) {fPressure = pressure;}
143 void SetState(EGeoMaterialState state) {fState = state;}
145 void SetFWExtension(TGeoExtension *ext);
147
148
149
150 ClassDef(TGeoMaterial, 7) // base material class
151
152//***** Need to add classes and globals to LinkDef.h *****
153};
154
155
157{
158protected :
159// data members
160 Int_t fNelements; // number of elements
161 Double_t *fZmixture; // [fNelements] array of Z of the elements
162 Double_t *fAmixture; // [fNelements] array of A of the elements
163 Double_t *fWeights; // [fNelements] array of relative proportions by mass
164 Int_t *fNatoms; // [fNelements] array of numbers of atoms
165 Double_t *fVecNbOfAtomsPerVolume; //[fNelements] array of numbers of atoms per unit volume
166 TObjArray *fElements; // array of elements composing the mixture
167// methods
168 TGeoMixture(const TGeoMixture&) = delete;
170 void AverageProperties();
171
172public:
173 // constructors
174 TGeoMixture();
175 TGeoMixture(const char *name, Int_t nel, Double_t rho=-1);
176 // destructor
177 virtual ~TGeoMixture();
178 // methods for adding elements
179 void AddElement(Double_t a, Double_t z, Double_t weight);
180 void AddElement(TGeoMaterial *mat, Double_t weight);
181 void AddElement(TGeoElement *elem, Double_t weight);
182 void AddElement(TGeoElement *elem, Int_t natoms);
183 // backward compatibility for defining elements
184 void DefineElement(Int_t iel, Double_t a, Double_t z, Double_t weight);
185 void DefineElement(Int_t iel, TGeoElement *elem, Double_t weight);
186 void DefineElement(Int_t iel, Int_t z, Int_t natoms);
187 // radioactive mixture evolution
188 virtual TGeoMaterial *DecayMaterial(Double_t time, Double_t precision=0.001);
189 virtual void FillMaterialEvolution(TObjArray *population, Double_t precision=0.001);
190 // getters
191 virtual Int_t GetByteCount() const {return 48+12*fNelements;}
192 virtual TGeoElement *GetElement(Int_t i=0) const;
193 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];}
194 virtual Int_t GetNelements() const {return fNelements;}
195 Double_t *GetZmixt() const {return fZmixture;}
196 Double_t *GetAmixt() const {return fAmixture;}
197 Double_t *GetWmixt() const {return fWeights;}
198 Int_t *GetNmixt() const {return fNatoms;}
199 virtual Double_t GetSpecificActivity(Int_t i=-1) const;
200 // utilities
201 virtual Bool_t IsEq(const TGeoMaterial *other) const;
202 virtual Bool_t IsMixture() const {return kTRUE;}
203 virtual void Print(const Option_t *option="") const;
204 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
205 virtual void SetA(Double_t a) {fA = a;}
206 virtual void SetZ(Double_t z) {fZ = z;}
207 virtual void SetDensity(Double_t density) {fDensity = density; AverageProperties();}
211
212 ClassDef(TGeoMixture, 3) // material mixtures
213};
214
216 {return AddElement(a,z,weight);}
218 {return AddElement(elem,weight);}
219
220
221#endif
222
int Int_t
Definition: RtypesCore.h:45
char Char_t
Definition: RtypesCore.h:33
const Bool_t kFALSE
Definition: RtypesCore.h:101
bool Bool_t
Definition: RtypesCore.h:63
double Double_t
Definition: RtypesCore.h:59
const Bool_t kTRUE
Definition: RtypesCore.h:100
const char Option_t
Definition: RtypesCore.h:66
#define ClassDef(name, id)
Definition: Rtypes.h:325
#define BIT(n)
Definition: Rtypes.h:85
char name[80]
Definition: TGX11.cxx:110
static const Double_t STP_temperature
Definition: TGeoMaterial.h:31
static const Double_t STP_pressure
Definition: TGeoMaterial.h:32
Fill Area Attributes class.
Definition: TAttFill.h:19
Style_t fFillStyle
Fill area style.
Definition: TAttFill.h:23
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Definition: TCollection.h:184
This class is used in the process of reading and writing the GDML "matrix" tag.
Definition: TGDMLMatrix.h:34
Table of elements.
Definition: TGeoElement.h:370
Base class for chemical elements.
Definition: TGeoElement.h:37
ABC for user objects attached to TGeoVolume or TGeoNode.
Definition: TGeoExtension.h:20
Base class describing materials.
Definition: TGeoMaterial.h:36
virtual ~TGeoMaterial()
Destructor.
Double_t GetConstProperty(const char *property, Bool_t *error=nullptr) const
virtual Double_t GetIntLen() const
Definition: TGeoMaterial.h:116
virtual void SetDensity(Double_t density)
Definition: TGeoMaterial.h:135
virtual void SetZ(Double_t z)
Definition: TGeoMaterial.h:134
void SetUserExtension(TGeoExtension *ext)
Connect user-defined extension to the material.
TGeoExtension * GetUserExtension() const
Definition: TGeoMaterial.h:124
TGeoExtension * GetFWExtension() const
Definition: TGeoMaterial.h:125
char * GetPointerName() const
Provide a pointer name containing uid.
virtual TObject * GetCerenkovProperties() const
Definition: TGeoMaterial.h:118
EGeoMaterialState fState
Definition: TGeoMaterial.h:58
virtual void SetCerenkovProperties(TObject *cerenkov)
Definition: TGeoMaterial.h:137
Bool_t IsUsed() const
Definition: TGeoMaterial.h:129
static Double_t ScreenFactor(Double_t z)
static function Compute screening factor for pair production and Bremsstrahlung REFERENCE : EGS MANUA...
const char * GetConstPropertyRef(const char *property) const
Int_t GetNconstProperties() const
Definition: TGeoMaterial.h:93
virtual Bool_t IsMixture() const
Definition: TGeoMaterial.h:130
Double_t fPressure
Definition: TGeoMaterial.h:57
virtual Int_t GetByteCount() const
Definition: TGeoMaterial.h:104
void SetFWExtension(TGeoExtension *ext)
Connect framework defined extension to the material.
bool AddConstProperty(const char *property, const char *ref)
Double_t fTemperature
Definition: TGeoMaterial.h:56
TList const & GetConstProperties() const
Definition: TGeoMaterial.h:101
virtual void GetElementProp(Double_t &a, Double_t &z, Double_t &w, Int_t i=0)
Single interface to get element properties.
virtual void Print(const Option_t *option="") const
print characteristics of this material
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.
TList fProperties
Definition: TGeoMaterial.h:62
void SetState(EGeoMaterialState state)
Definition: TGeoMaterial.h:143
EGeoMaterialState GetState() const
Definition: TGeoMaterial.h:122
bool AddProperty(const char *property, const char *ref)
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
Double_t GetTemperature() const
Definition: TGeoMaterial.h:120
virtual Double_t GetSpecificActivity(Int_t) const
Definition: TGeoMaterial.h:123
virtual Int_t GetNelements() const
Definition: TGeoMaterial.h:109
Double_t fZ
Definition: TGeoMaterial.h:52
void SetRadLen(Double_t radlen, Double_t intlen=0.)
Set radiation/absorption lengths.
TGeoElement * GetElement() const
Get a pointer to the element this material is made of.
TList const & GetProperties() const
Definition: TGeoMaterial.h:100
virtual Bool_t IsEq(const TGeoMaterial *other) const
return true if the other material has the same physical properties
TGeoElement * GetBaseElement() const
Definition: TGeoMaterial.h:113
const char * GetPropertyRef(const char *property) const
Int_t GetNproperties() const
Definition: TGeoMaterial.h:92
Double_t fA
Definition: TGeoMaterial.h:51
TGDMLMatrix * GetProperty(const char *name) const
TObject * fCerenkov
Definition: TGeoMaterial.h:60
void SetIndex(Int_t index)
Definition: TGeoMaterial.h:136
Double_t fDensity
Definition: TGeoMaterial.h:53
void SetUsed(Bool_t flag=kTRUE)
Definition: TGeoMaterial.h:139
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...
Int_t GetIndex()
Retrieve material index in the list of materials.
Double_t fIntLen
Definition: TGeoMaterial.h:55
Double_t GetPressure() const
Definition: TGeoMaterial.h:121
TGeoExtension * fUserExtension
Definition: TGeoMaterial.h:64
Char_t GetTransparency() const
Definition: TGeoMaterial.h:119
TList fConstProperties
Definition: TGeoMaterial.h:63
void SetPressure(Double_t pressure)
Definition: TGeoMaterial.h:142
TGeoElement * fElement
Definition: TGeoMaterial.h:61
void SetTransparency(Char_t transparency=0)
Definition: TGeoMaterial.h:140
const char * GetConstPropertyRef(Int_t i) const
Definition: TGeoMaterial.h:99
TGeoMaterial & operator=(const TGeoMaterial &)
assignment operator
TObject * fShader
Definition: TGeoMaterial.h:59
TGeoExtension * GrabUserExtension() const
Get a copy of the user extension pointer.
Double_t fRadLen
Definition: TGeoMaterial.h:54
TGeoExtension * GrabFWExtension() const
Get a copy of the framework extension pointer.
virtual Int_t GetDefaultColor() const
Get some default color related to this material.
TGeoMaterial()
Default constructor.
static Double_t Coulomb(Double_t z)
static function Compute Coulomb correction for pair production and Brem REFERENCE : EGS MANUAL SLAC 2...
virtual void SetA(Double_t a)
Definition: TGeoMaterial.h:133
virtual Double_t GetRadLen() const
Definition: TGeoMaterial.h:115
virtual Double_t GetA() const
Definition: TGeoMaterial.h:105
TGeoExtension * fFWExtension
Transient user-defined extension to materials.
Definition: TGeoMaterial.h:65
const char * GetPropertyRef(Int_t i) const
Definition: TGeoMaterial.h:95
virtual Double_t GetDensity() const
Definition: TGeoMaterial.h:108
virtual Double_t GetZ() const
Definition: TGeoMaterial.h:106
void SetTemperature(Double_t temperature)
Definition: TGeoMaterial.h:141
Mixtures of elements.
Definition: TGeoMaterial.h:157
Int_t * GetNmixt() const
Definition: TGeoMaterial.h:198
TObjArray * fElements
Definition: TGeoMaterial.h:166
void ComputeNuclearInterLength()
Compute Nuclear Interaction Length based on Geant4 formula.
Double_t * GetZmixt() const
Definition: TGeoMaterial.h:195
TGeoMixture & operator=(const TGeoMixture &)=delete
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
TGeoMixture(const TGeoMixture &)=delete
Double_t * fZmixture
Definition: TGeoMaterial.h:161
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.
TGeoMixture()
Default constructor.
virtual Int_t GetByteCount() const
Definition: TGeoMaterial.h:191
virtual ~TGeoMixture()
Destructor.
void ComputeDerivedQuantities()
Compute Derived Quantities as in Geant4.
virtual void Print(const Option_t *option="") const
print characteristics of this material
virtual void SetZ(Double_t z)
Definition: TGeoMaterial.h:206
void ComputeRadiationLength()
Compute Radiation Length based on Geant4 formula.
Double_t * fVecNbOfAtomsPerVolume
Definition: TGeoMaterial.h:165
virtual void SetDensity(Double_t density)
Definition: TGeoMaterial.h:207
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...
Double_t * fAmixture
Definition: TGeoMaterial.h:162
void AverageProperties()
Compute effective A/Z and radiation length.
Int_t fNelements
Definition: TGeoMaterial.h:160
Double_t * GetWmixt() const
Definition: TGeoMaterial.h:197
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 SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual Int_t GetNelements() const
Definition: TGeoMaterial.h:194
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:193
Int_t * fNatoms
Definition: TGeoMaterial.h:164
virtual void SetA(Double_t a)
Definition: TGeoMaterial.h:205
virtual Bool_t IsEq(const TGeoMaterial *other) const
Return true if the other material has the same physical properties.
virtual Bool_t IsMixture() const
Definition: TGeoMaterial.h:202
Double_t * fWeights
Definition: TGeoMaterial.h:163
void DefineElement(Int_t iel, Double_t a, Double_t z, Double_t weight)
Definition: TGeoMaterial.h:215
Double_t * GetAmixt() const
Definition: TGeoMaterial.h:196
A doubly linked list.
Definition: TList.h:44
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
Definition: TList.cxx:357
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
An array of TObjects.
Definition: TObjArray.h:37
Mother of all ROOT objects.
Definition: TObject.h:37
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:187
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:696
virtual const char * GetTitle() const
Returns title of object.
Definition: TObject.cxx:403
auto * a
Definition: textangle.C:12