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

#include <G4ParticleHPInelastic.hh>

+ Inheritance diagram for G4ParticleHPInelastic:

Public Member Functions

 G4ParticleHPInelastic (G4ParticleDefinition *projectile=G4Neutron::Neutron(), const char *name="NeutronHPInelastic")
 
 ~G4ParticleHPInelastic ()
 
G4HadFinalStateApplyYourself (const G4HadProjectile &aTrack, G4Nucleus &aTargetNucleus)
 
virtual const std::pair< G4double, G4doubleGetFatalEnergyCheckLevels () const
 
G4int GetVerboseLevel () const
 
void SetVerboseLevel (G4int)
 
void BuildPhysicsTable (const G4ParticleDefinition &)
 
virtual void ModelDescription (std::ostream &outFile) const
 
- Public Member Functions inherited from G4HadronicInteraction
 G4HadronicInteraction (const G4String &modelName="HadronicModel")
 
virtual ~G4HadronicInteraction ()
 
virtual G4HadFinalStateApplyYourself (const G4HadProjectile &aTrack, G4Nucleus &targetNucleus)
 
virtual G4double SampleInvariantT (const G4ParticleDefinition *p, G4double plab, G4int Z, G4int A)
 
virtual G4bool IsApplicable (const G4HadProjectile &aTrack, G4Nucleus &targetNucleus)
 
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)
 
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
 
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
 
virtual void BuildPhysicsTable (const G4ParticleDefinition &)
 
virtual void InitialiseModel ()
 
 G4HadronicInteraction (const G4HadronicInteraction &right)=delete
 
const G4HadronicInteractionoperator= (const G4HadronicInteraction &right)=delete
 
G4bool operator== (const G4HadronicInteraction &right) const =delete
 
G4bool operator!= (const G4HadronicInteraction &right) const =delete
 

Protected Attributes

std::vector< G4ParticleHPChannelList * > * theInelastic
 
G4String dataDirVariable
 
G4String dirName
 
G4int numEle
 
- Protected Attributes inherited from G4HadronicInteraction
G4HadFinalState theParticleChange
 
G4int verboseLevel
 
G4double theMinEnergy
 
G4double theMaxEnergy
 
G4bool isBlocked
 

Additional Inherited Members

- Protected Member Functions inherited from G4HadronicInteraction
void SetModelName (const G4String &nam)
 
G4bool IsBlocked () const
 
void Block ()
 

Detailed Description

Definition at line 89 of file G4ParticleHPInelastic.hh.

Constructor & Destructor Documentation

◆ G4ParticleHPInelastic()

G4ParticleHPInelastic::G4ParticleHPInelastic ( G4ParticleDefinition projectile = G4Neutron::Neutron(),
const char *  name = "NeutronHPInelastic" 
)

Definition at line 85 of file G4ParticleHPInelastic.cc.

