Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
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 //
27 // $Id: G4ProcessManager.hh 107935 2017-12-14 09:04:59Z 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  G4VProcess* GetProcess (const G4String&) const;
290  // get process by process name
291 
292  void StartTracking(G4Track* aTrack=0);
293  void EndTracking();
294  // these two methods are used by G4TrackingManager
295  // in order to inform Start/End of tracking for each track
296  // to the process manager and all physics processes
297 
298 
299  public:
301  private:
303  // vector for processes with GetPhysicalInteractionLength/DoIt
304 
305  typedef std::vector<G4ProcessAttribute*> G4ProcessAttrVector;
307  // vector for process attribute
308 
309  protected: // with description
310  G4int InsertAt(G4int position, G4VProcess* process, G4int ivec);
311  // insert process at position in theProcVector[ivec]
312 
313  G4int RemoveAt(G4int position, G4VProcess* process, G4int ivec);
314  // remove process at position in theProcVector[ivec]
315 
316  G4int FindInsertPosition(G4int ord, G4int ivec);
317  // find insert position according to ordering parameter
318  // in theProcVector[ivec]
319 
322 
323  void CheckOrderingParameters(G4VProcess*) const;
324  // check consistencies between ordering parameters and
325  // validity of DoIt of the Process
326 
327  private:
328  G4ProcessAttribute* GetAttribute(G4int index) const;
329  G4ProcessAttribute* GetAttribute(G4VProcess *aProcess) const;
330  // get Pointer to ProcessAttribute
331 
334  // Activate/InActivateProcess Process
335 
336  private:
338  // particle which has this process manager object
339 
342  // vector for all processes (called as "process List")
343 
344  private:
346  void CreateGPILvectors();
347  void SetIndexToProcessVector(G4int ivec);
348 
351 
352  public: // with description
353  void DumpInfo();
354 
356  G4int GetVerboseLevel() const;
357  // controle flag for output message
358  // 0: Silent
359  // 1: Warning message
360  // 2: More
361 
362  protected:
364 
365  private:
368 };
369 #include "G4ProcessManager.icc"
370 
371 #endif
372 
G4bool GetProcessActivation(G4VProcess *aProcess) const
G4VProcess * ActivateProcess(G4int index)
G4int GetAtRestIndex(G4VProcess *aProcess, G4ProcessVectorTypeIndex typ=typeGPIL) const
G4VProcess * GetProcess(const G4String &) const
void SetParticleType(const G4ParticleDefinition *)
void SetProcessOrderingToLast(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt)
G4int GetProcessListLength() const
G4int AddRestProcess(G4VProcess *aProcess, G4int ord=ordDefault)
static G4ThreadLocal G4ProcessManagerMessenger * fProcessManagerMessenger
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
G4int GetProcessVectorIndex(G4VProcess *aProcess, G4ProcessVectorDoItIndex idx, G4ProcessVectorTypeIndex typ=typeGPIL) const
G4VProcess * InActivateProcess(G4int index)
G4int GetProcessOrdering(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt)
G4ProcessVectorDoItIndex
G4ProcessVectorOrdering
G4bool isSetOrderingLastInvoked[NDoit]
G4int RemoveAt(G4int position, G4VProcess *process, G4int ivec)
G4ProcessVector * GetProcessList() const
#define G4ThreadLocal
Definition: tls.hh:69
G4ProcessVectorTypeIndex typ
G4ProcessVector * GetAlongStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
void SetProcessOrdering(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt, G4int ordDoIt=ordDefault)
void SetProcessOrderingToSecond(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt)
G4ProcessManager & operator=(const G4ProcessManager &right)
bool G4bool
Definition: G4Types.hh:79
G4int AddProcess(G4VProcess *aProcess, G4int ordAtRestDoIt=ordInActive, G4int ordAlongSteptDoIt=ordInActive, G4int ordPostStepDoIt=ordInActive)
G4int operator==(const G4ProcessManager &right) const
G4ProcessVectorTypeIndex
const XML_Char int const XML_Char * value
Definition: expat.h:331
G4ProcessAttrVector * theAttrVector
G4VProcess * SetProcessActivation(G4VProcess *aProcess, G4bool fActive)
G4int GetAlongStepIndex(G4VProcess *aProcess, G4ProcessVectorTypeIndex typ=typeGPIL) const
void SetProcessOrderingToFirst(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt)
G4ParticleDefinition * GetParticleType() const
G4ProcessVector * theProcessList
G4int InsertAt(G4int position, G4VProcess *process, G4int ivec)
G4int GetPostStepIndex(G4VProcess *aProcess, G4ProcessVectorTypeIndex typ=typeGPIL) const
G4ProcessVector * GetPostStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
G4int GetProcessVectorId(G4ProcessVectorDoItIndex idx, G4ProcessVectorTypeIndex typ=typeGPIL) const
G4int FindInsertPosition(G4int ord, G4int ivec)
G4ProcessAttribute * GetAttribute(G4int index) const
G4bool isSetOrderingFirstInvoked[NDoit]
int G4int
Definition: G4Types.hh:78
G4ProcessVector * GetAtRestProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
G4int AddContinuousProcess(G4VProcess *aProcess, G4int ord=ordDefault)
void StartTracking(G4Track *aTrack=0)
G4ProcessVector * GetProcessVector(G4ProcessVectorDoItIndex idx, G4ProcessVectorTypeIndex typ=typeGPIL) const
G4VProcess * RemoveProcess(G4VProcess *aProcess)
void SetVerboseLevel(G4int value)
std::vector< G4ProcessAttribute * > G4ProcessAttrVector
G4ProcessVector * theProcVector[SizeOfProcVectorArray]
void SetIndexToProcessVector(G4int ivec)
const G4ParticleDefinition * theParticleType
G4int operator!=(const G4ProcessManager &right) const
void CheckOrderingParameters(G4VProcess *) const
G4int GetVerboseLevel() const
G4int GetProcessIndex(G4VProcess *) const
static G4ThreadLocal G4int counterOfObjects