Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4QuasiElRatios Class Reference

#include <G4QuasiElRatios.hh>

Public Member Functions

 G4QuasiElRatios ()
 
 ~G4QuasiElRatios ()
 
std::pair< G4double, G4doubleGetRatios (G4double pIU, G4int prPDG, G4int tgZ, G4int tgN)
 
std::pair< G4double, G4doubleGetChExFactor (G4double pIU, G4int pPDG, G4int Z, G4int N)
 
std::pair< G4LorentzVector,
G4LorentzVector
Scatter (G4int NPDG, G4LorentzVector N4M, G4int pPDG, G4LorentzVector p4M)
 
std::pair< G4LorentzVector,
G4LorentzVector
ChExer (G4int NPDG, G4LorentzVector N4M, G4int pPDG, G4LorentzVector p4M)
 
std::pair< G4double, G4doubleGetElTot (G4double pIU, G4int hPDG, G4int Z, G4int N)
 
G4double ChExElCoef (G4double p, G4int Z, G4int N, G4int pPDG)
 
std::pair< G4double, G4doubleGetElTotXS (G4double Mom, G4int PDG, G4bool F)
 
std::pair< G4double, G4doubleFetchElTot (G4double pGeV, G4int PDG, G4bool F)
 
G4bool RelDecayIn2 (G4LorentzVector &theMomentum, G4LorentzVector &f4Mom, G4LorentzVector &s4Mom, G4LorentzVector &dir, G4double maxCost=1., G4double minCost=-1.)
 

Detailed Description

Definition at line 52 of file G4QuasiElRatios.hh.

Constructor & Destructor Documentation

G4QuasiElRatios::G4QuasiElRatios ( )

Definition at line 88 of file G4QuasiElRatios.cc.

89 {
90  vT = new std::vector<G4double*>;
91  vL = new std::vector<G4double*>;
92  vX = new std::vector<std::pair<G4double,G4double>*>;
93 
94  lastSRatio=0.; // The last sigma value for which R was calculated
95  lastRRatio=0.; // The last ratio R which was calculated
96  lastARatio=0; // theLast of calculated A
97  lastHRatio=0.; // theLast of max s initialized in the LinTable
98  lastNRatio=0; // theLast of topBin number initialized in LinTable
99  lastMRatio=0.; // theLast of rel max ln(s) initialized in LogTable
100  lastKRatio=0; // theLast of topBin number initialized in LogTable
101  lastTRatio=0; // theLast of pointer to LinTable in the C++ heap
102  lastLRatio=0; // theLast of pointer to LogTable in the C++ heap
103  lastPtot=0.; // The last momentum for which XS was calculated
104  lastHtot=0; // The last projPDG for which XS was calculated
105  lastFtot=true; // The last nucleon for which XS was calculated
106  lastItot=0; // The Last index for which XS was calculated
107  lastMtot=0.; // The Last rel max ln(p) initialized in LogTable
108  lastKtot=0; // The Last topBin number initialized in LogTable
109  lastXtot = new std::pair<G4double,G4double>; // The Last ETPointers to LogTable in heap
110 
112 
114 }
G4VCrossSectionDataSet * GetCrossSectionDataSet(const G4String &name, G4bool warning=true)
static const char * Default_Name()
static G4CrossSectionDataSetRegistry * Instance()
static const char * Default_Name()

Here is the call graph for this function:

G4QuasiElRatios::~G4QuasiElRatios ( )

Definition at line 116 of file G4QuasiElRatios.cc.

117 {
118  std::vector<G4double*>::iterator pos;
119  for(pos=vT->begin(); pos<vT->end(); pos++)
120  { delete [] *pos; }
121  vT->clear();
122  delete vT;
123 
124  for(pos=vL->begin(); pos<vL->end(); pos++)
125  { delete [] *pos; }
126  vL->clear();
127  delete vL;
128 
129  std::vector<std::pair<G4double,G4double>*>::iterator pos2;
130  for(pos2=vX->begin(); pos2<vX->end(); pos2++)
131  { delete [] *pos2; }
132  vX->clear();
133  delete vX;
134 
135 }
static const G4double pos

Member Function Documentation

G4double G4QuasiElRatios::ChExElCoef ( G4double  p,
G4int  Z,
G4int  N,
G4int  pPDG 
)

Definition at line 996 of file G4QuasiElRatios.cc.

997 {
998 
999  p/=MeV; // Converted from independent units
1000  G4double A=Z+N;
1001  if(A<1.5) return 0.;
1002  G4double Cex=0.;
1003  if (pPDG==2212) Cex=N/(A+Z);
1004  else if(pPDG==2112) Cex=Z/(A+N);
1005  else G4cout<<"*Warning*G4CohChrgExchange::ChExElCoef: wrong PDG="<<pPDG<<G4endl;
1006  Cex*=Cex; // Coherent processes squares the amplitude
1007  // @@ This is true only for nucleons: other projectiles must be treated differently
1008  G4double sp=std::sqrt(p);
1009  G4double p2=p*p;
1010  G4double p4=p2*p2;
1011  G4double dl1=G4Log(p)-5.;
1012  G4double T=(6.75+.14*dl1*dl1+13./p)/(1.+.14/p4)+.6/(p4+.00013);
1013  G4double U=(6.25+8.33e-5/p4/p)*(p*sp+.34)/p2/p;
1014  G4double R=U/T;
1015  return Cex*R*R;
1016 }
const int N
Definition: mixmax.h:43
const char * p
Definition: xmltok.h:285
G4GLOB_DLL std::ostream G4cout
double A(double temperature)
G4double G4Log(G4double x)
Definition: G4Log.hh:230
#define G4endl
Definition: G4ios.hh:61
static constexpr double MeV
Definition: G4SIunits.hh:214
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

std::pair< G4LorentzVector, G4LorentzVector > G4QuasiElRatios::ChExer ( G4int  NPDG,
G4LorentzVector  N4M,
G4int  pPDG,
G4LorentzVector  p4M 
)

Definition at line 884 of file G4QuasiElRatios.cc.

886 {
887  static const G4double mNeut= G4Neutron::Neutron()->GetPDGMass();
888  static const G4double mProt= G4Proton::Proton()->GetPDGMass();
889  G4LorentzVector pr4M=p4M/megaelectronvolt; // Convert 4-momenta in MeV(keep p4M)
890  N4M/=megaelectronvolt;
891  G4LorentzVector tot4M=N4M+p4M;
892  G4int Z=0;
893  G4int N=1;
894  G4int sPDG=0; // PDG code of the scattered hadron
895  G4double mS=0.; // proto of mass of scattered hadron
896  G4double mT=mProt; // mass of the recoil nucleon
897  if(NPDG==2212)
898  {
899  mT=mNeut;
900  Z=1;
901  N=0;
902  if(pPDG==-211) sPDG=111; // pi+ -> pi0
903  else if(pPDG==-321)
904  {
905  sPDG=310; // K+ -> K0S
906  if(G4UniformRand()>.5) sPDG=130; // K+ -> K0L
907  }
908  else if(pPDG==-311||pPDG==311||pPDG==130||pPDG==310) sPDG=321; // K0 -> K+ (?)
909  else if(pPDG==3112) sPDG=3212; // Sigma- -> Sigma0
910  else if(pPDG==3212) sPDG=3222; // Sigma0 -> Sigma+
911  else if(pPDG==3312) sPDG=3322; // Xi- -> Xi0
912  }
913  else if(NPDG==2112) // Default
914  {
915  if(pPDG==211) sPDG=111; // pi+ -> pi0
916  else if(pPDG==321)
917  {
918  sPDG=310; // K+ -> K0S
919  if(G4UniformRand()>.5) sPDG=130; // K+ -> K0L
920  }
921  else if(pPDG==-311||pPDG==311||pPDG==130||pPDG==310) sPDG=-321; // K0 -> K- (?)
922  else if(pPDG==3222) sPDG=3212; // Sigma+ -> Sigma0
923  else if(pPDG==3212) sPDG=3112; // Sigma0 -> Sigma-
924  else if(pPDG==3322) sPDG=3312; // Xi0 -> Xi-
925  }
926  else
927  {
928  G4cout<<"Error:G4QuasiElRatios::ChExer: NPDG="<<NPDG<<" is not 2212 or 2112"<<G4endl;
929  G4Exception("G4QuasiElRatios::ChExer:","21",FatalException,"QE complain");
930  //return std::make_pair(G4LorentzVector(0.,0.,0.,0.),p4M);// Use this if not exception
931  }
932  if(sPDG) mS=mNeut;
933  else
934  {
935  G4cout<<"Error:G4QuasiElRatios::ChExer: BAD pPDG="<<pPDG<<", NPDG="<<NPDG<<G4endl;
936  G4Exception("G4QuasiElRatios::ChExer:","21",FatalException,"QE complain");
937  //return std::make_pair(G4LorentzVector(0.,0.,0.,0.),p4M);// Use this if not exception
938  }
939  G4double mT2=mT*mT;
940  G4double mS2=mS*mS;
941  G4double E=(tot4M.m2()-mT2-mS2)/(mT+mT);
942  G4double E2=E*E;
943  if(E<0. || E2<mS2)
944  {
945  return std::make_pair(G4LorentzVector(0.,0.,0.,0.),p4M); // Do Nothing Action
946  }
947  G4double P=std::sqrt(E2-mS2); // Momentum in pseudo laboratory system
948  // @@ Temporary NN t-dependence for all hadrons
949  G4int PDG=2212; // *TMP* instead of pPDG
950  if(pPDG==2112||pPDG==-211||pPDG==-321) PDG=2112; // *TMP* instead of pPDG
951  if(!Z && N==1) // Change for Quasi-Elastic on neutron
952  {
953  Z=1;
954  N=0;
955  if (PDG==2212) PDG=2112;
956  else if(PDG==2112) PDG=2212;
957  }
958  G4double xSec=0.; // Prototype of Recalculated Cross Section *TMP*
959  if(PDG==2212) xSec=PCSmanager->GetChipsCrossSection(P, Z, N, PDG); // P CrossSect *TMP*
960  else xSec=NCSmanager->GetChipsCrossSection(P, Z, N, PDG); // N CrossSect *TMP*
961  // @@ check a possibility to separate p, n, or alpha (!)
962  if(xSec <= 0.) // The cross-section iz 0 -> Do Nothing
963  {
964  return std::make_pair(G4LorentzVector(0.,0.,0.,0.),p4M); //Do Nothing Action
965  }
966  G4double mint=0.; // Prototype of functional rand -t (MeV^2) *TMP*
967  if(PDG==2212) mint=PCSmanager->GetExchangeT(Z,N,PDG);// P functional rand -t(MeV^2) *TMP*
968  else mint=NCSmanager->GetExchangeT(Z,N,PDG);// N functional rand -t(MeV^2) *TMP*
969  G4double maxt=0.; // Prototype of max possible -t
970  if(PDG==2212) maxt=PCSmanager->GetHMaxT(); // max possible -t
971  else maxt=NCSmanager->GetHMaxT(); // max possible -t
972  G4double cost=1.-mint/maxt; // cos(theta) in CMS
973  if(cost>1. || cost<-1. || !(cost>-1. || cost<=1.))
974  {
975  if (cost>1.) cost=1.;
976  else if(cost<-1.) cost=-1.;
977  else
978  {
979  G4cerr<<"G4QuasiFreeRatio::ChExer:*NAN* c="<<cost<<",t="<<mint<<",tm="<<maxt<<G4endl;
980  return std::make_pair(G4LorentzVector(0.,0.,0.,0.),p4M); // Do Nothing Action
981  }
982  }
983  G4LorentzVector reco4M=G4LorentzVector(0.,0.,0.,mT); // 4mom of the recoil nucleon
984  pr4M=G4LorentzVector(0.,0.,0.,mS); // 4mom of the scattered hadron
985  G4LorentzVector dir4M=tot4M-G4LorentzVector(0.,0.,0.,(tot4M.e()-mT)*.01);
986  if(!RelDecayIn2(tot4M, pr4M, reco4M, dir4M, cost, cost))
987  {
988  G4cerr<<"G4QFR::ChEx:t="<<tot4M<<tot4M.m()<<",mT="<<mT<<",mP="<<mS<<G4endl;
989  //G4Exception("G4QFR::ChExer:","009",FatalException,"Decay of ElasticComp");
990  return std::make_pair(G4LorentzVector(0.,0.,0.,0.),p4M); // Do Nothing Action
991  }
992  return std::make_pair(reco4M*megaelectronvolt,pr4M*megaelectronvolt); // Result
993 } // End of ChExer
const int N
Definition: mixmax.h:43
virtual G4double GetChipsCrossSection(G4double momentum, G4int Z, G4int N, G4int pdg)
static constexpr double megaelectronvolt
Definition: G4SIunits.hh:208
int G4int
Definition: G4Types.hh:78
static double P[]
#define G4UniformRand()
Definition: Randomize.hh:97
G4GLOB_DLL std::ostream G4cout
G4double GetExchangeT(G4int tZ, G4int tN, G4int pPDG)
static G4Proton * Proton()
Definition: G4Proton.cc:93
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4bool RelDecayIn2(G4LorentzVector &theMomentum, G4LorentzVector &f4Mom, G4LorentzVector &s4Mom, G4LorentzVector &dir, G4double maxCost=1., G4double minCost=-1.)
G4double GetPDGMass() const
double m2() const
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
virtual G4double GetChipsCrossSection(G4double momentum, G4int Z, G4int N, G4int pdg)
G4double GetExchangeT(G4int tZ, G4int tN, G4int pPDG)
G4GLOB_DLL std::ostream G4cerr
CLHEP::HepLorentzVector G4LorentzVector

