Geant4 11.2.2
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 ()
 
 ~G4VModularPhysicsList () override
 
void ConstructParticle () override
 
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
 
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 &)
 
void Construct ()
 
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 ()
 

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 85 of file G4VModularPhysicsList.hh.

Member Typedef Documentation

◆ G4PhysConstVector

Constructor & Destructor Documentation

◆ G4VModularPhysicsList() [1/2]

G4VModularPhysicsList::G4VModularPhysicsList ( )

Definition at line 50 of file G4VModularPhysicsList.cc.

◆ ~G4VModularPhysicsList()

G4VModularPhysicsList::~G4VModularPhysicsList ( )
override

Definition at line 56 of file G4VModularPhysicsList.cc.

57{
58 if (G4MT_physicsVector != nullptr) {
59 for (auto& ptr : *G4MT_physicsVector) {
60 delete ptr;
61 }
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 112 of file G4VModularPhysicsList.cc.

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

◆ ConstructProcess()

void G4VModularPhysicsList::ConstructProcess ( )
overridevirtual

Implements G4VUserPhysicsList.

Reimplemented in LBE.

Definition at line 134 of file G4VModularPhysicsList.cc.

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

◆ GetInstanceID()

G4int G4VModularPhysicsList::GetInstanceID ( ) const
inline

Definition at line 150 of file G4VModularPhysicsList.hh.

151{
152 return g4vmplInstanceID;
153}

Referenced by operator=().

◆ GetPhysics() [1/2]

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

Definition at line 341 of file G4VModularPhysicsList.cc.

342{
343 auto itr = G4MT_physicsVector->cbegin();
344 for (; itr != G4MT_physicsVector->cend(); ++itr) {
345 if (name == (*itr)->GetPhysicsName()) break;
346 }
347 if (itr != G4MT_physicsVector->cend()) return (*itr);
348 return nullptr;
349}

◆ GetPhysics() [2/2]

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

Definition at line 331 of file G4VModularPhysicsList.cc.

332{
333 auto itr = G4MT_physicsVector->cbegin();
334 for (G4int i = 0; i < idx && itr != G4MT_physicsVector->cend(); ++i)
335 ++itr;
336 if (itr != G4MT_physicsVector->cend()) return (*itr);
337 return nullptr;
338}
int G4int
Definition G4Types.hh:85

◆ GetPhysicsWithType()

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

Definition at line 352 of file G4VModularPhysicsList.cc.

353{
354 auto itr = G4MT_physicsVector->cbegin();
355 for (; itr != G4MT_physicsVector->cend(); ++itr) {
356 if (pType == (*itr)->GetPhysicsType()) break;
357 }
358 if (itr != G4MT_physicsVector->cend()) return (*itr);
359 return nullptr;
360}

◆ GetSubInstanceManager()

const G4VMPLManager & G4VModularPhysicsList::GetSubInstanceManager ( )
inlinestatic

Definition at line 155 of file G4VModularPhysicsList.hh.

156{
158}

Referenced by G4PhysicsListWorkspace::G4PhysicsListWorkspace(), and operator=().

◆ GetVerboseLevel()

G4int G4VModularPhysicsList::GetVerboseLevel ( ) const
inline

◆ operator=()

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

Definition at line 76 of file G4VModularPhysicsList.cc.

77{
78 if (this != &right) {
86 (this->subInstanceManager.offset[this->g4vuplInstanceID])._fDisplayThreshold =
87 static_cast<const G4VUserPhysicsList&>(right)
89 .offset[right.GetInstanceID()]
90 ._fDisplayThreshold;
91 (this->subInstanceManager.offset[this->g4vuplInstanceID])._fDisplayThreshold =
92 static_cast<G4int>(static_cast<const G4VUserPhysicsList&>(right)
94 .offset[right.GetInstanceID()]
95 ._fIsPhysicsTableBuilt);
98
99 if (G4MT_physicsVector != nullptr) {
100 for (auto& ptr : *G4MT_physicsVector) {
101 delete ptr;
102 }
103 delete G4MT_physicsVector;
104 G4MT_physicsVector = nullptr;
105 }
107 }
108 return *this;
109}
static const G4VMPLManager & GetSubInstanceManager()
G4RUN_DLL G4ThreadLocalStatic T * offset
static G4RUN_DLL G4VUPLManager subInstanceManager
static const G4VUPLManager & GetSubInstanceManager()

◆ RegisterPhysics()

void G4VModularPhysicsList::RegisterPhysics ( G4VPhysicsConstructor * fPhysics)

Definition at line 145 of file G4VModularPhysicsList.cc.

146{
148 G4ApplicationState currentState = stateManager->GetCurrentState();
149 if (!(currentState == G4State_PreInit)) {
150 G4Exception("G4VModularPhysicsList::RegisterPhysics", "Run0201", JustWarning,
151 "Geant4 kernel is not PreInit state : Method ignored.");
152 return;
153 }
154
155 G4String pName = fPhysics->GetPhysicsName();
156 G4int pType = fPhysics->GetPhysicsType();
157 // If physics_type is equal to 0,
158 // following duplication check is omitted
159 // This is TEMPORAL treatment.
160 if (pType == 0) {
161 G4MT_physicsVector->push_back(fPhysics);
162#ifdef G4VERBOSE
163 if (verboseLevel > 1) {
164 G4cout << "G4VModularPhysicsList::RegisterPhysics: " << pName << " with type : " << pType
165 << " is added" << G4endl;
166 }
167#endif
168 return;
169 }
170
171 // Check if physics with the physics_type same as one of given physics
172 auto itr = G4MT_physicsVector->cbegin();
173 for (; itr != G4MT_physicsVector->cend(); ++itr) {
174 if (pType == (*itr)->GetPhysicsType()) break;
175 }
176 if (itr != G4MT_physicsVector->cend()) {
177#ifdef G4VERBOSE
178 if (verboseLevel > 0) {
179 G4cout << "G4VModularPhysicsList::RegisterPhysics: "
180 << "a physics with given type already exists " << G4endl;
181 G4cout << " Type = " << pType << " : "
182 << " existing physics is " << (*itr)->GetPhysicsName() << G4endl;
183 G4cout << " New " << pName << " can not be registered " << G4endl;
184 }
185#endif
186 G4String comment = "Duplicate type for ";
187 comment += pName;
188 G4Exception("G4VModularPhysicsList::RegisterPhysics", "Run0202", JustWarning, comment);
189 return;
190 }
191
192 // register
193 G4MT_physicsVector->push_back(fPhysics);
194}
G4ApplicationState
@ G4State_PreInit
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
#define G4endl
Definition G4ios.hh:67
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(), G4PhysListFactory::GetReferencePhysList(), NuBeam::NuBeam(), QBBC::QBBC(), QBBC_ABLA::QBBC_ABLA(), 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_BIC_HPT::QGSP_BIC_HPT(), QGSP_FTFP_BERT::QGSP_FTFP_BERT(), G4PhysListFactoryMessenger::SetNewValue(), and Shielding::Shielding().

◆ RemovePhysics() [1/3]

void G4VModularPhysicsList::RemovePhysics ( const G4String & name)

Definition at line 304 of file G4VModularPhysicsList.cc.

305{
307 G4ApplicationState currentState = stateManager->GetCurrentState();
308 if (!(currentState == G4State_PreInit)) {
309 G4Exception("G4VModularPhysicsList::RemovePhysics", "Run0206", JustWarning,
310 "Geant4 kernel is not PreInit state : Method ignored.");
311 return;
312 }
313
314 for (auto itr = G4MT_physicsVector->cbegin(); itr != G4MT_physicsVector->cend();) {
315 G4String pName = (*itr)->GetPhysicsName();
316 if (name == pName) {
317#ifdef G4VERBOSE
318 if (verboseLevel > 0) {
319 G4cout << "G4VModularPhysicsList::RemovePhysics: " << pName << " is removed" << G4endl;
320 }
321#endif
322 G4MT_physicsVector->erase(itr);
323 break;
324 }
325
326 ++itr;
327 }
328}

◆ RemovePhysics() [2/3]

void G4VModularPhysicsList::RemovePhysics ( G4int type)

Definition at line 250 of file G4VModularPhysicsList.cc.

251{
253 G4ApplicationState currentState = stateManager->GetCurrentState();
254 if (!(currentState == G4State_PreInit)) {
255 G4Exception("G4VModularPhysicsList::RemovePhysics", "Run0204", JustWarning,
256 "Geant4 kernel is not PreInit state : Method ignored.");
257 return;
258 }
259
260 for (auto itr = G4MT_physicsVector->cbegin(); itr != G4MT_physicsVector->cend();) {
261 if (pType == (*itr)->GetPhysicsType()) {
262 G4String pName = (*itr)->GetPhysicsName();
263#ifdef G4VERBOSE
264 if (verboseLevel > 0) {
265 G4cout << "G4VModularPhysicsList::RemovePhysics: " << pName << " is removed" << G4endl;
266 }
267#endif
268 G4MT_physicsVector->erase(itr);
269 break;
270 }
271
272 ++itr;
273 }
274}

◆ RemovePhysics() [3/3]

void G4VModularPhysicsList::RemovePhysics ( G4VPhysicsConstructor * fPhysics)

Definition at line 277 of file G4VModularPhysicsList.cc.

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

◆ ReplacePhysics()

void G4VModularPhysicsList::ReplacePhysics ( G4VPhysicsConstructor * fPhysics)

Definition at line 197 of file G4VModularPhysicsList.cc.

198{
200 G4ApplicationState currentState = stateManager->GetCurrentState();
201 if (!(currentState == G4State_PreInit)) {
202 G4Exception("G4VModularPhysicsList::ReplacePhysics", "Run0203", JustWarning,
203 "Geant4 kernel is not PreInit state : Method ignored.");
204 return;
205 }
206
207 G4String pName = fPhysics->GetPhysicsName();
208 G4int pType = fPhysics->GetPhysicsType();
209 // If physics_type is equal to 0,
210 // duplication check is omitted and just added.
211 // This is TEMPORAL treatment.
212 if (pType == 0) {
213 // register
214 G4MT_physicsVector->push_back(fPhysics);
215#ifdef G4VERBOSE
216 if (verboseLevel > 0) {
217 G4cout << "G4VModularPhysicsList::ReplacePhysics: " << pName << " with type : " << pType
218 << " is added" << G4endl;
219 }
220#endif
221 return;
222 }
223
224 // Check if physics with the physics_type same as one of given physics
225 auto itr = G4MT_physicsVector->begin();
226 for (; itr != G4MT_physicsVector->end(); ++itr) {
227 if (pType == (*itr)->GetPhysicsType()) break;
228 }
229 if (itr == G4MT_physicsVector->end()) {
230 // register
231 G4MT_physicsVector->push_back(fPhysics);
232 }
233 else {
234#ifdef G4VERBOSE
235 if (verboseLevel > 0) {
236 G4cout << "G4VModularPhysicsList::ReplacePhysics: " << (*itr)->GetPhysicsName()
237 << " with type : " << pType << " is replaced with " << pName << G4endl;
238 }
239#endif
240
241 // delete exsiting one
242 delete (*itr);
243 // replace with given one
244 (*itr) = fPhysics;
245 }
246 return;
247}

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

◆ SetVerboseLevel()

◆ TerminateWorker()

void G4VModularPhysicsList::TerminateWorker ( )
overridevirtual

Reimplemented from G4VUserPhysicsList.

Definition at line 373 of file G4VModularPhysicsList.cc.

374{
375 // See https://jira-geant4.kek.jp/browse/DEV-284
376 std::for_each(G4MT_physicsVector->cbegin(), G4MT_physicsVector->cend(),
377 [](G4PhysConstVector::value_type el) { el->TerminateWorker(); });
379}
virtual void TerminateWorker()

Member Data Documentation

◆ g4vmplInstanceID

G4int G4VModularPhysicsList::g4vmplInstanceID = 0
protected

◆ G4VMPLsubInstanceManager

G4VMPLManager G4VModularPhysicsList::G4VMPLsubInstanceManager
staticprotected

◆ verboseLevel


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