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

#include <G4VModularPhysicsList.hh>

+ Inheritance diagram for G4VModularPhysicsList:

Public Member Functions

 G4VModularPhysicsList ()
 
virtual ~G4VModularPhysicsList ()
 
virtual void ConstructParticle () override
 
virtual void ConstructProcess () override
 
void RegisterPhysics (G4VPhysicsConstructor *)
 
const G4VPhysicsConstructorGetPhysics (G4int index) const
 
const G4VPhysicsConstructorGetPhysics (const G4String &name) const
 
const G4VPhysicsConstructorGetPhysicsWithType (G4int physics_type) const
 
void ReplacePhysics (G4VPhysicsConstructor *)
 
void RemovePhysics (G4VPhysicsConstructor *)
 
void RemovePhysics (G4int type)
 
void RemovePhysics (const G4String &name)
 
G4int GetInstanceID () const
 
virtual void TerminateWorker () override
 
void SetVerboseLevel (G4int value)
 
G4int GetVerboseLevel () const
 
- Public Member Functions inherited from G4VUserPhysicsList
 G4VUserPhysicsList ()
 
virtual ~G4VUserPhysicsList ()
 
 G4VUserPhysicsList (const G4VUserPhysicsList &)
 
G4VUserPhysicsListoperator= (const G4VUserPhysicsList &)
 
virtual void ConstructParticle ()=0
 
void Construct ()
 
virtual void ConstructProcess ()=0
 
virtual void SetCuts ()
 
void SetDefaultCutValue (G4double newCutValue)
 
G4double GetDefaultCutValue () const
 
void BuildPhysicsTable ()
 
void PreparePhysicsTable (G4ParticleDefinition *)
 
void BuildPhysicsTable (G4ParticleDefinition *)
 
G4bool StorePhysicsTable (const G4String &directory=".")
 
G4bool IsPhysicsTableRetrieved () const
 
G4bool IsStoredInAscii () const
 
const G4StringGetPhysicsTableDirectory () const
 
void SetPhysicsTableRetrieved (const G4String &directory="")
 
void SetStoredInAscii ()
 
void ResetPhysicsTableRetrieved ()
 
void ResetStoredInAscii ()
 
void DumpList () const
 
void DumpCutValuesTable (G4int flag=1)
 
void DumpCutValuesTableIfRequested ()
 
void SetVerboseLevel (G4int value)
 
G4int GetVerboseLevel () const
 
void UseCoupledTransportation (G4bool vl=true)
 
void SetCutsWithDefault ()
 
void SetCutValue (G4double aCut, const G4String &pname)
 
G4double GetCutValue (const G4String &pname) const
 
void SetCutValue (G4double aCut, const G4String &pname, const G4String &rname)
 
void SetParticleCuts (G4double cut, G4ParticleDefinition *particle, G4Region *region=nullptr)
 
void SetParticleCuts (G4double cut, const G4String &particleName, G4Region *region=nullptr)
 
void SetCutsForRegion (G4double aCut, const G4String &rname)
 
void SetApplyCuts (G4bool value, const G4String &name)
 
G4bool GetApplyCuts (const G4String &name) const
 
void RemoveProcessManager ()
 
void RemoveTrackingManager ()
 
void AddProcessManager (G4ParticleDefinition *newParticle, G4ProcessManager *newManager=nullptr)
 
void CheckParticleList ()
 
void DisableCheckParticleList ()
 
G4int GetInstanceID () const
 
virtual void InitializeWorker ()
 
virtual void TerminateWorker ()
 

Static Public Member Functions

static const G4VMPLManagerGetSubInstanceManager ()
 
- Static Public Member Functions inherited from G4VUserPhysicsList
static const G4VUPLManagerGetSubInstanceManager ()
 

Protected Types

using G4PhysConstVector = G4VMPLData::G4PhysConstVectorData
 

Protected Member Functions

 G4VModularPhysicsList (const G4VModularPhysicsList &)
 
G4VModularPhysicsListoperator= (const G4VModularPhysicsList &)
 
- Protected Member Functions inherited from G4VUserPhysicsList
void AddTransportation ()
 
G4bool RegisterProcess (G4VProcess *process, G4ParticleDefinition *particle)
 
