Geant4  10.00.p01
G4ProcessManager.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4ProcessManager.hh 71231 2013-06-12 13:06:28Z gcosmo $
28 //
29 //
30 // ------------------------------------------------------------
31 // GEANT 4 class header file
32 //
33 // History: first implementation, based on object model of
34 // 2nd December 1995, G.Cosmo
35 // ---------------- G4ProcessManager -----------------
36 // Class Description
37 // It collects all physics a particle can undertake as seven vectors.
38 // These vectors are
39 // one vector for all processes (called as "process List")
40 // two vectors for processes with AtRestGetPhysicalInteractionLength
41 // and AtRestDoIt
42 // two vectors for processes with AlongStepGetPhysicalInteractionLength
43 // and AlongStepDoIt
44 // two vectors for processes with PostStepGetPhysicalInteractionLength
45 // and PostStepDoIt
46 // The tracking will message three types of GetPhysicalInteractionLength
47 // in order to limit the Step and select the occurence of processes.
48 // It will message the corresponding DoIt() to apply the selected
49 // processes. In addition, the Tracking will limit the Step
50 // and select the occurence of the processes according to
51 // the shortest physical interaction length computed (except for
52 // processes at rest, for which the Tracking will select the
53 // occurence of the process which returns the shortest mean
54 // life-time from the GetPhysicalInteractionLength()).
55 //
56 // History:
57 // revised by G.Cosmo, 06 May 1996
58 // Added vector of processes at rest, 06 May 1996
59 // ------------------------------------------------------------
60 // New Physics scheme 8 Jan. 1997 H.Kurahige
61 // Add SetProcessOrdering methods 27 Mar 1998 H.Kurahige
62 // Add copy constructor (deep copy) 28 June 1998 H.Kurashige
63 // Add GetProcessActivation 3 May. 1999 H.Kurashige
64 // Use STL vector instead of RW vector 1. Mar 00 H.Kurashige
65 // Modify G4ProcessVectorOrdering to fix FindInsedrtPosition 15 Feb. 2005
66 // Add
67 // ------------------------------------------------------------
68 
69 #ifndef G4ProcessManager_h
70 #define G4ProcessManager_h 1
71 
72 #include "globals.hh"
73 #include "G4ios.hh"
74 #include <vector>
75 
76 #include "G4VProcess.hh"
77 #include "G4ProcessVector.hh"
78 #include "G4ParticleDefinition.hh"
79 
81 class G4ProcessAttribute;
82 
83 // Indexes for ProcessVector
85 {
86  typeGPIL = 0, // for GetPhysicalInteractionLength
87  typeDoIt =1 // for DoIt
88 };
90 {
91  idxAll = -1, // for all DoIt/GPIL
92  idxAtRest = 0, // for AtRestDoIt/GPIL
93  idxAlongStep = 1, // for AlongStepDoIt/GPIL
94  idxPostStep =2, // for AlongSTepDoIt/GPIL
95  NDoit =3
96 };
97 
98 // enumeration for Ordering Parameter
100 {
101  ordInActive = -1, // ordering parameter to indicate InActive DoIt
102  ordDefault = 1000, // default ordering parameter
103  ordLast = 9999 // ordering parameter to indicate the last DoIt
104 };
105 
107 {
108 
109  public:
110  // copy constructor
112 
113  private:
114  // hide default constructor and assignment operator
117 
118  public:
119 
120  G4ProcessManager(const G4ParticleDefinition* aParticleType);
121  // Constructor
122 
124  // Destructor
125 
126  G4int operator==(const G4ProcessManager &right) const;
127  G4int operator!=(const G4ProcessManager &right) const;
128 
129  public: // with description
131  // Returns the address of the vector of all processes
132 
133  G4int GetProcessListLength() const;
134  // Returns the number of process in the ProcessVector
135 
137  // Returns the index of the process in the process List
138 
139  // --------------------------------------
140 
144  ) const;
145  // Returns the address of the vector of processes
146 
149  ) const;
150  // Returns the address of the vector of processes for
151  // AtRestGetPhysicalInteractionLength idx =0
152  // AtRestGetPhysicalDoIt idx =1
155  ) const;
156  // Returns the address of the vector of processes for
157  // AlongStepGetPhysicalInteractionLength idx =0
158  // AlongStepGetPhysicalDoIt idx =1
159 
162  ) const;
163  // Returns the address of the vector of processes for
164  // PostStepGetPhysicalInteractionLength idx =0
165  // PostStepGetPhysicalDoIt idx =1
166 
168  G4VProcess* aProcess,
171  ) const;
173  G4VProcess* aProcess,
175  ) const;
177  G4VProcess* aProcess,
179  ) const;
181  G4VProcess* aProcess,
183  ) const;
184  // Returns the index for GPIL/DoIt process vector of the process
185 
187  G4VProcess *aProcess,
188  G4int ordAtRestDoIt = ordInActive,
189  G4int ordAlongSteptDoIt = ordInActive,
190  G4int ordPostStepDoIt = ordInActive
191  );
192  // Add a process to the process List
193  // return values are index to the List. Negative return value
194  // indicates that the process has not be added due to some errors
195  // The first argument is a pointer to process.
196  // Following arguments are ordering parameters of the process in
197  // process vectors. If value is negative, the process is
198  // not added to the corresponding process vector.
199 
200  // following methods are provided for simple processes
201  // AtRestProcess has only AtRestDoIt
202  // ContinuousProcess has only AlongStepDoIt
203  // DiscreteProcess has only PostStepDoIt
204  // If the ording parameter is not specified, the process is
205  // added at the end of List of process vectors
206  // If a process with same ordering parameter exists,
207  // this new process will be added just after processes
208  // with same ordering parameter
209  // (except for processes assigned to LAST explicitly )
210  // for both DoIt and GetPhysicalInteractionLength
211  //
212 
213  G4int AddRestProcess(G4VProcess *aProcess, G4int ord = ordDefault);
216 
217 
219  // Methods for setting ordering parameters
220  // Altanative methods for setting ordering parameters
221  // Note: AddProcess method should precede these methods
222 
224  G4VProcess *aProcess,
226  );
227 
228  void SetProcessOrdering(
229  G4VProcess *aProcess,
231  G4int ordDoIt = ordDefault
232  );
233  // Set ordering parameter for DoIt specified by typeDoIt.
234  // If a process with same ordering parameter exists,
235  // this new process will be added just after processes
236  // with same ordering parameter
237  // Note: Ordering parameter will bet set to non-zero
238  // even if you set ordDoIt = 0
239 
241  G4VProcess *aProcess,
243  );
244  // Set ordering parameter to the first of all processes
245  // for DoIt specified by idDoIt.
246  // Note: If you use this method for two processes,
247  // a process called later will be first.
248 
250  G4VProcess *aProcess,
252  );
253  // Set ordering parameter to 1 for DoIt specified by idDoIt
254  // and the rpocess will be added just after
255  // the processes with ordering parameter equal to zero
256  // Note: If you use this method for two processes,
257  // a process called later will be .
258 
260  G4VProcess *aProcess,
262  );
263  // Set ordering parameter to the last of all processes
264  // for DoIt specified by idDoIt.
265  // Note: If you use this method for two processes,
266  // a process called later will precede.
267 
268  G4VProcess* RemoveProcess(G4VProcess *aProcess);
270  // Removes a process from the process List.
271  // return value is pointer to the removed process.
272  // (0 value will be returned in case of errors)
273 
274  G4VProcess* SetProcessActivation(G4VProcess *aProcess, G4bool fActive);
275  G4VProcess* SetProcessActivation(G4int index, G4bool fActive);
276  // Set activation flag.
277  // return value is pointer to the applied process.
278  // (0 value will be returned in case of errors)
279 
280  G4bool GetProcessActivation(G4VProcess *aProcess) const;
281  G4bool GetProcessActivation(G4int index) const;
282  // Get activation flag.
283 
285  // get the particle type
287  // set the particle type
288 
289  void StartTracking(G4Track* aTrack=0);
290  void EndTracking();
291  // these two methods are used by G4TrackingManager
292  // in order to inform Start/End of tracking for each track
293  // to the process manager and all physics processes
294 
295 
296  public:
298  private:
300  // vector for processes with GetPhysicalInteractionLength/DoIt
301 
302  typedef std::vector<G4ProcessAttribute*> G4ProcessAttrVector;
303  G4ProcessAttrVector* theAttrVector;
304  // vector for process attribute
305 
306  protected: // with description
307  G4int InsertAt(G4int position, G4VProcess* process, G4int ivec);
308  // insert process at position in theProcVector[ivec]
309 
310  G4int RemoveAt(G4int position, G4VProcess* process, G4int ivec);
311  // remove process at position in theProcVector[ivec]
312 
313  G4int FindInsertPosition(G4int ord, G4int ivec);
314  // find insert position according to ordering parameter
315  // in theProcVector[ivec]
316 
319 
320  void CheckOrderingParameters(G4VProcess*) const;
321  // check consistencies between ordering parameters and
322  // validity of DoIt of the Process
323 
324  private:
325  G4ProcessAttribute* GetAttribute(G4int index) const;
326  G4ProcessAttribute* GetAttribute(G4VProcess *aProcess) const;
327  // get Pointer to ProcessAttribute
328 
331  // Activate/InActivateProcess Process
332 
333  private:
335  // particle which has this process manager object
336 
339  // vector for all processes (called as "process List")
340 
341  private:
343  void CreateGPILvectors();
344  void SetIndexToProcessVector(G4int ivec);
345 
348 
349  public: // with description
350  void DumpInfo();
351 
352  void SetVerboseLevel(G4int value);
353  G4int GetVerboseLevel() const;
354  // controle flag for output message
355  // 0: Silent
356  // 1: Warning message
357  // 2: More
358 
359  protected:
361 
362  private:
365 };
366 #include "G4ProcessManager.icc"
367 
368 #endif
369 
G4ProcessVector * GetProcessVector(G4ProcessVectorDoItIndex idx, G4ProcessVectorTypeIndex typ=typeGPIL) const
std::vector< G4ProcessAttribute * > G4ProcessAttrVector
G4int GetProcessVectorIndex(G4VProcess *aProcess, G4ProcessVectorDoItIndex idx, G4ProcessVectorTypeIndex typ=typeGPIL) const
G4int GetAlongStepIndex(G4VProcess *aProcess, G4ProcessVectorTypeIndex typ=typeGPIL) const
G4ProcessVectorTypeIndex typ
void SetProcessOrderingToFirst(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt)
void SetProcessOrderingToSecond(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt)
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
G4ProcessManager & operator=(const G4ProcessManager &right)
G4ProcessAttrVector * theAttrVector
static G4ThreadLocal G4int counterOfObjects
G4int GetProcessOrdering(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt)
void SetVerboseLevel(G4int value)
G4int operator==(const G4ProcessManager &right) const
#define G4ThreadLocal
Definition: tls.hh:52
G4bool isSetOrderingFirstInvoked[NDoit]
G4ProcessVectorOrdering
G4int GetVerboseLevel() const
void SetParticleType(const G4ParticleDefinition *)
int G4int
Definition: G4Types.hh:78
const G4ParticleDefinition * theParticleType
G4int InsertAt(G4int position, G4VProcess *process, G4int ivec)
G4int GetAtRestIndex(G4VProcess *aProcess, G4ProcessVectorTypeIndex typ=typeGPIL) const
void CheckOrderingParameters(G4VProcess *) const
G4int operator!=(const G4ProcessManager &right) const
G4VProcess * SetProcessActivation(G4VProcess *aProcess, G4bool fActive)
G4VProcess * ActivateProcess(G4int index)
G4int RemoveAt(G4int position, G4VProcess *process, G4int ivec)
G4ProcessVector * GetAtRestProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
G4int FindInsertPosition(G4int ord, G4int ivec)
bool G4bool
Definition: G4Types.hh:79
G4int AddProcess(G4VProcess *aProcess, G4int ordAtRestDoIt=ordInActive, G4int ordAlongSteptDoIt=ordInActive, G4int ordPostStepDoIt=ordInActive)
G4ProcessAttribute * GetAttribute(G4int index) const
void SetProcessOrdering(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt, G4int ordDoIt=ordDefault)
G4ParticleDefinition * GetParticleType() const
G4int GetProcessVectorId(G4ProcessVectorDoItIndex idx, G4ProcessVectorTypeIndex typ=typeGPIL) const
void SetIndexToProcessVector(G4int ivec)
G4VProcess * InActivateProcess(G4int index)
G4ProcessVector * theProcVector[SizeOfProcVectorArray]
void SetProcessOrderingToLast(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt)
void StartTracking(G4Track *aTrack=0)
int position
Definition: filter.cc:7
G4int GetPostStepIndex(G4VProcess *aProcess, G4ProcessVectorTypeIndex typ=typeGPIL) const
G4int GetProcessIndex(G4VProcess *) const
G4bool GetProcessActivation(G4VProcess *aProcess) const
G4bool isSetOrderingLastInvoked[NDoit]
G4int AddRestProcess(G4VProcess *aProcess, G4int ord=ordDefault)
G4ProcessVector * GetAlongStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
G4ProcessVectorTypeIndex
G4int GetProcessListLength() const
G4VProcess * RemoveProcess(G4VProcess *aProcess)
G4ProcessVector * theProcessList
G4ProcessVectorDoItIndex
G4ProcessVector * GetProcessList() const
static G4ThreadLocal G4ProcessManagerMessenger * fProcessManagerMessenger
G4int AddContinuousProcess(G4VProcess *aProcess, G4int ord=ordDefault)
G4ProcessVector * GetPostStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const