Geant4-11
Public Types | Public Member Functions | Private Member Functions | Private Attributes
G4ProcessPlacer Class Reference

#include <G4ProcessPlacer.hh>

Inheritance diagram for G4ProcessPlacer:
G4VProcessPlacer

Public Types

enum  SecondOrLast { eSecond = 1 , eLast = 0 }
 

Public Member Functions

virtual void AddProcessAsLastDoIt (G4VProcess *process)
 
virtual void AddProcessAsSecondDoIt (G4VProcess *process)
 
 G4ProcessPlacer (const G4String &particlename)
 
virtual void RemoveProcess (G4VProcess *process)
 
virtual ~G4ProcessPlacer ()
 

Private Member Functions

void AddProcessAs (G4VProcess *process, SecondOrLast)
 
G4ProcessManagerGetProcessManager ()
 
void PrintAlongStepDoItVec ()
 
void PrintAlongStepGPILVec ()
 
void PrintPostStepDoItVec ()
 
void PrintPostStepGPILVec ()
 
void PrintProcVec (G4ProcessVector *processVec)
 

Private Attributes

G4String fParticleName
 

Detailed Description

Definition at line 48 of file G4ProcessPlacer.hh.

Member Enumeration Documentation

◆ SecondOrLast

Enumerator
eSecond 
eLast 

Definition at line 71 of file G4ProcessPlacer.hh.

72 {
73 eSecond = 1,
74 eLast = 0
75 };

Constructor & Destructor Documentation

◆ G4ProcessPlacer()

G4ProcessPlacer::G4ProcessPlacer ( const G4String particlename)
explicit

Definition at line 40 of file G4ProcessPlacer.cc.

41 : fParticleName(particlename)
42{
43}
G4String fParticleName

◆ ~G4ProcessPlacer()

G4ProcessPlacer::~G4ProcessPlacer ( )
virtual

Definition at line 45 of file G4ProcessPlacer.cc.

46{
47}

Member Function Documentation

◆ AddProcessAs()

void G4ProcessPlacer::AddProcessAs ( G4VProcess process,
SecondOrLast  sol 
)
private

Definition at line 78 of file G4ProcessPlacer.cc.

79{
80 G4cout << " Modifying Process Order for ProcessName: " << process->GetProcessName() << G4endl;
81
82 G4cout << " The initial AlongStep Vectors: " << G4endl;
85
86 G4cout << "The initial PostStep Vectors: " << G4endl;
89
90 if (sol == eLast)
91 {
93 }
94 else if (sol == eSecond)
95 {
96 // get transportation process
97 G4VProcess *transportation =
99
100 if (!transportation)
101 {
102 G4Exception("G4ProcessPlacer::AddProcessAs","Bias0001",RunMustBeAborted," could not get process id=0");
103 }
104 if (transportation->GetProcessName() != "Transportation" && transportation->GetProcessName() != "Transportation8" && transportation->GetProcessName() != "CoupledTransportation")
105 {
106 // G4cout << " GOT HERE CoupledTransportation" << G4endl;
107 G4cout << transportation->GetProcessName() << G4endl;
108 G4Exception("G4ProcessPlacer::AddProcessAs","Bias0002",RunMustBeAborted," process id=0 is not Transportation");
109 }
110
111 // place the given proces as first for the moment
112 // 31/5/11 previously set to first, then transportation set ahead of it,
113 // which is more conveniently correctly set with placing it second!
114 GetProcessManager()->AddProcess(process);
119 // xx test
120 // if(process->GetProcessName() == "ImportanceProcess")
121 //bug31/10/07 GetProcessManager()->SetProcessOrdering(process,
122 //bug31/10/07 idxAlongStep, 1);
123 // place transportation first again
124// GetProcessManager()->SetProcessOrderingToFirst(transportation,
125// idxAlongStep);
126// GetProcessManager()->SetProcessOrderingToFirst(transportation,
127// idxPostStep);
128 }
129
130 // for verification inly
131 G4cout << " The final AlongStep Vectors: " << G4endl;
134
135 G4cout << "The final PostStep Vectors: " << G4endl;
138
139 G4cout << "================================================" << G4endl;
140}
@ RunMustBeAborted
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
@ ordInActive
@ ordLast
@ idxPostStep
@ idxAlongStep
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
void SetProcessOrderingToSecond(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt)
G4ProcessVector * GetProcessList() const
G4int AddProcess(G4VProcess *aProcess, G4int ordAtRestDoIt=ordInActive, G4int ordAlongSteptDoIt=ordInActive, G4int ordPostStepDoIt=ordInActive)
void PrintAlongStepGPILVec()
G4ProcessManager * GetProcessManager()
void PrintAlongStepDoItVec()
const G4String & GetProcessName() const
Definition: G4VProcess.hh:382

