Geant4 9.6.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 ()
 
virtual void ConstructProcess ()
 
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
 
- 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 ()
 

Protected Types

typedef std::vector< G4VPhysicsConstructor * > 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 ()
 

Protected Attributes

G4PhysConstVectorphysicsVector
 
G4int verboseLevel
 
- Protected Attributes inherited from G4VUserPhysicsList
G4ParticleTabletheParticleTable
 
G4ParticleTable::G4PTblDicIteratortheParticleIterator
 
G4UserPhysicsListMessengertheMessenger
 
G4int verboseLevel
 
G4double defaultCutValue
 
G4bool isSetDefaultCutValue
 
G4ProductionCutsTablefCutsTable
 
G4bool fRetrievePhysicsTable
 
G4bool fStoredInAscii
 
G4bool fIsCheckedForRetrievePhysicsTable
 
G4bool fIsRestoredCutValues
 
G4String directoryPhysicsTable
 
G4int fDisplayThreshold
 
G4bool fIsPhysicsTableBuilt
 
G4bool fDisableCheckParticleList
 
G4PhysicsListHelperthePLHelper
 

Detailed Description

Definition at line 60 of file G4VModularPhysicsList.hh.

Member Typedef Documentation

◆ G4PhysConstVector

Definition at line 114 of file G4VModularPhysicsList.hh.

Constructor & Destructor Documentation

◆ G4VModularPhysicsList() [1/2]

G4VModularPhysicsList::G4VModularPhysicsList ( )

Definition at line 40 of file G4VModularPhysicsList.cc.

43{
45}
G4PhysConstVector * physicsVector
std::vector< G4VPhysicsConstructor * > G4PhysConstVector

◆ ~G4VModularPhysicsList()

G4VModularPhysicsList::~G4VModularPhysicsList ( )
virtual

Definition at line 47 of file G4VModularPhysicsList.cc.

48{
49 G4PhysConstVector::iterator itr;
50 for (itr = physicsVector->begin(); itr!= physicsVector->end(); ++itr) {
51 delete (*itr);
52 }
53 physicsVector->clear();
54 delete physicsVector;
55}

◆ G4VModularPhysicsList() [2/2]

G4VModularPhysicsList::G4VModularPhysicsList ( const G4VModularPhysicsList right)
protected

Definition at line 57 of file G4VModularPhysicsList.cc.

57 : G4VUserPhysicsList(right),
59{
61}

Member Function Documentation

◆ ConstructParticle()

void G4VModularPhysicsList::ConstructParticle ( )
virtual

Implements G4VUserPhysicsList.

Definition at line 91 of file G4VModularPhysicsList.cc.

92{
93 // create particles
94 G4PhysConstVector::iterator itr;
95 for (itr = physicsVector->begin(); itr!= physicsVector->end(); ++itr) {
96 (*itr)->ConstructParticle();;
97 }
98}

◆ ConstructProcess()

void G4VModularPhysicsList::ConstructProcess ( )
virtual

Implements G4VUserPhysicsList.

Definition at line 101 of file G4VModularPhysicsList.cc.

102{
104
105 G4PhysConstVector::iterator itr;
106 for (itr = physicsVector->begin(); itr!= physicsVector->end(); ++itr) {
107 (*itr)->ConstructProcess();
108 }
109}

◆ GetPhysics() [1/2]

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

Definition at line 327 of file G4VModularPhysicsList.cc.

328{
329 G4PhysConstVector::iterator itr;
330 for (itr = physicsVector->begin(); itr!= physicsVector->end(); ++itr) {
331 if ( name == (*itr)->GetPhysicsName()) break;
332 }
333 if (itr!= physicsVector->end()) return (*itr);
334 else return 0;
335}

◆ GetPhysics() [2/2]

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

Definition at line 318 of file G4VModularPhysicsList.cc.

319{
320 G4int i;
321 G4PhysConstVector::iterator itr= physicsVector->begin();
322 for (i=0; i<idx && itr!= physicsVector->end() ; ++i) ++itr;
323 if (itr!= physicsVector->end()) return (*itr);
324 else return 0;
325}
int G4int
Definition: G4Types.hh:66

◆ GetPhysicsWithType()

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

Definition at line 337 of file G4VModularPhysicsList.cc.

338{
339 G4PhysConstVector::iterator itr;
340 for (itr = physicsVector->begin(); itr!= physicsVector->end(); ++itr) {
341 if ( pType == (*itr)->GetPhysicsType()) break;
342 }
343 if (itr!= physicsVector->end()) return (*itr);
344 else return 0;
345}

◆ GetVerboseLevel()