87 : G4HadronicInteraction(name), theInelastic(nullptr), numEle(0)
88 , theProjectile(projectile)
89{
90 G4String baseName;
91 if ( G4FindDataDir("G4PARTICLEHPDATA") ) {
92 baseName = G4FindDataDir( "G4PARTICLEHPDATA" );
93 }
94 //const char* dataDirVariable;
95 G4String particleName;
96 if ( theProjectile == G4Neutron::Neutron() ) {
97 dataDirVariable = "G4NEUTRONHPDATA";
98 } else if( theProjectile == G4Proton::Proton() ) {
99 dataDirVariable = "G4PROTONHPDATA";
100 particleName = "Proton";
101 } else if( theProjectile == G4Deuteron::Deuteron() ) {
102 dataDirVariable = "G4DEUTERONHPDATA";
103 particleName = "Deuteron";
104 } else if( theProjectile == G4Triton::Triton() ) {
105 dataDirVariable = "G4TRITONHPDATA";
106 particleName = "Triton";
107 } else if( theProjectile == G4He3::He3() ) {
108 dataDirVariable = "G4HE3HPDATA";
109 particleName = "He3";
110 } else if( theProjectile == G4Alpha::Alpha() ) {
111 dataDirVariable = "G4ALPHAHPDATA";
112 particleName = "Alpha";
113 } else {
114 G4String message("G4ParticleHPInelastic may only be called for neutron, proton, deuteron, triton, He3 or alpha, while it is called for " + theProjectile->GetParticleName());
115 throw G4HadronicException(__FILE__, __LINE__,message.c_str());
116 }
117
118 SetMinEnergy( 0.0 );
119 SetMaxEnergy( 20.*MeV );
120
121 //G4cout << " entering G4ParticleHPInelastic constructor"<<G4endl;
122 if ( !G4FindDataDir("G4PARTICLEHPDATA") && !G4FindDataDir(dataDirVariable) ) {
123 G4String message("Please setenv G4PARTICLEHPDATA (recommended) or, at least setenv " +
124 G4String(dataDirVariable) + " to point to the " + theProjectile->GetParticleName() + " cross-section files." );
125 throw G4HadronicException(__FILE__, __LINE__,message.c_str());
126 }
129 } else {
130 dirName = baseName + "/" + particleName;
131 }
132
133#ifdef G4VERBOSE
135#endif
136
137 G4String tString = "/Inelastic";
138 dirName = dirName + tString;
139
140#ifdef G4VERBOSE
142 G4cout << "@@@ G4ParticleHPInelastic instantiated for particle " << theProjectile->GetParticleName() << " data directory variable is " << dataDirVariable << " pointing to " << dirName << G4endl;
143#endif
144 }
const char * G4FindDataDir(const char *)
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
static G4Alpha * Alpha()
Definition: G4Alpha.cc:88
static G4Deuteron * Deuteron()
Definition: G4Deuteron.cc:93
void SetMinEnergy(G4double anEnergy)
void SetMaxEnergy(const G4double anEnergy)
static G4HadronicParameters * Instance()
static G4He3 * He3()
Definition: G4He3.cc:93
static G4Neutron * Neutron()
Definition: G4Neutron.cc:103
const G4String & GetParticleName() const
std::vector< G4ParticleHPChannelList * > * theInelastic
static G4Proton * Proton()
Definition: G4Proton.cc:92
static G4Triton * Triton()
Definition: G4Triton.cc:93

◆ ~G4ParticleHPInelastic()

G4ParticleHPInelastic::~G4ParticleHPInelastic ( )

Definition at line 146 of file G4ParticleHPInelastic.cc.

147 {
148 //Vector is shared, only master deletes
150 if ( theInelastic != nullptr ) {
151 for ( auto it=theInelastic->cbegin(); it!=theInelastic->cend(); ++it ) {
152 delete *it;
153 }
154 theInelastic->clear();
155 }
156 }
157 }
G4bool IsWorkerThread()
Definition: G4Threading.cc:123

Member Function Documentation

◆ ApplyYourself()

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

Reimplemented from G4HadronicInteraction.

Definition at line 159 of file G4ParticleHPInelastic.cc.

160 {
162 const G4Material * theMaterial = aTrack.GetMaterial();
163 G4int n = (G4int)theMaterial->GetNumberOfElements();
164 std::size_t index = theMaterial->GetElement(0)->GetIndex();
165 G4int it=0;
166 if(n!=1)
167 {
168 G4double* xSec = new G4double[n];
169 G4double sum=0;
170 G4int i;
171 const G4double * NumAtomsPerVolume = theMaterial->GetVecNbOfAtomsPerVolume();
172 G4double rWeight;
173 G4ParticleHPThermalBoost aThermalE;
174 for (i=0; i<n; ++i)
175 {
176 index = theMaterial->GetElement(i)->GetIndex();
177 rWeight = NumAtomsPerVolume[i];
178 if ( aTrack.GetDefinition() == G4Neutron::Neutron() ) {
179 xSec[i] = ((*theInelastic)[index])->GetXsec(aThermalE.GetThermalEnergy(aTrack,
180 theMaterial->GetElement(i),
181 theMaterial->GetTemperature()));
182 } else {
183 xSec[i] = ((*theInelastic)[index])->GetXsec(aTrack.GetKineticEnergy());
184 }
185 xSec[i] *= rWeight;
186 sum+=xSec[i];
187#ifdef G4PHPDEBUG
188 #ifdef G4VERBOSE
189 if( std::getenv("G4ParticleHPDebug") && G4HadronicParameters::Instance()->GetVerboseLevel() > 0 )
190 G4cout << " G4ParticleHPInelastic XSEC ELEM " << i << " = " << xSec[i] << G4endl;
191 #endif
192#endif
193
194 }
195 G4double random = G4UniformRand();
196 G4double running = 0;
197 for (i=0; i<n; ++i)
198 {
199 running += xSec[i];
200 index = theMaterial->GetElement(i)->GetIndex();
201 it = i;
202 //if(random<=running/sum) break;
203 if( sum == 0 || random<=running/sum) break;
204 }
205 delete [] xSec;
206 }
207
208#ifdef G4PHPDEBUG
209 #ifdef G4VERBOSE
210 if( std::getenv("G4ParticleHPDebug") && G4HadronicParameters::Instance()->GetVerboseLevel() > 0 )
211 G4cout << " G4ParticleHPInelastic SELECTED ELEM " << it << " = " << theMaterial->GetElement(it)->GetName() << " FROM MATERIAL " << theMaterial->GetName() << G4endl;
212 #endif
213#endif
214 //return theInelastic[index].ApplyYourself(theMaterial->GetElement(it), aTrack);
215 G4HadFinalState* result = ((*theInelastic)[index])->ApplyYourself(theMaterial->GetElement(it), aTrack);
216 //
218 const G4Element* target_element = (*G4Element::GetElementTable())[index];
219 const G4Isotope* target_isotope = nullptr;
220 G4int iele = (G4int)target_element->GetNumberOfIsotopes();
221 for ( G4int j = 0 ; j != iele ; ++j ) {
222 target_isotope=target_element->GetIsotope( j );
223 if ( target_isotope->GetN() == G4ParticleHPManager::GetInstance()->GetReactionWhiteBoard()->GetTargA() ) break;
224 }
225 aNucleus.SetIsotope( target_isotope );
226
228
229 return result;
230 }
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
#define G4UniformRand()
Definition: Randomize.hh:52
static G4ElementTable * GetElementTable()
Definition: G4Element.cc:403
const G4Isotope * GetIsotope(G4int iso) const
Definition: G4Element.hh:170
size_t GetIndex() const
Definition: G4Element.hh:182
size_t GetNumberOfIsotopes() const
Definition: G4Element.hh:159
const G4String & GetName() const
Definition: G4Element.hh:127
const G4Material * GetMaterial() const
const G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
G4int GetN() const
Definition: G4Isotope.hh:93
G4double GetTemperature() const
Definition: G4Material.hh:177
const G4Element * GetElement(G4int iel) const
Definition: G4Material.hh:197
size_t GetNumberOfElements() const
Definition: G4Material.hh:181
const G4double * GetVecNbOfAtomsPerVolume() const
Definition: G4Material.hh:201
const G4String & GetName() const
Definition: G4Material.hh:172
G4HadFinalState * ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus &aTargetNucleus)
static G4ParticleHPManager * GetInstance()
G4ParticleHPReactionWhiteBoard * GetReactionWhiteBoard()
G4double GetThermalEnergy(const G4HadProjectile &aP, const G4Element *anE, G4double aT)

Referenced by ApplyYourself().

◆ BuildPhysicsTable()

void G4ParticleHPInelastic::BuildPhysicsTable ( const G4ParticleDefinition projectile)
virtual

Reimplemented from G4HadronicInteraction.

Definition at line 247 of file G4ParticleHPInelastic.cc.

