G4QAntiBaryonPlusNuclearCrossSection Class Reference

#include <G4QAntiBaryonPlusNuclearCrossSection.hh>

Inheritance diagram for G4QAntiBaryonPlusNuclearCrossSection:

G4VQCrossSection

Public Member Functions

 ~G4QAntiBaryonPlusNuclearCrossSection ()
virtual G4double GetCrossSection (G4bool fCS, G4double pMom, G4int tgZ, G4int tgN, G4int pPDG=-3112)
G4double CalculateCrossSection (G4bool CS, G4int F, G4int I, G4int PDG, G4int Z, G4int N, G4double Momentum)

Static Public Member Functions

static G4VQCrossSection * GetPointer ()

Protected Member Functions

 G4QAntiBaryonPlusNuclearCrossSection ()

Detailed Description

Definition at line 51 of file G4QAntiBaryonPlusNuclearCrossSection.hh.


Constructor & Destructor Documentation

G4QAntiBaryonPlusNuclearCrossSection::G4QAntiBaryonPlusNuclearCrossSection (  )  [inline, protected]

Definition at line 55 of file G4QAntiBaryonPlusNuclearCrossSection.hh.

00055 {}

G4QAntiBaryonPlusNuclearCrossSection::~G4QAntiBaryonPlusNuclearCrossSection (  ) 

Definition at line 71 of file G4QAntiBaryonPlusNuclearCrossSection.cc.

00072 {
00073   G4int lens=LEN->size();
00074   for(G4int i=0; i<lens; ++i) delete[] (*LEN)[i];
00075   delete LEN;
00076   G4int hens=HEN->size();
00077   for(G4int i=0; i<hens; ++i) delete[] (*HEN)[i];
00078   delete HEN;
00079 }


Member Function Documentation

G4double G4QAntiBaryonPlusNuclearCrossSection::CalculateCrossSection ( G4bool  CS,
G4int  F,
G4int  I,
G4int  PDG,
G4int  Z,
G4int  N,
G4double  Momentum 
) [virtual]

Implements G4VQCrossSection.

Definition at line 234 of file G4QAntiBaryonPlusNuclearCrossSection.cc.

References G4VQCrossSection::EquLinearFit(), G4cerr, G4cout, G4endl, and CLHEP::detail::n.

Referenced by GetCrossSection().