Here is the call graph for this function:

std::pair< G4double, G4double > G4QuasiElRatios::FetchElTot ( G4double  pGeV,
G4int  PDG,
G4bool  F 
)

Definition at line 601 of file G4QuasiElRatios.cc.

602 {
603  // LogTable is created only if necessary. The ratio R(s>8100 mb) = 0 for any nuclei
604  G4int nDB=vItot.size(); // A number of hadrons already initialized in AMDB
605  if(nDB && lastHtot==PDG && lastFtot==F && p>0. && p==lastPtot) return lastRtot;// VI don't use toler.
606  // if(nDB && lastH==PDG && lastF==F && p>0. && std::fabs(p-lastP)/p<toler) return lastR;
607  lastHtot=PDG;
608  lastFtot=F;
609  G4int ind=-1; // Prototipe of the index of the PDG/F combination
610  // i=0: pp(nn), i=1: np(pn), i=2: pimp(pipn), i=3: pipp(pimn), i=4: Kmp(Kmn,K0n,K0p),
611  // i=5: Kpp(Kpn,aK0n,aK0p), i=6: Hp(Hn), i=7: app(apn,ann,anp)
612  G4bool kfl=true; // Flag of K0/aK0 oscillation
613  G4bool kf=false;
614  if(PDG==130||PDG==310)
615  {
616  kf=true;
617  if(G4UniformRand()>.5) kfl=false;
618  }
619  if ( (PDG == 2212 && F) || (PDG == 2112 && !F) ) ind=0; // pp/nn
620  else if ( (PDG == 2112 && F) || (PDG == 2212 && !F) ) ind=1; // np/pn
621  else if ( (PDG == -211 && F) || (PDG == 211 && !F) ) ind=2; // pimp/pipn
622  else if ( (PDG == 211 && F) || (PDG == -211 && !F) ) ind=3; // pipp/pimn
623  else if ( PDG == -321 || PDG == -311 || (kf && !kfl) ) ind=4; // KmN/K0N
624  else if ( PDG == 321 || PDG == 311 || (kf && kfl) ) ind=5; // KpN/aK0N
625  else if ( PDG > 3000 && PDG < 3335) ind=6; // @@ for all hyperons - take Lambda
626  else if ( PDG > -3335 && PDG < -2000) ind=7; // @@ for all anti-baryons (anti-p/anti-n)
627  else {
628  G4cout<<"*Error*G4QuasiElRatios::FetchElTot: PDG="<<PDG
629  <<", while it is defined only for p,n,hyperons,anti-baryons,pi,K/antiK"<<G4endl;
630  G4Exception("G4QuasiELRatio::FetchElTot:","22",FatalException,"QECrash");
631  }
632  if(nDB && lastItot==ind && p>0. && p==lastPtot) return lastRtot; // VI do not use toler
633  // if(nDB && lastI==ind && p>0. && std::fabs(p-lastP)/p<toler) return lastR;
634  if(p<=mip || p>=map) return CalcElTot(p,ind); // @@ Slow calculation ! (Warning?)
635  G4bool found=false;
636  G4int i=-1;
637  if(nDB) for (i=0; i<nDB; i++) if(ind==vItot[i]) // Sirch for this index in AMDB
638  {
639  found=true; // The index is found
640  break;
641  }
642  G4double lp=G4Log(p);
643  if(!nDB || !found) // Create new line in the AMDB
644  {
645  lastXtot = new std::pair<G4double,G4double>[mlp]; // Create logarithmic Table for ElTot
646  lastItot = ind; // Remember the initialized inex
647  lastKtot = static_cast<int>((lp-lpi)/dlp)+1; // MaxBin to be initialized in LogTaB
648  if(lastKtot>nlp)
649  {
650  lastKtot=nlp;
651  lastMtot=lpa-lpi;
652  }
653  else lastMtot = lastKtot*dlp; // Calculate max initialized ln(p)-lpi for LogTab
654  G4double pv=mip;
655  for(G4int j=0; j<=lastKtot; j++) // Calculate LogTab values
656  {
657  lastXtot[j]=CalcElTot(pv,ind);
658  if(j!=lastKtot) pv*=edlp;
659  }
660  i++; // Make a new record to AMDB and position on it
661  vItot.push_back(lastItot);
662  vMtot.push_back(lastMtot);
663  vKtot.push_back(lastKtot);
664  vX->push_back(lastXtot);
665  }
666  else // The A value was found in AMDB
667  {
668  lastItot=vItot[i];
669  lastMtot=vMtot[i];
670  lastKtot=vKtot[i];
671  lastXtot=(*vX)[i];
672  G4int nextK=lastKtot+1;
673  G4double lpM=lastMtot+lpi;
674  if(lp>lpM && lastKtot<nlp) // LogTab must be updated
675  {
676  lastKtot = static_cast<int>((lp-lpi)/dlp)+1; // MaxBin to be initialized in LogTab
677  if(lastKtot>nlp)
678  {
679  lastKtot=nlp;
680  lastMtot=lpa-lpi;
681  }
682  else lastMtot = lastKtot*dlp; // Calculate max initialized ln(p)-lpi for LogTab
683  G4double pv=G4Exp(lpM); // momentum of the last calculated beam
684  for(G4int j=nextK; j<=lastKtot; j++)// Calculate LogTab values
685  {
686  pv*=edlp;
687  lastXtot[j]=CalcElTot(pv,ind);
688  }
689  } // End of LogTab update
690  if(lastKtot>=nextK) // The AMDB was apdated
691  {
692  vMtot[i]=lastMtot;
693  vKtot[i]=lastKtot;
694  }
695  }
696  // Now one can use tabeles to calculate the value
697  G4double dlpp=lp-lpi; // Shifted log(p) value
698  G4int n=static_cast<int>(dlpp/dlp); // Low edge number of the bin
699  G4double d=dlpp-n*dlp; // Log shift
700  G4double e=lastXtot[n].first; // E-Base
701  lastRtot.first=e+d*(lastXtot[n+1].first-e)/dlp; // E-Result
702  if(lastRtot.first<0.) lastRtot.first = 0.;
703  G4double t=lastXtot[n].second; // T-Base
704  lastRtot.second=t+d*(lastXtot[n+1].second-t)/dlp; // T-Result
705  if(lastRtot.second<0.) lastRtot.second= 0.;
706  if(lastRtot.first>lastRtot.second) lastRtot.first = lastRtot.second;
707  return lastRtot;
708 } // End of FetchElTot
const char * p
Definition: xmltok.h:285
int G4int
Definition: G4Types.hh:78
#define G4UniformRand()
Definition: Randomize.hh:97
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4double G4Log(G4double x)
Definition: G4Log.hh:230
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
Definition: G4Exp.hh:183
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function:

