146 G4double etotalToSetParticleProperties;
167 G4double lindhardAngleNumberHighLimit0;
172 G4double x1=0.,x2=0.,x3=0.,x4=0.,y1=0.,y2=0.,y3=0.,y4=0.;
174 G4double tx1=0.,tx2=0.,tx3=0.,tx4=0.,ty1=0.,ty2=0.,ty3=0.,ty4=0.;
176 G4double kvx1=0.,kvx2=0.,kvx3=0.,kvx4=0.,kvy1=0.,kvy2=0.,kvy3=0.,kvy4=0.;
188 fCrystalData->SetGeometryParameters(crystallogic);
195 fBaierKatkov->ResetRadIntegral();
205 lindhardAngleNumberHighLimit0 =
207 GetParticleDefinition()->GetParticleDefinitionID());
209 GetParticleDefinition()->GetParticleDefinitionID());
212 fCrystalData->SetParticleProperties(etotal, mass, charge, particleName);
219 xyz = fCrystalData->CoordinatesFromBoxToLattice(xyz0);
228 tx0 = std::atan(momentumDirection.
x()/momentumDirection.
z());
229 ty0 = std::atan(momentumDirection.
y()/momentumDirection.
z());
232 tx = fCrystalData->AngleXFromBoxToLattice(tx0,z);
235 etotalToSetParticleProperties = etotal*0.999;
241 tGlobalPreStep=tGlobal;
247 etotalPreStep = etotal;
249 dz = fCrystalData->GetSimulationStep(tx,ty);
259 kvx1=fCrystalData->Ex(x,y);
261 tx1=tx+(kvx1-fCrystalData->GetCurv(z)*fCrystalData->GetCorrectionZ())*dzd3;
262 if (fCrystalData->GetModel()==2)
264 kvy1=fCrystalData->Ey(x,y);
270 kvx2=fCrystalData->Ex(x1,y1);
272 tx2=tx-(kvx1-fCrystalData->GetCurv(z)*fCrystalData->GetCorrectionZ())*dzd3+
273 (kvx2-fCrystalData->GetCurv(z)*fCrystalData->GetCorrectionZ())*dz;
274 if (fCrystalData->GetModel()==2)
276 kvy2=fCrystalData->Ey(x1,y1);
278 ty2=ty-kvy1*dzd3+kvy2*dz;
282 kvx3=fCrystalData->Ex(x2,y2);
283 x3=x+(tx-tx1+tx2)*dz;
284 tx3=tx+(kvx1-kvx2+kvx3-fCrystalData->GetCurv(z)*fCrystalData->GetCorrectionZ())*dz;
285 if (fCrystalData->GetModel()==2)
287 kvy3=fCrystalData->Ey(x2,y2);
288 y3=y+(ty-ty1+ty2)*dz;
289 ty3=ty+(kvy1-kvy2+kvy3)*dz;
293 kvx4=fCrystalData->Ex(x3,y3);
294 x4=x+(tx+3.*tx1+3.*tx2+tx3)*dzd8;
295 tx4=tx+(kvx1+3.*kvx2+3.*kvx3+kvx4)*dzd8-
296 fCrystalData->GetCurv(z)*fCrystalData->GetCorrectionZ()*dz;
297 if (fCrystalData->GetModel()==2)
299 kvy4=fCrystalData->Ey(x3,y3);
300 y4=y+(ty+3.*ty1+3.*ty2+ty3)*dzd8;
301 ty4=ty+(kvy1+3.*kvy2+3.*kvy3+kvy4)*dzd8;
314 z+=dz*fCrystalData->GetCorrectionZ();
317 xyz = fCrystalData->ChannelChange(x,y,z);
325 xyz0=fCrystalData->CoordinatesFromLatticeToBox(xyz);
327 momentumDirectionStep=
328 dz*std::sqrt(1+std::pow(std::tan(tx),2)+std::pow(std::tan(ty),2));
329 tGlobal+=momentumDirectionStep/(fCrystalData->GetBeta())/CLHEP::c_light;
335 for (
G4int i = 0; i < fCrystalData->GetNelements(); i++)
338 effectiveStep = momentumDirectionStep*fCrystalData->NuclearDensity(x,y,i);
340 scatteringAnglesAndEnergyLoss += fCrystalData->
341 CoulombAtomicScattering(effectiveStep,momentumDirectionStep,i);
344 elossAccum += fCrystalData->IonizationLosses(momentumDirectionStep, i);
347 scatteringAnglesAndEnergyLoss += fCrystalData->CoulombElectronScattering(
348 fCrystalData->MinIonizationEnergy(x,y),
349 fCrystalData->ElectronDensity(x,y),
350 momentumDirectionStep);
351 tx += scatteringAnglesAndEnergyLoss.
x();
352 ty += scatteringAnglesAndEnergyLoss.
y();
353 elossAccum += scatteringAnglesAndEnergyLoss.
z();
357 if (etotalToSetParticleProperties>etotal)
359 fCrystalData->SetParticleProperties(etotal, mass, charge, particleName);
360 etotalToSetParticleProperties = etotal*0.999;
370 GetParticleDefinition()->
371 GetParticleDefinitionID()))
375 else if (fCrystalData->GetModel()==1)
379 std::max(lindhardAngleNumberHighLimit0*
380 fCrystalData->GetLindhardAngle(),
384 else if (fCrystalData->GetModel()==2)
387 if (std::sqrt(tx*tx+ty*ty) >=
388 std::max(lindhardAngleNumberHighLimit0*
389 fCrystalData->GetLindhardAngle(),
399 tx0 = fCrystalData->AngleXFromLatticeToBox(tx,z);
404 if(fBaierKatkov->DoRadiation(etotal,mass,
406 scatteringAnglesAndEnergyLoss.
x(),
407 scatteringAnglesAndEnergyLoss.
y(),
408 momentumDirectionStep,tGlobal,xyz0,
411 Inside(xyz0)!=
kInside&&inCrystal))
417 etotal = fBaierKatkov->GetParticleNewTotalEnergy();
418 tx0 = fBaierKatkov->GetParticleNewAngleX();
419 ty0 = fBaierKatkov->GetParticleNewAngleY();
420 tGlobal = fBaierKatkov->GetNewGlobalTime();
421 xyz0 = fBaierKatkov->GetParticleNewCoordinateXYZ();
424 fBaierKatkov->GeneratePhoton(fastStep);
427 fCrystalData->SetParticleProperties(etotal, mass, charge, particleName);
430 xyz = fCrystalData->CoordinatesFromBoxToLattice(xyz0);
436 tx = fCrystalData->AngleXFromBoxToLattice(tx0,z);
444 etotal -= elossAccum;
445 eDeposited += elossAccum;
447 ekinetic = etotal-mass;
450 G4cout <<
"Warning in G4ChannelingFastSimModel: " <<
451 ekinetic <<
"<" << 1*keV <<
" !" <<
G4endl;
452 eDeposited-=(1*keV-ekinetic);
454 G4cout <<
"Setting deposited energy=" <<
455 eDeposited <<
" & ekinetic=" << ekinetic <<
G4endl;
456 etotal = mass+ekinetic;
466 tGlobal = tGlobalPreStep;
470 etotal = etotalPreStep;
471 z-=dz*fCrystalData->GetCorrectionZ();
494 tx0 = fCrystalData->AngleXFromLatticeToBox(tx,z);
503 etotal -= elossAccum;
504 eDeposited += elossAccum;
505 ekinetic = etotal-mass;
508 G4cout <<
"Warning in G4ChannelingFastSimModel: " <<
509 ekinetic <<
"<" << 1*keV <<
" !" <<
G4endl;
510 eDeposited-=(1*keV-ekinetic);
512 G4cout <<
"Setting deposited energy=" <<
513 eDeposited <<
" & ekinetic=" << ekinetic <<
G4endl;
522 1./std::sqrt(1.+std::pow(std::tan(tx0),2)+std::pow(std::tan(ty0),2));
525 momentumDirectionZ*std::tan(ty0),
526 momentumDirectionZ));