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

#include <G4ElectroNuclearCrossSection.hh>

+ Inheritance diagram for G4ElectroNuclearCrossSection:

Public Member Functions

 G4ElectroNuclearCrossSection ()
 
virtual ~G4ElectroNuclearCrossSection ()
 
virtual void CrossSectionDescription (std::ostream &) const
 
virtual G4bool IsElementApplicable (const G4DynamicParticle *, G4int Z, const G4Material *)
 
virtual G4double GetElementCrossSection (const G4DynamicParticle *, G4int Z, const G4Material *mat)
 
G4double GetEquivalentPhotonEnergy ()
 
G4double GetVirtualFactor (G4double nu, G4double Q2)
 
G4double GetEquivalentPhotonQ2 (G4double nu)
 
- Public Member Functions inherited from G4VCrossSectionDataSet
 G4VCrossSectionDataSet (const G4String &nam="")
 
virtual ~G4VCrossSectionDataSet ()
 
virtual G4bool IsElementApplicable (const G4DynamicParticle *, G4int Z, const G4Material *mat=nullptr)
 
virtual G4bool IsIsoApplicable (const G4DynamicParticle *, G4int Z, G4int A, const G4Element *elm=nullptr, const G4Material *mat=nullptr)
 
G4double GetCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *mat=nullptr)
 
G4double ComputeCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *mat=nullptr)
 
virtual G4double ComputeCrossSectionPerElement (G4double kinEnergy, G4double loge, const G4ParticleDefinition *, const G4Element *, const G4Material *mat=nullptr)
 
virtual G4double GetElementCrossSection (const G4DynamicParticle *, G4int Z, const G4Material *mat=nullptr)
 
virtual G4double GetIsoCrossSection (const G4DynamicParticle *, G4int Z, G4int A, const G4Isotope *iso=nullptr, const G4Element *elm=nullptr, const G4Material *mat=nullptr)
 
virtual G4double ComputeIsoCrossSection (G4double kinEnergy, G4double loge, const G4ParticleDefinition *, G4int Z, G4int A, const G4Isotope *iso=nullptr, const G4Element *elm=nullptr, const G4Material *mat=nullptr)
 
virtual const G4IsotopeSelectIsotope (const G4Element *, G4double kinEnergy, G4double logE)
 
virtual void BuildPhysicsTable (const G4ParticleDefinition &)
 
virtual void DumpPhysicsTable (const G4ParticleDefinition &)
 
virtual void CrossSectionDescription (std::ostream &) const
 
virtual void SetVerboseLevel (G4int value)
 
G4double GetMinKinEnergy () const
 
void SetMinKinEnergy (G4double value)
 
G4double GetMaxKinEnergy () const
 
void SetMaxKinEnergy (G4double value)
 
bool ForAllAtomsAndEnergies () const
 
void SetForAllAtomsAndEnergies (G4bool val)
 
const G4StringGetName () const
 
void SetName (const G4String &nam)
 
G4VCrossSectionDataSetoperator= (const G4VCrossSectionDataSet &right)=delete
 
 G4VCrossSectionDataSet (const G4VCrossSectionDataSet &)=delete
 

Static Public Member Functions

static const char * Default_Name ()
 

Additional Inherited Members

- Protected Attributes inherited from G4VCrossSectionDataSet
G4int verboseLevel
 
G4String name
 

Detailed Description

Definition at line 58 of file G4ElectroNuclearCrossSection.hh.

Constructor & Destructor Documentation

◆ G4ElectroNuclearCrossSection()

G4ElectroNuclearCrossSection::G4ElectroNuclearCrossSection ( )

Definition at line 2180 of file G4ElectroNuclearCrossSection.cc.

