TGeoMaterial.h

Go to the documentation of this file.
00001 // @(#)root/geom:$Id: TGeoMaterial.h 35651 2010-09-23 13:31:47Z agheata $
00002 // Author: Andrei Gheata   25/10/01
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 /*************************************************************************
00013  * TGeoMaterial - package description
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 // forward declarations
00036 
00037 
00038 ////////////////////////////////////////////////////////////////////////////
00039 //                                                                        //
00040 // TGeoMaterial - base class describing materials                         //
00041 //                                                                        //
00042 ////////////////////////////////////////////////////////////////////////////
00043 
00044 // Some units used in G4
00045 static const Double_t STP_temperature = 273.15;     // [K]
00046 static const Double_t STP_pressure    = 6.32420e+8; // [MeV/mm3]
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;      // material index
00065    Double_t                 fA;          // A of material
00066    Double_t                 fZ;          // Z of material
00067    Double_t                 fDensity;    // density of material
00068    Double_t                 fRadLen;     // radiation length
00069    Double_t                 fIntLen;     // interaction length
00070    Double_t                 fTemperature; // temperature
00071    Double_t                 fPressure;   // pressure
00072    EGeoMaterialState        fState;      // material state
00073    TObject                 *fShader;     // shader with optical properties
00074    TObject                 *fCerenkov;   // pointer to class with Cerenkov properties
00075    TGeoElement             *fElement;    // pointer to element composing the material
00076 
00077 // methods
00078    TGeoMaterial(const TGeoMaterial&);
00079    TGeoMaterial& operator=(const TGeoMaterial&);
00080 
00081 
00082 public:
00083    // constructors
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    // destructor
00093    virtual ~TGeoMaterial();
00094    // methods
00095    static  Double_t         Coulomb(Double_t z);
00096    // radioactive mixture evolution
00097    virtual TGeoMaterial    *DecayMaterial(Double_t time, Double_t precision=0.001);
00098    virtual void             FillMaterialEvolution(TObjArray *population, Double_t precision=0.001);
00099    // getters & setters
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)              // base material class
00137 
00138 //***** Need to add classes and globals to LinkDef.h *****
00139 };
00140 
00141 ////////////////////////////////////////////////////////////////////////////
00142 //                                                                        //
00143 // TGeoMixture - mixtures of elements                                     //
00144 //                                                                        //
00145 ////////////////////////////////////////////////////////////////////////////
00146 
00147 class TGeoMixture : public TGeoMaterial
00148 {
00149 protected :
00150 // data members
00151    Int_t                    fNelements;  // number of elements
00152    Double_t                *fZmixture;   // [fNelements] array of Z of the elements
00153    Double_t                *fAmixture;   // [fNelements] array of A of the elements
00154    Double_t                *fWeights;    // [fNelements] array of relative proportions by mass
00155    Int_t                   *fNatoms;     // [fNelements] array of numbers of atoms
00156    TObjArray               *fElements;   // array of elements composing the mixture
00157 // methods
00158    TGeoMixture(const TGeoMixture&); // Not implemented
00159    TGeoMixture& operator=(const TGeoMixture&); // Not implemented
00160    void                     AverageProperties();
00161 
00162 public:
00163    // constructors
00164    TGeoMixture();
00165    TGeoMixture(const char *name, Int_t nel, Double_t rho=-1);
00166    // destructor
00167    virtual ~TGeoMixture();
00168    // methods for adding elements
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    // backward compatibility for defining elements
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    // radioactive mixture evolution
00178    virtual TGeoMaterial    *DecayMaterial(Double_t time, Double_t precision=0.001);
00179    virtual void             FillMaterialEvolution(TObjArray *population, Double_t precision=0.001);
00180    // getters
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    // utilities
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)              // material mixtures
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 

Generated on Tue Jul 5 14:12:17 2011 for ROOT_528-00b_version by  doxygen 1.5.1