Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4NeutronHPInelastic Class Reference

#include <G4NeutronHPInelastic.hh>

+ Inheritance diagram for G4NeutronHPInelastic:

Public Member Functions

 G4NeutronHPInelastic ()
 
 ~G4NeutronHPInelastic ()
 
G4HadFinalStateApplyYourself (const G4HadProjectile &aTrack, G4Nucleus &aTargetNucleus)
 
virtual const std::pair< G4double, G4doubleGetFatalEnergyCheckLevels () const
 
- Public Member Functions inherited from G4HadronicInteraction
 G4HadronicInteraction (const G4String &modelName="HadronicModel")
 
virtual ~G4HadronicInteraction ()
 
virtual G4HadFinalStateApplyYourself (const G4HadProjectile &aTrack, G4Nucleus &targetNucleus)=0
 
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
 
G4int GetVerboseLevel () const
 
void SetVerboseLevel (G4int value)
 
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 const std::pair< G4double, G4doubleGetFatalEnergyCheckLevels () const
 
virtual std::pair< G4double, G4doubleGetEnergyMomentumCheckLevels () 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 87 of file G4NeutronHPInelastic.hh.

Constructor & Destructor Documentation

◆ G4NeutronHPInelastic()

G4NeutronHPInelastic::G4NeutronHPInelastic ( )

Definition at line 45 of file G4NeutronHPInelastic.cc.

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

◆ ~G4NeutronHPInelastic()

G4NeutronHPInelastic::~G4NeutronHPInelastic ( )

Definition at line 191 of file G4NeutronHPInelastic.cc.

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

Member Function Documentation

◆ ApplyYourself()

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

Implements G4HadronicInteraction.

Definition at line 204 of file G4NeutronHPInelastic.cc.

205 {
206 if ( numEle < (G4int)G4Element::GetNumberOfElements() ) addChannelForNewElement();
208 const G4Material * theMaterial = aTrack.GetMaterial();
209 G4int n = theMaterial->GetNumberOfElements();
210 G4int index = theMaterial->GetElement(0)->GetIndex();
211 G4int it=0;
212 if(n!=1)
213 {
214 xSec = new G4double[n];
215 G4double sum=0;
216 G4int i;
217 const G4double * NumAtomsPerVolume = theMaterial->GetVecNbOfAtomsPerVolume();
218 G4double rWeight;
219 G4NeutronHPThermalBoost aThermalE;
220 for (i=0; i<n; i++)
221 {
222 index = theMaterial->GetElement(i)->GetIndex();
223 rWeight = NumAtomsPerVolume[i];
224 //xSec[i] = theInelastic[index].GetXsec(aThermalE.GetThermalEnergy(aTrack,
225 xSec[i] = (*theInelastic[index]).GetXsec(aThermalE.GetThermalEnergy(aTrack,
226 theMaterial->GetElement(i),
227 theMaterial->GetTemperature()));
228 xSec[i] *= rWeight;
229 sum+=xSec[i];
230 }
231 G4double random = G4UniformRand();
232 G4double running = 0;
233 for (i=0; i<n; i++)
234 {
235 running += xSec[i];
236 index = theMaterial->GetElement(i)->GetIndex();
237 it = i;
238 //if(random<=running/sum) break;
239 if( sum == 0 || random<=running/sum) break;
240 }
241 delete [] xSec;
242 }
243
244 //return theInelastic[index].ApplyYourself(theMaterial->GetElement(it), aTrack);
245 G4HadFinalState* result = (*theInelastic[index]).ApplyYourself(theMaterial->GetElement(it), aTrack);
246 //
249 return result;
250 }
double G4double
Definition: G4Types.hh:64
#define G4UniformRand()
Definition: Randomize.hh:53
size_t GetIndex() const
Definition: G4Element.hh:182
const G4Material * GetMaterial() const
G4double GetTemperature() const
Definition: G4Material.hh:181
const G4Element * GetElement(G4int iel) const
Definition: G4Material.hh:201
size_t GetNumberOfElements() const
Definition: G4Material.hh:185
const G4double * GetVecNbOfAtomsPerVolume() const
Definition: G4Material.hh:205
G4HadFinalState * ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus &aTargetNucleus)
static G4NeutronHPManager * GetInstance()
G4NeutronHPReactionWhiteBoard * GetReactionWhiteBoard()
G4double GetThermalEnergy(const G4HadProjectile &aP, const G4Element *anE, G4double aT)

Referenced by ApplyYourself().

◆ GetFatalEnergyCheckLevels()

const std::pair< G4double, G4double > G4NeutronHPInelastic::GetFatalEnergyCheckLevels ( ) const
virtual

Reimplemented from G4HadronicInteraction.

Definition at line 252 of file G4NeutronHPInelastic.cc.

253{
254 // max energy non-conservation is mass of heavy nucleus
255// if ( getenv("G4NEUTRONHP_DO_NOT_ADJUST_FINAL_STATE") ) return std::pair<G4double, G4double>(5*perCent,250*GeV);
256 // This should be same to the hadron default value
257// return std::pair<G4double, G4double>(10*perCent,10*GeV);
258 return std::pair<G4double, G4double>(10*perCent,DBL_MAX);
259}
#define DBL_MAX
Definition: templates.hh:83

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