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

#include <G4NeutronHPInelastic.hh>

Inheritance diagram for G4NeutronHPInelastic:
G4HadronicInteraction

Public Member Functions

 G4NeutronHPInelastic ()
 
 ~G4NeutronHPInelastic ()
 
G4HadFinalStateApplyYourself (const G4HadProjectile &aTrack, G4Nucleus &aTargetNucleus)
 
virtual const std::pair
< G4double, G4double
GetFatalEnergyCheckLevels () const
 
G4int GetVerboseLevel () const
 
void SetVerboseLevel (G4int)
 
- Public Member Functions inherited from G4HadronicInteraction
 G4HadronicInteraction (const G4String &modelName="HadronicModel")
 
virtual ~G4HadronicInteraction ()
 
virtual G4double SampleInvariantT (const G4ParticleDefinition *p, G4double plab, G4int Z, G4int A)
 
virtual G4bool IsApplicable (const G4HadProjectile &, G4Nucleus &)
 
G4double GetMinEnergy () const
 
G4double GetMinEnergy (const G4Material *aMaterial, const G4Element *anElement) const
 
void SetMinEnergy (G4double anEnergy)
 
void SetMinEnergy (G4double anEnergy, const G4Element *anElement)
 
void SetMinEnergy (G4double anEnergy, const G4Material *aMaterial)
 
G4double GetMaxEnergy () const
 
G4double GetMaxEnergy (const G4Material *aMaterial, const G4Element *anElement) const
 
void SetMaxEnergy (const G4double anEnergy)
 
void SetMaxEnergy (G4double anEnergy, const G4Element *anElement)
 
void SetMaxEnergy (G4double anEnergy, const G4Material *aMaterial)
 
const G4HadronicInteractionGetMyPointer () const
 
const G4StringGetModelName () const
 
void DeActivateFor (const G4Material *aMaterial)
 
void ActivateFor (const G4Material *aMaterial)
 
void DeActivateFor (const G4Element *anElement)
 
void ActivateFor (const G4Element *anElement)
 
G4bool IsBlocked (const G4Material *aMaterial) const
 
G4bool IsBlocked (const G4Element *anElement) const
 
void SetRecoilEnergyThreshold (G4double val)
 
G4double GetRecoilEnergyThreshold () const
 
G4bool operator== (const G4HadronicInteraction &right) const
 
G4bool operator!= (const G4HadronicInteraction &right) const
 
virtual std::pair< G4double,
G4double
GetEnergyMomentumCheckLevels () const
 
void SetEnergyMomentumCheckLevels (G4double relativeLevel, G4double absoluteLevel)
 
virtual void ModelDescription (std::ostream &outFile) const
 

Additional Inherited Members

- Protected Member Functions inherited from G4HadronicInteraction
void SetModelName (const G4String &nam)
 
G4bool IsBlocked () const
 
void Block ()
 
- Protected Attributes inherited from G4HadronicInteraction
G4HadFinalState theParticleChange
 
G4int verboseLevel
 
G4double theMinEnergy
 
G4double theMaxEnergy
 
G4bool isBlocked
 

Detailed Description

Definition at line 86 of file G4NeutronHPInelastic.hh.

Constructor & Destructor Documentation

G4NeutronHPInelastic::G4NeutronHPInelastic ( )

Definition at line 44 of file G4NeutronHPInelastic.cc.

References G4cout, G4endl, G4Element::GetElementTable(), G4Element::GetNumberOfElements(), lightions::Init(), python.hepunit::MeV, G4AutoDelete::Register(), G4HadronicInteraction::SetMaxEnergy(), and G4HadronicInteraction::SetMinEnergy().

