Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4QKaonPlusNuclearCrossSection Class Reference

#include <G4QKaonPlusNuclearCrossSection.hh>

+ Inheritance diagram for G4QKaonPlusNuclearCrossSection:

Public Member Functions

 ~G4QKaonPlusNuclearCrossSection ()
 
virtual G4double GetCrossSection (G4bool fCS, G4double pMom, G4int tgZ, G4int tgN, G4int pPDG=321)
 
G4double CalculateCrossSection (G4bool CS, G4int F, G4int I, G4int PDG, G4int Z, G4int N, G4double Momentum)
 
- Public Member Functions inherited from G4VQCrossSection
virtual ~G4VQCrossSection ()
 
virtual G4double GetCrossSection (G4bool, G4double, G4int, G4int, G4int pPDG=0)
 
virtual G4double ThresholdEnergy (G4int Z, G4int N, G4int PDG=0)
 
virtual G4double CalculateCrossSection (G4bool CS, G4int F, G4int I, G4int PDG, G4int tgZ, G4int tgN, G4double pMom)=0
 
virtual G4double GetLastTOTCS ()
 
virtual G4double GetLastQELCS ()
 
virtual G4double GetDirectPart (G4double Q2)
 
virtual G4double GetNPartons (G4double Q2)
 
virtual G4double GetExchangeEnergy ()
 
virtual G4double GetExchangeT (G4int tZ, G4int tN, G4int pPDG)
 
virtual G4double GetSlope (G4int tZ, G4int tN, G4int pPDG)
 
virtual G4double GetHMaxT ()
 
virtual G4double GetExchangeQ2 (G4double nu=0)
 
virtual G4double GetVirtualFactor (G4double nu, G4double Q2)
 
virtual G4double GetQEL_ExchangeQ2 ()
 
virtual G4double GetNQE_ExchangeQ2 ()
 
virtual G4int GetExchangePDGCode ()
 

Static Public Member Functions

static G4VQCrossSectionGetPointer ()
 
- Static Public Member Functions inherited from G4VQCrossSection
static void setTolerance (G4double tol)
 

Protected Member Functions

 G4QKaonPlusNuclearCrossSection ()
 
- Protected Member Functions inherited from G4VQCrossSection
 G4VQCrossSection ()
 
G4double LinearFit (G4double X, G4int N, G4double *XN, G4double *YN)
 
G4double EquLinearFit (G4double X, G4int N, G4double X0, G4double DX, G4double *Y)
 

Additional Inherited Members

- Static Protected Attributes inherited from G4VQCrossSection
static G4double tolerance =.001
 

Detailed Description

Definition at line 51 of file G4QKaonPlusNuclearCrossSection.hh.

Constructor & Destructor Documentation

◆ G4QKaonPlusNuclearCrossSection()

G4QKaonPlusNuclearCrossSection::G4QKaonPlusNuclearCrossSection ( )
inlineprotected

Definition at line 55 of file G4QKaonPlusNuclearCrossSection.hh.

55{}

◆ ~G4QKaonPlusNuclearCrossSection()

G4QKaonPlusNuclearCrossSection::~G4QKaonPlusNuclearCrossSection ( )

Definition at line 69 of file G4QKaonPlusNuclearCrossSection.cc.

70{
71 G4int lens=LEN->size();
72 for(G4int i=0; i<lens; ++i) delete[] (*LEN)[i];
73 delete LEN;
74 G4int hens=HEN->size();
75 for(G4int i=0; i<hens; ++i) delete[] (*HEN)[i];
76 delete HEN;
77}
int G4int
Definition: G4Types.hh:66

Member Function Documentation

◆ CalculateCrossSection()

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

Implements G4VQCrossSection.

Definition at line 231 of file G4QKaonPlusNuclearCrossSection.cc.

