Geant4 11.4.0
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 *p=G4Neutron::Neutron(), const char *name="NeutronHPInelastic")
 ~G4ParticleHPInelastic () override
G4HadFinalStateApplyYourself (const G4HadProjectile &aTrack, G4Nucleus &aTargetNucleus) override
const std::pair< G4double, G4doubleGetFatalEnergyCheckLevels () const override
void BuildPhysicsTable (const G4ParticleDefinition &) override
void ModelDescription (std::ostream &outFile) const override
 G4ParticleHPInelastic (G4ParticleHPInelastic &)=delete
G4ParticleHPInelasticoperator= (const G4ParticleHPInelastic &right)=delete
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 &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 std::pair< G4double, G4doubleGetEnergyMomentumCheckLevels () const
void SetEnergyMomentumCheckLevels (G4double relativeLevel, G4double absoluteLevel)
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

G4ParticleHPManagerfManager
G4String dirName
G4int numEle {0}
G4int indexP
Protected Attributes inherited from G4HadronicInteraction
G4HadFinalState theParticleChange
G4int verboseLevel
G4double theMinEnergy
G4double theMaxEnergy
G4bool isBlocked

Static Protected Attributes

static std::vector< G4ParticleHPChannelList * > * theInelastic [6] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}

Additional Inherited Members

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

Detailed Description

Definition at line 49 of file G4ParticleHPInelastic.hh.

Constructor & Destructor Documentation

◆ G4ParticleHPInelastic() [1/2]

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

Definition at line 97 of file G4ParticleHPInelastic.cc.

98 : G4HadronicInteraction(name), theProjectile(p)
99{
101 dirName = fManager->GetParticleHPPath(theProjectile) + "/Inelastic";
102 indexP = fManager->GetPHPIndex(theProjectile);
103
104#ifdef G4VERBOSE
105 if (fManager->GetVerboseLevel() > 1)
106 G4cout << "@@@ G4ParticleHPInelastic instantiated for "
107 << p->GetParticleName() << " indexP=" << indexP
108 << "/n data directory " << dirName << G4endl;
109#endif
110}
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
G4HadronicInteraction(const G4String &modelName="HadronicModel")
const G4String & GetParticleName() const
G4ParticleHPManager * fManager
static G4ParticleHPManager * GetInstance()

Referenced by G4ParticleHPInelastic(), and operator=().

◆ ~G4ParticleHPInelastic()

G4ParticleHPInelastic::~G4ParticleHPInelastic ( )
override

Definition at line 112 of file G4ParticleHPInelastic.cc.

113{
114 // Vector is shared, only one delete
115 if (isFirst) {
116 ClearData();
117 }
118}

◆ G4ParticleHPInelastic() [2/2]

G4ParticleHPInelastic::G4ParticleHPInelastic ( G4ParticleHPInelastic & )
delete

Member Function Documentation

◆ ApplyYourself()

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

Reimplemented from G4HadronicInteraction.

Definition at line 133 of file G4ParticleHPInelastic.cc.

135{
137 const G4Material* theMaterial = aTrack.GetMaterial();
138 auto n = (G4int)theMaterial->GetNumberOfElements();
139 auto elm = theMaterial->GetElement(0);
140 std::size_t index = elm->GetIndex();
141 G4int it = 0;
142 /*
143 G4cout << "G4ParticleHPInelastic::ApplyYourself n=" << n << " index=" << index
144 << " indexP=" << indexP << " "
145 << aTrack.GetDefinition()->GetParticleName() << G4endl;
146 */
147 if (n != 1) {
148 auto xSec = new G4double[n];
149 G4double sum = 0;
150 G4int i;
151 const G4double* NumAtomsPerVolume = theMaterial->GetVecNbOfAtomsPerVolume();
152 G4double rWeight;
153 G4double xs;
154 G4ParticleHPThermalBoost aThermalE;
155 for (i = 0; i < n; ++i) {
156 elm = theMaterial->GetElement(i);
157 index = elm->GetIndex();
158 /*
159 G4cout << "i=" << i << " index=" << index << " " << elm->GetName()
160 << " " << (*(theInelastic[indexP]))[index] << G4endl;
161 */
162 rWeight = NumAtomsPerVolume[i];
163 if (aTrack.GetDefinition() == G4Neutron::Neutron()) {
164 xs = (*(theInelastic[indexP]))[index]->GetXsec(aThermalE.GetThermalEnergy(aTrack, elm,
165 theMaterial->GetTemperature()));
166 }
167 else {
168 xs = (*(theInelastic[indexP]))[index]->GetXsec(aTrack.GetKineticEnergy());
169 }
170 xs *= rWeight;
171 sum += xs;
172 xSec[i] = sum;
173#ifdef G4VERBOSE
174 if (fManager->GetDEBUG())
175 G4cout << " G4ParticleHPInelastic XSEC ELEM " << i << " = " << xSec[i] << G4endl;
176#endif
177 }
178 sum *= G4UniformRand();
179 for (it = 0; it < n; ++it) {
180 elm = theMaterial->GetElement(it);
181 index = elm->GetIndex();
182 if (sum <= xSec[it]) break;
183 }
184 delete[] xSec;
185 }
186
187#ifdef G4VERBOSE
188 if (fManager->GetDEBUG())
189 G4cout << " G4ParticleHPInelastic: Elem it=" << it << " "
190 << elm->GetName() << " index=" << index
191 << " from material " << theMaterial->GetName()
192 << G4endl;
193#endif
194
195 G4HadFinalState* result =
196 (*(theInelastic[indexP]))[index]->ApplyYourself(elm, aTrack);
197
198 aNucleus.SetParameters(fManager->GetReactionWhiteBoard()->GetTargA(),
199 fManager->GetReactionWhiteBoard()->GetTargZ());
200
201 const G4Element* target_element = (*G4Element::GetElementTable())[index];
202 const G4Isotope* target_isotope = nullptr;
203 auto iele = (G4int)target_element->GetNumberOfIsotopes();
204 for (G4int j = 0; j != iele; ++j) {
205 target_isotope = target_element->GetIsotope(j);
206 if (target_isotope->GetN() == fManager->GetReactionWhiteBoard()->GetTargA())
207 break;
208 }
209 aNucleus.SetIsotope(target_isotope);
210
212
213 return result;
214}
double G4double
Definition G4Types.hh:83
int G4int
Definition G4Types.hh:85
#define G4UniformRand()
Definition Randomize.hh:52
std::size_t GetNumberOfIsotopes() const
Definition G4Element.hh:143
std::size_t GetIndex() const
Definition G4Element.hh:159
const G4Isotope * GetIsotope(G4int iso) const
Definition G4Element.hh:151
static const G4ElementTable * GetElementTable()
Definition G4Element.cc:401
const G4Material * GetMaterial() const
const G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
G4int GetN() const
Definition G4Isotope.hh:83
G4double GetTemperature() const
const G4Element * GetElement(G4int iel) const
const G4double * GetVecNbOfAtomsPerVolume() const
std::size_t GetNumberOfElements() const
const G4String & GetName() const
static G4Neutron * Neutron()
Definition G4Neutron.cc:101
static std::vector< G4ParticleHPChannelList * > * theInelastic[6]
G4HadFinalState * ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus &aTargetNucleus) override
G4double GetThermalEnergy(const G4HadProjectile &aP, const G4Element *anE, G4double aT)

Referenced by ApplyYourself().

◆ BuildPhysicsTable()

void G4ParticleHPInelastic::BuildPhysicsTable ( const G4ParticleDefinition & projectile)
overridevirtual

Reimplemented from G4HadronicInteraction.

Definition at line 222 of file G4ParticleHPInelastic.cc.

