00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef ROOT_TGeoMaterial
00020 #define ROOT_TGeoMaterial
00021
00022 #ifndef ROOT_TNamed
00023 #include "TNamed.h"
00024 #endif
00025
00026 #ifndef ROOT_TAttFill
00027 #include "TAttFill.h"
00028 #endif
00029
00030 #ifndef ROOT_TGeoElement
00031 #include "TGeoElement.h"
00032 #endif
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 static const Double_t STP_temperature = 273.15;
00046 static const Double_t STP_pressure = 6.32420e+8;
00047
00048 class TGeoMaterial : public TNamed,
00049 public TAttFill
00050 {
00051 public:
00052 enum EGeoMaterial {
00053 kMatUsed = BIT(17),
00054 kMatSavePrimitive = BIT(18)
00055 };
00056 enum EGeoMaterialState {
00057 kMatStateUndefined,
00058 kMatStateSolid,
00059 kMatStateLiquid,
00060 kMatStateGas
00061 };
00062
00063 protected:
00064 Int_t fIndex;
00065 Double_t fA;
00066 Double_t fZ;
00067 Double_t fDensity;
00068 Double_t fRadLen;
00069 Double_t fIntLen;
00070 Double_t fTemperature;
00071 Double_t fPressure;
00072 EGeoMaterialState fState;
00073 TObject *fShader;
00074 TObject *fCerenkov;
00075 TGeoElement *fElement;
00076
00077
00078 TGeoMaterial(const TGeoMaterial&);
00079 TGeoMaterial& operator=(const TGeoMaterial&);
00080
00081
00082 public:
00083
00084 TGeoMaterial();
00085 TGeoMaterial(const char *name);
00086 TGeoMaterial(const char *name, Double_t a, Double_t z,
00087 Double_t rho, Double_t radlen=0, Double_t intlen=0);
00088 TGeoMaterial(const char *name, Double_t a, Double_t z, Double_t rho,
00089 EGeoMaterialState state, Double_t temperature=STP_temperature, Double_t pressure=STP_pressure);
00090 TGeoMaterial(const char *name, TGeoElement *elem, Double_t rho);
00091
00092
00093 virtual ~TGeoMaterial();
00094
00095 static Double_t Coulomb(Double_t z);
00096
00097 virtual TGeoMaterial *DecayMaterial(Double_t time, Double_t precision=0.001);
00098 virtual void FillMaterialEvolution(TObjArray *population, Double_t precision=0.001);
00099
00100 virtual Int_t GetByteCount() const {return sizeof(*this);}
00101 virtual Double_t GetA() const {return fA;}
00102 virtual Double_t GetZ() const {return fZ;}
00103 virtual Int_t GetDefaultColor() const;
00104 virtual Double_t GetDensity() const {return fDensity;}
00105 virtual TGeoElement *GetElement(Int_t i=0) const;
00106 TGeoElement *GetBaseElement() const {return fElement;}
00107 char *GetPointerName() const;
00108 virtual Double_t GetRadLen() const {return fRadLen;}
00109 virtual Double_t GetIntLen() const {return fIntLen;}
00110 Int_t GetIndex();
00111 virtual TObject *GetCerenkovProperties() const {return fCerenkov;}
00112 Char_t GetTransparency() const {return (fFillStyle<3000 || fFillStyle>3100)?0:Char_t(fFillStyle-3000);}
00113 Double_t GetTemperature() const {return fTemperature;}
00114 Double_t GetPressure() const {return fPressure;}
00115 EGeoMaterialState GetState() const {return fState;}
00116 virtual Bool_t IsEq(const TGeoMaterial *other) const;
00117 Bool_t IsUsed() const {return TObject::TestBit(kMatUsed);}
00118 virtual Bool_t IsMixture() const {return kFALSE;}
00119 virtual void Print(const Option_t *option="") const;
00120 virtual void SavePrimitive(ostream &out, Option_t *option = "");
00121 void SetA(Double_t a) {fA = a; SetRadLen(0);}
00122 void SetZ(Double_t z) {fZ = z; SetRadLen(0);}
00123 void SetDensity(Double_t density) {fDensity = density; SetRadLen(0);}
00124 void SetIndex(Int_t index) {fIndex=index;}
00125 virtual void SetCerenkovProperties(TObject* cerenkov) {fCerenkov = cerenkov;}
00126 void SetRadLen(Double_t radlen, Double_t intlen=0.);
00127 void SetUsed(Bool_t flag=kTRUE) {TObject::SetBit(kMatUsed, flag);}
00128 void SetTransparency(Char_t transparency=0) {fFillStyle = 3000+transparency;}
00129 void SetTemperature(Double_t temperature) {fTemperature = temperature;}
00130 void SetPressure(Double_t pressure) {fPressure = pressure;}
00131 void SetState(EGeoMaterialState state) {fState = state;}
00132 static Double_t ScreenFactor(Double_t z);
00133
00134
00135
00136 ClassDef(TGeoMaterial, 5)
00137
00138
00139 };
00140
00141
00142
00143
00144
00145
00146
00147 class TGeoMixture : public TGeoMaterial
00148 {
00149 protected :
00150
00151 Int_t fNelements;
00152 Double_t *fZmixture;
00153 Double_t *fAmixture;
00154 Double_t *fWeights;
00155 Int_t *fNatoms;
00156 TObjArray *fElements;
00157
00158 TGeoMixture(const TGeoMixture&);
00159 TGeoMixture& operator=(const TGeoMixture&);
00160 void AverageProperties();
00161
00162 public:
00163
00164 TGeoMixture();
00165 TGeoMixture(const char *name, Int_t nel, Double_t rho=-1);
00166
00167 virtual ~TGeoMixture();
00168
00169 void AddElement(Double_t a, Double_t z, Double_t weight);
00170 void AddElement(TGeoMaterial *mat, Double_t weight);
00171 void AddElement(TGeoElement *elem, Double_t weight);
00172 void AddElement(TGeoElement *elem, Int_t natoms);
00173
00174 void DefineElement(Int_t iel, Double_t a, Double_t z, Double_t weight);
00175 void DefineElement(Int_t iel, TGeoElement *elem, Double_t weight);
00176 void DefineElement(Int_t iel, Int_t z, Int_t natoms);
00177
00178 virtual TGeoMaterial *DecayMaterial(Double_t time, Double_t precision=0.001);
00179 virtual void FillMaterialEvolution(TObjArray *population, Double_t precision=0.001);
00180
00181 virtual Int_t GetByteCount() const {return 48+12*fNelements;}
00182 virtual TGeoElement *GetElement(Int_t i=0) const;
00183 Int_t GetNelements() const {return fNelements;}
00184 Double_t *GetZmixt() const {return fZmixture;}
00185 Double_t *GetAmixt() const {return fAmixture;}
00186 Double_t *GetWmixt() const {return fWeights;}
00187 Int_t *GetNmixt() const {return fNatoms;}
00188
00189 virtual Bool_t IsEq(const TGeoMaterial *other) const;
00190 virtual Bool_t IsMixture() const {return kTRUE;}
00191 virtual void Print(const Option_t *option="") const;
00192 virtual void SavePrimitive(ostream &out, Option_t *option = "");
00193 void SetA(Double_t a) {fA = a;}
00194 void SetZ(Double_t z) {fZ = z;}
00195
00196 ClassDef(TGeoMixture, 2)
00197 };
00198
00199 inline void TGeoMixture::DefineElement(Int_t, Double_t a, Double_t z, Double_t weight)
00200 {return AddElement(a,z,weight);}
00201 inline void TGeoMixture::DefineElement(Int_t, TGeoElement *elem, Double_t weight)
00202 {return AddElement(elem,weight);}
00203
00204
00205 #endif
00206