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

#include <G4QNeutronElasticCrossSection.hh>

+ Inheritance diagram for G4QNeutronElasticCrossSection:

Public Member Functions

 ~G4QNeutronElasticCrossSection ()
 
virtual G4double GetCrossSection (G4bool fCS, G4double pMom, G4int tgZ, G4int tgN, G4int pPDG=2112)
 
G4double CalculateCrossSection (G4bool CS, G4int F, G4int I, G4int pPDG, G4int Z, G4int N, G4double pP)
 
G4double GetSlope (G4int tZ, G4int tN, G4int pPDG)
 
G4double GetExchangeT (G4int tZ, G4int tN, G4int pPDG)
 
G4double GetHMaxT ()
 
- 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

 G4QNeutronElasticCrossSection ()
 
- 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 47 of file G4QNeutronElasticCrossSection.hh.

Constructor & Destructor Documentation

◆ G4QNeutronElasticCrossSection()

G4QNeutronElasticCrossSection::G4QNeutronElasticCrossSection ( )
protected

Definition at line 100 of file G4QNeutronElasticCrossSection.cc.

101{
102}

◆ ~G4QNeutronElasticCrossSection()

G4QNeutronElasticCrossSection::~G4QNeutronElasticCrossSection ( )

Definition at line 104 of file G4QNeutronElasticCrossSection.cc.

105{
106 std::vector<G4double*>::iterator pos;
107 for (pos=CST.begin(); pos<CST.end(); pos++)
108 { delete [] *pos; }
109 CST.clear();
110 for (pos=PAR.begin(); pos<PAR.end(); pos++)
111 { delete [] *pos; }
112 PAR.clear();
113 for (pos=SST.begin(); pos<SST.end(); pos++)
114 { delete [] *pos; }
115 SST.clear();
116 for (pos=S1T.begin(); pos<S1T.end(); pos++)
117 { delete [] *pos; }
118 S1T.clear();
119 for (pos=B1T.begin(); pos<B1T.end(); pos++)
120 { delete [] *pos; }
121 B1T.clear();
122 for (pos=S2T.begin(); pos<S2T.end(); pos++)
123 { delete [] *pos; }
124 S2T.clear();
125 for (pos=B2T.begin(); pos<B2T.end(); pos++)
126 { delete [] *pos; }
127 B2T.clear();
128 for (pos=S3T.begin(); pos<S3T.end(); pos++)
129 { delete [] *pos; }
130 S3T.clear();
131 for (pos=B3T.begin(); pos<B3T.end(); pos++)
132 { delete [] *pos; }
133 B3T.clear();
134 for (pos=S4T.begin(); pos<S4T.end(); pos++)
135 { delete [] *pos; }
136 S4T.clear();
137 for (pos=B4T.begin(); pos<B4T.end(); pos++)
138 { delete [] *pos; }
139 B4T.clear();
140}

Member Function Documentation

◆ CalculateCrossSection()

G4double G4QNeutronElasticCrossSection::CalculateCrossSection ( G4bool  CS,
G4int  F,
G4int  I,
G4int  pPDG,
G4int  Z,
G4int  N,
G4double  pP 
)
virtual

Implements G4VQCrossSection.

Definition at line 286 of file G4QNeutronElasticCrossSection.cc.

