Geant4 10.7.0
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)
 
void SetVerboseLevel (G4int value)
 
G4int GetVerboseLevel () const
 
G4int GetInstanceID () const
 
virtual void TerminateWorker () override
 
- 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
 
void UseCoupledTransportation (G4bool vl=true)
 
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 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=0)
 
void SetParticleCuts (G4double cut, const G4String &particleName, G4Region *region=0)
 
void SetCutsForRegion (G4double aCut, const G4String &rname)
 
void ResetCuts ()
 obsolete methods
 
void SetApplyCuts (G4bool value, const G4String &name)
 
G4bool GetApplyCuts (const G4String &name) const
 
void RemoveProcessManager ()
 
void AddProcessManager (G4ParticleDefinition *newParticle, G4ProcessManager *newManager=0)
 
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

typedef G4VMPLData::G4PhysConstVectorData G4PhysConstVector
 

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
 
G4int g4vmplInstanceID
 
- Protected Attributes inherited from G4VUserPhysicsList
G4ParticleTabletheParticleTable
 
G4int verboseLevel
 
G4double defaultCutValue
 
G4bool isSetDefaultCutValue
 
G4ProductionCutsTablefCutsTable
 
G4bool fRetrievePhysicsTable
 
G4bool fStoredInAscii
 
G4bool fIsCheckedForRetrievePhysicsTable
 
G4bool fIsRestoredCutValues
 
G4String directoryPhysicsTable
 
G4bool fDisableCheckParticleList
 
G4int g4vuplInstanceID
 

Static Protected Attributes

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

Detailed Description

Definition at line 93 of file G4VModularPhysicsList.hh.

Member Typedef Documentation

◆ G4PhysConstVector

Constructor & Destructor Documentation

◆ G4VModularPhysicsList() [1/2]

G4VModularPhysicsList::G4VModularPhysicsList ( )

◆ ~G4VModularPhysicsList()

G4VModularPhysicsList::~G4VModularPhysicsList ( )
virtual

Definition at line 55 of file G4VModularPhysicsList.cc.

56{
57 for(auto itr = G4MT_physicsVector->begin(); itr != G4MT_physicsVector->end();
58 ++itr)
59 {
60 delete(*itr);
61 }
62 G4MT_physicsVector->clear();
63 delete G4MT_physicsVector;
64}
#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 118 of file G4VModularPhysicsList.cc.

119{
120 // create particles
121 for(auto itr = G4MT_physicsVector->begin(); itr != G4MT_physicsVector->end();
122 ++itr)
123 {
124 (*itr)->ConstructParticle();
125 ;
126 }
127}

◆ ConstructProcess()

void G4VModularPhysicsList::ConstructProcess ( )
overridevirtual

Implements G4VUserPhysicsList.

Reimplemented in LBE.

Definition at line 141 of file G4VModularPhysicsList.cc.

142{
143 G4AutoLock l(&constructProcessMutex); // Protection to be removed (A.Dotti)
145
146 for(auto itr = G4MT_physicsVector->begin(); itr != G4MT_physicsVector->end();
147 ++itr)
148 {
149 (*itr)->ConstructProcess();
150 }
151}

◆ GetInstanceID()

G4int G4VModularPhysicsList::GetInstanceID ( ) const
inline

Definition at line 162 of file G4VModularPhysicsList.hh.

163{
164 return g4vmplInstanceID;
165}

Referenced by operator=().

◆ GetPhysics() [1/2]

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

Definition at line 386 of file G4VModularPhysicsList.cc.

388{
389 auto itr = G4MT_physicsVector->begin();
390 for(; itr != G4MT_physicsVector->end(); ++itr)
391 {
392 if(name == (*itr)->GetPhysicsName())
393 break;
394 }
395 if(itr != G4MT_physicsVector->end())
396 return (*itr);
397 else
398 return 0;
399}

◆ GetPhysics() [2/2]

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

Definition at line 374 of file G4VModularPhysicsList.cc.