223{
224 // only one object destroy all list of final state models
225 std::call_once(applyOnce, [this]() { isFirst = true; });
226
228 if (isFirst && nelm != numEle) {
229 G4AutoLock l(&theHPInelastic);
230 if (nelm != numEle) {
231 for (G4int i=0; i<6; ++i) { fLock[i] = false; }
232 }
233 l.unlock();
234 }
235 if (fLock[indexP]) { return; }
236
237 // extra elements should be initialized
238 G4AutoLock l(&theHPInelastic);
239 if (fLock[indexP]) { return; }
240
241 fLock[indexP] = true;
242 G4int n0 = numEle;
243 numEle = nelm;
244
245 if (nullptr == theInelastic[indexP]) {
246 theInelastic[indexP] = new std::vector<G4ParticleHPChannelList*>;
247 }
248
249 if (fManager->GetVerboseLevel() > 0 && isFirst) {
250 fManager->DumpSetting();
251 G4cout << "@@@ G4ParticleHPInelastic instantiated for particle "
252 << theProjectile->GetParticleName() << "/n data directory is "
253 << dirName << G4endl;
254 }
255
257 for (G4int i = n0; i < nelm; ++i) {
258 auto clist = new G4ParticleHPChannelList(36, theProjectile);
259 theInelastic[indexP]->push_back(clist);
260 clist->Init((*table)[i], dirName, theProjectile);
261 clist->Register(new G4ParticleHPNInelasticFS, "F01/"); // has
262 clist->Register(new G4ParticleHPNXInelasticFS, "F02/");
263 clist->Register(new G4ParticleHP2NDInelasticFS, "F03/");
264 clist->Register(new G4ParticleHP2NInelasticFS, "F04/"); // has, E Done
265 clist->Register(new G4ParticleHP3NInelasticFS, "F05/"); // has, E Done
266 clist->Register(new G4ParticleHPNAInelasticFS, "F06/");
267 clist->Register(new G4ParticleHPN3AInelasticFS, "F07/");
268 clist->Register(new G4ParticleHP2NAInelasticFS, "F08/");
269 clist->Register(new G4ParticleHP3NAInelasticFS, "F09/");
270 clist->Register(new G4ParticleHPNPInelasticFS, "F10/");
271 clist->Register(new G4ParticleHPN2AInelasticFS, "F11/");
272 clist->Register(new G4ParticleHP2N2AInelasticFS, "F12/");
273 clist->Register(new G4ParticleHPNDInelasticFS, "F13/");
274 clist->Register(new G4ParticleHPNTInelasticFS, "F14/");
275 clist->Register(new G4ParticleHPNHe3InelasticFS, "F15/");
276 clist->Register(new G4ParticleHPND2AInelasticFS, "F16/");
277 clist->Register(new G4ParticleHPNT2AInelasticFS, "F17/");
278 clist->Register(new G4ParticleHP4NInelasticFS, "F18/"); // has, E Done
279 clist->Register(new G4ParticleHP2NPInelasticFS, "F19/");
280 clist->Register(new G4ParticleHP3NPInelasticFS, "F20/");
281 clist->Register(new G4ParticleHPN2PInelasticFS, "F21/");
282 clist->Register(new G4ParticleHPNPAInelasticFS, "F22/");
283 clist->Register(new G4ParticleHPPInelasticFS, "F23/");
284 clist->Register(new G4ParticleHPDInelasticFS, "F24/");
285 clist->Register(new G4ParticleHPTInelasticFS, "F25/");
286 clist->Register(new G4ParticleHPHe3InelasticFS, "F26/");
287 clist->Register(new G4ParticleHPAInelasticFS, "F27/");
288 clist->Register(new G4ParticleHP2AInelasticFS, "F28/");
289 clist->Register(new G4ParticleHP3AInelasticFS, "F29/");
290 clist->Register(new G4ParticleHP2PInelasticFS, "F30/");
291 clist->Register(new G4ParticleHPPAInelasticFS, "F31/");
292 clist->Register(new G4ParticleHPD2AInelasticFS, "F32/");
293 clist->Register(new G4ParticleHPT2AInelasticFS, "F33/");
294 clist->Register(new G4ParticleHPPDInelasticFS, "F34/");
295 clist->Register(new G4ParticleHPPTInelasticFS, "F35/");
296 clist->Register(new G4ParticleHPDAInelasticFS, "F36/");
297#ifdef G4VERBOSE
298 if (fManager->GetVerboseLevel() > 1) {
299 G4cout << "ParticleHP::Inelastic for "
300 << theProjectile->GetParticleName() << " off "
301 << (*table)[i]->GetName() << G4endl;
302 }
303#endif
304 }
305 fManager->RegisterInelasticFinalStates( &projectile , theInelastic[indexP] );
306 l.unlock();
307}
G4TemplateAutoLock< G4Mutex > G4AutoLock
static std::size_t GetNumberOfElements()
Definition G4Element.cc:408