void BuildIntegralPhysicsTable (G4VProcess *, G4ParticleDefinition *)
 
virtual void RetrievePhysicsTable (G4ParticleDefinition *, const G4String &directory, G4bool ascii=false)
 
void InitializeProcessManager ()
 
G4ParticleTable::G4PTblDicIteratorGetParticleIterator () const
 

Protected Attributes

G4int verboseLevel = 0
 
G4int g4vmplInstanceID = 0
 
- Protected Attributes inherited from G4VUserPhysicsList
G4ParticleTabletheParticleTable = nullptr
 
G4int verboseLevel = 1
 
G4double defaultCutValue = 1.0
 
G4bool isSetDefaultCutValue = false
 
G4ProductionCutsTablefCutsTable = nullptr
 
G4bool fRetrievePhysicsTable = false
 
G4bool fStoredInAscii = true
 
G4bool fIsCheckedForRetrievePhysicsTable = false
 
G4bool fIsRestoredCutValues = false
 
G4String directoryPhysicsTable = "."
 
G4bool fDisableCheckParticleList = false
 
G4int g4vuplInstanceID = 0
 

Static Protected Attributes

static G4RUN_DLL G4VMPLManager G4VMPLsubInstanceManager
 
- Static Protected Attributes inherited from G4VUserPhysicsList
static G4RUN_DLL G4VUPLManager subInstanceManager
 

Detailed Description

Definition at line 86 of file G4VModularPhysicsList.hh.

Member Typedef Documentation

◆ G4PhysConstVector

Constructor & Destructor Documentation

◆ G4VModularPhysicsList() [1/2]

G4VModularPhysicsList::G4VModularPhysicsList ( )

◆ ~G4VModularPhysicsList()

G4VModularPhysicsList::~G4VModularPhysicsList ( )
virtual

Definition at line 57 of file G4VModularPhysicsList.cc.

58{
59 if(G4MT_physicsVector != nullptr)
60 {
61 for(auto & ptr : *G4MT_physicsVector) { delete ptr; }
62 delete G4MT_physicsVector;
63 G4MT_physicsVector = nullptr;
64 }
65}
#define G4MT_physicsVector

◆ G4VModularPhysicsList() [2/2]

G4VModularPhysicsList::G4VModularPhysicsList ( const G4VModularPhysicsList right)
protected

Member Function Documentation

◆ ConstructParticle()

void G4VModularPhysicsList::ConstructParticle ( )
overridevirtual

Implements G4VUserPhysicsList.

Reimplemented in LBE.

Definition at line 113 of file G4VModularPhysicsList.cc.

114{
115 // create particles
116 for(auto itr = G4MT_physicsVector->cbegin();
117 itr != G4MT_physicsVector->cend(); ++itr)
118 {
119 (*itr)->ConstructParticle();
120 }
121}

◆ ConstructProcess()

void G4VModularPhysicsList::ConstructProcess ( )
overridevirtual

Implements G4VUserPhysicsList.

Reimplemented in LBE.

Definition at line 137 of file G4VModularPhysicsList.cc.

138{
139 G4AutoLock l(&constructProcessMutex); // Protection to be removed (A.Dotti)
141
142 for(auto itr = G4MT_physicsVector->cbegin();
143 itr != G4MT_physicsVector->cend(); ++itr)
144 {
145 (*itr)->ConstructProcess();
146 }
147}

◆ GetInstanceID()

G4int G4VModularPhysicsList::GetInstanceID ( ) const
inline

Definition at line 153 of file G4VModularPhysicsList.hh.

154{
155 return g4vmplInstanceID;
156}

Referenced by operator=().

◆ GetPhysics() [1/2]

const G4VPhysicsConstructor * G4VModularPhysicsList::GetPhysics ( const G4String name) const

Definition at line 390 of file G4VModularPhysicsList.cc.

392{
393 auto itr = G4MT_physicsVector->cbegin();
394 for(; itr != G4MT_physicsVector->cend(); ++itr)
395 {
396 if(name == (*itr)->GetPhysicsName())
397 break;
398 }
399 if(itr != G4MT_physicsVector->cend())
400 return (*itr);
401 else
402 return nullptr;
403}

◆ GetPhysics() [2/2]

