53G4int G4QIonIonElastic::nPartCWorld=85;
54std::vector<G4int> G4QIonIonElastic::ElementZ;
55std::vector<G4double> G4QIonIonElastic::ElProbInMat;
56std::vector<std::vector<G4int>*> G4QIonIonElastic::ElIsoN;
57std::vector<std::vector<G4double>*>G4QIonIonElastic::IsoProbInEl;
66 G4cout<<
"G4QIonIonElastic::Constructor is called processName="<<processName<<
G4endl;
86 G4cout<<
"-Warning-G4QIonIonElastic::GetMeanFreePath: notImplementedParticle"<<
G4endl;
91 G4cout<<
"G4QIonIonElastic::GetMeanFreePath: kinE="<<KinEn<<
",Mom="<<Momentum<<
G4endl;
98 G4cout<<
"G4QIonIonElastic::GetMeanFreePath:"<<nE<<
" Elem's in theMaterial"<<
G4endl;
107 else if (incidentParticleDefinition ==
G4Alpha::Alpha() ) pPDG = 1000020040;
108 else if (incidentParticleDefinition ==
G4Triton::Triton() ) pPDG = 1000010030;
109 else if (incidentParticleDefinition ==
G4He3::He3() ) pPDG = 1000020030;
114 G4int prPDG=1000000000+10000*pZ+10*pA;
115 G4cout<<
"G4QIonIonElastic::GetMeanFreePath: PDG="<<prPDG<<
"="<<pPDG<<
G4endl;
118 else G4cout<<
"-Warning-G4QIonIonElastic::GetMeanFreePath:Unknown projectile Ion"<<
G4endl;
122 G4int IPIE=IsoProbInEl.size();
123 if(IPIE)
for(
G4int ip=0; ip<IPIE; ++ip)
125 std::vector<G4double>* SPI=IsoProbInEl[ip];
128 std::vector<G4int>* IsN=ElIsoN[ip];
136 for(
G4int i=0; i<nE; ++i)
138 G4Element* pElement=(*theElementVector)[i];
140 ElementZ.push_back(Z);
144 if(isoVector) isoSize=isoVector->size();
146 G4cout<<
"G4QIonIonElastic::GetMeanFreePath: isovectorLength="<<isoSize<<
G4endl;
156 std::vector<std::pair<G4int,G4double>*>* newAbund =
157 new std::vector<std::pair<G4int,G4double>*>;
159 for(
G4int j=0; j<isoSize; j++)
165 std::pair<G4int,G4double>* pr=
new std::pair<G4int,G4double>(N,abund);
167 G4cout<<
"G4QIonIonElastic::GetMeanFP:pair#="<<j<<
",N="<<N<<
",ab="<<abund<<
G4endl;
169 newAbund->push_back(pr);
172 G4cout<<
"G4QIonIonElastic::GetMeanFP: pairVectorLength="<<newAbund->size()<<
G4endl;
175 for(
G4int k=0; k<isoSize; k++)
delete (*newAbund)[k];
179 std::vector<std::pair<G4int,G4double>*>* cs= Isotopes->
GetCSVector(Z,indEl);
180 std::vector<G4double>* SPI =
new std::vector<G4double>;
181 IsoProbInEl.push_back(SPI);
182 std::vector<G4int>* IsN =
new std::vector<G4int>;
183 ElIsoN.push_back(IsN);
184 G4int nIs=cs->size();
186 G4cout<<
"G4QIonIonEl::GetMFP:=***=> #isot="<<nIs<<
", Z="<<Z<<
", indEl="<<indEl<<
G4endl;
189 if(nIs)
for(
G4int j=0; j<nIs; j++)
191 std::pair<G4int,G4double>* curIs=(*cs)[j];
192 G4int N=curIs->first;
195 G4cout<<
"G4QIIE::GMFP:true,P="<<Momentum<<
",Z="<<Z<<
",N="<<N<<
",pPDG="<<pPDG<<
G4endl;
199 G4cout<<
"G4QIonIonElastic::GMFP: GetCS #1 j="<<j<<
G4endl;
205 CSI=PCSmanager->
GetCrossSection(
true, Momentum*mProt/projM, Z, N, 2212);
209 G4cout<<
"G4QIonIonElastic::GMFP: jI="<<j<<
", Zt="<<Z<<
", Nt="<<N<<
", Mom="<<Momentum
210 <<
", XSec="<<CSI/millibarn<<
G4endl;
214 SPI->push_back(susi);
221 ElProbInMat.push_back(sigma);
225 G4cout<<
"G4QIonIonElastic::GetMeanFreePath: MeanFreePath="<<1./sigma<<
G4endl;
227 if(sigma > 0.00000000001)
return 1./sigma;
239 else if (particle == *(
G4He3::He3() ))
return true;
241 else if (Z > 0 && A > 0)
return true;
252 static const G4double fm2MeV2 = 3*38938./1.09;
253 static G4bool CWinit =
true;
263 G4cout<<
"G4QIonIonElastic::PostStepDoIt: Before the GetMeanFreePath is called In4M="
270 if(std::fabs(Momentum-momentum)>.000001)
271 G4cerr<<
"-Warn-G4QIonIonElastic::PostStepDoIt:P(IU)="<<Momentum<<
"#"<<momentum<<
G4endl;
275 G4cout<<
"G4QIonIonEl::PostStepDoIt: pP(IU)="<<Momentum<<
"="<<momentum<<
",pM="<<pM<<
G4endl;
279 G4cerr<<
"G4QIonIonElastic::PostStepDoIt: Only NA elastic is implemented."<<
G4endl;
286 G4cout<<
"G4QIonIonElastic::PostStepDoIt: "<<nE<<
" elements in the material."<<
G4endl;
295 else if (particle ==
G4He3::He3() ) projPDG= 1000020030;
300 G4int prPDG=1000000000+10000*pZ+10*pA;
301 G4cout<<
"G4QIonIonElastic::PostStepDoIt: PDG="<<prPDG<<
"="<<projPDG<<
G4endl;
304 else G4cout<<
"-Warning-G4QIonIonElastic::PostStepDoIt:Unknown projectile Ion"<<
G4endl;
307 G4cout<<
"G4QIonIonElastic::PostStepDoIt: projPDG="<<projPDG<<
", stPDG="<<prPDG<<
G4endl;
311 G4cerr<<
"-Warning-G4QIonIonElastic::PostStepDoIt:Undefined interactingNucleus"<<
G4endl;
315 G4int EPIM=ElProbInMat.size();
317 G4cout<<
"G4QIonIonElastic::PSDI:m="<<EPIM<<
",n="<<nE<<
",T="<<ElProbInMat[EPIM-1]<<
G4endl;
326 G4cout<<
"G4QIonIonElastic::PSDI: EPM["<<i<<
"]="<<ElProbInMat[i]<<
", r="<<rnd<<
G4endl;
328 if (rnd<ElProbInMat[i])
break;
332 G4Element* pElement=(*theElementVector)[i];
335 G4cout<<
"G4QIonIonElastic::PostStepDoIt: i="<<i<<
", Z(element)="<<tZ<<
G4endl;
339 G4cerr<<
"---Warning---G4QIonIonElastic::PostStepDoIt: Element with Z="<<tZ<<
G4endl;
342 std::vector<G4double>* SPI = IsoProbInEl[i];
343 std::vector<G4int>* IsN = ElIsoN[i];
344 G4int nofIsot=SPI->size();
346 G4cout<<
"G4QIonIonElastic::PosStDoIt: nI="<<nofIsot<<
",T="<<(*SPI)[nofIsot-1]<<
G4endl;
352 for(j=0; j<nofIsot; ++j)
355 G4cout<<
"G4QIonIonElastic::PostStDI: SP["<<j<<
"]="<<(*SPI)[j]<<
", r="<<rndI<<
G4endl;
357 if(rndI < (*SPI)[j])
break;
359 if(j>=nofIsot) j=nofIsot-1;
361 G4int tN =(*IsN)[j]; ;
363 G4cout<<
"G4QIonIonElastic::PostStepDoIt:j="<<i<<
",N(isotope)="<<tN<<
",MeV="<<MeV<<
G4endl;
367 G4cerr<<
"-Warning-G4QIonIonElastic::PostStepDoIt:IsotopeZ="<<tZ<<
" & 0>N="<<tN<<
G4endl;
372 G4cout<<
"G4QIonIonElastic::PostStepDoIt: N="<<tN<<
" for element with Z="<<tZ<<
G4endl;
376 G4cout<<
"G4QIonIonElastic::PostStepDoIt: track is initialized"<<
G4endl;
382 G4cout<<
"G4QIonIonElastic::PostStepDoIt: before Touchable extraction"<<
G4endl;
386 G4cout<<
"G4QIonIonElastic::PostStepDoIt: Touchable is extracted"<<
G4endl;
395 G4int targPDG=90000000+tZ*1000+tN;
404 G4cout<<
"G4QIonIonElastic::PostStepDoIt: After the GetMeanFreePath is called"<<
G4endl;
415 bvel=proj4M.
vect()/proj4M.
e();
416 proj4M=targ4M.
boost(-bvel);
418 Momentum = proj4M.
rho();
422 G4cout<<
"G4QIonIonElastic::PostStDI: tM="<<tM<<
", p4M="<<proj4M<<
", t4M="<<tot4M<<
G4endl;
424 EnMomConservation=tot4M;
430 G4cout<<
"G4QIIEl::PSDI:f, P="<<Momentum<<
",Z="<<tZ<<
",N="<<tN<<
",tPDG="<<projPDG<<
G4endl;
434 if(revkin) xSec=PELmanager->
GetCrossSection(
false, Momentum, tZ, tN, 2212);
435 else xSec=CSmanager->
GetCrossSection(
false, Momentum, tZ, tN, projPDG);
437 G4cout<<
"G4QIIEl::PSDI: pPDG="<<projPDG<<
",P="<<Momentum<<
",CS="<<xSec/millibarn<<
G4endl;
440 if(xSec>0. || xSec<0. || xSec==0);
441 else G4cout<<
"-NaN-Warning-G4QIonIonElastic::PostStDoIt: xSec="<<xSec/millibarn<<
G4endl;
447 G4cerr<<
"-Warning-G4QIonIonElastic::PostStDoIt: *Zero cross-section* PDG="<<projPDG
448 <<
",tPDG="<<targPDG<<
",P="<<Momentum<<
G4endl;
468 maxt=dtM*PA2/(std::sqrt(PA2+pM2)+tM/2+pM2/dtM);
470 G4cout<<
"G4QIonIonElastic::PostStDoIt:pPDG="<<projPDG<<
",tPDG="<<targPDG<<
",P="
471 <<Momentum<<
",CS="<<xSec<<
",maxt="<<maxt<<
G4endl;
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;
484 G4cout<<
"G4QIonIonElastic::PostStDoIt:B1="<<B1<<
",B2="<<B2<<
",mB="<<mB
485 <<
",pR2="<<pR2<<
",tR2="<<tR2<<
",eB="<<eB<<
",mint="<<mint<<
G4endl;
490 else G4cout<<
"-Warning-G4QIonIonElastic::PostStDoIt:-t="<<mint<<
G4endl;
495 G4cout<<
"G4QIonIonElastic::PoStDoI:t="<<mint<<
",dpcm2="<<CSmanager->
GetHMaxT()<<
",Ek="
496 <<kinEnergy<<
",tM="<<tM<<
",pM="<<pM<<
",cost="<<cost<<
G4endl;
498 if(cost>1. || cost<-1. || !(cost>-1. || cost<1.))
500 if(cost>1.000001 || cost<-1.000001 || !(cost>-1. || cost<1.))
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;
510 if (cost>1.) cost=1.;
511 else if(cost<-1.) cost=-1.;
516 if(!
G4QHadron(tot4M).RelDecayIn2(scat4M, reco4M, dir4M, cost, cost))
518 G4cout<<
"-Warning-G4QIonIonE::PSDI:t4M="<<tot4M<<
",pM="<<pM<<
",tM="<<tM<<
",cost="
524 scat4M=reco4M.
boost(bvel);
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;
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;
547 EnMomConservation-=scat4M;
551 G4cout<<
"G4QIonIonElastic::PostStepDoIt: Ion tZ="<<tZ<<
", tA="<<tA<<
G4endl;
556 if(!theDefinition)
G4cout<<
"-Warning-G4QIonIonElastic::PoStDI:drop PDG="<<targPDG<<
G4endl;
561 EnMomConservation-=reco4M;
563 G4cout<<
"G4QIonIonElastic::PSD:"<<targPDG<<reco4M<<reco4M.
m()<<EnMomConservation<<
G4endl;
570 G4cout<<
"G4QIonIonElastic::PSDI: p="<<curD<<curD.
mag()<<
",e="<<curE<<
",m="<<curM<<
G4endl;
578 G4cout<<
"G4QIonIonElastic::PostStepDoIt: **** PostStepDoIt is done ****"<<
G4endl;
std::vector< G4Element * > G4ElementVector
#define G4HadronicDeprecate(name)
std::vector< G4Isotope * > G4IsotopeVector
CLHEP::HepLorentzVector G4LorentzVector
G4DLLIMPORT std::ostream G4cerr
G4DLLIMPORT std::ostream G4cout
HepLorentzVector & boost(double, double, double)
static G4Deuteron * Deuteron()
const G4ThreeVector & GetMomentumDirection() const
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
G4ParticleDefinition * GetDefinition() const
G4LorentzVector Get4Momentum() const
G4double GetKineticEnergy() const
void Set4Momentum(const G4LorentzVector &momentum)
G4double GetTotalMomentum() const
G4double * GetRelativeAbundanceVector() const
const G4Isotope * GetIsotope(G4int iso) const
G4IsotopeVector * GetIsotopeVector() const
static G4GenericIon * GenericIon()
const G4ElementVector * GetElementVector() const
size_t GetNumberOfElements() const
const G4double * GetVecNbOfAtomsPerVolume() const
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
G4int GetPDGEncoding() const
G4double GetPDGCharge() const
G4int GetBaryonNumber() 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)
static G4VQCrossSection * GetPointer()
G4QIonIonElastic(const G4String &processName="CHIPS_IonIonElasticScattering")
G4bool IsApplicable(const G4ParticleDefinition &particle)
G4VParticleChange * PostStepDoIt(const G4Track &aTrack, const G4Step &aStep)
G4double GetMeanFreePath(const G4Track &aTrack, G4double previousStepSize, G4ForceCondition *condition)
std::vector< std::pair< G4int, G4double > * > * GetCSVector(G4int Z, G4int index=0)
G4bool IsDefined(G4int Z, G4int Ind)
G4double GetMeanCrossSection(G4int Z, G4int index=0)
static G4QIsotope * Get()
G4int InitElement(G4int Z, G4int index, std::vector< std::pair< G4int, G4double > * > *abund)
static G4VQCrossSection * GetPointer()
G4double GetNuclMass(G4int Z, G4int N, G4int S)
static G4VQCrossSection * GetPointer()
G4double GetWeight() const
void SetWeight(G4double aValue)
const G4ThreeVector & GetPosition() const
void SetTouchableHandle(const G4TouchableHandle &apValue)
G4double GetGlobalTime() const
G4Material * GetMaterial() const
const G4DynamicParticle * GetDynamicParticle() const
const G4TouchableHandle & GetTouchableHandle() const
static G4Triton * Triton()
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
void ProposeTrackStatus(G4TrackStatus status)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
G4ParticleChange aParticleChange
const G4String & GetProcessName() const
virtual G4double GetSlope(G4int tZ, G4int tN, G4int pPDG)
virtual G4double GetExchangeT(G4int tZ, G4int tN, G4int pPDG)
virtual G4double GetCrossSection(G4bool, G4double, G4int, G4int, G4int pPDG=0)
virtual G4double GetHMaxT()