247 {
248
250
251 theInelastic = hpmanager->GetInelasticFinalStates( &projectile );
252
254
255 if ( theInelastic == nullptr ) theInelastic = new std::vector<G4ParticleHPChannelList*>;
256
257 if ( numEle == (G4int)G4Element::GetNumberOfElements() ) return;
258
259 if ( theInelastic->size() == G4Element::GetNumberOfElements() ) {
261 return;
262 }
263#ifdef G4VERBOSE
265 hpmanager->DumpSetting();
266 G4cout << "@@@ G4ParticleHPInelastic instantiated for particle " << projectile.GetParticleName() << " data directory variable is " << dataDirVariable << " pointing to " << dirName << G4endl;
267 }
268#endif
269 for (G4int i = numEle ; i < (G4int)G4Element::GetNumberOfElements(); ++i)
270 {
271 theInelastic->push_back( new G4ParticleHPChannelList );
272 ((*theInelastic)[i])->Init((*(G4Element::GetElementTable()))[i], dirName, const_cast<G4ParticleDefinition*>(&projectile));
273 G4int itry = 0;
274 do
275 {
276 ((*theInelastic)[i])->Register( new G4ParticleHPNInelasticFS , "F01"); // has
277 ((*theInelastic)[i])->Register( new G4ParticleHPNXInelasticFS , "F02");
278 ((*theInelastic)[i])->Register( new G4ParticleHP2NDInelasticFS , "F03");
279 ((*theInelastic)[i])->Register( new G4ParticleHP2NInelasticFS , "F04"); // has, E Done
280 ((*theInelastic)[i])->Register( new G4ParticleHP3NInelasticFS , "F05"); // has, E Done
281 ((*theInelastic)[i])->Register( new G4ParticleHPNAInelasticFS , "F06");
282 ((*theInelastic)[i])->Register( new G4ParticleHPN3AInelasticFS , "F07");
283 ((*theInelastic)[i])->Register( new G4ParticleHP2NAInelasticFS , "F08");
284 ((*theInelastic)[i])->Register( new G4ParticleHP3NAInelasticFS , "F09");
285 ((*theInelastic)[i])->Register( new G4ParticleHPNPInelasticFS , "F10");
286 ((*theInelastic)[i])->Register( new G4ParticleHPN2AInelasticFS , "F11");
287 ((*theInelastic)[i])->Register( new G4ParticleHP2N2AInelasticFS , "F12");
288 ((*theInelastic)[i])->Register( new G4ParticleHPNDInelasticFS , "F13");
289 ((*theInelastic)[i])->Register( new G4ParticleHPNTInelasticFS , "F14");
290 ((*theInelastic)[i])->Register( new G4ParticleHPNHe3InelasticFS , "F15");
291 ((*theInelastic)[i])->Register( new G4ParticleHPND2AInelasticFS , "F16");
292 ((*theInelastic)[i])->Register( new G4ParticleHPNT2AInelasticFS , "F17");
293 ((*theInelastic)[i])->Register( new G4ParticleHP4NInelasticFS , "F18"); // has, E Done
294 ((*theInelastic)[i])->Register( new G4ParticleHP2NPInelasticFS , "F19");
295 ((*theInelastic)[i])->Register( new G4ParticleHP3NPInelasticFS , "F20");
296 ((*theInelastic)[i])->Register( new G4ParticleHPN2PInelasticFS , "F21");
297 ((*theInelastic)[i])->Register( new G4ParticleHPNPAInelasticFS , "F22");
298 ((*theInelastic)[i])->Register( new G4ParticleHPPInelasticFS , "F23");
299 ((*theInelastic)[i])->Register( new G4ParticleHPDInelasticFS , "F24");
300 ((*theInelastic)[i])->Register( new G4ParticleHPTInelasticFS , "F25");
301 ((*theInelastic)[i])->Register( new G4ParticleHPHe3InelasticFS , "F26");
302 ((*theInelastic)[i])->Register( new G4ParticleHPAInelasticFS , "F27");
303 ((*theInelastic)[i])->Register( new G4ParticleHP2AInelasticFS , "F28");
304 ((*theInelastic)[i])->Register( new G4ParticleHP3AInelasticFS , "F29");
305 ((*theInelastic)[i])->Register( new G4ParticleHP2PInelasticFS , "F30");
306 ((*theInelastic)[i])->Register( new G4ParticleHPPAInelasticFS , "F31");
307 ((*theInelastic)[i])->Register( new G4ParticleHPD2AInelasticFS , "F32");
308 ((*theInelastic)[i])->Register( new G4ParticleHPT2AInelasticFS , "F33");
309 ((*theInelastic)[i])->Register( new G4ParticleHPPDInelasticFS , "F34");
310 ((*theInelastic)[i])->Register( new G4ParticleHPPTInelasticFS , "F35");
311 ((*theInelastic)[i])->Register( new G4ParticleHPDAInelasticFS , "F36");
312 ((*theInelastic)[i])->RestartRegistration();
313 itry++;
314 }
315 while( !((*theInelastic)[i])->HasDataInAnyFinalState() && itry < 6 ); // Loop checking, 11.05.2015, T. Koi
316 // 6 is corresponding to the value(5) of G4ParticleHPChannel. TK
317
318 if ( itry == 6 ) {
319 // No Final State at all.
320#ifdef G4VERBOSE
323 G4cout << "ParticleHP::Inelastic for " << projectile.GetParticleName() << ". Do not know what to do with element of \"" << (*(G4Element::GetElementTable()))[i]->GetName() << "\"." << G4endl;
324 G4cout << "The components of the element are" << G4endl;
325 for ( G4int ii = 0 ; ii < (G4int)( (*(G4Element::GetElementTable()))[i]->GetNumberOfIsotopes() ) ; ++ii ) {
326 G4cout << " Z: " << (*(G4Element::GetElementTable()))[i]->GetIsotope( ii )->GetZ() << ", A: " << (*(G4Element::GetElementTable()))[i]->GetIsotope( ii )->GetN() << G4endl;
327 }
328 G4cout << "No possible final state data of the element is found in " << dataDirVariable << "." << G4endl;
329 }
330#endif
331 }
332 }
333 hpmanager->RegisterInelasticFinalStates( &projectile , theInelastic );
334 }
336}
static size_t GetNumberOfElements()
Definition: G4Element.cc:410
std::vector< G4ParticleHPChannelList * > * GetInelasticFinalStates(const G4ParticleDefinition *)
void RegisterInelasticFinalStates(const G4ParticleDefinition *, std::vector< G4ParticleHPChannelList * > *)
void Register(T *inst)
Definition: G4AutoDelete.hh:65
G4bool IsMasterThread()
Definition: G4Threading.cc:124
void Init()
Definition: G4IonTable.cc:77