std::pair< G4double, G4double > G4QuasiElRatios::GetChExFactor ( G4double  pIU,
G4int  pPDG,
G4int  Z,
G4int  N 
)

Definition at line 727 of file G4QuasiElRatios.cc.

729 {
730  G4double pGeV=pIU/gigaelectronvolt;
731  G4double resP=0.;
732  G4double resN=0.;
733  if(Z<1 && N<1)
734  {
735  G4cout<<"-Warning-G4QuasiElRatio::GetChExF:Z="<<Z<<",N="<<N<<", return zero"<<G4endl;
736  return std::make_pair(resP,resN);
737  }
738  G4double A=Z+N;
739  G4double pf=0.; // Possibility to interact with a proton
740  G4double nf=0.; // Possibility to interact with a neutron
741  if (hPDG==-211||hPDG==-321||hPDG==3112||hPDG==3212||hPDG==3312) pf=Z/(A+N);
742  else if(hPDG==211||hPDG==321||hPDG==3222||hPDG==3212||hPDG==3322) nf=N/(A+Z);
743  else if(hPDG==-311||hPDG==311||hPDG==130||hPDG==310)
744  {
745  G4double dA=A+A;
746  pf=Z/(dA+N+N);
747  nf=N/(dA+Z+Z);
748  }
749  G4double mult=1.; // Factor of increasing multiplicity ( ? @@)
750  if(pGeV>.5)
751  {
752  mult=1./(1.+G4Log(pGeV+pGeV))/pGeV;
753  if(mult>1.) mult=1.;
754  }
755  if(pf)
756  {
757  std::pair<G4double,G4double> hp=FetchElTot(pGeV, hPDG, true);
758  resP=pf*(hp.second/hp.first-1.)*mult;
759  }
760  if(nf)
761  {
762  std::pair<G4double,G4double> hn=FetchElTot(pGeV, hPDG, false);
763  resN=nf*(hn.second/hn.first-1.)*mult;
764  }
765  return std::make_pair(resP,resN);
766 } // End of GetChExFactor
const int N
Definition: mixmax.h:43
std::pair< G4double, G4double > FetchElTot(G4double pGeV, G4int PDG, G4bool F)
G4GLOB_DLL std::ostream G4cout
double A(double temperature)
G4double G4Log(G4double x)
Definition: G4Log.hh:230
static constexpr double gigaelectronvolt
Definition: G4SIunits.hh:209
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

