- Timestamp:
- Apr 6, 2009, 12:21:12 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/electromagnetic/standard/src/G4BraggModel.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4BraggModel.cc,v 1. 16 2007/07/28 13:30:53vnivanch Exp $27 // GEANT4 tag $Name: $26 // $Id: G4BraggModel.cc,v 1.21 2009/02/20 12:06:37 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 50 50 // 15-02-06 ComputeCrossSectionPerElectron, ComputeCrossSectionPerAtom (mma) 51 51 // 25-04-06 Add stopping data from PSTAR (V.Ivanchenko) 52 // 12-08-08 Added methods GetParticleCharge, GetChargeSquareRatio, 53 // CorrectionsAlongStep needed for ions(V.Ivanchenko) 52 54 53 55 // Class Description: … … 67 69 #include "G4Electron.hh" 68 70 #include "G4ParticleChangeForLoss.hh" 71 #include "G4LossTableManager.hh" 72 #include "G4EmCorrections.hh" 69 73 70 74 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... … … 74 78 G4BraggModel::G4BraggModel(const G4ParticleDefinition* p, const G4String& nam) 75 79 : G4VEmModel(nam), 76 particle(0), 77 protonMassAMU(1.007276), 78 iMolecula(0), 79 isIon(false) 80 particle(0), 81 protonMassAMU(1.007276), 82 iMolecula(0), 83 isIon(false), 84 isInitialised(false) 80 85 { 81 86 if(p) SetParticle(p); 87 SetHighEnergyLimit(2.0*MeV); 88 82 89 lowestKinEnergy = 1.0*keV; 83 90 theZieglerFactor = eV*cm2*1.0e-15; … … 104 111 { 105 112 if(p != particle) SetParticle(p); 106 G4String pname = particle->GetParticleName(); 107 if(particle->GetParticleType() == "nucleus" && 108 pname != "deuteron" && pname != "triton") isIon = true; 109 110 if(pParticleChange) 111 fParticleChange = reinterpret_cast<G4ParticleChangeForLoss*> 112 (pParticleChange); 113 else 114 fParticleChange = new G4ParticleChangeForLoss(); 113 114 // always false before the run 115 SetDeexcitationFlag(false); 116 117 if(!isInitialised) { 118 isInitialised = true; 119 120 G4String pname = particle->GetParticleName(); 121 if(particle->GetParticleType() == "nucleus" && 122 pname != "deuteron" && pname != "triton") isIon = true; 123 124 corr = G4LossTableManager::Instance()->EmCorrections(); 125 126 if(pParticleChange) { 127 fParticleChange = 128 reinterpret_cast<G4ParticleChangeForLoss*>(pParticleChange); 129 } else { 130 fParticleChange = new G4ParticleChangeForLoss(); 131 } 132 } 133 } 134 135 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 136 137 G4double G4BraggModel::GetChargeSquareRatio(const G4ParticleDefinition* p, 138 const G4Material* mat, 139 G4double kineticEnergy) 140 { 141 // this method is called only for ions 142 G4double q2 = corr->EffectiveChargeSquareRatio(p,mat,kineticEnergy); 143 GetModelOfFluctuations()->SetParticleAndCharge(p, q2); 144 return q2*corr->EffectiveChargeCorrection(p,mat,kineticEnergy); 145 } 146 147 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 148 149 G4double G4BraggModel::GetParticleCharge(const G4ParticleDefinition* p, 150 const G4Material* mat, 151 G4double kineticEnergy) 152 { 153 // this method is called only for ions 154 return corr->GetParticleCharge(p,mat,kineticEnergy); 115 155 } 116 156 … … 123 163 G4double maxKinEnergy) 124 164 { 125 126 165 G4double cross = 0.0; 127 166 G4double tmax = MaxSecondaryEnergy(p, kineticEnergy); 128 G4double maxEnergy = min(tmax,maxKinEnergy);167 G4double maxEnergy = std::min(tmax,maxKinEnergy); 129 168 if(cutEnergy < tmax) { 130 169 … … 203 242 204 243 return dedx; 244 } 245 246 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 247 248 void G4BraggModel::CorrectionsAlongStep(const G4MaterialCutsCouple* couple, 249 const G4DynamicParticle* dp, 250 G4double& eloss, 251 G4double&, 252 G4double length) 253 { 254 if(nuclearStopping) { 255 256 G4double preKinEnergy = dp->GetKineticEnergy(); 257 G4double e = preKinEnergy - eloss*0.5; 258 if(e < 0.0) e = preKinEnergy*0.5; 259 G4double nloss = length*corr->NuclearDEDX(dp->GetDefinition(), 260 couple->GetMaterial(), 261 e,false); 262 263 // too big energy loss 264 if(eloss + nloss > preKinEnergy) { 265 nloss *= (preKinEnergy/(eloss + nloss)); 266 eloss = preKinEnergy; 267 } else { 268 eloss += nloss; 269 } 270 /* 271 G4cout << "G4ionIonisation::CorrectionsAlongStep: e= " << preKinEnergy 272 << " de= " << eloss << " NIEL= " << nloss 273 << " dynQ= " << dp->GetCharge()/eplus << G4endl; 274 */ 275 fParticleChange->ProposeNonIonizingEnergyDeposit(nloss); 276 } 205 277 } 206 278 … … 268 340 269 341 vdp->push_back(delta); 342 } 343 344 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 345 346 G4double G4BraggModel::MaxSecondaryEnergy(const G4ParticleDefinition* pd, 347 G4double kinEnergy) 348 { 349 if(pd != particle) SetParticle(pd); 350 G4double tau = kinEnergy/mass; 351 G4double tmax = 2.0*electron_mass_c2*tau*(tau + 2.) / 352 (1. + 2.0*(tau + 1.)*ratio + ratio*ratio); 353 return tmax; 270 354 } 271 355
Note: See TracChangeset
for help on using the changeset viewer.