ROOT logo
// @(#)root/geom:$Id: TGeoMaterial.h 21425 2007-12-17 15:59:27Z brun $
// Author: Andrei Gheata   25/10/01

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

/*************************************************************************
 * TGeoMaterial - package description
 *
 *
 *
 *************************************************************************/

#ifndef ROOT_TGeoMaterial
#define ROOT_TGeoMaterial

#ifndef ROOT_TNamed
#include "TNamed.h"
#endif

#ifndef ROOT_TAttFill
#include "TAttFill.h"
#endif

#ifndef ROOT_TGeoElement
#include "TGeoElement.h"
#endif


// forward declarations


////////////////////////////////////////////////////////////////////////////
//                                                                        //
// TGeoMaterial - base class describing materials                         //
//                                                                        //
////////////////////////////////////////////////////////////////////////////

// Some units used in G4
static const Double_t STP_temperature = 273.15;     // [K]
static const Double_t STP_pressure    = 6.32420e+8; // [MeV/mm3]

class TGeoMaterial : public TNamed,
                     public TAttFill
{
public:
   enum EGeoMaterial {
      kMatUsed   =   BIT(17),
      kMatSavePrimitive = BIT(18)
   };
   enum EGeoMaterialState {   
      kMatStateUndefined,
      kMatStateSolid,
      kMatStateLiquid,
      kMatStateGas
   };

protected:
   Int_t                    fIndex;      // material index
   Double_t                 fA;          // A of material
   Double_t                 fZ;          // Z of material
   Double_t                 fDensity;    // density of material
   Double_t                 fRadLen;     // radiation length
   Double_t                 fIntLen;     // interaction length
   Double_t                 fTemperature; // temperature
   Double_t                 fPressure;   // pressure
   EGeoMaterialState        fState;      // material state
   TObject                 *fShader;     // shader with optical properties
   TObject                 *fCerenkov;   // pointer to class with Cerenkov properties
   TGeoElement             *fElement;    // pointer to element composing the material

// methods
   TGeoMaterial(const TGeoMaterial&);
   TGeoMaterial& operator=(const TGeoMaterial&);


public:
   // constructors
   TGeoMaterial();
   TGeoMaterial(const char *name);
   TGeoMaterial(const char *name, Double_t a, Double_t z, 
                Double_t rho, Double_t radlen=0, Double_t intlen=0);
   TGeoMaterial(const char *name, Double_t a, Double_t z, Double_t rho,
                EGeoMaterialState state, Double_t temperature=STP_temperature, Double_t pressure=STP_pressure);
   TGeoMaterial(const char *name, TGeoElement *elem, Double_t rho);

   // destructor
   virtual ~TGeoMaterial();
   // methods
   static  Double_t         Coulomb(Double_t z);
   // radioactive mixture evolution
   virtual TGeoMaterial    *DecayMaterial(Double_t time, Double_t precision=0.001);
   virtual void             FillMaterialEvolution(TObjArray *population, Double_t precision=0.001);
   // getters & setters
   virtual Int_t            GetByteCount() const {return sizeof(this);}
   virtual Double_t         GetA() const       {return fA;}
   virtual Double_t         GetZ()  const      {return fZ;}
   virtual Int_t            GetDefaultColor() const;
   virtual Double_t         GetDensity() const {return fDensity;}
   virtual TGeoElement     *GetElement(Int_t i=0) const;
   TGeoElement             *GetBaseElement() const {return fElement;}
   char                    *GetPointerName() const;
   virtual Double_t         GetRadLen() const  {return fRadLen;}
   virtual Double_t         GetIntLen() const  {return fIntLen;}
   Int_t                    GetIndex();
   virtual TObject         *GetCerenkovProperties() const {return fCerenkov;}
   Char_t                   GetTransparency() const {return (fFillStyle<3000 || fFillStyle>3100)?0:Char_t(fFillStyle-3000);}
   Double_t                 GetTemperature() const {return fTemperature;}
   Double_t                 GetPressure() const {return fPressure;}
   EGeoMaterialState        GetState() const {return fState;}
   virtual Bool_t           IsEq(const TGeoMaterial *other) const;
   Bool_t                   IsUsed() const {return TObject::TestBit(kMatUsed);}
   virtual Bool_t           IsMixture() const {return kFALSE;}
   virtual void             Print(const Option_t *option="") const;
   virtual void             SavePrimitive(ostream &out, Option_t *option = "");
   void                     SetA(Double_t a) {fA = a; SetRadLen(0);}
   void                     SetZ(Double_t z) {fZ = z; SetRadLen(0);}
   void                     SetDensity(Double_t density) {fDensity = density; SetRadLen(0);}
   void                     SetIndex(Int_t index) {fIndex=index;}
   virtual void             SetCerenkovProperties(TObject* cerenkov) {fCerenkov = cerenkov;}
   void                     SetRadLen(Double_t radlen, Double_t intlen=0.);
   void                     SetUsed(Bool_t flag=kTRUE) {TObject::SetBit(kMatUsed, flag);}
   void                     SetTransparency(Char_t transparency=0) {fFillStyle = 3000+transparency;}
   void                     SetTemperature(Double_t temperature) {fTemperature = temperature;}
   void                     SetPressure(Double_t pressure) {fPressure = pressure;}
   void                     SetState(EGeoMaterialState state) {fState = state;}
   static  Double_t         ScreenFactor(Double_t z);

   

   ClassDef(TGeoMaterial, 5)              // base material class

//***** Need to add classes and globals to LinkDef.h *****
};

