Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4VProcess.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$
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 //
36 // Class Description
37 // This class is the virtual class for physics process objects.
38 // It defines public methods which describe the behavior of
39 // a physics process.
40 //
41 // ------------------------------------------------------------
42 // New Physics scheme 18 Dec. 1996 H.Kurahige
43 // ------------------------------------------------------------
44 // change DoIt/GetPIL arguments type 20 Mar. 1997 H.Kurashige
45 // modified AlongStepGPIL 17 Dec. 1997 H.Kurashige
46 // modified for new ParticleChange 12 Mar. 1998 H.Kurashige
47 // Add process trype 27 Mar. 1998 H.Kurashige
48 // Remove thePhysicsTable 2 Aug. 1998 H.Kurashige
49 // Add PILfactor and GPIL 3 Nov. 2000 H.Kurashige
50 // Add Store/RetrievePhysicsTable 8 Nov. 2000 H.Kurashige
51 // Modify Store/RetrievePhysicsTable methods 9 Mar. 2001 H.Kurashige
52 // Added PreparePhysicsTable 20 Aug. 2004 H.Kurashige
53 // Added isXXXXDoItIsEnabled 2 Oct. 2007 H.Kurashige
54 // Added ProcessSubType 15 Nov. 2007 H.Kurashige
55 
56 #ifndef G4VProcess_h
57 #define G4VProcess_h 1
58 
59 #include "globals.hh"
60 #include <cmath>
61 #include "G4ios.hh"
62 
64 class G4DynamicParticle;
65 class G4Track;
66 class G4Step;
67 
68 #include "G4PhysicsTable.hh"
69 #include "G4VParticleChange.hh"
70 #include "G4ForceCondition.hh"
71 #include "G4GPILSelection.hh"
72 #include "G4ParticleChange.hh"
73 #include "G4ProcessType.hh"
74 
75 class G4VProcess
76 {
77  // A virtual class for physics process objects. It defines
78  // public methods which describe the behavior of a
79  // physics process.
80 
81  private:
82  // hide default constructor and assignment operator as private
83  // do not hide default constructor for alpha version
84  // G4VProcess G4VProcess();
85  G4VProcess & operator=(const G4VProcess &right);
86 
87  public: // with description
88  // constructor requires the process name and type
89  G4VProcess(const G4String& aName = "NoName",
90  G4ProcessType aType = fNotDefined );
91 
92  // copy constructor copys the name but does not copy the
93  // physics table (0 pointer is assigned)
94  G4VProcess(const G4VProcess &right);
95 
96  public:
97  // destructor
98  virtual ~G4VProcess();
99 
100  // equal opperators
101  G4int operator==(const G4VProcess &right) const;
102  G4int operator!=(const G4VProcess &right) const;
103 
104  public: // with description
106  // DoIt /////////////////
109  const G4Track& track,
110  const G4Step& stepData
111  ) = 0;
112 
114  const G4Track& track,
115  const G4Step& stepData
116  ) = 0;
117  virtual G4VParticleChange* AtRestDoIt(
118  const G4Track& track,
119  const G4Step& stepData
120  ) = 0;
121  // A virtual base class function that has to be overridden
122  // by any subclass. The DoIt method actually performs the
123  // physics process and determines either momentum change
124  // of the production of secondaries etc.
125  // arguments
126  // const G4Track& track:
127  // reference to the current G4Track information
128  // const G4Step& stepData:
129  // reference to the current G4Step information
130 
132  // GPIL //////////////
135  const G4Track& track,
136  G4double previousStepSize,
137  G4double currentMinimumStep,
138  G4double& proposedSafety,
139  G4GPILSelection* selection) = 0;
140 
142  const G4Track& track,
144  ) = 0;
145 
147  const G4Track& track,
148  G4double previousStepSize,
149  G4ForceCondition* condition
150  ) = 0;
151 
152  // Returns the Step-size (actual length) which is allowed
153  // by "this" process. (for AtRestGetPhysicalInteractionLength,
154  // return value is Step-time) The NumberOfInteractionLengthLeft is
155  // recalculated by using previousStepSize and the Step-size is
156  // calucalted accoding to the resultant NumberOfInteractionLengthLeft.
157  // using NumberOfInteractionLengthLeft, which is recalculated at
158  // arguments
159  // const G4Track& track:
160  // reference to the current G4Track information
161  // G4double* previousStepSize:
162  // the Step-size (actual length) of the previous Step
163  // of this track. Negative calue indicates that
164  // NumberOfInteractionLengthLeft must be reset.
165  // the current physical interaction legth of this process
166  // G4ForceCondition* condition:
167  // the flag indicates DoIt of this process is forced
168  // to be called
169  // Forced: Corresponding DoIt is forced
170  // NotForced: Corresponding DoIt is called
171  // if the Step size of this Step is determined
172  // by this process
173  // !! AlongStepDoIt is always called !!
174  // G4double& currentMinimumStep:
175  // this value is used for transformation of
176  // true path length to geometrical path length
177 
179  // Returns currentInteractionLength
180 
183  G4double GetPILfactor() const;
184  // Set/Get factor for PhysicsInteractionLength
185  // which is passed to G4SteppingManager for both AtRest and PostStep
186 
187  // These three GPIL methods are used by Stepping Manager.
188  // They invoke virtual GPIL methods listed above.
189  // As for AtRest and PostStep the returned value is multipled by thePILfactor
190  //
191  G4double AlongStepGPIL( const G4Track& track,
192  G4double previousStepSize,
193  G4double currentMinimumStep,
194  G4double& proposedSafety,
195  G4GPILSelection* selection );
196 
197  G4double AtRestGPIL( const G4Track& track,
198  G4ForceCondition* condition );
199 
200  G4double PostStepGPIL( const G4Track& track,
201  G4double previousStepSize,
202  G4ForceCondition* condition );
203 
205  virtual G4bool IsApplicable(const G4ParticleDefinition&){return true;}
206  // Returns true if this process object is applicable to
207  // the particle type
208  // Process will not be registered to a particle if IsApplicable is false
209 
211  // Messaged by the Particle definition (via the Process manager)
212  // whenever cross section tables have to be rebuilt (i.e. if new
213  // materials have been defined).
214  // It is overloaded by individual processes when they need physics
215  // tables.
216 
218  // Messaged by the Particle definition (via the Process manager)
219  // whenever cross section tables have to be prepare for rebuilt
220  // (i.e. if new materials have been defined).
221  // It is overloaded by individual processes when they need physics
222  // tables.
223 
224  // Processes which Build physics tables independent of cuts
225  // (for example in their constructors)
226  // should preferably use private
227  // void BuildThePhysicsTable() and void PreparePhysicsTable().
228  // Not another BuildPhysicsTable, please.
229 
230 
232  const G4String&, G4bool){return true;}
233  // Store PhysicsTable in a file.
234  // (return false in case of failure at I/O )
235 
237  const G4String&, G4bool){return false;}
238  // Retrieve Physics from a file.
239  // (return true if the Physics Table can be build by using file)
240  // (return false if the process has no functionality or in case of failure)
241  // File name should be defined by each process
242  // and the file should be placed under the directory specifed by the argument.
244  const G4String& directory,
245  const G4String& tableName,
246  G4bool ascii =false);
247  // this method is utility for Store/RetreivePhysicsTable
248 
250  const G4String& GetProcessName() const;
251  // Returns the name of the process.
252 
254  // Returns the process type.
255 
257  // Set the process type.
258 
259  G4int GetProcessSubType() const;
260  // Returns the process sub type.
261 
262  void SetProcessSubType(G4int );
263  // Set the process sub type.
264 
265  static const G4String& GetProcessTypeName(G4ProcessType );
266  // Returns the process type name
267 
268  virtual void StartTracking(G4Track*);
269  virtual void EndTracking();
270  // inform Start/End of tracking for each track to the physics process
271 
272  public:
273  virtual void SetProcessManager(const G4ProcessManager*);
274  // A process manager set its own pointer when the process is registered
275  // the process Manager
276  virtual const G4ProcessManager* GetProcessManager();
277  // Get the process manager which the process belongs to
278 
279  protected:
281 
282  protected:
284  // The pointer to G4VParticleChange object
285  // which is modified and returned by address by the DoIt() method.
286  // This pointer should be set in each physics process
287  // after construction of derived class object.
288 
290  // This object is kept for compatibility with old scheme
291  // This will be removed in future
292 
294  // The flight length left for the current tracking particle
295  // in unit of "Interaction length".
296 
298  // The InteractionLength in the current material
299 
301  // The initial value when ResetNumberOfInteractionLengthLeft is invoked
302 
303  public: // with description
304  virtual void ResetNumberOfInteractionLengthLeft();
305  // reset (determine the value of)NumberOfInteractionLengthLeft
306 
308  // get NumberOfInteractionLengthLeft
309 
311  // get NumberOfInteractionLength
312  // after ResetNumberOfInteractionLengthLeft is invoked
313 
314  protected: // with description
316  G4double previousStepSize
317  );
318  // subtract NumberOfInteractionLengthLeft by the value corresponding to
319  // previousStepSize
320 
322  // clear NumberOfInteractionLengthLeft
323  // !!! This method should be at the end of PostStepDoIt()
324  // !!! and AtRestDoIt
325 
326  public: // with description
327  // These methods indicate which DoIt is enabled
328  // These methods are used by G4ProcessManager to check
329  // that ordering parameters are set properly
333 
334  protected:
336  // The name of the process
337 
339 
341  // The type of the process
342 
344  // The sub type of the process
345 
347  // factor for PhysicsInteractionLength
348  // which is passed to G4SteppingManager
349 
353 
354  public: // with description
355  virtual void DumpInfo() const;
356  // dump out process information
357 
358  public: // with description
359  void SetVerboseLevel(G4int value);
360  G4int GetVerboseLevel() const;
361  // set/get controle flag for output message
362  // 0: Silent
363  // 1: Warning message
364  // 2: More
365 
366 
367  protected:
369  // controle flag for output message
370 
371 };
372 
373 // -----------------------------------------
374 // inlined function members implementation
375 // -----------------------------------------
376 #include "Randomize.hh"
377 
378 inline
380 {
381  return theProcessName;
382 }
383 
384 inline
386 {
387  return theProcessType;
388 }
389 
390 inline
392 {
393  theProcessType = aType;
394 }
395 
396 inline
398 {
399  return theProcessSubType;
400 }
401 
402 inline
404 {
406 }
407 
409 {
411 }
412 
414 {
415  return verboseLevel;
416 }
417 
419 {
422 }
423 
425 {
427 }
428 
430 {
432 
434 {
436 }
437 
439 {
440  if (value>0.) {
442  }
443 }
444 
446 {
447  return thePILfactor;
448 }
449 
451  G4double previousStepSize,
452  G4double currentMinimumStep,
453  G4double& proposedSafety,
454  G4GPILSelection* selection )
455 {
457  =AlongStepGetPhysicalInteractionLength(track, previousStepSize, currentMinimumStep, proposedSafety, selection);
458  return value;
459 }
460 
463 {
465  =AtRestGetPhysicalInteractionLength(track, condition);
466  return thePILfactor*value;
467 }
468 
470  G4double previousStepSize,
472 {
474  =PostStepGetPhysicalInteractionLength(track, previousStepSize, condition);
475  return thePILfactor*value;
476 }
477 
478 inline
480 {
481  aProcessManager = procMan;
482 }
483 
484 inline
486 {
487  return aProcessManager;
488 }
489 
490 inline
492 {
493  return enableAtRestDoIt;
494 }
495 
496 inline
498 {
499  return enableAlongStepDoIt;
500 }
501 
502 inline
504 {
505  return enablePostStepDoIt;
506 }
507 
508 #endif