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

#include <G4QKaonPlusElasticCrossSection.hh>

+ Inheritance diagram for G4QKaonPlusElasticCrossSection:

Public Member Functions

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

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

Constructor & Destructor Documentation

◆ G4QKaonPlusElasticCrossSection()

G4QKaonPlusElasticCrossSection::G4QKaonPlusElasticCrossSection ( )
protected

Definition at line 100 of file G4QKaonPlusElasticCrossSection.cc.

101{
102}

◆ ~G4QKaonPlusElasticCrossSection()

G4QKaonPlusElasticCrossSection::~G4QKaonPlusElasticCrossSection ( )

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

Implements G4VQCrossSection.

Definition at line 286 of file G4QKaonPlusElasticCrossSection.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<<"G4QKaonPlusElasticCS::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<<"G4QKaonPlusElCS::CalCS:DB updated for I="<<I<<",*,PIN4="<<PIN[4]<<G4endl;
316#endif
317 }
318#ifdef pdebug
319 G4cout<<"G4QKaonPlusElasticCS::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<<"G4QKPElCS::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<<"G4QKaonPlusElasticCS::CalcCS:*ini*,lstLP="<<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<<"G4QKaPlElCS::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<<"G4QKPElCS::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<<"G4QKaonPlusElCS::CalcCS:*updated(O)*,LP="<<lastLP<<"<IN="<<lastPIN<<G4endl;
373#endif
374 }
375#ifdef pdebug
376 G4cout<<"G4QKaPlElCS::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<<"G4QKaPlElCrosSec::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<<"G4QKPElCS::CCS:b="<<blast<<",n="<<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<<"G4QKaonPlusElasticCS::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<<"G4QKaonPlusElasticCrossSection::CalcCrossSection:Sig="<<lastSIG<<",P="
418 <<pMom<<",Z="<<tgZ<<",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 pdebug
428 G4cout<<"G4QKaonPlusElasticCS::CalcCrossSect: b="<<blast<<", ls="<<lastL<<",SL="
429 <<S1TL<<",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 pdebug
439 G4cout<<"G4QKaonPlusElasticCrossSection::CalcCS: s3l="<<S3TL<<", sh3="<<shift
440 <<", s3h="<<lastS3T[lastL]<<", b="<<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<<"G4QKaonPlusElasticCrossSection::CalcCS: s4l="<<S4TL<<", sh4="<<shift
448 <<",s4h="<<lastS4T[lastL]<<",b="<<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<<"G4QKaonPlusElasticCS::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<<"G4QKaonPlusElasticCrossSection::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 G4QKaonPlusElasticCrossSection::GetCrossSection ( G4bool  fCS,
G4double  pMom,
G4int  tgZ,
G4int  tgN,
G4int  pPDG = 321 
)
virtual

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

Reimplemented from G4VQCrossSection.

Definition at line 151 of file G4QKaonPlusElasticCrossSection.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<<"G4QKaPlusElCS::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!=321)
168 {
169 G4cout<<"*Warning*G4QKaonPlusElaCS::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<<"G4QKPElCS::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<<"G4QKPElCS::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<<"G4QKaonPlusElastCS::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<<"G4QKPElCS::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<<"G4QKaonPlusElCS::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<<"G4QKaonPlusElCS::GetCS: 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<<"---G4QKaonPlusElasticCrossSection::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 } // 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<<"G4QKaonPlusElCS::GetCS:CalNewP="<<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<<"G4QKaonPlusElasticCrossSection::GetCS:NewThr="<<lastTH<<",T="<<pEn<<G4endl;
244#endif
245 if(pEn>lastTH)
246 {
247#ifdef pdebug
248 G4cout<<"G4QKaonPlusElCS::GetCS:1st T="<<pEn<<"(CS=0)>Threshold="<<lastTH<<G4endl;
249#endif
250 lastTH=pEn;
251 }
252 }
253#ifdef pdebug
254 G4cout<<"G4QKaonPlusElCS::GetCS:NCS="<<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<<"G4QKPElCS::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<<"G4QKaonPlusElasticCrossSection::GetCS: Update lastI="<<lastI<<G4endl;
272#endif
273 colP[lastI]=pMom;
274 colCS[lastI]=lastCS;
275 }
276#ifdef pdebug
277 G4cout<<"G4QKPElCS::GetCSec:End,P="<<pMom<<"(MeV),CS="<<lastCS*millibarn<<"(mb)"<<G4endl;
278 //CalculateCrossSection(fCS,-27,lastI,pPDG,lastZ,lastN,pMom); // DUMMY TEST
279 G4cout<<"G4QKaonPlusElasticCrossSection::GetCrosSec:**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 G4QKaonPlusElasticCrossSection::GetExchangeT ( G4int  tZ,
G4int  tN,
G4int  pPDG 
)
virtual

Reimplemented from G4VQCrossSection.

Definition at line 735 of file G4QKaonPlusElasticCrossSection.cc.

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

◆ GetHMaxT()

G4double G4QKaonPlusElasticCrossSection::GetHMaxT ( )
virtual

Reimplemented from G4VQCrossSection.

Definition at line 951 of file G4QKaonPlusElasticCrossSection.cc.

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

◆ GetPointer()

G4VQCrossSection * G4QKaonPlusElasticCrossSection::GetPointer ( )
static

◆ GetSlope()

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

Reimplemented from G4VQCrossSection.

Definition at line 926 of file G4QKaonPlusElasticCrossSection.cc.

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