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 // 28 // GEANT4 Class file 29 // GEANT4 Class file 29 // 30 // 30 // 31 // 31 // File name: G4hIonisation 32 // File name: G4hIonisation 32 // 33 // 33 // Author: Laszlo Urban 34 // Author: Laszlo Urban 34 // 35 // 35 // Creation date: 30.05.1997 36 // Creation date: 30.05.1997 36 // 37 // 37 // Modified by Laszlo Urban, Michel Maire and 38 // Modified by Laszlo Urban, Michel Maire and Vladimir Ivanchenko 38 // 39 // >> 40 // 39 // ------------------------------------------- 41 // ------------------------------------------------------------------- 40 // 42 // 41 //....oooOO0OOooo........oooOO0OOooo........oo 43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 42 //....oooOO0OOooo........oooOO0OOooo........oo 44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 43 45 44 #include "G4hIonisation.hh" 46 #include "G4hIonisation.hh" 45 #include "G4PhysicalConstants.hh" 47 #include "G4PhysicalConstants.hh" 46 #include "G4SystemOfUnits.hh" 48 #include "G4SystemOfUnits.hh" 47 #include "G4Electron.hh" 49 #include "G4Electron.hh" 48 #include "G4Proton.hh" 50 #include "G4Proton.hh" 49 #include "G4AntiProton.hh" 51 #include "G4AntiProton.hh" 50 #include "G4BraggModel.hh" 52 #include "G4BraggModel.hh" 51 #include "G4BetheBlochModel.hh" 53 #include "G4BetheBlochModel.hh" 52 #include "G4EmStandUtil.hh" << 54 #include "G4IonFluctuations.hh" >> 55 #include "G4UniversalFluctuation.hh" >> 56 #include "G4BohrFluctuations.hh" >> 57 #include "G4UnitsTable.hh" 53 #include "G4PionPlus.hh" 58 #include "G4PionPlus.hh" 54 #include "G4PionMinus.hh" 59 #include "G4PionMinus.hh" 55 #include "G4KaonPlus.hh" 60 #include "G4KaonPlus.hh" 56 #include "G4KaonMinus.hh" 61 #include "G4KaonMinus.hh" 57 #include "G4ICRU73QOModel.hh" 62 #include "G4ICRU73QOModel.hh" 58 #include "G4EmParameters.hh" 63 #include "G4EmParameters.hh" 59 64 60 //....oooOO0OOooo........oooOO0OOooo........oo 65 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 61 66 >> 67 using namespace std; >> 68 62 G4hIonisation::G4hIonisation(const G4String& n 69 G4hIonisation::G4hIonisation(const G4String& name) 63 : G4VEnergyLossProcess(name) << 70 : G4VEnergyLossProcess(name), >> 71 isInitialised(false) 64 { 72 { 65 SetProcessSubType(fIonisation); 73 SetProcessSubType(fIonisation); 66 SetSecondaryParticle(G4Electron::Electron()) 74 SetSecondaryParticle(G4Electron::Electron()); 67 eth = 2*CLHEP::MeV; << 75 mass = 0.0; >> 76 ratio = 0.0; >> 77 eth = 2*MeV; 68 } 78 } 69 79 70 //....oooOO0OOooo........oooOO0OOooo........oo 80 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 71 81 72 G4bool G4hIonisation::IsApplicable(const G4Par << 82 G4hIonisation::~G4hIonisation() >> 83 {} >> 84 >> 85 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 86 >> 87 G4bool G4hIonisation::IsApplicable(const G4ParticleDefinition& p) 73 { 88 { 74 return true; << 89 return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 10.0*MeV && >> 90 !p.IsShortLived()); 75 } 91 } 76 92 77 //....oooOO0OOooo........oooOO0OOooo........oo 93 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 78 94 79 G4double G4hIonisation::MinPrimaryEnergy(const 95 G4double G4hIonisation::MinPrimaryEnergy(const G4ParticleDefinition*, 80 const G4Material*, 96 const G4Material*, 81 G4double cut) 97 G4double cut) 82 { 98 { 83 G4double x = 0.5*cut/electron_mass_c2; 99 G4double x = 0.5*cut/electron_mass_c2; 84 G4double gam = x*ratio + std::sqrt((1. + x)* 100 G4double gam = x*ratio + std::sqrt((1. + x)*(1. + x*ratio*ratio)); 85 return mass*(gam - 1.0); 101 return mass*(gam - 1.0); 86 } 102 } 87 103 88 //....oooOO0OOooo........oooOO0OOooo........oo 104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 89 105 90 void G4hIonisation::InitialiseEnergyLossProces 106 void G4hIonisation::InitialiseEnergyLossProcess( 91 const G4ParticleDefinition* part, 107 const G4ParticleDefinition* part, 92 const G4ParticleDefinition* bpart) 108 const G4ParticleDefinition* bpart) 93 { 109 { 94 if(!isInitialised) { 110 if(!isInitialised) { 95 111 96 const G4ParticleDefinition* theBaseParticl 112 const G4ParticleDefinition* theBaseParticle = nullptr; 97 G4String pname = part->GetParticleName(); 113 G4String pname = part->GetParticleName(); 98 G4double q = part->GetPDGCharge(); 114 G4double q = part->GetPDGCharge(); 99 115 100 //G4cout << " G4hIonisation::InitialiseEne 116 //G4cout << " G4hIonisation::InitialiseEnergyLossProcess " << pname 101 // << " " << bpart << G4endl; 117 // << " " << bpart << G4endl; 102 118 103 // define base particle << 119 // standard base particles 104 if(part == bpart) { << 120 if(part == bpart || pname == "proton" || 105 theBaseParticle = nullptr; << 121 pname == "anti_proton" || 106 } else if(nullptr != bpart) { << 122 pname == "pi+" || pname == "pi-" || 107 theBaseParticle = bpart; << 123 pname == "kaon+" || pname == "kaon-" || pname == "GenericIon" 108 << 124 || pname == "He3" || pname == "alpha") 109 } else if(pname == "proton" || pname == "a << 125 { 110 pname == "pi+" || pname == "pi-" || << 126 theBaseParticle = nullptr; 111 pname == "kaon+" || pname == "kaon-" | << 127 } 112 pname == "GenericIon" || pname == "alp << 128 // select base particle 113 // no base particles << 129 else if(bpart == nullptr) { 114 theBaseParticle = nullptr; << 115 130 116 } else { << 117 // select base particle << 118 if(part->GetPDGSpin() == 0.0) { 131 if(part->GetPDGSpin() == 0.0) { 119 if(q > 0.0) { theBaseParticle = G4KaonPlus:: 132 if(q > 0.0) { theBaseParticle = G4KaonPlus::KaonPlus(); } 120 else { theBaseParticle = G4KaonMinus::KaonMi 133 else { theBaseParticle = G4KaonMinus::KaonMinus(); } 121 } else { 134 } else { 122 if(q > 0.0) { theBaseParticle = G4Proton::Pr 135 if(q > 0.0) { theBaseParticle = G4Proton::Proton(); } 123 else { theBaseParticle = G4AntiProton::AntiP 136 else { theBaseParticle = G4AntiProton::AntiProton(); } 124 } 137 } >> 138 >> 139 // base particle defined by interface >> 140 } else { >> 141 theBaseParticle = bpart; 125 } 142 } 126 SetBaseParticle(theBaseParticle); 143 SetBaseParticle(theBaseParticle); 127 144 128 // model limit defined for protons << 129 mass = part->GetPDGMass(); 145 mass = part->GetPDGMass(); 130 ratio = electron_mass_c2/mass; 146 ratio = electron_mass_c2/mass; 131 eth = 2.0*MeV*mass/proton_mass_c2; 147 eth = 2.0*MeV*mass/proton_mass_c2; 132 148 133 G4EmParameters* param = G4EmParameters::In 149 G4EmParameters* param = G4EmParameters::Instance(); 134 G4double emin = param->MinKinEnergy(); << 150 G4double emin = std::min(param->MinKinEnergy(), 0.1*eth); 135 G4double emax = param->MaxKinEnergy(); << 151 G4double emax = std::max(param->MaxKinEnergy(), 100*eth); 136 152 137 // define model of energy loss fluctuation << 153 if(emin != param->MinKinEnergy() || emax != param->MaxKinEnergy()) { 138 if (nullptr == FluctModel()) { << 154 SetMinKinEnergy(emin); 139 G4bool ion = (pname == "GenericIon" || p << 155 SetMaxKinEnergy(emax); 140 SetFluctModel(G4EmStandUtil::ModelOfFluc << 156 G4int bin = G4lrint(param->NumberOfBinsPerDecade()*std::log10(emax/emin)); >> 157 SetDEDXBinning(bin); 141 } 158 } 142 159 143 if (nullptr == EmModel(0)) { << 160 if (!EmModel(0)) { 144 if(q > 0.0) { SetEmModel(new G4BraggMode 161 if(q > 0.0) { SetEmModel(new G4BraggModel()); } 145 else { SetEmModel(new G4ICRU73QOM 162 else { SetEmModel(new G4ICRU73QOModel()); } 146 } 163 } 147 // to compute ranges correctly we have to << 148 // model even if activation limit is high << 149 EmModel(0)->SetLowEnergyLimit(emin); 164 EmModel(0)->SetLowEnergyLimit(emin); >> 165 EmModel(0)->SetHighEnergyLimit(eth); >> 166 AddEmModel(1, EmModel(0), new G4IonFluctuations()); >> 167 >> 168 if (!FluctModel()) { SetFluctModel(new G4UniversalFluctuation()); } >> 169 >> 170 if (!EmModel(1)) { SetEmModel(new G4BetheBlochModel()); } >> 171 EmModel(1)->SetLowEnergyLimit(eth); >> 172 EmModel(1)->SetHighEnergyLimit(emax); >> 173 AddEmModel(1, EmModel(1), FluctModel()); 150 174 151 // high energy limit may be eth or DBL_MAX << 152 G4double emax1 = (EmModel(0)->HighEnergyLi << 153 EmModel(0)->SetHighEnergyLimit(emax1); << 154 AddEmModel(1, EmModel(0), FluctModel()); << 155 << 156 // second model is used if the first does << 157 if(emax1 < emax) { << 158 if (nullptr == EmModel(1)) { SetEmModel( << 159 EmModel(1)->SetLowEnergyLimit(emax1); << 160 << 161 // for extremely heavy particles upper l << 162 // should be increased << 163 emax = std::max(emax, eth*10); << 164 EmModel(1)->SetHighEnergyLimit(emax); << 165 AddEmModel(2, EmModel(1), FluctModel()); << 166 } << 167 isInitialised = true; 175 isInitialised = true; 168 } 176 } 169 } 177 } 170 178 171 //....oooOO0OOooo........oooOO0OOooo........oo 179 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 172 180 >> 181 void G4hIonisation::PrintInfo() >> 182 {} >> 183 >> 184 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 185 173 void G4hIonisation::ProcessDescription(std::os 186 void G4hIonisation::ProcessDescription(std::ostream& out) const 174 { 187 { 175 out << " Hadron ionisation"; << 188 out << " Ionisation"; 176 G4VEnergyLossProcess::ProcessDescription(out 189 G4VEnergyLossProcess::ProcessDescription(out); 177 } 190 } 178 191 179 //....oooOO0OOooo........oooOO0OOooo........oo 192 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 180 193