Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ChargeExchangeXS Class Referencefinal

#include <G4ChargeExchangeXS.hh>

Inheritance diagram for G4ChargeExchangeXS:

Public Member Functions

 G4ChargeExchangeXS ()
 ~G4ChargeExchangeXS () override=default
G4bool IsElementApplicable (const G4DynamicParticle *, G4int Z, const G4Material *) final
G4double GetElementCrossSection (const G4DynamicParticle *, G4int Z, const G4Material *) final
void CrossSectionDescription (std::ostream &) const final
const G4ParticleDefinitionSampleSecondaryType (const G4ParticleDefinition *, const G4Material *, G4int Z, G4int A, G4double etot)
G4double GetPartialPionXS (G4int idx) const
void SetEnergyLimit (G4double val)
void SetCrossSectionFactor (G4double val)
G4double GetCrossSectionFactor () const
G4bool isPion () const
G4double SampleTforPion (const G4double etot, const G4double tmax) const
G4ChargeExchangeXSoperator= (const G4ChargeExchangeXS &right)=delete
 G4ChargeExchangeXS (const G4ChargeExchangeXS &)=delete
Public Member Functions inherited from G4VCrossSectionDataSet
 G4VCrossSectionDataSet (const G4String &nam="")
virtual ~G4VCrossSectionDataSet ()
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 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 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

Additional Inherited Members

Protected Attributes inherited from G4VCrossSectionDataSet
G4int verboseLevel {0}
G4String name

Detailed Description

Definition at line 65 of file G4ChargeExchangeXS.hh.

Constructor & Destructor Documentation

◆ G4ChargeExchangeXS() [1/2]

G4ChargeExchangeXS::G4ChargeExchangeXS ( )

Definition at line 77 of file G4ChargeExchangeXS.cc.

78{
79 if (verboseLevel > 1) {
80 G4cout << "G4ChargeExchangeXS::G4ChargeExchangeXS" << G4endl;
81 }
82 fMassPi = G4PionPlus::PionPlus()->GetPDGMass();
83 g4calc = G4Pow::GetInstance();
85 const G4String nam[5] = {"pi0", "eta", "eta_prime", "omega", "f2(1270)"};
86 for (G4int i=0; i<5; ++i) {
87 fPionSecPD[i] = table->FindParticle(nam[i]);
88 if (nullptr == fPionSecPD[i]) {
90 ed << "### meson " << nam[i] << " is not found out in the particle table";
91 G4Exception("G4ChargeExchangeXS::G4ChargeExchangeXS()","had044",
92 FatalException, ed,"");
93 }
94 }
95}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
int G4int
Definition G4Types.hh:85
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
static G4ParticleTable * GetParticleTable()
static G4PionPlus * PionPlus()
Definition G4PionPlus.cc:93
static G4Pow * GetInstance()
Definition G4Pow.cc:41

Referenced by G4ChargeExchangeXS(), and operator=().

◆ ~G4ChargeExchangeXS()

G4ChargeExchangeXS::~G4ChargeExchangeXS ( )
overridedefault

◆ G4ChargeExchangeXS() [2/2]

G4ChargeExchangeXS::G4ChargeExchangeXS ( const G4ChargeExchangeXS & )
delete

Member Function Documentation

◆ CrossSectionDescription()

void G4ChargeExchangeXS::CrossSectionDescription ( std::ostream & outFile) const
finalvirtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 98 of file G4ChargeExchangeXS.cc.

99{
100 outFile << "G4ChargeExchangeXS calculates charge exchange cross section for "
101 << "pi+, pi-, K+, K-, KL\n";
102}

◆ GetCrossSectionFactor()

G4double G4ChargeExchangeXS::GetCrossSectionFactor ( ) const
inline

Definition at line 91 of file G4ChargeExchangeXS.hh.

91{ return fFactor; };

◆ GetElementCrossSection()

G4double G4ChargeExchangeXS::GetElementCrossSection ( const G4DynamicParticle * dp,
G4int Z,
const G4Material * mat )
finalvirtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 111 of file G4ChargeExchangeXS.cc.

113{
114 G4double pE = dp->GetTotalEnergy();
115 return (pE > fEnergyLimit) ?
116 GetCrossSection(dp->GetDefinition(), mat, Z, pE) : 0.0;
117}
double G4double
Definition G4Types.hh:83
G4ParticleDefinition * GetDefinition() const
G4double GetTotalEnergy() const

◆ GetPartialPionXS()

G4double G4ChargeExchangeXS::GetPartialPionXS ( G4int idx) const

Definition at line 314 of file G4ChargeExchangeXS.cc.

