68G4int G4QCoherentChargeExchange::nPartCWorld=85;
69std::vector<G4int> G4QCoherentChargeExchange::ElementZ;
70std::vector<G4double> G4QCoherentChargeExchange::ElProbInMat;
71std::vector<std::vector<G4int>*> G4QCoherentChargeExchange::ElIsoN;
72std::vector<std::vector<G4double>*>G4QCoherentChargeExchange::IsoProbInEl;
81 G4cout<<
"G4QCohChargeEx::Constructor is called processName="<<processName<<
G4endl;
92 {
return EnMomConservation;}
106 G4cout<<
"*W*G4QCohChargeEx::GetMeanFreePath called for notImplementedParticle"<<
G4endl;
111 G4cout<<
"G4QCohChEx::GetMeanFreePath: kinE="<<KinEn<<
",Mom="<<Momentum<<
G4endl;
118 G4cout<<
"G4QCohChargeExchange::GetMeanFreePath:"<<nE<<
" Elem's in theMaterial"<<
G4endl;
124 else G4cout<<
"G4QCohChargeEx::GetMeanFreePath: only nA & pA are implemented"<<
G4endl;
128 G4int IPIE=IsoProbInEl.size();
129 if(IPIE)
for(
G4int ip=0; ip<IPIE; ++ip)
131 std::vector<G4double>* SPI=IsoProbInEl[ip];
134 std::vector<G4int>* IsN=ElIsoN[ip];
142 for(
G4int i=0; i<nE; ++i)
144 G4Element* pElement=(*theElementVector)[i];
146 ElementZ.push_back(Z);
150 if(isoVector) isoSize=isoVector->size();
152 G4cout<<
"G4QCoherentChargeExchange::GetMeanFreePath:isovectorLength="<<isoSize<<
G4endl;
162 std::vector<std::pair<G4int,G4double>*>* newAbund =
163 new std::vector<std::pair<G4int,G4double>*>;
165 for(
G4int j=0; j<isoSize; j++)
171 std::pair<G4int,G4double>* pr=
new std::pair<G4int,G4double>(N,abund);
173 G4cout<<
"G4QCohChEx::GetMeanFreePath:pair#="<<j<<
",N="<<N<<
",ab="<<abund<<
G4endl;
175 newAbund->push_back(pr);
178 G4cout<<
"G4QCohChEx::GetMeanFreePath: pairVectorLength="<<newAbund->size()<<
G4endl;
181 for(
G4int k=0; k<isoSize; k++)
delete (*newAbund)[k];
185 std::vector<std::pair<G4int,G4double>*>* cs= Isotopes->
GetCSVector(Z,indEl);
186 std::vector<G4double>* SPI =
new std::vector<G4double>;
187 IsoProbInEl.push_back(SPI);
188 std::vector<G4int>* IsN =
new std::vector<G4int>;
189 ElIsoN.push_back(IsN);
190 G4int nIs=cs->size();
192 G4cout<<
"G4QCohChargEx::GMFP:=***=>,#isot="<<nIs<<
", Z="<<Z<<
", indEl="<<indEl<<
G4endl;
195 if(nIs)
for(
G4int j=0; j<nIs; j++)
197 std::pair<G4int,G4double>* curIs=(*cs)[j];
198 G4int N=curIs->first;
201 G4cout<<
"G4QCCX::GMFP:true, P="<<Momentum<<
",Z="<<Z<<
",N="<<N<<
",PDG="<<pPDG<<
G4endl;
204 if(Q==-27.) ccsf=
false;
206 G4cout<<
"G4QCoherentChargeExchange::GMFP: GetCS #1 j="<<j<<
G4endl;
208 G4double CSI=CalculateXSt(ccsf,
true, Momentum, Z, N, pPDG);
211 G4cout<<
"G4QCohChEx::GetMeanFreePath:jI="<<j<<
",Zt="<<Z<<
",Nt="<<N<<
",Mom="<<Momentum
212 <<
", XSec="<<CSI/millibarn<<
G4endl;
216 SPI->push_back(susi);
223 ElProbInMat.push_back(sigma);
227 G4cout<<
"G4QCoherentChargeExchange::GetMeanFreePath: MeanFreePath="<<1./sigma<<
G4endl;
229 if(sigma > 0.)
return 1./sigma;
274 static G4bool CWinit =
true;
284 G4cout<<
"G4QCohChargeExchange::PostStepDoIt: Before the GetMeanFreePath is called In4M="
291 G4cout<<
"G4QCohChargeExchange::PostStepDoIt: After GetMeanFreePath is called"<<
G4endl;
296 if(std::fabs(Momentum-momentum)>.000001)
297 G4cerr<<
"*Warning*G4QCohChEx::PostStepDoIt:P(IU)="<<Momentum<<
"#"<<momentum<<
G4endl;
299 G4cout<<
"G4QCoherentChargeExchange::PostStepDoIt: pP(IU)="<<Momentum<<
"="<<momentum
300 <<
",pM="<<pM<<
",proj4M="<<proj4M<<proj4M.
m()<<
G4endl;
304 G4cerr<<
"G4QCoherentChargeExchange::PostStepDoIt: Only NA is implemented."<<
G4endl;
312 G4cout<<
"G4QCohChargeExchange::PostStepDoIt: "<<nE<<
" elements in the material."<<
G4endl;
348 G4cout<<
"G4QCohChrgExchange::PostStepDoIt: projPDG="<<projPDG<<
", stPDG="<<prPDG<<
G4endl;
352 G4cerr<<
"*Warning*G4QCoherentChargeExchange::PostStepDoIt:UndefinedProjHadron"<<
G4endl;
358 if(projPDG==2112) pM=mProt;
361 G4int EPIM=ElProbInMat.size();
363 G4cout<<
"G4QCohChEx::PostStDoIt:m="<<EPIM<<
",n="<<nE<<
",T="<<ElProbInMat[EPIM-1]<<
G4endl;
372 G4cout<<
"G4QCohChEx::PostStepDoIt:EPM["<<i<<
"]="<<ElProbInMat[i]<<
",r="<<rnd<<
G4endl;
374 if (rnd<ElProbInMat[i])
break;
378 G4Element* pElement=(*theElementVector)[i];
381 G4cout<<
"G4QCoherentChargeExchange::PostStepDoIt: i="<<i<<
", Z(element)="<<Z<<
G4endl;
385 G4cerr<<
"-Warning-G4QCoherentChargeExchange::PostStepDoIt: Element with Z="<<Z<<
G4endl;
388 std::vector<G4double>* SPI = IsoProbInEl[i];
389 std::vector<G4int>* IsN = ElIsoN[i];
390 G4int nofIsot=SPI->size();
392 G4cout<<
"G4QCohChargeExchange::PosStDoIt:nI="<<nofIsot<<
",T="<<(*SPI)[nofIsot-1]<<
G4endl;
398 for(j=0; j<nofIsot; ++j)
401 G4cout<<
"G4QCohChargEx::PostStepDoIt: SP["<<j<<
"]="<<(*SPI)[j]<<
", r="<<rndI<<
G4endl;
403 if(rndI < (*SPI)[j])
break;
405 if(j>=nofIsot) j=nofIsot-1;
407 G4int N =(*IsN)[j]; ;
409 G4cout<<
"G4QCohChargeEx::PostStepDoIt: j="<<i<<
", N(isotope)="<<N<<
", MeV="<<MeV<<
G4endl;
413 G4cerr<<
"*Warning*G4QCohChEx::PostStepDoIt: Isotope with Z="<<Z<<
", 0>N="<<N<<
G4endl;
418 G4cout<<
"G4QCohChargeExchange::PostStepDoIt: N="<<N<<
" for element with Z="<<Z<<
G4endl;
422 G4cerr<<
"*Warning*G4QCoherentChargeExchange::PostStepDoIt:Element with N="<<N<<
G4endl;
427 G4cout<<
"G4QCoherentChargeExchange::PostStepDoIt: track is initialized"<<
G4endl;
433 G4cout<<
"G4QCoherentChargeExchange::PostStepDoIt: before Touchable extraction"<<
G4endl;
437 G4cout<<
"G4QCoherentChargeExchange::PostStepDoIt: Touchable is extracted"<<
G4endl;
440 G4int targPDG=90000000+Z*1000+N;
441 if(projPDG==2212) targPDG+=999;
442 else if(projPDG==2112) targPDG-=999;
449 G4cout<<
"G4QCohChrgEx::PostStepDoIt: tM="<<tM<<
", p4M="<<proj4M<<
", t4M="<<tot4M<<
G4endl;
451 EnMomConservation=tot4M;
454 G4cout<<
"G4QCCX::PSDI:false, P="<<Momentum<<
",Z="<<Z<<
",N="<<N<<
",PDG="<<projPDG<<
G4endl;
456 G4double xSec=CalculateXSt(
false,
true, Momentum, Z, N, projPDG);
458 G4cout<<
"G4QCoChEx::PSDI:PDG="<<projPDG<<
",P="<<Momentum<<
",CS="<<xSec/millibarn<<
G4endl;
461 if(xSec>0. || xSec<0. || xSec==0);
462 else G4cout<<
"*Warning*G4QCohChargeExchange::PSDI: xSec="<<xSec/millibarn<<
G4endl;
468 G4cerr<<
"*Warning*G4QCoherentChargeExchange::PSDoIt:*Zero cross-section* PDG="<<projPDG
469 <<
",tPDG="<<targPDG<<
",P="<<Momentum<<
G4endl;
477 G4double mint=CalculateXSt(
false,
false, Momentum, Z, N, projPDG);
479 G4cout<<
"G4QCohChEx::PoStDoIt:pPDG="<<projPDG<<
",tPDG="<<targPDG<<
",P="<<Momentum<<
",CS="
480 <<xSec<<
",-t="<<mint<<
G4endl;
484 else G4cout<<
"*Warning*G4QCoherentChargeExchange::PostStDoIt:-t="<<mint<<
G4endl;
486 G4double maxt=CalculateXSt(
true,
false, Momentum, Z, N, projPDG);
487 if(maxt<=0.) maxt=1.e-27;
491 G4cout<<
"G4QCoherentChargeExchange::PoStDoIt:t="<<mint<<
",dpcm2="<<maxt
492 <<
",Ek="<<kinEnergy<<
",tM="<<tM<<
",pM="<<pM<<
",cost="<<cost<<
G4endl;
494 if(cost>1. || cost<-1. || !(cost>-1. || cost<1.))
496 if(cost>1.000001 || cost<-1.000001 || !(cost>-1. || cost<1.))
501 G4double twop2cm=(tM2+tM2)*(pEn*pEn-pM2)/sM;
502 G4cout<<
"*Warning*G4QCohChEx::PostStepDoIt:cos="<<cost<<
",t="<<mint<<
",T="<<kinEnergy
503 <<
",tM="<<tM<<
",tmax="<<2*kinEnergy*tM<<
",p="<<projPDG<<
",t="<<targPDG<<
G4endl;
504 G4cout<<
"..G4QCohChEx::PoStDoI: dpcm2="<<twop2cm<<
"="<<maxt<<
G4endl;
506 if (cost>1.) cost=1.;
507 else if(cost<-1.) cost=-1.;
512 if(!
G4QHadron(tot4M).RelDecayIn2(scat4M, reco4M, dir4M, cost, cost))
514 G4cerr<<
"G4QCohChEx::PSDI:t4M="<<tot4M<<
",pM="<<pM<<
",tM="<<tM<<
",cost="<<cost<<
G4endl;
518 G4cout<<
"G4QCohChEx::PoStDoIt:s4M="<<scat4M<<
"+r4M="<<reco4M<<
"="<<scat4M+reco4M<<
G4endl;
519 G4cout<<
"G4QCohChEx::PoStDoIt: scatE="<<scat4M.
e()-pM<<
", recoE="<<reco4M.
e()-tM<<
",d4M="
520 <<tot4M-scat4M-reco4M<<
G4endl;
529 EnMomConservation-=scat4M;
539 G4cout<<
"G4QCoherentChargeExchange::PostStepDoIt: Ion Z="<<Z<<
", A="<<aA<<
G4endl;
542 if(!theDefinition)
G4cout<<
"*Warning*G4QCohChEx::PostStepDoIt:drop PDG="<<targPDG<<
G4endl;
547 EnMomConservation-=reco4M;
549 G4cout<<
"G4QCohChEx::PostSDoIt:"<<targPDG<<reco4M<<reco4M.
m()<<EnMomConservation<<
G4endl;
556 G4cout<<
"G4QCohChEx::PostStpDoIt:p="<<curD<<curD.
mag()<<
",e="<<curE<<
",m="<<curM<<
G4endl;
564 G4cout<<
"G4QCoherentChargeExchange::PostStepDoIt:*** PostStepDoIt is done ***"<<
G4endl;
611 else G4cout<<
"*Warning*G4QCohChrgExchange::CalculateXSt: NotInitiatedScattering"<<
G4endl;
std::vector< G4Element * > G4ElementVector
#define G4HadronicDeprecate(name)
std::vector< G4Isotope * > G4IsotopeVector
CLHEP::HepLorentzVector G4LorentzVector
G4DLLIMPORT std::ostream G4cerr
G4DLLIMPORT std::ostream G4cout
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
const G4ElementVector * GetElementVector() const
size_t GetNumberOfElements() const
const G4double * GetVecNbOfAtomsPerVolume() const
static G4Neutron * Neutron()
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
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)
G4int GetNumberOfNeutronsInTarget()
G4double GetMeanFreePath(const G4Track &aTrack, G4double previousStepSize, G4ForceCondition *condition)
G4QCoherentChargeExchange(const G4String &processName="CHIPS_CoherChargeExScattering")
G4bool IsApplicable(const G4ParticleDefinition &particle)
G4VParticleChange * PostStepDoIt(const G4Track &aTrack, const G4Step &aStep)
G4LorentzVector GetEnegryMomentumConservation()
~G4QCoherentChargeExchange()
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()
static G4VQCrossSection * GetPointer()
G4double ChExElCoef(G4double p, G4int Z, G4int N, G4int pPDG)
static G4QuasiFreeRatios * 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
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
void ProposeTrackStatus(G4TrackStatus status)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
G4ParticleChange aParticleChange
const G4String & GetProcessName() const
virtual G4double GetExchangeT(G4int tZ, G4int tN, G4int pPDG)
virtual G4double GetCrossSection(G4bool, G4double, G4int, G4int, G4int pPDG=0)
virtual G4double GetHMaxT()