288{
289 // *** Begin of Associative Memory DB for acceleration of the cross section calculations
290 static std::vector <G4double> PIN; // Vector of max initialized log(P) in the table
291 // *** End of Static Definitions (Associative Memory Data Base) ***
292 G4double pMom=pIU/GeV; // All calculations are in GeV
293 onlyCS=CS; // Flag to calculate only CS (not Si/Bi)
294#ifdef debug
295 G4cout<<"G4QNeutronElasticCrosS::CalcCS:->onlyCS="<<onlyCS<<",F="<<F<<",p="<<pIU<<G4endl;
296#endif
297 lastLP=std::log(pMom); // Make a logarithm of the momentum for calculation
298 if(F) // This isotope was found in AMDB =>RETRIEVE/UPDATE
299 {
300 if(F<0) // the AMDB must be loded
301 {
302 lastPIN = PIN[I]; // Max log(P) initialised for this table set
303 lastPAR = PAR[I]; // Pointer to the parameter set
304 lastCST = CST[I]; // Pointer to the total sross-section table
305 lastSST = SST[I]; // Pointer to the first squared slope
306 lastS1T = S1T[I]; // Pointer to the first mantissa
307 lastB1T = B1T[I]; // Pointer to the first slope
308 lastS2T = S2T[I]; // Pointer to the second mantissa
309 lastB2T = B2T[I]; // Pointer to the second slope
310 lastS3T = S3T[I]; // Pointer to the third mantissa
311 lastB3T = B3T[I]; // Pointer to the rhird slope
312 lastS4T = S4T[I]; // Pointer to the 4-th mantissa
313 lastB4T = B4T[I]; // Pointer to the 4-th slope
314#ifdef debug
315 G4cout<<"G4QNElasticCS::CalcCS: DB is updated for I="<<I<<",*,PIN4="<<PIN[4]<<G4endl;
316#endif
317 }
318#ifdef debug
319 G4cout<<"G4QNeutronElasticCrosS::CalcCS:*read*, LP="<<lastLP<<",PIN="<<lastPIN<<G4endl;
320#endif
321 if(lastLP>lastPIN && lastLP<lPMax)
322 {
323 lastPIN=GetPTables(lastLP,lastPIN,PDG,tgZ,tgN);// Can update upper logP-Limit in tabs
324#ifdef debug
325 G4cout<<"G4QNElCrS::CalcCS:updated(I),LP="<<lastLP<<"<IN["<<I<<"]="<<lastPIN<<G4endl;
326#endif
327 PIN[I]=lastPIN; // Remember the new P-Limit of the tables
328 }
329 }
330 else // This isotope wasn't initialized => CREATE
331 {
332 lastPAR = new G4double[nPoints]; // Allocate memory for parameters of CS function
333 lastPAR[nLast]=0; // Initialization for VALGRIND
334 lastCST = new G4double[nPoints]; // Allocate memory for Tabulated CS function
335 lastSST = new G4double[nPoints]; // Allocate memory for Tabulated first sqaredSlope
336 lastS1T = new G4double[nPoints]; // Allocate memory for Tabulated first mantissa
337 lastB1T = new G4double[nPoints]; // Allocate memory for Tabulated first slope
338 lastS2T = new G4double[nPoints]; // Allocate memory for Tabulated second mantissa
339 lastB2T = new G4double[nPoints]; // Allocate memory for Tabulated second slope
340 lastS3T = new G4double[nPoints]; // Allocate memory for Tabulated third mantissa
341 lastB3T = new G4double[nPoints]; // Allocate memory for Tabulated third slope
342 lastS4T = new G4double[nPoints]; // Allocate memory for Tabulated 4-th mantissa
343 lastB4T = new G4double[nPoints]; // Allocate memory for Tabulated 4-th slope
344#ifdef debug
345 G4cout<<"G4QNeutronElasticCrosS::CalcCS:*ini*,lastLP="<<lastLP<<",min="<<lPMin<<G4endl;
346#endif
347 lastPIN = GetPTables(lastLP,lPMin,PDG,tgZ,tgN); // Returns the new P-limit for tables
348#ifdef debug
349 G4cout<<"G4QNElCS::CalcCS:i,Z="<<tgZ<<",N="<<tgN<<",PDG="<<PDG<<",LP"<<lastPIN<<G4endl;
350#endif
351 PIN.push_back(lastPIN); // Fill parameters of CS function to AMDB
352 PAR.push_back(lastPAR); // Fill parameters of CS function to AMDB
353 CST.push_back(lastCST); // Fill Tabulated CS function to AMDB
354 SST.push_back(lastSST); // Fill Tabulated first sq.slope to AMDB
355 S1T.push_back(lastS1T); // Fill Tabulated first mantissa to AMDB
356 B1T.push_back(lastB1T); // Fill Tabulated first slope to AMDB
357 S2T.push_back(lastS2T); // Fill Tabulated second mantissa to AMDB
358 B2T.push_back(lastB2T); // Fill Tabulated second slope to AMDB
359 S3T.push_back(lastS3T); // Fill Tabulated third mantissa to AMDB
360 B3T.push_back(lastB3T); // Fill Tabulated third slope to AMDB
361 S4T.push_back(lastS4T); // Fill Tabulated 4-th mantissa to AMDB
362 B4T.push_back(lastB4T); // Fill Tabulated 4-th slope to AMDB
363 } // End of creation/update of the new set of parameters and tables
364 // =-------= NOW Update (if necessary) and Calculate the Cross Section =---------=
365#ifdef debug
366 G4cout<<"G4QNElCrS::CalcCS:?update?,LP="<<lastLP<<",IN="<<lastPIN<<",ML="<<lPMax<<G4endl;
367#endif
368 if(lastLP>lastPIN && lastLP<lPMax)
369 {
370 lastPIN = GetPTables(lastLP,lastPIN,PDG,tgZ,tgN);
371#ifdef debug
372 G4cout<<"G4QNeutronElCrS::CalcCS:*updated(O)*, LP="<<lastLP<<" < IN="<<lastPIN<<G4endl;
373#endif
374 }
375#ifdef debug
376 G4cout<<"G4QNEltCrS::CalcCS: lastLP="<<lastLP<<",lPM="<<lPMin<<",lPIN="<<lastPIN<<G4endl;
377#endif
378 if(!onlyCS) lastTM=GetQ2max(PDG, tgZ, tgN, pMom); // Calculate (-t)_max=Q2_max (GeV2)
379#ifdef debug
380 G4cout<<"G4QNeutElastCroSec::CalcCS:oCS="<<onlyCS<<",-t="<<lastTM<<",p="<<lastLP<<G4endl;
381#endif
382 if(lastLP>lPMin && lastLP<=lastPIN) // Linear fit is made using precalculated tables
383 {
384 if(lastLP==lastPIN)
385 {
386 G4double shift=(lastLP-lPMin)/dlnP+.000001; // Log distance from lPMin
387 G4int blast=static_cast<int>(shift); // this is a bin number of the lower edge (0)
388 if(blast<0 || blast>=nLast) G4cout<<"G4QNeutElCS::CCS:b="<<blast<<","<<nLast<<G4endl;
389 lastSIG = lastCST[blast];
390 if(!onlyCS) // Skip the differential cross-section parameters
391 {
392 theSS = lastSST[blast];
393 theS1 = lastS1T[blast];
394 theB1 = lastB1T[blast];
395 theS2 = lastS2T[blast];
396 theB2 = lastB2T[blast];
397 theS3 = lastS3T[blast];
398 theB3 = lastB3T[blast];
399 theS4 = lastS4T[blast];
400 theB4 = lastB4T[blast];
401 }
402#ifdef debug
403 G4cout<<"G4QNeutronElasticCrossSection::CalcCS:(E)S1="<<theS1<<",B1="<<theB1<<G4endl;
404#endif
405 }
406 else
407 {
408 G4double shift=(lastLP-lPMin)/dlnP; // a shift from the beginning of the table
409 G4int blast=static_cast<int>(shift); // the lower bin number
410 if(blast<0) blast=0;
411 if(blast>=nLast) blast=nLast-1; // low edge of the last bin
412 shift-=blast; // step inside the unit bin
413 G4int lastL=blast+1; // the upper bin number
414 G4double SIGL=lastCST[blast]; // the basic value of the cross-section
415 lastSIG= SIGL+shift*(lastCST[lastL]-SIGL); // calculated total elastic cross-section
416#ifdef debug
417 G4cout<<"G4QNeutronElCS::CalcCrossSection: Sig="<<lastSIG<<", P="<<pMom<<", Z="<<tgZ
418 <<", N="<<tgN<<", PDG="<<PDG<<", onlyCS="<<onlyCS<<G4endl;
419#endif
420 if(!onlyCS) // Skip the differential cross-section parameters
421 {
422 G4double SSTL=lastSST[blast]; // the low bin of the first squared slope
423 theSS=SSTL+shift*(lastSST[lastL]-SSTL); // the basic value of the first sq.slope
424 G4double S1TL=lastS1T[blast]; // the low bin of the first mantissa
425 theS1=S1TL+shift*(lastS1T[lastL]-S1TL); // the basic value of the first mantissa
426 G4double B1TL=lastB1T[blast]; // the low bin of the first slope
427#ifdef debug
428 G4cout<<"G4QNeutronElCrS::CalcCrossSection:bl="<<blast<<",ls="<<lastL<<",SL="<<S1TL
429 <<",SU="<<lastS1T[lastL]<<",BL="<<B1TL<<",BU="<<lastB1T[lastL]<<G4endl;
430#endif
431 theB1=B1TL+shift*(lastB1T[lastL]-B1TL); // the basic value of the first slope
432 G4double S2TL=lastS2T[blast]; // the low bin of the second mantissa
433 theS2=S2TL+shift*(lastS2T[lastL]-S2TL); // the basic value of the second mantissa
434 G4double B2TL=lastB2T[blast]; // the low bin of the second slope
435 theB2=B2TL+shift*(lastB2T[lastL]-B2TL); // the basic value of the second slope
436 G4double S3TL=lastS3T[blast]; // the low bin of the third mantissa
437 theS3=S3TL+shift*(lastS3T[lastL]-S3TL); // the basic value of the third mantissa
438#ifdef debug
439 G4cout<<"G4QNElCS::CCS: s3l="<<S3TL<<",sh3="<<shift<<",s3h="<<lastS3T[lastL]<<",b="
440 <<blast<<",l="<<lastL<<G4endl;
441#endif
442 G4double B3TL=lastB3T[blast]; // the low bin of the third slope
443 theB3=B3TL+shift*(lastB3T[lastL]-B3TL); // the basic value of the third slope
444 G4double S4TL=lastS4T[blast]; // the low bin of the 4-th mantissa
445 theS4=S4TL+shift*(lastS4T[lastL]-S4TL); // the basic value of the 4-th mantissa
446#ifdef debug
447 G4cout<<"G4QNElCS::CCS: s4l="<<S4TL<<",sh4="<<shift<<",s4h="<<lastS4T[lastL]<<",b="
448 <<blast<<",l="<<lastL<<G4endl;
449#endif
450 G4double B4TL=lastB4T[blast]; // the low bin of the 4-th slope
451 theB4=B4TL+shift*(lastB4T[lastL]-B4TL); // the basic value of the 4-th slope
452 }
453#ifdef debug
454 G4cout<<"G4QNeutronElasticCrossSection::CalcCS:(I)S1="<<theS1<<",B1="<<theB1<<G4endl;
455#endif
456 }
457 }
458 else lastSIG=GetTabValues(lastLP, PDG, tgZ, tgN); // Direct calculation beyond the table
459 if(lastSIG<0.) lastSIG = 0.; // @@ a Warning print can be added
460#ifdef debug
461 G4cout<<"G4QNeutronElasticCrossSection::CalculateCS: END, onlyCS="<<onlyCS<<G4endl;
462#endif
463 return lastSIG;
464}
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout

Referenced by GetCrossSection().

◆ GetCrossSection()

G4double G4QNeutronElasticCrossSection::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 151 of file G4QNeutronElasticCrossSection.cc.

153{
154 static std::vector <G4int> colN; // Vector of N for calculated nuclei (isotops)
155 static std::vector <G4int> colZ; // Vector of Z for calculated nuclei (isotops)
156 static std::vector <G4double> colP; // Vector of last momenta for the reaction
157 static std::vector <G4double> colTH; // Vector of energy thresholds for the reaction
158 static std::vector <G4double> colCS; // Vector of last cross sections for the reaction
159 // ***---*** End of the mandatory Static Definitions of the Associative Memory ***---***
160 G4double pEn=pMom;
161 onlyCS=fCS;
162#ifdef debug
163 G4cout<<"G4QNElCS::GetCS:>>> f="<<fCS<<", p="<<pMom<<", Z="<<tgZ<<"("<<lastZ<<") ,N="
164 <<tgN<<"("<<lastN<<"), T="<<pEn<<"("<<lastTH<<")"<<",Sz="<<colN.size()<<G4endl;
165 //CalculateCrossSection(fCS,-27,j,pPDG,lastZ,lastN,pMom); // DUMMY TEST
166#endif
167 if(pPDG!=2112)
168 {
169 G4cout<<"G4QNeutronElCS::GetCS: *** Found pPDG="<<pPDG<<" =--=> CS=0"<<G4endl;
170 //CalculateCrossSection(fCS,-27,j,pPDG,lastZ,lastN,pMom); // DUMMY TEST
171 return 0.; // projectile PDG=0 is a mistake (?!) @@
172 }
173 G4bool in=false; // By default the isotope must be found in the AMDB
174 lastP = 0.; // New momentum history (nothing to compare with)
175 lastN = tgN; // The last N of the calculated nucleus
176 lastZ = tgZ; // The last Z of the calculated nucleus
177 lastI = colN.size(); // Size of the Associative Memory DB in the heap
178 if(lastI) for(G4int i=0; i<lastI; i++) // Loop over proj/tgZ/tgN lines of DB
179 { // The nucleus with projPDG is found in AMDB
180 if(colN[i]==tgN && colZ[i]==tgZ) // Isotope is foind in AMDB
181 {
182 lastI=i;
183 lastTH =colTH[i]; // Last THreshold (A-dependent)
184#ifdef debug
185 G4cout<<"G4QNeutElCS::GetCS:Found,P="<<pMom<<",Threshold="<<lastTH<<",i="<<i<<G4endl;
186 //CalculateCrossSection(fCS,-27,i,pPDG,lastZ,lastN,pMom); // DUMMY TEST
187#endif
188 if(pEn<=lastTH)
189 {
190#ifdef debug
191 G4cout<<"G4QNeutElCS::GetCS:Found,T="<<pEn<<"<Threshold="<<lastTH<<",CS=0"<<G4endl;
192 //CalculateCrossSection(fCS,-27,i,pPDG,lastZ,lastN,pMom); // DUMMY TEST
193#endif
194 return 0.; // Energy is below the Threshold value
195 }
196 lastP =colP [i]; // Last Momentum (A-dependent)
197 lastCS =colCS[i]; // Last CrossSect (A-dependent)
198 // if(std::fabs(lastP/pMom-1.)<tolerance) //VI (do not use tolerance)
199 if(lastP == pMom) // Do not recalculate
200 {
201#ifdef debug
202 G4cout<<"G4QNeutronElasticCS::GetCrosS:P="<<pMom<<",CS="<<lastCS*millibarn<<G4endl;
203#endif
204 CalculateCrossSection(fCS,-1,i,pPDG,lastZ,lastN,pMom); // Update param's only
205 return lastCS*millibarn; // Use theLastCS
206 }
207 in = true; // This is the case when the isotop is found in DB
208 // Momentum pMom is in IU ! @@ Units
209#ifdef debug
210 G4cout<<"G4QNElCrS::G:UpdateDB,P="<<pMom<<",f="<<fCS<<",I="<<lastI<<",i="<<i<<G4endl;
211#endif
212 lastCS=CalculateCrossSection(fCS,-1,i,pPDG,lastZ,lastN,pMom); // read & update
213#ifdef debug
214 G4cout<<"G4QNeutronElCS::GetCrosSec:*****>New (inDB) Calculated CS="<<lastCS<<G4endl;
215 //CalculateCrossSection(fCS,-27,i,pPDG,lastZ,lastN,pMom); // DUMMY TEST
216#endif
217 if(lastCS<=0. && pEn>lastTH) // Correct the threshold
218 {
219#ifdef debug
220 G4cout<<"G4QNeutronElCS::GetCS:New,T="<<pEn<<"(CS=0) > Threshold="<<lastTH<<G4endl;
221#endif
222 lastTH=pEn;
223 }
224 break; // Go out of the LOOP with found lastI
225 }
226#ifdef debug
227 G4cout<<"---G4QNeutronElasticCrossSection::GetCrosSec:pPDG="<<pPDG<<",i="<<i<<",N="
228 <<colN[i]<<",Z["<<i<<"]="<<colZ[i]<<G4endl;
229 //CalculateCrossSection(fCS,-27,i,pPDG,lastZ,lastN,pMom); // DUMMY TEST
230#endif
231 }
232 if(!in) // This nucleus has not been calculated previously
233 {
234#ifdef debug
235 G4cout<<"G4QNElCrS::GetCrosSec:CalcNew P="<<pMom<<",f="<<fCS<<",lastI="<<lastI<<G4endl;
236#endif
237 //!!The slave functions must provide cross-sections in millibarns (mb) !! (not in IU)
238 lastCS=CalculateCrossSection(fCS,0,lastI,pPDG,lastZ,lastN,pMom);//calculate&create
239 if(lastCS<=0.)
240 {
241 lastTH = ThresholdEnergy(tgZ, tgN); // The Threshold Energy which is now the last
242#ifdef debug
243 G4cout<<"G4QNeutronElCrosSect::GetCrossSect: NewThresh="<<lastTH<<",T="<<pEn<<G4endl;
244#endif
245 if(pEn>lastTH)
246 {
247#ifdef debug
248 G4cout<<"G4QNeutElCS::GetCS: First T="<<pEn<<"(CS=0) > Threshold="<<lastTH<<G4endl;
249#endif
250 lastTH=pEn;
251 }
252 }
253#ifdef debug
254 G4cout<<"G4QNElCrS::GetCrosSec: New CS="<<lastCS<<",lZ="<<lastN<<",lN="<<lastZ<<G4endl;
255 //CalculateCrossSection(fCS,-27,lastI,pPDG,lastZ,lastN,pMom); // DUMMY TEST
256#endif
257 colN.push_back(tgN);
258 colZ.push_back(tgZ);
259 colP.push_back(pMom);
260 colTH.push_back(lastTH);
261 colCS.push_back(lastCS);
262#ifdef debug
263 G4cout<<"G4QNElCrS::GetCS:1st,P="<<pMom<<"(MeV),CS="<<lastCS*millibarn<<"(mb)"<<G4endl;
264 //CalculateCrossSection(fCS,-27,lastI,pPDG,lastZ,lastN,pMom); // DUMMY TEST
265#endif
266 return lastCS*millibarn;
267 } // End of creation of the new set of parameters
268 else
269 {
270#ifdef debug
271 G4cout<<"G4QNeutronElasticCrossSection::GetCS: Update lastI="<<lastI<<G4endl;
272#endif
273 colP[lastI]=pMom;
274 colCS[lastI]=lastCS;
275 }
276#ifdef debug
277 G4cout<<"G4QNElCS::GetCrSec:End,P="<<pMom<<"(MeV),CS="<<lastCS*millibarn<<"(mb)"<<G4endl;
278 //CalculateCrossSection(fCS,-27,lastI,pPDG,lastZ,lastN,pMom); // DUMMY TEST
279 G4cout<<"G4QNeutronElasticCrossSection::GetCrSec:***End***, onlyCS="<<onlyCS<<G4endl;
280#endif
281 return lastCS*millibarn;
282}
bool G4bool
Definition: G4Types.hh:67
G4double CalculateCrossSection(G4bool CS, G4int F, G4int I, G4int pPDG, G4int Z, G4int N, G4double pP)
virtual G4double ThresholdEnergy(G4int Z, G4int N, G4int PDG=0)

◆ GetExchangeT()

G4double G4QNeutronElasticCrossSection::GetExchangeT ( G4int  tZ,
G4int  tN,
G4int  pPDG 
)
virtual

Reimplemented from G4VQCrossSection.

Definition at line 1997 of file G4QNeutronElasticCrossSection.cc.

1998{
1999 static const G4double GeVSQ=gigaelectronvolt*gigaelectronvolt;
2000 static const G4double third=1./3.;
2001 static const G4double fifth=1./5.;
2002 static const G4double sevth=1./7.;
2003#ifdef tdebug
2004 G4cout<<"G4QNeutElCrS::GetExcT:F="<<onlyCS<<",Z="<<tgZ<<",N="<<tgN<<",PDG="<<PDG<<G4endl;
2005#endif
2006 if(PDG!=2112) G4cout<<"*Warning*G4QNeutronElasticCrossSection::GetExT:PDG="<<PDG<<G4endl;
2007 if(onlyCS) G4cout<<"*Warning*G4QNeutronElasticCrossSection::GetExchangeT:onCS=1"<<G4endl;
2008 if(lastLP<-4.3) return lastTM*GeVSQ*G4UniformRand();// S-wave for p<14 MeV/c (kinE<.1MeV)
2009 G4double q2=0.;
2010 if(tgZ==1 && tgN==0) // ===> n+p=n+p
2011 {
2012#ifdef tdebug
2013 G4cout<<"G4QNeutronElasticCrS::GetExchangeT: TM="<<lastTM<<",S1="<<theS1<<",B1="<<theB1
2014 <<",S2="<<theS2<<",B2="<<theB2<<",GeV2="<<GeVSQ<<G4endl;
2015#endif
2016 G4double E1=lastTM*theB1;
2017 G4double R1=(1.-std::exp(-E1));
2018#ifdef tdebug
2019 G4double ts1=-std::log(1.-R1)/theB1;
2020 G4double ds1=std::fabs(ts1-lastTM)/lastTM;
2021 if(ds1>.0001)
2022 G4cout<<"*Warning*G4QNeutronElasticCrossSection::GetExT:1n "<<ts1<<"#"<<lastTM<<",d="
2023 <<ds1<<",R1="<<R1<<",E1="<<E1<<G4endl;
2024#endif
2025 G4double E2=lastTM*theB2;
2026 G4double R2=(1.-std::exp(-E2));
2027#ifdef tdebug
2028 G4double ts2=-std::log(1.-R2)/theB2;
2029 G4double ds2=std::fabs(ts2-lastTM)/lastTM;
2030 if(ds2>.0001)
2031 G4cout<<"*Warning*G4QNeutronElasticCrossSection::GetExT:2n "<<ts2<<"#"<<lastTM<<",d="
2032 <<ds2<<",R2="<<R2<<",E2="<<E2<<G4endl;
2033#endif
2034 //G4double E3=lastTM*theB3;
2035 //G4double R3=(1.-std::exp(-E3));
2036#ifdef tdebug
2037 //G4double ts3=-std::log(1.-R3)/theB3;
2038 //G4double ds3=std::fabs(ts3-lastTM)/lastTM;
2039 //if(ds3>.01)G4cout<<"Warn*G4QNElCS::GetExT:3n="<<ts3<<"#"<<lastTM<<",d="<<ds3<<G4endl;
2040#endif
2041 G4double I1=R1*theS1;
2042 G4double I2=R2*theS2/theB2;
2043 //G4double I3=R3*theS3/theB3;
2044 G4double I12=I1+I2;
2045 //G4double rand=(I12+I3)*G4UniformRand();
2046 G4double rand=I12*G4UniformRand();
2047 if (rand<I1 )
2048 {
2049 G4double ran=R1*G4UniformRand();
2050 if(ran>1.) ran=1.;
2051 q2=-std::log(1.-ran)/theB1; // t-chan
2052 }
2053 else
2054 {
2055 G4double ran=R2*G4UniformRand();
2056 if(ran>1.) ran=1.;
2057 q2=lastTM+std::log(1.-ran)/theB2; // u-chan (ChEx)
2058 }
2059 }
2060 else
2061 {
2062 G4double a=tgZ+tgN;
2063#ifdef tdebug
2064 G4cout<<"G4QNeutronElCroSec::GetExT:a="<<a<<",t="<<lastTM<<",S1="<<theS1<<",B1="<<theB1
2065 <<",SS="<<theSS<<",S2="<<theS2<<",B2="<<theB2<<",S3="<<theS3<<",B3="<<theB3
2066 <<",S4="<<theS4<<",B4="<<theB4<<G4endl;
2067#endif
2068 G4double E1=lastTM*(theB1+lastTM*theSS);
2069 G4double R1=(1.-std::exp(-E1));
2070 G4double tss=theSS+theSS; // for future solution of quadratic equation (imediate check)
2071#ifdef tdebug
2072 G4double ts1=-std::log(1.-R1)/theB1;
2073 if(std::fabs(tss)>1.e-7) ts1=(std::sqrt(theB1*(theB1+(tss+tss)*ts1))-theB1)/tss;
2074 G4double ds1=(ts1-lastTM)/lastTM;
2075 if(ds1>.0001)
2076 G4cout<<"*Warning*G4QNeutronElasticCrossSection::GetExT:1a "<<ts1<<"#"<<lastTM<<",d="
2077 <<ds1<<",R1="<<R1<<",E1="<<E1<<G4endl;
2078#endif
2079 G4double tm2=lastTM*lastTM;
2080 G4double E2=lastTM*tm2*theB2; // power 3 for lowA, 5 for HighA (1st)
2081 if(a>6.5)E2*=tm2; // for heavy nuclei
2082 G4double R2=(1.-std::exp(-E2));
2083#ifdef tdebug
2084 G4double ts2=-std::log(1.-R2)/theB2;
2085 if(a<6.5)ts2=std::pow(ts2,third);
2086 else ts2=std::pow(ts2,fifth);
2087 G4double ds2=std::fabs(ts2-lastTM)/lastTM;
2088 if(ds2>.0001)
2089 G4cout<<"*Warning*G4QNeutronElasticCrossSection::GetExT:2a "<<ts2<<"#"<<lastTM<<",d="
2090 <<ds2<<",R2="<<R2<<",E2="<<E2<<G4endl;
2091#endif
2092 G4double E3=lastTM*theB3;
2093 if(a>6.5)E3*=tm2*tm2*tm2; // power 1 for lowA, 7 (2nd) for HighA
2094 G4double R3=(1.-std::exp(-E3));
2095#ifdef tdebug
2096 G4double ts3=-std::log(1.-R3)/theB3;
2097 if(a>6.5)ts3=std::pow(ts3,sevth);
2098 G4double ds3=std::fabs(ts3-lastTM)/lastTM;
2099 if(ds3>.0001)
2100 G4cout<<"*Warning*G4QNeutronElasticCrossSection::GetExT:3a "<<ts3<<"#"<<lastTM<<",d="
2101 <<ds3<<",R3="<<R3<<",E3="<<E3<<G4endl;
2102#endif
2103 G4double E4=lastTM*theB4;
2104 G4double R4=(1.-std::exp(-E4));
2105#ifdef tdebug
2106 G4double ts4=-std::log(1.-R4)/theB4;
2107 G4double ds4=std::fabs(ts4-lastTM)/lastTM;
2108 if(ds4>.0001)
2109 G4cout<<"*Warning*G4QNeutronElasticCrissSection::GetExT:4a "<<ts4<<"#"<<lastTM<<",d="
2110 <<ds4<<",R4="<<R4<<",E4="<<E4<<G4endl;
2111#endif
2112 G4double I1=R1*theS1;
2113 G4double I2=R2*theS2;
2114 G4double I3=R3*theS3;
2115 G4double I4=R4*theS4;
2116 G4double I12=I1+I2;
2117 G4double I13=I12+I3;
2118 G4double rand=(I13+I4)*G4UniformRand();
2119#ifdef tdebug
2120 G4cout<<"G4QNElCS::GtExT:1="<<I1<<",2="<<I2<<",3="<<I3<<",4="<<I4<<",r="<<rand<<G4endl;
2121#endif
2122 if(rand<I1)
2123 {
2124 G4double ran=R1*G4UniformRand();
2125 if(ran>1.) ran=1.;
2126 q2=-std::log(1.-ran)/theB1;
2127 if(std::fabs(tss)>1.e-7) q2=(std::sqrt(theB1*(theB1+(tss+tss)*q2))-theB1)/tss;
2128#ifdef tdebug
2129 G4cout<<"G4QNElCS::GetET:Q2="<<q2<<",ss="<<tss/2<<",b1="<<theB1<<",t1="<<ts1<<G4endl;
2130#endif
2131 }
2132 else if(rand<I12)
2133 {
2134 G4double ran=R2*G4UniformRand();
2135 if(ran>1.) ran=1.;
2136 q2=-std::log(1.-ran)/theB2;
2137 if(q2<0.) q2=0.;
2138 if(a<6.5) q2=std::pow(q2,third);
2139 else q2=std::pow(q2,fifth);
2140#ifdef tdebug
2141 G4cout<<"G4QNElCS::GetExT: Q2="<<q2<<",r2="<<R2<<", b2="<<theB2<<",t2="<<ts2<<G4endl;
2142#endif
2143 }
2144 else if(rand<I13)
2145 {
2146 G4double ran=R3*G4UniformRand();
2147 if(ran>1.) ran=1.;
2148 q2=-std::log(1.-ran)/theB3;
2149 if(q2<0.) q2=0.;
2150 if(a>6.5) q2=std::pow(q2,sevth);
2151#ifdef tdebug
2152 G4cout<<"G4QNElCS::GetExT:Q2="<<q2<<", r3="<<R2<<", b3="<<theB2<<",t3="<<ts2<<G4endl;
2153#endif
2154 }
2155 else
2156 {
2157 G4double ran=R4*G4UniformRand();
2158 if(ran>1.) ran=1.;
2159 q2=-std::log(1.-ran)/theB4;
2160 if(a<6.5) q2=lastTM-q2; // u reduced for lightA (starts from 0)
2161#ifdef tdebug
2162 G4cout<<"G4QNElCS::GetET:Q2="<<q2<<",m="<<lastTM<<",b4="<<theB3<<",t4="<<ts3<<G4endl;
2163#endif
2164 }
2165 }
2166 if(q2<0.) q2=0.;
2167 if(!(q2>=-1.||q2<=1.)) G4cout<<"*NAN*G4QNeutronElCroSect::GetExchangeT: -t="<<q2<<G4endl;
2168 if(q2>lastTM)
2169 {
2170#ifdef tdebug
2171 G4cout<<"*Warning*G4QNeutronElasticCrossSection::GetExT:-t="<<q2<<" >"<<lastTM<<G4endl;
2172#endif
2173 q2=lastTM;
2174 }
2175 return q2*GeVSQ;
2176}
#define G4UniformRand()
Definition: Randomize.hh:53

◆ GetHMaxT()

G4double G4QNeutronElasticCrossSection::GetHMaxT ( )
virtual

Reimplemented from G4VQCrossSection.

Definition at line 2204 of file G4QNeutronElasticCrossSection.cc.

2205{
2206 static const G4double HGeVSQ=gigaelectronvolt*gigaelectronvolt/2.;
2207 return lastTM*HGeVSQ;
2208}

◆ GetPointer()

◆ GetSlope()

G4double G4QNeutronElasticCrossSection::GetSlope ( G4int  tZ,
G4int  tN,
G4int  pPDG 
)
virtual

Reimplemented from G4VQCrossSection.

Definition at line 2179 of file G4QNeutronElasticCrossSection.cc.

2180{
2181 static const G4double GeVSQ=gigaelectronvolt*gigaelectronvolt;
2182#ifdef tdebug
2183 G4cout<<"G4QNeutrElCS::GetSlope:"<<onlyCS<<", Z="<<tgZ<<",N="<<tgN<<",PDG="<<PDG<<G4endl;
2184#endif
2185 if(onlyCS) G4cout<<"Warning*G4QNeutronElasticCrossSection::GetSlope:onlyCS=true"<<G4endl;
2186 if(lastLP<-4.3) return 0.; // S-wave for p<14 MeV/c (kinE<.1MeV)
2187 if(PDG!=2112)
2188 {
2189 // G4cout<<"*Error*G4QNeutronElasticCrossSection::GetSlope: PDG="<<PDG<<", Z="<<tgZ
2190 // <<", N="<<tgN<<", while it is defined only for PDG=2112"<<G4endl;
2191 // throw G4QException("G4QNeutronElasticCrossSection::GetSlope: only nA are implemented");
2193 ed << "PDG = " << PDG << ", Z = " << tgZ << ", N = " << tgN
2194 <<", while it is defined only for PDG=2112 (n) " << G4endl;
2195 G4Exception("G4QNeutronElasticCrossSection::GetSlope()", "HAD_CHPS_0000",
2196 FatalException, ed);
2197 }
2198 if(theB1<0.) theB1=0.;
2199 if(!(theB1>=-1.||theB1<=1.))G4cout<<"*NAN*G4QNeutElasticCrosS::Getslope:"<<theB1<<G4endl;
2200 return theB1/GeVSQ;
2201}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76

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