LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ArParticleHPCapture Class Reference

#include "ArParticleHPCapture.hh"

Inheritance diagram for ArParticleHPCapture:

Public Member Functions

 ArParticleHPCapture ()
 
 ~ArParticleHPCapture ()
 
G4HadFinalState * ApplyYourself (const G4HadProjectile &aTrack, G4Nucleus &aTargetNucleus) override
 
const std::pair< G4double, G4double > GetFatalEnergyCheckLevels () const override
 
G4int GetVerboseLevel () const
 
void SetVerboseLevel (G4int)
 
void BuildPhysicsTable (const G4ParticleDefinition &) override
 
void ModelDescription (std::ostream &outFile) const override
 

Private Attributes

std::vector< G4ParticleHPChannel * > * theCapture
 
G4String dirName
 
G4int numEle
 
G4HadFinalState theResult
 

Detailed Description

Definition at line 49 of file ArParticleHPCapture.hh.

Constructor & Destructor Documentation

ArParticleHPCapture::ArParticleHPCapture ( )

Definition at line 47 of file ArParticleHPCapture.cc.

48  : G4HadronicInteraction("NeutronHPCapture"), theCapture(NULL), numEle(0)
49 {
50  SetMinEnergy(0.0);
51  SetMaxEnergy(20. * MeV);
52 }
std::vector< G4ParticleHPChannel * > * theCapture
ArParticleHPCapture::~ArParticleHPCapture ( )

Definition at line 54 of file ArParticleHPCapture.cc.

References theCapture.

55 {
56  if (!G4Threading::IsWorkerThread()) {
57  if (theCapture != NULL) {
59  ite != theCapture->end();
60  ite++) {
61  delete *ite;
62  }
63  theCapture->clear();
64  }
65  }
66 }
intermediate_table::iterator iterator
std::vector< G4ParticleHPChannel * > * theCapture

Member Function Documentation

G4HadFinalState * ArParticleHPCapture::ApplyYourself ( const G4HadProjectile &  aTrack,
G4Nucleus &  aTargetNucleus 
)
override

Definition at line 70 of file ArParticleHPCapture.cc.

References n, and sum.

71 {
72  G4ParticleHPManager::GetInstance()->OpenReactionWhiteBoard();
73  if (std::getenv("NeutronHPCapture"))
74  G4cout << " ####### ArParticleHPCapture called" << G4endl;
75  const G4Material* theMaterial = aTrack.GetMaterial();
76  G4int n = theMaterial->GetNumberOfElements();
77  G4int index = theMaterial->GetElement(0)->GetIndex();
78  if (n != 1) {
79  G4double* xSec = new G4double[n];
80  G4double sum = 0;
81  G4int i;
82  const G4double* NumAtomsPerVolume = theMaterial->GetVecNbOfAtomsPerVolume();
83  G4double rWeight;
84  G4ParticleHPThermalBoost aThermalE;
85  for (i = 0; i < n; i++) {
86  index = theMaterial->GetElement(i)->GetIndex();
87  rWeight = NumAtomsPerVolume[i];
88  xSec[i] = ((*theCapture)[index])
89  ->GetXsec(aThermalE.GetThermalEnergy(
90  aTrack, theMaterial->GetElement(i), theMaterial->GetTemperature()));
91  xSec[i] *= rWeight;
92  sum += xSec[i];
93  }
94  G4double random = G4UniformRand();
95  G4double running = 0;
96  for (i = 0; i < n; i++) {
97  running += xSec[i];
98  index = theMaterial->GetElement(i)->GetIndex();
99  if (sum == 0 || random <= running / sum)
100  break;
101  }
102  if (i == n)
103  i = std::max(0, n - 1);
104  delete[] xSec;
105  }
106 
107  G4HadFinalState* result = ((*theCapture)[index])->ApplyYourself(aTrack);
108 
109  // Overwrite target parameters
110  aNucleus.SetParameters(G4ParticleHPManager::GetInstance()->GetReactionWhiteBoard()->GetTargA(),
111  G4ParticleHPManager::GetInstance()->GetReactionWhiteBoard()->GetTargZ());
112  const G4Element* target_element = (*G4Element::GetElementTable())[index];
113  const G4Isotope* target_isotope = NULL;
114  G4int iele = target_element->GetNumberOfIsotopes();
115  for (G4int j = 0; j != iele; j++) {
116  target_isotope = target_element->GetIsotope(j);
117  if (target_isotope->GetN() ==
118  G4ParticleHPManager::GetInstance()->GetReactionWhiteBoard()->GetTargA())
119  break;
120  }
121  aNucleus.SetIsotope(target_isotope);
122 
123  G4ParticleHPManager::GetInstance()->CloseReactionWhiteBoard();
124  return result;
125 }
G4HadFinalState * ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus &aTargetNucleus) override
Char_t n[5]
Double_t sum
Definition: plot.C:31
void ArParticleHPCapture::BuildPhysicsTable ( const G4ParticleDefinition &  )
override