G4int G4VModularPhysicsList::GetVerboseLevel ( ) const
inline

Definition at line 122 of file G4VModularPhysicsList.hh.

123{
124 return verboseLevel;
125}

Referenced by G4PhysListFactory::GetReferencePhysList().

◆ operator=()

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

Definition at line 63 of file G4VModularPhysicsList.cc.

64{
65 if (this != &right) {
77
78 if(physicsVector !=0) {
79 G4PhysConstVector::iterator itr;
80 for (itr = physicsVector->begin(); itr!= physicsVector->end(); ++itr) {
81 delete (*itr);
82 }
83 physicsVector->clear();
84 delete physicsVector;
85 }
87 }
88 return *this;
89}
G4bool fIsCheckedForRetrievePhysicsTable

◆ RegisterPhysics()

void G4VModularPhysicsList::RegisterPhysics ( G4VPhysicsConstructor fPhysics)

Definition at line 113 of file G4VModularPhysicsList.cc.

114{
116 G4ApplicationState currentState = stateManager->GetCurrentState();
117 if(!(currentState==G4State_PreInit)){
118 G4Exception("G4VModularPhysicsList::RegisterPhysics",
119 "Run0201", JustWarning,
120 "Geant4 kernel is not PreInit state : Method ignored.");
121 return;
122 }
123
124 G4String pName = fPhysics->GetPhysicsName();
125 G4int pType = fPhysics->GetPhysicsType();
126 // If physics_type is equal to 0,
127 // following duplication check is omitted
128 // This is TEMPORAL treatment.
129 if (pType == 0) {
130 physicsVector->push_back(fPhysics);
131#ifdef G4VERBOSE
132 if (verboseLevel >1){
133 G4cout << "G4VModularPhysicsList::RegisterPhysics: "
134 << pName << "with type : " << pType
135 << " is added"
136 << G4endl;
137 }
138#endif
139 return;
140 }
141
142 // Check if physics with the physics_type same as one of given physics
143 G4PhysConstVector::iterator itr;
144 for (itr = physicsVector->begin(); itr!= physicsVector->end(); ++itr) {
145 if ( pType == (*itr)->GetPhysicsType()) break;
146 }
147 if (itr!= physicsVector->end()) {
148#ifdef G4VERBOSE
149 if (verboseLevel >0){
150 G4cout << "G4VModularPhysicsList::RegisterPhysics: "
151 << "a physics with given type already exists "
152 << G4endl;
153 G4cout << " Type = " << pType << " : "
154 << " existing physics is " << (*itr)->GetPhysicsName()
155 << G4endl;
156 G4cout << pName << " can not be registered "<<G4endl;
157 }
158#endif
159 G4String comment ="Duplicate type for ";
160 comment += pName;
161 G4Exception("G4VModularPhysicsList::RegisterPhysics",
162 "Run0202", JustWarning, comment);
163 return;
164 }
165
166 // register
167 physicsVector->push_back(fPhysics);
168
169}
G4ApplicationState
@ G4State_PreInit
@ JustWarning
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
G4ApplicationState GetCurrentState() const
static G4StateManager * GetStateManager()
const G4String & GetPhysicsName() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Referenced by QBBC::QBBC().

◆ RemovePhysics() [1/3]

void G4VModularPhysicsList::RemovePhysics ( const G4String name)

Definition at line 288 of file G4VModularPhysicsList.cc.

289{
291 G4ApplicationState currentState = stateManager->GetCurrentState();
292 if(!(currentState==G4State_PreInit)){
293 G4Exception("G4VModularPhysicsList::RemovePhysics",
294 "Run0206", JustWarning,
295 "Geant4 kernel is not PreInit state : Method ignored.");
296 return;
297 }
298
299 for (G4PhysConstVector::iterator itr = physicsVector->begin();
300 itr!= physicsVector->end();) {
301 G4String pName = (*itr)->GetPhysicsName();
302 if ( name == pName) {
303#ifdef G4VERBOSE
304 if (verboseLevel > 0){
305 G4cout << "G4VModularPhysicsList::RemovePhysics: "
306 << pName << " is removed"
307 << G4endl;
308 }
309#endif
310 physicsVector->erase(itr);
311 break;
312 } else {
313 itr++;
314 }
315 }
316}

◆ RemovePhysics() [2/3]

void G4VModularPhysicsList::RemovePhysics ( G4int  type)

Definition at line 229 of file G4VModularPhysicsList.cc.