00236 {
00237   static const G4double THmin=27.;     // default minimum Momentum (MeV/c) Threshold
00238   static const G4double THmiG=THmin*.001; // minimum Momentum (GeV/c) Threshold
00239   static const G4double dP=10.;        // step for the LEN (Low ENergy) table MeV/c
00240   static const G4double dPG=dP*.001;   // step for the LEN (Low ENergy) table GeV/c
00241   static const G4int    nL=105;        // A#of LEN points in E (step 10 MeV/c)
00242   static const G4double Pmin=THmin+(nL-1)*dP; // minP for the HighE part with safety
00243   static const G4double Pmax=227000.;  // maxP for the HEN (High ENergy) part 227 GeV
00244   static const G4int    nH=224;        // A#of HEN points in lnE
00245   static const G4double milP=std::log(Pmin);// Low logarithm energy for the HEN part
00246   static const G4double malP=std::log(Pmax);// High logarithm energy (each 2.75 percent)
00247   static const G4double dlP=(malP-milP)/(nH-1); // Step in log energy in the HEN part
00248   static const G4double milPG=std::log(.001*Pmin);// Low logarithmEnergy for HEN part GeV/c
00249 #ifdef debug
00250   G4cout<<"G4QaBPNuCS::CalCS:N="<<targN<<",Z="<<targZ<<",P="<<Momentum<<">"<<THmin<<G4endl;
00251 #endif
00252   G4double sigma=0.;
00253   if(F&&I) sigma=0.;                   // @@ *!* Fake line *!* to use F & I !!!Temporary!!!
00254   //G4double A=targN+targZ;              // A of the target
00255 #ifdef debug
00256   G4cout<<"G4QaBarPNucCS::CalCS:A="<<A<<",F="<<F<<",I="<<I<<",nL="<<nL<<",nH="<<nH<<G4endl;
00257 #endif
00258   if(F<=0)                             // This isotope was not the last used isotop
00259   {
00260     if(F<0)                            // This isotope was found in DAMDB =-----=> RETRIEVE
00261     {
00262       G4int sync=LEN->size();
00263       if(sync<=I) G4cerr<<"*!*G4QaBarPNuclCS::CalcCrosSect: Sync="<<sync<<"<="<<I<<G4endl;
00264       lastLEN=(*LEN)[I];               // Pointer to prepared LowEnergy cross sections
00265       lastHEN=(*HEN)[I];               // Pointer to prepared High Energy cross sections
00266     }
00267     else                               // This isotope wasn't calculated before => CREATE
00268     {
00269       lastLEN = new G4double[nL];      // Allocate memory for the new LEN cross sections
00270       lastHEN = new G4double[nH];      // Allocate memory for the new HEN cross sections
00271       // --- Instead of making a separate function ---
00272       G4double P=THmiG;                // Table threshold in GeV/c
00273       for(G4int n=0; n<nL; n++)
00274       {
00275         lastLEN[n] = CrossSectionLin(targZ, targN, P);
00276         P+=dPG;
00277       }
00278       G4double lP=milPG;
00279       for(G4int n=0; n<nH; n++)
00280       {
00281         lastHEN[n] = CrossSectionLog(targZ, targN, lP);
00282         lP+=dlP;
00283       }
00284 #ifdef debug
00285       G4cout<<"-*->G4QaBarPNucCS::CalCS:Tab for Z="<<targZ<<",N="<<targN<<",I="<<I<<G4endl;
00286 #endif
00287       // --- End of possible separate function
00288       // *** The synchronization check ***
00289       G4int sync=LEN->size();
00290       if(sync!=I)
00291       {
00292         G4cerr<<"***G4QaBarPNuclCS::CalcCrossSect: Sinc="<<sync<<"#"<<I<<", Z=" <<targZ
00293               <<", N="<<targN<<", F="<<F<<G4endl;
00294         //G4Exception("G4PiMinusNuclearCS::CalculateCS:","39",FatalException,"DBoverflow");
00295       }
00296       LEN->push_back(lastLEN);         // remember the Low Energy Table
00297       HEN->push_back(lastHEN);         // remember the High Energy Table
00298     } // End of creation of the new set of parameters
00299   } // End of parameters udate
00300   // =--------------------= NOW the Magic Formula =--------------------=
00301 #ifdef debug
00302   G4cout<<"G4QaBPNCS::CalCS:lTH="<<lastTH<<",Pmi="<<Pmin<<",dP="<<dP<<",dlP="<<dlP<<G4endl;
00303 #endif
00304   if (Momentum<lastTH) return 0.;      // It must be already checked in the interface class
00305   else if (Momentum<Pmin)              // High Energy region
00306   {
00307 #ifdef debug
00308     G4cout<<"G4QaBPNCS::CalcCS:bLEN nL="<<nL<<",TH="<<THmin<<",dP="<<dP<<G4endl;
00309 #endif
00310     sigma=EquLinearFit(Momentum,nL,THmin,dP,lastLEN);
00311 #ifdef debugn
00312     if(sigma<0.)
00313       G4cout<<"G4QaBPNCS::CalcCS: E="<<Momentum<<",T="<<THmin<<",dP="<<dP<<G4endl;
00314 #endif
00315   }
00316   else if (Momentum<Pmax)              // High Energy region
00317   {
00318     G4double lP=std::log(Momentum);
00319 #ifdef debug
00320     G4cout<<"G4QaBarPNucCS::CalcCS:before HEN nH="<<nH<<",iE="<<milP<<",dlP="<<dlP<<G4endl;
00321 #endif
00322     sigma=EquLinearFit(lP,nH,milP,dlP,lastHEN);
00323   }
00324   else                                 // UHE region (calculation, not frequent)
00325   {
00326     G4double P=0.001*Momentum;         // Approximation formula is for P in GeV/c
00327     sigma=CrossSectionFormula(targZ, targN, P, std::log(P));
00328   }
00329 #ifdef debug
00330   G4cout<<"G4QAntiBaryonPlusNuclearCrossSection::CalcCS: CS="<<sigma<<G4endl;
00331 #endif
00332   if(sigma<0.) return 0.;
00333   return sigma;
00334 }

G4double G4QAntiBaryonPlusNuclearCrossSection::GetCrossSection ( G4bool  fCS,
G4double  pMom,
G4int  tgZ,
G4int  tgN,
G4int  pPDG = -3112 
) [virtual]

Reimplemented from G4VQCrossSection.

Definition at line 83 of file G4QAntiBaryonPlusNuclearCrossSection.cc.

References CalculateCrossSection(), G4cout, G4endl, G4VQCrossSection::ThresholdEnergy(), and G4VQCrossSection::tolerance.