std::pair< G4double, G4double > G4QuasiElRatios::GetElTot ( G4double  pIU,
G4int  hPDG,
G4int  Z,
G4int  N 
)

Definition at line 711 of file G4QuasiElRatios.cc.

713 {
714  G4double pGeV=pIU/gigaelectronvolt;
715  if(Z<1 && N<1)
716  {
717  G4cout<<"-Warning-G4QuasiElRatio::GetElTot:Z="<<Z<<",N="<<N<<", return zero"<<G4endl;
718  return std::make_pair(0.,0.);
719  }
720  std::pair<G4double,G4double> hp=FetchElTot(pGeV, hPDG, true);
721  std::pair<G4double,G4double> hn=FetchElTot(pGeV, hPDG, false);
722  G4double A=(Z+N)/millibarn; // To make the result in independent units(IU)
723  return std::make_pair((Z*hp.first+N*hn.first)/A,(Z*hp.second+N*hn.second)/A);
724 } // End of GetElTot
const int N
Definition: mixmax.h:43
std::pair< G4double, G4double > FetchElTot(G4double pGeV, G4int PDG, G4bool F)
G4GLOB_DLL std::ostream G4cout
double A(double temperature)
static constexpr double gigaelectronvolt
Definition: G4SIunits.hh:209
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
static constexpr double millibarn
Definition: G4SIunits.hh:106

Here is the call graph for this function:

Here is the caller graph for this function:

std::pair< G4double, G4double > G4QuasiElRatios::GetElTotXS ( G4double  Mom,
G4int  PDG,
G4bool  F 
)

Definition at line 574 of file G4QuasiElRatios.cc.

575 {
576  G4int ind=0; // Prototype of the reaction index
577  G4bool kfl=true; // Flag of K0/aK0 oscillation
578  G4bool kf=false;
579  if(PDG==130||PDG==310)
580  {
581  kf=true;
582  if(G4UniformRand()>.5) kfl=false;
583  }
584  if ( (PDG == 2212 && F) || (PDG == 2112 && !F) ) ind=0; // pp/nn
585  else if ( (PDG == 2112 && F) || (PDG == 2212 && !F) ) ind=1; // np/pn
586  else if ( (PDG == -211 && F) || (PDG == 211 && !F) ) ind=2; // pimp/pipn
587  else if ( (PDG == 211 && F) || (PDG == -211 && !F) ) ind=3; // pipp/pimn
588  else if ( PDG == -321 || PDG == -311 || (kf && !kfl) ) ind=4; // KmN/K0N
589  else if ( PDG == 321 || PDG == 311 || (kf && kfl) ) ind=5; // KpN/aK0N
590  else if ( PDG > 3000 && PDG < 3335) ind=6; // @@ for all hyperons - take Lambda
591  else if ( PDG > -3335 && PDG < -2000) ind=7; // @@ for all anti-baryons (anti-p/anti-n)
592  else {
593  G4cout<<"*Error*G4QuasiElRatios::CalcElTotXS: PDG="<<PDG
594  <<", while it is defined only for p,n,hyperons,anti-baryons,pi,K/antiK"<<G4endl;
595  G4Exception("G4QuasiElRatio::CalcElTotXS:","22",FatalException,"QEcrash");
596  }
597  return CalcElTot(p,ind);
598 }
const char * p
Definition: xmltok.h:285
int G4int
Definition: G4Types.hh:78
#define G4UniformRand()
Definition: Randomize.hh:97
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

std::pair< G4double, G4double > G4QuasiElRatios::GetRatios ( G4double  pIU,
G4int  prPDG,
G4int  tgZ,
G4int  tgN 
)

Definition at line 138 of file G4QuasiElRatios.cc.

140 {
141  G4double R=0.;
142  G4double QF2In=1.; // Prototype of QuasiFree/Inel ratio for hN_tot
143  G4int tgA=tgZ+tgN;
144  if(tgA<2) return std::make_pair(QF2In,R); // No quasi-elastic on the only nucleon
145  std::pair<G4double,G4double> ElTot=GetElTot(pIU, pPDG, tgZ, tgN); // mean hN El&Tot(IU)
146  //if( ( (pPDG>999 && pIU<227.) || pIU<27.) && tgA>1) R=1.; // @@ TMP to accelerate @lowE
147  if(pPDG>999 && pIU<227. && tgZ+tgN>1) R=1.; // To accelerate @lowE
148  else if(ElTot.second>0.)
149  {
150  R=ElTot.first/ElTot.second; // El/Total ratio (does not depend on units
151  QF2In=GetQF2IN_Ratio(ElTot.second/millibarn, tgZ+tgN); // QuasiFree/Inelastic ratio
152  }
153  return std::make_pair(QF2In,R);
154 }
int G4int
Definition: G4Types.hh:78
std::pair< G4double, G4double > GetElTot(G4double pIU, G4int hPDG, G4int Z, G4int N)
double G4double
Definition: G4Types.hh:76
static constexpr double millibarn
Definition: G4SIunits.hh:106

Here is the call graph for this function:

Here is the caller graph for this function:

G4bool G4QuasiElRatios::RelDecayIn2 ( G4LorentzVector theMomentum,
G4LorentzVector f4Mom,
G4LorentzVector s4Mom,
G4LorentzVector dir,
G4double  maxCost = 1.,
G4double  minCost = -1. 
)

Definition at line 1019 of file G4QuasiElRatios.cc.

1021 {
1022  G4double fM2 = f4Mom.m2();
1023  G4double fM = std::sqrt(fM2); // Mass of the 1st Hadron
1024  G4double sM2 = s4Mom.m2();
1025  G4double sM = std::sqrt(sM2); // Mass of the 2nd Hadron
1026  G4double iM2 = theMomentum.m2();
1027  G4double iM = std::sqrt(iM2); // Mass of the decaying hadron
1028  G4double vP = theMomentum.rho(); // Momentum of the decaying hadron
1029  G4double dE = theMomentum.e(); // Energy of the decaying hadron
1030  if(dE<vP)
1031  {
1032  G4cerr<<"***G4QHad::RelDecIn2: Tachionic 4-mom="<<theMomentum<<", E-p="<<dE-vP<<G4endl;
1033  G4double accuracy=.000001*vP;
1034  G4double emodif=std::fabs(dE-vP);
1035  //if(emodif<accuracy)
1036  //{
1037  G4cerr<<"G4QHadron::RelDecIn2: *Boost* E-p shift is corrected to "<<emodif<<G4endl;
1038  theMomentum.setE(vP+emodif+.01*accuracy);
1039  //}
1040  }
1041  G4ThreeVector ltb = theMomentum.boostVector();// Boost vector for backward Lorentz Trans.
1042  G4ThreeVector ltf = -ltb; // Boost vector for forward Lorentz Trans.
1043  G4LorentzVector cdir = dir; // A copy to make a transformation to CMS
1044  cdir.boost(ltf); // Direction transpormed to CMS of the Momentum
1045  G4ThreeVector vdir = cdir.vect(); // 3-Vector of the direction-particle
1046  G4ThreeVector vx(0.,0.,1.); // Ort in the direction of the reference particle
1047  G4ThreeVector vy(0.,1.,0.); // First ort orthogonal to the direction
1048  G4ThreeVector vz(1.,0.,0.); // Second ort orthoganal to the direction
1049  if(vdir.mag2() > 0.) // the refference particle isn't at rest in CMS
1050  {
1051  vx = vdir.unit(); // Ort in the direction of the reference particle
1052  G4ThreeVector vv= vx.orthogonal(); // Not normed orthogonal vector (!)
1053  vy = vv.unit(); // First ort orthogonal to the direction
1054  vz = vx.cross(vy); // Second ort orthoganal to the direction
1055  }
1056  if(maxCost> 1.) maxCost= 1.;
1057  if(minCost<-1.) minCost=-1.;
1058  if(maxCost<-1.) maxCost=-1.;
1059  if(minCost> 1.) minCost= 1.;
1060  if(minCost> maxCost) minCost=maxCost;
1061  if(std::fabs(iM-fM-sM)<.00000001)
1062  {
1063  G4double fR=fM/iM;
1064  G4double sR=sM/iM;
1065  f4Mom=fR*theMomentum;
1066  s4Mom=sR*theMomentum;
1067  return true;
1068  }
1069  else if (iM+.001<fM+sM || iM==0.)
1070  {//@@ Later on make a quark content check for the decay
1071  G4cerr<<"***G4QH::RelDecIn2: fM="<<fM<<"+sM="<<sM<<">iM="<<iM<<",d="<<iM-fM-sM<<G4endl;
1072  return false;
1073  }
1074  G4double d2 = iM2-fM2-sM2;
1075  G4double p2 = (d2*d2/4.-fM2*sM2)/iM2; // Decay momentum(^2) in CMS of Quasmon
1076  if(p2<0.)
1077  {
1078  p2=0.;
1079  }
1080  G4double p = std::sqrt(p2);
1081  G4double ct = maxCost;
1082  if(maxCost>minCost)
1083  {
1084  G4double dcost=maxCost-minCost;
1085  ct = minCost+dcost*G4UniformRand();
1086  }
1087  G4double phi= twopi*G4UniformRand(); // @@ Change 360.*deg to M_TWOPI (?)
1088  G4double pss=0.;
1089  if(std::fabs(ct)<1.) pss = p * std::sqrt(1.-ct*ct);
1090  else
1091  {
1092  if(ct>1.) ct=1.;
1093  if(ct<-1.) ct=-1.;
1094  }
1095  G4ThreeVector pVect=(pss*std::sin(phi))*vz+(pss*std::cos(phi))*vy+p*ct*vx;
1096 
1097  f4Mom.setVect(pVect);
1098  f4Mom.setE(std::sqrt(fM2+p2));
1099  s4Mom.setVect((-1)*pVect);
1100  s4Mom.setE(std::sqrt(sM2+p2));
1101 
1102  if(f4Mom.e()+.001<f4Mom.rho())G4cerr<<"*G4QH::RDIn2:*Boost* f4M="<<f4Mom<<",e-p="
1103  <<f4Mom.e()-f4Mom.rho()<<G4endl;
1104  f4Mom.boost(ltb); // Lor.Trans. of 1st hadron back to LS
1105  if(s4Mom.e()+.001<s4Mom.rho())G4cerr<<"*G4QH::RDIn2:*Boost* s4M="<<s4Mom<<",e-p="
1106  <<s4Mom.e()-s4Mom.rho()<<G4endl;
1107  s4Mom.boost(ltb); // Lor.Trans. of 2nd hadron back to LS
1108  return true;
1109 } // End of "RelDecayIn2"
Hep3Vector boostVector() const
const char * p
Definition: xmltok.h:285
static const G4double d2
static constexpr double twopi
Definition: G4SIunits.hh:76
static const G4double dE
Hep3Vector vect() const
#define G4UniformRand()
Definition: Randomize.hh:97
HepLorentzVector & boost(double, double, double)
double rho() const
double m2() const
Hep3Vector unit() const
Hep3Vector orthogonal() const
double mag2() const
#define G4endl
Definition: G4ios.hh:61
Hep3Vector cross(const Hep3Vector &) const
void setVect(const Hep3Vector &)
double G4double
Definition: G4Types.hh:76
G4GLOB_DLL std::ostream G4cerr

Here is the call graph for this function:

Here is the caller graph for this function:

std::pair< G4LorentzVector, G4LorentzVector > G4QuasiElRatios::Scatter ( G4int  NPDG,
G4LorentzVector  N4M,
G4int  pPDG,
G4LorentzVector  p4M 
)

Definition at line 770 of file G4QuasiElRatios.cc.

772 {
773  static const G4double mNeut= G4Neutron::Neutron()->GetPDGMass();
774  static const G4double mProt= G4Proton::Proton()->GetPDGMass();
775  static const G4double mDeut= G4Deuteron::Deuteron()->GetPDGMass();
776  static const G4double mTrit= G4Triton::Triton()->GetPDGMass();
777  static const G4double mHel3= G4He3::He3()->GetPDGMass();
778  static const G4double mAlph= G4Alpha::Alpha()->GetPDGMass();
779 
780  G4LorentzVector pr4M=p4M/megaelectronvolt; // Convert 4-momenta in MeV (keep p4M)
781  N4M/=megaelectronvolt;
782  G4LorentzVector tot4M=N4M+p4M;
783  G4double mT=mNeut;
784  G4int Z=0;
785  G4int N=1;
786  if(NPDG==2212||NPDG==90001000)
787  {
788  mT=mProt;
789  Z=1;
790  N=0;
791  }
792  else if(NPDG==90001001)
793  {
794  mT=mDeut;
795  Z=1;
796  N=1;
797  }
798  else if(NPDG==90002001)
799  {
800  mT=mHel3;
801  Z=2;
802  N=1;
803  }
804  else if(NPDG==90001002)
805  {
806  mT=mTrit;
807  Z=1;
808  N=2;
809  }
810  else if(NPDG==90002002)
811  {
812  mT=mAlph;
813  Z=2;
814  N=2;
815  }
816  else if(NPDG!=2112&&NPDG!=90000001)
817  {
818  G4cout<<"Error:G4QuasiElRatios::Scatter:NPDG="<<NPDG<<" is not 2212 or 2112"<<G4endl;
819  G4Exception("G4QuasiElRatios::Scatter:","21",FatalException,"QEcomplain");
820  //return std::make_pair(G4LorentzVector(0.,0.,0.,0.),p4M);// Use this if not exception
821  }
822  G4double mT2=mT*mT;
823  G4double mP2=pr4M.m2();
824  G4double E=(tot4M.m2()-mT2-mP2)/(mT+mT);
825  G4double E2=E*E;
826  if(E<0. || E2<mP2)
827  {
828  return std::make_pair(G4LorentzVector(0.,0.,0.,0.),p4M); // Do Nothing Action
829  }
830  G4double P=std::sqrt(E2-mP2); // Momentum in pseudo laboratory system
831  // @@ Temporary NN t-dependence for all hadrons
832  if(pPDG>3400 || pPDG<-3400) G4cout<<"-Warning-G4QE::Scatter: pPDG="<<pPDG<<G4endl;
833  G4int PDG=2212; // *TMP* instead of pPDG
834  if(pPDG==2112||pPDG==-211||pPDG==-321) PDG=2112; // *TMP* instead of pPDG
835  if(!Z && N==1) // Change for Quasi-Elastic on neutron
836  {
837  Z=1;
838  N=0;
839  if (PDG==2212) PDG=2112;
840  else if(PDG==2112) PDG=2212;
841  }
842  G4double xSec=0.; // Prototype of Recalculated Cross Section *TMP*
843  if(PDG==2212) xSec=PCSmanager->GetChipsCrossSection(P, Z, N, PDG); // P CrossSect *TMP*
844  else xSec=NCSmanager->GetChipsCrossSection(P, Z, N, PDG); // N CrossSect *TMP*
845  // @@ check a possibility to separate p, n, or alpha (!)
846  if(xSec <= 0.) // The cross-section iz 0 -> Do Nothing
847  {
848  return std::make_pair(G4LorentzVector(0.,0.,0.,0.),p4M); //Do Nothing Action
849  }
850  G4double mint=0.; // Prototype of functional rand -t (MeV^2) *TMP*
851  if(PDG==2212) mint=PCSmanager->GetExchangeT(Z,N,PDG);// P functional rand -t(MeV^2) *TMP*
852  else mint=NCSmanager->GetExchangeT(Z,N,PDG);// N functional rand -t(MeV^2) *TMP*
853  G4double maxt=0.; // Prototype of max possible -t
854  if(PDG==2212) maxt=PCSmanager->GetHMaxT(); // max possible -t
855  else maxt=NCSmanager->GetHMaxT(); // max possible -t
856  G4double cost=1.-(mint+mint)/maxt; // cos(theta) in CMS
857  if(cost>1. || cost<-1. || !(cost>-1. || cost<=1.))
858  {
859  if (cost>1.) cost=1.;
860  else if(cost<-1.) cost=-1.;
861  else
862  {
863  G4double tm=0.;
864  if(PDG==2212) tm=PCSmanager->GetHMaxT();
865  else tm=NCSmanager->GetHMaxT();
866  G4cerr<<"G4QuasiFreeRatio::Scat:*NAN* cost="<<cost<<",-t="<<mint<<",tm="<<tm<<G4endl;
867  return std::make_pair(G4LorentzVector(0.,0.,0.,0.),p4M); // Do Nothing Action
868  }
869  }
870  G4LorentzVector reco4M=G4LorentzVector(0.,0.,0.,mT); // 4mom of the recoil nucleon
871  G4LorentzVector dir4M=tot4M-G4LorentzVector(0.,0.,0.,(tot4M.e()-mT)*.01);
872  if(!RelDecayIn2(tot4M, pr4M, reco4M, dir4M, cost, cost))
873  {
874  G4cerr<<"G4QFR::Scat:t="<<tot4M<<tot4M.m()<<",mT="<<mT<<",mP="<<std::sqrt(mP2)<<G4endl;
875  //G4Exception("G4QFR::Scat:","009",FatalException,"Decay of ElasticComp");
876  return std::make_pair(G4LorentzVector(0.,0.,0.,0.),p4M); // Do Nothing Action
877  }
878  return std::make_pair(reco4M*megaelectronvolt,pr4M*megaelectronvolt); // Result
879 } // End of Scatter
const int N
Definition: mixmax.h:43
virtual G4double GetChipsCrossSection(G4double momentum, G4int Z, G4int N, G4int pdg)
static constexpr double megaelectronvolt
Definition: G4SIunits.hh:208
int G4int
Definition: G4Types.hh:78
static double P[]
G4GLOB_DLL std::ostream G4cout
G4double GetExchangeT(G4int tZ, G4int tN, G4int pPDG)
static G4Triton * Triton()
Definition: G4Triton.cc:95
static G4Proton * Proton()
Definition: G4Proton.cc:93
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
static G4Deuteron * Deuteron()
Definition: G4Deuteron.cc:94
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4bool RelDecayIn2(G4LorentzVector &theMomentum, G4LorentzVector &f4Mom, G4LorentzVector &s4Mom, G4LorentzVector &dir, G4double maxCost=1., G4double minCost=-1.)
G4double GetPDGMass() const
double m2() const
#define G4endl
Definition: G4ios.hh:61
static G4Alpha * Alpha()
Definition: G4Alpha.cc:89
double G4double
Definition: G4Types.hh:76
static G4He3 * He3()
Definition: G4He3.cc:94
virtual G4double GetChipsCrossSection(G4double momentum, G4int Z, G4int N, G4int pdg)
G4double GetExchangeT(G4int tZ, G4int tN, G4int pPDG)
G4GLOB_DLL std::ostream G4cerr
CLHEP::HepLorentzVector G4LorentzVector

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files: