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

#include <G4QPionPlusElasticCrossSection.hh>

+ Inheritance diagram for G4QPionPlusElasticCrossSection:

Public Member Functions

 ~G4QPionPlusElasticCrossSection ()
 
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

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

Constructor & Destructor Documentation

◆ G4QPionPlusElasticCrossSection()

G4QPionPlusElasticCrossSection::G4QPionPlusElasticCrossSection ( )
protected

Definition at line 100 of file G4QPionPlusElasticCrossSection.cc.

101{
102}

◆ ~G4QPionPlusElasticCrossSection()

G4QPionPlusElasticCrossSection::~G4QPionPlusElasticCrossSection ( )

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

Implements G4VQCrossSection.

Definition at line 289 of file G4QPionPlusElasticCrossSection.cc.

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

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

Reimplemented from G4VQCrossSection.

Definition at line 737 of file G4QPionPlusElasticCrossSection.cc.

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

◆ GetHMaxT()

G4double G4QPionPlusElasticCrossSection::GetHMaxT ( )
virtual

Reimplemented from G4VQCrossSection.

Definition at line 953 of file G4QPionPlusElasticCrossSection.cc.

954{
955 static const G4double HGeVSQ=gigaelectronvolt*gigaelectronvolt/2.;
956 return lastTM*HGeVSQ;
957}

◆ GetPointer()

G4VQCrossSection * G4QPionPlusElasticCrossSection::GetPointer ( )
static

Definition at line 143 of file G4QPionPlusElasticCrossSection.cc.

144{
145 static G4QPionPlusElasticCrossSection theCrossSection;//StaticBody of theQEl CrossSection
146#ifdef pdebug
147 G4cout<<"G4QPiPlElCS::GetCS: PiPlus Elastic pointer is taken"<<G4endl;
148#endif
149 return &theCrossSection;
150}

Referenced by G4CHIPSElastic::G4CHIPSElastic(), G4CHIPSElasticXS::G4CHIPSElasticXS(), G4QHadronElasticDataSet::GetIsoCrossSection(), G4QElastic::GetMeanFreePath(), and G4QElastic::PostStepDoIt().

◆ GetSlope()

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

Reimplemented from G4VQCrossSection.

Definition at line 928 of file G4QPionPlusElasticCrossSection.cc.

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