ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ProcessManager.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4ProcessManager.hh
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 // ---------------- G4ProcessManager -----------------
27 //
28 // Class Description:
29 //
30 // G4ProcessManager collects all physics a particle can undertake as
31 // vectors. These vectors are:
32 // one vector for all processes (called as "process List")
33 // two vectors for processes with AtRestGetPhysicalInteractionLength()
34 // and AtRestDoIt()
35 // two vectors for processes with AlongStepGetPhysicalInteractionLength()
36 // and AlongStepDoIt()
37 // two vectors for processes with PostStepGetPhysicalInteractionLength()
38 // and PostStepDoIt()
39 // The tracking will message three types of GetPhysicalInteractionLength()
40 // in order to limit the Step and select the occurrence of processes.
41 // It will message the corresponding DoIt() to apply the selected
42 // processes. In addition, the Tracking will limit the Step
43 // and select the occurrence of the processes according to
44 // the shortest physical interaction length computed (except for
45 // processes at rest, for which the Tracking will select the
46 // occurrence of the process which returns the shortest mean
47 // life-time from the GetPhysicalInteractionLength()).
48 
49 // - First implementation, based on object model of
50 // 2nd December 1995, G.Cosmo
51 // - Revised; added vector of processes at rest
52 // 06 May 1996, G.Cosmo
53 // --------------------------------------------------------------------
54 // - New Physics scheme - 08.01.1997, H.Kurashige
55 // - Use STL vector instead of RW vector - 01.03.2000, H.Kurashige
56 // --------------------------------------------------------------------
57 #ifndef G4ProcessManager_hh
58 #define G4ProcessManager_hh 1
59 
60 #include <vector>
61 
62 #include "globals.hh"
63 #include "G4ios.hh"
64 
65 #include "G4VProcess.hh"
66 #include "G4ProcessVector.hh"
67 #include "G4ParticleDefinition.hh"
68 
70 class G4ProcessAttribute;
71 
72 // Indexes for ProcessVector
74 {
75  typeGPIL = 0, // for GetPhysicalInteractionLength
76  typeDoIt =1 // for DoIt
77 };
79 {
80  idxAll = -1, // for all DoIt/GPIL
81  idxAtRest = 0, // for AtRestDoIt/GPIL
82  idxAlongStep = 1, // for AlongStepDoIt/GPIL
83  idxPostStep =2, // for AlongSTepDoIt/GPIL
84  NDoit =3
85 };
86 
87 // enumeration for Ordering Parameter
89 {
90  ordInActive = -1, // ordering parameter to indicate InActive DoIt
91  ordDefault = 1000, // default ordering parameter
92  ordLast = 9999 // ordering parameter to indicate the last DoIt
93 };
94 
96 {
97  public:
98  // copy constructor
100 
101  private:
102  // hide default constructor and assignment operator
105 
106  public:
107 
108  G4ProcessManager(const G4ParticleDefinition* aParticleType);
109  // Constructor
110 
112  // Destructor
113 
114  G4bool operator==(const G4ProcessManager &right) const;
115  G4bool operator!=(const G4ProcessManager &right) const;
116 
117  public: // with description
119  // Returns the address of the vector of all processes
120 
121  G4int GetProcessListLength() const;
122  // Returns the number of process in the ProcessVector
123 
125  // Returns the index of the process in the process List
126 
127  // --------------------------------------
128 
132  ) const;
133  // Returns the address of the vector of processes
134 
137  ) const;
138  // Returns the address of the vector of processes for
139  // AtRestGetPhysicalInteractionLength idx =0
140  // AtRestGetPhysicalDoIt idx =1
143  ) const;
144  // Returns the address of the vector of processes for
145  // AlongStepGetPhysicalInteractionLength idx =0
146  // AlongStepGetPhysicalDoIt idx =1
147 
150  ) const;
151  // Returns the address of the vector of processes for
152  // PostStepGetPhysicalInteractionLength idx =0
153  // PostStepGetPhysicalDoIt idx =1
154 
156  G4VProcess* aProcess,
159  ) const;
161  G4VProcess* aProcess,
163  ) const;
165  G4VProcess* aProcess,
167  ) const;
169  G4VProcess* aProcess,
171  ) const;
172  // Returns the index for GPIL/DoIt process vector of the process
173 
175  G4VProcess *aProcess,
176  G4int ordAtRestDoIt = ordInActive,
177  G4int ordAlongSteptDoIt = ordInActive,
178  G4int ordPostStepDoIt = ordInActive
179  );
180  // Add a process to the process List
181  // return values are index to the List. Negative return value
182  // indicates that the process has not be added due to some errors
183  // The first argument is a pointer to process.
184  // Following arguments are ordering parameters of the process in
185  // process vectors. If value is negative, the process is
186  // not added to the corresponding process vector.
187 
188  // following methods are provided for simple processes
189  // AtRestProcess has only AtRestDoIt
190  // ContinuousProcess has only AlongStepDoIt
191  // DiscreteProcess has only PostStepDoIt
192  // If the ording parameter is not specified, the process is
193  // added at the end of List of process vectors
194  // If a process with same ordering parameter exists,
195  // this new process will be added just after processes
196  // with same ordering parameter
197  // (except for processes assigned to LAST explicitly )
198  // for both DoIt and GetPhysicalInteractionLength
199  //
200 
201  G4int AddRestProcess(G4VProcess *aProcess, G4int ord = ordDefault);
204 
205 
207  // Methods for setting ordering parameters
208  // Altanative methods for setting ordering parameters
209  // Note: AddProcess method should precede these methods
210 
212  G4VProcess *aProcess,
214  );
215 
216  void SetProcessOrdering(
217  G4VProcess *aProcess,
219  G4int ordDoIt = ordDefault
220  );
221  // Set ordering parameter for DoIt specified by typeDoIt.
222  // If a process with same ordering parameter exists,
223  // this new process will be added just after processes
224  // with same ordering parameter
225  // Note: Ordering parameter will bet set to non-zero
226  // even if you set ordDoIt = 0
227 
229  G4VProcess *aProcess,
231  );
232  // Set ordering parameter to the first of all processes
233  // for DoIt specified by idDoIt.
234  // Note: If you use this method for two processes,
235  // a process called later will be first.
236 
238  G4VProcess *aProcess,
240  );
241  // Set ordering parameter to 1 for DoIt specified by idDoIt
242  // and the rpocess will be added just after
243  // the processes with ordering parameter equal to zero
244  // Note: If you use this method for two processes,
245  // a process called later will be .
246 
248  G4VProcess *aProcess,
250  );
251  // Set ordering parameter to the last of all processes
252  // for DoIt specified by idDoIt.
253  // Note: If you use this method for two processes,
254  // a process called later will precede.
255 
256  G4VProcess* RemoveProcess(G4VProcess *aProcess);
258  // Removes a process from the process List.
259  // return value is pointer to the removed process.
260  // (0 value will be returned in case of errors)
261 
262  G4VProcess* SetProcessActivation(G4VProcess *aProcess, G4bool fActive);
263  G4VProcess* SetProcessActivation(G4int index, G4bool fActive);
264  // Set activation flag.
265  // return value is pointer to the applied process.
266  // (0 value will be returned in case of errors)
267 
268  G4bool GetProcessActivation(G4VProcess *aProcess) const;
269  G4bool GetProcessActivation(G4int index) const;
270  // Get activation flag.
271 
273  // get the particle type
275  // set the particle type
276 
277  G4VProcess* GetProcess (const G4String&) const;
278  // get process by process name
279 
280  void StartTracking(G4Track* aTrack=0);
281  void EndTracking();
282  // these two methods are used by G4TrackingManager
283  // in order to inform Start/End of tracking for each track
284  // to the process manager and all physics processes
285 
286 
287  public:
289  private:
291  // vector for processes with GetPhysicalInteractionLength/DoIt
292 
293  typedef std::vector<G4ProcessAttribute*> G4ProcessAttrVector;
295  // vector for process attribute
296 
297  protected: // with description
298  G4int InsertAt(G4int position, G4VProcess* process, G4int ivec);
299  // insert process at position in theProcVector[ivec]
300 
301  G4int RemoveAt(G4int position, G4VProcess* process, G4int ivec);
302  // remove process at position in theProcVector[ivec]
303 
304  G4int FindInsertPosition(G4int ord, G4int ivec);
305  // find insert position according to ordering parameter
306  // in theProcVector[ivec]
307 
310 
311  void CheckOrderingParameters(G4VProcess*) const;
312  // check consistencies between ordering parameters and
313  // validity of DoIt of the Process
314 
315  private:
316  G4ProcessAttribute* GetAttribute(G4int index) const;
317  G4ProcessAttribute* GetAttribute(G4VProcess *aProcess) const;
318  // get Pointer to ProcessAttribute
319 
322  // Activate/InActivateProcess Process
323 
324  private:
326  // particle which has this process manager object
327 
330  // vector for all processes (called as "process List")
331 
332  private:
334  void CreateGPILvectors();
335  void SetIndexToProcessVector(G4int ivec);
336 
339 
340  public: // with description
341  void DumpInfo();
342 
344  G4int GetVerboseLevel() const;
345  // controle flag for output message
346  // 0: Silent
347  // 1: Warning message
348  // 2: More
349 
350  protected:
352 
353  private:
356 };
357 
358 #include "G4ProcessManager.icc"
359 
360 #endif