12 #ifndef ROOT_TGeoMaterial
13 #define ROOT_TGeoMaterial
26 static const Double_t STP_temperature = 273.15;
27 static const Double_t STP_pressure = 6.32420e+8;
29 class TGeoMaterial :
public TNamed,
35 kMatSavePrimitive = BIT(18)
37 enum EGeoMaterialState {
51 Double_t fTemperature;
53 EGeoMaterialState fState;
56 TGeoElement *fElement;
58 TList fConstProperties;
59 TGeoExtension *fUserExtension;
60 TGeoExtension *fFWExtension;
63 TGeoMaterial(
const TGeoMaterial&);
64 TGeoMaterial& operator=(
const TGeoMaterial&);
70 TGeoMaterial(
const char *name);
71 TGeoMaterial(
const char *name, Double_t a, Double_t z,
72 Double_t rho, Double_t radlen=0, Double_t intlen=0);
73 TGeoMaterial(
const char *name, Double_t a, Double_t z, Double_t rho,
74 EGeoMaterialState state, Double_t temperature=STP_temperature, Double_t pressure=STP_pressure);
75 TGeoMaterial(
const char *name, TGeoElement *elem, Double_t rho);
78 virtual ~TGeoMaterial();
80 static Double_t Coulomb(Double_t z);
82 virtual TGeoMaterial *DecayMaterial(Double_t time, Double_t precision=0.001);
83 virtual void FillMaterialEvolution(TObjArray *population, Double_t precision=0.001);
85 bool AddProperty(
const char *property,
const char *ref);
86 bool AddConstProperty(
const char *property,
const char *ref);
87 Int_t GetNproperties()
const {
return fProperties.GetSize(); }
88 Int_t GetNconstProperties()
const {
return fConstProperties.GetSize(); }
89 const char *GetPropertyRef(
const char *property)
const;
90 const char *GetPropertyRef(Int_t i)
const {
return (fProperties.At(i) ? fProperties.At(i)->GetTitle() :
nullptr); }
91 Double_t GetConstProperty(
const char *property, Bool_t *error =
nullptr)
const;
92 Double_t GetConstProperty(Int_t i, Bool_t *error =
nullptr)
const;
93 const char *GetConstPropertyRef(
const char *property)
const;
94 const char *GetConstPropertyRef(Int_t i)
const {
return (fConstProperties.At(i) ? fConstProperties.At(i)->GetTitle() :
nullptr); }
95 TList
const &GetProperties()
const {
return fProperties; }
96 TList
const &GetConstProperties()
const {
return fConstProperties; }
97 TGDMLMatrix* GetProperty(
const char* name)
const;
98 TGDMLMatrix* GetProperty(Int_t i)
const;
99 virtual Int_t GetByteCount()
const {
return sizeof(*this);}
100 virtual Double_t GetA()
const {
return fA;}
101 virtual Double_t GetZ()
const {
return fZ;}
102 virtual Int_t GetDefaultColor()
const;
103 virtual Double_t GetDensity()
const {
return fDensity;}
104 virtual Int_t GetNelements()
const {
return 1;}
105 virtual TGeoElement *GetElement(Int_t i=0)
const;
106 virtual void GetElementProp(Double_t &a, Double_t &z, Double_t &w, Int_t i=0);
107 TGeoElement *GetBaseElement()
const {
return fElement;}
108 char *GetPointerName()
const;
109 virtual Double_t GetRadLen()
const {
return fRadLen;}
110 virtual Double_t GetIntLen()
const {
return fIntLen;}
112 virtual TObject *GetCerenkovProperties()
const {
return fCerenkov;}
113 Char_t GetTransparency()
const {
return (fFillStyle<3000 || fFillStyle>3100)?0:Char_t(fFillStyle-3000);}
114 Double_t GetTemperature()
const {
return fTemperature;}
115 Double_t GetPressure()
const {
return fPressure;}
116 EGeoMaterialState GetState()
const {
return fState;}
117 virtual Double_t GetSpecificActivity(Int_t)
const {
return 0.;}
118 TGeoExtension *GetUserExtension()
const {
return fUserExtension;}
119 TGeoExtension *GetFWExtension()
const {
return fFWExtension;}
120 TGeoExtension *GrabUserExtension()
const;
121 TGeoExtension *GrabFWExtension()
const;
122 virtual Bool_t IsEq(
const TGeoMaterial *other)
const;
123 Bool_t IsUsed()
const {
return TObject::TestBit(kMatUsed);}
124 virtual Bool_t IsMixture()
const {
return kFALSE;}
125 virtual void Print(
const Option_t *option=
"")
const;
126 virtual void SavePrimitive(std::ostream &out, Option_t *option =
"");
127 virtual void SetA(Double_t a) {fA = a; SetRadLen(0);}
128 virtual void SetZ(Double_t z) {fZ = z; SetRadLen(0);}
129 virtual void SetDensity(Double_t density) {fDensity = density; SetRadLen(0);}
130 void SetIndex(Int_t index) {fIndex=index;}
131 virtual void SetCerenkovProperties(TObject* cerenkov) {fCerenkov = cerenkov;}
132 void SetRadLen(Double_t radlen, Double_t intlen=0.);
133 void SetUsed(Bool_t flag=kTRUE) {TObject::SetBit(kMatUsed, flag);}
134 void SetTransparency(Char_t transparency=0) {fFillStyle = 3000+transparency;}
135 void SetTemperature(Double_t temperature) {fTemperature = temperature;}
136 void SetPressure(Double_t pressure) {fPressure = pressure;}
137 void SetState(EGeoMaterialState state) {fState = state;}
138 void SetUserExtension(TGeoExtension *ext);
139 void SetFWExtension(TGeoExtension *ext);
140 static Double_t ScreenFactor(Double_t z);
144 ClassDef(TGeoMaterial, 7)
150 class TGeoMixture :
public TGeoMaterial
159 Double_t *fVecNbOfAtomsPerVolume;
160 TObjArray *fElements;
162 TGeoMixture(
const TGeoMixture&);
163 TGeoMixture& operator=(
const TGeoMixture&);
164 void AverageProperties();
169 TGeoMixture(
const char *name, Int_t nel, Double_t rho=-1);
171 virtual ~TGeoMixture();
173 void AddElement(Double_t a, Double_t z, Double_t weight);
174 void AddElement(TGeoMaterial *mat, Double_t weight);
175 void AddElement(TGeoElement *elem, Double_t weight);
176 void AddElement(TGeoElement *elem, Int_t natoms);
178 void DefineElement(Int_t iel, Double_t a, Double_t z, Double_t weight);
179 void DefineElement(Int_t iel, TGeoElement *elem, Double_t weight);
180 void DefineElement(Int_t iel, Int_t z, Int_t natoms);
182 virtual TGeoMaterial *DecayMaterial(Double_t time, Double_t precision=0.001);
183 virtual void FillMaterialEvolution(TObjArray *population, Double_t precision=0.001);
185 virtual Int_t GetByteCount()
const {
return 48+12*fNelements;}
186 virtual TGeoElement *GetElement(Int_t i=0)
const;
187 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];}
188 virtual Int_t GetNelements()
const {
return fNelements;}
189 Double_t *GetZmixt()
const {
return fZmixture;}
190 Double_t *GetAmixt()
const {
return fAmixture;}
191 Double_t *GetWmixt()
const {
return fWeights;}
192 Int_t *GetNmixt()
const {
return fNatoms;}
193 virtual Double_t GetSpecificActivity(Int_t i=-1)
const;
195 virtual Bool_t IsEq(
const TGeoMaterial *other)
const;
196 virtual Bool_t IsMixture()
const {
return kTRUE;}
197 virtual void Print(
const Option_t *option=
"")
const;
198 virtual void SavePrimitive(std::ostream &out, Option_t *option =
"");
199 virtual void SetA(Double_t a) {fA = a;}
200 virtual void SetZ(Double_t z) {fZ = z;}
201 virtual void SetDensity(Double_t density) {fDensity = density; AverageProperties();}
202 void ComputeDerivedQuantities();
203 void ComputeRadiationLength();
204 void ComputeNuclearInterLength();
206 ClassDef(TGeoMixture, 3)
209 inline void TGeoMixture::DefineElement(Int_t, Double_t a, Double_t z, Double_t weight)
210 {
return AddElement(a,z,weight);}
211 inline void TGeoMixture::DefineElement(Int_t, TGeoElement *elem, Double_t weight)
212 {
return AddElement(elem,weight);}