Definition at line 145 of file ArParticleHPCapture.cc.

References dirName, numEle, and theCapture.

146 {
147 
148  G4ParticleHPManager* hpmanager = G4ParticleHPManager::GetInstance();
149 
150  theCapture = hpmanager->GetCaptureFinalStates();
151 
152  if (G4Threading::IsMasterThread()) {
153 
154  if (theCapture == NULL)
155  theCapture = new std::vector<G4ParticleHPChannel*>;
156 
157  if (numEle == (G4int)G4Element::GetNumberOfElements())
158  return;
159 
160  if (theCapture->size() == G4Element::GetNumberOfElements()) {
161  numEle = G4Element::GetNumberOfElements();
162  return;
163  }
164 
165  if (!std::getenv("G4NEUTRONHPDATA"))
166  throw G4HadronicException(
167  __FILE__,
168  __LINE__,
169  "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files.");
170  dirName = std::getenv("G4NEUTRONHPDATA");
171  G4String tString = "/Capture";
172  dirName = dirName + tString;
173 
174  G4ParticleHPCaptureFS* theFS = new G4ParticleHPCaptureFS;
176  for (G4int i = numEle; i < (G4int)G4Element::GetNumberOfElements(); i++) {
177  theCapture->push_back(new G4ParticleHPChannel);
178  ((*theCapture)[i])->Init((*(G4Element::GetElementTable()))[i], dirName);
179  if ((*(G4Element::GetElementTable()))[i]->GetZ() == 18) {
180  ((*theCapture)[i])->Register(theArFS);
181  std::cout << "======= use new Argon Capture =======" << std::endl; // Jingbo Wang
182  } else
183  ((*theCapture)[i])->Register(theFS);
184  }
185  delete theFS;
186  delete theArFS;
187  hpmanager->RegisterCaptureFinalStates(theCapture);
188  }
189  numEle = G4Element::GetNumberOfElements();
190 }
std::vector< G4ParticleHPChannel * > * theCapture
const std::pair< G4double, G4double > ArParticleHPCapture::GetFatalEnergyCheckLevels ( ) const
override

Definition at line 128 of file ArParticleHPCapture.cc.

129 {
130  return std::pair<G4double, G4double>(10 * perCent, DBL_MAX);
131 }
G4int ArParticleHPCapture::GetVerboseLevel ( ) const

Definition at line 134 of file ArParticleHPCapture.cc.

135 {
136  return G4ParticleHPManager::GetInstance()->GetVerboseLevel();
137 }
void ArParticleHPCapture::ModelDescription ( std::ostream &  outFile) const
override

Definition at line 193 of file ArParticleHPCapture.cc.

194 {
195  outFile << "High Precision model based on Evaluated Nuclear Data Files (ENDF) for radiative "
196  "capture reaction of neutrons below 20MeV\n";
197 }
void ArParticleHPCapture::SetVerboseLevel ( G4int  newValue)

Definition at line 139 of file ArParticleHPCapture.cc.

140 {
141  G4ParticleHPManager::GetInstance()->SetVerboseLevel(newValue);
142 }

Member Data Documentation

G4String ArParticleHPCapture::dirName
private

Definition at line 66 of file ArParticleHPCapture.hh.

Referenced by BuildPhysicsTable().

G4int ArParticleHPCapture::numEle
private

Definition at line 67 of file ArParticleHPCapture.hh.

Referenced by BuildPhysicsTable().

std::vector<G4ParticleHPChannel*>* ArParticleHPCapture::theCapture
private

Definition at line 65 of file ArParticleHPCapture.hh.

Referenced by BuildPhysicsTable(), and ~ArParticleHPCapture().

G4HadFinalState ArParticleHPCapture::theResult
private

Definition at line 69 of file ArParticleHPCapture.hh.


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