◆ GetFatalEnergyCheckLevels()

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

Reimplemented from G4HadronicInteraction.

Definition at line 232 of file G4ParticleHPInelastic.cc.

233{
234 // max energy non-conservation is mass of heavy nucleus
235 return std::pair<G4double, G4double>(10.0*perCent, 350.0*CLHEP::GeV);
236}

◆ GetVerboseLevel()

G4int G4ParticleHPInelastic::GetVerboseLevel ( ) const

Definition at line 238 of file G4ParticleHPInelastic.cc.

Referenced by ApplyYourself(), and G4ParticleHPInelastic().

◆ ModelDescription()

void G4ParticleHPInelastic::ModelDescription ( std::ostream &  outFile) const
virtual

Reimplemented from G4HadronicInteraction.

Definition at line 338 of file G4ParticleHPInelastic.cc.

339{
340 outFile << "Extension of High Precision model for inelastic reaction of proton,\n"
341 << "deuteron, triton, He3 and alpha below 20MeV\n";
342}

◆ SetVerboseLevel()

void G4ParticleHPInelastic::SetVerboseLevel ( G4int  newValue)

Definition at line 242 of file G4ParticleHPInelastic.cc.

243{
245}

Member Data Documentation

◆ dataDirVariable

G4String G4ParticleHPInelastic::dataDirVariable
protected

Definition at line 110 of file G4ParticleHPInelastic.hh.

Referenced by BuildPhysicsTable(), and G4ParticleHPInelastic().

◆ dirName

G4String G4ParticleHPInelastic::dirName
protected

Definition at line 111 of file G4ParticleHPInelastic.hh.

Referenced by BuildPhysicsTable(), and G4ParticleHPInelastic().

◆ numEle

G4int G4ParticleHPInelastic::numEle
protected

Definition at line 112 of file G4ParticleHPInelastic.hh.

Referenced by BuildPhysicsTable().

◆ theInelastic

std::vector<G4ParticleHPChannelList*>* G4ParticleHPInelastic::theInelastic
protected

Definition at line 109 of file G4ParticleHPInelastic.hh.

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


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