◆ GetFatalEnergyCheckLevels()

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

Reimplemented from G4HadronicInteraction.

Definition at line 216 of file G4ParticleHPInelastic.cc.

217{
218 // max energy non-conservation is mass of heavy nucleus
219 return std::pair<G4double, G4double>(10.0 * perCent, 350.0 * CLHEP::GeV);
220}

◆ ModelDescription()

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

Reimplemented from G4HadronicInteraction.

Definition at line 309 of file G4ParticleHPInelastic.cc.

310{
311 outFile << "High Precision (HP) model for inelastic reaction of "
312 << theProjectile->GetParticleName() << " below 20MeV\n";
313}

◆ operator=()

G4ParticleHPInelastic & G4ParticleHPInelastic::operator= ( const G4ParticleHPInelastic & right)
delete

Member Data Documentation

◆ dirName

G4String G4ParticleHPInelastic::dirName
protected

Definition at line 82 of file G4ParticleHPInelastic.hh.

Referenced by BuildPhysicsTable(), and G4ParticleHPInelastic().

◆ fManager

G4ParticleHPManager* G4ParticleHPInelastic::fManager
protected

◆ indexP

G4int G4ParticleHPInelastic::indexP
protected

◆ numEle

G4int G4ParticleHPInelastic::numEle {0}
protected

Definition at line 83 of file G4ParticleHPInelastic.hh.

83{0};

Referenced by BuildPhysicsTable().

◆ theInelastic

std::vector< G4ParticleHPChannelList * > * G4ParticleHPInelastic::theInelastic = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}
staticprotected

Definition at line 88 of file G4ParticleHPInelastic.hh.

137{
138public:
139 G4ParticleHPInelastic(G4ParticleDefinition* p = G4Neutron::Neutron(),
140 const char* name = "NeutronHPInelastic");
141
142 ~G4ParticleHPInelastic() override;
143
144 G4HadFinalState* ApplyYourself(const G4HadProjectile& aTrack,
145 G4Nucleus& aTargetNucleus) override;
146
147 const std::pair<G4double, G4double>
148 GetFatalEnergyCheckLevels() const override;
149
150 void BuildPhysicsTable(const G4ParticleDefinition&) override;
151 void ModelDescription(std::ostream& outFile) const override;
152
154 G4ParticleHPInelastic & operator=
155 (const G4ParticleHPInelastic &right) = delete;
156
157private:
158
159 void ClearData();
160
161 G4ParticleDefinition* theProjectile;
162 G4bool isFirst{false};
163 static G4bool fLock[6];
164
165protected:
166 // one List per element
167 static std::vector<G4ParticleHPChannelList*>* theInelastic[6];
168 G4ParticleHPManager* fManager;
169 G4String dirName;
170 G4int numEle{0};
172};
173
174#endif
bool G4bool
Definition G4Types.hh:86
void ModelDescription(std::ostream &outFile) const override
void BuildPhysicsTable(const G4ParticleDefinition &) override
const std::pair< G4double, G4double > GetFatalEnergyCheckLevels() const override
G4ParticleHPInelastic(G4ParticleDefinition *p=G4Neutron::Neutron(), const char *name="NeutronHPInelastic")

Referenced by ApplyYourself(), and BuildPhysicsTable().


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