45  :G4HadronicInteraction("NeutronHPInelastic")
46  {
47  SetMinEnergy( 0.0 );
48  SetMaxEnergy( 20.*MeV );
49 
50  G4int istatus;
51 #if defined WIN32-VC
52  istatus = system("echo %G4NEUTRONHPDATA%");
53 #else
54  istatus = system("echo $G4NEUTRONHPDATA");
55 #endif
56  if ( istatus < 0 )
57  {
58  G4cout << "Warning! system(\"echo $G4NEUTRONHPDATA\") returns error value at G4NeutronHPInelastic" << G4endl;
59  }
60 
61 // G4cout << " entering G4NeutronHPInelastic constructor"<<G4endl;
62  if(!getenv("G4NEUTRONHPDATA"))
63  throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files.");
64  dirName = getenv("G4NEUTRONHPDATA");
65  G4String tString = "/Inelastic";
66  dirName = dirName + tString;
68 /*
69  theInelastic = new G4NeutronHPChannelList[numEle];
70  for (G4int i=0; i<numEle; i++)
71  {
72  theInelastic[i].Init((*(G4Element::GetElementTable()))[i], dirName);
73  G4int itry = 0;
74  do
75  {
76  theInelastic[i].Register(&theNFS, "F01"); // has
77  theInelastic[i].Register(&theNXFS, "F02");
78  theInelastic[i].Register(&the2NDFS, "F03");
79  theInelastic[i].Register(&the2NFS, "F04"); // has, E Done
80  theInelastic[i].Register(&the3NFS, "F05"); // has, E Done
81  theInelastic[i].Register(&theNAFS, "F06");
82  theInelastic[i].Register(&theN3AFS, "F07");
83  theInelastic[i].Register(&the2NAFS, "F08");
84  theInelastic[i].Register(&the3NAFS, "F09");
85  theInelastic[i].Register(&theNPFS, "F10");
86  theInelastic[i].Register(&theN2AFS, "F11");
87  theInelastic[i].Register(&the2N2AFS, "F12");
88  theInelastic[i].Register(&theNDFS, "F13");
89  theInelastic[i].Register(&theNTFS, "F14");
90  theInelastic[i].Register(&theNHe3FS, "F15");
91  theInelastic[i].Register(&theND2AFS, "F16");
92  theInelastic[i].Register(&theNT2AFS, "F17");
93  theInelastic[i].Register(&the4NFS, "F18"); // has, E Done
94  theInelastic[i].Register(&the2NPFS, "F19");
95  theInelastic[i].Register(&the3NPFS, "F20");
96  theInelastic[i].Register(&theN2PFS, "F21");
97  theInelastic[i].Register(&theNPAFS, "F22");
98  theInelastic[i].Register(&thePFS, "F23");
99  theInelastic[i].Register(&theDFS, "F24");
100  theInelastic[i].Register(&theTFS, "F25");
101  theInelastic[i].Register(&theHe3FS, "F26");
102  theInelastic[i].Register(&theAFS, "F27");
103  theInelastic[i].Register(&the2AFS, "F28");
104  theInelastic[i].Register(&the3AFS, "F29");
105  theInelastic[i].Register(&the2PFS, "F30");
106  theInelastic[i].Register(&thePAFS, "F31");
107  theInelastic[i].Register(&theD2AFS, "F32");
108  theInelastic[i].Register(&theT2AFS, "F33");
109  theInelastic[i].Register(&thePDFS, "F34");
110  theInelastic[i].Register(&thePTFS, "F35");
111  theInelastic[i].Register(&theDAFS, "F36");
112  theInelastic[i].RestartRegistration();
113  itry++;
114  }
115  //while(!theInelastic[i].HasDataInAnyFinalState());
116  while( !theInelastic[i].HasDataInAnyFinalState() && itry < 6 );
117  // 6 is corresponding to the value(5) of G4NeutronHPChannel. TK
118 
119  if ( itry == 6 )
120  {
121  // No Final State at all.
122  G4bool exceptional = false;
123  if ( (*(G4Element::GetElementTable()))[i]->GetNumberOfIsotopes() == 1 )
124  {
125  if ( (*(G4Element::GetElementTable()))[i]->GetIsotope( 0 )->GetZ() == 1 && (*(G4Element::GetElementTable()))[i]->GetIsotope( 0 )->GetN() == 1 ) exceptional = true; //1H
126  }
127  if ( !exceptional ) throw G4HadronicException(__FILE__, __LINE__, "Channel: Do not know what to do with this element");
128  }
129  }
130 */
131 
132  for (G4int i=0; i<numEle; i++)
133  {
134  theInelastic.push_back( new G4NeutronHPChannelList );
135  (*theInelastic[i]).Init((*(G4Element::GetElementTable()))[i], dirName);
136  G4int itry = 0;
137  do
138  {
139  (*theInelastic[i]).Register(&theNFS, "F01"); // has
140  (*theInelastic[i]).Register(&theNXFS, "F02");
141  (*theInelastic[i]).Register(&the2NDFS, "F03");
142  (*theInelastic[i]).Register(&the2NFS, "F04"); // has, E Done
143  (*theInelastic[i]).Register(&the3NFS, "F05"); // has, E Done
144  (*theInelastic[i]).Register(&theNAFS, "F06");
145  (*theInelastic[i]).Register(&theN3AFS, "F07");
146  (*theInelastic[i]).Register(&the2NAFS, "F08");
147  (*theInelastic[i]).Register(&the3NAFS, "F09");
148  (*theInelastic[i]).Register(&theNPFS, "F10");
149  (*theInelastic[i]).Register(&theN2AFS, "F11");
150  (*theInelastic[i]).Register(&the2N2AFS, "F12");
151  (*theInelastic[i]).Register(&theNDFS, "F13");
152  (*theInelastic[i]).Register(&theNTFS, "F14");
153  (*theInelastic[i]).Register(&theNHe3FS, "F15");
154  (*theInelastic[i]).Register(&theND2AFS, "F16");
155  (*theInelastic[i]).Register(&theNT2AFS, "F17");
156  (*theInelastic[i]).Register(&the4NFS, "F18"); // has, E Done
157  (*theInelastic[i]).Register(&the2NPFS, "F19");
158  (*theInelastic[i]).Register(&the3NPFS, "F20");
159  (*theInelastic[i]).Register(&theN2PFS, "F21");
160  (*theInelastic[i]).Register(&theNPAFS, "F22");
161  (*theInelastic[i]).Register(&thePFS, "F23");
162  (*theInelastic[i]).Register(&theDFS, "F24");
163  (*theInelastic[i]).Register(&theTFS, "F25");
164  (*theInelastic[i]).Register(&theHe3FS, "F26");
165  (*theInelastic[i]).Register(&theAFS, "F27");
166  (*theInelastic[i]).Register(&the2AFS, "F28");
167  (*theInelastic[i]).Register(&the3AFS, "F29");
168  (*theInelastic[i]).Register(&the2PFS, "F30");
169  (*theInelastic[i]).Register(&thePAFS, "F31");
170  (*theInelastic[i]).Register(&theD2AFS, "F32");
171  (*theInelastic[i]).Register(&theT2AFS, "F33");
172  (*theInelastic[i]).Register(&thePDFS, "F34");
173  (*theInelastic[i]).Register(&thePTFS, "F35");
174  (*theInelastic[i]).Register(&theDAFS, "F36");
175  (*theInelastic[i]).RestartRegistration();
176  itry++;
177  }
178  while( !(*theInelastic[i]).HasDataInAnyFinalState() && itry < 6 );
179  // 6 is corresponding to the value(5) of G4NeutronHPChannel. TK
180 
181  if ( itry == 6 )
182  {
183  // No Final State at all.
184  G4bool exceptional = false;
185  if ( (*(G4Element::GetElementTable()))[i]->GetNumberOfIsotopes() == 1 )
186  {
187  if ( (*(G4Element::GetElementTable()))[i]->GetIsotope( 0 )->GetZ() == 1 && (*(G4Element::GetElementTable()))[i]->GetIsotope( 0 )->GetN() == 1 ) exceptional = true; //1H
188  }
189  if ( !exceptional ) throw G4HadronicException(__FILE__, __LINE__, "Channel: Do not know what to do with this element");
190  }
191 
192  }
193  }
void Init()
Definition: G4IonTable.cc:89
int G4int
Definition: G4Types.hh:78
void SetMinEnergy(G4double anEnergy)
void Register(T *inst)
Definition: G4AutoDelete.hh:65
G4GLOB_DLL std::ostream G4cout
static size_t GetNumberOfElements()
Definition: G4Element.cc:402
bool G4bool
Definition: G4Types.hh:79
G4HadronicInteraction(const G4String &modelName="HadronicModel")
void SetMaxEnergy(const G4double anEnergy)
#define G4endl
Definition: G4ios.hh:61
static G4ElementTable * GetElementTable()
Definition: G4Element.cc:395
G4NeutronHPInelastic::~G4NeutronHPInelastic ( )

