[822] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
| 26 | // |
---|
| 27 | // $Id: G4SandiaTable.hh,v 1.21 2007/10/02 10:13:33 vnivanch Exp $ |
---|
[850] | 28 | // GEANT4 tag $Name: HEAD $ |
---|
[822] | 29 | |
---|
| 30 | // class description |
---|
| 31 | // |
---|
| 32 | // This class is an interface to G4StaticSandiaData. |
---|
| 33 | // it provides - Sandia coeff for an element, given its Z |
---|
| 34 | // - sandia coeff for a material, given a pointer to it |
---|
| 35 | // |
---|
| 36 | |
---|
| 37 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... |
---|
| 38 | // |
---|
| 39 | // History: |
---|
| 40 | // |
---|
| 41 | // 10.06.97 created. V. Grichine |
---|
| 42 | // 18.11.98 simplified public interface; new methods for materials. mma |
---|
| 43 | // 30.01.01 major bug in the computation of AoverAvo and in the units (/g!) |
---|
| 44 | // in GetSandiaCofPerAtom(). mma |
---|
| 45 | // 03.04.01 fnulcof[4] added; returned if energy < emin |
---|
| 46 | // 05.03.04 V.Grichine, new methods for old sorting algorithm for PAI model |
---|
| 47 | // |
---|
| 48 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... |
---|
| 49 | |
---|
| 50 | #ifndef G4SANDIATABLE_HH |
---|
| 51 | #define G4SANDIATABLE_HH |
---|
| 52 | |
---|
| 53 | #include "G4OrderedTable.hh" |
---|
| 54 | #include "G4ios.hh" |
---|
| 55 | #include "globals.hh" |
---|
| 56 | #include <assert.h> |
---|
| 57 | |
---|
| 58 | class G4Material; |
---|
| 59 | |
---|
| 60 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... |
---|
| 61 | |
---|
| 62 | class G4SandiaTable |
---|
| 63 | { |
---|
| 64 | public: // with description |
---|
| 65 | |
---|
| 66 | G4SandiaTable(G4Material*); |
---|
| 67 | |
---|
| 68 | ~G4SandiaTable(); |
---|
| 69 | |
---|
| 70 | //main computation per atom: |
---|
| 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. |
---|
| 91 | |
---|
| 92 | private: |
---|
| 93 | |
---|
| 94 | void ComputeMatSandiaMatrix(); |
---|
| 95 | void ComputeMatSandiaMatrixPAI(); |
---|
| 96 | |
---|
| 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 |
---|
| 128 | |
---|
| 129 | public: // without description |
---|
| 130 | |
---|
| 131 | G4SandiaTable(G4int); |
---|
| 132 | |
---|
| 133 | inline void SandiaSwap( G4double** da, |
---|
| 134 | G4int i, |
---|
| 135 | G4int j ); |
---|
| 136 | |
---|
| 137 | void SandiaSort( G4double** da, |
---|
| 138 | G4int sz ); |
---|
| 139 | |
---|
| 140 | G4int SandiaIntervals( G4int Z[], |
---|
| 141 | G4int el ); |
---|
| 142 | |
---|
| 143 | G4int SandiaMixing( G4int Z[], |
---|
| 144 | const G4double fractionW[], |
---|
| 145 | G4int el, |
---|
| 146 | G4int mi ); |
---|
| 147 | |
---|
| 148 | inline G4double GetPhotoAbsorpCof(G4int i , G4int j) const; |
---|
| 149 | |
---|
| 150 | inline G4int GetMaxInterval() const; |
---|
| 151 | |
---|
| 152 | inline G4double** GetPointerToCof(); |
---|
| 153 | |
---|
| 154 | private: |
---|
| 155 | |
---|
| 156 | void ComputeMatTable(); |
---|
| 157 | |
---|
| 158 | ////////////////////////////////////////////////////////////////////////// |
---|
| 159 | // |
---|
| 160 | // data members for PAI model |
---|
| 161 | |
---|
| 162 | private: |
---|
| 163 | |
---|
| 164 | G4double** fPhotoAbsorptionCof ; // SandiaTable for mixture |
---|
| 165 | |
---|
| 166 | G4int fMaxInterval ; |
---|
| 167 | |
---|
| 168 | // |
---|
| 169 | // |
---|
| 170 | ////////////////////////////////////////////////////////////////////////// |
---|
| 171 | |
---|
| 172 | }; |
---|
| 173 | |
---|
| 174 | // Inline methods |
---|
| 175 | |
---|
| 176 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... |
---|
| 177 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... |
---|
| 178 | |
---|
| 179 | inline G4int |
---|
| 180 | G4SandiaTable::GetMatNbOfIntervals() |
---|
| 181 | { |
---|
| 182 | return fMatNbOfIntervals; |
---|
| 183 | } |
---|
| 184 | |
---|
| 185 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... |
---|
| 186 | |
---|
| 187 | inline G4int |
---|
| 188 | G4SandiaTable::GetNbOfIntervals(G4int Z) |
---|
| 189 | { |
---|
| 190 | // assert (Z>0 && Z<101); |
---|
| 191 | return fNbOfIntervals[Z]; |
---|
| 192 | } |
---|
| 193 | |
---|
| 194 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... |
---|
| 195 | |
---|
| 196 | inline G4double |
---|
| 197 | G4SandiaTable::GetSandiaCofPerAtom(G4int Z, G4int interval, G4int j) |
---|
| 198 | { |
---|
| 199 | assert (Z>0 && Z<101 && interval>=0 && interval<fNbOfIntervals[Z] |
---|
| 200 | && j>=0 && j<5); |
---|
| 201 | |
---|
| 202 | G4int row = fCumulInterval[Z-1] + interval; |
---|
| 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 | } |
---|
| 210 | |
---|
| 211 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... |
---|
| 212 | |
---|
| 213 | inline G4double |
---|
| 214 | G4SandiaTable::GetSandiaCofForMaterial(G4int interval, G4int j) |
---|
| 215 | { |
---|
| 216 | assert (interval>=0 && interval<fMatNbOfIntervals && j>=0 && j<5); |
---|
| 217 | return ((*(*fMatSandiaMatrix)[interval])[j]); |
---|
| 218 | } |
---|
| 219 | |
---|
| 220 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... |
---|
| 221 | |
---|
| 222 | inline G4double* |
---|
| 223 | G4SandiaTable::GetSandiaCofForMaterial(G4double energy) |
---|
| 224 | { |
---|
| 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 |
---|
| 349 | |
---|