ROOT logo
// @(#)root/geom:$Id: TGeoMaterial.cxx 27103 2009-01-08 09:32:20Z 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.             *
 *************************************************************************/

////////////////////////////////////////////////////////////////////////////////
//
//Begin_Html
/*
<img src="gif/t_material.jpg">
*/
//End_Html
#include "Riostream.h"
#include "TMath.h"
#include "TObjArray.h"
#include "TStyle.h"
#include "TList.h"
#include "TGeoManager.h"
#include "TGeoMaterial.h"

// statics and globals

ClassImp(TGeoMaterial)

//_____________________________________________________________________________
TGeoMaterial::TGeoMaterial()
             :TNamed(), TAttFill(),
              fIndex(0),
              fA(0.),
              fZ(0.),
              fDensity(0.),
              fRadLen(0.),
              fIntLen(0.),
              fTemperature(0.),
              fPressure(0.),
              fState(kMatStateUndefined),
              fShader(NULL),
              fCerenkov(NULL),
              fElement(NULL)
{
// Default constructor
   SetUsed(kFALSE);
   fIndex    = -1;
   fTemperature = STP_temperature;
   fPressure = STP_pressure;
   fState = kMatStateUndefined;
}

//_____________________________________________________________________________
TGeoMaterial::TGeoMaterial(const char *name)
             :TNamed(name, ""), TAttFill(),
              fIndex(0),
              fA(0.),
              fZ(0.),
              fDensity(0.),
              fRadLen(0.),
              fIntLen(0.),
              fTemperature(0.),
              fPressure(0.),
              fState(kMatStateUndefined),
              fShader(NULL),
              fCerenkov(NULL),
              fElement(NULL)
{
// constructor
   fName = fName.Strip();
   SetUsed(kFALSE);
   fIndex    = -1;
   fTemperature = STP_temperature;
   fPressure = STP_pressure;
   fState = kMatStateUndefined;
   
   if (!gGeoManager) {
      gGeoManager = new TGeoManager("Geometry", "default geometry");
   }
   gGeoManager->AddMaterial(this);
}

//_____________________________________________________________________________
TGeoMaterial::TGeoMaterial(const char *name, Double_t a, Double_t z, 
                Double_t rho, Double_t radlen, Double_t intlen)
             :TNamed(name, ""), TAttFill(),
              fIndex(0),
              fA(a),
              fZ(z),
              fDensity(rho),
              fRadLen(0.),
              fIntLen(0.),
              fTemperature(0.),
              fPressure(0.),
              fState(kMatStateUndefined),
              fShader(NULL),
              fCerenkov(NULL),
              fElement(NULL)
{
// constructor
   fName = fName.Strip();
   SetUsed(kFALSE);
   fIndex    = -1;
   fA        = a;
   fZ        = z;
   fDensity  = rho;
   fTemperature = STP_temperature;
   fPressure = STP_pressure;
   fState = kMatStateUndefined;
   SetRadLen(radlen, intlen);
   if (!gGeoManager) {
      gGeoManager = new TGeoManager("Geometry", "default geometry");
   }
   if (fZ - Int_t(fZ) > 1E-3)
      Warning("ctor", "Material %s defined with fractional Z=%f", GetName(), fZ);
   GetElement()->SetUsed();
   gGeoManager->AddMaterial(this);
}

//_____________________________________________________________________________
TGeoMaterial::TGeoMaterial(const char *name, Double_t a, Double_t z, Double_t rho,
                EGeoMaterialState state, Double_t temperature, Double_t pressure)
             :TNamed(name, ""), TAttFill(),
              fIndex(0),
              fA(a),
              fZ(z),
              fDensity(rho),
              fRadLen(0.),
              fIntLen(0.),
              fTemperature(temperature),
              fPressure(pressure),
              fState(state),
              fShader(NULL),
              fCerenkov(NULL),
              fElement(NULL)
{
// Constructor with state, temperature and pressure.
   fName = fName.Strip();
   SetUsed(kFALSE);
   fIndex    = -1;
   SetRadLen(0,0);
   if (!gGeoManager) {
      gGeoManager = new TGeoManager("Geometry", "default geometry");
   }
   if (fZ - Int_t(fZ) > 1E-3)
      Warning("ctor", "Material %s defined with fractional Z=%f", GetName(), fZ);
   GetElement()->SetUsed();
   gGeoManager->AddMaterial(this);
}

//_____________________________________________________________________________
TGeoMaterial::TGeoMaterial(const char *name, TGeoElement *elem, Double_t rho)
             :TNamed(name, ""), TAttFill(),
              fIndex(0),
              fA(0.),
              fZ(0.),
              fDensity(rho),
              fRadLen(0.),
              fIntLen(0.),
              fTemperature(0.),
              fPressure(0.),
              fState(kMatStateUndefined),
              fShader(NULL),
              fCerenkov(NULL),
              fElement(elem)
{
// constructor
   fName = fName.Strip();
   SetUsed(kFALSE);
   fIndex    = -1;
   fA        = elem->A();
   fZ        = elem->Z();
   SetRadLen(0,0);
   fTemperature = STP_temperature;
   fPressure = STP_pressure;
   fState = kMatStateUndefined;
   if (!gGeoManager) {
      gGeoManager = new TGeoManager("Geometry", "default geometry");
   }
   if (fZ - Int_t(fZ) > 1E-3)
      Warning("ctor", "Material %s defined with fractional Z=%f", GetName(), fZ);
   GetElement()->SetUsed();
   gGeoManager->AddMaterial(this);
}

//_____________________________________________________________________________
TGeoMaterial::TGeoMaterial(const TGeoMaterial& gm) :
              TNamed(gm),
              TAttFill(gm),
              fIndex(gm.fIndex),
              fA(gm.fA),
              fZ(gm.fZ),
              fDensity(gm.fDensity),
              fRadLen(gm.fRadLen),
              fIntLen(gm.fIntLen),
              fTemperature(gm.fTemperature),
              fPressure(gm.fPressure),
              fState(gm.fState),
              fShader(gm.fShader),
              fCerenkov(gm.fCerenkov),
              fElement(gm.fElement)
{ 
   //copy constructor
}

//_____________________________________________________________________________
TGeoMaterial& TGeoMaterial::operator=(const TGeoMaterial& gm) 
{
   //assignment operator
   if(this!=&gm) {
      TNamed::operator=(gm);
      TAttFill::operator=(gm);
      fIndex=gm.fIndex;
      fA=gm.fA;
      fZ=gm.fZ;
      fDensity=gm.fDensity;
      fRadLen=gm.fRadLen;
      fIntLen=gm.fIntLen;
      fTemperature=gm.fTemperature;
      fPressure=gm.fPressure;
      fState=gm.fState;
      fShader=gm.fShader;
      fCerenkov=gm.fCerenkov;
      fElement=gm.fElement;
   } 
   return *this;
}

//_____________________________________________________________________________
TGeoMaterial::~TGeoMaterial()
{
// Destructor
}

//_____________________________________________________________________________
char *TGeoMaterial::GetPointerName() const
{
// Provide a pointer name containing uid.
   static char name[20];
   sprintf(name,"pMat%d", GetUniqueID());
   return name;
}    

//_____________________________________________________________________________
void TGeoMaterial::SetRadLen(Double_t radlen, Double_t intlen)
{
// Set radiation/absorbtion lengths. If the values are negative, their absolute value
// is taken, otherwise radlen is recomputed using G3 formula.
   fRadLen = TMath::Abs(radlen);
   fIntLen = TMath::Abs(intlen);
   // compute radlen systematically with G3 formula for a valid material
   if (fA > 0 && fZ > 0 && radlen>=0) {
      //taken grom Geant3 routine GSMATE
      const Double_t alr2av=1.39621E-03, al183=5.20948;
      fRadLen = fA/(alr2av*fDensity*fZ*(fZ +TGeoMaterial::ScreenFactor(fZ))*
             (al183-TMath::Log(fZ)/3-TGeoMaterial::Coulomb(fZ)));
   } else {
      if (radlen>0) Error("SetRadLen","Invalid material %s: a=%f z=%f -> user values taken: radlen=%f intlen=%f",fA,fZ,radlen,intlen);
   }   
}   

//_____________________________________________________________________________
Double_t TGeoMaterial::Coulomb(Double_t z)
{
   // static function
   //  Compute Coulomb correction for pair production and Brem 
   //  REFERENCE : EGS MANUAL SLAC 210 - UC32 - JUNE 78
   //                        FORMULA 2.7.17
   
   const Double_t alpha = 7.29927E-03;

   Double_t az    = alpha*z;
   Double_t az2   = az*az;
   Double_t az4   =   az2 * az2;
   Double_t fp    = ( 0.0083*az4 + 0.20206 + 1./(1.+az2) ) * az2;
   Double_t fm    = ( 0.0020*az4 + 0.0369  ) * az4;
   return fp - fm;
}