References G4ProcessManager::AddProcess(), eLast, eSecond, G4cout, G4endl, G4Exception(), G4ProcessManager::GetProcessList(), GetProcessManager(), G4VProcess::GetProcessName(), idxAlongStep, idxPostStep, ordInActive, ordLast, PrintAlongStepDoItVec(), PrintAlongStepGPILVec(), PrintPostStepDoItVec(), PrintPostStepGPILVec(), RunMustBeAborted, and G4ProcessManager::SetProcessOrderingToSecond().

Referenced by AddProcessAsLastDoIt(), and AddProcessAsSecondDoIt().

◆ AddProcessAsLastDoIt()

void G4ProcessPlacer::AddProcessAsLastDoIt ( G4VProcess process)
virtual

Implements G4VProcessPlacer.

Definition at line 149 of file G4ProcessPlacer.cc.

150{
151 G4cout << "=== G4ProcessPlacer::AddProcessAsLastDoIt: for: "
152 << fParticleName << G4endl;
153 AddProcessAs(process, eLast);
154}
void AddProcessAs(G4VProcess *process, SecondOrLast)

References AddProcessAs(), eLast, fParticleName, G4cout, and G4endl.

Referenced by G4WeightCutOffConfigurator::Configure().

◆ AddProcessAsSecondDoIt()

void G4ProcessPlacer::AddProcessAsSecondDoIt ( G4VProcess process)
virtual

Implements G4VProcessPlacer.

Definition at line 142 of file G4ProcessPlacer.cc.

143{
144 G4cout << "=== G4ProcessPlacer::AddProcessAsSecondDoIt: for: "
145 << fParticleName << G4endl;
146 AddProcessAs(process, eSecond);
147}

References AddProcessAs(), eSecond, fParticleName, G4cout, and G4endl.

Referenced by G4ImportanceConfigurator::Configure(), and G4WeightWindowConfigurator::Configure().

◆ GetProcessManager()

G4ProcessManager * G4ProcessPlacer::GetProcessManager ( )
private

Definition at line 156 of file G4ProcessPlacer.cc.

157{
158 // get particle iterator to add processes ---------------------
159 G4ParticleTable* theParticleTable = 0;
161 theParticleTable = G4ParticleTable::GetParticleTable();
162 theParticleIterator = theParticleTable->GetIterator();
163 // -------------------------------------------------------
164 G4ProcessManager *processmanager = 0;
165 // find process manager ---------------------------
166 theParticleIterator->reset();
167 while( (*theParticleIterator)() ) /* while checked for unending loop, 30.05.2016, Marc Verderi */
168 {
169 G4ParticleDefinition* particle = theParticleIterator->value();
170 if (particle->GetParticleName() == fParticleName)
171 {
172 processmanager = particle->GetProcessManager();
173 break;
174 }
175 }
176 // ---------------------------------------------------------
177 if (!processmanager)
178 {
179 G4Exception("G4ProcessPlacer::GetProcessManager()", "InvalidSetup",
180 FatalException, "NULL pointer to Process Manager ! Sampler.Configure() must be after PhysicsList instantiation");
181 }
182 return processmanager;
183}
@ FatalException
#define theParticleIterator
G4ProcessManager * GetProcessManager() const
const G4String & GetParticleName() const
G4PTblDicIterator * GetIterator() const
static G4ParticleTable * GetParticleTable()

References FatalException, fParticleName, G4Exception(), G4ParticleTable::GetIterator(), G4ParticleDefinition::GetParticleName(), G4ParticleTable::GetParticleTable(), G4ParticleDefinition::GetProcessManager(), and theParticleIterator.

Referenced by AddProcessAs(), PrintAlongStepDoItVec(), PrintAlongStepGPILVec(), PrintPostStepDoItVec(), PrintPostStepGPILVec(), and RemoveProcess().

◆ PrintAlongStepDoItVec()

void G4ProcessPlacer::PrintAlongStepDoItVec ( )
private

Definition at line 193 of file G4ProcessPlacer.cc.

194{
195 G4cout << "DoIt Vector: " << G4endl;
196 G4ProcessVector* processDoItVec =
198 PrintProcVec(processDoItVec);
199}
@ typeDoIt
G4ProcessVector * GetAlongStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
void PrintProcVec(G4ProcessVector *processVec)

References G4cout, G4endl, G4ProcessManager::GetAlongStepProcessVector(), GetProcessManager(), PrintProcVec(), and typeDoIt.

