// // ******************************************************************** // * DISCLAIMER * // * * // * The following disclaimer summarizes all the specific disclaimers * // * of contributors to this software. The specific disclaimers,which * // * govern, are listed with their locations in: * // * http://cern.ch/geant4/license * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. * // * * // * This code implementation is the intellectual property of the * // * GEANT4 collaboration. * // * By copying, distributing or modifying the Program (or any work * // * based on the Program) you indicate your acceptance of this * // * statement, and all its terms. * // ******************************************************************** // // // $Id: G4SandiaTable.cc,v 1.19 2004/04/14 10:19:06 maire Exp $ // GEANT4 tag $Name: geant4-06-02 $ // //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... // // 05.03.04 New methods for old sorting algorithm for PAI model. V.Grichine // 03.02.04 Update distructor V.Ivanchenko // 10.07.01 Migration to STL. M. Verderi. // 03.04.01 fnulcof returned if energy < emin // 22.02.01 GetsandiaCofForMaterial(energy) return 0 below lowest interval mma // 16.02.01 adapted for STL. mma // 31.01.01 redesign of ComputeMatSandiaMatrix(). mma // 18.11.98 simplified public interface; new methods for materials. mma // 10.06.97 created. V. Grichine // //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... #include "G4SandiaTable.hh" #include "G4StaticSandiaData.hh" #include "G4Material.hh" #include "G4MaterialTable.hh" G4int G4SandiaTable::fCumulInterval[101]; G4double G4SandiaTable::fSandiaCofPerAtom[4]; //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... G4SandiaTable::G4SandiaTable(G4int matIndex) { fMatSandiaMatrix = 0 ; fPhotoAbsorptionCof = 0 ; const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable(); size_t numberOfMat = G4Material::GetNumberOfMaterials(); if ( matIndex >= 0 && matIndex < G4int(numberOfMat) ) { fMaterial = (*theMaterialTable)[matIndex]; } else { G4Exception("G4SandiaTable::G4SandiaTable(G4int matIndex): wrong matIndex "); } ComputeMatTable(); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... G4SandiaTable::G4SandiaTable(G4Material* material) :fMaterial(material) { fPhotoAbsorptionCof = 0 ; //build the CumulInterval array fCumulInterval[0] = 1; for (G4int Z=1; Z<101; Z++) fCumulInterval[Z] = fCumulInterval[Z-1] + fNbOfIntervals[Z]; //compute macroscopic Sandia coefs for a material ComputeMatSandiaMatrix(); //initialisation of fnulcof fnulcof[0] = fnulcof[1] = fnulcof[2] = fnulcof[3] = 0.; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... G4SandiaTable::~G4SandiaTable() { if(fMatSandiaMatrix) delete fMatSandiaMatrix; if(fPhotoAbsorptionCof) { // for(G4int i = 0 ; i < fMaxInterval ; i++) delete[] fPhotoAbsorptionCof[i]; delete [] fPhotoAbsorptionCof ; } } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... void G4SandiaTable::ComputeMatSandiaMatrix() { //get list of elements const G4int NbElm = fMaterial->GetNumberOfElements(); const G4ElementVector* ElementVector = fMaterial->GetElementVector(); G4int* Z = new G4int[NbElm]; //Atomic number // //determine the maximum number of energy-intervals for this material // G4int MaxIntervals = 0; G4int elm; for (elm=0; elmGetZ(); MaxIntervals += fNbOfIntervals[Z[elm]]; } // //copy the Energy bins in a tmp1 array //(take care of the Ionization Potential of each element) // G4double* tmp1 = new G4double[MaxIntervals]; G4double IonizationPot; G4int interval1=0; for (elm=0; elmpush_back(new G4DataVector(5,0.)); // //ready to compute the Sandia coefs for the material // const G4double* NbOfAtomsPerVolume = fMaterial->GetVecNbOfAtomsPerVolume(); const G4double prec = 1.e-03*eV; G4double coef, oldsum(0.), newsum(0.); fMatNbOfIntervals = 0; for (interval=0; interval=0 && interval=0 && j<5); return ((*(*fMatSandiaMatrix)[interval])[j]); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... G4double* G4SandiaTable::GetSandiaCofForMaterial(G4double energy) { if (energy < (*(*fMatSandiaMatrix)[0])[0]) return fnulcof; G4int interval = fMatNbOfIntervals - 1; while ((interval>0)&&(energy<(*(*fMatSandiaMatrix)[interval])[0])) interval--; return &((*(*fMatSandiaMatrix)[interval])[1]); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// // // Methods for PAI model /////////////////////////////////////////////////////////////////////// // // Bubble sorting of left energy interval in SandiaTable in ascening order // void G4SandiaTable::SandiaSort(G4double** da , G4int sz ) { for(G4int i = 1 ;i < sz ; i++ ) { for(G4int j = i + 1 ;j < sz ; j++ ) { if(da[i][0] > da[j][0]) { SandiaSwap(da,i,j) ; } } } } //////////////////////////////////////////////////////////////////////////// // // SandiaIntervals // G4int G4SandiaTable::SandiaIntervals(G4int Z[], G4int el ) { G4int c,i ; fMaxInterval = 0 ; for(i=0;i