Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4FastPathHadronicCrossSection::fastPathEntry Struct Reference

#include <G4FastPathHadronicCrossSection.hh>

Collaboration diagram for G4FastPathHadronicCrossSection::fastPathEntry:

Public Member Functions

 fastPathEntry (const G4ParticleDefinition *par, const G4Material *mat, G4double min_cutoff)
 
 ~fastPathEntry ()
 
G4double GetCrossSection (G4double ene) const
 
void Initialize (G4CrossSectionDataStore *)
 

Public Attributes

const G4ParticleDefinition *const particle
 
const G4Material *const material
 
const G4double min_cutoff
 
XSParamphysicsVector
 

Detailed Description

Definition at line 54 of file G4FastPathHadronicCrossSection.hh.

Constructor & Destructor Documentation

fastPathEntry::fastPathEntry ( const G4ParticleDefinition par,
const G4Material mat,
G4double  min_cutoff 
)

Definition at line 65 of file G4FastPathHadronicCrossSection.cc.

65  :
66  particle(part),material(mat),min_cutoff(min),physicsVector(nullptr)
67  {
68  DBG("Initializing a fastPathEntry");
69 #ifdef FPDEBUG
70  count = 0;
71  slowpath_sum=0.;
72  max_delta=0.;
73  min_delta=0.;
74  sum_delta=0.;
75  sum_delta_square=0.;
76 #endif
77 }
#define DBG(msg)
XSParam * physicsVector
const G4ParticleDefinition *const particle
const G4double min_cutoff
const G4Material *const material
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
fastPathEntry::~fastPathEntry ( )

Definition at line 79 of file G4FastPathHadronicCrossSection.cc.

80 {
81  DBG("Deleting fastPathEntry");
82  DBG("Dumping status for: "<<(particle?particle->GetParticleName():"PART_NONE")<<" "\
83  <<(material?material->GetName():"MAT_NONE")<<" min_cutoff:"<<min_cutoff<<" "\
84  <<" count:"<<count<<" slowpath_sum:"<<slowpath_sum<<" max_delta:"<<max_delta\
85  <<" min_delta"<<min_delta<<" sum_delta"<<sum_delta<<" sum_delta_squared:"<<sum_delta_square);
86  delete physicsVector;
87 }
#define DBG(msg)
XSParam * physicsVector
const G4String & GetName() const
Definition: G4Material.hh:178
const G4ParticleDefinition *const particle
const G4double min_cutoff
const G4Material *const material
const G4String & GetParticleName() const

Here is the call graph for this function:

Member Function Documentation

G4double G4FastPathHadronicCrossSection::fastPathEntry::GetCrossSection ( G4double  ene) const
inline

Definition at line 58 of file G4FastPathHadronicCrossSection.hh.

58 { return physicsVector->Value(ene); }
XSParam * physicsVector
G4double Value(G4double theEnergy, size_t &lastidx) const

Here is the call graph for this function:

void fastPathEntry::Initialize ( G4CrossSectionDataStore xsds)

Definition at line 95 of file G4FastPathHadronicCrossSection.cc.

96 {
97  //Check this method is called when G4CrossSectionDataStore is in the correct state:
98  // FastPath is enabled and we are indeed initializing
101  using std::log10;
102  std::vector<Point_t> data_in;
103  const fastPathParameters& params = xsds->GetFastPathParameters();
104  G4double xs;
105 
106  //G4double max_query = params.queryMax;
107  //G4int count = sampleCount;
108  //G4double tol = dpTol;
109 
110  //Shift so max and min are >= 1.
111  //Don't forget to shift back before computing XS
112  G4double min = params.sampleMin;
113  G4double max = params.sampleMax;
114  G4double shift = 0.0;
115  if(min < 1.0){
116  shift = 1.0 - min;
117  }
118  min += shift;
119  max += shift;
120 
121  G4double log_max = std::log10(params.sampleMax);
122  G4double log_min = std::log10(params.sampleMin);
123  G4double log_step = (log_max-log_min)/(1.0*params.sampleCount);
124 
125  G4double max_xs = 0.0;
126 
127  //Utility particle to calculate XS, with 0 kin energy by default
128  static const G4ThreeVector constDirection(0.,0.,1.);
129  G4DynamicParticle* probingParticle = new G4DynamicParticle( particle , constDirection , 0 );
130 
131  //add the cutoff energy
132  probingParticle->SetKineticEnergy(min_cutoff);
133  //Sample cross-section
134  xs = xsds->GetCrossSection(probingParticle,material);
135  data_in.push_back({min_cutoff,xs});
136 
137  G4double currEnergy = 0.0;
138  //log results
139  auto exp10 = [](G4double x){ return std::exp( M_LN10*x); };
140  for(G4double log_currEnergy = log_min; log_currEnergy < log_max; log_currEnergy += log_step){
141  currEnergy = exp10(log_currEnergy) - shift;
142  if (currEnergy < min_cutoff) continue;
143  probingParticle->SetKineticEnergy(currEnergy);
144  xs=xsds->GetCrossSection(probingParticle,material);
145  //G4cout << "PRUTH: energy value " << currEnergy << ", XS value " << xs << G4endl;
146  if (xs > max_xs) max_xs = xs;
147  data_in.push_back({currEnergy,xs});
148  } // --- end of loop i
149  probingParticle->SetKineticEnergy(max-shift);
150  xs = xsds->GetCrossSection(probingParticle,material);
151  data_in.push_back({max-shift,xs});
152 
153  G4double tol = max_xs * 0.01;
154  std::vector<Point_t> decimated_data;
155  simplify_function(tol, data_in, decimated_data);
156  std::vector<Point_t> debiased_data;
157  RemoveBias( data_in, decimated_data, debiased_data);
158  if ( physicsVector != nullptr ) delete physicsVector;
159  physicsVector = new XSParam(decimated_data.size());
160  G4int physicsVectorIndex = 0;
161  for(size_t i = 0; i < decimated_data.size(); i++){
162  physicsVector->PutValue(physicsVectorIndex++, decimated_data[i].e, decimated_data[i].xs);
163  }
164  //xsds->DumpFastPath(particle,material,G4cout);
165 }
const G4FastPathHadronicCrossSection::controlFlag & GetFastPathControlFlags() const
XSParam * physicsVector
void PutValue(size_t index, G4double energy, G4double dataValue)
const G4ParticleDefinition *const particle
const G4double min_cutoff
int G4int
Definition: G4Types.hh:78
const G4Material *const material
const G4FastPathHadronicCrossSection::fastPathParameters & GetFastPathParameters() const
G4double GetCrossSection(const G4DynamicParticle *, const G4Material *)
void SetKineticEnergy(G4double aEnergy)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

const G4Material* const G4FastPathHadronicCrossSection::fastPathEntry::material

Definition at line 61 of file G4FastPathHadronicCrossSection.hh.

const G4double G4FastPathHadronicCrossSection::fastPathEntry::min_cutoff

Definition at line 62 of file G4FastPathHadronicCrossSection.hh.

const G4ParticleDefinition* const G4FastPathHadronicCrossSection::fastPathEntry::particle

Definition at line 60 of file G4FastPathHadronicCrossSection.hh.

XSParam* G4FastPathHadronicCrossSection::fastPathEntry::physicsVector

Definition at line 64 of file G4FastPathHadronicCrossSection.hh.


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