Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions
G4ElectroNuclearCrossSection Class Reference

#include <G4ElectroNuclearCrossSection.hh>

Inheritance diagram for G4ElectroNuclearCrossSection:
G4VCrossSectionDataSet

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 IsIsoApplicable (const G4DynamicParticle *, G4int Z, G4int A, const G4Element *elm=0, const G4Material *mat=0)
 
G4double GetCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *mat=0)
 
G4double ComputeCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *mat=0)
 
virtual G4double GetIsoCrossSection (const G4DynamicParticle *, G4int Z, G4int A, const G4Isotope *iso=0, const G4Element *elm=0, const G4Material *mat=0)
 
virtual G4IsotopeSelectIsotope (const G4Element *, G4double kinEnergy)
 
virtual void BuildPhysicsTable (const G4ParticleDefinition &)
 
virtual void DumpPhysicsTable (const G4ParticleDefinition &)
 
virtual G4int GetVerboseLevel () const
 
virtual void SetVerboseLevel (G4int value)
 
G4double GetMinKinEnergy () const
 
void SetMinKinEnergy (G4double value)
 
G4double GetMaxKinEnergy () const
 
void SetMaxKinEnergy (G4double value)
 
const G4StringGetName () const
 

Static Public Member Functions

static const char * Default_Name ()
 

Additional Inherited Members

- Protected Member Functions inherited from G4VCrossSectionDataSet
void SetName (const G4String &)
 
- Protected Attributes inherited from G4VCrossSectionDataSet
G4int verboseLevel
 

Detailed Description

Definition at line 58 of file G4ElectroNuclearCrossSection.hh.

Constructor & Destructor Documentation

G4ElectroNuclearCrossSection::G4ElectroNuclearCrossSection ( )

Definition at line 2180 of file G4ElectroNuclearCrossSection.cc.

References G4NistManager::Instance().

2181 currentN(0), currentZ(0), lastZ(0),
2182 lastE(0), lastSig(0), lastG(0), lastL(0), mNeut(G4NucleiProperties::GetNuclearMass(1,0)), mProt(G4NucleiProperties::GetNuclearMass(1,1))
2183 {
2184  //Initialize caches
2185  lastUsedCacheEl = new cacheEl_t;
2186  nistmngr = G4NistManager::Instance();
2187 
2188  for (G4int i=0;i<120;i++)
2189  {
2190  cache.push_back(0);
2191  }
2192 
2193 }
static G4double GetNuclearMass(const G4double A, const G4double Z)
G4VCrossSectionDataSet(const G4String &nam="")
int G4int
Definition: G4Types.hh:78
static G4NistManager * Instance()
G4ElectroNuclearCrossSection::~G4ElectroNuclearCrossSection ( )
virtual

Definition at line 2195 of file G4ElectroNuclearCrossSection.cc.

2196 {
2197  std::vector<cacheEl_t*>::iterator it = cache.begin();
2198  while ( it != cache.end() )
2199  {
2200  delete[] (*it)->J1; (*it)->J1 = 0;
2201  delete[] (*it)->J2; (*it)->J2 = 0;
2202  delete[] (*it)->J3; (*it)->J3 = 0;
2203  ++it;
2204  }
2205  cache.clear();
2206 }

Member Function Documentation

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

Reimplemented from G4VCrossSectionDataSet.

Definition at line 2242 of file G4ElectroNuclearCrossSection.cc.

2243 {
2244  outFile << "G4ElectroNuclearCrossSection provides the total inelastic\n"
2245  << "cross section for e- and e+ interactions with nuclei. The\n"
2246  << "cross sections are retrieved from a table which is\n"
2247  << "generated using the equivalent photon approximation. In\n"
2248  << "this approximation real gammas are produced from the virtual\n"
2249  << "ones generated at the electromagnetic vertex. This cross\n"
2250  << "section set is valid for incident electrons and positrons at\n"
2251  << "all energies.\n";
2252 }
std::ofstream outFile
Definition: GammaRayTel.cc:68
static const char* G4ElectroNuclearCrossSection::Default_Name ( )
inlinestatic

Definition at line 65 of file G4ElectroNuclearCrossSection.hh.

Referenced by G4ElectroVDNuclearModel::G4ElectroVDNuclearModel().

65 {return "ElectroNuclearXS";}
G4double G4ElectroNuclearCrossSection::GetElementCrossSection ( const G4DynamicParticle aPart,
G4int  Z,
const G4Material mat 
)
virtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 2260 of file G4ElectroNuclearCrossSection.cc.

References cacheEl_t::F, G4NistManager::GetAtomicMassAmu(), G4DynamicParticle::GetKineticEnergy(), cacheEl_t::H, cacheEl_t::J1, cacheEl_t::J2, cacheEl_t::J3, python.hepunit::MeV, python.hepunit::millibarn, N, and cacheEl_t::TH.

Referenced by G4ElectroVDNuclearModel::ApplyYourself().

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

Definition at line 2427 of file G4ElectroNuclearCrossSection.cc.

References cacheEl_t::F, G4cerr, G4endl, G4UniformRand, cacheEl_t::H, cacheEl_t::J1, cacheEl_t::J2, and cacheEl_t::J3.

Referenced by G4ElectroVDNuclearModel::ApplyYourself().

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

Definition at line 2506 of file G4ElectroNuclearCrossSection.cc.

References G4UniformRand.

Referenced by G4ElectroVDNuclearModel::ApplyYourself().

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

Definition at line 2550 of file G4ElectroNuclearCrossSection.cc.

References test::c.

2551 {
2552  if(nu <= 0.0 || Q2 <= 0.0) { return 0.0; }
2553  //G4double x=Q2/dM/nu; // Direct x definition
2554  G4double K=nu-Q2/dM; // K=nu*(1-x)
2555  if(K <= 0.) // VI
2556  {
2557  return 0.;
2558  }
2559  G4double lK=std::log(K); // ln(K)
2560  G4double x=1.-K/nu; // This definitin saves one div.
2561  G4double GD=1.+Q2/Q02; // Reversed nucleonic form-factor
2562  G4double b=std::exp(bp*(lK-blK0)); // b-factor
2563  G4double c=std::exp(cp*(lK-clK0)); // c-factor
2564  G4double r=.5*std::log(Q2+nu*nu)-lK; // r=.5*std::log((Q^2+nu^2)/K^2)
2565  G4double ef=std::exp(r*(b-c*r*r)); // exponential factor
2566  return (1.-x)*ef/GD/GD;
2567 }
double G4double
Definition: G4Types.hh:76
G4bool G4ElectroNuclearCrossSection::IsElementApplicable ( const G4DynamicParticle ,
G4int  Z,
const G4Material  
)
virtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 2254 of file G4ElectroNuclearCrossSection.cc.

2255 {
2256  return true;
2257 }

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