Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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, public TAttFill {
35public:
38
39protected:
40 Int_t fIndex; // material index
41 Double_t fA; // A of material
42 Double_t fZ; // Z of material
43 Double_t fDensity; // density of material
44 Double_t fRadLen; // radiation length
45 Double_t fIntLen; // interaction length
46 Double_t fTemperature; // temperature
47 Double_t fPressure; // pressure
48 EGeoMaterialState fState; // material state
49 TObject *fShader; // shader with optical properties
50 TObject *fCerenkov; // pointer to class with Cerenkov properties
51 TGeoElement *fElement; // pointer to element composing the material
52 TList fProperties; // user-defined properties
53 TList fConstProperties; // user-defined constant properties
54 TGeoExtension *fUserExtension; //! Transient user-defined extension to materials
55 TGeoExtension *fFWExtension; //! Transient framework-defined extension to materials
56
57 // methods
60
61public:
62 // constructors
64 TGeoMaterial(const char *name);
65 TGeoMaterial(const char *name, Double_t a, Double_t z, Double_t rho, Double_t radlen = 0, Double_t intlen = 0);
66 TGeoMaterial(const char *name, Double_t a, Double_t z, Double_t rho, EGeoMaterialState state,
67 Double_t temperature = STP_temperature, Double_t pressure = STP_pressure);
68 TGeoMaterial(const char *name, TGeoElement *elem, Double_t rho);
69
70 // destructor
71 ~TGeoMaterial() override;
72 // methods
73 static Double_t Coulomb(Double_t z);
74 // radioactive mixture evolution
75 virtual TGeoMaterial *DecayMaterial(Double_t time, Double_t precision = 0.001);
76 virtual void FillMaterialEvolution(TObjArray *population, Double_t precision = 0.001);
77 // getters & setters
78 bool AddProperty(const char *property, const char *ref);
79 bool AddConstProperty(const char *property, const char *ref);
82 const char *GetPropertyRef(const char *property) const;
83 const char *GetPropertyRef(Int_t i) const
84 {
85 return (fProperties.At(i) ? fProperties.At(i)->GetTitle() : nullptr);
86 }
87 Double_t GetConstProperty(const char *property, Bool_t *error = nullptr) const;
88 Double_t GetConstProperty(Int_t i, Bool_t *error = nullptr) const;
89 const char *GetConstPropertyRef(const char *property) const;
90 const char *GetConstPropertyRef(Int_t i) const
91 {
92 return (fConstProperties.At(i) ? fConstProperties.At(i)->GetTitle() : nullptr);
93 }
94 TList const &GetProperties() const { return fProperties; }
95 TList const &GetConstProperties() const { return fConstProperties; }
96 TGDMLMatrix *GetProperty(const char *name) const;
98 virtual Int_t GetByteCount() const { return sizeof(*this); }
99 virtual Double_t GetA() const { return fA; }
100 virtual Double_t GetZ() const { return fZ; }
101 virtual Int_t GetDefaultColor() const;
102 virtual Double_t GetDensity() const { return fDensity; }
103 virtual Int_t GetNelements() const { return 1; }
104 TGeoElement *GetElement() const;
105 virtual TGeoElement *GetElement(Int_t i) const;
106 virtual void GetElementProp(Double_t &a, Double_t &z, Double_t &w, Int_t i = 0);
108 const char *GetPointerName() const;
109 virtual Double_t GetRadLen() const { return fRadLen; }
110 virtual Double_t GetIntLen() const { return fIntLen; }
111 Int_t GetIndex();
112 virtual TObject *GetCerenkovProperties() const { return fCerenkov; }
113 Char_t GetTransparency() const { return (fFillStyle < 3000 || fFillStyle > 3100) ? 0 : Char_t(fFillStyle - 3000); }
115 Double_t GetPressure() const { return fPressure; }
117 virtual Double_t GetSpecificActivity(Int_t) const { return 0.; }
122 virtual Bool_t IsEq(const TGeoMaterial *other) const;
124 virtual Bool_t IsMixture() const { return kFALSE; }
125 void Print(const Option_t *option = "") const override;
126 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
127 virtual void SetA(Double_t a)
128 {
129 fA = a;
130 SetRadLen(0);
131 }
132 virtual void SetZ(Double_t z)
133 {
134 fZ = z;
135 SetRadLen(0);
136 }
137 virtual void SetDensity(Double_t density)
138 {
139 fDensity = density;
140 SetRadLen(0);
141 }
143 virtual void SetCerenkovProperties(TObject *cerenkov) { fCerenkov = cerenkov; }
144 void SetRadLen(Double_t radlen, Double_t intlen = 0.);
145 void SetUsed(Bool_t flag = kTRUE) { TObject::SetBit(kMatUsed, flag); }
146 void SetTransparency(Char_t transparency = 0) { fFillStyle = 3000 + transparency; }
147 void SetTemperature(Double_t temperature) { fTemperature = temperature; }
148 void SetPressure(Double_t pressure) { fPressure = pressure; }
149 void SetState(EGeoMaterialState state) { fState = state; }
151 void SetFWExtension(TGeoExtension *ext);
153
154 ClassDefOverride(TGeoMaterial, 7) // base material class
155
156 //***** Need to add classes and globals to LinkDef.h *****
157};
158
159class TGeoMixture : public TGeoMaterial {
160protected:
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 Double_t *fVecNbOfAtomsPerVolume; //[fNelements] array of numbers of atoms per unit volume
168 TObjArray *fElements; // array of elements composing the mixture
169 // methods
170 TGeoMixture(const TGeoMixture &) = delete;
172 void AverageProperties();
173
174public:
175 // constructors
176 TGeoMixture();
177 TGeoMixture(const char *name, Int_t nel, Double_t rho = -1);
178 // destructor
179 ~TGeoMixture() override;
180 // methods for adding elements
181 void AddElement(Double_t a, Double_t z, Double_t weight);
182 void AddElement(TGeoMaterial *mat, Double_t weight);
183 void AddElement(TGeoElement *elem, Double_t weight);
184 void AddElement(TGeoElement *elem, Int_t natoms);
185 // backward compatibility for defining elements
186 void DefineElement(Int_t iel, Double_t a, Double_t z, Double_t weight);
187 void DefineElement(Int_t iel, TGeoElement *elem, Double_t weight);
188 void DefineElement(Int_t iel, Int_t z, Int_t natoms);
189 // radioactive mixture evolution
190 TGeoMaterial *DecayMaterial(Double_t time, Double_t precision = 0.001) override;
191 void FillMaterialEvolution(TObjArray *population, Double_t precision = 0.001) override;
192 // getters
193 Int_t GetByteCount() const override { return 48 + 12 * fNelements; }
194 TGeoElement *GetElement(Int_t i = 0) const override;
195 void GetElementProp(Double_t &a, Double_t &z, Double_t &w, Int_t i = 0) override
196 {
197 a = fAmixture[i];
198 z = fZmixture[i];
199 w = fWeights[i];
200 }
201 Int_t GetNelements() const override { return fNelements; }
202 Double_t *GetZmixt() const { return fZmixture; }
203 Double_t *GetAmixt() const { return fAmixture; }
204 Double_t *GetWmixt() const { return fWeights; }
205 Int_t *GetNmixt() const { return fNatoms; }
206 Double_t GetSpecificActivity(Int_t i = -1) const override;
207 // utilities
208 Bool_t IsEq(const TGeoMaterial *other) const override;
209 Bool_t IsMixture() const override { return kTRUE; }
210 void Print(const Option_t *option = "") const override;
211 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
212 void SetA(Double_t a) override { fA = a; }
213 void SetZ(Double_t z) override { fZ = z; }
214 void SetDensity(Double_t density) override
215 {
216 fDensity = density;
218 }
222
223 ClassDefOverride(TGeoMixture, 3) // material mixtures
224};
225
227{
228 return AddElement(a, z, weight);
229}
231{
232 return AddElement(elem, weight);
233}
234
235#endif
#define a(i)
Definition RSha256.hxx:99
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
char Char_t
Definition RtypesCore.h:37
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
double Double_t
Definition RtypesCore.h:59
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define BIT(n)
Definition Rtypes.h:85
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h GetProperty
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t property
char name[80]
Definition TGX11.cxx:110
static const Double_t STP_temperature
static const Double_t STP_pressure
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.
This class is used in the process of reading and writing the GDML "matrix" tag.
Definition TGDMLMatrix.h:33
Table of elements.
Base class for chemical elements.
Definition TGeoElement.h:36
ABC for user objects attached to TGeoVolume or TGeoNode.
Base class describing materials.
Double_t GetConstProperty(const char *property, Bool_t *error=nullptr) const
virtual Double_t GetIntLen() const
virtual void SetDensity(Double_t density)
virtual void SetZ(Double_t z)
void SetUserExtension(TGeoExtension *ext)
Connect user-defined extension to the material.
TGeoExtension * GetUserExtension() const
TGeoExtension * GetFWExtension() const
virtual TObject * GetCerenkovProperties() const
EGeoMaterialState fState
virtual void SetCerenkovProperties(TObject *cerenkov)
const char * GetPointerName() const
Provide a pointer name containing uid.
Bool_t IsUsed() const
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
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
virtual Bool_t IsMixture() const
Double_t fPressure
virtual Int_t GetByteCount() const
void SetFWExtension(TGeoExtension *ext)
Connect framework defined extension to the material.
bool AddConstProperty(const char *property, const char *ref)
Double_t fTemperature
TList const & GetConstProperties() const
virtual void GetElementProp(Double_t &a, Double_t &z, Double_t &w, Int_t i=0)
Single interface to get element properties.
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
void SetState(EGeoMaterialState state)
EGeoMaterialState GetState() const
bool AddProperty(const char *property, const char *ref)
Double_t GetTemperature() const
virtual Double_t GetSpecificActivity(Int_t) const
virtual Int_t GetNelements() const
Double_t fZ
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
virtual Bool_t IsEq(const TGeoMaterial *other) const
return true if the other material has the same physical properties
TGeoElement * GetBaseElement() const
const char * GetPropertyRef(const char *property) const
Int_t GetNproperties() const
Double_t fA
TObject * fCerenkov
void SetIndex(Int_t index)
Double_t fDensity
void SetUsed(Bool_t flag=kTRUE)
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
Double_t GetPressure() const
TGeoExtension * fUserExtension
Char_t GetTransparency() const
TList fConstProperties
void SetPressure(Double_t pressure)
TGeoElement * fElement
void SetTransparency(Char_t transparency=0)
const char * GetConstPropertyRef(Int_t i) const
TGeoMaterial & operator=(const TGeoMaterial &)
assignment operator
TObject * fShader
TGeoExtension * GrabUserExtension() const
Get a copy of the user extension pointer.
Double_t fRadLen
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)
virtual Double_t GetRadLen() const
virtual Double_t GetA() const
TGeoExtension * fFWExtension
Transient user-defined extension to materials.
const char * GetPropertyRef(Int_t i) const
void Print(const Option_t *option="") const override
print characteristics of this material
virtual Double_t GetDensity() const
virtual Double_t GetZ() const
~TGeoMaterial() override
Destructor.
void SetTemperature(Double_t temperature)
Mixtures of elements.
Int_t * GetNmixt() const
TObjArray * fElements
void GetElementProp(Double_t &a, Double_t &z, Double_t &w, Int_t i=0) override
Single interface to get element properties.
Int_t GetByteCount() const override
void ComputeNuclearInterLength()
Compute Nuclear Interaction Length based on Geant4 formula.
~TGeoMixture() override
Destructor.
Double_t * GetZmixt() const
Bool_t IsEq(const TGeoMaterial *other) const override
Return true if the other material has the same physical properties.
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
Bool_t IsMixture() const override
Double_t * fZmixture
TGeoMixture()
Default constructor.
void ComputeDerivedQuantities()
Compute Derived Quantities as in Geant4.
Int_t GetNelements() const override
void SetZ(Double_t z) override
TGeoMaterial * DecayMaterial(Double_t time, Double_t precision=0.001) override
Create the mixture representing the decay product of this material at a given time.
void ComputeRadiationLength()
Compute Radiation Length based on Geant4 formula.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
void SetDensity(Double_t density) override
Double_t * fVecNbOfAtomsPerVolume
Double_t * fAmixture
void FillMaterialEvolution(TObjArray *population, Double_t precision=0.001) override
Fills a user array with all the elements deriving from the possible decay of the top elements composi...
void AverageProperties()
Compute effective A/Z and radiation length.
void Print(const Option_t *option="") const override
print characteristics of this material
Double_t * GetWmixt() const
Double_t GetSpecificActivity(Int_t i=-1) const override
Get specific activity (in Bq/gram) for the whole mixture (no argument) or for a given component.
Int_t * fNatoms
void SetA(Double_t a) override
Double_t * fWeights
void DefineElement(Int_t iel, Double_t a, Double_t z, Double_t weight)
Double_t * GetAmixt() const
A doubly linked list.
Definition TList.h:38
TObject * At(Int_t idx) const override
Returns the object at position idx. Returns 0 if idx is out of range.
Definition TList.cxx:355
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
An array of TObjects.
Definition TObjArray.h:31
Mother of all ROOT objects.
Definition TObject.h:41
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:199
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:780
virtual const char * GetTitle() const
Returns title of object.
Definition TObject.cxx:483