315{
316 G4double res = 0.0;
317 if (0 == idx) { res = fXSecPion[0]; }
318 else if (0 < idx && 5 > idx) {
319 res = fXSecPion[idx] - fXSecPion[idx - 1];
320 }
321 return res;
322}

◆ IsElementApplicable()

G4bool G4ChargeExchangeXS::IsElementApplicable ( const G4DynamicParticle * ,
G4int Z,
const G4Material *  )
finalvirtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 104 of file G4ChargeExchangeXS.cc.

106{
107 return true;
108}

◆ isPion()

G4bool G4ChargeExchangeXS::isPion ( ) const
inline

Definition at line 93 of file G4ChargeExchangeXS.hh.

93{ return findex >= 0; };

◆ operator=()

G4ChargeExchangeXS & G4ChargeExchangeXS::operator= ( const G4ChargeExchangeXS & right)
delete

◆ SampleSecondaryType()

const G4ParticleDefinition * G4ChargeExchangeXS::SampleSecondaryType ( const G4ParticleDefinition * part,
const G4Material * mat,
G4int Z,
G4int A,
G4double etot )

Definition at line 220 of file G4ChargeExchangeXS.cc.

223{
224 // index of pion partial x-section
225 findex = -1;
226 // recompute x-section for the element in complex material
227 GetCrossSection(part, mat, Z, etot);
228
229 const G4ParticleDefinition* pd = nullptr;
230 G4int pdg = std::abs(part->GetPDGEncoding());
231 G4cout << pdg << G4endl;
232 // pi- + p / pi+ + n
233 if (pdg == 211) {
234 pd = fPionSecPD[0];
235 G4double x = fXSecPion[4]*G4UniformRand();
236 for (findex = 0; findex < 5; ++findex) {
237 if (x <= fXSecPion[findex]) {
238 pd = fPionSecPD[findex];
239 break;
240 }
241 }
242 }
243
244 // K- + p / K+ + n
245 // Equal opportunity of producing k-short and k-long
246 else if (pdg == 321) {
247 if (G4UniformRand() >= 0.5) {
249 }
250 else {
252 }
253 }
254
255 // KL + nucleus
256 else if (pdg == 130) {
257 G4double prob = (G4double)Z/(G4double)A;
258 if (G4UniformRand() >= prob) {
260 }
261 else {
263 }
264 }
265 if (verboseLevel > 1) {
266 G4cout << "G4ChargeExchangeXS::SampleSecondaryType for "
267 << pd->GetParticleName() << " findex=" << findex
268 << G4endl;
269 }
270 return pd;
271}
const G4double A[17]
#define G4UniformRand()
Definition Randomize.hh:52
static G4KaonMinus * KaonMinus()
static G4KaonPlus * KaonPlus()
static G4KaonZeroLong * KaonZeroLong()
static G4KaonZeroShort * KaonZeroShort()
const G4String & GetParticleName() const

◆ SampleTforPion()

G4double G4ChargeExchangeXS::SampleTforPion ( const G4double etot,
const G4double tmax ) const

Definition at line 273 of file G4ChargeExchangeXS.cc.

275{
276 G4double tmax = ltmax/GeV2;
277 G4double tM = CLHEP::proton_mass_c2;
278 G4double logX = G4Log((tM*tM + 2*tM*etot + fMassPi*fMassPi)*inv1e7);
279
280 G4double gl = pG0[findex] + pG1[findex]*logX;
281 G4double cl = pC0[findex] + pC1[findex]*logX;
282 G4double gc = gl*cl;
283
284 G4double t{0};
285 G4double sigmaMax = (gc > 0.0) ? gl*G4Exp(-(gl - 1.0)/gl) : 1.0;
286 for (G4int i = 0; i < 100000; ++i) {
287 t = tmax*G4UniformRand();
288 G4double sigma = (1.0 + gc*t)*G4Exp(-cl*t);
289 if (G4UniformRand()*sigmaMax <= sigma) {
290 return t*GeV2;
291 }
292 }
293 return 0.0;
294}
const G4double GeV2
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
Definition G4Exp.hh:132
G4double G4Log(G4double x)
Definition G4Log.hh:169

◆ SetCrossSectionFactor()

void G4ChargeExchangeXS::SetCrossSectionFactor ( G4double val)
inline

Definition at line 89 of file G4ChargeExchangeXS.hh.

89{ fFactor = val; };

◆ SetEnergyLimit()

void G4ChargeExchangeXS::SetEnergyLimit ( G4double val)
inline

Definition at line 87 of file G4ChargeExchangeXS.hh.

87{ fEnergyLimit = val; };

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