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 25 26 //-------------------------------------------- 26 //--------------------------------------------------------------------------- 27 // 27 // 28 // GEANT4 Class file 28 // GEANT4 Class file 29 // 29 // 30 // File name: G4ICRU90StoppingData 30 // File name: G4ICRU90StoppingData 31 // 31 // 32 // Description: Data on electroninc stopping 32 // Description: Data on electroninc stopping power from ICRU 90 33 // 33 // 34 // Author: Lucas Norberto Burigo 34 // Author: Lucas Norberto Burigo 35 // 35 // 36 // Creation date: 03.09.2018 36 // Creation date: 03.09.2018 37 // 37 // 38 // Modifications: 25.09.2018 V.Ivanchenko adop 38 // Modifications: 25.09.2018 V.Ivanchenko adopted for material sub-library 39 // 39 // 40 //-------------------------------------------- 40 //---------------------------------------------------------------------------- 41 41 42 #include "G4ICRU90StoppingData.hh" 42 #include "G4ICRU90StoppingData.hh" 43 43 44 #include "G4PhysicalConstants.hh" 44 #include "G4PhysicalConstants.hh" 45 #include "G4SystemOfUnits.hh" 45 #include "G4SystemOfUnits.hh" 46 46 47 //....oooOO0OOooo........oooOO0OOooo........oo 47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 48 48 49 G4ICRU90StoppingData::G4ICRU90StoppingData() 49 G4ICRU90StoppingData::G4ICRU90StoppingData() 50 { 50 { 51 // 1st initialisation 51 // 1st initialisation 52 for (std::size_t i = 0; i < nvectors; ++i) { 52 for (std::size_t i = 0; i < nvectors; ++i) { 53 materials[i] = nullptr; 53 materials[i] = nullptr; 54 sdata_proton[i] = nullptr; 54 sdata_proton[i] = nullptr; 55 sdata_alpha[i] = nullptr; 55 sdata_alpha[i] = nullptr; 56 } 56 } 57 FillData(); 57 FillData(); 58 58 59 Initialise(); 59 Initialise(); 60 } 60 } 61 61 62 //....oooOO0OOooo........oooOO0OOooo........oo 62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 63 63 64 G4ICRU90StoppingData::~G4ICRU90StoppingData() 64 G4ICRU90StoppingData::~G4ICRU90StoppingData() 65 { 65 { 66 for (std::size_t i = 0; i < nvectors; ++i) { 66 for (std::size_t i = 0; i < nvectors; ++i) { 67 delete sdata_proton[i]; 67 delete sdata_proton[i]; 68 delete sdata_alpha[i]; 68 delete sdata_alpha[i]; 69 } 69 } 70 } 70 } 71 71 72 //....oooOO0OOooo........oooOO0OOooo........oo 72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 73 73 74 void G4ICRU90StoppingData::Initialise() 74 void G4ICRU90StoppingData::Initialise() 75 { 75 { 76 if (isInitialized) { 76 if (isInitialized) { 77 return; 77 return; 78 } 78 } 79 // this method may be called several times d 79 // this method may be called several times during initialisation 80 auto nmat = (G4int)G4Material::GetNumberOfMa 80 auto nmat = (G4int)G4Material::GetNumberOfMaterials(); 81 if (nmat == (G4int)nvectors) { 81 if (nmat == (G4int)nvectors) { 82 return; 82 return; 83 } 83 } 84 84 85 static const G4String nameNIST_ICRU90[3] = { 85 static const G4String nameNIST_ICRU90[3] = {"G4_AIR", "G4_WATER", "G4_GRAPHITE"}; 86 86 87 // loop via material list to add extra data 87 // loop via material list to add extra data 88 for (G4int i = 0; i < nmat; ++i) { 88 for (G4int i = 0; i < nmat; ++i) { 89 const G4Material* mat = (*(G4Material::Get 89 const G4Material* mat = (*(G4Material::GetMaterialTable()))[i]; 90 90 91 G4bool isThere = false; 91 G4bool isThere = false; 92 for (auto const & material : materials) { 92 for (auto const & material : materials) { 93 if (mat == material) { 93 if (mat == material) { 94 isThere = true; 94 isThere = true; 95 break; 95 break; 96 } 96 } 97 } 97 } 98 if (! isThere) { 98 if (! isThere) { 99 // check list of NIST materials 99 // check list of NIST materials 100 G4String mname = mat->GetName(); 100 G4String mname = mat->GetName(); 101 for (G4int j = 0; j < nvectors; ++j) { 101 for (G4int j = 0; j < nvectors; ++j) { 102 if (mname == nameNIST_ICRU90[j]) { 102 if (mname == nameNIST_ICRU90[j]) { 103 materials[j] = mat; 103 materials[j] = mat; 104 break; 104 break; 105 } 105 } 106 } 106 } 107 } 107 } 108 isInitialized = 108 isInitialized = 109 ((materials[0] != nullptr) && (materials 109 ((materials[0] != nullptr) && (materials[1] != nullptr) && (materials[2] != nullptr)); 110 if (isInitialized) { 110 if (isInitialized) { 111 return; 111 return; 112 } 112 } 113 } 113 } 114 } 114 } 115 115 116 //....oooOO0OOooo........oooOO0OOooo........oo 116 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 117 117 118 G4double G4ICRU90StoppingData::GetElectronicDE 118 G4double G4ICRU90StoppingData::GetElectronicDEDXforProton( 119 const G4Material* mat, G4double kinEnergy) c 119 const G4Material* mat, G4double kinEnergy) const 120 { 120 { 121 const G4int idx = GetIndex(mat); 121 const G4int idx = GetIndex(mat); 122 return (idx >= 0) ? GetDEDX(sdata_proton[idx 122 return (idx >= 0) ? GetDEDX(sdata_proton[idx], kinEnergy) : 0.0; 123 } 123 } 124 124 125 //....oooOO0OOooo........oooOO0OOooo........oo 125 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 126 126 127 G4double G4ICRU90StoppingData::GetElectronicDE 127 G4double G4ICRU90StoppingData::GetElectronicDEDXforAlpha( 128 const G4Material* mat, G4double scaledKinEne 128 const G4Material* mat, G4double scaledKinEnergy) const 129 { 129 { 130 const G4int idx = GetIndex(mat); 130 const G4int idx = GetIndex(mat); 131 return (idx >= 0) ? GetDEDX(sdata_alpha[idx] 131 return (idx >= 0) ? GetDEDX(sdata_alpha[idx], scaledKinEnergy) : 0.0; 132 } 132 } 133 133 134 //....oooOO0OOooo........oooOO0OOooo........oo 134 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 135 135 136 void G4ICRU90StoppingData::FillData() 136 void G4ICRU90StoppingData::FillData() 137 { 137 { 138 // clang-format off 138 // clang-format off 139 static const G4float T0_proton[57] = { 0.00 139 static const G4float T0_proton[57] = { 0.0010f, 0.001500f, 0.0020f, 0.0030f, 0.0040f, 0.0050f, 0.0060f, 0.0080f, 0.010f, 0.0150f, 0.020f, 0.030f, 0.040f, 0.050f, 0.060f, 0.080f, 0.10f, 0.150f, 0.20f, 0.30f, 0.40f, 0.50f, 0.60f, 0.80f, 1.00f, 1.50f, 2.00f, 3.00f, 4.00f, 5.00f, 6.00f, 8.00f, 10.00f, 15.00f, 20.00f, 30.00f, 40.00f, 50.00f, 60.00f, 80.00f, 100.00f, 150.00f, 200.00f, 300.00f, 400.00f, 500.00f, 600.00f, 800.00f, 1000.00f, 1500.00f, 2000.00f, 3000.00f, 4000.00f, 5000.00f, 6000.00f, 8000.00f, 10000.00f }; 140 140 141 static const G4float T0_alpha[49] = { 0.001 141 static const G4float T0_alpha[49] = { 0.0010f, 0.001500f, 0.0020f, 0.0030f, 0.0040f, 0.0050f, 0.0060f, 0.0080f, 0.010f, 0.0150f, 0.020f, 0.030f, 0.040f, 0.050f, 0.060f, 0.080f, 0.10f, 0.150f, 0.20f, 0.30f, 0.40f, 0.50f, 0.60f, 0.80f, 1.00f, 1.50f, 2.00f, 3.00f, 4.00f, 5.00f, 6.00f, 8.00f, 10.00f, 15.00f, 20.00f, 30.00f, 40.00f, 50.00f, 60.00f, 80.00f, 100.00f, 150.00f, 200.00f, 300.00f, 400.00f, 500.00f, 600.00f, 800.00f, 1000.00f }; 142 142 143 static const G4float e0_proton[57] = { 119. 143 static const G4float e0_proton[57] = { 119.70f, 146.70f, 169.30f, 207.40f, 239.50f, 267.80f, 293.30f, 338.70f, 378.70f, 450.40f, 506.70f, 590.50f, 648.30f, 687.70f, 713.20f, 734.10f, 729.00f, 667.20f, 592.20f, 476.50f, 401.20f, 349.80f, 312.10f, 258.70f, 222.70f, 168.20f, 137.00f, 101.70f, 81.920f, 69.050f, 59.940f, 47.810f, 40.040f, 28.920f, 22.930f, 16.520f, 13.120f, 10.980f, 9.5140f, 7.6180f, 6.4410f, 4.8150f, 3.9750f, 3.1170f, 2.6860f, 2.4310f, 2.2650f, 2.0690f, 1.9620f, 1.850f, 1.820f, 1.8280f, 1.8610f, 1.8980f, 1.9340f, 1.9980f, 2.0520f }; 144 144 145 static const G4float e0_alpha[49] = { 87.50 145 static const G4float e0_alpha[49] = { 87.50f, 108.60f, 126.70f, 157.30f, 183.50f, 206.70f, 227.90f, 265.90f, 299.60f, 372.30f, 434.30f, 539.50f, 629.00f, 708.10f, 779.80f, 906.80f, 1018.00f, 1247.00f, 1429.00f, 1693.00f, 1861.00f, 1961.00f, 2008.00f, 2002.00f, 1922.00f, 1626.00f, 1381.00f, 1071.00f, 885.80f, 760.60f, 669.60f, 545.30f, 463.40f, 342.30f, 274.70f, 200.10f, 159.30f, 133.20f, 115.00f, 91.190f, 76.140f, 54.930f, 43.690f, 31.840f, 25.630f, 21.790f, 19.170f, 15.830f, 13.790f }; 146 146 147 static const G4float e1_proton[57] = { 133. 147 static const G4float e1_proton[57] = { 133.70f, 163.80f, 189.10f, 231.60f, 267.50f, 299.00f, 327.60f, 378.20f, 422.90f, 503.60f, 567.30f, 662.80f, 729.00f, 774.00f, 802.60f, 824.10f, 814.50f, 736.00f, 658.50f, 543.50f, 464.30f, 406.50f, 362.40f, 299.70f, 257.40f, 193.40f, 156.90f, 116.00f, 93.190f, 78.420f, 68.010f, 54.170f, 45.320f, 32.690f, 25.890f, 18.640f, 14.790f, 12.380f, 10.720f, 8.5780f, 7.250f, 5.4170f, 4.470f, 3.5040f, 3.0180f, 2.7310f, 2.5440f, 2.3230f, 2.2030f, 2.0650f, 2.0170f, 1.9980f, 2.010f, 2.0290f, 2.050f, 2.090f, 2.1240f }; 148 148 149 static const G4float e1_alpha[49] = { 98.91 149 static const G4float e1_alpha[49] = { 98.910f, 122.80f, 143.10f, 177.60f, 206.90f, 233.00f, 256.80f, 299.30f, 337.00f, 418.10f, 487.10f, 603.90f, 703.00f, 790.50f, 869.60f, 1009.00f, 1131.00f, 1383.00f, 1582.00f, 1873.00f, 2062.00f, 2178.00f, 2240.00f, 2256.00f, 2190.00f, 1877.00f, 1599.00f, 1239.00f, 1021.00f, 874.70f, 768.70f, 623.90f, 529.00f, 389.40f, 311.80f, 226.70f, 180.20f, 150.60f, 130.00f, 103.00f, 85.930f, 61.940f, 49.230f, 35.860f, 28.850f, 24.520f, 21.560f, 17.80f, 15.50f }; 150 150 151 static const G4float e2_proton[57] = { 118. 151 static const G4float e2_proton[57] = { 118.50f, 145.10f, 167.60f, 205.30f, 237.00f, 265.00f, 290.30f, 335.20f, 374.80f, 435.30f, 481.10f, 550.30f, 611.00f, 663.00f, 697.60f, 726.70f, 726.60f, 671.20f, 598.60f, 483.30f, 407.10f, 354.60f, 315.90f, 262.40f, 226.10f, 171.10f, 139.40f, 103.50f, 83.260f, 70.10f, 60.810f, 48.450f, 40.550f, 29.250f, 23.170f, 16.680f, 13.230f, 11.070f, 9.5910f, 7.6750f, 6.4860f, 4.8430f, 3.9940f, 3.1250f, 2.6870f, 2.4260f, 2.2550f, 2.050f, 1.9360f, 1.8060f, 1.760f, 1.7440f, 1.7560f, 1.7750f, 1.7960f, 1.8340f, 1.8680f }; 152 152 153 static const G4float e2_alpha[49] = { 192.3 153 static const G4float e2_alpha[49] = { 192.30f, 228.90f, 259.00f, 308.30f, 348.90f, 384.00f, 415.30f, 469.90f, 517.00f, 615.10f, 695.50f, 826.20f, 932.70f, 1024.00f, 1104.00f, 1240.00f, 1354.00f, 1574.00f, 1731.00f, 1929.00f, 2027.00f, 2063.00f, 2060.00f, 1993.00f, 1891.00f, 1615.00f, 1387.00f, 1085.00f, 898.20f, 772.00f, 680.40f, 554.40f, 471.20f, 347.80f, 278.80f, 202.80f, 161.20f, 134.80f, 116.30f, 92.140f, 76.890f, 55.430f, 44.050f, 32.090f, 25.810f, 21.930f, 19.280f, 15.910f, 13.840f }; 154 154 155 sdata_proton[0] = AddData(57, T0_proton, e0_ 155 sdata_proton[0] = AddData(57, T0_proton, e0_proton); 156 sdata_proton[1] = AddData(57, T0_proton, e1_ 156 sdata_proton[1] = AddData(57, T0_proton, e1_proton); 157 sdata_proton[2] = AddData(57, T0_proton, e2_ 157 sdata_proton[2] = AddData(57, T0_proton, e2_proton); 158 158 159 sdata_alpha[0] = AddData(49, T0_alpha, e0_al 159 sdata_alpha[0] = AddData(49, T0_alpha, e0_alpha); 160 sdata_alpha[1] = AddData(49, T0_alpha, e1_al 160 sdata_alpha[1] = AddData(49, T0_alpha, e1_alpha); 161 sdata_alpha[2] = AddData(49, T0_alpha, e2_al 161 sdata_alpha[2] = AddData(49, T0_alpha, e2_alpha); 162 // clang-format on 162 // clang-format on 163 } 163 } 164 164 165 //....oooOO0OOooo........oooOO0OOooo........oo 165 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 166 166 167 G4PhysicsFreeVector* G4ICRU90StoppingData::Add 167 G4PhysicsFreeVector* G4ICRU90StoppingData::AddData(G4int n, const G4float* e, 168 168 const G4float* dedx) 169 { 169 { 170 static const G4double fac = CLHEP::MeV * CLH 170 static const G4double fac = CLHEP::MeV * CLHEP::cm2 / CLHEP::g; 171 171 172 auto* data = new G4PhysicsFreeVector(n, e[0] 172 auto* data = new G4PhysicsFreeVector(n, e[0], e[n - 1], true); 173 for (G4int i = 0; i < n; ++i) { 173 for (G4int i = 0; i < n; ++i) { 174 data->PutValues(i, ((G4double)e[i]) * CLHE 174 data->PutValues(i, ((G4double)e[i]) * CLHEP::MeV, ((G4double)dedx[i]) * fac); 175 } 175 } 176 data->FillSecondDerivatives(); 176 data->FillSecondDerivatives(); 177 return data; 177 return data; 178 } 178 } 179 179