2181currentN(0), currentZ(0), lastZ(0),lastE(0), lastSig(0), lastG(0), lastL(0),
2182mNeut(neutron_mass_c2), mProt(proton_mass_c2)
2183{
2185 //Initialize caches
2186 lastUsedCacheEl = new cacheEl_t();
2187 nistmngr = G4NistManager::Instance();
2188
2189 for (G4int i=0;i<120;i++)
2190 {
2191 cache.push_back(nullptr);
2192 }
2193
2194}
int G4int
Definition: G4Types.hh:85
static G4NistManager * Instance()
void SetForAllAtomsAndEnergies(G4bool val)

◆ ~G4ElectroNuclearCrossSection()

G4ElectroNuclearCrossSection::~G4ElectroNuclearCrossSection ( )
virtual

Definition at line 2196 of file G4ElectroNuclearCrossSection.cc.

2197{
2198 std::vector<cacheEl_t*>::iterator it = cache.begin();
2199 while ( it != cache.end() ) /* Loop checking, 08.01.2016, W. Pokorski */
2200 {
2201 if ( *it ) {
2202 delete[] (*it)->J1; (*it)->J1 = 0;
2203 delete[] (*it)->J2; (*it)->J2 = 0;
2204 delete[] (*it)->J3; (*it)->J3 = 0;
2205 delete *it;
2206 }
2207 ++it;
2208 }
2209 cache.clear();
2210 delete lastUsedCacheEl;
2211}

Member Function Documentation

◆ CrossSectionDescription()

void G4ElectroNuclearCrossSection::CrossSectionDescription ( std::ostream &  outFile) const
virtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 2245 of file G4ElectroNuclearCrossSection.cc.

2246{
2247 outFile << "G4ElectroNuclearCrossSection provides the total inelastic\n"
2248 << "cross section for e- and e+ interactions with nuclei. The\n"
2249 << "cross sections are retrieved from a table which is\n"
2250 << "generated using the equivalent photon approximation. In\n"
2251 << "this approximation real gammas are produced from the virtual\n"
2252 << "ones generated at the electromagnetic vertex. This cross\n"
2253 << "section set is valid for incident electrons and positrons at\n"
2254 << "all energies.\n";
2255}

◆ Default_Name()

static const char * G4ElectroNuclearCrossSection::Default_Name ( )
inlinestatic

Definition at line 65 of file G4ElectroNuclearCrossSection.hh.

65{return "ElectroNuclearXS";}

Referenced by G4ElectroVDNuclearModel::G4ElectroVDNuclearModel().

◆ GetElementCrossSection()

G4double G4ElectroNuclearCrossSection::GetElementCrossSection ( const G4DynamicParticle aPart,
G4int  Z,
const G4Material mat 
)
virtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 2263 of file G4ElectroNuclearCrossSection.cc.

