Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** >> 25 // >> 26 // >> 27 // $Id: G4SandiaTable.hh,v 1.23 2010-11-22 08:21:04 grichine Exp $ >> 28 // GEANT4 tag $Name: not supported by cvs2svn $ 25 29 26 // class description 30 // class description 27 // 31 // 28 // This class is an interface to G4StaticSandi 32 // This class is an interface to G4StaticSandiaData. 29 // it provides - Sandia coeff for an element, 33 // it provides - Sandia coeff for an element, given its Z 30 // - sandia coeff for a material, 34 // - sandia coeff for a material, given a pointer to it 31 // 35 // >> 36 >> 37 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... >> 38 // 32 // History: 39 // History: 33 // 40 // 34 // 10.06.97 created. V. Grichine 41 // 10.06.97 created. V. Grichine 35 // 18.11.98 simplified public interface; new m 42 // 18.11.98 simplified public interface; new methods for materials. mma 36 // 30.01.01 major bug in the computation of Ao 43 // 30.01.01 major bug in the computation of AoverAvo and in the units (/g!) 37 // in GetSandiaCofPerAtom(). mma 44 // in GetSandiaCofPerAtom(). mma 38 // 03.04.01 fnulcof[4] added; returned if ener 45 // 03.04.01 fnulcof[4] added; returned if energy < emin 39 // 05.03.04 V.Grichine, new methods for old so 46 // 05.03.04 V.Grichine, new methods for old sorting algorithm for PAI model 40 // 21.21.13 V.Ivanchenko, changed signature of << 41 // static variables, me << 42 // 47 // >> 48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... 43 49 44 #ifndef G4SANDIATABLE_HH 50 #ifndef G4SANDIATABLE_HH 45 #define G4SANDIATABLE_HH 51 #define G4SANDIATABLE_HH 46 52 47 #include "G4OrderedTable.hh" << 53 #include "G4OrderedTable.hh" 48 #include "G4ios.hh" 54 #include "G4ios.hh" 49 #include "globals.hh" 55 #include "globals.hh" 50 << 51 #include <CLHEP/Units/PhysicalConstants.h> << 52 #include <assert.h> 56 #include <assert.h> 53 57 54 #include <vector> << 55 << 56 class G4Material; 58 class G4Material; 57 59 >> 60 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... >> 61 58 class G4SandiaTable 62 class G4SandiaTable 59 { 63 { 60 public: // with description << 64 public: // with description 61 G4SandiaTable(); << 65 62 G4SandiaTable(const G4Material*); << 66 G4SandiaTable(G4Material*); 63 G4SandiaTable(G4int matIndex); << 67 64 ~G4SandiaTable(); 68 ~G4SandiaTable(); 65 69 66 G4SandiaTable(G4SandiaTable&) = delete; << 70 //main computation per atom: 67 G4SandiaTable& operator=(const G4SandiaTable << 71 static G4double* GetSandiaCofPerAtom(G4int Z, G4double energy); >> 72 static G4double GetZtoA (G4int Z); >> 73 >> 74 //per volume of a material: >> 75 inline G4int GetMatNbOfIntervals(); >> 76 inline G4double GetSandiaCofForMaterial(G4int,G4int); >> 77 inline G4double* GetSandiaCofForMaterial(G4double energy); >> 78 inline G4double GetSandiaMatTable(G4int,G4int); >> 79 >> 80 inline G4double GetSandiaCofForMaterialPAI(G4int,G4int); >> 81 inline G4double* GetSandiaCofForMaterialPAI(G4double energy); >> 82 inline G4double GetSandiaMatTablePAI(G4int,G4int); >> 83 inline G4OrderedTable* GetSandiaMatrixPAI(); >> 84 >> 85 void SetVerbose(G4int ver){fVerbose = ver;}; >> 86 >> 87 public: // without description >> 88 >> 89 G4SandiaTable(__void__&); >> 90 // Fake default constructor for usage restricted to direct object >> 91 // persistency for clients requiring preallocation of memory for >> 92 // persistifiable objects. 68 93 69 // main computation per atom: << 94 private: 70 void GetSandiaCofPerAtom(G4int Z, G4double e << 95 >> 96 void ComputeMatSandiaMatrix(); >> 97 void ComputeMatSandiaMatrixPAI(); 71 98 72 void GetSandiaCofWater(G4double energy, std: << 99 // methods per atom >> 100 inline G4int GetNbOfIntervals (G4int Z); >> 101 inline G4double GetSandiaCofPerAtom(G4int Z, G4int, G4int); >> 102 inline G4double GetIonizationPot (G4int Z); >> 103 >> 104 // static members of the class >> 105 static const G4int fNumberOfElements; >> 106 static const G4int fIntervalLimit; >> 107 static const G4int fNumberOfIntervals; >> 108 >> 109 static const G4double fSandiaTable[981][5]; >> 110 static const G4int fNbOfIntervals[101]; >> 111 static const G4double fZtoAratio[101]; >> 112 static const G4double fIonizationPotentials[101]; >> 113 static const G4double funitc[4]; >> 114 >> 115 static G4int fCumulInterval[101]; >> 116 static G4double fSandiaCofPerAtom[4]; >> 117 >> 118 // members of the class >> 119 G4Material* fMaterial; >> 120 G4int fMatNbOfIntervals; >> 121 G4OrderedTable* fMatSandiaMatrix; >> 122 G4OrderedTable* fMatSandiaMatrixPAI; >> 123 >> 124 G4double fnulcof[4]; >> 125 >> 126 ///////////////////////////////////////////////////////////////////// >> 127 // >> 128 // Methods for old implementation of PAI model >> 129 // Will be removed for the next major release 73 130 74 G4double GetWaterEnergyLimit() const; << 131 public: // without description 75 G4double GetWaterCofForMaterial(G4int, G4int << 76 132 77 static G4double GetZtoA(G4int Z); << 133 G4SandiaTable(G4int); 78 134 79 // per volume of a material: << 135 inline void SandiaSwap( G4double** da, 80 G4int GetMatNbOfIntervals() const; << 136 G4int i, 81 G4double GetSandiaCofForMaterial(G4int, G4in << 137 G4int j ); 82 G4double GetSandiaMatTable(G4int, G4int) con << 83 const G4double* GetSandiaCofForMaterial(G4do << 84 138 85 G4double GetSandiaMatTablePAI(G4int, G4int) << 139 void SandiaSort( G4double** da, 86 const G4double* GetSandiaCofForMaterialPAI(G << 140 G4int sz ); 87 141 88 inline void SetVerbose(G4int ver) { fVerbose << 142 G4int SandiaIntervals( G4int Z[], >> 143 G4int el ); 89 144 90 //////////////////////////////////////////// << 145 G4int SandiaMixing( G4int Z[], 91 // << 146 const G4double* fractionW, 92 // Methods for implementation of PAI model << 147 G4int el, 93 // << 148 G4int mi ); 94 //////////////////////////////////////////// << 95 149 96 void Initialize(const G4Material*); << 150 inline G4double GetPhotoAbsorpCof(G4int i , G4int j) const; 97 151 98 G4int SandiaIntervals(G4int Z[], G4int el); << 152 inline G4int GetMaxInterval() const; 99 153 100 G4int SandiaMixing(G4int Z[], const G4double << 154 inline G4double** GetPointerToCof(); 101 155 102 G4double GetPhotoAbsorpCof(G4int i, G4int j) << 156 private: 103 157 104 G4int GetMaxInterval() const; << 158 void ComputeMatTable(); 105 159 106 inline G4bool GetLowerI1() { return fLowerI1 << 160 // copy constructor and hide assignment operator 107 inline void SetLowerI1(G4bool flag) { fLower << 161 G4SandiaTable(G4SandiaTable &); >> 162 G4SandiaTable & operator=(const G4SandiaTable &right); 108 163 109 // operators << 164 ////////////////////////////////////////////////////////////////////////// 110 G4bool operator==(const G4SandiaTable&) cons << 165 // 111 G4bool operator!=(const G4SandiaTable&) cons << 166 // data members for PAI model 112 167 113 private: << 168 private: 114 void ComputeMatSandiaMatrix(); << 169 115 void ComputeMatSandiaMatrixPAI(); << 170 G4double** fPhotoAbsorptionCof ; // SandiaTable for mixture 116 171 117 // methods per atom << 172 G4int fMaxInterval ; 118 G4double GetSandiaPerAtom(G4int Z, G4int, G4 << 173 G4int fVerbose; >> 174 119 175 120 #ifdef G4VERBOSE << 176 // 121 static G4int PrintErrorZ(G4int Z, const G4St << 177 // 122 static void PrintErrorV(const G4String&); << 178 ////////////////////////////////////////////////////////////////////////// 123 #endif << 179 >> 180 }; >> 181 >> 182 // Inline methods 124 183 125 void ComputeMatTable(); << 184 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... >> 185 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... 126 186 127 void SandiaSwap(G4double** da, G4int i, G4in << 187 inline G4int >> 188 G4SandiaTable::GetMatNbOfIntervals() >> 189 { >> 190 return fMatNbOfIntervals; >> 191 } 128 192 129 void SandiaSort(G4double** da, G4int sz); << 193 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... 130 194 131 G4double** GetPointerToCof(); << 195 inline G4int >> 196 G4SandiaTable::GetNbOfIntervals(G4int Z) >> 197 { >> 198 // assert (Z>0 && Z<101); >> 199 return fNbOfIntervals[Z]; >> 200 } 132 201 133 // computed once << 202 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... 134 static G4int fCumulInterval[101]; << 135 static const G4double funitc[5]; << 136 203 137 // used at initialisation << 204 inline G4double 138 std::vector<G4double> fSandiaCofPerAtom; << 205 G4SandiaTable::GetSandiaCofPerAtom(G4int Z, G4int interval, G4int j) >> 206 { >> 207 assert (Z>0 && Z<101 && interval>=0 && interval<fNbOfIntervals[Z] >> 208 && j>=0 && j<5); 139 209 140 // members of the class << 210 G4int row = fCumulInterval[Z-1] + interval; 141 const G4Material* fMaterial; << 211 G4double x = fSandiaTable[row][0]*keV; 142 G4int fMatNbOfIntervals; << 212 if (j > 0) { 143 G4OrderedTable* fMatSandiaMatrix; << 213 x = Z*amu/fZtoAratio[Z]* 144 G4OrderedTable* fMatSandiaMatrixPAI; << 214 (fSandiaTable[row][j]*cm2*std::pow(keV,G4double(j))/g); >> 215 } >> 216 return x; >> 217 } 145 218 146 static const G4double fSandiaTable[981][5]; << 219 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... 147 static const G4int fNumberOfElements; << 148 static const G4int fIntervalLimit; << 149 static const G4int fNumberOfIntervals; << 150 static const G4int fH2OlowerInt; << 151 220 152 // data members for PAI model << 221 inline G4double 153 G4double** fPhotoAbsorptionCof; // SandiaTa << 222 G4SandiaTable::GetSandiaCofForMaterial(G4int interval, G4int j) >> 223 { >> 224 assert (interval>=0 && interval<fMatNbOfIntervals && j>=0 && j<5); >> 225 return ((*(*fMatSandiaMatrix)[interval])[j]); >> 226 } 154 227 155 G4int fMaxInterval; << 228 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... 156 G4int fVerbose; << 229 157 G4bool fLowerI1; << 230 inline G4double* 158 }; << 231 G4SandiaTable::GetSandiaCofForMaterial(G4double energy) >> 232 { >> 233 G4double* x = fnulcof; >> 234 if (energy >= (*(*fMatSandiaMatrix)[0])[0]) { >> 235 >> 236 G4int interval = fMatNbOfIntervals - 1; >> 237 while ((interval>0)&&(energy<(*(*fMatSandiaMatrix)[interval])[0])) >> 238 {interval--;} >> 239 x = &((*(*fMatSandiaMatrix)[interval])[1]); >> 240 } >> 241 return x; >> 242 } >> 243 >> 244 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... >> 245 >> 246 inline G4double >> 247 G4SandiaTable::GetSandiaMatTable(G4int interval, G4int j) >> 248 { >> 249 assert (interval >= 0 && interval < fMaxInterval && j >= 0 && j < 5 ); >> 250 G4double unitCof ; >> 251 if(j == 0) unitCof = keV ; >> 252 else unitCof = (cm2/g)*std::pow(keV,(G4double)j); >> 253 return ( (*(*fMatSandiaMatrix)[interval])[j] )*unitCof; >> 254 } >> 255 >> 256 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... >> 257 >> 258 inline G4double >> 259 G4SandiaTable::GetSandiaCofForMaterialPAI(G4int interval, G4int j) >> 260 { >> 261 assert (interval>=0 && interval<fMatNbOfIntervals && j>=0 && j<5); >> 262 if(!fMatSandiaMatrixPAI) ComputeMatSandiaMatrixPAI(); >> 263 return ((*(*fMatSandiaMatrixPAI)[interval])[j]); >> 264 } >> 265 >> 266 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... >> 267 >> 268 inline G4double* >> 269 G4SandiaTable::GetSandiaCofForMaterialPAI(G4double energy) >> 270 { >> 271 if(!fMatSandiaMatrixPAI) ComputeMatSandiaMatrixPAI(); >> 272 G4double* x = fnulcof; >> 273 if (energy >= (*(*fMatSandiaMatrixPAI)[0])[0]) { >> 274 >> 275 G4int interval = fMatNbOfIntervals - 1; >> 276 while ((interval>0)&&(energy<(*(*fMatSandiaMatrixPAI)[interval])[0])) >> 277 {interval--;} >> 278 x = &((*(*fMatSandiaMatrixPAI)[interval])[1]); >> 279 } >> 280 return x; >> 281 } >> 282 >> 283 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... >> 284 >> 285 inline G4double >> 286 G4SandiaTable::GetSandiaMatTablePAI(G4int interval, G4int j) >> 287 { >> 288 assert (interval >= 0 && interval < fMaxInterval && j >= 0 && j < 5 ); >> 289 if(!fMatSandiaMatrixPAI) ComputeMatSandiaMatrixPAI(); >> 290 G4double unitCof ; >> 291 if(j == 0) unitCof = keV ; >> 292 else unitCof = (cm2/g)*std::pow(keV,(G4double)j); >> 293 return ( (*(*fMatSandiaMatrixPAI)[interval])[j] )*unitCof; >> 294 } >> 295 >> 296 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... >> 297 >> 298 inline G4double >> 299 G4SandiaTable::GetIonizationPot(G4int Z) >> 300 { >> 301 return fIonizationPotentials[Z]*eV; >> 302 } >> 303 >> 304 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... >> 305 >> 306 inline G4OrderedTable* >> 307 G4SandiaTable::GetSandiaMatrixPAI() >> 308 { >> 309 if(!fMatSandiaMatrixPAI) ComputeMatSandiaMatrixPAI(); >> 310 return fMatSandiaMatrixPAI; >> 311 } >> 312 >> 313 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... >> 314 >> 315 /////////////////////////////////////////////////////////////////////// >> 316 // >> 317 // Inline methods for PAI model, will be removed in next major release >> 318 >> 319 inline G4int >> 320 G4SandiaTable::GetMaxInterval() const { >> 321 return fMaxInterval; >> 322 } >> 323 >> 324 inline G4double** >> 325 G4SandiaTable::GetPointerToCof() >> 326 { >> 327 if(!fPhotoAbsorptionCof) ComputeMatTable(); >> 328 return fPhotoAbsorptionCof; >> 329 } >> 330 >> 331 inline void >> 332 G4SandiaTable::SandiaSwap( G4double** da , >> 333 G4int i, >> 334 G4int j ) >> 335 { >> 336 G4double tmp = da[i][0] ; >> 337 da[i][0] = da[j][0] ; >> 338 da[j][0] = tmp ; >> 339 } >> 340 >> 341 inline >> 342 G4double G4SandiaTable::GetPhotoAbsorpCof(G4int i, G4int j) const >> 343 { >> 344 G4double unitCof ; >> 345 if(j == 0) unitCof = keV ; >> 346 else unitCof = (cm2/g)*std::pow(keV,(G4double)j) ; >> 347 >> 348 return fPhotoAbsorptionCof[i][j]*unitCof ; >> 349 } >> 350 >> 351 // >> 352 // >> 353 //////////////////////////////////////////////////////////////////////////// >> 354 >> 355 >> 356 #endif 159 357 160 #endif << 161 358