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: G4eCoulombScatteringModel.cc,v 1.40 2008/01/07 08:32:01 vnivanch Exp $ >> 27 // GEANT4 tag $Name: geant4-09-01-patch-03 $ 26 // 28 // 27 // ------------------------------------------- 29 // ------------------------------------------------------------------- 28 // 30 // 29 // GEANT4 Class file 31 // GEANT4 Class file 30 // 32 // 31 // 33 // 32 // File name: G4eCoulombScatteringModel 34 // File name: G4eCoulombScatteringModel 33 // 35 // 34 // Author: Vladimir Ivanchenko 36 // Author: Vladimir Ivanchenko 35 // 37 // 36 // Creation date: 22.08.2005 38 // Creation date: 22.08.2005 37 // 39 // 38 // Modifications: V.Ivanchenko << 40 // Modifications: 39 // << 41 // 01.08.06 V.Ivanchenko extend upper limit of table to TeV and review the 40 // << 42 // logic of building - only elements from G4ElementTable >> 43 // 08.08.06 V.Ivanchenko build internal table in ekin scale, introduce faclim >> 44 // 19.08.06 V.Ivanchenko add inline function ScreeningParameter >> 45 // 09.10.07 V.Ivanchenko reorganized methods, add cut dependence in scattering off e- 41 // 46 // 42 // Class Description: 47 // Class Description: 43 // 48 // 44 // ------------------------------------------- 49 // ------------------------------------------------------------------- 45 // 50 // 46 //....oooOO0OOooo........oooOO0OOooo........oo 51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 47 //....oooOO0OOooo........oooOO0OOooo........oo 52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 48 53 49 #include "G4eCoulombScatteringModel.hh" 54 #include "G4eCoulombScatteringModel.hh" 50 #include "G4PhysicalConstants.hh" << 51 #include "G4SystemOfUnits.hh" << 52 #include "Randomize.hh" 55 #include "Randomize.hh" 53 #include "G4DataVector.hh" 56 #include "G4DataVector.hh" 54 #include "G4ElementTable.hh" 57 #include "G4ElementTable.hh" >> 58 #include "G4PhysicsLogVector.hh" 55 #include "G4ParticleChangeForGamma.hh" 59 #include "G4ParticleChangeForGamma.hh" >> 60 #include "G4Electron.hh" >> 61 #include "G4Positron.hh" 56 #include "G4Proton.hh" 62 #include "G4Proton.hh" 57 #include "G4ParticleTable.hh" << 58 #include "G4IonTable.hh" << 59 #include "G4ProductionCutsTable.hh" << 60 #include "G4NucleiProperties.hh" << 61 #include "G4Pow.hh" << 62 #include "G4NistManager.hh" << 63 63 64 //....oooOO0OOooo........oooOO0OOooo........oo 64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 65 65 66 using namespace std; 66 using namespace std; 67 67 68 G4eCoulombScatteringModel::G4eCoulombScatterin << 68 G4eCoulombScatteringModel::G4eCoulombScatteringModel( 69 : G4VEmModel("eCoulombScattering"), isCombin << 69 G4double thetaMin, G4double thetaMax, G4bool build, >> 70 G4double tlim, const G4String& nam) >> 71 : G4VEmModel(nam), >> 72 cosThetaMin(cos(thetaMin)), >> 73 cosThetaMax(cos(thetaMax)), >> 74 q2Limit(tlim), >> 75 theCrossSectionTable(0), >> 76 lowKEnergy(keV), >> 77 highKEnergy(TeV), >> 78 alpha2(fine_structure_const*fine_structure_const), >> 79 faclim(100.0), >> 80 nbins(12), >> 81 nmax(100), >> 82 buildTable(build), >> 83 isInitialised(false) 70 { 84 { 71 fNistManager = G4NistManager::Instance(); 85 fNistManager = G4NistManager::Instance(); 72 theIonTable = G4ParticleTable::GetParticleT << 86 theElectron = G4Electron::Electron(); 73 theProton = G4Proton::Proton(); << 87 thePositron = G4Positron::Positron(); 74 << 88 theProton = G4Proton::Proton(); 75 wokvi = new G4WentzelOKandVIxSection(isCombi << 89 a0 = alpha2*electron_mass_c2*electron_mass_c2/(0.885*0.885); 76 << 90 G4double p0 = electron_mass_c2*classic_electr_radius; 77 mass = CLHEP::proton_mass_c2; << 91 coeff = twopi*p0*p0; >> 92 constn = 6.937e-6/(MeV*MeV); >> 93 tkin = targetZ = targetA = mom2 = DBL_MIN; >> 94 elecXSection = nucXSection = 0.0; >> 95 ecut = DBL_MAX; >> 96 particle = 0; >> 97 for(size_t j=0; j<100; j++) {index[j] = -1;} 78 } 98 } 79 99 80 //....oooOO0OOooo........oooOO0OOooo........oo 100 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 81 101 82 G4eCoulombScatteringModel::~G4eCoulombScatteri 102 G4eCoulombScatteringModel::~G4eCoulombScatteringModel() 83 { 103 { 84 delete wokvi; << 104 if(theCrossSectionTable) { >> 105 theCrossSectionTable->clearAndDestroy(); >> 106 delete theCrossSectionTable; >> 107 } 85 } 108 } 86 109 87 //....oooOO0OOooo........oooOO0OOooo........oo 110 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 88 111 89 void G4eCoulombScatteringModel::Initialise(con << 112 void G4eCoulombScatteringModel::Initialise(const G4ParticleDefinition* p, 90 const G4DataVector& cuts) << 113 const G4DataVector&) 91 { 114 { 92 SetupParticle(part); << 115 // G4cout << "!!! G4eCoulombScatteringModel::Initialise for " 93 currentCouple = nullptr; << 116 // << p->GetParticleName() << " cos(TetMin)= " << cosThetaMin 94 << 117 // << " cos(TetMax)= " << cosThetaMax <<G4endl; 95 G4double tet = PolarAngleLimit(); << 118 if(!isInitialised) { 96 << 119 isInitialised = true; 97 // defined theta limit between single and mu << 120 98 if(isCombined) { << 121 if(pParticleChange) 99 if(tet >= CLHEP::pi) { cosThetaMin = -1.0; << 122 fParticleChange = 100 else if(tet > 0.0) { cosThetaMin = std::co << 123 reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange); 101 << 124 else 102 // single scattering without multiple << 125 fParticleChange = new G4ParticleChangeForGamma(); 103 } else if(tet > 0.0) { << 126 } else { 104 cosThetaMin = std::cos(std::min(tet, CLHEP << 127 return; 105 } 128 } 106 129 107 wokvi->Initialise(part, cosThetaMin); << 130 if(p->GetParticleType() == "nucleus") buildTable = false; 108 pCuts = &cuts; << 131 if(!buildTable) return; 109 /* << 132 110 G4cout << "G4eCoulombScatteringModel::Initia << 133 // Compute log cross section table per atom 111 << part->GetParticleName() << " 1-cos(Tet << 134 if(!theCrossSectionTable) theCrossSectionTable = new G4PhysicsTable(); 112 << " 1-cos(TetMax)= " << 1. - cosThetaMax << 135 113 G4cout << "cut[0]= " << (*pCuts)[0] << G4end << 136 nbins = 2*G4int(log10(highKEnergy/lowKEnergy)); 114 */ << 115 if(nullptr == fParticleChange) { << 116 fParticleChange = GetParticleChangeForGamm << 117 } << 118 if(IsMaster() && mass < GeV && part->GetPart << 119 InitialiseElementSelectors(part, cuts); << 120 } << 121 } 137 } 122 138 123 //....oooOO0OOooo........oooOO0OOooo........oo 139 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 124 140 125 void G4eCoulombScatteringModel::InitialiseLoca << 141 G4double G4eCoulombScatteringModel::ComputeCrossSectionPerAtom( 126 G4VEmModel* masterModel) << 142 const G4ParticleDefinition* p, >> 143 G4double kinEnergy, >> 144 G4double Z, G4double A, >> 145 G4double cutEnergy, G4double) 127 { 146 { 128 SetElementSelectors(masterModel->GetElementS << 147 if(p == particle && kinEnergy == tkin && Z == targetZ && >> 148 A == targetA && cutEnergy == ecut) return nucXSection; >> 149 >> 150 //G4cout << "### G4eCoulombScatteringModel::ComputeCrossSectionPerAtom for " >> 151 // << p->GetParticleName() << " Z= " << Z << " A= " << A >> 152 // << " e= " << kinEnergy << G4endl; >> 153 >> 154 nucXSection = ComputeElectronXSectionPerAtom(p,kinEnergy,Z,A,cutEnergy); >> 155 >> 156 // nuclear cross section >> 157 if(theCrossSectionTable) { >> 158 G4bool b; >> 159 G4int iz = G4int(Z); >> 160 G4int idx = index[iz]; >> 161 >> 162 // compute table for given Z >> 163 if(-1 == idx) { >> 164 idx = theCrossSectionTable->size(); >> 165 index[iz] = idx; >> 166 G4PhysicsLogVector* ptrVector >> 167 = new G4PhysicsLogVector(lowKEnergy, highKEnergy, nbins); >> 168 // G4cout << "New vector Z= " << iz << " A= " << A << " idx= " << idx << G4endl; >> 169 G4double e, value; >> 170 for(G4int i=0; i<=nbins; i++) { >> 171 e = ptrVector->GetLowEdgeEnergy( i ) ; >> 172 value = CalculateCrossSectionPerAtom(p, e, Z, A); >> 173 ptrVector->PutValue( i, log(value) ); >> 174 } >> 175 theCrossSectionTable->push_back(ptrVector); >> 176 } >> 177 >> 178 // take value from the table >> 179 nucXSection += >> 180 std::exp((((*theCrossSectionTable)[idx]))->GetValue(kinEnergy, b)); >> 181 >> 182 // compute value from scratch >> 183 } else nucXSection += CalculateCrossSectionPerAtom(p, kinEnergy, Z, A); >> 184 >> 185 // G4cout << " cross(bn)= " << nucXSection/barn << G4endl; >> 186 >> 187 if(nucXSection < 0.0) nucXSection = 0.0; >> 188 return nucXSection; 129 } 189 } 130 190 131 //....oooOO0OOooo........oooOO0OOooo........oo << 191 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 132 192 133 G4double << 193 G4double G4eCoulombScatteringModel::ComputeElectronXSectionPerAtom( 134 G4eCoulombScatteringModel::MinPrimaryEnergy(co << 194 const G4ParticleDefinition* p, 135 const G4ParticleDefinition* part << 195 G4double kinEnergy, 136 G4double) << 196 G4double Z, >> 197 G4double A, >> 198 G4double cutEnergy) 137 { 199 { 138 SetupParticle(part); << 200 if(p == particle && kinEnergy == tkin && Z == targetZ && >> 201 cutEnergy == ecut) return elecXSection; >> 202 ecut = cutEnergy; >> 203 elecXSection = 0.0; >> 204 SetupParticle(p); >> 205 G4double ekin = std::max(keV, kinEnergy); >> 206 //G4double ekin = kinEnergy; >> 207 SetupTarget(Z, A, ekin); >> 208 >> 209 G4double tmax = tkin; >> 210 if(p == theElectron) tmax *= 0.5; >> 211 else if(p != thePositron) { >> 212 G4double ratio = electron_mass_c2/mass; >> 213 G4double tau = tkin/mass; >> 214 tmax = 2.0*electron_mass_c2*tau*(tau + 2.)/ >> 215 (1.0 + 2.0*ratio*(tau + 1.0) + ratio*ratio); >> 216 } 139 217 140 // define cut using cuts for proton << 218 cosTetMaxElec = cosTetMaxNuc; 141 G4double cut = << 219 G4double t = std::min(cutEnergy, tmax); 142 std::max(recoilThreshold, (*pCuts)[Current << 220 G4double mom21 = t*(t + 2.0*electron_mass_c2); 143 << 221 G4double t1 = tkin - t; 144 // find out lightest element << 222 if(t1 > 0.0) { 145 const G4ElementVector* theElementVector = ma << 223 G4double mom22 = t1*(t1 + 2.0*mass); 146 std::size_t nelm = material->GetNumberOfElem << 224 G4double ctm = (mom2 + mom22 - mom21)*0.5/sqrt(mom2*mom22); 147 << 225 if(ctm > cosTetMaxElec && ctm <= 1.0) cosTetMaxElec = ctm; 148 // select lightest element << 149 G4int Z = 300; << 150 for (std::size_t j=0; j<nelm; ++j) { << 151 Z = std::min(Z,(*theElementVector)[j]->Get << 152 } 226 } 153 G4int A = G4lrint(fNistManager->GetAtomicMas << 154 G4double targetMass = G4NucleiProperties::Ge << 155 G4double t = std::max(cut, 0.5*(cut + sqrt(2 << 156 227 157 return t; << 228 if(cosTetMaxElec < cosThetaMin) { >> 229 G4double x1 = 1.0 - cosThetaMin + screenZ; >> 230 G4double x2 = 1.0 - cosTetMaxElec + screenZ; >> 231 elecXSection = coeff*Z*chargeSquare*invbeta2* >> 232 (cosThetaMin - cosTetMaxElec)/(x1*x2*mom2); >> 233 } >> 234 // G4cout << "cut= " << ecut << " e= " << tkin >> 235 // << " croosE(barn)= " << elecXSection/barn >> 236 // << " cosEl= " << cosTetMaxElec << " costmin= " << cosThetaMin << G4endl; >> 237 return elecXSection; 158 } 238 } 159 239 160 //....oooOO0OOooo........oooOO0OOooo........oo << 240 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 161 241 162 G4double G4eCoulombScatteringModel::ComputeCro << 242 G4double G4eCoulombScatteringModel::CalculateCrossSectionPerAtom( 163 const G4ParticleDefinition* p, << 243 const G4ParticleDefinition* p, 164 G4double kinEnergy, << 244 G4double kinEnergy, 165 G4double Z, G4double, << 245 G4double Z, G4double A) 166 G4double cutEnergy, G4double) << 167 { 246 { 168 /* << 169 G4cout << "### G4eCoulombScatteringModel::Co << 170 << p->GetParticleName()<<" Z= "<<Z<<" e(MeV << 171 << G4endl; << 172 */ << 173 G4double cross = 0.0; 247 G4double cross = 0.0; 174 elecRatio = 0.0; << 248 SetupParticle(p); 175 if(p != particle) { SetupParticle(p); } << 249 G4double ekin = std::max(keV, kinEnergy); 176 << 250 //G4double ekin = kinEnergy; 177 // cross section is set to zero to avoid pro << 251 SetupTarget(Z, A, ekin); 178 if(kinEnergy <= 0.0) { return cross; } << 252 179 DefineMaterial(CurrentCouple()); << 253 if(cosTetMaxNuc < cosThetaMin) { 180 G4double costmin = wokvi->SetupKinematic(kin << 254 G4double x1 = 1.0 - cosThetaMin; 181 << 255 G4double x2 = 1.0 - cosTetMaxNuc; 182 //G4cout << "cosThetaMax= "<<cosThetaMax<<" << 256 G4double x3 = cosThetaMin - cosTetMaxNuc; 183 << 257 G4double z1 = x1 + screenZ; 184 if(cosThetaMax < costmin) { << 258 G4double z2 = x2 + screenZ; 185 G4int iz = G4lrint(Z); << 259 G4double d = 1.0/formfactA - screenZ; 186 G4double cut = (0.0 < fixedCut) ? fixedCut << 260 G4double d1 = 1.0 - formfactA*screenZ; 187 costmin = wokvi->SetupTarget(iz, cut); << 261 G4double zn1= x1 + d; 188 //G4cout << "SetupTarget: Z= " << iz << " << 262 G4double zn2= x2 + d; 189 // << costmin << G4endl; << 263 cross = coeff*Z*Z*chargeSquare*invbeta2 190 G4double costmax = (1 == iz && particle == << 264 *(x3/(z1*z2) + x3/(zn1*zn2) + 191 ? 0.0 : cosThetaMax; << 265 2.0*std::log(z1*zn2/(z2*zn1))/d) / (mom2*d1*d1); 192 if(costmin > costmax) { << 193 cross = wokvi->ComputeNuclearCrossSectio << 194 + wokvi->ComputeElectronCrossSection(c << 195 } << 196 /* << 197 if(p->GetParticleName() == "e-") << 198 G4cout << "Z= " << Z << " e(MeV)= " << kin << 199 << " cross(b)= " << cross/barn << " 1-cos << 200 << " 1-costmax= " << 1-costmax << 201 << " 1-cosThetaMax= " << 1-cosThetaMax << 202 << " " << currentMaterial->GetName() << 203 << G4endl; << 204 */ << 205 } 266 } 206 //G4cout << "====== cross= " << cross << G4e << 267 207 return cross; << 268 // G4cout << "CalculateCrossSectionPerAtom: e(MeV)= " << tkin >> 269 // << " cross(b)= " << cross/barn << " ctmin= " << cosThetaMin >> 270 // << " ctmax= " << cosTetMaxNuc << G4endl; >> 271 >> 272 return cross; 208 } 273 } 209 274 210 //....oooOO0OOooo........oooOO0OOooo........oo 275 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 211 276 212 void G4eCoulombScatteringModel::SampleSecondar 277 void G4eCoulombScatteringModel::SampleSecondaries( 213 std::vector<G4DynamicParticle* << 278 std::vector<G4DynamicParticle*>*, 214 const G4MaterialCutsCouple* couple, 279 const G4MaterialCutsCouple* couple, 215 const G4DynamicParticle* dp, 280 const G4DynamicParticle* dp, 216 G4double cutEnergy, 281 G4double cutEnergy, 217 G4double) << 282 G4double maxEnergy) 218 { 283 { >> 284 const G4Material* aMaterial = couple->GetMaterial(); >> 285 const G4ParticleDefinition* p = dp->GetDefinition(); 219 G4double kinEnergy = dp->GetKineticEnergy(); 286 G4double kinEnergy = dp->GetKineticEnergy(); 220 SetupParticle(dp->GetDefinition()); << 287 221 DefineMaterial(couple); << 288 // Select atom and setup >> 289 SetupParticle(p); >> 290 const G4Element* elm = >> 291 SelectRandomAtom(aMaterial,p,kinEnergy,cutEnergy,maxEnergy); >> 292 G4double Z = elm->GetZ(); >> 293 G4double A = elm->GetN(); >> 294 >> 295 G4double cross = >> 296 ComputeCrossSectionPerAtom(p,kinEnergy,Z,A,cutEnergy,maxEnergy); >> 297 >> 298 G4double costm = cosTetMaxNuc; >> 299 G4double formf = formfactA; >> 300 if(G4UniformRand()*cross < elecXSection) { >> 301 costm = cosTetMaxElec; >> 302 formf = 0.0; >> 303 } 222 /* 304 /* 223 G4cout << "G4eCoulombScatteringModel::Sample << 305 G4cout << "G4eCoul...SampleSecondaries: e(MeV)= " << tkin 224 << kinEnergy << " " << particle->GetPart << 306 << " ctmin= " << cosThetaMin 225 << " cut= " << cutEnergy<< G4endl; << 307 << " ctmaxN= " << cosTetMaxNuc >> 308 << " ctmax= " << costm >> 309 << " Z= " << Z << " A= " << A >> 310 << " cross= " << cross/barn << " crossE= " << elecXSection/barn >> 311 << G4endl; 226 */ 312 */ 227 // Choose nucleus << 313 if(costm >= cosThetaMin) return; 228 G4double cut = (0.0 < fixedCut) ? fixedCut : << 229 314 230 wokvi->SetupKinematic(kinEnergy, currentMate << 315 G4double x1 = 1. - cosThetaMin + screenZ; >> 316 G4double x2 = 1. - costm; >> 317 G4double x3 = cosThetaMin - costm; >> 318 G4double grej, z, z1; >> 319 do { >> 320 z = G4UniformRand()*x3; >> 321 z1 = (x1*x2 - screenZ*z)/(x1 + z); >> 322 if(z1 < 0.0) z1 = 0.0; >> 323 else if(z1 > 2.0) z1 = 2.0; >> 324 grej = 1.0/(1.0 + formf*z1); >> 325 } while ( G4UniformRand() > grej*grej ); >> 326 >> 327 G4double cost = 1.0 - z1; >> 328 G4double sint= sqrt(z1*(2.0 - z1)); >> 329 /* >> 330 if(sint > 0.1) >> 331 G4cout<<"## SampleSecondaries: e(MeV)= " << kinEnergy >> 332 << " sint= " << sint << " Z= " << Z << " screenZ= " << screenZ >> 333 << " cn= " << formf >> 334 << G4endl; >> 335 */ >> 336 G4double phi = twopi * G4UniformRand(); 231 337 232 const G4Element* currentElement = SelectTarg << 233 dp->Get << 234 G4int iz = currentElement->GetZasInt(); << 235 << 236 G4double costmin = wokvi->SetupTarget(iz, cu << 237 G4double costmax = (1 == iz && particle == t << 238 ? 0.0 : cosThetaMax; << 239 if(costmin <= costmax) { return; } << 240 << 241 G4double cross = wokvi->ComputeNuclearCrossS << 242 G4double ecross = wokvi->ComputeElectronCros << 243 G4double ratio = ecross/(cross + ecross); << 244 << 245 G4int ia = SelectIsotopeNumber(currentElemen << 246 G4double targetMass = G4NucleiProperties::Ge << 247 wokvi->SetTargetMass(targetMass); << 248 << 249 G4ThreeVector newDirection = << 250 wokvi->SampleSingleScattering(costmin, cos << 251 G4double cost = newDirection.z(); << 252 /* << 253 G4cout << "SampleSec: e(MeV)= " << kinEn << 254 << " 1-costmin= " << 1-costmin << 255 << " 1-costmax= " << 1-costmax << 256 << " 1-cost= " << 1-cost << 257 << " ratio= " << ratio << 258 << G4endl; << 259 */ << 260 G4ThreeVector direction = dp->GetMomentumDir 338 G4ThreeVector direction = dp->GetMomentumDirection(); >> 339 G4ThreeVector newDirection(cos(phi)*sint,sin(phi)*sint,cost); 261 newDirection.rotateUz(direction); 340 newDirection.rotateUz(direction); 262 341 263 fParticleChange->ProposeMomentumDirection(ne 342 fParticleChange->ProposeMomentumDirection(newDirection); 264 << 343 265 // recoil sampling assuming a small recoil << 344 return; 266 // and first order correction to primary 4-m << 267 G4double mom2 = wokvi->GetMomentumSquare(); << 268 G4double trec = mom2*(1.0 - cost) << 269 /(targetMass + (mass + kinEnergy)*(1.0 - c << 270 << 271 // the check likely not needed << 272 trec = std::min(trec, kinEnergy); << 273 G4double finalT = kinEnergy - trec; << 274 G4double edep = 0.0; << 275 /* << 276 G4cout<<"G4eCoulombScatteringModel: finalT << 277 <<trec << " Z= " << iz << " A= " << ia << 278 << " tcut(keV)= " << (*pCuts)[currentMater << 279 */ << 280 G4double tcut = recoilThreshold; << 281 if(pCuts) { tcut= std::max(tcut,(*pCuts)[cur << 282 << 283 if(trec > tcut) { << 284 G4ParticleDefinition* ion = theIonTable->G << 285 G4ThreeVector dir = (direction*sqrt(mom2) << 286 newDirection*sqrt(finalT*(2*mass + fina << 287 auto newdp = new G4DynamicParticle(ion, di << 288 fvect->push_back(newdp); << 289 } else { << 290 edep = trec; << 291 fParticleChange->ProposeNonIonizingEnergyD << 292 } << 293 << 294 // finelize primary energy and energy bala << 295 // this threshold may be applied only beca << 296 // e+e- msc model is applied << 297 if(finalT < 0.0) { << 298 edep += finalT; << 299 finalT = 0.0; << 300 } << 301 edep = std::max(edep, 0.0); << 302 fParticleChange->SetProposedKineticEnergy(fi << 303 fParticleChange->ProposeLocalEnergyDeposit(e << 304 } 345 } 305 346 306 //....oooOO0OOooo........oooOO0OOooo........oo 347 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 348 >> 349 307 350