2264{
2265 const G4double Energy = aPart->GetKineticEnergy()/MeV; // Energy of the electron
2266
2267 if (Energy<=EMi) return 0.; // Energy is below the minimum energy in the table
2268
2269 if(ZZ!=lastZ) // This nucleus was not the last used element
2270 {
2271 lastE = 0.; // New history in the electron Energy
2272 lastG = 0.; // New history in the photon Energy
2273 lastZ = ZZ;
2274
2275 //key to search in cache
2276 if(!cache[ZZ]){
2277 lastUsedCacheEl->J1 = new G4double[nE]; // Allocate memory for the new J1 function
2278 lastUsedCacheEl->J2 = new G4double[nE]; // Allocate memory for the new J2 function
2279 lastUsedCacheEl->J3 = new G4double[nE]; // Allocate memory for the new J3 function
2280 G4double Aa = nistmngr->GetAtomicMassAmu(ZZ); // average A
2281 G4int N = (G4int)Aa - ZZ;
2282 lastUsedCacheEl->F = GetFunctions(Aa,lastUsedCacheEl->J1,lastUsedCacheEl->J2,lastUsedCacheEl->J3); // new ZeroPos and filling of J-functions
2283 lastUsedCacheEl->H = alop*Aa*(1.-.072*G4Log(Aa));// corresponds to lastSP from G4PhotonuclearCrossSection
2284 lastUsedCacheEl->TH = ThresholdEnergy(ZZ, N); // The last Threshold Energy
2285 cacheEl_t* new_el = new cacheEl_t(*lastUsedCacheEl);
2286 cache[ZZ] = new_el;
2287 }
2288 else
2289 { //found in cache
2290 const cacheEl_t& el = *(cache[ZZ]);
2291 lastUsedCacheEl->F = el.F;
2292 lastUsedCacheEl->TH = el.TH;
2293 lastUsedCacheEl->H = el.H;
2294 lastUsedCacheEl->J1 = el.J1;
2295 lastUsedCacheEl->J2 = el.J2;
2296 lastUsedCacheEl->J3 = el.J3;
2297 }
2298 }
2299 else
2300 { //current isotope is the same as previous one
2301 if ( lastE == Energy ) return lastSig*millibarn; // Don't calc. same CS twice
2302 }
2303 //End of optimization: now lastUsedCacheEl structure contains the correct data for this isotope
2304
2305 // ============================== NOW Calculate the Cross Section ==========================
2306 lastE=Energy; // lastE - the electron energy
2307
2308 if ( Energy <= lastUsedCacheEl->TH ) // check that the eE is higher than the ThreshE
2309 {
2310 lastSig=0.;
2311 return 0.;
2312 }
2313
2314 G4double lE=G4Log(Energy); // G4Log(eE) (it is necessary at this point for the fit)
2315
2316 lastG=lE-lmel; // Gamma of the electron (used to recover G4Log(eE))
2317 G4double dlg1=lastG+lastG-1.;
2318 G4double lgoe=lastG/lastE;
2319 if(lE<lEMa) // Linear fit is made explicitly to fix the last bin for the randomization
2320 {
2321 G4double shift=(lE-lEMi)/dlnE;
2322 G4int blast=static_cast<G4int>(shift);
2323 if(blast<0) blast=0;
2324 if(blast>=mLL) blast=mLL-1;
2325 shift-=blast;
2326 lastL=blast+1;
2327 G4double YNi=dlg1*lastUsedCacheEl->J1[blast]-lgoe*(lastUsedCacheEl->J2[blast]+lastUsedCacheEl->J2[blast]-lastUsedCacheEl->J3[blast]/lastE);
2328 G4double YNj=dlg1*lastUsedCacheEl->J1[lastL]-lgoe*(lastUsedCacheEl->J2[lastL]+lastUsedCacheEl->J2[lastL]-lastUsedCacheEl->J3[lastL]/lastE);
2329 lastSig= YNi+shift*(YNj-YNi);
2330 if(lastSig>YNj)lastSig=YNj;
2331 }
2332 else
2333 {
2334 lastL=mLL;
2335
2336 G4double term1=lastUsedCacheEl->J1[mLL]+lastUsedCacheEl->H*HighEnergyJ1(lE);
2337
2338 G4double term2=lastUsedCacheEl->J2[mLL]+lastUsedCacheEl->H*HighEnergyJ2(lE, Energy);
2339
2340 G4double En2 = Energy*Energy;
2341 G4double term3=lastUsedCacheEl->J3[mLL]+lastUsedCacheEl->H*HighEnergyJ3(lE, En2);
2342
2343 lastSig=dlg1*term1-lgoe*(term2+term2-term3/lastE);
2344 }
2345
2346 if(lastSig<0.) lastSig = 0.;
2347
2348 return lastSig*millibarn;
2349}
G4double G4Log(G4double x)
Definition: G4Log.hh:227
double G4double
Definition: G4Types.hh:83
G4double GetKineticEnergy() const
G4double GetAtomicMassAmu(const G4String &symb) const
#define N
Definition: crc32.c:56

Referenced by G4ElectroVDNuclearModel::ApplyYourself(), and G4ElNucleusSFcs::GetIsoCrossSection().

