GlobalPhysicsList.cc
Go to the documentation of this file.
1 #include "GlobalPhysicsList.h"
2 
3 #include <utl/ErrorLogger.h>
4 
5 
6 #include "DefaultPhysicsList.h"
7 
8 using namespace tls;
9 using namespace std;
10 
11 
13 {
14  SetVerboseLevel(-10);
15 }
16 
17 
19 {
20  INFO("destructing global physics list");
21  for (vector<G4VUserPhysicsList*>::iterator it = fPhysicsVector.begin();
22  it!= fPhysicsVector.end(); ++it) {
23  delete (*it);
24  }
25  fPhysicsVector.clear();
26 }
27 
28 
29 void
31 {
32  for (vector<G4VUserPhysicsList*>::iterator it = fPhysicsVector.begin();
33  it!= fPhysicsVector.end(); ++it) {
34  (*it)->ConstructParticle();
35  }
36 }
37 
38 
39 void
41 {
42  AddTransportation();
43 
44  for (vector<G4VUserPhysicsList*>::iterator it = fPhysicsVector.begin();
45  it!= fPhysicsVector.end(); ++it) {
46  (*it)->ConstructProcess();
47  }
48 }
49 
50 
51 void
53 {
54  for (vector<G4VUserPhysicsList*>::iterator it = fPhysicsVector.begin();
55  it!= fPhysicsVector.end(); ++it) {
56  (*it)->SetVerboseLevel(verbosity);
57  }
58 }
59 
60 
61 void
63 {
64  this->SetCutsWithDefault();
65 }
66 
67 
68 const
69 G4VUserPhysicsList*
70 GlobalPhysicsList::GetPhysics(const G4String& name)
71  const
72 {
73  const unsigned int n = fPhysicsVectorNames.size();
74  for (unsigned int i = 0; i != n; ++i) {
75  if (fPhysicsVectorNames[i] == name)
76  return fPhysicsVector[i];
77  }
78  return 0;
79 }
80 
81 
82 void
83 GlobalPhysicsList::RegisterPhysics(const G4String& name, G4VUserPhysicsList* userList)
84 {
85  vector<G4String>::iterator it =
86  find(fPhysicsVectorNames.begin(), fPhysicsVectorNames.end(), name);
87  if (it == fPhysicsVectorNames.end()) {
88  fPhysicsVectorNames.push_back(name);
89  fPhysicsVector.push_back(userList);
90  }
91  else {
92  const unsigned int i = distance(fPhysicsVectorNames.begin(), it);
93  fPhysicsVector[i] = userList;
94  }
95 }
#define INFO(message)
Macro for logging informational messages.
Definition: ErrorLogger.h:161
void RegisterPhysics(const G4String &name, G4VUserPhysicsList *userList)
void SetVerboseLevel(bool verbosity)
virtual void ConstructParticle()
virtual void ConstructProcess()
const G4VUserPhysicsList * GetPhysics(const G4String &name) const

, generated on Tue Sep 26 2023.