Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 26 //-------------------------------------------- 27 // 28 // GEANT4 Class file 29 // 30 // File name: G4ICRU90StoppingData 31 // 32 // Description: Data on electroninc stopping 33 // 34 // Author: Lucas Norberto Burigo 35 // 36 // Creation date: 03.09.2018 37 // 38 // Modifications: 25.09.2018 V.Ivanchenko adop 39 // 40 //-------------------------------------------- 41 42 #include "G4ICRU90StoppingData.hh" 43 44 #include "G4PhysicalConstants.hh" 45 #include "G4SystemOfUnits.hh" 46 47 //....oooOO0OOooo........oooOO0OOooo........oo 48 49 G4ICRU90StoppingData::G4ICRU90StoppingData() 50 { 51 // 1st initialisation 52 for (std::size_t i = 0; i < nvectors; ++i) { 53 materials[i] = nullptr; 54 sdata_proton[i] = nullptr; 55 sdata_alpha[i] = nullptr; 56 } 57 FillData(); 58 59 Initialise(); 60 } 61 62 //....oooOO0OOooo........oooOO0OOooo........oo 63 64 G4ICRU90StoppingData::~G4ICRU90StoppingData() 65 { 66 for (std::size_t i = 0; i < nvectors; ++i) { 67 delete sdata_proton[i]; 68 delete sdata_alpha[i]; 69 } 70 } 71 72 //....oooOO0OOooo........oooOO0OOooo........oo 73 74 void G4ICRU90StoppingData::Initialise() 75 { 76 if (isInitialized) { 77 return; 78 } 79 // this method may be called several times d 80 auto nmat = (G4int)G4Material::GetNumberOfMa 81 if (nmat == (G4int)nvectors) { 82 return; 83 } 84 85 static const G4String nameNIST_ICRU90[3] = { 86 87 // loop via material list to add extra data 88 for (G4int i = 0; i < nmat; ++i) { 89 const G4Material* mat = (*(G4Material::Get 90 91 G4bool isThere = false; 92 for (auto const & material : materials) { 93 if (mat == material) { 94 isThere = true; 95 break; 96 } 97 } 98 if (! isThere) { 99 // check list of NIST materials 100 G4String mname = mat->GetName(); 101 for (G4int j = 0; j < nvectors; ++j) { 102 if (mname == nameNIST_ICRU90[j]) { 103 materials[j] = mat; 104 break; 105 } 106 } 107 } 108 isInitialized = 109 ((materials[0] != nullptr) && (materials 110 if (isInitialized) { 111 return; 112 } 113 } 114 } 115 116 //....oooOO0OOooo........oooOO0OOooo........oo 117 118 G4double G4ICRU90StoppingData::GetElectronicDE 119 const G4Material* mat, G4double kinEnergy) c 120 { 121 const G4int idx = GetIndex(mat); 122 return (idx >= 0) ? GetDEDX(sdata_proton[idx 123 } 124 125 //....oooOO0OOooo........oooOO0OOooo........oo 126 127 G4double G4ICRU90StoppingData::GetElectronicDE 128 const G4Material* mat, G4double scaledKinEne 129 { 130 const G4int idx = GetIndex(mat); 131 return (idx >= 0) ? GetDEDX(sdata_alpha[idx] 132 } 133 134 //....oooOO0OOooo........oooOO0OOooo........oo 135 136 void G4ICRU90StoppingData::FillData() 137 { 138 // clang-format off 139 static const G4float T0_proton[57] = { 0.00 140 141 static const G4float T0_alpha[49] = { 0.001 142 143 static const G4float e0_proton[57] = { 119. 144 145 static const G4float e0_alpha[49] = { 87.50 146 147 static const G4float e1_proton[57] = { 133. 148 149 static const G4float e1_alpha[49] = { 98.91 150 151 static const G4float e2_proton[57] = { 118. 152 153 static const G4float e2_alpha[49] = { 192.3 154 155 sdata_proton[0] = AddData(57, T0_proton, e0_ 156 sdata_proton[1] = AddData(57, T0_proton, e1_ 157 sdata_proton[2] = AddData(57, T0_proton, e2_ 158 159 sdata_alpha[0] = AddData(49, T0_alpha, e0_al 160 sdata_alpha[1] = AddData(49, T0_alpha, e1_al 161 sdata_alpha[2] = AddData(49, T0_alpha, e2_al 162 // clang-format on 163 } 164 165 //....oooOO0OOooo........oooOO0OOooo........oo 166 167 G4PhysicsFreeVector* G4ICRU90StoppingData::Add 168 169 { 170 static const G4double fac = CLHEP::MeV * CLH 171 172 auto* data = new G4PhysicsFreeVector(n, e[0] 173 for (G4int i = 0; i < n; ++i) { 174 data->PutValues(i, ((G4double)e[i]) * CLHE 175 } 176 data->FillSecondDerivatives(); 177 return data; 178 } 179