////////////////////////////////////////////////////////////////////////////
//                                                                        //
// TGeoMixture - mixtures of elements                                     //
//                                                                        //
////////////////////////////////////////////////////////////////////////////

class TGeoMixture : public TGeoMaterial
{
protected :
// data members
   Int_t                    fNelements;  // number of elements
   Double_t                *fZmixture;   // [fNelements] array of Z of the elements
   Double_t                *fAmixture;   // [fNelements] array of A of the elements
   Double_t                *fWeights;    // [fNelements] array of relative proportions by mass
   Int_t                   *fNatoms;     // [fNelements] array of numbers of atoms
   TObjArray               *fElements;   // array of elements composing the mixture
// methods
   TGeoMixture(const TGeoMixture&); // Not implemented
   TGeoMixture& operator=(const TGeoMixture&); // Not implemented
   void                     AverageProperties();

public:
   // constructors
   TGeoMixture();
   TGeoMixture(const char *name, Int_t nel, Double_t rho=-1);
   // destructor
   virtual ~TGeoMixture();
   // methods for adding elements
   void                     AddElement(Double_t a, Double_t z, Double_t weight);
   void                     AddElement(TGeoMaterial *mat, Double_t weight);
   void                     AddElement(TGeoElement *elem, Double_t weight);
   void                     AddElement(TGeoElement *elem, Int_t natoms);
   // backward compatibility for defining elements
   void                     DefineElement(Int_t iel, Double_t a, Double_t z, Double_t weight);
   void                     DefineElement(Int_t iel, TGeoElement *elem, Double_t weight);
   void                     DefineElement(Int_t iel, Int_t z, Int_t natoms);
   // radioactive mixture evolution
   virtual TGeoMaterial    *DecayMaterial(Double_t time, Double_t precision=0.001);
   virtual void             FillMaterialEvolution(TObjArray *population, Double_t precision=0.001);
   // getters
   virtual Int_t            GetByteCount() const {return 48+12*fNelements;}
   virtual TGeoElement     *GetElement(Int_t i=0) const;
   Int_t                    GetNelements() const {return fNelements;}
   Double_t                *GetZmixt() const     {return fZmixture;}
   Double_t                *GetAmixt() const     {return fAmixture;}
   Double_t                *GetWmixt() const     {return fWeights;}
   Int_t                   *GetNmixt() const     {return fNatoms;}
   // utilities
   virtual Bool_t           IsEq(const TGeoMaterial *other) const;
   virtual Bool_t           IsMixture() const {return kTRUE;}
   virtual void             Print(const Option_t *option="") const;
   virtual void             SavePrimitive(ostream &out, Option_t *option = "");
   void                     SetA(Double_t a) {fA = a;}
   void                     SetZ(Double_t z) {fZ = z;}