const G4VPhysicsConstructor * G4VModularPhysicsList::GetPhysics ( G4int  index) const

Definition at line 378 of file G4VModularPhysicsList.cc.

379{
380 auto itr = G4MT_physicsVector->cbegin();
381 for(G4int i = 0; i < idx && itr != G4MT_physicsVector->cend(); ++i)
382 ++itr;
383 if(itr != G4MT_physicsVector->cend())
384 return (*itr);
385 else
386 return nullptr;
387}
int G4int
Definition: G4Types.hh:85

◆ GetPhysicsWithType()

const G4VPhysicsConstructor * G4VModularPhysicsList::GetPhysicsWithType ( G4int  physics_type) const

Definition at line 406 of file G4VModularPhysicsList.cc.

408{
409 auto itr = G4MT_physicsVector->cbegin();
410 for(; itr != G4MT_physicsVector->cend(); ++itr)
411 {
412 if(pType == (*itr)->GetPhysicsType())
413 break;
414 }
415 if(itr != G4MT_physicsVector->cend())
416 return (*itr);
417 else
418 return nullptr;
419}

◆ GetSubInstanceManager()

const G4VMPLManager & G4VModularPhysicsList::GetSubInstanceManager ( )
inlinestatic

Definition at line 158 of file G4VModularPhysicsList.hh.

159{
161}

Referenced by G4PhysicsListWorkspace::G4PhysicsListWorkspace().

◆ GetVerboseLevel()

G4int G4VModularPhysicsList::GetVerboseLevel ( ) const
inline

◆ operator=()

G4VModularPhysicsList & G4VModularPhysicsList::operator= ( const G4VModularPhysicsList right)
protected

Definition at line 76 of file G4VModularPhysicsList.cc.

78{
79 if(this != &right)
80 {
89 ._fDisplayThreshold = static_cast<const G4VUserPhysicsList&>(right)
91 .offset[right.GetInstanceID()]
92 ._fDisplayThreshold;
94 ._fDisplayThreshold = static_cast<const G4VUserPhysicsList&>(right)
96 .offset[right.GetInstanceID()]
97 ._fIsPhysicsTableBuilt;
100
101 if(G4MT_physicsVector != nullptr)
102 {
103 for(auto & ptr : *G4MT_physicsVector) { delete ptr; }
104 delete G4MT_physicsVector;
105 G4MT_physicsVector = nullptr;
106 }
108 }
109 return *this;
110}
G4RUN_DLL G4ThreadLocalStatic T * offset
G4bool fIsCheckedForRetrievePhysicsTable
static G4RUN_DLL G4VUPLManager subInstanceManager
static const G4VUPLManager & GetSubInstanceManager()

◆ RegisterPhysics()

void G4VModularPhysicsList::RegisterPhysics ( G4VPhysicsConstructor fPhysics)

Definition at line 150 of file G4VModularPhysicsList.cc.

151{
153 G4ApplicationState currentState = stateManager->GetCurrentState();
154 if(!(currentState == G4State_PreInit))
155 {
156 G4Exception("G4VModularPhysicsList::RegisterPhysics", "Run0201",
158 "Geant4 kernel is not PreInit state : Method ignored.");
159 return;
160 }
161
162 G4String pName = fPhysics->GetPhysicsName();
163 G4int pType = fPhysics->GetPhysicsType();
164 // If physics_type is equal to 0,
165 // following duplication check is omitted
166 // This is TEMPORAL treatment.
167 if(pType == 0)
168 {
169 G4MT_physicsVector->push_back(fPhysics);
170#ifdef G4VERBOSE
171 if(verboseLevel > 1)
172 {
173 G4cout << "G4VModularPhysicsList::RegisterPhysics: " << pName
174 << " with type : " << pType << " is added" << G4endl;
175 }
176#endif
177 return;
178 }
179
180 // Check if physics with the physics_type same as one of given physics
181 auto itr = G4MT_physicsVector->cbegin();
182 for(; itr != G4MT_physicsVector->cend(); ++itr)
183 {
184 if(pType == (*itr)->GetPhysicsType())
185 break;
186 }
187 if(itr != G4MT_physicsVector->cend())
188 {
189#ifdef G4VERBOSE
190 if(verboseLevel > 0)
191 {
192 G4cout << "G4VModularPhysicsList::RegisterPhysics: "
193 << "a physics with given type already exists " << G4endl;
194 G4cout << " Type = " << pType << " : "
195 << " existing physics is " << (*itr)->GetPhysicsName() << G4endl;
196 G4cout << " New " << pName << " can not be registered " << G4endl;
197 }
198#endif
199 G4String comment = "Duplicate type for ";
200 comment += pName;
201 G4Exception("G4VModularPhysicsList::RegisterPhysics", "Run0202",
202 JustWarning, comment);
203 return;
204 }
205
206 // register
207 G4MT_physicsVector->push_back(fPhysics);
208}
G4ApplicationState
@ G4State_PreInit
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
const G4ApplicationState & GetCurrentState() const
static G4StateManager * GetStateManager()
const G4String & GetPhysicsName() const

