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.21 2007/10/02 10:13:33 vnivanch Exp $ >> 28 // GEANT4 tag $Name: geant4-09-03-patch-01 $ 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 public: // without description >> 86 >> 87 G4SandiaTable(__void__&); >> 88 // Fake default constructor for usage restricted to direct object >> 89 // persistency for clients requiring preallocation of memory for >> 90 // persistifiable objects. 68 91 69 // main computation per atom: << 92 private: 70 void GetSandiaCofPerAtom(G4int Z, G4double e << 93 >> 94 void ComputeMatSandiaMatrix(); >> 95 void ComputeMatSandiaMatrixPAI(); 71 96 72 void GetSandiaCofWater(G4double energy, std: << 97 // methods per atom >> 98 inline G4int GetNbOfIntervals (G4int Z); >> 99 inline G4double GetSandiaCofPerAtom(G4int Z, G4int, G4int); >> 100 inline G4double GetIonizationPot (G4int Z); >> 101 >> 102 // static members of the class >> 103 static const G4int fNumberOfElements; >> 104 static const G4int fIntervalLimit; >> 105 static const G4int fNumberOfIntervals; >> 106 >> 107 static const G4double fSandiaTable[981][5]; >> 108 static const G4int fNbOfIntervals[101]; >> 109 static const G4double fZtoAratio[101]; >> 110 static const G4double fIonizationPotentials[101]; >> 111 static const G4double funitc[4]; >> 112 >> 113 static G4int fCumulInterval[101]; >> 114 static G4double fSandiaCofPerAtom[4]; >> 115 >> 116 // members of the class >> 117 G4Material* fMaterial; >> 118 G4int fMatNbOfIntervals; >> 119 G4OrderedTable* fMatSandiaMatrix; >> 120 G4OrderedTable* fMatSandiaMatrixPAI; >> 121 >> 122 G4double fnulcof[4]; >> 123 >> 124 ///////////////////////////////////////////////////////////////////// >> 125 // >> 126 // Methods for old implementation of PAI model >> 127 // Will be removed for the next major release 73 128 74 G4double GetWaterEnergyLimit() const; << 129 public: // without description 75 G4double GetWaterCofForMaterial(G4int, G4int << 76 130 77 static G4double GetZtoA(G4int Z); << 131 G4SandiaTable(G4int); 78 132 79 // per volume of a material: << 133 inline void SandiaSwap( G4double** da, 80 G4int GetMatNbOfIntervals() const; << 134 G4int i, 81 G4double GetSandiaCofForMaterial(G4int, G4in << 135 G4int j ); 82 G4double GetSandiaMatTable(G4int, G4int) con << 83 const G4double* GetSandiaCofForMaterial(G4do << 84 136 85 G4double GetSandiaMatTablePAI(G4int, G4int) << 137 void SandiaSort( G4double** da, 86 const G4double* GetSandiaCofForMaterialPAI(G << 138 G4int sz ); 87 139 88 inline void SetVerbose(G4int ver) { fVerbose << 140 G4int SandiaIntervals( G4int Z[], >> 141 G4int el ); 89 142 90 //////////////////////////////////////////// << 143 G4int SandiaMixing( G4int Z[], 91 // << 144 const G4double fractionW[], 92 // Methods for implementation of PAI model << 145 G4int el, 93 // << 146 G4int mi ); 94 //////////////////////////////////////////// << 95 147 96 void Initialize(const G4Material*); << 148 inline G4double GetPhotoAbsorpCof(G4int i , G4int j) const; 97 149 98 G4int SandiaIntervals(G4int Z[], G4int el); << 150 inline G4int GetMaxInterval() const; 99 151 100 G4int SandiaMixing(G4int Z[], const G4double << 152 inline G4double** GetPointerToCof(); 101 153 102 G4double GetPhotoAbsorpCof(G4int i, G4int j) << 154 private: 103 155 104 G4int GetMaxInterval() const; << 156 void ComputeMatTable(); 105 157 106 inline G4bool GetLowerI1() { return fLowerI1 << 158 ////////////////////////////////////////////////////////////////////////// 107 inline void SetLowerI1(G4bool flag) { fLower << 159 // >> 160 // data members for PAI model 108 161 109 // operators << 162 private: 110 G4bool operator==(const G4SandiaTable&) cons << 163 111 G4bool operator!=(const G4SandiaTable&) cons << 164 G4double** fPhotoAbsorptionCof ; // SandiaTable for mixture 112 165 113 private: << 166 G4int fMaxInterval ; 114 void ComputeMatSandiaMatrix(); << 115 void ComputeMatSandiaMatrixPAI(); << 116 167 117 // methods per atom << 168 // 118 G4double GetSandiaPerAtom(G4int Z, G4int, G4 << 169 // >> 170 ////////////////////////////////////////////////////////////////////////// >> 171 >> 172 }; >> 173 >> 174 // Inline methods 119 175 120 #ifdef G4VERBOSE << 176 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... 121 static G4int PrintErrorZ(G4int Z, const G4St << 177 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... 122 static void PrintErrorV(const G4String&); << 123 #endif << 124 178 125 void ComputeMatTable(); << 179 inline G4int >> 180 G4SandiaTable::GetMatNbOfIntervals() >> 181 { >> 182 return fMatNbOfIntervals; >> 183 } 126 184 127 void SandiaSwap(G4double** da, G4int i, G4in << 185 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... 128 186 129 void SandiaSort(G4double** da, G4int sz); << 187 inline G4int >> 188 G4SandiaTable::GetNbOfIntervals(G4int Z) >> 189 { >> 190 // assert (Z>0 && Z<101); >> 191 return fNbOfIntervals[Z]; >> 192 } 130 193 131 G4double** GetPointerToCof(); << 194 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... 132 195 133 // computed once << 196 inline G4double 134 static G4int fCumulInterval[101]; << 197 G4SandiaTable::GetSandiaCofPerAtom(G4int Z, G4int interval, G4int j) 135 static const G4double funitc[5]; << 198 { >> 199 assert (Z>0 && Z<101 && interval>=0 && interval<fNbOfIntervals[Z] >> 200 && j>=0 && j<5); 136 201 137 // used at initialisation << 202 G4int row = fCumulInterval[Z-1] + interval; 138 std::vector<G4double> fSandiaCofPerAtom; << 203 G4double x = fSandiaTable[row][0]*keV; >> 204 if (j > 0) { >> 205 x = Z*amu/fZtoAratio[Z]* >> 206 (fSandiaTable[row][j]*cm2*std::pow(keV,G4double(j))/g); >> 207 } >> 208 return x; >> 209 } 139 210 140 // members of the class << 211 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... 141 const G4Material* fMaterial; << 142 G4int fMatNbOfIntervals; << 143 G4OrderedTable* fMatSandiaMatrix; << 144 G4OrderedTable* fMatSandiaMatrixPAI; << 145 212 146 static const G4double fSandiaTable[981][5]; << 213 inline G4double 147 static const G4int fNumberOfElements; << 214 G4SandiaTable::GetSandiaCofForMaterial(G4int interval, G4int j) 148 static const G4int fIntervalLimit; << 215 { 149 static const G4int fNumberOfIntervals; << 216 assert (interval>=0 && interval<fMatNbOfIntervals && j>=0 && j<5); 150 static const G4int fH2OlowerInt; << 217 return ((*(*fMatSandiaMatrix)[interval])[j]); 151 << 218 } 152 // data members for PAI model << 219 153 G4double** fPhotoAbsorptionCof; // SandiaTa << 220 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... 154 << 221 155 G4int fMaxInterval; << 222 inline G4double* 156 G4int fVerbose; << 223 G4SandiaTable::GetSandiaCofForMaterial(G4double energy) 157 G4bool fLowerI1; << 224 { 158 }; << 225 G4double* x = fnulcof; >> 226 if (energy >= (*(*fMatSandiaMatrix)[0])[0]) { >> 227 >> 228 G4int interval = fMatNbOfIntervals - 1; >> 229 while ((interval>0)&&(energy<(*(*fMatSandiaMatrix)[interval])[0])) >> 230 {interval--;} >> 231 x = &((*(*fMatSandiaMatrix)[interval])[1]); >> 232 } >> 233 return x; >> 234 } >> 235 >> 236 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... >> 237 >> 238 inline G4double >> 239 G4SandiaTable::GetSandiaMatTable(G4int interval, G4int j) >> 240 { >> 241 assert (interval >= 0 && interval < fMaxInterval && j >= 0 && j < 5 ); >> 242 G4double unitCof ; >> 243 if(j == 0) unitCof = keV ; >> 244 else unitCof = (cm2/g)*std::pow(keV,(G4double)j); >> 245 return ( (*(*fMatSandiaMatrix)[interval])[j] )*unitCof; >> 246 } >> 247 >> 248 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... >> 249 >> 250 inline G4double >> 251 G4SandiaTable::GetSandiaCofForMaterialPAI(G4int interval, G4int j) >> 252 { >> 253 assert (interval>=0 && interval<fMatNbOfIntervals && j>=0 && j<5); >> 254 if(!fMatSandiaMatrixPAI) ComputeMatSandiaMatrixPAI(); >> 255 return ((*(*fMatSandiaMatrixPAI)[interval])[j]); >> 256 } >> 257 >> 258 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... >> 259 >> 260 inline G4double* >> 261 G4SandiaTable::GetSandiaCofForMaterialPAI(G4double energy) >> 262 { >> 263 if(!fMatSandiaMatrixPAI) ComputeMatSandiaMatrixPAI(); >> 264 G4double* x = fnulcof; >> 265 if (energy >= (*(*fMatSandiaMatrixPAI)[0])[0]) { >> 266 >> 267 G4int interval = fMatNbOfIntervals - 1; >> 268 while ((interval>0)&&(energy<(*(*fMatSandiaMatrixPAI)[interval])[0])) >> 269 {interval--;} >> 270 x = &((*(*fMatSandiaMatrixPAI)[interval])[1]); >> 271 } >> 272 return x; >> 273 } >> 274 >> 275 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... >> 276 >> 277 inline G4double >> 278 G4SandiaTable::GetSandiaMatTablePAI(G4int interval, G4int j) >> 279 { >> 280 assert (interval >= 0 && interval < fMaxInterval && j >= 0 && j < 5 ); >> 281 if(!fMatSandiaMatrixPAI) ComputeMatSandiaMatrixPAI(); >> 282 G4double unitCof ; >> 283 if(j == 0) unitCof = keV ; >> 284 else unitCof = (cm2/g)*std::pow(keV,(G4double)j); >> 285 return ( (*(*fMatSandiaMatrixPAI)[interval])[j] )*unitCof; >> 286 } >> 287 >> 288 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... >> 289 >> 290 inline G4double >> 291 G4SandiaTable::GetIonizationPot(G4int Z) >> 292 { >> 293 return fIonizationPotentials[Z]*eV; >> 294 } >> 295 >> 296 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... >> 297 >> 298 inline G4OrderedTable* >> 299 G4SandiaTable::GetSandiaMatrixPAI() >> 300 { >> 301 if(!fMatSandiaMatrixPAI) ComputeMatSandiaMatrixPAI(); >> 302 return fMatSandiaMatrixPAI; >> 303 } >> 304 >> 305 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... >> 306 >> 307 /////////////////////////////////////////////////////////////////////// >> 308 // >> 309 // Inline methods for PAI model, will be removed in next major release >> 310 >> 311 inline G4int >> 312 G4SandiaTable::GetMaxInterval() const { >> 313 return fMaxInterval; >> 314 } >> 315 >> 316 inline G4double** >> 317 G4SandiaTable::GetPointerToCof() >> 318 { >> 319 if(!fPhotoAbsorptionCof) ComputeMatTable(); >> 320 return fPhotoAbsorptionCof; >> 321 } >> 322 >> 323 inline void >> 324 G4SandiaTable::SandiaSwap( G4double** da , >> 325 G4int i, >> 326 G4int j ) >> 327 { >> 328 G4double tmp = da[i][0] ; >> 329 da[i][0] = da[j][0] ; >> 330 da[j][0] = tmp ; >> 331 } >> 332 >> 333 inline >> 334 G4double G4SandiaTable::GetPhotoAbsorpCof(G4int i, G4int j) const >> 335 { >> 336 G4double unitCof ; >> 337 if(j == 0) unitCof = keV ; >> 338 else unitCof = (cm2/g)*std::pow(keV,(G4double)j) ; >> 339 >> 340 return fPhotoAbsorptionCof[i][j]*unitCof ; >> 341 } >> 342 >> 343 // >> 344 // >> 345 //////////////////////////////////////////////////////////////////////////// >> 346 >> 347 >> 348 #endif 159 349 160 #endif << 161 350