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

#include <G4QPionMinusElasticCrossSection.hh>

+ Inheritance diagram for G4QPionMinusElasticCrossSection:

Public Member Functions

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

 G4QPionMinusElasticCrossSection ()
 
- 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 G4QPionMinusElasticCrossSection.hh.

Constructor & Destructor Documentation

◆ G4QPionMinusElasticCrossSection()

G4QPionMinusElasticCrossSection::G4QPionMinusElasticCrossSection ( )
protected

Definition at line 100 of file G4QPionMinusElasticCrossSection.cc.

101{
102}

◆ ~G4QPionMinusElasticCrossSection()

G4QPionMinusElasticCrossSection::~G4QPionMinusElasticCrossSection ( )

Definition at line 104 of file G4QPionMinusElasticCrossSection.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 G4QPionMinusElasticCrossSection::CalculateCrossSection ( G4bool  CS,
G4int  F,
G4int  I,
G4int  pPDG,
G4int  Z,
G4int  N,
G4double  pP 
)
virtual

Implements G4VQCrossSection.

Definition at line 286 of file G4QPionMinusElasticCrossSection.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 pdebug
295 G4cout<<"G4QPionPlusElasticCroS::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 pdebug
315 G4cout<<"G4QElasticCS::CalcCS: DB is updated for I="<<I<<",*,PIN4="<<PIN[4]<<G4endl;
316#endif
317 }
318#ifdef pdebug
319 G4cout<<"G4QPionPlusElasticCroS::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 pdebug
325 G4cout<<"G4QElCS::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 pdebug
345 G4cout<<"G4QPionPlusElasticCroS::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 pdebug
349 G4cout<<"G4QPiPlElCS::CCS: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 pdebug
366 G4cout<<"G4QElCS::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 pdebug
372 G4cout<<"G4QElCS::CalcCS: *updated(O)*, LP="<<lastLP<<" < IN="<<lastPIN<<G4endl;
373#endif
374 }
375#ifdef pdebug
376 G4cout<<"G4QElastCS::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 pdebug
380 G4cout<<"G4QElasticCrosSec::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<<"G4QEleastCS::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 pdebug
403 G4cout<<"G4QPionPlusElasticCroS::CalculateCS:(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 pdebug
417 G4cout<<"G4QElCS::CalcCrossSection: Sig="<<lastSIG<<", P="<<pMom<<", Z="<<tgZ<<", N="
418 <<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 pdebug
428 G4cout<<"G4QElCS::CalcCrossSection:bl="<<blast<<",ls="<<lastL<<",SL="<<S1TL<<",SU="
429 <<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 pdebug
439 G4cout<<"G4QElCS::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 pdebug
447 G4cout<<"G4QElCS::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 pdebug
454 G4cout<<"G4QPionPlusElasticCroS::CalculateCS:(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 pdebug
461 G4cout<<"G4QPionMinusElasticCrossSection::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 G4QPionMinusElasticCrossSection::GetCrossSection ( G4bool  fCS,
G4double  pMom,
G4int  tgZ,
G4int  tgN,
G4int  pPDG = 2212 
)
virtual

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

Reimplemented from G4VQCrossSection.

Definition at line 151 of file G4QPionMinusElasticCrossSection.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 pdebug
163 G4cout<<"G4QPElCS::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!=-211)
168 {
169 G4cout<<"*Warning*G4QPionPlusElCS::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 pdebug
185 G4cout<<"G4QElCS::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 pdebug
191 G4cout<<"G4QElCS::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 pdebug
202 G4cout<<"G4QElCS::GetCS: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 pdebug
210 G4cout<<"G4QElCS::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 pdebug
214 G4cout<<"G4QElCS::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 pdebug
220 G4cout<<"G4QElCS::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 pdebug
227 G4cout<<"---G4QElCrossSec::GetCrosSec:pPDG="<<pPDG<<",i="<<i<<",N="<<colN[i]
228 <<",Z["<<i<<"]="<<colZ[i]<<G4endl;
229 //CalculateCrossSection(fCS,-27,i,pPDG,lastZ,lastN,pMom); // DUMMY TEST
230#endif
231 } // End of attampt to find the nucleus in DB
232 if(!in) // This nucleus has not been calculated previously
233 {
234#ifdef pdebug
235 G4cout<<"G4QElCS::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 pdebug
243 G4cout<<"G4QElCrossSection::GetCrossSect: NewThresh="<<lastTH<<",T="<<pEn<<G4endl;
244#endif
245 if(pEn>lastTH)
246 {
247#ifdef pdebug
248 G4cout<<"G4QElCS::GetCS: First T="<<pEn<<"(CS=0) > Threshold="<<lastTH<<G4endl;
249#endif
250 lastTH=pEn;
251 }
252 }
253#ifdef pdebug
254 G4cout<<"G4QElCS::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 pdebug
263 G4cout<<"G4QElCS::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 pdebug
271 G4cout<<"G4QElCS::GetCS: Update lastI="<<lastI<<G4endl;
272#endif
273 colP[lastI]=pMom;
274 colCS[lastI]=lastCS;
275 }
276#ifdef pdebug
277 G4cout<<"G4QElCS::GetCrSec:End,P="<<pMom<<"(MeV),CS="<<lastCS*millibarn<<"(mb)"<<G4endl;
278 //CalculateCrossSection(fCS,-27,lastI,pPDG,lastZ,lastN,pMom); // DUMMY TEST
279 G4cout<<"G4QElCS::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 G4QPionMinusElasticCrossSection::GetExchangeT ( G4int  tZ,
G4int  tN,
G4int  pPDG 
)
virtual