◆ GetEquivalentPhotonEnergy()

G4double G4ElectroNuclearCrossSection::GetEquivalentPhotonEnergy ( )

Definition at line 2433 of file G4ElectroNuclearCrossSection.cc.

2434{
2435 if(lastSig <= 0.0) { return 0.0; } // VI
2436 G4double phLE = 0.; // Prototype of the G4Log(nu=E_gamma)
2437 G4double Y[nE] = {0.0}; // Prepare the array for randomization
2438
2439 G4double lastLE=lastG+lmel; // recover G4Log(eE) from the gamma (lastG)
2440 G4double dlg1=lastG+lastG-1.;
2441 G4double lgoe=lastG/lastE;
2442 for (G4int i=lastUsedCacheEl->F;i<=lastL;i++) {
2443 Y[i] = dlg1*lastUsedCacheEl->J1[i]-lgoe*(lastUsedCacheEl->J2[i]+lastUsedCacheEl->J2[i]-lastUsedCacheEl->J3[i]/lastE);
2444 if(Y[i] < 0.0) { Y[i] = 0.0; }
2445 }
2446 // Tempory IF of H.P.: delete it if the *HP* err message does not
2447 // show up M.K.
2448 if(lastSig>0.99*Y[lastL] && lastL<mLL && Y[lastL]<1.E-30)
2449 {
2450 G4cerr << "*HP*G4ElNucCS::GetEqPhotE:S=" << lastSig <<">" << Y[lastL]
2451 << ",l=" << lastL << ">" << mLL << G4endl;
2452 if(lastSig <= 0.0) { return 0.0; } // VI
2453 }
2454 G4double ris = lastSig*G4UniformRand(); // Sig can be > Y[lastL = mLL], then it
2455 // is in the funct. region
2456
2457 if (ris < Y[lastL]) { // Search the table
2458 G4int j = lastUsedCacheEl->F;
2459 G4double Yj = Y[j]; // It must be 0 (sometimes just very small)
2460 while (ris > Yj && j < lastL) { // Associative search /* Loop checking, 08.01.2016, W. Pokorski */
2461 j++;
2462 Yj = Y[j]; // Yj is first value above ris
2463 }
2464 G4int j1 = j-1;
2465 G4double Yi = Y[j1]; // Previous value is below ris
2466 phLE = lEMi + (j1 + (ris-Yi)/(Yj-Yi) )*dlnE;
2467 } else { // Search with the function
2468 if (lastL < mLL) G4cerr << "**G4EleNucCS::GetEfPhE:L=" << lastL << ",S="
2469 << lastSig << ",Y=" << Y[lastL] << G4endl;
2470 G4double f = (ris-Y[lastL])/lastUsedCacheEl->H; // The scaled residual value of the cross-section integral
2471 phLE=SolveTheEquation(f); // Solve the equation to find theLog(phE) (compare with lastLE)
2472 }
2473
2474 if (phLE>lastLE) {
2475 G4cerr << "***G4ElectroNuclearCS::GetEquPhotE:N=" << currentN << ",Z="
2476 << currentZ << ", lpE" << phLE << ">leE" << lastLE << ",Sig="
2477 << lastSig << ",rndSig=" << ris << ",Beg=" << lastUsedCacheEl->F << ",End="
2478 << lastL << ",Y=" << Y[lastL] << G4endl;
2479 if(lastLE<7.2) phLE=G4Log(G4Exp(lastLE)-.511);
2480 else phLE=7.;
2481 }
2482 return G4Exp(phLE);
2483}
G4double Y(G4double density)
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
Definition: G4Exp.hh:180
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
#define G4UniformRand()
Definition: Randomize.hh:52

Referenced by G4ElectroVDNuclearModel::ApplyYourself().

◆ GetEquivalentPhotonQ2()

G4double G4ElectroNuclearCrossSection::GetEquivalentPhotonQ2 ( G4double  nu)