00085 {
00086   //A.R.23-Oct-2012 Shadowed variable  static G4double tolerance=0.001; // Tolerance (0.1%) to consider as "the same mom"
00087   static G4int j;                      // A#0f Z/N-records already tested in AMDB
00088   static std::vector <G4int>    colN;  // Vector of N for calculated nuclei (isotops)
00089   static std::vector <G4int>    colZ;  // Vector of Z for calculated nuclei (isotops)
00090   static std::vector <G4double> colP;  // Vector of last momenta for the reaction
00091   static std::vector <G4double> colTH; // Vector of energy thresholds for the reaction
00092   static std::vector <G4double> colCS; // Vector of last cross sections for the reaction
00093   // ***---*** End of the mandatory Static Definitions of the Associative Memory ***---***
00094 #ifdef debug
00095   G4cout<<"G4QaBPCS::GetCS:>>>f="<<fCS<<", p="<<pMom<<", Z="<<tgZ<<"("<<lastZ<<") ,N="<<tgN
00096         <<"("<<lastN<<"),PDG="<<PDG<<", thresh="<<lastTH<<",Sz="<<colN.size()<<G4endl;
00097 #endif
00098   if(PDG!=-3112 && PDG!=-3312 && PDG!=-3334)
00099     G4cout<<"-Warning-G4QAntiBaryonPlusCS::GetCS: Not a PositiveAntiBar,PDG="<<PDG<<G4endl;
00100   G4bool in=false;                     // By default the isotope must be found in the AMDB
00101   if(tgN!=lastN || tgZ!=lastZ)         // The nucleus was not the last used isotope
00102   {
00103     in = false;                        // By default the isotope haven't be found in AMDB  
00104     lastP   = 0.;                      // New momentum history (nothing to compare with)
00105     lastN   = tgN;                     // The last N of the calculated nucleus
00106     lastZ   = tgZ;                     // The last Z of the calculated nucleus
00107     lastI   = colN.size();             // Size of the Associative Memory DB in the heap
00108     j  = 0;                            // A#0f records found in DB for this projectile
00109 #ifdef debug
00110     G4cout<<"G4QABPNuclCS::GetCS: the amount of records in the AMDB lastI="<<lastI<<G4endl;
00111 #endif
00112     if(lastI) for(G4int i=0; i<lastI; i++) // AMDB exists, try to find the (Z,N) isotope
00113     {
00114       if(colN[i]==tgN && colZ[i]==tgZ) // Try the record "i" in the AMDB
00115       {
00116         lastI=i;                       // Remember the index for future fast/last use
00117         lastTH =colTH[i];              // The last THreshold (A-dependent)
00118 #ifdef debug
00119         G4cout<<"G4QaBPCS::GetCS:*Found*P="<<pMom<<",Threshold="<<lastTH<<",j="<<j<<G4endl;
00120 #endif
00121         if(pMom<=lastTH)
00122         {
00123 #ifdef debug
00124           G4cout<<"G4QPCS::GetCS:Found,P="<<pMom<<" < Threshold="<<lastTH<<",CS=0"<<G4endl;
00125 #endif
00126           return 0.;                   // Energy is below the Threshold value
00127         }
00128         lastP  =colP [i];              // Last Momentum  (A-dependent)
00129         lastCS =colCS[i];              // Last CrossSect (A-dependent)
00130         if(std::fabs(lastP-pMom)<tolerance*pMom)
00131         //if(lastP==pMom)              // VI do not use tolerance
00132         {
00133 #ifdef debug
00134           G4cout<<"G4QaBPNCS::GetCS:.DoNothing.P="<<pMom<<",CS="<<lastCS*millibarn<<G4endl;
00135 #endif
00136           //CalculateCrossSection(fCS,-1,j,PDG,lastZ,lastN,pMom); // Update param's only
00137           return lastCS*millibarn;     // Use theLastCS
00138         }
00139         in = true;                     // This is the case when the isotop is found in DB
00140         // Momentum pMom is in IU ! @@ Units
00141 #ifdef debug
00142         G4cout<<"G4QaBPNCS::G:UpdDB,P="<<pMom<<",f="<<fCS<<",lI="<<lastI<<",j="<<j<<G4endl;
00143 #endif
00144         lastCS=CalculateCrossSection(fCS,-1,j,PDG,lastZ,lastN,pMom); // read & update
00145 #ifdef debug
00146         G4cout<<"G4QaBPNuCS::GetCrosSec: *****> New (inDB) Calculated CS="<<lastCS<<G4endl;
00147 #endif
00148         if(lastCS<=0. && pMom>lastTH)  // Correct the threshold (@@ No intermediate Zeros)
00149         {
00150 #ifdef debug
00151           G4cout<<"G4QaBPNuCS::GetCS: New P="<<pMom<<"(CS=0) > Threshold="<<lastTH<<G4endl;
00152 #endif
00153           lastCS=0.;
00154           lastTH=pMom;
00155         }
00156         break;                         // Go out of the LOOP
00157       }
00158 #ifdef debug
00159       G4cout<<"-->G4QaBarPNucCrossSec::GetCrosSec: pPDG="<<PDG<<", j="<<j<<", N="<<colN[i]
00160             <<",Z["<<i<<"]="<<colZ[i]<<G4endl;
00161 #endif
00162       j++;                             // Increment a#0f records found in DB
00163     }
00164 #ifdef debug
00165     G4cout<<"-?-G4QaBPNCS::GeCS:R,Z="<<tgZ<<",N="<<tgN<<",in="<<in<<",j="<<j<<" ?"<<G4endl;
00166 #endif
00167     if(!in)                            // This isotope has not been calculated previously
00168     {
00169 #ifdef debug
00170       G4cout<<"^^^G4QaBPCS::GetCS:CalcNewP="<<pMom<<", f="<<fCS<<", lastI="<<lastI<<G4endl;
00171 #endif
00173       lastCS=CalculateCrossSection(fCS,0,j,PDG,lastZ,lastN,pMom); //calculate & create
00174       //if(lastCS>0.)                   // It means that the AMBD was initialized
00175       //{
00176 
00177         lastTH = ThresholdEnergy(tgZ, tgN); // The Threshold Energy which is now the last
00178 #ifdef debug
00179         G4cout<<"G4QaBPNucCrossSec::GetCrossSect: NewThresh="<<lastTH<<",P="<<pMom<<G4endl;
00180 #endif
00181         colN.push_back(tgN);
00182         colZ.push_back(tgZ);
00183         colP.push_back(pMom);
00184         colTH.push_back(lastTH);
00185         colCS.push_back(lastCS);
00186 #ifdef debug
00187         G4cout<<"G4QaBPNCS::GetCrosSec:lCS="<<lastCS<<",lZ="<<lastN<<",lN="<<lastZ<<G4endl;
00188 #endif
00189       //} // M.K. Presence of H1 with high threshold breaks the syncronization
00190 #ifdef pdebug
00191       G4cout<<"G4QaBPNCS::GCS:1st,P="<<pMom<<"(MeV),CS="<<lastCS*millibarn<<"(mb)"<<G4endl;
00192 #endif
00193       return lastCS*millibarn;
00194     } // End of creation of the new set of parameters
00195     else
00196     {
00197 #ifdef debug
00198       G4cout<<"G4QaBarPNucCrossSect::GetCrosSect: Update lastI="<<lastI<<",j="<<j<<G4endl;
00199 #endif
00200       colP[lastI]=pMom;
00201       colCS[lastI]=lastCS;
00202     }
00203   } // End of parameters udate
00204   else if(pMom<=lastTH)
00205   {
00206 #ifdef debug
00207     G4cout<<"G4QaBPNuCS::GetCS:CurrentP="<<pMom<<" < Threshold="<<lastTH<<", CS=0"<<G4endl;
00208 #endif
00209     return 0.;                         // Momentum is below the Threshold Value -> CS=0
00210   }
00211   else if(std::fabs(lastP-pMom)<tolerance*pMom)
00212   //else if(lastP==pMom)               // VI do not use tolerance
00213   {
00214 #ifdef debug
00215     G4cout<<"G4QaBPCS::GetCS:OldNZ&P="<<lastP<<"="<<pMom<<",CS="<<lastCS*millibarn<<G4endl;
00216 #endif
00217     return lastCS*millibarn;           // Use theLastCS
00218   }
00219   else                                 // It is the last used -> use the current tables
00220   {
00221 #ifdef debug
00222     G4cout<<"-!-G4QaBPCS::GeCS:UseCurP="<<pMom<<",f="<<fCS<<",I="<<lastI<<",j="<<j<<G4endl;
00223 #endif
00224     lastCS=CalculateCrossSection(fCS,1,j,PDG,lastZ,lastN,pMom); // Only read and UpdateDB
00225     lastP=pMom;
00226   }
00227 #ifdef debug
00228   G4cout<<"==>G4QaBPCS::GetCroSec:P="<<pMom<<"(MeV),CS="<<lastCS*millibarn<<"(mb)"<<G4endl;
00229 #endif
00230   return lastCS*millibarn;
00231 }

G4VQCrossSection * G4QAntiBaryonPlusNuclearCrossSection::GetPointer (  )  [static]

Definition at line 65 of file G4QAntiBaryonPlusNuclearCrossSection.cc.

Referenced by G4QHadronInelasticDataSet::GetIsoCrossSection(), and G4QInelastic::GetMeanFreePath().

00066 {
00067   static G4QAntiBaryonPlusNuclearCrossSection theCrossSection;//Static body of CrossSection
00068   return &theCrossSection;
00069 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:53:04 2013 for Geant4 by  doxygen 1.4.7