250{
252 static const G4double fm2MeV2 = 3*38938./1.09;
253 static G4bool CWinit =
true;
254 if(CWinit)
255 {
256 CWinit=false;
258 }
259
262#ifdef debug
263 G4cout<<
"G4QIonIonElastic::PostStepDoIt: Before the GetMeanFreePath is called In4M="
266#endif
270 if(std::fabs(Momentum-momentum)>.000001)
271 G4cerr<<
"-Warn-G4QIonIonElastic::PostStepDoIt:P(IU)="<<Momentum<<
"#"<<momentum<<
G4endl;
274#ifdef pdebug
275 G4cout<<
"G4QIonIonEl::PostStepDoIt: pP(IU)="<<Momentum<<
"="<<momentum<<
",pM="<<pM<<
G4endl;
276#endif
278 {
279 G4cerr<<
"G4QIonIonElastic::PostStepDoIt: Only NA elastic is implemented."<<
G4endl;
280 return 0;
281 }
285#ifdef debug
286 G4cout<<
"G4QIonIonElastic::PostStepDoIt: "<<nE<<
" elements in the material."<<
G4endl;
287#endif
288
295 else if (particle ==
G4He3::He3() ) projPDG= 1000020030;
297 {
299#ifdef debug
300 G4int prPDG=1000000000+10000*pZ+10*pA;
301 G4cout<<
"G4QIonIonElastic::PostStepDoIt: PDG="<<prPDG<<
"="<<projPDG<<
G4endl;
302#endif
303 }
304 else G4cout<<
"-Warning-G4QIonIonElastic::PostStepDoIt:Unknown projectile Ion"<<
G4endl;
305#ifdef debug
307 G4cout<<
"G4QIonIonElastic::PostStepDoIt: projPDG="<<projPDG<<
", stPDG="<<prPDG<<
G4endl;
308#endif
309 if(!projPDG)
310 {
311 G4cerr<<
"-Warning-G4QIonIonElastic::PostStepDoIt:Undefined interactingNucleus"<<
G4endl;
312 return 0;
313 }
315 G4int EPIM=ElProbInMat.size();
316#ifdef debug
317 G4cout<<
"G4QIonIonElastic::PSDI:m="<<EPIM<<
",n="<<nE<<
",T="<<ElProbInMat[EPIM-1]<<
G4endl;
318#endif
320 if(EPIM>1)
321 {
323 for(i=0; i<nE; ++i)
324 {
325#ifdef debug
326 G4cout<<
"G4QIonIonElastic::PSDI: EPM["<<i<<
"]="<<ElProbInMat[i]<<
", r="<<rnd<<
G4endl;
327#endif
328 if (rnd<ElProbInMat[i]) break;
329 }
330 if(i>=nE) i=nE-1;
331 }
332 G4Element* pElement=(*theElementVector)[i];
334#ifdef debug
335 G4cout<<
"G4QIonIonElastic::PostStepDoIt: i="<<i<<
", Z(element)="<<tZ<<
G4endl;
336#endif
337 if(tZ<=0)
338 {
339 G4cerr<<
"---Warning---G4QIonIonElastic::PostStepDoIt: Element with Z="<<tZ<<
G4endl;
340 if(tZ<0) return 0;
341 }
342 std::vector<G4double>* SPI = IsoProbInEl[i];
343 std::vector<G4int>* IsN = ElIsoN[i];
344 G4int nofIsot=SPI->size();
345#ifdef debug
346 G4cout<<
"G4QIonIonElastic::PosStDoIt: nI="<<nofIsot<<
",T="<<(*SPI)[nofIsot-1]<<
G4endl;
347#endif
349 if(nofIsot>1)
350 {
352 for(j=0; j<nofIsot; ++j)
353 {
354#ifdef debug
355 G4cout<<
"G4QIonIonElastic::PostStDI: SP["<<j<<
"]="<<(*SPI)[j]<<
", r="<<rndI<<
G4endl;
356#endif
357 if(rndI < (*SPI)[j]) break;
358 }
359 if(j>=nofIsot) j=nofIsot-1;
360 }
361 G4int tN =(*IsN)[j]; ;
362#ifdef debug
363 G4cout<<
"G4QIonIonElastic::PostStepDoIt:j="<<i<<
",N(isotope)="<<tN<<
",MeV="<<MeV<<
G4endl;
364#endif
365 if(tN<0)
366 {
367 G4cerr<<
"-Warning-G4QIonIonElastic::PostStepDoIt:IsotopeZ="<<tZ<<
" & 0>N="<<tN<<
G4endl;
368 return 0;
369 }
370 nOfNeutrons=tN;
371#ifdef debug
372 G4cout<<
"G4QIonIonElastic::PostStepDoIt: N="<<tN<<
" for element with Z="<<tZ<<
G4endl;
373#endif
375#ifdef debug
376 G4cout<<
"G4QIonIonElastic::PostStepDoIt: track is initialized"<<
G4endl;
377#endif
378 G4double weight = track.GetWeight();
379 G4double localtime = track.GetGlobalTime();
381#ifdef debug
382 G4cout<<
"G4QIonIonElastic::PostStepDoIt: before Touchable extraction"<<
G4endl;
383#endif
385#ifdef debug
386 G4cout<<
"G4QIonIonElastic::PostStepDoIt: Touchable is extracted"<<
G4endl;
387#endif
388
391
395 G4int targPDG=90000000+tZ*1000+tN;
399 if(tZ==1 && !tN)
400 {
403#ifdef debug
404 G4cout<<
"G4QIonIonElastic::PostStepDoIt: After the GetMeanFreePath is called"<<
G4endl;
405#endif
406 revkin=true;
407 tZ=pZ;
408 tN=pN;
409 tA=tZ+tN;
410 tM=pM;
411 pZ=1;
412 pN=0;
413 pA=1;
414 pM=mProt;
415 bvel=proj4M.
vect()/proj4M.
e();
416 proj4M=targ4M.
boost(-bvel);
418 Momentum = proj4M.
rho();
419 }
421#ifdef debug
422 G4cout<<
"G4QIonIonElastic::PostStDI: tM="<<tM<<
", p4M="<<proj4M<<
", t4M="<<tot4M<<
G4endl;
423#endif
424 EnMomConservation=tot4M;
428
429#ifdef debug
430 G4cout<<
"G4QIIEl::PSDI:f, P="<<Momentum<<
",Z="<<tZ<<
",N="<<tN<<
",tPDG="<<projPDG<<
G4endl;
431#endif
432
434 if(revkin) xSec=PELmanager->
GetCrossSection(
false, Momentum, tZ, tN, 2212);
435 else xSec=CSmanager->
GetCrossSection(
false, Momentum, tZ, tN, projPDG);
436#ifdef debug
437 G4cout<<
"G4QIIEl::PSDI: pPDG="<<projPDG<<
",P="<<Momentum<<
",CS="<<xSec/millibarn<<
G4endl;
438#endif
439#ifdef nandebug
440 if(xSec>0. || xSec<0. || xSec==0);
441 else G4cout<<
"-NaN-Warning-G4QIonIonElastic::PostStDoIt: xSec="<<xSec/millibarn<<
G4endl;
442#endif
443
444 if(xSec <= 0.)
445 {
446#ifdef pdebug
447 G4cerr<<
"-Warning-G4QIonIonElastic::PostStDoIt: *Zero cross-section* PDG="<<projPDG
448 <<
",tPDG="<<targPDG<<
",P="<<Momentum<<
G4endl;
449#endif
450
455 }
459 if(revkin)
460 {
463 }
464 else
465 {
468 maxt=dtM*PA2/(std::sqrt(PA2+pM2)+tM/2+pM2/dtM);
469#ifdef pdebug
470 G4cout<<
"G4QIonIonElastic::PostStDoIt:pPDG="<<projPDG<<
",tPDG="<<targPDG<<
",P="
471 <<Momentum<<
",CS="<<xSec<<
",maxt="<<maxt<<
G4endl;
472#endif
477 G4double mB =((pZ*tZ+pN*tN)*B1+(pZ*tN+pN*tZ)*B2)/(pA+tA);
478 G4double pR2=std::pow(pA+4.,.305)/fm2MeV2;
479 G4double tR2=std::pow(tA+4.,.305)/fm2MeV2;
481 mint=-std::log(1.-
G4UniformRand()*(1.-std::exp(-eB*maxt)))/eB;
482 mint+=mint;
483#ifdef pdebug
484 G4cout<<
"G4QIonIonElastic::PostStDoIt:B1="<<B1<<
",B2="<<B2<<
",mB="<<mB
485 <<
",pR2="<<pR2<<
",tR2="<<tR2<<
",eB="<<eB<<
",mint="<<mint<<
G4endl;
486#endif
487 }
488#ifdef nandebug
489 if(mint>-.0000001);
490 else G4cout<<
"-Warning-G4QIonIonElastic::PostStDoIt:-t="<<mint<<
G4endl;
491#endif
493
494#ifdef ppdebug
495 G4cout<<
"G4QIonIonElastic::PoStDoI:t="<<mint<<
",dpcm2="<<CSmanager->
GetHMaxT()<<
",Ek="
496 <<kinEnergy<<
",tM="<<tM<<
",pM="<<pM<<
",cost="<<cost<<
G4endl;
497#endif
498 if(cost>1. || cost<-1. || !(cost>-1. || cost<1.))
499 {
500 if(cost>1.000001 || cost<-1.000001 || !(cost>-1. || cost<1.))
501 {
505 G4double twop2cm=(tM2+tM2)*(pEn*pEn-pM2)/sM;
506 G4cout<<
"-Warning-G4QIonIonElastic::PoStDI:cos="<<cost<<
",t="<<mint<<
",T="<<kinEnergy
507 <<
",tM="<<tM<<
",tmax="<<2*kinEnergy*tM<<
",p="<<projPDG<<
",t="<<targPDG<<
G4endl;
509 }
510 if (cost>1.) cost=1.;
511 else if(cost<-1.) cost=-1.;
512 }
516 if(!
G4QHadron(tot4M).RelDecayIn2(scat4M, reco4M, dir4M, cost, cost))
517 {
518 G4cout<<
"-Warning-G4QIonIonE::PSDI:t4M="<<tot4M<<
",pM="<<pM<<
",tM="<<tM<<
",cost="
520 }
521 if(revkin)
522 {
524 scat4M=reco4M.
boost(bvel);
525 reco4M=tmpLV;
526 pM=tM;
527 tM=mProt;
528 }
529#ifdef debug
530 G4cout<<
"G4QIonIonElast::PSDI:s4M="<<scat4M<<
"+r4M="<<reco4M<<
"="<<scat4M+reco4M<<
G4endl;
531 G4cout<<
"G4QIonIonElastic::PSDI:scatE="<<scat4M.e()-pM<<
",recoE="<<reco4M.e()-tM<<
",d4M="
532 <<tot4M-scat4M-reco4M<<
G4endl;
533#endif
534
537 else
538 {
539 if(finE<-1.e-8 || !(finE>-1.||finE<1.))
540 G4cerr<<
"*Warning*G4QIonIonElastic::PostStDoIt: Zero or negative scattered E="<<finE
541 <<
", s4M="<<scat4M<<
", r4M="<<reco4M<<
", d4M="<<tot4M-scat4M-reco4M<<
G4endl;
544 }
547 EnMomConservation-=scat4M;
548
550#ifdef pdebug
551 G4cout<<
"G4QIonIonElastic::PostStepDoIt: Ion tZ="<<tZ<<
", tA="<<tA<<
G4endl;
552#endif
556 if(!theDefinition)
G4cout<<
"-Warning-G4QIonIonElastic::PoStDI:drop PDG="<<targPDG<<
G4endl;
557#ifdef pdebug
559#endif
561 EnMomConservation-=reco4M;
562#ifdef tdebug
563 G4cout<<
"G4QIonIonElastic::PSD:"<<targPDG<<reco4M<<reco4M.m()<<EnMomConservation<<
G4endl;
564#endif
566#ifdef debug
570 G4cout<<
"G4QIonIonElastic::PSDI: p="<<curD<<curD.
mag()<<
",e="<<curE<<
",m="<<curM<<
G4endl;
571#endif
572
577#ifdef debug
578 G4cout<<
"G4QIonIonElastic::PostStepDoIt: **** PostStepDoIt is done ****"<<
G4endl;
579#endif
581}
CLHEP::HepLorentzVector G4LorentzVector
HepLorentzVector & boost(double, double, double)
const G4ThreeVector & GetMomentumDirection() const
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
G4LorentzVector Get4Momentum() const
void Set4Momentum(const G4LorentzVector &momentum)
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
void AddSecondary(G4Track *aSecondary)
void ProposeEnergy(G4double finalEnergy)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
virtual void Initialize(const G4Track &)
const G4String & GetParticleType() const
const G4String & GetParticleName() const
const G4String & GetParticleSubType() const
G4ParticleDefinition * FindIon(G4int atomicNumber, G4int atomicMass, G4double excitationEnergy)
static G4ParticleTable * GetParticleTable()
static G4Proton * Proton()
static G4QCHIPSWorld * Get()
G4QParticleVector * GetParticles(G4int nOfParts=0)
G4double GetMeanFreePath(const G4Track &aTrack, G4double previousStepSize, G4ForceCondition *condition)
static G4VQCrossSection * GetPointer()
void SetWeight(G4double aValue)
void SetTouchableHandle(const G4TouchableHandle &apValue)
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
void ProposeTrackStatus(G4TrackStatus status)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
G4ParticleChange aParticleChange
virtual G4double GetSlope(G4int tZ, G4int tN, G4int pPDG)
virtual G4double GetExchangeT(G4int tZ, G4int tN, G4int pPDG)
virtual G4double GetHMaxT()