233{
234 static const G4double THmin=27.; // default minimum Momentum (MeV/c) Threshold
235 static const G4double THmiG=THmin*.001; // minimum Momentum (GeV/c) Threshold
236 static const G4double dP=10.; // step for the LEN (Low ENergy) table MeV/c
237 static const G4double dPG=dP*.001; // step for the LEN (Low ENergy) table GeV/c
238 static const G4int nL=105; // A#of LEN points in E (step 10 MeV/c)
239 static const G4double Pmin=THmin+(nL-1)*dP; // minP for the HighE part with safety
240 static const G4double Pmax=227000.; // maxP for the HEN (High ENergy) part 227 GeV
241 static const G4int nH=224; // A#of HEN points in lnE
242 static const G4double milP=std::log(Pmin);// Low logarithm energy for the HEN part
243 static const G4double malP=std::log(Pmax);// High logarithm energy (each 2.75 percent)
244 static const G4double dlP=(malP-milP)/(nH-1); // Step in log energy in the HEN part
245 static const G4double milPG=std::log(.001*Pmin);// Low logarithmEnergy for HEN part GeV/c
246#ifdef debug
247 G4cout<<"G4QKpNucCS::CalCS:N="<<targN<<",Z="<<targZ<<",P="<<Momentum<<">"<<THmin<<G4endl;
248#endif
249 G4double sigma=0.;
250 if(F&&I) sigma=0.; // @@ *!* Fake line *!* to use F & I !!!Temporary!!!
251 G4double A=targN+targZ; // A of the target
252#ifdef debug
253 G4cout<<"G4QKpNucCS::CalCS: A="<<A<<",F="<<F<<",I="<<I<<",nL="<<nL<<",nH="<<nH<<G4endl;
254#endif
255 if(F<=0) // This isotope was not the last used isotop
256 {
257 if(F<0) // This isotope was found in DAMDB =-----=> RETRIEVE
258 {
259 G4int sync=LEN->size();
260 if(sync<=I) G4cerr<<"*!*G4QPiMinusNuclCS::CalcCrosSect:Sync="<<sync<<"<="<<I<<G4endl;
261 lastLEN=(*LEN)[I]; // Pointer to prepared LowEnergy cross sections
262 lastHEN=(*HEN)[I]; // Pointer to prepared High Energy cross sections
263 }
264 else // This isotope wasn't calculated before => CREATE
265 {
266 lastLEN = new G4double[nL]; // Allocate memory for the new LEN cross sections
267 lastHEN = new G4double[nH]; // Allocate memory for the new HEN cross sections
268 // --- Instead of making a separate function ---
269 G4double P=THmiG; // Table threshold in GeV/c
270 for(G4int n=0; n<nL; n++)
271 {
272 lastLEN[n] = CrossSectionLin(targZ, targN, P);
273 P+=dPG;
274 }
275 G4double lP=milPG;
276 for(G4int n=0; n<nH; n++)
277 {
278 lastHEN[n] = CrossSectionLog(targZ, targN, lP);
279 lP+=dlP;
280 }
281#ifdef debug
282 G4cout<<"-*->G4QKpNucCS::CalcCS:Tab for Z="<<targZ<<",N="<<targN<<",I="<<I<<G4endl;
283#endif
284 // --- End of possible separate function
285 // *** The synchronization check ***
286 G4int sync=LEN->size();
287 if(sync!=I)
288 {
289 G4cerr<<"***G4QPiMinusNuclCS::CalcCrossSect: Sinc="<<sync<<"#"<<I<<", Z=" <<targZ
290 <<", N="<<targN<<", F="<<F<<G4endl;
291 //G4Exception("G4PiMinusNuclearCS::CalculateCS:","39",FatalException,"DBoverflow");
292 }
293 LEN->push_back(lastLEN); // remember the Low Energy Table
294 HEN->push_back(lastHEN); // remember the High Energy Table
295 } // End of creation of the new set of parameters
296 } // End of parameters udate
297 // =--------------------------= NOW the Magic Formula =---------------------------------=
298#ifdef debug
299 G4cout<<"G4QKpNCS::CalcCS:lTH="<<lastTH<<",Pmi="<<Pmin<<",dP="<<dP<<",dlP="<<dlP<<G4endl;
300#endif
301 if (Momentum<lastTH) return 0.; // It must be already checked in the interface class
302 else if (Momentum<Pmin) // Low Energy region
303 {
304#ifdef debug
305 G4cout<<"G4QKpNCS::CalcCS:bLEN A="<<A<<", nL="<<nL<<", P="<<Momentum<<G4endl;
306#endif
307 if(A<=1. && Momentum < 600.) sigma=0.; // Approximation tot/el uncertainty
308 else sigma=EquLinearFit(Momentum,nL,THmin,dP,lastLEN);
309#ifdef debugn
310 if(sigma<0.)
311 G4cout<<"G4QKpNuCS::CalcCS: E="<<Momentum<<",T="<<THmin<<",dP="<<dP<<G4endl;
312#endif
313 }
314 else if (Momentum<Pmax) // High Energy region
315 {
316 G4double lP=std::log(Momentum);
317#ifdef debug
318 G4cout<<"G4QKpNucCS::CalcCS: before HEN nH="<<nH<<",iE="<<milP<<",dlP="<<dlP<<G4endl;
319#endif
320 sigma=EquLinearFit(lP,nH,milP,dlP,lastHEN);
321 }
322 else // UHE region (calculation, not frequent)
323 {
324 G4double P=0.001*Momentum; // Approximation formula is for P in GeV/c
325 sigma=CrossSectionFormula(targZ, targN, P, std::log(P));
326 }
327#ifdef debug
328 G4cout<<"G4QKaonPlusNuclearCrossSection::CalcCS: CS="<<sigma<<G4endl;
329#endif
330 if(sigma<0.) return 0.;
331 return sigma;
332}
double G4double
Definition: G4Types.hh:64
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cerr
G4DLLIMPORT std::ostream G4cout
G4double EquLinearFit(G4double X, G4int N, G4double X0, G4double DX, G4double *Y)