Definition at line 195 of file G4NeutronHPInelastic.cc.

196  {
197 // delete [] theInelastic;
198  for ( std::vector<G4NeutronHPChannelList*>::iterator
199  it = theInelastic.begin() ; it != theInelastic.end() ; it++ )
200  {
201  delete *it;
202  }
203  theInelastic.clear();
204  }

Member Function Documentation

G4HadFinalState * G4NeutronHPInelastic::ApplyYourself ( const G4HadProjectile aTrack,
G4Nucleus aTargetNucleus 
)
virtual

Implements G4HadronicInteraction.

Definition at line 208 of file G4NeutronHPInelastic.cc.

References G4NeutronHPManager::CloseReactionWhiteBoard(), G4UniformRand, G4Material::GetElement(), G4Element::GetIndex(), G4NeutronHPManager::GetInstance(), G4HadProjectile::GetMaterial(), G4Element::GetNumberOfElements(), G4Material::GetNumberOfElements(), G4Material::GetTemperature(), G4NeutronHPThermalBoost::GetThermalEnergy(), G4Material::GetVecNbOfAtomsPerVolume(), n, G4NeutronHPManager::OpenReactionWhiteBoard(), and G4Nucleus::SetParameters().

209  {
210  if ( numEle < (G4int)G4Element::GetNumberOfElements() ) addChannelForNewElement();
212  const G4Material * theMaterial = aTrack.GetMaterial();
213  G4int n = theMaterial->GetNumberOfElements();
214  G4int index = theMaterial->GetElement(0)->GetIndex();
215  G4int it=0;
216  if(n!=1)
217  {
218  xSec = new G4double[n];
219  G4double sum=0;
220  G4int i;
221  const G4double * NumAtomsPerVolume = theMaterial->GetVecNbOfAtomsPerVolume();
222  G4double rWeight;
223  G4NeutronHPThermalBoost aThermalE;
224  for (i=0; i<n; i++)
225  {
226  index = theMaterial->GetElement(i)->GetIndex();
227  rWeight = NumAtomsPerVolume[i];
228  //xSec[i] = theInelastic[index].GetXsec(aThermalE.GetThermalEnergy(aTrack,
229  xSec[i] = (*theInelastic[index]).GetXsec(aThermalE.GetThermalEnergy(aTrack,
230  theMaterial->GetElement(i),
231  theMaterial->GetTemperature()));
232  xSec[i] *= rWeight;
233  sum+=xSec[i];
234  }
235  G4double random = G4UniformRand();
236  G4double running = 0;
237  for (i=0; i<n; i++)
238  {
239  running += xSec[i];
240  index = theMaterial->GetElement(i)->GetIndex();
241  it = i;
242  //if(random<=running/sum) break;
243  if( sum == 0 || random<=running/sum) break;
244  }
245  delete [] xSec;
246  }
247 
248  //return theInelastic[index].ApplyYourself(theMaterial->GetElement(it), aTrack);
249  G4HadFinalState* result = (*theInelastic[index]).ApplyYourself(theMaterial->GetElement(it), aTrack);
250  //
251  aNucleus.SetParameters(G4NeutronHPManager::GetInstance()->GetReactionWhiteBoard()->GetTargA(),G4NeutronHPManager::GetInstance()->GetReactionWhiteBoard()->GetTargZ());
253  return result;
254  }
static G4NeutronHPManager * GetInstance()
const G4Element * GetElement(G4int iel) const
Definition: G4Material.hh:200
int G4int
Definition: G4Types.hh:78
const G4double * GetVecNbOfAtomsPerVolume() const
Definition: G4Material.hh:204
#define G4UniformRand()
Definition: Randomize.hh:87
static size_t GetNumberOfElements()
Definition: G4Element.cc:402
size_t GetIndex() const
Definition: G4Element.hh:181
const G4int n
G4double GetThermalEnergy(const G4HadProjectile &aP, const G4Element *anE, G4double aT)
G4HadFinalState * ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus &aTargetNucleus)
G4double GetTemperature() const
Definition: G4Material.hh:180
const G4Material * GetMaterial() const
size_t GetNumberOfElements() const
Definition: G4Material.hh:184
double G4double
Definition: G4Types.hh:76
const std::pair< G4double, G4double > G4NeutronHPInelastic::GetFatalEnergyCheckLevels ( ) const
virtual

