G4QHyperonNuclearCrossSection Class Reference

#include <G4QHyperonNuclearCrossSection.hh>

Inheritance diagram for G4QHyperonNuclearCrossSection:

G4VQCrossSection

Public Member Functions

 ~G4QHyperonNuclearCrossSection ()
virtual G4double GetCrossSection (G4bool fCS, G4double pMom, G4int tgZ, G4int tgN, G4int pPDG=3122)
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

 G4QHyperonNuclearCrossSection ()

Detailed Description

Definition at line 50 of file G4QHyperonNuclearCrossSection.hh.


Constructor & Destructor Documentation

G4QHyperonNuclearCrossSection::G4QHyperonNuclearCrossSection (  )  [inline, protected]

Definition at line 54 of file G4QHyperonNuclearCrossSection.hh.

00054 {}

G4QHyperonNuclearCrossSection::~G4QHyperonNuclearCrossSection (  ) 

Definition at line 69 of file G4QHyperonNuclearCrossSection.cc.

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


Member Function Documentation

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

Implements G4VQCrossSection.

Definition at line 232 of file G4QHyperonNuclearCrossSection.cc.

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

Referenced by GetCrossSection().

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

G4double G4QHyperonNuclearCrossSection::GetCrossSection ( G4bool  fCS,
G4double  pMom,
G4int  tgZ,
G4int  tgN,
G4int  pPDG = 3122 
) [virtual]

Reimplemented from G4VQCrossSection.

Definition at line 81 of file G4QHyperonNuclearCrossSection.cc.

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

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

G4VQCrossSection * G4QHyperonNuclearCrossSection::GetPointer (  )  [static]

Definition at line 63 of file G4QHyperonNuclearCrossSection.cc.

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

00064 {
00065   static G4QHyperonNuclearCrossSection theCrossSection; //**Static body of Cross Section**
00066   return &theCrossSection;
00067 }


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