Reimplemented from G4VQCrossSection.

Definition at line 734 of file G4QPionMinusElasticCrossSection.cc.

735{
736 static const G4double GeVSQ=gigaelectronvolt*gigaelectronvolt;
737 static const G4double third=1./3.;
738 static const G4double fifth=1./5.;
739 static const G4double sevth=1./7.;
740#ifdef tdebug
741 G4cout<<"G4QPiPlElCS::GetExcT: F="<<onlyCS<<",Z="<<tgZ<<",N="<<tgN<<",PDG="<<PDG<<G4endl;
742#endif
743 if(PDG!=-211)G4cout<<"Warning*G4QPionMinusElasticCrossSection::GetExT:PDG="<<PDG<<G4endl;
744 if(onlyCS)G4cout<<"Warning*G4QPionMinusElasticCrossSection::GetExchanT:onlyCS=1"<<G4endl;
745 if(lastLP<-4.3) return lastTM*GeVSQ*G4UniformRand();// S-wave for p<14 MeV/c (kinE<.1MeV)
746 G4double q2=0.;
747 if(tgZ==1 && tgN==0) // ===> p+p=p+p
748 {
749#ifdef tdebug
750 G4cout<<"G4QElasticCS::GetExchangeT: TM="<<lastTM<<",S1="<<theS1<<",B1="<<theB1<<",S2="
751 <<theS2<<",B2="<<theB2<<",S3="<<theS3<<",B3="<<theB3<<",GeV2="<<GeVSQ<<G4endl;
752#endif
753 G4double E1=lastTM*theB1;
754 G4double R1=(1.-std::exp(-E1));
755#ifdef tdebug
756 G4double ts1=-std::log(1.-R1)/theB1;
757 G4double ds1=std::fabs(ts1-lastTM)/lastTM;
758 if(ds1>.0001)
759 G4cout<<"*Warning*G4QElCS::GetExT:1p "<<ts1<<"#"<<lastTM<<",d="<<ds1
760 <<",R1="<<R1<<",E1="<<E1<<G4endl;
761#endif
762 G4double E2=lastTM*theB2;
763 G4double R2=(1.-std::exp(-E2*E2*E2));
764#ifdef tdebug
765 G4double ts2=std::pow(-std::log(1.-R2),.333333333)/theB2;
766 G4double ds2=std::fabs(ts2-lastTM)/lastTM;
767 if(ds2>.0001)
768 G4cout<<"*Warning*G4QElCS::GetExT:2p "<<ts2<<"#"<<lastTM<<",d="<<ds2
769 <<",R2="<<R2<<",E2="<<E2<<G4endl;
770#endif
771 G4double E3=lastTM*theB3;
772 G4double R3=(1.-std::exp(-E3));
773#ifdef tdebug
774 G4double ts3=-std::log(1.-R3)/theB3;
775 G4double ds3=std::fabs(ts3-lastTM)/lastTM;
776 if(ds3>.0001)
777 G4cout<<"*Warning*G4QElCS::GetExT:3p "<<ts3<<"#"<<lastTM<<",d="<<ds3
778 <<",R3="<<R1<<",E3="<<E3<<G4endl;
779#endif
780 G4double I1=R1*theS1/theB1;
781 G4double I2=R2*theS2;
782 G4double I3=R3*theS3;
783 G4double I12=I1+I2;
784 G4double rand=(I12+I3)*G4UniformRand();
785 if (rand<I1 )
786 {
787 G4double ran=R1*G4UniformRand();
788 if(ran>1.) ran=1.;
789 q2=-std::log(1.-ran)/theB1;
790 }
791 else if(rand<I12)
792 {
793 G4double ran=R2*G4UniformRand();
794 if(ran>1.) ran=1.;
795 q2=-std::log(1.-ran);
796 if(q2<0.) q2=0.;
797 q2=std::pow(q2,third)/theB2;
798 }
799 else
800 {
801 G4double ran=R3*G4UniformRand();
802 if(ran>1.) ran=1.;
803 q2=-std::log(1.-ran)/theB3;
804 }
805 }
806 else
807 {
808 G4double a=tgZ+tgN;
809#ifdef tdebug
810 G4cout<<"G4QElCS::GetExT: a="<<a<<",t="<<lastTM<<",S1="<<theS1<<",B1="<<theB1<<",SS="
811 <<theSS<<",S2="<<theS2<<",B2="<<theB2<<",S3="<<theS3<<",B3="<<theB3<<",S4="
812 <<theS4<<",B4="<<theB4<<G4endl;
813#endif
814 G4double E1=lastTM*(theB1+lastTM*theSS);
815 G4double R1=(1.-std::exp(-E1));
816 G4double tss=theSS+theSS; // for future solution of quadratic equation (imediate check)
817#ifdef tdebug
818 G4double ts1=-std::log(1.-R1)/theB1;
819 if(std::fabs(tss)>1.e-7) ts1=(std::sqrt(theB1*(theB1+(tss+tss)*ts1))-theB1)/tss;
820 G4double ds1=(ts1-lastTM)/lastTM;
821 if(ds1>.0001)
822 G4cout<<"*Warning*G4QElCS::GetExT:1a "<<ts1<<"#"<<lastTM<<",d="<<ds1
823 <<",R1="<<R1<<",E1="<<E1<<G4endl;
824#endif
825 G4double tm2=lastTM*lastTM;
826 G4double E2=lastTM*tm2*theB2; // power 3 for lowA, 5 for HighA (1st)
827 if(a>6.5)E2*=tm2; // for heavy nuclei
828 G4double R2=(1.-std::exp(-E2));
829#ifdef tdebug
830 G4double ts2=-std::log(1.-R2)/theB2;
831 if(a<6.5)ts2=std::pow(ts2,third);
832 else ts2=std::pow(ts2,fifth);
833 G4double ds2=std::fabs(ts2-lastTM)/lastTM;
834 if(ds2>.0001)
835 G4cout<<"*Warning*G4QElCS::GetExT:2a "<<ts2<<"#"<<lastTM<<",d="<<ds2
836 <<",R2="<<R2<<",E2="<<E2<<G4endl;
837#endif
838 G4double E3=lastTM*theB3;
839 if(a>6.5)E3*=tm2*tm2*tm2; // power 1 for lowA, 7 (2nd) for HighA
840 G4double R3=(1.-std::exp(-E3));
841#ifdef tdebug
842 G4double ts3=-std::log(1.-R3)/theB3;
843 if(a>6.5)ts3=std::pow(ts3,sevth);
844 G4double ds3=std::fabs(ts3-lastTM)/lastTM;
845 if(ds3>.0001)
846 G4cout<<"*Warning*G4QElCS::GetExT:3a "<<ts3<<"#"<<lastTM<<",d="<<ds3
847 <<",R3="<<R3<<",E3="<<E3<<G4endl;
848#endif
849 G4double E4=lastTM*theB4;
850 G4double R4=(1.-std::exp(-E4));
851#ifdef tdebug
852 G4double ts4=-std::log(1.-R4)/theB4;
853 G4double ds4=std::fabs(ts4-lastTM)/lastTM;
854 if(ds4>.0001)
855 G4cout<<"*Warning*G4QElCS::GetExT:4a "<<ts4<<"#"<<lastTM<<",d="<<ds4
856 <<",R4="<<R4<<",E4="<<E4<<G4endl;
857#endif
858 G4double I1=R1*theS1;
859 G4double I2=R2*theS2;
860 G4double I3=R3*theS3;
861 G4double I4=R4*theS4;
862 G4double I12=I1+I2;
863 G4double I13=I12+I3;
864 G4double rand=(I13+I4)*G4UniformRand();
865#ifdef tdebug
866 G4cout<<"G4QElCS::GtExT:1="<<I1<<",2="<<I2<<",3="<<I3<<",4="<<I4<<",r="<<rand<<G4endl;
867#endif
868 if(rand<I1)
869 {
870 G4double ran=R1*G4UniformRand();
871 if(ran>1.) ran=1.;
872 q2=-std::log(1.-ran)/theB1;
873 if(std::fabs(tss)>1.e-7) q2=(std::sqrt(theB1*(theB1+(tss+tss)*q2))-theB1)/tss;
874#ifdef tdebug
875 G4cout<<"G4QElCS::GetExT:Q2="<<q2<<",ss="<<tss/2<<",b1="<<theB1<<",t1="<<ts1<<G4endl;
876#endif
877 }
878 else if(rand<I12)
879 {
880 G4double ran=R2*G4UniformRand();
881 if(ran>1.) ran=1.;
882 q2=-std::log(1.-ran)/theB2;
883 if(q2<0.) q2=0.;
884 if(a<6.5) q2=std::pow(q2,third);
885 else q2=std::pow(q2,fifth);
886#ifdef tdebug
887 G4cout<<"G4QElCS::GetExT: Q2="<<q2<<", r2="<<R2<<", b2="<<theB2<<",t2="<<ts2<<G4endl;
888#endif
889 }
890 else if(rand<I13)
891 {
892 G4double ran=R3*G4UniformRand();
893 if(ran>1.) ran=1.;
894 q2=-std::log(1.-ran)/theB3;
895 if(q2<0.) q2=0.;
896 if(a>6.5) q2=std::pow(q2,sevth);
897#ifdef tdebug
898 G4cout<<"G4QElCS::GetExT:Q2="<<q2<<", r3="<<R2<<", b3="<<theB2<<",t3="<<ts2<<G4endl;
899#endif
900 }
901 else
902 {
903 G4double ran=R4*G4UniformRand();
904 if(ran>1.) ran=1.;
905 q2=-std::log(1.-ran)/theB4;
906 if(a<6.5) q2=lastTM-q2; // u reduced for lightA (starts from 0)
907#ifdef tdebug
908 G4cout<<"G4QElCS::GetExT:Q2="<<q2<<",m="<<lastTM<<",b4="<<theB3<<",t4="<<ts3<<G4endl;
909#endif
910 }
911 }
912 if(q2<0.) q2=0.;
913 if(!(q2>=-1.||q2<=1.)) G4cout<<"*NAN*G4QElasticCrossSect::GetExchangeT: -t="<<q2<<G4endl;
914 if(q2>lastTM)
915 {
916#ifdef tdebug
917 G4cout<<"*Warning*G4QElasticCrossSect::GetExT:-t="<<q2<<">"<<lastTM<<G4endl;
918#endif
919 q2=lastTM;
920 }
921 return q2*GeVSQ;
922}
#define G4UniformRand()
Definition: Randomize.hh:53