//_____________________________________________________________________________
Bool_t TGeoMaterial::IsEq(const TGeoMaterial *other) const
{
// return true if the other material has the same physical properties
   if (other==this) return kTRUE;
   if (other->IsMixture()) return kFALSE;
   if (TMath::Abs(fA-other->GetA())>1E-3) return kFALSE;
   if (TMath::Abs(fZ-other->GetZ())>1E-3) return kFALSE;
   if (TMath::Abs(fDensity-other->GetDensity())>1E-6) return kFALSE;
   if (GetCerenkovProperties() != other->GetCerenkovProperties()) return kFALSE;
//   if (fRadLen != other->GetRadLen()) return kFALSE;
//   if (fIntLen != other->GetIntLen()) return kFALSE;
   return kTRUE;
}

//_____________________________________________________________________________
void TGeoMaterial::Print(const Option_t * /*option*/) const
{
// print characteristics of this material
   printf("Material %s %s   A=%g Z=%g rho=%g radlen=%g index=%i\n", GetName(), GetTitle(),
          fA,fZ,fDensity, fRadLen, fIndex);
}

//_____________________________________________________________________________
void TGeoMaterial::SavePrimitive(ostream &out, Option_t * /*option*/ /*= ""*/)
{
// Save a primitive as a C++ statement(s) on output stream "out".
   if (TestBit(TGeoMaterial::kMatSavePrimitive)) return;
   char *name = GetPointerName();
   out << "// Material: " << GetName() << endl;
   out << "   a       = " << fA << ";" << endl;
   out << "   z       = " << fZ << ";" << endl;
   out << "   density = " << fDensity << ";" << endl;
   out << "   radl    = " << fRadLen << ";" << endl;
   out << "   absl    = " << fIntLen << ";" << endl;
   
   out << "   " << name << " = new TGeoMaterial(\"" << GetName() << "\", a,z,density,radl,absl);" << endl;
   out << "   " << name << "->SetIndex(" << GetIndex() << ");" << endl;
   SetBit(TGeoMaterial::kMatSavePrimitive);
}

//_____________________________________________________________________________
Int_t TGeoMaterial::GetDefaultColor() const
{
// Get some default color related to this material.
   Int_t id = 1+ gGeoManager->GetListOfMaterials()->IndexOf(this);
   return (2+id%6);
}

//_____________________________________________________________________________
TGeoElement *TGeoMaterial::GetElement(Int_t) const
{
// Get a pointer to the element this material is made of.
   if (fElement) return fElement;
   TGeoElementTable *table = gGeoManager->GetElementTable();
   return table->GetElement(Int_t(fZ));
}

//_____________________________________________________________________________
Int_t TGeoMaterial::GetIndex()
{
// Retreive material index in the list of materials
   if (fIndex>=0) return fIndex;
   TList *matlist = gGeoManager->GetListOfMaterials();
   fIndex = matlist->IndexOf(this);
   return fIndex;
}      

//_____________________________________________________________________________
TGeoMaterial *TGeoMaterial::DecayMaterial(Double_t time, Double_t precision)
{
// Create the material representing the decay product of this material at a
// given time. The precision represent the minimum cumulative branching ratio for 
// which decay products are still taken into account.
   TObjArray *pop = new TObjArray();
   if (!fElement || !fElement->IsRadioNuclide()) return this;
   FillMaterialEvolution(pop, precision);
   Int_t ncomp = pop->GetEntriesFast();
   if (!ncomp) return this;
   TGeoElementRN *el;
   Double_t *weight = new Double_t[ncomp];
   Double_t amed = 0.;
   Int_t i;
   for (i=0; i<ncomp; i++) {
      el = (TGeoElementRN *)pop->At(i);
      weight[i] = el->Ratio()->Concentration(time) * el->A();
      amed += weight[i];
   }  
   Double_t rho = fDensity*amed/fA;
   TGeoMixture *mix = 0;
   Int_t ncomp1 = ncomp;
   for (i=0; i<ncomp; i++) {
      if ((weight[i]/amed)<precision) {
         amed -= weight[i];
         ncomp1--;
      }
   }
   if (ncomp1>1) mix = new TGeoMixture(Form("%s-evol",GetName()), ncomp, rho); 
   for (i=0; i<ncomp; i++) {
      weight[i] /= amed;
      if (weight[i]<precision) continue;
      el = (TGeoElementRN *)pop->At(i);
      if (ncomp1==1) return new TGeoMaterial(Form("%s-evol",GetName()), el, rho);
      mix->AddElement(el, weight[i]);
   }
   delete [] weight;
   delete pop;
   return mix;
}      

//_____________________________________________________________________________
void TGeoMaterial::FillMaterialEvolution(TObjArray *population, Double_t precision)
{
// Fills a user array with all the elements deriving from the possible
// decay of the top element composing the mixture. Each element contained
// by <population> may be a radionuclide having a Bateman solution attached.
// The precision represent the minimum cumulative branching ratio for 
// which decay products are still taken into account.
// To visualize the time evolution of each decay product one can use:
//    TGeoElement *elem = population->At(index);
//    TGeoElementRN *elemrn = 0;
//    if (elem->IsRadioNuclide()) elemrn = (TGeoElementRN*)elem;
// One can get Ni/N1(t=0) at any moment of time. Ni is the number of atoms
// of one of the decay products, N1(0) is the number of atoms of the top
// element at t=0.
//    Double_t fraction_weight = elemrn->Ratio()->Concentration(time);
// One can also display the time evolution of the fractional weigth:
//    elemrn->Ratio()->Draw(option);
   if (population->GetEntriesFast()) {
      Error("FillMaterialEvolution", "Provide an empty array !");
      return;
   }
   TGeoElementTable *table = gGeoManager->GetElementTable();
   TGeoElement *elem;
   TGeoElementRN *elemrn;
   TIter next(table->GetElementsRN());
   while ((elemrn=(TGeoElementRN*)next())) elemrn->ResetRatio();
   elem = GetElement();
   if (!elem->IsRadioNuclide()) {
      population->Add(elem);
      return;
   }
   elemrn = (TGeoElementRN*)elem;
   elemrn->FillPopulation(population, precision);
}      


/*************************************************************************
 * TGeoMixture - mixtures of elements 
 *
 *************************************************************************/
ClassImp(TGeoMixture)

//_____________________________________________________________________________
TGeoMixture::TGeoMixture()
{
// Default constructor
   fNelements = 0;
   fZmixture  = 0;
   fAmixture  = 0;
   fWeights   = 0;
   fNatoms    = 0;
   fElements  = 0;
}

//_____________________________________________________________________________
TGeoMixture::TGeoMixture(const char *name, Int_t /*nel*/, Double_t rho)
            :TGeoMaterial(name)
{
// constructor
   fZmixture   = 0;
   fAmixture   = 0;
   fWeights    = 0;
   fNelements  = 0;
   fNatoms     = 0;
   fDensity = rho;
   fElements   = 0;
   if (fDensity < 0) fDensity = 0.001;
}

//_____________________________________________________________________________
TGeoMixture::TGeoMixture(const TGeoMixture& gm) :
  TGeoMaterial(gm),
  fNelements(gm.fNelements),
  fZmixture(gm.fZmixture),
  fAmixture(gm.fAmixture),
  fWeights(gm.fWeights),
  fNatoms(gm.fNatoms),
  fElements(gm.fElements)
{ 
   //copy constructor
}

//_____________________________________________________________________________
TGeoMixture& TGeoMixture::operator=(const TGeoMixture& gm) 
{
   //assignment operator
   if(this!=&gm) {
      TGeoMaterial::operator=(gm);
      fNelements=gm.fNelements;
      fZmixture=gm.fZmixture;
      fAmixture=gm.fAmixture;
      fWeights=gm.fWeights;
      fNatoms = gm.fNatoms;
      fElements = gm.fElements;
   } 
   return *this;
}

//_____________________________________________________________________________
TGeoMixture::~TGeoMixture()
{
// Destructor
   if (fZmixture) delete[] fZmixture;
   if (fAmixture) delete[] fAmixture;
   if (fWeights)  delete[] fWeights;
   if (fNatoms)   delete[] fNatoms;
   if (fElements) delete fElements;
}

//_____________________________________________________________________________
void TGeoMixture::AverageProperties()
{
// Compute effective A/Z and radiation length
   const Double_t alr2av = 1.39621E-03 , al183 =5.20948;
   Double_t radinv = 0;
   fA = 0;
   fZ = 0;
   for (Int_t j=0;j<fNelements;j++) {
      if (fWeights[j] <= 0) continue;
      fA += fWeights[j]*fAmixture[j];
      fZ += fWeights[j]*fZmixture[j];
      Double_t zc = fZmixture[j];
      Double_t alz = TMath::Log(zc)/3.;
      Double_t xinv = zc*(zc+TGeoMaterial::ScreenFactor(zc))*
         (al183-alz-TGeoMaterial::Coulomb(zc))/fAmixture[j];
      radinv += xinv*fWeights[j];
   }
   radinv *= alr2av*fDensity;
   if (radinv > 0) fRadLen = 1/radinv;
}

//_____________________________________________________________________________
void TGeoMixture::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
   TGeoElementTable *table = gGeoManager->GetElementTable();
   if (z<1 || z>table->GetNelements()-1)
      Fatal("AddElement", "Cannot add element having Z=%d to mixture %s", (Int_t)z, GetName());
   Int_t i;
   for (i=0; i<fNelements; i++) {
      if (TMath::Abs(z-fZmixture[i])<1.e-6  && TMath::Abs(a-fAmixture[i])<1.e-6) {
         fWeights[i] += weight;
         AverageProperties();
         return;
      }
   }      
   if (!fNelements) {
      fZmixture = new Double_t[1];
      fAmixture = new Double_t[1];
      fWeights  = new Double_t[1];
   } else {   
      Int_t nelements = fNelements+1;
      Double_t *zmixture = new Double_t[nelements];
      Double_t *amixture = new Double_t[nelements];
      Double_t *weights  = new Double_t[nelements];
      for (Int_t j=0; j<fNelements; j++) {
         zmixture[j] = fZmixture[j];
         amixture[j] = fAmixture[j];
         weights[j]  = fWeights[j];
      }
      delete [] fZmixture;
      delete [] fAmixture;
      delete [] fWeights;
      fZmixture = zmixture;
      fAmixture = amixture;
      fWeights  = weights;
   }       
   
   fNelements++;
   i = fNelements - 1;   
   fZmixture[i] = z;
   fAmixture[i] = a;
   fWeights[i]  = weight;
   if (z - Int_t(z) > 1E-3)
      Warning("DefineElement", "Mixture %s has element defined with fractional Z=%f", GetName(), z);
   GetElement(i)->SetDefined();
   table->GetElement((Int_t)z)->SetDefined();
   
   //compute equivalent radiation length (taken from Geant3/GSMIXT)
   AverageProperties();
}

//_____________________________________________________________________________
void TGeoMixture::AddElement(TGeoMaterial *mat, Double_t weight)
{
// Define one component of the mixture as an existing material/mixture.
   TGeoElement *elnew, *elem;   
   Double_t a,z;
   if (!mat->IsMixture()) {
      elem = mat->GetBaseElement();
      if (elem) {
         AddElement(elem, weight);
      } else {   
         a = mat->GetA();
         z = mat->GetZ();
         AddElement(a, z, weight);
      }   
      return;
   }
   // The material is a mixture.
   TGeoMixture *mix = (TGeoMixture*)mat;
   Double_t wnew;
   Int_t nelem = mix->GetNelements();
   Bool_t elfound;
   Int_t i,j;
   // loop the elements of the daughter mixture
   for (i=0; i<nelem; i++) {
      elfound = kFALSE;
      elnew = mix->GetElement(i);
      if (!elnew) continue;
      // check if we have the element already defined in the parent mixture
      for (j=0; j<fNelements; j++) {
         if (fWeights[j]<=0) continue;
         elem = GetElement(j);
         if (elem == elnew) {
            // element found, compute new weight
            fWeights[j] += weight * (mix->GetWmixt())[i];
            elfound = kTRUE;
            break;
         }
      }
      if (elfound) continue;
      // element not found, define it
      wnew = weight * (mix->GetWmixt())[i];
      AddElement(elnew, wnew);
   }   
}         

//_____________________________________________________________________________
void TGeoMixture::AddElement(TGeoElement *elem, Double_t weight)
{
// add an element to the mixture using fraction by weight
   TGeoElement *elemold;
   TGeoElementTable *table = gGeoManager->GetElementTable();
   if (!fElements) fElements = new TObjArray(10);
   Bool_t exist = kFALSE;
   // If previous elements were defined by A/Z, add corresponding TGeoElements
   for (Int_t i=0; i<fNelements; i++) {
      elemold = (TGeoElement*)fElements->At(i);
      if (!elemold) fElements->AddAt(elemold = table->GetElement((Int_t)fZmixture[i]), i);   
      if (elemold == elem) exist = kTRUE;
   }
   if (!exist) fElements->AddAtAndExpand(elem, fNelements);   
   AddElement(elem->A(), elem->Z(), weight);
}   

//_____________________________________________________________________________
void TGeoMixture::AddElement(TGeoElement *elem, Int_t natoms)
{
// Add a mixture element by number of atoms in the chemical formula.
   Int_t i,j;
   Double_t amol;
   TGeoElement *elemold;
   TGeoElementTable *table = gGeoManager->GetElementTable();
   if (!fElements) fElements = new TObjArray(10);
   // Check if the element is already defined
   for (i=0; i<fNelements; i++) {
      elemold = (TGeoElement*)fElements->At(i);
      if (!elemold) fElements->AddAt(table->GetElement((Int_t)fZmixture[i]), i);
      else if (elemold != elem) continue;
      if ((elem==elemold) || 
          (TMath::Abs(elem->Z()-fZmixture[i])<1.e-6 && TMath::Abs(elem->A()-fAmixture[i])<1.e-6)) {
         fNatoms[i] += natoms;
         amol = 0.;
         for (j=0; j<fNelements; j++) amol += fAmixture[j]*fNatoms[j];
         for (j=0; j<fNelements; j++) fWeights[j] = fNatoms[j]*fAmixture[j]/amol;
         AverageProperties();
         return;
      }
   }
   // New element      
   if (!fNelements) {
      fZmixture = new Double_t[1];
      fAmixture = new Double_t[1];
      fWeights  = new Double_t[1];
      fNatoms   = new Int_t[1];
   } else {   
      if (!fNatoms) {
         Fatal("AddElement", "Cannot add element by natoms in mixture %s after defining elements by weight",
               GetName());
         return;
      }         
      Int_t nelements = fNelements+1;
      Double_t *zmixture = new Double_t[nelements];
      Double_t *amixture = new Double_t[nelements];
      Double_t *weights  = new Double_t[nelements];
      Int_t *nnatoms  = new Int_t[nelements];
      for (j=0; j<fNelements; j++) {
         zmixture[j] = fZmixture[j];
         amixture[j] = fAmixture[j];
         weights[j]  = fWeights[j];
         nnatoms[j]  = fNatoms[j];
      }
      delete [] fZmixture;
      delete [] fAmixture;
      delete [] fWeights;
      delete [] fNatoms;
      fZmixture = zmixture;
      fAmixture = amixture;
      fWeights  = weights;
      fNatoms   = nnatoms;
   }
   fNelements++;       
   Int_t iel = fNelements-1;
   fZmixture[iel] = elem->Z();
   fAmixture[iel] = elem->A();
   fNatoms[iel]  = natoms;
   fElements->AddAtAndExpand(elem, iel);
   amol = 0.;
   for (i=0; i<fNelements; i++) {
      if (fNatoms[i]<=0) return;
      amol += fAmixture[i]*fNatoms[i];
   }   
   for (i=0; i<fNelements; i++) fWeights[i] = fNatoms[i]*fAmixture[i]/amol;
   table->GetElement(elem->Z())->SetDefined();
   AverageProperties();
}          

//_____________________________________________________________________________
void TGeoMixture::DefineElement(Int_t /*iel*/, Int_t z, Int_t natoms)
{
// Define the mixture element at index iel by number of atoms in the chemical formula.
   TGeoElementTable *table = gGeoManager->GetElementTable();
   TGeoElement *elem = table->GetElement(z);
   if (!elem) Fatal("DefineElement", "In mixture %s, element with Z=%i not found",GetName(),z);
   AddElement(elem, natoms);
}
   
//_____________________________________________________________________________
TGeoElement *TGeoMixture::GetElement(Int_t i) const
{
// Retreive the pointer to the element corresponding to component I.
   if (i<0 || i>=fNelements) {
      Error("GetElement", "Mixture %s has only %d elements", GetName(), fNelements);
      return 0;
   }   
   TGeoElement *elem = 0;
   if (fElements) elem = (TGeoElement*)fElements->At(i);
   if (elem) return elem;
   TGeoElementTable *table = gGeoManager->GetElementTable();
   return table->GetElement(Int_t(fZmixture[i]));
}