Reimplemented from G4HadronicInteraction.

Definition at line 256 of file G4NeutronHPInelastic.cc.

References DBL_MAX, and python.hepunit::perCent.

257 {
258  // max energy non-conservation is mass of heavy nucleus
259 // if ( getenv("G4NEUTRONHP_DO_NOT_ADJUST_FINAL_STATE") ) return std::pair<G4double, G4double>(5*perCent,250*GeV);
260  // This should be same to the hadron default value
261 // return std::pair<G4double, G4double>(10*perCent,10*GeV);
262  return std::pair<G4double, G4double>(10*perCent,DBL_MAX);
263 }
float perCent
Definition: hepunit.py:239
#define DBL_MAX
Definition: templates.hh:83
G4int G4NeutronHPInelastic::GetVerboseLevel ( ) const
virtual

Reimplemented from G4HadronicInteraction.

Definition at line 333 of file G4NeutronHPInelastic.cc.

References G4NeutronHPManager::GetInstance(), and G4NeutronHPManager::GetVerboseLevel().

334 {
336 }
static G4NeutronHPManager * GetInstance()
void G4NeutronHPInelastic::SetVerboseLevel ( G4int  newValue)
virtual

Reimplemented from G4HadronicInteraction.

Definition at line 337 of file G4NeutronHPInelastic.cc.

References G4NeutronHPManager::GetInstance(), and G4NeutronHPManager::SetVerboseLevel().

338 {
340 }
static G4NeutronHPManager * GetInstance()
void SetVerboseLevel(G4int i)

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