Referenced by AddProcessAs(), and RemoveProcess().

◆ PrintAlongStepGPILVec()

void G4ProcessPlacer::PrintAlongStepGPILVec ( )
private

Definition at line 185 of file G4ProcessPlacer.cc.

186{
187 G4cout << "GPIL Vector: " << G4endl;
188 G4ProcessVector* processGPILVec =
190 PrintProcVec(processGPILVec);
191}
@ typeGPIL

References G4cout, G4endl, G4ProcessManager::GetAlongStepProcessVector(), GetProcessManager(), PrintProcVec(), and typeGPIL.

Referenced by AddProcessAs(), and RemoveProcess().

◆ PrintPostStepDoItVec()

void G4ProcessPlacer::PrintPostStepDoItVec ( )
private

Definition at line 210 of file G4ProcessPlacer.cc.

211{
212 G4cout << "DoIt Vector: " << G4endl;
213 G4ProcessVector* processDoItVec =
215 PrintProcVec(processDoItVec);
216}
G4ProcessVector * GetPostStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const

References G4cout, G4endl, G4ProcessManager::GetPostStepProcessVector(), GetProcessManager(), PrintProcVec(), and typeDoIt.

Referenced by AddProcessAs(), and RemoveProcess().

◆ PrintPostStepGPILVec()

void G4ProcessPlacer::PrintPostStepGPILVec ( )
private

Definition at line 202 of file G4ProcessPlacer.cc.

203{
204 G4cout << "GPIL Vector: " << G4endl;
205 G4ProcessVector* processGPILVec =
207 PrintProcVec(processGPILVec);
208}

References G4cout, G4endl, G4ProcessManager::GetPostStepProcessVector(), GetProcessManager(), PrintProcVec(), and typeGPIL.

Referenced by AddProcessAs(), and RemoveProcess().

◆ PrintProcVec()

void G4ProcessPlacer::PrintProcVec ( G4ProcessVector processVec)
private

Definition at line 219 of file G4ProcessPlacer.cc.

220{
221 if (!processVec)
222 {
223 G4Exception("G4ProcessPlacer::G4ProcessPlacer()", "InvalidArgument",
224 FatalException, "NULL pointer to process-vector !");
225 }
226 size_t len = processVec->length();
227 if (len==0)
228 {
229 G4Exception("G4ProcessPlacer::G4ProcessPlacer()", "InvalidSetup",
230 FatalException, "Length of process-vector is zero !");
231 }
232 for (size_t i=0; i<len; i++)
233 {
234 G4VProcess *p = (*processVec)[i];
235 if (p)
236 {
237 G4cout << " " << p->GetProcessName() << G4endl;
238 }
239 else
240 {
241 G4cout << " " << "no process found for position: " << i
242 << ", in vector of length: " << len << G4endl;
243 }
244 }
245}
std::size_t length() const

References FatalException, G4cout, G4endl, G4Exception(), G4VProcess::GetProcessName(), and G4ProcessVector::length().

Referenced by PrintAlongStepDoItVec(), PrintAlongStepGPILVec(), PrintPostStepDoItVec(), and PrintPostStepGPILVec().

◆ RemoveProcess()

void G4ProcessPlacer::RemoveProcess ( G4VProcess process)
virtual

Implements G4VProcessPlacer.

Definition at line 49 of file G4ProcessPlacer.cc.

50{
51 G4cout << "=== G4ProcessPlacer::RemoveProcess: for: " << fParticleName
52 << G4endl;
53 G4cout << " ProcessName: " << process->GetProcessName()
54 << ", will be removed!" << G4endl;
55
56 G4cout << " The initial AlongStep Vectors: " << G4endl;
59
60 G4cout << " The initial PostStep Vectors: " << G4endl;
63
65
66 G4cout << " The final AlongStep Vectors: " << G4endl;
69
70 G4cout << " The final PostStep Vectors: " << G4endl;
73
74 G4cout << "================================================" << G4endl;
75
76}
G4VProcess * RemoveProcess(G4VProcess *aProcess)

References fParticleName, G4cout, G4endl, GetProcessManager(), G4VProcess::GetProcessName(), PrintAlongStepDoItVec(), PrintAlongStepGPILVec(), PrintPostStepDoItVec(), PrintPostStepGPILVec(), and G4ProcessManager::RemoveProcess().

Referenced by G4ImportanceConfigurator::~G4ImportanceConfigurator(), G4WeightCutOffConfigurator::~G4WeightCutOffConfigurator(), and G4WeightWindowConfigurator::~G4WeightWindowConfigurator().

Field Documentation

◆ fParticleName

G4String G4ProcessPlacer::fParticleName
private

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