//_____________________________________________________________________________
Bool_t TGeoMixture::IsEq(const TGeoMaterial *other) const
{
// Return true if the other material has the same physical properties
   if (other->IsEqual(this)) return kTRUE;
   if (!other->IsMixture()) return kFALSE;
   TGeoMixture *mix = (TGeoMixture*)other;
   if (!mix) return kFALSE;
   if (fNelements != mix->GetNelements()) return kFALSE;
   if (TMath::Abs(fA-other->GetA())>1E-3) return kFALSE;
   if (TMath::Abs(fZ-other->GetZ())>1E-3) return kFALSE;
   if (TMath::Abs(fDensity-other->GetDensity())>1E-6) return kFALSE;
   if (GetCerenkovProperties() != other->GetCerenkovProperties()) return kFALSE;
//   if (fRadLen != other->GetRadLen()) return kFALSE;
//   if (fIntLen != other->GetIntLen()) return kFALSE;
   for (Int_t i=0; i<fNelements; i++) {
      if (TMath::Abs(fZmixture[i]-(mix->GetZmixt())[i])>1E-3) return kFALSE;
      if (TMath::Abs(fAmixture[i]-(mix->GetAmixt())[i])>1E-3) return kFALSE;
      if (TMath::Abs(fWeights[i]-(mix->GetWmixt())[i])>1E-3) return kFALSE;
   }
   return kTRUE;
}

//_____________________________________________________________________________
void TGeoMixture::Print(const Option_t * /*option*/) const
{
// print characteristics of this material
   printf("Mixture %s %s   Aeff=%g Zeff=%g rho=%g radlen=%g index=%i\n", GetName(), GetTitle(),
          fA,fZ,fDensity, fRadLen, fIndex);
   for (Int_t i=0; i<fNelements; i++) {
      if (fNatoms) printf("   Element #%i : %s  Z=%6.2f A=%6.2f w=%6.3f natoms=%d\n", i, GetElement(i)->GetName(),fZmixture[i],
             fAmixture[i], fWeights[i], fNatoms[i]);
      else printf("   Element #%i : %s  Z=%6.2f A=%6.2f w=%6.3f\n", i, GetElement(i)->GetName(),fZmixture[i],
             fAmixture[i], fWeights[i]);
   }
}

//_____________________________________________________________________________
void TGeoMixture::SavePrimitive(ostream &out, Option_t * /*option*/ /*= ""*/)
{
// Save a primitive as a C++ statement(s) on output stream "out".
   if (TestBit(TGeoMaterial::kMatSavePrimitive)) return;
   char *name = GetPointerName();
   out << "// Mixture: " << GetName() << endl;
   out << "   nel     = " << fNelements << ";" << endl;
   out << "   density = " << fDensity << ";" << endl;
   out << "   " << name << " = new TGeoMixture(\"" << GetName() << "\", nel,density);" << endl;
   for (Int_t i=0; i<fNelements; i++) {
      TGeoElement *el = GetElement(i);
      out << "      a = " << fAmixture[i] << ";   z = "<< fZmixture[i] << ";   w = " << fWeights[i] << ";  // " << el->GetName() << endl;
      out << "   " << name << "->DefineElement(" << i << ",a,z,w);" << endl;
   }         
   out << "   " << name << "->SetIndex(" << GetIndex() << ");" << endl;
   SetBit(TGeoMaterial::kMatSavePrimitive);
}

//_____________________________________________________________________________
TGeoMaterial *TGeoMixture::DecayMaterial(Double_t time, Double_t precision)
{
// Create the mixture representing the decay product of this material at a
// given time. The precision represent the minimum cumulative branching ratio for 
// which decay products are still taken into account.
   TObjArray *pop = new TObjArray();
   FillMaterialEvolution(pop, precision);
   Int_t ncomp = pop->GetEntriesFast();
   if (!ncomp) return this;
   TGeoElement *elem;
   TGeoElementRN *el;
   Double_t *weight = new Double_t[ncomp];
   Double_t amed = 0.;
   Int_t i, j;
   for (i=0; i<ncomp; i++) {
      elem = (TGeoElement *)pop->At(i);
      if (!elem->IsRadioNuclide()) {
         j = fElements->IndexOf(elem);
         weight[i] = fWeights[j]*fAmixture[0]/fWeights[0];
      } else {   
         el = (TGeoElementRN*)elem;
         weight[i] = el->Ratio()->Concentration(time) * el->A();
      }   
      amed += weight[i];
   }  
   Double_t rho = fDensity * fWeights[0] * amed/fAmixture[0];
   TGeoMixture *mix = 0;
   Int_t ncomp1 = ncomp;
   for (i=0; i<ncomp; i++) {
      if ((weight[i]/amed)<precision) {
         amed -= weight[i];
         ncomp1--;
      }
   }
   if (ncomp1>1) mix = new TGeoMixture(Form("%s-evol",GetName()), ncomp, rho); 
   for (i=0; i<ncomp; i++) {
      weight[i] /= amed;
      if (weight[i]<precision) continue;
      el = (TGeoElementRN *)pop->At(i);
      if (ncomp1==1) return new TGeoMaterial(Form("%s-evol",GetName()), el, rho);
      mix->AddElement(el, weight[i]);
   }
   delete [] weight;
   delete pop;
   return mix;
}      

//_____________________________________________________________________________
void TGeoMixture::FillMaterialEvolution(TObjArray *population, Double_t precision)
{
// Fills a user array with all the elements deriving from the possible
// decay of the top elements composing the mixture. Each element contained
// by <population> may be a radionuclide having a Bateman solution attached.
// The precision represent the minimum cumulative branching ratio for 
// which decay products are still taken into account.
// To visualize the time evolution of each decay product one can use:
//    TGeoElement *elem = population->At(index);
//    TGeoElementRN *elemrn = 0;
//    if (elem->IsRadioNuclide()) elemrn = (TGeoElementRN*)elem;
// One can get Ni/N1(t=0) at any moment of time. Ni is the number of atoms
// of one of the decay products, N1(0) is the number of atoms of the first top
// element at t=0.
//    Double_t fraction_weight = elemrn->Ratio()->Concentration(time);
// One can also display the time evolution of the fractional weigth:
//    elemrn->Ratio()->Draw(option);
   if (population->GetEntriesFast()) {
      Error("FillMaterialEvolution", "Provide an empty array !");
      return;
   }
   TGeoElementTable *table = gGeoManager->GetElementTable();
   TGeoElement *elem;
   TGeoElementRN *elemrn;
   TIter next(table->GetElementsRN());
   while ((elemrn=(TGeoElementRN*)next())) elemrn->ResetRatio();
   Double_t factor;
   for (Int_t i=0; i<fNelements; i++) {
      elem = GetElement(i);
      if (!elem->IsRadioNuclide()) {
         population->Add(elem);
         continue;
      }
      elemrn = (TGeoElementRN*)elem;
      factor = fWeights[i]*fAmixture[0]/(fWeights[0]*fAmixture[i]);
      elemrn->FillPopulation(population, precision, factor);
   }   
}      