375{
376 G4int i;
377 auto itr = G4MT_physicsVector->begin();
378 for(i = 0; i < idx && itr != G4MT_physicsVector->end(); ++i)
379 ++itr;
380 if(itr != G4MT_physicsVector->end())
381 return (*itr);
382 else
383 return 0;
384}
int G4int
Definition: G4Types.hh:85

◆ GetPhysicsWithType()

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

Definition at line 401 of file G4VModularPhysicsList.cc.

403{
404 auto itr = G4MT_physicsVector->begin();
405 for(; itr != G4MT_physicsVector->end(); ++itr)
406 {
407 if(pType == (*itr)->GetPhysicsType())
408 break;
409 }
410 if(itr != G4MT_physicsVector->end())
411 return (*itr);
412 else
413 return 0;
414}

◆ GetSubInstanceManager()

const G4VMPLManager & G4VModularPhysicsList::GetSubInstanceManager ( )
inlinestatic

Definition at line 167 of file G4VModularPhysicsList.hh.

168{
170}

Referenced by G4PhysicsListWorkspace::G4PhysicsListWorkspace().

◆ GetVerboseLevel()

G4int G4VModularPhysicsList::GetVerboseLevel ( ) const
inline

◆ operator=()

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

Definition at line 73 of file G4VModularPhysicsList.cc.

75{
76 if(this != &right)
77 {
85 // fDisplayThreshold = static_cast<const
86 // G4VUserPhysicsList&>(right).GetSubInstanceManager().offset[right.GetInstanceID()]._fDisplayThreshold;
88 ._fDisplayThreshold = static_cast<const G4VUserPhysicsList&>(right)
90 .offset[right.GetInstanceID()]
91 ._fDisplayThreshold;
92 // fIsPhysicsTableBuilt = static_cast<const
93 // G4VUserPhysicsList&>(right).GetSubInstanceManager().offset[right.GetInstanceID()]._fIsPhysicsTableBuilt;
95 ._fDisplayThreshold = static_cast<const G4VUserPhysicsList&>(right)
97 .offset[right.GetInstanceID()]
98 ._fIsPhysicsTableBuilt;
99 // fDisplayThreshold = right.fDisplayThreshold;
102
103 if(G4MT_physicsVector != 0)
104 {
105 for(auto itr = G4MT_physicsVector->begin();
106 itr != G4MT_physicsVector->end(); ++itr)
107 {
108 delete(*itr);
109 }
110 G4MT_physicsVector->clear();
111 delete G4MT_physicsVector;
112 }
114 }
115 return *this;
116}
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 153 of file G4VModularPhysicsList.cc.

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

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

◆ RemovePhysics() [2/3]

void G4VModularPhysicsList::RemovePhysics ( G4int  type)

Definition at line 276 of file G4VModularPhysicsList.cc.

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

◆ RemovePhysics() [3/3]

void G4VModularPhysicsList::RemovePhysics ( G4VPhysicsConstructor fPhysics)

Definition at line 309 of file G4VModularPhysicsList.cc.

310{
312 G4ApplicationState currentState = stateManager->GetCurrentState();
313 if(!(currentState == G4State_PreInit))
314 {
315 G4Exception("G4VModularPhysicsList::RemovePhysics", "Run0205", JustWarning,
316 "Geant4 kernel is not PreInit state : Method ignored.");
317 return;
318 }
319
320 for(auto itr = G4MT_physicsVector->begin(); itr != G4MT_physicsVector->end();)
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 213 of file G4VModularPhysicsList.cc.

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

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

◆ SetVerboseLevel()

◆ TerminateWorker()

void G4VModularPhysicsList::TerminateWorker ( )
overridevirtual

Reimplemented from G4VUserPhysicsList.

Definition at line 427 of file G4VModularPhysicsList.cc.

428{
429 // See https://jira-geant4.kek.jp/browse/DEV-284
430 std::for_each(
431 G4MT_physicsVector->begin(), G4MT_physicsVector->end(),
432 [](G4PhysConstVector::value_type el) { el->TerminateWorker(); });
434}
virtual void TerminateWorker()

Member Data Documentation

◆ g4vmplInstanceID

G4int G4VModularPhysicsList::g4vmplInstanceID
protected

Definition at line 148 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: