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 // $Id: G4hIonisation.cc,v 1.81 2008/10/22 16:02:20 vnivanch Exp $ >> 27 // GEANT4 tag $Name: geant4-09-02 $ >> 28 // 26 // ------------------------------------------- 29 // ------------------------------------------------------------------- 27 // 30 // 28 // GEANT4 Class file 31 // GEANT4 Class file 29 // 32 // 30 // 33 // 31 // File name: G4hIonisation 34 // File name: G4hIonisation 32 // 35 // 33 // Author: Laszlo Urban 36 // Author: Laszlo Urban 34 // 37 // 35 // Creation date: 30.05.1997 38 // Creation date: 30.05.1997 36 // 39 // 37 // Modified by Laszlo Urban, Michel Maire and << 40 // Modifications: >> 41 // >> 42 // corrected by L.Urban on 24/09/97 >> 43 // several bugs corrected by L.Urban on 13/01/98 >> 44 // 07-04-98 remove 'tracking cut' of the ionizing particle, mma >> 45 // 22-10-98 cleanup L.Urban >> 46 // 02-02-99 bugs fixed , L.Urban >> 47 // 29-07-99 correction in BuildLossTable for low energy, L.Urban >> 48 // 10-02-00 modifications , new e.m. structure, L.Urban >> 49 // 10-08-00 V.Ivanchenko change BuildLambdaTable, in order to >> 50 // simulate energy losses of ions; correction to >> 51 // cross section for particles with spin 1 is inserted as well >> 52 // 28-05-01 V.Ivanchenko minor changes to provide ANSI -wall compilation >> 53 // 10-08-01 new methods Store/Retrieve PhysicsTable (mma) >> 54 // 14-08-01 new function ComputeRestrictedMeandEdx() + 'cleanup' (mma) >> 55 // 29-08-01 PostStepDoIt: correction for spin 1/2 (instead of 1) (mma) >> 56 // 17-09-01 migration of Materials to pure STL (mma) >> 57 // 25-09-01 completion of RetrievePhysicsTable() (mma) >> 58 // 29-10-01 all static functions no more inlined >> 59 // 08-11-01 Charge renamed zparticle; added to the dedx >> 60 // 27-03-02 Bug fix in scaling of lambda table (V.Ivanchenko) >> 61 // 09-04-02 Update calculation of tables for GenericIons (V.Ivanchenko) >> 62 // 30-04-02 V.Ivanchenko update to new design >> 63 // 04-12-02 Add verbose level definition (VI) >> 64 // 23-12-02 Change interface in order to move to cut per region (V.Ivanchenko) >> 65 // 26-12-02 Secondary production moved to derived classes (V.Ivanchenko) >> 66 // 13-02-03 SubCutoff regime is assigned to a region (V.Ivanchenko) >> 67 // 23-05-03 Define default integral + BohrFluctuations (V.Ivanchenko) >> 68 // 03-06-03 Fix initialisation problem for STD ionisation (V.Ivanchenko) >> 69 // 04-08-03 Set integral=false to be default (V.Ivanchenko) >> 70 // 08-08-03 STD substitute standard (V.Ivanchenko) >> 71 // 12-11-03 G4EnergyLossSTD -> G4EnergyLossProcess (V.Ivanchenko) >> 72 // 27-05-04 Set integral to be a default regime (V.Ivanchenko) >> 73 // 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivantchenko) >> 74 // 24-03-05 Optimize internal interfaces (V.Ivantchenko) >> 75 // 12-08-05 SetStepLimits(0.2, 0.1*mm) (mma) >> 76 // 10-01-06 SetStepLimits -> SetStepFunction (V.Ivanchenko) >> 77 // 26-05-06 scale negative particles from pi- and pbar, >> 78 // positive from pi+ and p (VI) >> 79 // 14-01-07 use SetEmModel() and SetFluctModel() from G4VEnergyLossProcess (mma) >> 80 // 12-09-08 Removed CorrectionsAlongStep (VI) 38 // 81 // 39 // ------------------------------------------- 82 // ------------------------------------------------------------------- 40 // 83 // 41 //....oooOO0OOooo........oooOO0OOooo........oo 84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 42 //....oooOO0OOooo........oooOO0OOooo........oo 85 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 43 86 44 #include "G4hIonisation.hh" 87 #include "G4hIonisation.hh" 45 #include "G4PhysicalConstants.hh" << 46 #include "G4SystemOfUnits.hh" << 47 #include "G4Electron.hh" 88 #include "G4Electron.hh" 48 #include "G4Proton.hh" 89 #include "G4Proton.hh" 49 #include "G4AntiProton.hh" 90 #include "G4AntiProton.hh" 50 #include "G4BraggModel.hh" 91 #include "G4BraggModel.hh" 51 #include "G4BetheBlochModel.hh" 92 #include "G4BetheBlochModel.hh" 52 #include "G4EmStandUtil.hh" << 93 #include "G4IonFluctuations.hh" >> 94 #include "G4UniversalFluctuation.hh" >> 95 #include "G4BohrFluctuations.hh" >> 96 #include "G4UnitsTable.hh" 53 #include "G4PionPlus.hh" 97 #include "G4PionPlus.hh" 54 #include "G4PionMinus.hh" 98 #include "G4PionMinus.hh" 55 #include "G4KaonPlus.hh" 99 #include "G4KaonPlus.hh" 56 #include "G4KaonMinus.hh" 100 #include "G4KaonMinus.hh" 57 #include "G4ICRU73QOModel.hh" << 58 #include "G4EmParameters.hh" << 59 101 60 //....oooOO0OOooo........oooOO0OOooo........oo 102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 61 103 >> 104 using namespace std; >> 105 62 G4hIonisation::G4hIonisation(const G4String& n 106 G4hIonisation::G4hIonisation(const G4String& name) 63 : G4VEnergyLossProcess(name) << 107 : G4VEnergyLossProcess(name), >> 108 isInitialised(false), >> 109 nuclearStopping(true) 64 { 110 { >> 111 // SetStepFunction(0.2, 1.0*mm); >> 112 //SetIntegral(true); >> 113 //SetVerboseLevel(1); 65 SetProcessSubType(fIonisation); 114 SetProcessSubType(fIonisation); 66 SetSecondaryParticle(G4Electron::Electron()) << 115 mass = 0.0; 67 eth = 2*CLHEP::MeV; << 116 ratio = 0.0; 68 } << 69 << 70 //....oooOO0OOooo........oooOO0OOooo........oo << 71 << 72 G4bool G4hIonisation::IsApplicable(const G4Par << 73 { << 74 return true; << 75 } 117 } 76 118 77 //....oooOO0OOooo........oooOO0OOooo........oo 119 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 78 120 79 G4double G4hIonisation::MinPrimaryEnergy(const << 121 G4hIonisation::~G4hIonisation() 80 const G4Material*, << 122 {} 81 G4double cut) << 82 { << 83 G4double x = 0.5*cut/electron_mass_c2; << 84 G4double gam = x*ratio + std::sqrt((1. + x)* << 85 return mass*(gam - 1.0); << 86 } << 87 123 88 //....oooOO0OOooo........oooOO0OOooo........oo 124 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 89 125 90 void G4hIonisation::InitialiseEnergyLossProces 126 void G4hIonisation::InitialiseEnergyLossProcess( 91 const G4ParticleDefinition* part, 127 const G4ParticleDefinition* part, 92 const G4ParticleDefinition* bpart) 128 const G4ParticleDefinition* bpart) 93 { 129 { 94 if(!isInitialised) { 130 if(!isInitialised) { 95 131 96 const G4ParticleDefinition* theBaseParticl << 132 const G4ParticleDefinition* theBaseParticle = 0; 97 G4String pname = part->GetParticleName(); 133 G4String pname = part->GetParticleName(); 98 G4double q = part->GetPDGCharge(); << 99 << 100 //G4cout << " G4hIonisation::InitialiseEne << 101 // << " " << bpart << G4endl; << 102 134 103 // define base particle << 135 // standard base particles 104 if(part == bpart) { << 136 if(part == bpart || pname == "proton" || 105 theBaseParticle = nullptr; << 137 pname == "anti_proton" || 106 } else if(nullptr != bpart) { << 138 pname == "pi+" || pname == "pi-" || 107 theBaseParticle = bpart; << 139 pname == "kaon+" || pname == "kaon-") >> 140 { >> 141 theBaseParticle = 0; >> 142 } >> 143 // select base particle >> 144 else if(bpart == 0) { 108 145 109 } else if(pname == "proton" || pname == "a << 146 if(part->GetPDGSpin() == 0.0) 110 pname == "pi+" || pname == "pi-" || << 147 if(part->GetPDGCharge() > 0.0 ) { 111 pname == "kaon+" || pname == "kaon-" | << 148 theBaseParticle = G4KaonPlus::KaonPlus(); 112 pname == "GenericIon" || pname == "alp << 149 } else { 113 // no base particles << 150 theBaseParticle = G4KaonMinus::KaonMinus(); 114 theBaseParticle = nullptr; << 151 } 115 << 152 else if(part->GetPDGCharge() > 0.0) { 116 } else { << 153 theBaseParticle = G4Proton::Proton(); 117 // select base particle << 118 if(part->GetPDGSpin() == 0.0) { << 119 if(q > 0.0) { theBaseParticle = G4KaonPlus:: << 120 else { theBaseParticle = G4KaonMinus::KaonMi << 121 } else { 154 } else { 122 if(q > 0.0) { theBaseParticle = G4Proton::Pr << 155 theBaseParticle = G4AntiProton::AntiProton(); 123 else { theBaseParticle = G4AntiProton::AntiP << 124 } 156 } >> 157 // base particle defined by interface >> 158 } else { >> 159 theBaseParticle = bpart; 125 } 160 } 126 SetBaseParticle(theBaseParticle); 161 SetBaseParticle(theBaseParticle); >> 162 SetSecondaryParticle(G4Electron::Electron()); 127 163 128 // model limit defined for protons << 129 mass = part->GetPDGMass(); 164 mass = part->GetPDGMass(); 130 ratio = electron_mass_c2/mass; 165 ratio = electron_mass_c2/mass; 131 eth = 2.0*MeV*mass/proton_mass_c2; << 132 166 133 G4EmParameters* param = G4EmParameters::In << 167 if(mass < 900.*MeV) nuclearStopping = false; 134 G4double emin = param->MinKinEnergy(); << 168 135 G4double emax = param->MaxKinEnergy(); << 169 if (!EmModel(1)) SetEmModel(new G4BraggModel(),1); 136 << 170 EmModel(1)->SetLowEnergyLimit(MinKinEnergy()); 137 // define model of energy loss fluctuation << 171 138 if (nullptr == FluctModel()) { << 172 // model limit defined for protons 139 G4bool ion = (pname == "GenericIon" || p << 173 eth = (EmModel(1)->HighEnergyLimit())*mass/proton_mass_c2; 140 SetFluctModel(G4EmStandUtil::ModelOfFluc << 174 EmModel(1)->SetHighEnergyLimit(eth); 141 } << 175 AddEmModel(1, EmModel(1), new G4IonFluctuations()); >> 176 >> 177 if (!FluctModel()) SetFluctModel(new G4UniversalFluctuation()); >> 178 >> 179 if (!EmModel(2)) SetEmModel(new G4BetheBlochModel(),2); >> 180 EmModel(2)->SetLowEnergyLimit(eth); >> 181 EmModel(2)->SetHighEnergyLimit(MaxKinEnergy()); >> 182 AddEmModel(2, EmModel(2), FluctModel()); 142 183 143 if (nullptr == EmModel(0)) { << 144 if(q > 0.0) { SetEmModel(new G4BraggMode << 145 else { SetEmModel(new G4ICRU73QOM << 146 } << 147 // to compute ranges correctly we have to << 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)->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; 184 isInitialised = true; 168 } 185 } >> 186 EmModel(1)->ActivateNuclearStopping(nuclearStopping); >> 187 EmModel(2)->ActivateNuclearStopping(nuclearStopping); 169 } 188 } 170 189 171 //....oooOO0OOooo........oooOO0OOooo........oo 190 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 172 191 173 void G4hIonisation::ProcessDescription(std::os << 192 void G4hIonisation::PrintInfo() 174 { 193 { 175 out << " Hadron ionisation"; << 194 if(EmModel(1) && EmModel(2)) { 176 G4VEnergyLossProcess::ProcessDescription(out << 195 G4cout << " NuclearStopping= " << nuclearStopping >> 196 << G4endl; >> 197 } 177 } 198 } 178 199 179 //....oooOO0OOooo........oooOO0OOooo........oo << 200 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 180 201