Referenced by FTF_BIC::FTF_BIC(), FTFP_BERT::FTFP_BERT(), FTFP_BERT_ATL::FTFP_BERT_ATL(), FTFP_BERT_HP::FTFP_BERT_HP(), FTFP_BERT_TRV::FTFP_BERT_TRV(), FTFQGSP_BERT::FTFQGSP_BERT(), G4PhysListRegistry::GetModularPhysicsList(), NuBeam::NuBeam(), QBBC::QBBC(), QGS_BIC::QGS_BIC(), QGSP_BERT::QGSP_BERT(), QGSP_BERT_HP::QGSP_BERT_HP(), QGSP_BIC::QGSP_BIC(), QGSP_BIC_AllHP::QGSP_BIC_AllHP(), QGSP_BIC_HP::QGSP_BIC_HP(), QGSP_FTFP_BERT::QGSP_FTFP_BERT(), G4PhysListFactoryMessenger::SetNewValue(), and Shielding::Shielding().

◆ RemovePhysics() [1/3]

void G4VModularPhysicsList::RemovePhysics ( const G4String name)

Definition at line 343 of file G4VModularPhysicsList.cc.

344{
346 G4ApplicationState currentState = stateManager->GetCurrentState();
347 if(!(currentState == G4State_PreInit))
348 {
349 G4Exception("G4VModularPhysicsList::RemovePhysics", "Run0206", JustWarning,
350 "Geant4 kernel is not PreInit state : Method ignored.");
351 return;
352 }
353
354 for(auto itr = G4MT_physicsVector->cbegin();
355 itr != G4MT_physicsVector->cend();)
356 {
357 G4String pName = (*itr)->GetPhysicsName();
358 if(name == pName)
359 {
360#ifdef G4VERBOSE
361 if(verboseLevel > 0)
362 {
363 G4cout << "G4VModularPhysicsList::RemovePhysics: " << pName
364 << " is removed" << G4endl;
365 }
366#endif
367 G4MT_physicsVector->erase(itr);
368 break;
369 }
370 else
371 {
372 ++itr;
373 }
374 }
375}

◆ RemovePhysics() [2/3]

void G4VModularPhysicsList::RemovePhysics ( G4int  type)

Definition at line 273 of file G4VModularPhysicsList.cc.

274{
276 G4ApplicationState currentState = stateManager->GetCurrentState();
277 if(!(currentState == G4State_PreInit))
278 {
279 G4Exception("G4VModularPhysicsList::RemovePhysics", "Run0204", JustWarning,
280 "Geant4 kernel is not PreInit state : Method ignored.");
281 return;
282 }
283
284 for(auto itr = G4MT_physicsVector->cbegin();
285 itr != G4MT_physicsVector->cend();)
286 {
287 if(pType == (*itr)->GetPhysicsType())
288 {
289 G4String pName = (*itr)->GetPhysicsName();
290#ifdef G4VERBOSE
291 if(verboseLevel > 0)
292 {
293 G4cout << "G4VModularPhysicsList::RemovePhysics: " << pName
294 << " is removed" << G4endl;
295 }
296#endif
297 G4MT_physicsVector->erase(itr);
298 break;
299 }
300 else
301 {
302 ++itr;
303 }
304 }
305}

◆ RemovePhysics() [3/3]

void G4VModularPhysicsList::RemovePhysics ( G4VPhysicsConstructor fPhysics)

