Geant4  10.02.p03
G4ProcessPlacer Class Reference

#include <G4ProcessPlacer.hh>

Inheritance diagram for G4ProcessPlacer:
Collaboration diagram for G4ProcessPlacer:

Public Types

enum  SecondOrLast { eSecond = 1, eLast = 0 }
 

Public Member Functions

 G4ProcessPlacer (const G4String &particlename)
 
virtual ~G4ProcessPlacer ()
 
virtual void AddProcessAsLastDoIt (G4VProcess *process)
 
virtual void AddProcessAsSecondDoIt (G4VProcess *process)
 
virtual void RemoveProcess (G4VProcess *process)
 
- Public Member Functions inherited from G4VProcessPlacer
 G4VProcessPlacer ()
 
virtual ~G4VProcessPlacer ()
 

Private Member Functions

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

Private Attributes

G4String fParticleName
 

Detailed Description

Definition at line 49 of file G4ProcessPlacer.hh.

Member Enumeration Documentation

◆ SecondOrLast

Enumerator
eSecond 
eLast 

Definition at line 72 of file G4ProcessPlacer.hh.

Constructor & Destructor Documentation

◆ G4ProcessPlacer()

G4ProcessPlacer::G4ProcessPlacer ( const G4String particlename)
explicit

Definition at line 41 of file G4ProcessPlacer.cc.

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

◆ ~G4ProcessPlacer()

G4ProcessPlacer::~G4ProcessPlacer ( )
virtual

Definition at line 46 of file G4ProcessPlacer.cc.

47 {
48 }

Member Function Documentation

◆ AddProcessAs()

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

Definition at line 79 of file G4ProcessPlacer.cc.

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

◆ AddProcessAsLastDoIt()

void G4ProcessPlacer::AddProcessAsLastDoIt ( G4VProcess process)
virtual

Implements G4VProcessPlacer.

Definition at line 150 of file G4ProcessPlacer.cc.

151 {
152  G4cout << "=== G4ProcessPlacer::AddProcessAsLastDoIt: for: "
153  << fParticleName << G4endl;
154  AddProcessAs(process, eLast);
155 }
void AddProcessAs(G4VProcess *process, SecondOrLast)
G4GLOB_DLL std::ostream G4cout
G4String fParticleName
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:

◆ AddProcessAsSecondDoIt()

void G4ProcessPlacer::AddProcessAsSecondDoIt ( G4VProcess process)
virtual

Implements G4VProcessPlacer.

Definition at line 143 of file G4ProcessPlacer.cc.

144 {
145  G4cout << "=== G4ProcessPlacer::AddProcessAsSecondDoIt: for: "
146  << fParticleName << G4endl;
147  AddProcessAs(process, eSecond);
148 }
void AddProcessAs(G4VProcess *process, SecondOrLast)
G4GLOB_DLL std::ostream G4cout
G4String fParticleName
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:

◆ GetProcessManager()

G4ProcessManager * G4ProcessPlacer::GetProcessManager ( )
private

Definition at line 157 of file G4ProcessPlacer.cc.

158 {
159  // get particle iterator to add processes ---------------------
160  G4ParticleTable* theParticleTable = 0;
162  theParticleTable = G4ParticleTable::GetParticleTable();
163  theParticleIterator = theParticleTable->GetIterator();
164  // -------------------------------------------------------
165  G4ProcessManager *processmanager = 0;
166  // find process manager ---------------------------
167  theParticleIterator->reset();
168  while( (*theParticleIterator)() )
169  {
170  G4ParticleDefinition* particle = theParticleIterator->value();
171  if (particle->GetParticleName() == fParticleName)
172  {
173  processmanager = particle->GetProcessManager();
174  break;
175  }
176  }
177  // ---------------------------------------------------------
178  if (!processmanager)
179  {
180  G4Exception("G4ProcessPlacer::GetProcessManager()", "InvalidSetup",
181  FatalException, "NULL pointer to Process Manager ! Sampler.Configure() must be after PhysicsList instantiation");
182  }
183  return processmanager;
184 }
G4ProcessManager * GetProcessManager() const
const G4String & GetParticleName() const
void reset(G4bool ifSkipIon=true)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static G4ParticleTable * GetParticleTable()
G4String fParticleName
G4PTblDicIterator * GetIterator() const
#define theParticleIterator
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PrintAlongStepDoItVec()

void G4ProcessPlacer::PrintAlongStepDoItVec ( )
private

Definition at line 194 of file G4ProcessPlacer.cc.