//_____________________________________________________________________________
Double_t TGeoMaterial::ScreenFactor(Double_t z)
{
   // static function
   //  Compute screening factor for pair production and Bremstrahlung
   //  REFERENCE : EGS MANUAL SLAC 210 - UC32 - JUNE 78
   //                        FORMULA 2.7.22
   
   const Double_t al183= 5.20948 , al1440 = 7.27239;
   Double_t alz  = TMath::Log(z)/3.;
   Double_t factor = (al1440 - 2*alz) / (al183 - alz - TGeoMaterial::Coulomb(z));
   return factor;
}
 TGeoMaterial.cxx:1
 TGeoMaterial.cxx:2
 TGeoMaterial.cxx:3
 TGeoMaterial.cxx:4
 TGeoMaterial.cxx:5
 TGeoMaterial.cxx:6
 TGeoMaterial.cxx:7
 TGeoMaterial.cxx:8
 TGeoMaterial.cxx:9
 TGeoMaterial.cxx:10
 TGeoMaterial.cxx:11
 TGeoMaterial.cxx:12
 TGeoMaterial.cxx:13
 TGeoMaterial.cxx:14
 TGeoMaterial.cxx:15
 TGeoMaterial.cxx:16
 TGeoMaterial.cxx:17
 TGeoMaterial.cxx:18
 TGeoMaterial.cxx:19
 TGeoMaterial.cxx:20
 TGeoMaterial.cxx:21
 TGeoMaterial.cxx:22
 TGeoMaterial.cxx:23
 TGeoMaterial.cxx:24
 TGeoMaterial.cxx:25
 TGeoMaterial.cxx:26
 TGeoMaterial.cxx:27
 TGeoMaterial.cxx:28
 TGeoMaterial.cxx:29
 TGeoMaterial.cxx:30
 TGeoMaterial.cxx:31
 TGeoMaterial.cxx:32
 TGeoMaterial.cxx:33
 TGeoMaterial.cxx:34
 TGeoMaterial.cxx:35
 TGeoMaterial.cxx:36
 TGeoMaterial.cxx:37
 TGeoMaterial.cxx:38
 TGeoMaterial.cxx:39
 TGeoMaterial.cxx:40
 TGeoMaterial.cxx:41
 TGeoMaterial.cxx:42
 TGeoMaterial.cxx:43
 TGeoMaterial.cxx:44
 TGeoMaterial.cxx:45
 TGeoMaterial.cxx:46
 TGeoMaterial.cxx:47
 TGeoMaterial.cxx:48
 TGeoMaterial.cxx:49
 TGeoMaterial.cxx:50
 TGeoMaterial.cxx:51
 TGeoMaterial.cxx:52
 TGeoMaterial.cxx:53
 TGeoMaterial.cxx:54
 TGeoMaterial.cxx:55
 TGeoMaterial.cxx:56
 TGeoMaterial.cxx:57
 TGeoMaterial.cxx:58
 TGeoMaterial.cxx:59
 TGeoMaterial.cxx:60
 TGeoMaterial.cxx:61
 TGeoMaterial.cxx:62
 TGeoMaterial.cxx:63
 TGeoMaterial.cxx:64
 TGeoMaterial.cxx:65
 TGeoMaterial.cxx:66
 TGeoMaterial.cxx:67
 TGeoMaterial.cxx:68
 TGeoMaterial.cxx:69
 TGeoMaterial.cxx:70
 TGeoMaterial.cxx:71
 TGeoMaterial.cxx:72
 TGeoMaterial.cxx:73
 TGeoMaterial.cxx:74
 TGeoMaterial.cxx:75
 TGeoMaterial.cxx:76
 TGeoMaterial.cxx:77
 TGeoMaterial.cxx:78
 TGeoMaterial.cxx:79
 TGeoMaterial.cxx:80
 TGeoMaterial.cxx:81
 TGeoMaterial.cxx:82
 TGeoMaterial.cxx:83
 TGeoMaterial.cxx:84
 TGeoMaterial.cxx:85
 TGeoMaterial.cxx:86
 TGeoMaterial.cxx:87
 TGeoMaterial.cxx:88
 TGeoMaterial.cxx:89
 TGeoMaterial.cxx:90
 TGeoMaterial.cxx:91
 TGeoMaterial.cxx:92
 TGeoMaterial.cxx:93
 TGeoMaterial.cxx:94
 TGeoMaterial.cxx:95
 TGeoMaterial.cxx:96
 TGeoMaterial.cxx:97
 TGeoMaterial.cxx:98
 TGeoMaterial.cxx:99
 TGeoMaterial.cxx:100
 TGeoMaterial.cxx:101
 TGeoMaterial.cxx:102
 TGeoMaterial.cxx:103
 TGeoMaterial.cxx:104
 TGeoMaterial.cxx:105
 TGeoMaterial.cxx:106
 TGeoMaterial.cxx:107
 TGeoMaterial.cxx:108
 TGeoMaterial.cxx:109
 TGeoMaterial.cxx:110
 TGeoMaterial.cxx:111
 TGeoMaterial.cxx:112
 TGeoMaterial.cxx:113
 TGeoMaterial.cxx:114
 TGeoMaterial.cxx:115
 TGeoMaterial.cxx:116
 TGeoMaterial.cxx:117
 TGeoMaterial.cxx:118
 TGeoMaterial.cxx:119
 TGeoMaterial.cxx:120
 TGeoMaterial.cxx:121
 TGeoMaterial.cxx:122
 TGeoMaterial.cxx:123
 TGeoMaterial.cxx:124
 TGeoMaterial.cxx:125
 TGeoMaterial.cxx:126
 TGeoMaterial.cxx:127
 TGeoMaterial.cxx:128
 TGeoMaterial.cxx:129
 TGeoMaterial.cxx:130
 TGeoMaterial.cxx:131
 TGeoMaterial.cxx:132
 TGeoMaterial.cxx:133
 TGeoMaterial.cxx:134
 TGeoMaterial.cxx:135
 TGeoMaterial.cxx:136
 TGeoMaterial.cxx:137
 TGeoMaterial.cxx:138
 TGeoMaterial.cxx:139
 TGeoMaterial.cxx:140
 TGeoMaterial.cxx:141
 TGeoMaterial.cxx:142
 TGeoMaterial.cxx:143
 TGeoMaterial.cxx:144
 TGeoMaterial.cxx:145
 TGeoMaterial.cxx:146
 TGeoMaterial.cxx:147
 TGeoMaterial.cxx:148
 TGeoMaterial.cxx:149
 TGeoMaterial.cxx:150
 TGeoMaterial.cxx:151
 TGeoMaterial.cxx:152
 TGeoMaterial.cxx:153
 TGeoMaterial.cxx:154
 TGeoMaterial.cxx:155
 TGeoMaterial.cxx:156
 TGeoMaterial.cxx:157
 TGeoMaterial.cxx:158
 TGeoMaterial.cxx:159
 TGeoMaterial.cxx:160
 TGeoMaterial.cxx:161
 TGeoMaterial.cxx:162
 TGeoMaterial.cxx:163
 TGeoMaterial.cxx:164
 TGeoMaterial.cxx:165
 TGeoMaterial.cxx:166
 TGeoMaterial.cxx:167
 TGeoMaterial.cxx:168
 TGeoMaterial.cxx:169
 TGeoMaterial.cxx:170
 TGeoMaterial.cxx:171
 TGeoMaterial.cxx:172
 TGeoMaterial.cxx:173
 TGeoMaterial.cxx:174
 TGeoMaterial.cxx:175
 TGeoMaterial.cxx:176
 TGeoMaterial.cxx:177
 TGeoMaterial.cxx:178
 TGeoMaterial.cxx:179
 TGeoMaterial.cxx:180
 TGeoMaterial.cxx:181
 TGeoMaterial.cxx:182
 TGeoMaterial.cxx:183
 TGeoMaterial.cxx:184
 TGeoMaterial.cxx:185
 TGeoMaterial.cxx:186
 TGeoMaterial.cxx:187
 TGeoMaterial.cxx:188
 TGeoMaterial.cxx:189
 TGeoMaterial.cxx:190
 TGeoMaterial.cxx:191
 TGeoMaterial.cxx:192
 TGeoMaterial.cxx:193
 TGeoMaterial.cxx:194
 TGeoMaterial.cxx:195
 TGeoMaterial.cxx:196
 TGeoMaterial.cxx:197
 TGeoMaterial.cxx:198
 TGeoMaterial.cxx:199
 TGeoMaterial.cxx:200
 TGeoMaterial.cxx:201
 TGeoMaterial.cxx:202
 TGeoMaterial.cxx:203
 TGeoMaterial.cxx:204
 TGeoMaterial.cxx:205
 TGeoMaterial.cxx:206
 TGeoMaterial.cxx:207
 TGeoMaterial.cxx:208
 TGeoMaterial.cxx:209
 TGeoMaterial.cxx:210
 TGeoMaterial.cxx:211
 TGeoMaterial.cxx:212
 TGeoMaterial.cxx:213
 TGeoMaterial.cxx:214
 TGeoMaterial.cxx:215
 TGeoMaterial.cxx:216
 TGeoMaterial.cxx:217
 TGeoMaterial.cxx:218
 TGeoMaterial.cxx:219
 TGeoMaterial.cxx:220
 TGeoMaterial.cxx:221
 TGeoMaterial.cxx:222
 TGeoMaterial.cxx:223
 TGeoMaterial.cxx:224
 TGeoMaterial.cxx:225
 TGeoMaterial.cxx:226
 TGeoMaterial.cxx:227
 TGeoMaterial.cxx:228
 TGeoMaterial.cxx:229
 TGeoMaterial.cxx:230
 TGeoMaterial.cxx:231
 TGeoMaterial.cxx:232
 TGeoMaterial.cxx:233
 TGeoMaterial.cxx:234
 TGeoMaterial.cxx:235
 TGeoMaterial.cxx:236
 TGeoMaterial.cxx:237
 TGeoMaterial.cxx:238
 TGeoMaterial.cxx:239
 TGeoMaterial.cxx:240
 TGeoMaterial.cxx:241
 TGeoMaterial.cxx:242
 TGeoMaterial.cxx:243
 TGeoMaterial.cxx:244
 TGeoMaterial.cxx:245
 TGeoMaterial.cxx:246
 TGeoMaterial.cxx:247
 TGeoMaterial.cxx:248
 TGeoMaterial.cxx:249
 TGeoMaterial.cxx:250
 TGeoMaterial.cxx:251
 TGeoMaterial.cxx:252
 TGeoMaterial.cxx:253
 TGeoMaterial.cxx:254
 TGeoMaterial.cxx:255
 TGeoMaterial.cxx:256
 TGeoMaterial.cxx:257
 TGeoMaterial.cxx:258
 TGeoMaterial.cxx:259
 TGeoMaterial.cxx:260
 TGeoMaterial.cxx:261
 TGeoMaterial.cxx:262
 TGeoMaterial.cxx:263
 TGeoMaterial.cxx:264
 TGeoMaterial.cxx:265
 TGeoMaterial.cxx:266
 TGeoMaterial.cxx:267
 TGeoMaterial.cxx:268
 TGeoMaterial.cxx:269
 TGeoMaterial.cxx:270
 TGeoMaterial.cxx:271
 TGeoMaterial.cxx:272
 TGeoMaterial.cxx:273
 TGeoMaterial.cxx:274
 TGeoMaterial.cxx:275
 TGeoMaterial.cxx:276
 TGeoMaterial.cxx:277
 TGeoMaterial.cxx:278
 TGeoMaterial.cxx:279
 TGeoMaterial.cxx:280
 TGeoMaterial.cxx:281
 TGeoMaterial.cxx:282
 TGeoMaterial.cxx:283
 TGeoMaterial.cxx:284
 TGeoMaterial.cxx:285
 TGeoMaterial.cxx:286
 TGeoMaterial.cxx:287
 TGeoMaterial.cxx:288
 TGeoMaterial.cxx:289
 TGeoMaterial.cxx:290
 TGeoMaterial.cxx:291
 TGeoMaterial.cxx:292
 TGeoMaterial.cxx:293
 TGeoMaterial.cxx:294
 TGeoMaterial.cxx:295
 TGeoMaterial.cxx:296
 TGeoMaterial.cxx:297
 TGeoMaterial.cxx:298
 TGeoMaterial.cxx:299
 TGeoMaterial.cxx:300
 TGeoMaterial.cxx:301
 TGeoMaterial.cxx:302
 TGeoMaterial.cxx:303
 TGeoMaterial.cxx:304
 TGeoMaterial.cxx:305
 TGeoMaterial.cxx:306
 TGeoMaterial.cxx:307
 TGeoMaterial.cxx:308
 TGeoMaterial.cxx:309
 TGeoMaterial.cxx:310
 TGeoMaterial.cxx:311
 TGeoMaterial.cxx:312
 TGeoMaterial.cxx:313
 TGeoMaterial.cxx:314
 TGeoMaterial.cxx:315
 TGeoMaterial.cxx:316
 TGeoMaterial.cxx:317
 TGeoMaterial.cxx:318
 TGeoMaterial.cxx:319
 TGeoMaterial.cxx:320
 TGeoMaterial.cxx:321
 TGeoMaterial.cxx:322
 TGeoMaterial.cxx:323
 TGeoMaterial.cxx:324
 TGeoMaterial.cxx:325
 TGeoMaterial.cxx:326
 TGeoMaterial.cxx:327
 TGeoMaterial.cxx:328
 TGeoMaterial.cxx:329
 TGeoMaterial.cxx:330
 TGeoMaterial.cxx:331
 TGeoMaterial.cxx:332
 TGeoMaterial.cxx:333
 TGeoMaterial.cxx:334
 TGeoMaterial.cxx:335
 TGeoMaterial.cxx:336
 TGeoMaterial.cxx:337
 TGeoMaterial.cxx:338
 TGeoMaterial.cxx:339
 TGeoMaterial.cxx:340
 TGeoMaterial.cxx:341
 TGeoMaterial.cxx:342
 TGeoMaterial.cxx:343
 TGeoMaterial.cxx:344
 TGeoMaterial.cxx:345
 TGeoMaterial.cxx:346
 TGeoMaterial.cxx:347
 TGeoMaterial.cxx:348
 TGeoMaterial.cxx:349
 TGeoMaterial.cxx:350
 TGeoMaterial.cxx:351
 TGeoMaterial.cxx:352
 TGeoMaterial.cxx:353
 TGeoMaterial.cxx:354
 TGeoMaterial.cxx:355
 TGeoMaterial.cxx:356
 TGeoMaterial.cxx:357
 TGeoMaterial.cxx:358
 TGeoMaterial.cxx:359
 TGeoMaterial.cxx:360
 TGeoMaterial.cxx:361
 TGeoMaterial.cxx:362
 TGeoMaterial.cxx:363
 TGeoMaterial.cxx:364
 TGeoMaterial.cxx:365
 TGeoMaterial.cxx:366
 TGeoMaterial.cxx:367
 TGeoMaterial.cxx:368
 TGeoMaterial.cxx:369
 TGeoMaterial.cxx:370
 TGeoMaterial.cxx:371
 TGeoMaterial.cxx:372
 TGeoMaterial.cxx:373
 TGeoMaterial.cxx:374
 TGeoMaterial.cxx:375
 TGeoMaterial.cxx:376
 TGeoMaterial.cxx:377
 TGeoMaterial.cxx:378
 TGeoMaterial.cxx:379
 TGeoMaterial.cxx:380
 TGeoMaterial.cxx:381
 TGeoMaterial.cxx:382
 TGeoMaterial.cxx:383
 TGeoMaterial.cxx:384
 TGeoMaterial.cxx:385
 TGeoMaterial.cxx:386
 TGeoMaterial.cxx:387
 TGeoMaterial.cxx:388
 TGeoMaterial.cxx:389
 TGeoMaterial.cxx:390
 TGeoMaterial.cxx:391
 TGeoMaterial.cxx:392
 TGeoMaterial.cxx:393
 TGeoMaterial.cxx:394
 TGeoMaterial.cxx:395
 TGeoMaterial.cxx:396
 TGeoMaterial.cxx:397
 TGeoMaterial.cxx:398
 TGeoMaterial.cxx:399
 TGeoMaterial.cxx:400
 TGeoMaterial.cxx:401
 TGeoMaterial.cxx:402
 TGeoMaterial.cxx:403
 TGeoMaterial.cxx:404
 TGeoMaterial.cxx:405
 TGeoMaterial.cxx:406
 TGeoMaterial.cxx:407
 TGeoMaterial.cxx:408
 TGeoMaterial.cxx:409
 TGeoMaterial.cxx:410
 TGeoMaterial.cxx:411
 TGeoMaterial.cxx:412
 TGeoMaterial.cxx:413
 TGeoMaterial.cxx:414
 TGeoMaterial.cxx:415
 TGeoMaterial.cxx:416
 TGeoMaterial.cxx:417
 TGeoMaterial.cxx:418
 TGeoMaterial.cxx:419
 TGeoMaterial.cxx:420
 TGeoMaterial.cxx:421
 TGeoMaterial.cxx:422
 TGeoMaterial.cxx:423
 TGeoMaterial.cxx:424
 TGeoMaterial.cxx:425
 TGeoMaterial.cxx:426
 TGeoMaterial.cxx:427
 TGeoMaterial.cxx:428
 TGeoMaterial.cxx:429
 TGeoMaterial.cxx:430
 TGeoMaterial.cxx:431
 TGeoMaterial.cxx:432
 TGeoMaterial.cxx:433
 TGeoMaterial.cxx:434
 TGeoMaterial.cxx:435
 TGeoMaterial.cxx:436
 TGeoMaterial.cxx:437
 TGeoMaterial.cxx:438
 TGeoMaterial.cxx:439
 TGeoMaterial.cxx:440
 TGeoMaterial.cxx:441
 TGeoMaterial.cxx:442
 TGeoMaterial.cxx:443
 TGeoMaterial.cxx:444
 TGeoMaterial.cxx:445
 TGeoMaterial.cxx:446
 TGeoMaterial.cxx:447
 TGeoMaterial.cxx:448
 TGeoMaterial.cxx:449
 TGeoMaterial.cxx:450
 TGeoMaterial.cxx:451
 TGeoMaterial.cxx:452
 TGeoMaterial.cxx:453
 TGeoMaterial.cxx:454
 TGeoMaterial.cxx:455
 TGeoMaterial.cxx:456
 TGeoMaterial.cxx:457
 TGeoMaterial.cxx:458
 TGeoMaterial.cxx:459
 TGeoMaterial.cxx:460
 TGeoMaterial.cxx:461
 TGeoMaterial.cxx:462
 TGeoMaterial.cxx:463
 TGeoMaterial.cxx:464
 TGeoMaterial.cxx:465
 TGeoMaterial.cxx:466
 TGeoMaterial.cxx:467
 TGeoMaterial.cxx:468
 TGeoMaterial.cxx:469
 TGeoMaterial.cxx:470
 TGeoMaterial.cxx:471
 TGeoMaterial.cxx:472
 TGeoMaterial.cxx:473
 TGeoMaterial.cxx:474
 TGeoMaterial.cxx:475
 TGeoMaterial.cxx:476
 TGeoMaterial.cxx:477
 TGeoMaterial.cxx:478
 TGeoMaterial.cxx:479
 TGeoMaterial.cxx:480
 TGeoMaterial.cxx:481
 TGeoMaterial.cxx:482
 TGeoMaterial.cxx:483
 TGeoMaterial.cxx:484
 TGeoMaterial.cxx:485
 TGeoMaterial.cxx:486
 TGeoMaterial.cxx:487
 TGeoMaterial.cxx:488
 TGeoMaterial.cxx:489
 TGeoMaterial.cxx:490
 TGeoMaterial.cxx:491
 TGeoMaterial.cxx:492
 TGeoMaterial.cxx:493
 TGeoMaterial.cxx:494
 TGeoMaterial.cxx:495
 TGeoMaterial.cxx:496
 TGeoMaterial.cxx:497
 TGeoMaterial.cxx:498
 TGeoMaterial.cxx:499
 TGeoMaterial.cxx:500
 TGeoMaterial.cxx:501
 TGeoMaterial.cxx:502
 TGeoMaterial.cxx:503
 TGeoMaterial.cxx:504
 TGeoMaterial.cxx:505
 TGeoMaterial.cxx:506
 TGeoMaterial.cxx:507
 TGeoMaterial.cxx:508
 TGeoMaterial.cxx:509
 TGeoMaterial.cxx:510
 TGeoMaterial.cxx:511
 TGeoMaterial.cxx:512
 TGeoMaterial.cxx:513
 TGeoMaterial.cxx:514
 TGeoMaterial.cxx:515
 TGeoMaterial.cxx:516
 TGeoMaterial.cxx:517
 TGeoMaterial.cxx:518
 TGeoMaterial.cxx:519
 TGeoMaterial.cxx:520
 TGeoMaterial.cxx:521
 TGeoMaterial.cxx:522
 TGeoMaterial.cxx:523
 TGeoMaterial.cxx:524
 TGeoMaterial.cxx:525
 TGeoMaterial.cxx:526
 TGeoMaterial.cxx:527
 TGeoMaterial.cxx:528
 TGeoMaterial.cxx:529
 TGeoMaterial.cxx:530
 TGeoMaterial.cxx:531
 TGeoMaterial.cxx:532
 TGeoMaterial.cxx:533
 TGeoMaterial.cxx:534
 TGeoMaterial.cxx:535
 TGeoMaterial.cxx:536
 TGeoMaterial.cxx:537
 TGeoMaterial.cxx:538
 TGeoMaterial.cxx:539
 TGeoMaterial.cxx:540
 TGeoMaterial.cxx:541
 TGeoMaterial.cxx:542
 TGeoMaterial.cxx:543
 TGeoMaterial.cxx:544
 TGeoMaterial.cxx:545
 TGeoMaterial.cxx:546
 TGeoMaterial.cxx:547
 TGeoMaterial.cxx:548
 TGeoMaterial.cxx:549
 TGeoMaterial.cxx:550
 TGeoMaterial.cxx:551
 TGeoMaterial.cxx:552
 TGeoMaterial.cxx:553
 TGeoMaterial.cxx:554
 TGeoMaterial.cxx:555
 TGeoMaterial.cxx:556
 TGeoMaterial.cxx:557
 TGeoMaterial.cxx:558
 TGeoMaterial.cxx:559
 TGeoMaterial.cxx:560
 TGeoMaterial.cxx:561
 TGeoMaterial.cxx:562
 TGeoMaterial.cxx:563
 TGeoMaterial.cxx:564
 TGeoMaterial.cxx:565
 TGeoMaterial.cxx:566
 TGeoMaterial.cxx:567
 TGeoMaterial.cxx:568
 TGeoMaterial.cxx:569
 TGeoMaterial.cxx:570
 TGeoMaterial.cxx:571
 TGeoMaterial.cxx:572
 TGeoMaterial.cxx:573
 TGeoMaterial.cxx:574
 TGeoMaterial.cxx:575
 TGeoMaterial.cxx:576
 TGeoMaterial.cxx:577
 TGeoMaterial.cxx:578
 TGeoMaterial.cxx:579
 TGeoMaterial.cxx:580
 TGeoMaterial.cxx:581
 TGeoMaterial.cxx:582
 TGeoMaterial.cxx:583
 TGeoMaterial.cxx:584
 TGeoMaterial.cxx:585
 TGeoMaterial.cxx:586
 TGeoMaterial.cxx:587
 TGeoMaterial.cxx:588
 TGeoMaterial.cxx:589
 TGeoMaterial.cxx:590
 TGeoMaterial.cxx:591
 TGeoMaterial.cxx:592
 TGeoMaterial.cxx:593
 TGeoMaterial.cxx:594
 TGeoMaterial.cxx:595
 TGeoMaterial.cxx:596
 TGeoMaterial.cxx:597
 TGeoMaterial.cxx:598
 TGeoMaterial.cxx:599
 TGeoMaterial.cxx:600
 TGeoMaterial.cxx:601
 TGeoMaterial.cxx:602
 TGeoMaterial.cxx:603
 TGeoMaterial.cxx:604
 TGeoMaterial.cxx:605
 TGeoMaterial.cxx:606
 TGeoMaterial.cxx:607
 TGeoMaterial.cxx:608
 TGeoMaterial.cxx:609
 TGeoMaterial.cxx:610
 TGeoMaterial.cxx:611
 TGeoMaterial.cxx:612
 TGeoMaterial.cxx:613
 TGeoMaterial.cxx:614
 TGeoMaterial.cxx:615
 TGeoMaterial.cxx:616
 TGeoMaterial.cxx:617
 TGeoMaterial.cxx:618
 TGeoMaterial.cxx:619
 TGeoMaterial.cxx:620
 TGeoMaterial.cxx:621
 TGeoMaterial.cxx:622
 TGeoMaterial.cxx:623
 TGeoMaterial.cxx:624
 TGeoMaterial.cxx:625
 TGeoMaterial.cxx:626
 TGeoMaterial.cxx:627
 TGeoMaterial.cxx:628
 TGeoMaterial.cxx:629
 TGeoMaterial.cxx:630
 TGeoMaterial.cxx:631
 TGeoMaterial.cxx:632
 TGeoMaterial.cxx:633
 TGeoMaterial.cxx:634
 TGeoMaterial.cxx:635
 TGeoMaterial.cxx:636
 TGeoMaterial.cxx:637
 TGeoMaterial.cxx:638
 TGeoMaterial.cxx:639
 TGeoMaterial.cxx:640
 TGeoMaterial.cxx:641
 TGeoMaterial.cxx:642
 TGeoMaterial.cxx:643
 TGeoMaterial.cxx:644
 TGeoMaterial.cxx:645
 TGeoMaterial.cxx:646
 TGeoMaterial.cxx:647
 TGeoMaterial.cxx:648
 TGeoMaterial.cxx:649
 TGeoMaterial.cxx:650
 TGeoMaterial.cxx:651
 TGeoMaterial.cxx:652
 TGeoMaterial.cxx:653
 TGeoMaterial.cxx:654
 TGeoMaterial.cxx:655
 TGeoMaterial.cxx:656
 TGeoMaterial.cxx:657
 TGeoMaterial.cxx:658
 TGeoMaterial.cxx:659
 TGeoMaterial.cxx:660
 TGeoMaterial.cxx:661
 TGeoMaterial.cxx:662
 TGeoMaterial.cxx:663
 TGeoMaterial.cxx:664
 TGeoMaterial.cxx:665
 TGeoMaterial.cxx:666
 TGeoMaterial.cxx:667
 TGeoMaterial.cxx:668
 TGeoMaterial.cxx:669
 TGeoMaterial.cxx:670
 TGeoMaterial.cxx:671
 TGeoMaterial.cxx:672
 TGeoMaterial.cxx:673
 TGeoMaterial.cxx:674
 TGeoMaterial.cxx:675
 TGeoMaterial.cxx:676
 TGeoMaterial.cxx:677
 TGeoMaterial.cxx:678
 TGeoMaterial.cxx:679
 TGeoMaterial.cxx:680
 TGeoMaterial.cxx:681
 TGeoMaterial.cxx:682
 TGeoMaterial.cxx:683
 TGeoMaterial.cxx:684
 TGeoMaterial.cxx:685
 TGeoMaterial.cxx:686
 TGeoMaterial.cxx:687
 TGeoMaterial.cxx:688
 TGeoMaterial.cxx:689
 TGeoMaterial.cxx:690
 TGeoMaterial.cxx:691
 TGeoMaterial.cxx:692
 TGeoMaterial.cxx:693
 TGeoMaterial.cxx:694
 TGeoMaterial.cxx:695
 TGeoMaterial.cxx:696
 TGeoMaterial.cxx:697
 TGeoMaterial.cxx:698
 TGeoMaterial.cxx:699
 TGeoMaterial.cxx:700
 TGeoMaterial.cxx:701
 TGeoMaterial.cxx:702
 TGeoMaterial.cxx:703
 TGeoMaterial.cxx:704
 TGeoMaterial.cxx:705
 TGeoMaterial.cxx:706
 TGeoMaterial.cxx:707
 TGeoMaterial.cxx:708
 TGeoMaterial.cxx:709
 TGeoMaterial.cxx:710
 TGeoMaterial.cxx:711
 TGeoMaterial.cxx:712
 TGeoMaterial.cxx:713
 TGeoMaterial.cxx:714
 TGeoMaterial.cxx:715
 TGeoMaterial.cxx:716
 TGeoMaterial.cxx:717
 TGeoMaterial.cxx:718
 TGeoMaterial.cxx:719
 TGeoMaterial.cxx:720
 TGeoMaterial.cxx:721
 TGeoMaterial.cxx:722
 TGeoMaterial.cxx:723
 TGeoMaterial.cxx:724
 TGeoMaterial.cxx:725
 TGeoMaterial.cxx:726
 TGeoMaterial.cxx:727
 TGeoMaterial.cxx:728
 TGeoMaterial.cxx:729
 TGeoMaterial.cxx:730
 TGeoMaterial.cxx:731
 TGeoMaterial.cxx:732
 TGeoMaterial.cxx:733
 TGeoMaterial.cxx:734
 TGeoMaterial.cxx:735
 TGeoMaterial.cxx:736
 TGeoMaterial.cxx:737
 TGeoMaterial.cxx:738
 TGeoMaterial.cxx:739
 TGeoMaterial.cxx:740
 TGeoMaterial.cxx:741
 TGeoMaterial.cxx:742
 TGeoMaterial.cxx:743
 TGeoMaterial.cxx:744
 TGeoMaterial.cxx:745
 TGeoMaterial.cxx:746
 TGeoMaterial.cxx:747
 TGeoMaterial.cxx:748
 TGeoMaterial.cxx:749
 TGeoMaterial.cxx:750
 TGeoMaterial.cxx:751
 TGeoMaterial.cxx:752
 TGeoMaterial.cxx:753
 TGeoMaterial.cxx:754
 TGeoMaterial.cxx:755
 TGeoMaterial.cxx:756
 TGeoMaterial.cxx:757
 TGeoMaterial.cxx:758
 TGeoMaterial.cxx:759
 TGeoMaterial.cxx:760
 TGeoMaterial.cxx:761
 TGeoMaterial.cxx:762
 TGeoMaterial.cxx:763
 TGeoMaterial.cxx:764
 TGeoMaterial.cxx:765
 TGeoMaterial.cxx:766
 TGeoMaterial.cxx:767
 TGeoMaterial.cxx:768
 TGeoMaterial.cxx:769
 TGeoMaterial.cxx:770
 TGeoMaterial.cxx:771
 TGeoMaterial.cxx:772
 TGeoMaterial.cxx:773
 TGeoMaterial.cxx:774
 TGeoMaterial.cxx:775
 TGeoMaterial.cxx:776
 TGeoMaterial.cxx:777
 TGeoMaterial.cxx:778
 TGeoMaterial.cxx:779
 TGeoMaterial.cxx:780
 TGeoMaterial.cxx:781
 TGeoMaterial.cxx:782
 TGeoMaterial.cxx:783
 TGeoMaterial.cxx:784
 TGeoMaterial.cxx:785
 TGeoMaterial.cxx:786
 TGeoMaterial.cxx:787
 TGeoMaterial.cxx:788
 TGeoMaterial.cxx:789
 TGeoMaterial.cxx:790
 TGeoMaterial.cxx:791
 TGeoMaterial.cxx:792
 TGeoMaterial.cxx:793
 TGeoMaterial.cxx:794
 TGeoMaterial.cxx:795
 TGeoMaterial.cxx:796
 TGeoMaterial.cxx:797
 TGeoMaterial.cxx:798
 TGeoMaterial.cxx:799
 TGeoMaterial.cxx:800
 TGeoMaterial.cxx:801
 TGeoMaterial.cxx:802
 TGeoMaterial.cxx:803
 TGeoMaterial.cxx:804
 TGeoMaterial.cxx:805
 TGeoMaterial.cxx:806
 TGeoMaterial.cxx:807
 TGeoMaterial.cxx:808
 TGeoMaterial.cxx:809
 TGeoMaterial.cxx:810
 TGeoMaterial.cxx:811
 TGeoMaterial.cxx:812
 TGeoMaterial.cxx:813
 TGeoMaterial.cxx:814
 TGeoMaterial.cxx:815
 TGeoMaterial.cxx:816
 TGeoMaterial.cxx:817
 TGeoMaterial.cxx:818
 TGeoMaterial.cxx:819
 TGeoMaterial.cxx:820
 TGeoMaterial.cxx:821
 TGeoMaterial.cxx:822
 TGeoMaterial.cxx:823
 TGeoMaterial.cxx:824
 TGeoMaterial.cxx:825
 TGeoMaterial.cxx:826
 TGeoMaterial.cxx:827
 TGeoMaterial.cxx:828
 TGeoMaterial.cxx:829
 TGeoMaterial.cxx:830
 TGeoMaterial.cxx:831
 TGeoMaterial.cxx:832
 TGeoMaterial.cxx:833
 TGeoMaterial.cxx:834
 TGeoMaterial.cxx:835
 TGeoMaterial.cxx:836
 TGeoMaterial.cxx:837
 TGeoMaterial.cxx:838
 TGeoMaterial.cxx:839
 TGeoMaterial.cxx:840
 TGeoMaterial.cxx:841
 TGeoMaterial.cxx:842
 TGeoMaterial.cxx:843
 TGeoMaterial.cxx:844
 TGeoMaterial.cxx:845
 TGeoMaterial.cxx:846
 TGeoMaterial.cxx:847
 TGeoMaterial.cxx:848
 TGeoMaterial.cxx:849
 TGeoMaterial.cxx:850
 TGeoMaterial.cxx:851
 TGeoMaterial.cxx:852
 TGeoMaterial.cxx:853
 TGeoMaterial.cxx:854
 TGeoMaterial.cxx:855
 TGeoMaterial.cxx:856
 TGeoMaterial.cxx:857
 TGeoMaterial.cxx:858
 TGeoMaterial.cxx:859
 TGeoMaterial.cxx:860
 TGeoMaterial.cxx:861
 TGeoMaterial.cxx:862
 TGeoMaterial.cxx:863
 TGeoMaterial.cxx:864
 TGeoMaterial.cxx:865
 TGeoMaterial.cxx:866
 TGeoMaterial.cxx:867
 TGeoMaterial.cxx:868
 TGeoMaterial.cxx:869
 TGeoMaterial.cxx:870
 TGeoMaterial.cxx:871
 TGeoMaterial.cxx:872
 TGeoMaterial.cxx:873
 TGeoMaterial.cxx:874
 TGeoMaterial.cxx:875
 TGeoMaterial.cxx:876
 TGeoMaterial.cxx:877
 TGeoMaterial.cxx:878
 TGeoMaterial.cxx:879
 TGeoMaterial.cxx:880
 TGeoMaterial.cxx:881
 TGeoMaterial.cxx:882
 TGeoMaterial.cxx:883
 TGeoMaterial.cxx:884
 TGeoMaterial.cxx:885
 TGeoMaterial.cxx:886
 TGeoMaterial.cxx:887
 TGeoMaterial.cxx:888
 TGeoMaterial.cxx:889
 TGeoMaterial.cxx:890
 TGeoMaterial.cxx:891
 TGeoMaterial.cxx:892
 TGeoMaterial.cxx:893