Definition at line 308 of file G4VModularPhysicsList.cc.

309{
311 G4ApplicationState currentState = stateManager->GetCurrentState();
312 if(!(currentState == G4State_PreInit))
313 {
314 G4Exception("G4VModularPhysicsList::RemovePhysics", "Run0205", JustWarning,
315 "Geant4 kernel is not PreInit state : Method ignored.");
316 return;
317 }
318
319 for(auto itr = G4MT_physicsVector->cbegin();
320 itr != G4MT_physicsVector->cend();)
321 {
322 if(fPhysics == (*itr))
323 {
324 G4String pName = (*itr)->GetPhysicsName();
325#ifdef G4VERBOSE
326 if(verboseLevel > 0)
327 {
328 G4cout << "G4VModularPhysicsList::RemovePhysics: " << pName
329 << " is removed" << G4endl;
330 }
331#endif
332 G4MT_physicsVector->erase(itr);
333 break;
334 }
335 else
336 {
337 ++itr;
338 }
339 }
340}

◆ ReplacePhysics()

void G4VModularPhysicsList::ReplacePhysics ( G4VPhysicsConstructor fPhysics)

Definition at line 211 of file G4VModularPhysicsList.cc.

212{
214 G4ApplicationState currentState = stateManager->GetCurrentState();
215 if(!(currentState == G4State_PreInit))
216 {
217 G4Exception("G4VModularPhysicsList::ReplacePhysics", "Run0203", JustWarning,
218 "Geant4 kernel is not PreInit state : Method ignored.");
219 return;
220 }
221
222 G4String pName = fPhysics->GetPhysicsName();
223 G4int pType = fPhysics->GetPhysicsType();
224 // If physics_type is equal to 0,
225 // duplication check is omitted and just added.
226 // This is TEMPORAL treatment.
227 if(pType == 0)
228 {
229 // register
230 G4MT_physicsVector->push_back(fPhysics);
231#ifdef G4VERBOSE
232 if(verboseLevel > 0)
233 {
234 G4cout << "G4VModularPhysicsList::ReplacePhysics: " << pName
235 << " with type : " << pType << " is added" << G4endl;
236 }
237#endif
238 return;
239 }
240
241 // Check if physics with the physics_type same as one of given physics
242 auto itr = G4MT_physicsVector->begin();
243 for(; itr != G4MT_physicsVector->end(); ++itr)
244 {
245 if(pType == (*itr)->GetPhysicsType())
246 break;
247 }
248 if(itr == G4MT_physicsVector->end())
249 {
250 // register
251 G4MT_physicsVector->push_back(fPhysics);
252 }
253 else
254 {
255#ifdef G4VERBOSE
256 if(verboseLevel > 0)
257 {
258 G4cout << "G4VModularPhysicsList::ReplacePhysics: "
259 << (*itr)->GetPhysicsName() << " with type : " << pType
260 << " is replaced with " << pName << G4endl;
261 }
262#endif
263
264 // delete exsiting one
265 delete(*itr);
266 // replace with given one
267 (*itr) = fPhysics;
268 }
269 return;
270}

Referenced by G4PhysListRegistry::GetModularPhysicsList(), and G4PhysListFactory::GetReferencePhysList().

◆ SetVerboseLevel()

◆ TerminateWorker()

void G4VModularPhysicsList::TerminateWorker ( )
overridevirtual

Reimplemented from G4VUserPhysicsList.

Definition at line 434 of file G4VModularPhysicsList.cc.

435{
436 // See https://jira-geant4.kek.jp/browse/DEV-284
437 std::for_each(
438 G4MT_physicsVector->cbegin(), G4MT_physicsVector->cend(),
439 [](G4PhysConstVector::value_type el) { el->TerminateWorker(); });
441}
virtual void TerminateWorker()

Member Data Documentation

◆ g4vmplInstanceID

G4int G4VModularPhysicsList::g4vmplInstanceID = 0
protected

Definition at line 142 of file G4VModularPhysicsList.hh.

Referenced by G4VModularPhysicsList(), GetInstanceID(), and operator=().

◆ G4VMPLsubInstanceManager

G4VMPLManager G4VModularPhysicsList::G4VMPLsubInstanceManager
staticprotected

◆ verboseLevel


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