Geant4 Cross Reference |
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 #ifndef G4ICRU90StoppingData_h 28 #define G4ICRU90StoppingData_h 1 29 30 //---------------------------------------------------------------------- 31 // 32 // File name: G4ICRU90StoppingData 33 // 34 // Description: Data on electroninc stopping power from ICRU 90 35 // 36 // Author: Lucas Norberto Burigo 37 // 38 // Creation date: 03.09.2018 39 // 40 // Modifications: 25.09.2018 V.Ivanchenko adopted for material sub-library 41 // 42 //---------------------------------------------------------------------------- 43 // 44 // Class Description: 45 // 46 // Data on electonic stopping powers from ICRU 90 report 47 // 48 // 49 50 #include "G4Material.hh" 51 #include "G4PhysicsFreeVector.hh" 52 #include "globals.hh" 53 54 class G4ICRU90StoppingData 55 { 56 public: 57 58 G4ICRU90StoppingData(); 59 60 ~G4ICRU90StoppingData(); 61 62 // hide assignment operator 63 G4ICRU90StoppingData& operator=(const G4ICRU90StoppingData& right) = delete; 64 G4ICRU90StoppingData(const G4ICRU90StoppingData&) = delete; 65 66 void Initialise(); 67 68 G4double GetElectronicDEDXforProton(const G4Material*, G4double kinEnergy) const; 69 70 G4double GetElectronicDEDXforAlpha(const G4Material*, G4double scaledKinEnergy) const; 71 72 inline G4int GetIndex(const G4Material*) const; 73 74 inline G4int GetIndex(const G4String&) const; 75 76 inline G4double GetElectronicDEDXforProton(G4int idx, G4double kinEnergy) const; 77 78 inline G4double GetElectronicDEDXforAlpha(G4int idx, G4double scaledKinEnergy) const; 79 80 inline G4bool IsApplicable(const G4Material*) const; 81 82 private: 83 84 inline G4double GetDEDX(const G4PhysicsFreeVector*, G4double e) const; 85 86 void FillData(); 87 88 G4PhysicsFreeVector* AddData(G4int n, const G4float* e, const G4float* dedx); 89 90 static constexpr G4int nvectors = 3; 91 const G4Material* materials[nvectors]; 92 G4PhysicsFreeVector* sdata_proton[nvectors]; 93 G4PhysicsFreeVector* sdata_alpha[nvectors]; 94 G4bool isInitialized{false}; 95 }; 96 97 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 98 99 inline G4bool G4ICRU90StoppingData::IsApplicable(const G4Material* mat) const 100 { 101 return (mat == materials[1] || mat == materials[0] || mat == materials[2]); 102 } 103 104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 105 106 inline G4int G4ICRU90StoppingData::GetIndex(const G4Material* mat) const 107 { 108 G4int idx = -1; 109 if (mat == materials[1]) { 110 idx = 1; 111 } 112 else if (mat == materials[0]) { 113 idx = 0; 114 } 115 else if (mat == materials[2]) { 116 idx = 2; 117 } 118 return idx; 119 } 120 121 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 122 123 inline G4int G4ICRU90StoppingData::GetIndex(const G4String& nam) const 124 { 125 G4int idx = -1; 126 if (nam == materials[1]->GetName()) { 127 idx = 1; 128 } 129 else if (nam == materials[0]->GetName()) { 130 idx = 0; 131 } 132 else if (nam == materials[2]->GetName()) { 133 idx = 2; 134 } 135 return idx; 136 } 137 138 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 139 140 inline G4double G4ICRU90StoppingData::GetDEDX(const G4PhysicsFreeVector* data, 141 G4double e) const 142 { 143 const G4double emin = data->Energy(0); 144 return (e >= emin) ? data->Value(e) : (*data)[0] * std::sqrt(e / emin); 145 } 146 147 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 148 149 inline G4double G4ICRU90StoppingData::GetElectronicDEDXforProton( 150 G4int idx, G4double kinEnergy) const 151 { 152 return (idx >= 0 && idx < nvectors) ? GetDEDX(sdata_proton[idx], kinEnergy) : 0.0; 153 } 154 155 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 156 157 inline G4double G4ICRU90StoppingData::GetElectronicDEDXforAlpha( 158 G4int idx, G4double scaledKinEnergy) const 159 { 160 return (idx >= 0 && idx < nvectors) ? GetDEDX(sdata_alpha[idx], scaledKinEnergy) : 0.0; 161 } 162 163 #endif 164