Definition at line 2512 of file G4ElectroNuclearCrossSection.cc.

2513{
2514 if(lastG <= 0.0 || lastE <= 0.0) { return 0.; } // VI
2515 if(lastSig <= 0.0) { return 0.0; } // VI
2516 G4double y=nu/lastE; // Part of energy carried by the equivalent pfoton
2517 if(y>=1.-1./(lastG+lastG)) return 0.; // The region where the method does not work
2518 G4double y2=y*y; // Squared photonic part of energy
2519 G4double ye=1.-y; // Part of energy carried by the secondary electron
2520 G4double Qi2=mel2*y2/ye; // Minimum Q2
2521 G4double Qa2=4*lastE*lastE*ye; // Maximum Q2
2522 G4double iar=Qi2/Qa2; // Q2min/Q2max ratio
2523 G4double Dy=ye+.5*y2; // D(y) function
2524 G4double Py=ye/Dy; // P(y) function
2525 G4double ePy=1.-G4Exp(Py); // 1-std::exp(P(y)) part
2526 G4double Uy=Py*(1.-iar); // U(y) function
2527 G4double Fy=(ye+ye)*(1.+ye)*iar/y2; // F(y) function
2528 G4double fr=iar/(1.-ePy*iar); // Q-fraction
2529 if(Fy<=-fr)
2530 {
2531 return 0.;
2532 }
2533 G4double LyQa2=G4Log(Fy+fr); // L(y,Q2max) function
2534 G4bool cond=true;
2535 G4int maxTry=3;
2536 G4int cntTry=0;
2537 G4double Q2=Qi2;
2538 while(cond&&cntTry<maxTry) // The loop to avoid x>1. /* Loop checking, 08.01.2016, W. Pokorski */
2539 {
2540 G4double R=G4UniformRand(); // Random number (0,1)
2541 Q2=Qi2*(ePy+1./(G4Exp(R*LyQa2-(1.-R)*Uy)-Fy));
2542 cntTry++;
2543 cond = Q2>1878.*nu;
2544 }
2545 if(Q2<Qi2)
2546 {
2547 return Qi2;
2548 }
2549 if(Q2>Qa2)
2550 {
2551 return Qa2;
2552 }
2553 return Q2;
2554}
bool G4bool
Definition: G4Types.hh:86

Referenced by G4ElectroVDNuclearModel::ApplyYourself().

◆ GetVirtualFactor()

G4double G4ElectroNuclearCrossSection::GetVirtualFactor ( G4double  nu,
G4double  Q2 
)

Definition at line 2556 of file G4ElectroNuclearCrossSection.cc.

2557{
2558 if(nu <= 0.0 || Q2 <= 0.0) { return 0.0; }
2559 //G4double x=Q2/dM/nu; // Direct x definition
2560 G4double K=nu-Q2/dM; // K=nu*(1-x)
2561 if(K <= 0.) // VI
2562 {
2563 return 0.;
2564 }
2565 G4double lK=G4Log(K); // ln(K)
2566 G4double x=1.-K/nu; // This definitin saves one div.
2567 G4double GD=1.+Q2/Q02; // Reversed nucleonic form-factor
2568 G4double b=G4Exp(bp*(lK-blK0)); // b-factor
2569 G4double c=G4Exp(cp*(lK-clK0)); // c-factor
2570 G4double r=.5*G4Log(Q2+nu*nu)-lK; // r=.5*G4Log((Q^2+nu^2)/K^2)
2571 G4double ef=G4Exp(r*(b-c*r*r)); // exponential factor
2572 return (1.-x)*ef/GD/GD;
2573}

◆ IsElementApplicable()

G4bool G4ElectroNuclearCrossSection::IsElementApplicable ( const G4DynamicParticle ,
G4int  Z,
const G4Material  
)
virtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 2257 of file G4ElectroNuclearCrossSection.cc.

2258{
2259 return (Z>0 && Z<120);
2260}
const G4int Z[17]

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