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