230{
232 G4ApplicationState currentState = stateManager->GetCurrentState();
233 if(!(currentState==G4State_PreInit)){
234 G4Exception("G4VModularPhysicsList::RemovePhysics",
235 "Run0204", JustWarning,
236 "Geant4 kernel is not PreInit state : Method ignored.");
237 return;
238 }
239
240 for (G4PhysConstVector::iterator itr = physicsVector->begin();
241 itr!= physicsVector->end();) {
242 if ( pType == (*itr)->GetPhysicsType()) {
243 G4String pName = (*itr)->GetPhysicsName();
244#ifdef G4VERBOSE
245 if (verboseLevel > 0){
246 G4cout << "G4VModularPhysicsList::RemovePhysics: "
247 << pName << " is removed"
248 << G4endl;
249 }
250#endif
251 physicsVector->erase(itr);
252 break;
253 } else {
254 itr++;
255 }
256 }
257}

◆ RemovePhysics() [3/3]

void G4VModularPhysicsList::RemovePhysics ( G4VPhysicsConstructor fPhysics)

Definition at line 259 of file G4VModularPhysicsList.cc.

260{
262 G4ApplicationState currentState = stateManager->GetCurrentState();
263 if(!(currentState==G4State_PreInit)){
264 G4Exception("G4VModularPhysicsList::RemovePhysics",
265 "Run0205", JustWarning,
266 "Geant4 kernel is not PreInit state : Method ignored.");
267 return;
268 }
269
270 for (G4PhysConstVector::iterator itr = physicsVector->begin();
271 itr!= physicsVector->end();) {
272 if ( fPhysics == (*itr)) {
273 G4String pName = (*itr)->GetPhysicsName();
274#ifdef G4VERBOSE
275 if (verboseLevel > 0 ){
276 G4cout << "G4VModularPhysicsList::RemovePhysics: "
277 << pName << " is removed"
278 << G4endl;
279 }
280#endif
281 physicsVector->erase(itr);
282 break;
283 } else {
284 itr++;
285 }
286 }
287}

◆ ReplacePhysics()

void G4VModularPhysicsList::ReplacePhysics ( G4VPhysicsConstructor fPhysics)

Definition at line 171 of file G4VModularPhysicsList.cc.

172{
174 G4ApplicationState currentState = stateManager->GetCurrentState();
175 if(!(currentState==G4State_PreInit)){
176 G4Exception("G4VModularPhysicsList::ReplacePhysics",
177 "Run0203", JustWarning,
178 "Geant4 kernel is not PreInit state : Method ignored.");
179 return;
180 }
181
182 G4String pName = fPhysics->GetPhysicsName();
183 G4int pType = fPhysics->GetPhysicsType();
184 // If physics_type is equal to 0,
185 // duplication check is omitted and just added.
186 // This is TEMPORAL treatment.
187 if (pType == 0) {
188 // register
189 physicsVector->push_back(fPhysics);
190#ifdef G4VERBOSE
191 if (verboseLevel >0){
192 G4cout << "G4VModularPhysicsList::ReplacePhysics: "
193 << pName << "with type : " << pType
194 << " is added"
195 << G4endl;
196 }
197#endif
198 return;
199 }
200
201 // Check if physics with the physics_type same as one of given physics
202 G4PhysConstVector::iterator itr= physicsVector->begin();
203 for (itr = physicsVector->begin(); itr!= physicsVector->end(); ++itr) {
204 if ( pType == (*itr)->GetPhysicsType()) break;
205 }
206 if (itr == physicsVector->end()) {
207 // register
208 physicsVector->push_back(fPhysics);
209 } else {
210#ifdef G4VERBOSE
211 if (verboseLevel >0){
212 G4cout << "G4VModularPhysicsList::ReplacePhysics: "
213 << (*itr)->GetPhysicsName() << "with type : " << pType
214 << " is replaces with " << pName
215 << G4endl;
216 }
217#endif
218
219 // delete exsiting one
220 delete (*itr);
221 // replace with given one
222 (*itr) = fPhysics;
223
224 }
225
226 return;
227}

Referenced by G4PhysListFactory::GetReferencePhysList().

◆ SetVerboseLevel()

void G4VModularPhysicsList::SetVerboseLevel ( G4int  value)

Definition at line 348 of file G4VModularPhysicsList.cc.

349{
350 verboseLevel = value;
351
352 // Loop over constructors
353 G4PhysConstVector::iterator itr;
354 for (itr = physicsVector->begin(); itr!= physicsVector->end(); ++itr) {
355 (*itr)->SetVerboseLevel(verboseLevel);
356 }
357
358}

Referenced by G4PhysListFactory::GetReferencePhysList(), and QBBC::QBBC().

Member Data Documentation

◆ physicsVector

◆ verboseLevel

G4int G4VModularPhysicsList::verboseLevel
protected

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