Referenced by GetCrossSection().

◆ GetCrossSection()

G4double G4QKaonPlusNuclearCrossSection::GetCrossSection ( G4bool  fCS,
G4double  pMom,
G4int  tgZ,
G4int  tgN,
G4int  pPDG = 321 
)
virtual

!The slave functions must provide cross-sections in millibarns (mb) !! (not in IU)

Reimplemented from G4VQCrossSection.

Definition at line 81 of file G4QKaonPlusNuclearCrossSection.cc.

83{
84 //A.R.23-Oct-2012 Shadowed variable static G4double tolerance=0.001; // Tolerance (0.1%) to consider as "the same mom"
85 static G4int j; // A#0f Z/N-records already tested in AMDB
86 static std::vector <G4int> colN; // Vector of N for calculated nuclei (isotops)
87 static std::vector <G4int> colZ; // Vector of Z for calculated nuclei (isotops)
88 static std::vector <G4double> colP; // Vector of last momenta for the reaction
89 static std::vector <G4double> colTH; // Vector of energy thresholds for the reaction
90 static std::vector <G4double> colCS; // Vector of last cross sections for the reaction
91 // ***---*** End of the mandatory Static Definitions of the Associative Memory ***---***
92#ifdef debug
93 G4cout<<"G4QKpCS::GetCS:>>> f="<<fCS<<", p="<<pMom<<", Z="<<tgZ<<"("<<lastZ<<") ,N="<<tgN
94 <<"("<<lastN<<"),PDG="<<PDG<<", thresh="<<lastTH<<",Sz="<<colN.size()<<G4endl;
95#endif
96 if(PDG!=321) G4cout<<"-Warning-G4QKaonPlusCS::GetCS:***Not a KPlus***,PDG="<<PDG<<G4endl;
97 G4bool in=false; // By default the isotope must be found in the AMDB
98 if(tgN!=lastN || tgZ!=lastZ) // The nucleus was not the last used isotope
99 {
100 in = false; // By default the isotope haven't be found in AMDB
101 lastP = 0.; // New momentum history (nothing to compare with)
102 lastN = tgN; // The last N of the calculated nucleus
103 lastZ = tgZ; // The last Z of the calculated nucleus
104 lastI = colN.size(); // Size of the Associative Memory DB in the heap
105 j = 0; // A#0f records found in DB for this projectile
106#ifdef debug
107 G4cout<<"G4QKpCS::GetCS: the amount of records in the AMDB lastI="<<lastI<<G4endl;
108#endif
109 if(lastI) for(G4int i=0; i<lastI; i++) // AMDB exists, try to find the (Z,N) isotope
110 {
111 if(colN[i]==tgN && colZ[i]==tgZ) // Try the record "i" in the AMDB
112 {
113 lastI=i; // Remember the index for future fast/last use
114 lastTH =colTH[i]; // The last THreshold (A-dependent)
115#ifdef debug
116 G4cout<<"G4QKpCS::GetCS:*Found* P="<<pMom<<",Threshold="<<lastTH<<",j="<<j<<G4endl;
117#endif
118 if(pMom<=lastTH)
119 {
120#ifdef debug
121 G4cout<<"G4QPCS::GetCS:Found,P="<<pMom<<" < Threshold="<<lastTH<<",CS=0"<<G4endl;
122#endif
123 return 0.; // Energy is below the Threshold value
124 }
125 lastP =colP [i]; // Last Momentum (A-dependent)
126 lastCS =colCS[i]; // Last CrossSect (A-dependent)
127 if(std::fabs(lastP-pMom)<tolerance*pMom)
128 //if(lastP==pMom) // VI do not use tolerance
129 {
130#ifdef debug
131 G4cout<<"..G4QKpCS::GetCS:.DoNothing.P="<<pMom<<",CS="<<lastCS*millibarn<<G4endl;
132#endif
133 //CalculateCrossSection(fCS,-1,j,321,lastZ,lastN,pMom); // Update param's only
134 return lastCS*millibarn; // Use theLastCS
135 }
136 in = true; // This is the case when the isotop is found in DB
137 // Momentum pMom is in IU ! @@ Units
138#ifdef debug
139 G4cout<<"G4QKpCS::G:UpdatDB P="<<pMom<<",f="<<fCS<<",lI="<<lastI<<",j="<<j<<G4endl;
140#endif
141 lastCS=CalculateCrossSection(fCS,-1,j,321,lastZ,lastN,pMom); // read & update
142#ifdef debug
143 G4cout<<"G4QKpCS::GetCrosSec: *****> New (inDB) Calculated CS="<<lastCS<<G4endl;
144#endif
145 if(lastCS<=0. && pMom>lastTH) // Correct the threshold (@@ No intermediate Zeros)
146 {
147#ifdef debug
148 G4cout<<"G4QKpCS::GetCS: New P="<<pMom<<"(CS=0) > Threshold="<<lastTH<<G4endl;
149#endif
150 lastCS=0.;
151 lastTH=pMom;
152 }
153 break; // Go out of the LOOP
154 }
155#ifdef debug
156 G4cout<<"-->G4QKpCrossSec::GetCrosSec: pPDG=321, j="<<j<<", N="<<colN[i]
157 <<",Z["<<i<<"]="<<colZ[i]<<G4endl;
158#endif
159 j++; // Increment a#0f records found in DB
160 }
161#ifdef debug
162 G4cout<<"-?-G4QKpCS::GetCS:RC Z="<<tgZ<<",N="<<tgN<<",in="<<in<<",j="<<j<<" ?"<<G4endl;
163#endif
164 if(!in) // This isotope has not been calculated previously
165 {
166#ifdef debug
167 G4cout<<"^^^G4QKpCS::GetCS:CalcNew P="<<pMom<<", f="<<fCS<<", lastI="<<lastI<<G4endl;
168#endif
169 //!!The slave functions must provide cross-sections in millibarns (mb) !! (not in IU)
170 lastCS=CalculateCrossSection(fCS,0,j,321,lastZ,lastN,pMom); //calculate & create
171 //if(lastCS>0.) // It means that the AMBD was initialized
172 //{
173
174 lastTH = ThresholdEnergy(tgZ, tgN); // The Threshold Energy which is now the last
175#ifdef debug
176 G4cout<<"G4QKpCrossSection::GetCrossSect: NewThresh="<<lastTH<<",P="<<pMom<<G4endl;
177#endif
178 colN.push_back(tgN);
179 colZ.push_back(tgZ);
180 colP.push_back(pMom);
181 colTH.push_back(lastTH);
182 colCS.push_back(lastCS);
183#ifdef debug
184 G4cout<<"G4QKpCS::GetCrosSec:recCS="<<lastCS<<",lZ="<<lastN<<",lN="<<lastZ<<G4endl;
185#endif
186 //} // M.K. Presence of H1 with high threshold breaks the syncronization
187#ifdef pdebug
188 G4cout<<"G4QKpCS::GetCS:1st,P="<<pMom<<"(MeV),CS="<<lastCS*millibarn<<"(mb)"<<G4endl;
189#endif
190 return lastCS*millibarn;
191 } // End of creation of the new set of parameters
192 else
193 {
194#ifdef debug
195 G4cout<<"G4QKpCS::GetCS: Update lastI="<<lastI<<",j="<<j<<G4endl;
196#endif
197 colP[lastI]=pMom;
198 colCS[lastI]=lastCS;
199 }
200 } // End of parameters udate
201 else if(pMom<=lastTH)
202 {
203#ifdef debug
204 G4cout<<"G4QKpCS::GetCS: Current P="<<pMom<<" < Threshold="<<lastTH<<", CS=0"<<G4endl;
205#endif
206 return 0.; // Momentum is below the Threshold Value -> CS=0
207 }
208 else if(std::fabs(lastP-pMom)<tolerance*pMom)
209 //else if(lastP==pMom) // VI do not use tolerance
210 {
211#ifdef debug
212 G4cout<<"..G4QPCS::GetCS:OldNZ&P="<<lastP<<"="<<pMom<<",CS="<<lastCS*millibarn<<G4endl;
213#endif
214 return lastCS*millibarn; // Use theLastCS
215 }
216 else // It is the last used -> use the current tables
217 {
218#ifdef debug
219 G4cout<<"-!-G4QPCS::GetCS:UseCur P="<<pMom<<",f="<<fCS<<",I="<<lastI<<",j="<<j<<G4endl;
220#endif
221 lastCS=CalculateCrossSection(fCS,1,j,321,lastZ,lastN,pMom); // Only read and UpdateDB
222 lastP=pMom;
223 }
224#ifdef debug
225 G4cout<<"==>G4QKpCS::GetCroSec: P="<<pMom<<"(MeV),CS="<<lastCS*millibarn<<"(mb)"<<G4endl;
226#endif
227 return lastCS*millibarn;
228}
bool G4bool
Definition: G4Types.hh:67
G4double CalculateCrossSection(G4bool CS, G4int F, G4int I, G4int PDG, G4int Z, G4int N, G4double Momentum)
virtual G4double ThresholdEnergy(G4int Z, G4int N, G4int PDG=0)
static G4double tolerance

◆ GetPointer()

G4VQCrossSection * G4QKaonPlusNuclearCrossSection::GetPointer ( )
static

Definition at line 63 of file G4QKaonPlusNuclearCrossSection.cc.

64{
65 static G4QKaonPlusNuclearCrossSection theCrossSection; //**Static body of Cross Section**
66 return &theCrossSection;
67}

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


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