195 {
196  G4cout << "DoIt Vector: " << G4endl;
197  G4ProcessVector* processDoItVec =
199  PrintProcVec(processDoItVec);
200 }
G4GLOB_DLL std::ostream G4cout
G4ProcessVector * GetAlongStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
G4ProcessManager * GetProcessManager()
#define G4endl
Definition: G4ios.hh:61
void PrintProcVec(G4ProcessVector *processVec)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PrintAlongStepGPILVec()

void G4ProcessPlacer::PrintAlongStepGPILVec ( )
private

Definition at line 186 of file G4ProcessPlacer.cc.

187 {
188  G4cout << "GPIL Vector: " << G4endl;
189  G4ProcessVector* processGPILVec =
191  PrintProcVec(processGPILVec);
192 }
G4GLOB_DLL std::ostream G4cout
G4ProcessVector * GetAlongStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
G4ProcessManager * GetProcessManager()
#define G4endl
Definition: G4ios.hh:61
void PrintProcVec(G4ProcessVector *processVec)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PrintPostStepDoItVec()

void G4ProcessPlacer::PrintPostStepDoItVec ( )
private

Definition at line 211 of file G4ProcessPlacer.cc.

212 {
213  G4cout << "DoIt Vector: " << G4endl;
214  G4ProcessVector* processDoItVec =
216  PrintProcVec(processDoItVec);
217 }
G4ProcessVector * GetPostStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
G4GLOB_DLL std::ostream G4cout
G4ProcessManager * GetProcessManager()
#define G4endl
Definition: G4ios.hh:61
void PrintProcVec(G4ProcessVector *processVec)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PrintPostStepGPILVec()

void G4ProcessPlacer::PrintPostStepGPILVec ( )
private

Definition at line 203 of file G4ProcessPlacer.cc.

204 {
205  G4cout << "GPIL Vector: " << G4endl;
206  G4ProcessVector* processGPILVec =
208  PrintProcVec(processGPILVec);
209 }
G4ProcessVector * GetPostStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
G4GLOB_DLL std::ostream G4cout
G4ProcessManager * GetProcessManager()
#define G4endl
Definition: G4ios.hh:61
void PrintProcVec(G4ProcessVector *processVec)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PrintProcVec()

void G4ProcessPlacer::PrintProcVec ( G4ProcessVector processVec)
private

Definition at line 220 of file G4ProcessPlacer.cc.

221 {
222  if (!processVec)
223  {
224  G4Exception("G4ProcessPlacer::G4ProcessPlacer()", "InvalidArgument",
225  FatalException, "NULL pointer to process-vector !");
226  }
227  size_t len = processVec->length();
228  if (len==0)
229  {
230  G4Exception("G4ProcessPlacer::G4ProcessPlacer()", "InvalidSetup",
231  FatalException, "Length of process-vector is zero !");
232  }
233  for (size_t i=0; i<len; i++)
234  {
235  G4VProcess *p = (*processVec)[i];
236  if (p)
237  {
238  G4cout << " " << p->GetProcessName() << G4endl;
239  }
240  else
241  {
242  G4cout << " " << "no process found for position: " << i
243  << ", in vector of length: " << len << G4endl;
244  }
245  }
246 }
const G4String & GetProcessName() const
Definition: G4VProcess.hh:408
G4GLOB_DLL std::ostream G4cout
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
G4int length() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ RemoveProcess()

void G4ProcessPlacer::RemoveProcess ( G4VProcess process)
virtual

Implements G4VProcessPlacer.

Definition at line 50 of file G4ProcessPlacer.cc.

51 {
52  G4cout << "=== G4ProcessPlacer::RemoveProcess: for: " << fParticleName
53  << G4endl;
54  G4cout << " ProcessName: " << process->GetProcessName()
55  << ", will be removed!" << G4endl;
56 
57  G4cout << " The initial AlongStep Vectors: " << G4endl;
60 
61  G4cout << " The initial PostStep Vectors: " << G4endl;
64 
65  GetProcessManager()->RemoveProcess(process);
66 
67  G4cout << " The final AlongStep Vectors: " << G4endl;
70 
71  G4cout << " The final PostStep Vectors: " << G4endl;
74 
75  G4cout << "================================================" << G4endl;
76 
77 }
void PrintAlongStepGPILVec()
const G4String & GetProcessName() const
Definition: G4VProcess.hh:408
G4GLOB_DLL std::ostream G4cout
G4String fParticleName
G4ProcessManager * GetProcessManager()
void PrintAlongStepDoItVec()
#define G4endl
Definition: G4ios.hh:61
G4VProcess * RemoveProcess(G4VProcess *aProcess)
Here is the call graph for this function:

Member Data Documentation

◆ fParticleName

G4String G4ProcessPlacer::fParticleName
private

Definition at line 91 of file G4ProcessPlacer.hh.


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