◆ GetHMaxT()

G4double G4QPionMinusElasticCrossSection::GetHMaxT ( )
virtual

Reimplemented from G4VQCrossSection.

Definition at line 950 of file G4QPionMinusElasticCrossSection.cc.

951{
952 static const G4double HGeVSQ=gigaelectronvolt*gigaelectronvolt/2.;
953 return lastTM*HGeVSQ;
954}

◆ GetPointer()

G4VQCrossSection * G4QPionMinusElasticCrossSection::GetPointer ( )
static

◆ GetSlope()

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

Reimplemented from G4VQCrossSection.

Definition at line 925 of file G4QPionMinusElasticCrossSection.cc.

926{
927 static const G4double GeVSQ=gigaelectronvolt*gigaelectronvolt;
928#ifdef tdebug
929 G4cout<<"G4QElasticCS::GetSlope:"<<onlyCS<<", Z="<<tgZ<<",N="<<tgN<<",PDG="<<PDG<<G4endl;
930#endif
931 if(onlyCS)G4cout<<"Warning*G4QPionMinusElasticCrossSection::GetSlope:onlCS=true"<<G4endl;
932 if(lastLP<-4.3) return 0.; // S-wave for p<14 MeV/c (kinE<.1MeV)
933 if(PDG !=-211)
934 {
935 // G4cout<<"*Error*G4QPionMinusElasticCrossSection::GetSlope: PDG="<<PDG<<", Z="<<tgZ
936 // <<", N="<<tgN<<", while it is defined only for PDG=-211"<<G4endl;
937 // throw G4QException("G4QPionMinusElasticCrossSection::GetSlope: pipA are implemented");
939 ed << "PDG = " << PDG << ", Z = " << tgZ << ", N = " << tgN
940 << ", while it is defined only for PDG=-211" << G4endl;
941 G4Exception("G4QPionMinusElasticCrossSection::GetSlope()", "HAD_CHPS_0000",
942 FatalException, ed);
943 }
944 if(theB1<0.) theB1=0.;
945 if(!(theB1>=-1.||theB1<=1.))G4cout<<"*NAN*G4QElasticCrossSect::Getslope:"<<theB1<<G4endl;
946 return theB1/GeVSQ;
947}
@ 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: