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

#include <G4QNeutronNuclearCrossSection.hh>

+ Inheritance diagram for G4QNeutronNuclearCrossSection:

Public Member Functions

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

 G4QNeutronNuclearCrossSection ()
 
- 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 48 of file G4QNeutronNuclearCrossSection.hh.

Constructor & Destructor Documentation

◆ G4QNeutronNuclearCrossSection()

G4QNeutronNuclearCrossSection::G4QNeutronNuclearCrossSection ( )
inlineprotected

Definition at line 52 of file G4QNeutronNuclearCrossSection.hh.

52{}

◆ ~G4QNeutronNuclearCrossSection()

G4QNeutronNuclearCrossSection::~G4QNeutronNuclearCrossSection ( )

Definition at line 70 of file G4QNeutronNuclearCrossSection.cc.

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

Member Function Documentation

◆ CalculateCrossSection()

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

Implements G4VQCrossSection.

Definition at line 232 of file G4QNeutronNuclearCrossSection.cc.

234{
235 static const G4double THmin=1.; // default minimum Momentum (MeV/c) Threshold
236 static const G4double THmiG=THmin*.001; // minimum Momentum (GeV/c) Threshold
237 static const G4double dP=10.; // step for the LEN (Low ENergy) table MeV/c
238 static const G4double dPG=dP*.001; // step for the LEN (Low ENergy) table GeV/c
239 static const G4int nL=105; // A#of LEN points in E (step 10 MeV/c)
240 static const G4double Pmin=THmin+(nL-1)*dP; // minP for the HighE part with safety
241 static const G4double Pmax=227000.; // maxP for the HEN (High ENergy) part 227 GeV
242 static const G4int nH=224; // A#of HEN points in lnE
243 static const G4double milP=std::log(Pmin);// Low logarithm energy for the HEN part
244 static const G4double malP=std::log(Pmax);// High logarithm energy (each 2.75 percent)
245 static const G4double dlP=(malP-milP)/(nH-1); // Step in log energy in the HEN part
246 static const G4double milPG=std::log(.001*Pmin);// Low logarithmEnergy for HEN part GeV/c
247 //
248 // Associative memory for acceleration
249 //static std::vector <G4double> spA; // shadowing coefficients (A-dependent)
250#ifdef debug
251 G4cout<<"G4QNeutNCS::CalCS:N="<<targN<<",Z="<<targZ<<",P="<<Momentum<<">"<<THmin<<G4endl;
252#endif
253 G4double sigma=0.;
254 if(F&&I) sigma=0.; // @@ *!* Fake line *!* to use F & I !!!Temporary!!!
255 //G4double A=targN+targZ; // A of the target
256#ifdef debug
257 G4cout<<"G4QNeutNucCS::CalCS: A="<<A<<",F="<<F<<",I="<<I<<",nL="<<nL<<",nH="<<nH<<G4endl;
258#endif
259 if(F<=0) // This isotope was not the last used isotop
260 {
261 if(F<0) // This isotope was found in DAMDB =-----=> RETRIEVE
262 {
263 G4int sync=LEN->size();
264 if(sync<=I) G4cerr<<"*!*G4QNetronNuclCS::CalcCrossSect:Sync="<<sync<<"<="<<I<<G4endl;
265 lastLEN=(*LEN)[I]; // Pointer to prepared LowEnergy cross sections
266 lastHEN=(*HEN)[I]; // Pointer to prepared High Energy cross sections
267 }
268 else // This isotope wasn't calculated before => CREATE
269 {
270 lastLEN = new G4double[nL]; // Allocate memory for the new LEN cross sections
271 lastHEN = new G4double[nH]; // Allocate memory for the new HEN cross sections
272 // --- Instead of making a separate function ---
273 G4double P=THmiG; // Table threshold in GeV/c
274 for(G4int n=0; n<nL; n++)
275 {
276 lastLEN[n] = CrossSectionLin(targZ, targN, P);
277#ifdef debug
278 G4cout<<"-Li->G4QNeutNucCS::CalcCS: P="<<P<<", S="<<lastLEN[n]<<G4endl;
279#endif
280 P+=dPG;
281 }
282 G4double lP=milPG;
283 for(G4int n=0; n<nH; n++)
284 {
285 lastHEN[n] = CrossSectionLog(targZ, targN, lP);
286#ifdef debug
287 G4cout<<"-Li->G4QNeutNucCS::CalcCS: lP="<<lP<<", S="<<lastHEN[n]<<G4endl;
288#endif
289 lP+=dlP;
290 }
291 // --- End of possible separate function
292 // *** The synchronization check ***
293 G4int sync=LEN->size();
294#ifdef debug
295 G4cout<<"-*->G4QNeutNCS::CCS:Z="<<targZ<<",N="<<targN<<",I="<<I<<",S="<<sync<<G4endl;
296#endif
297 if(sync!=I)
298 {
299 G4cerr<<"***G4QNetronNuclearCS::CalcCrossSect: Sync="<<sync<<"#"<<I<<", Z=" <<targZ
300 <<", N="<<targN<<", F="<<F<<G4endl;
301 //G4Exception("G4ProtonNuclearCS::CalculateCS:","39",FatalException,"overflow DB");
302 }
303 LEN->push_back(lastLEN); // remember the Low Energy Table
304 HEN->push_back(lastHEN); // remember the High Energy Table
305 } // End of creation of the new set of parameters
306 } // End of parameters udate
307 // =------------------= NOW the Magic Formula =---------------------------=
308#ifdef debug
309 G4cout<<"G4QNeutCS::CalcCS:lTH="<<lastTH<<",Pi="<<Pmin<<",dP="<<dP<<",dlP="<<dlP<<G4endl;
310#endif
311 if (Momentum<lastTH) return 0.; // It must be already checked in the interface class
312 else if (Momentum<Pmin) // High Energy region
313 {
314#ifdef debug
315 G4cout<<"G4QNeutCS::CalcCS:bLEN nL="<<nL<<",TH="<<THmin<<",dP="<<dP<<G4endl;
316#endif
317 sigma=EquLinearFit(Momentum,nL,THmin,dP,lastLEN);
318#ifdef debugn
319 if(sigma<0.)
320 G4cout<<"G4QNeutCS::CalcCS: E="<<Momentum<<",T="<<THmin<<",dP="<<dP<<G4endl;
321#endif
322 }
323 else if (Momentum<Pmax) // High Energy region
324 {
325 G4double lP=std::log(Momentum);
326#ifdef debug
327 G4cout<<"G4QProtNucCS::CalcCS: before HEN nH="<<nH<<",iE="<<milP<<",dlP="<<dlP<<G4endl;
328#endif
329 sigma=EquLinearFit(lP,nH,milP,dlP,lastHEN);
330 }
331 else // UHE region (calculation, not frequent)
332 {
333 G4double P=0.001*Momentum; // Approximation formula is for P in GeV/c
334 sigma=CrossSectionFormula(targZ, targN, P, std::log(P));
335 }
336#ifdef debug
337 G4cout<<"G4QNeutronNuclearCrossSection::CalcCS: CS="<<sigma<<G4endl;
338#endif
339 if(sigma<0.) return 0.;
340 return sigma;
341}
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 G4QNeutronNuclearCrossSection::GetCrossSection ( G4bool  fCS,
G4double  pMom,
G4int  tgZ,
G4int  tgN,
G4int  pPDG = 2112 
)
virtual

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

Reimplemented from G4VQCrossSection.

Definition at line 82 of file G4QNeutronNuclearCrossSection.cc.

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

Definition at line 64 of file G4QNeutronNuclearCrossSection.cc.

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

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


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