   ClassDef(TGeoMixture, 2)              // material mixtures
};

inline void TGeoMixture::DefineElement(Int_t, Double_t a, Double_t z, Double_t weight) 
   {return AddElement(a,z,weight);}
inline void TGeoMixture::DefineElement(Int_t, TGeoElement *elem, Double_t weight) 
   {return AddElement(elem,weight);}


#endif

 TGeoMaterial.h:1
 TGeoMaterial.h:2
 TGeoMaterial.h:3
 TGeoMaterial.h:4
 TGeoMaterial.h:5
 TGeoMaterial.h:6
 TGeoMaterial.h:7
 TGeoMaterial.h:8
 TGeoMaterial.h:9
 TGeoMaterial.h:10
 TGeoMaterial.h:11
 TGeoMaterial.h:12
 TGeoMaterial.h:13
 TGeoMaterial.h:14
 TGeoMaterial.h:15
 TGeoMaterial.h:16
 TGeoMaterial.h:17
 TGeoMaterial.h:18
 TGeoMaterial.h:19
 TGeoMaterial.h:20
 TGeoMaterial.h:21
 TGeoMaterial.h:22
 TGeoMaterial.h:23
 TGeoMaterial.h:24
 TGeoMaterial.h:25
 TGeoMaterial.h:26
 TGeoMaterial.h:27
 TGeoMaterial.h:28
 TGeoMaterial.h:29
 TGeoMaterial.h:30
 TGeoMaterial.h:31
 TGeoMaterial.h:32
 TGeoMaterial.h:33
 TGeoMaterial.h:34
 TGeoMaterial.h:35
 TGeoMaterial.h:36
 TGeoMaterial.h:37
 TGeoMaterial.h:38
 TGeoMaterial.h:39
 TGeoMaterial.h:40
 TGeoMaterial.h:41
 TGeoMaterial.h:42
 TGeoMaterial.h:43
 TGeoMaterial.h:44
 TGeoMaterial.h:45
 TGeoMaterial.h:46
 TGeoMaterial.h:47
 TGeoMaterial.h:48
 TGeoMaterial.h:49
 TGeoMaterial.h:50
 TGeoMaterial.h:51
 TGeoMaterial.h:52
 TGeoMaterial.h:53
 TGeoMaterial.h:54
 TGeoMaterial.h:55
 TGeoMaterial.h:56
 TGeoMaterial.h:57
 TGeoMaterial.h:58
 TGeoMaterial.h:59
 TGeoMaterial.h:60
 TGeoMaterial.h:61
 TGeoMaterial.h:62
 TGeoMaterial.h:63
 TGeoMaterial.h:64
 TGeoMaterial.h:65
 TGeoMaterial.h:66
 TGeoMaterial.h:67
 TGeoMaterial.h:68
 TGeoMaterial.h:69
 TGeoMaterial.h:70
 TGeoMaterial.h:71
 TGeoMaterial.h:72
 TGeoMaterial.h:73
 TGeoMaterial.h:74
 TGeoMaterial.h:75
 TGeoMaterial.h:76
 TGeoMaterial.h:77
 TGeoMaterial.h:78
 TGeoMaterial.h:79
 TGeoMaterial.h:80
 TGeoMaterial.h:81
 TGeoMaterial.h:82
 TGeoMaterial.h:83
 TGeoMaterial.h:84
 TGeoMaterial.h:85
 TGeoMaterial.h:86
 TGeoMaterial.h:87
 TGeoMaterial.h:88
 TGeoMaterial.h:89
 TGeoMaterial.h:90
 TGeoMaterial.h:91
 TGeoMaterial.h:92
 TGeoMaterial.h:93
 TGeoMaterial.h:94
 TGeoMaterial.h:95
 TGeoMaterial.h:96
 TGeoMaterial.h:97
 TGeoMaterial.h:98
 TGeoMaterial.h:99
 TGeoMaterial.h:100
 TGeoMaterial.h:101
 TGeoMaterial.h:102
 TGeoMaterial.h:103
 TGeoMaterial.h:104
 TGeoMaterial.h:105
 TGeoMaterial.h:106
 TGeoMaterial.h:107
 TGeoMaterial.h:108
 TGeoMaterial.h:109
 TGeoMaterial.h:110
 TGeoMaterial.h:111
 TGeoMaterial.h:112
 TGeoMaterial.h:113
 TGeoMaterial.h:114
 TGeoMaterial.h:115
 TGeoMaterial.h:116
 TGeoMaterial.h:117
 TGeoMaterial.h:118
 TGeoMaterial.h:119
 TGeoMaterial.h:120
 TGeoMaterial.h:121
 TGeoMaterial.h:122
 TGeoMaterial.h:123
 TGeoMaterial.h:124
 TGeoMaterial.h:125
 TGeoMaterial.h:126
 TGeoMaterial.h:127
 TGeoMaterial.h:128
 TGeoMaterial.h:129
 TGeoMaterial.h:130
 TGeoMaterial.h:131
 TGeoMaterial.h:132
 TGeoMaterial.h:133
 TGeoMaterial.h:134
 TGeoMaterial.h:135
 TGeoMaterial.h:136
 TGeoMaterial.h:137
 TGeoMaterial.h:138
 TGeoMaterial.h:139
 TGeoMaterial.h:140
 TGeoMaterial.h:141
 TGeoMaterial.h:142
 TGeoMaterial.h:143
 TGeoMaterial.h:144
 TGeoMaterial.h:145
 TGeoMaterial.h:146
 TGeoMaterial.h:147
 TGeoMaterial.h:148
 TGeoMaterial.h:149
 TGeoMaterial.h:150
 TGeoMaterial.h:151
 TGeoMaterial.h:152
 TGeoMaterial.h:153
 TGeoMaterial.h:154
 TGeoMaterial.h:155
 TGeoMaterial.h:156
 TGeoMaterial.h:157
 TGeoMaterial.h:158
 TGeoMaterial.h:159
 TGeoMaterial.h:160
 TGeoMaterial.h:161
 TGeoMaterial.h:162
 TGeoMaterial.h:163
 TGeoMaterial.h:164
 TGeoMaterial.h:165
 TGeoMaterial.h:166
 TGeoMaterial.h:167
 TGeoMaterial.h:168
 TGeoMaterial.h:169
 TGeoMaterial.h:170
 TGeoMaterial.h:171
 TGeoMaterial.h:172
 TGeoMaterial.h:173
 TGeoMaterial.h:174
 TGeoMaterial.h:175
 TGeoMaterial.h:176
 TGeoMaterial.h:177
 TGeoMaterial.h:178
 TGeoMaterial.h:179
 TGeoMaterial.h:180
 TGeoMaterial.h:181
 TGeoMaterial.h:182
 TGeoMaterial.h:183
 TGeoMaterial.h:184
 TGeoMaterial.h:185
 TGeoMaterial.h:186
 TGeoMaterial.h:187
 TGeoMaterial.h:188
 TGeoMaterial.h:189
 TGeoMaterial.h:190
 TGeoMaterial.h:191
 TGeoMaterial.h:192
 TGeoMaterial.h:193
 TGeoMaterial.h:194
 TGeoMaterial.h:195
 TGeoMaterial.h:196
 TGeoMaterial.h:197
 TGeoMaterial.h:198
 TGeoMaterial.h:199
 TGeoMaterial.h:200
 TGeoMaterial.h:201
 TGeoMaterial.h:202
 TGeoMaterial.h:203
 TGeoMaterial.h:204
 TGeoMaterial.h:205
 TGeoMaterial.h:206