source: trunk/source/processes/management/include/G4VProcess.hh@ 819

Last change on this file since 819 was 819, checked in by garnier, 17 years ago

import all except CVS

File size: 16.5 KB
RevLine 
[819]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: G4VProcess.hh,v 1.24 2007/10/02 08:23:20 kurasige Exp $
28// GEANT4 tag $Name: geant4-09-01-patch-02 $
29//
30//
31// ------------------------------------------------------------
32// GEANT 4 class header file
33//
34// History: first implementation, based on object model of
35// 2nd December 1995, G.Cosmo
36//
37// Class Description
38// This class is the virtual class for physics process objects.
39// It defines public methods which describe the behavior of
40// a physics process.
41//
42// ------------------------------------------------------------
43// New Physics scheme 18 Dec. 1996 H.Kurahige
44// ------------------------------------------------------------
45// change DoIt/GetPIL arguments type 20 Mar. 1997 H.Kurashige
46// modified AlongStepGPIL 17 Dec. 1997 H.Kurashige
47// modified for new ParticleChange 12 Mar. 1998 H.Kurashige
48// Add process trype 27 Mar. 1998 H.Kurashige
49// Remove thePhysicsTable 2 Aug. 1998 H.Kurashige
50// Add PILfactor and GPIL 3 Nov. 2000 H.Kurashige
51// Add Store/RetrievePhysicsTable 8 Nov. 2000 H.Kurashige
52// Modify Store/RetrievePhysicsTable methods 9 Mar. 2001 H.Kurashige
53// Added PreparePhysicsTable 20 Aug. 2004 H.Kurashige
54// Added isXXXXDoItIsEnabled 2 Oct. 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
63class G4ParticleDefinition;
64class G4DynamicParticle;
65class G4Track;
66class 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
75class 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
105 ////////////////////////////
106 // DoIt /////////////////
107 ///////////////////////////
108 virtual G4VParticleChange* PostStepDoIt(
109 const G4Track& track,
110 const G4Step& stepData
111 ) = 0;
112
113 virtual G4VParticleChange* AlongStepDoIt(
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
131 //////////////////////////
132 // GPIL //////////////
133 /////////////////////////
134 virtual G4double AlongStepGetPhysicalInteractionLength(
135 const G4Track& track,
136 G4double previousStepSize,
137 G4double currentMinimumStep,
138 G4double& proposedSafety,
139 G4GPILSelection* selection) = 0;
140
141 virtual G4double AtRestGetPhysicalInteractionLength(
142 const G4Track& track,
143 G4ForceCondition* condition
144 ) = 0;
145
146 virtual G4double PostStepGetPhysicalInteractionLength(
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
178 G4double GetCurrentInteractionLength() const;
179 // Returns currentInteractionLength
180
181 ////////// PIL factor ////////
182 void SetPILfactor(G4double value);
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
204 //////////////////////
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
210 virtual void BuildPhysicsTable(const G4ParticleDefinition&){};
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
217 virtual void PreparePhysicsTable(const G4ParticleDefinition&){};
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
231 virtual G4bool StorePhysicsTable(const G4ParticleDefinition* ,
232 const G4String&,
233 G4bool ascii = false)
234 {ascii=false; return true;}
235 // Store PhysicsTable in a file.
236 // (return false in case of failure at I/O )
237
238 virtual G4bool RetrievePhysicsTable( const G4ParticleDefinition* ,
239 const G4String&,
240 G4bool ascii = false)
241 {ascii=false; return false;}
242 // Retrieve Physics from a file.
243 // (return true if the Physics Table can be build by using file)
244 // (return false if the process has no functionality or in case of failure)
245 // File name should be defined by each process
246 // and the file should be placed under the directory specifed by the argument.
247 const G4String& GetPhysicsTableFileName(const G4ParticleDefinition* ,
248 const G4String& directory,
249 const G4String& tableName,
250 G4bool ascii =false);
251 // this method is utility for Store/RetreivePhysicsTable
252
253 ////////////////////////////
254 const G4String& GetProcessName() const;
255 // Returns the name of the process.
256
257 G4ProcessType GetProcessType() const;
258 // Returns the process type.
259
260 void SetProcessType(G4ProcessType );
261 // Set the process type.
262
263 static const G4String& GetProcessTypeName(G4ProcessType );
264 // Returns the process type name
265
266 virtual void StartTracking(G4Track*);
267 virtual void EndTracking();
268 // inform Start/End of tracking for each track to the physics process
269
270 public:
271 virtual void SetProcessManager(const G4ProcessManager*);
272 // A process manager set its own pointer when the process is registered
273 // the process Manager
274 virtual const G4ProcessManager* GetProcessManager();
275 // Get the process manager which the process belongs to
276
277 protected:
278 const G4ProcessManager* aProcessManager;
279
280 protected:
281 G4VParticleChange* pParticleChange;
282 // The pointer to G4VParticleChange object
283 // which is modified and returned by address by the DoIt() method.
284 // This pointer should be set in each physics process
285 // after construction of derived class object.
286
287 G4ParticleChange aParticleChange;
288 // This object is kept for compatibility with old scheme
289 // This will be removed in future
290
291 G4double theNumberOfInteractionLengthLeft;
292 // The flight length left for the current tracking particle
293 // in unit of "Interaction length".
294
295 G4double currentInteractionLength;
296 // The InteractionLength in the current material
297
298 public: // with description
299 virtual void ResetNumberOfInteractionLengthLeft();
300 // reset (determine the value of)NumberOfInteractionLengthLeft
301
302 protected: // with description
303 virtual void SubtractNumberOfInteractionLengthLeft(
304 G4double previousStepSize
305 );
306 // subtract NumberOfInteractionLengthLeft by the value corresponding to
307 // previousStepSize
308
309 virtual void ClearNumberOfInteractionLengthLeft();
310 // clear NumberOfInteractionLengthLeft
311 // !!! This method should be at the end of PostStepDoIt()
312 // !!! and AtRestDoIt
313
314 public: // with description
315 // These methods indicate which DoIt is enabled
316 // These methods are used by G4ProcessManager to check
317 // that ordering parameters are set properly
318 G4bool isAtRestDoItIsEnabled() const;
319 G4bool isAlongStepDoItIsEnabled() const;
320 G4bool isPostStepDoItIsEnabled() const;
321
322 protected:
323 G4String theProcessName;
324 // The name of the process
325
326 G4String thePhysicsTableFileName;
327
328 G4ProcessType theProcessType;
329 // The type of the process
330
331 G4double thePILfactor;
332 // factor for PhysicsInteractionLength
333 // which is passed to G4SteppingManager
334
335 G4bool enableAtRestDoIt;
336 G4bool enableAlongStepDoIt;
337 G4bool enablePostStepDoIt;
338
339 public: // with description
340 virtual void DumpInfo() const;
341 // dump out process information
342
343 public: // with description
344 void SetVerboseLevel(G4int value);
345 G4int GetVerboseLevel() const;
346 // set/get controle flag for output message
347 // 0: Silent
348 // 1: Warning message
349 // 2: More
350
351
352 protected:
353 G4int verboseLevel;
354 // controle flag for output message
355
356};
357
358// -----------------------------------------
359// inlined function members implementation
360// -----------------------------------------
361#include "Randomize.hh"
362
363inline
364 const G4String& G4VProcess::GetProcessName() const
365{
366 return theProcessName;
367}
368
369inline
370 G4ProcessType G4VProcess::GetProcessType() const
371{
372 return theProcessType;
373}
374
375inline
376 void G4VProcess::SetProcessType(G4ProcessType aType)
377{
378 theProcessType = aType;
379}
380
381inline void G4VProcess::SetVerboseLevel(G4int value)
382{
383 verboseLevel = value;
384}
385
386inline G4int G4VProcess::GetVerboseLevel() const
387{
388 return verboseLevel;
389}
390
391inline void G4VProcess::ResetNumberOfInteractionLengthLeft()
392{
393 theNumberOfInteractionLengthLeft = -std::log( G4UniformRand() );
394}
395
396inline void G4VProcess::ClearNumberOfInteractionLengthLeft()
397{
398 theNumberOfInteractionLengthLeft = -1.0;
399}
400
401inline G4double G4VProcess::GetCurrentInteractionLength() const
402{
403 return currentInteractionLength;
404}
405
406inline void G4VProcess::SetPILfactor(G4double value)
407{
408 if (value>0.) {
409 thePILfactor = value;
410 }
411}
412
413inline G4double G4VProcess::GetPILfactor() const
414{
415 return thePILfactor;
416}
417
418inline G4double G4VProcess::AlongStepGPIL( const G4Track& track,
419 G4double previousStepSize,
420 G4double currentMinimumStep,
421 G4double& proposedSafety,
422 G4GPILSelection* selection )
423{
424 G4double value
425 =AlongStepGetPhysicalInteractionLength(track, previousStepSize, currentMinimumStep, proposedSafety, selection);
426 return value;
427}
428
429inline G4double G4VProcess::AtRestGPIL( const G4Track& track,
430 G4ForceCondition* condition )
431{
432 G4double value
433 =AtRestGetPhysicalInteractionLength(track, condition);
434 return thePILfactor*value;
435}
436
437inline G4double G4VProcess::PostStepGPIL( const G4Track& track,
438 G4double previousStepSize,
439 G4ForceCondition* condition )
440{
441 G4double value
442 =PostStepGetPhysicalInteractionLength(track, previousStepSize, condition);
443 return thePILfactor*value;
444}
445
446inline
447 void G4VProcess::SetProcessManager(const G4ProcessManager* procMan)
448{
449 aProcessManager = procMan;
450}
451
452inline
453 const G4ProcessManager* G4VProcess::GetProcessManager()
454{
455 return aProcessManager;
456}
457
458inline
459 G4bool G4VProcess::isAtRestDoItIsEnabled() const
460{
461 return enableAtRestDoIt;
462}
463
464inline
465 G4bool G4VProcess::isAlongStepDoItIsEnabled() const
466{
467 return enableAlongStepDoIt;
468}
469
470inline
471 G4bool G4VProcess::isPostStepDoItIsEnabled() const
472{
473 return enablePostStepDoIt;
474}
475
476#endif
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
Note: See TracBrowser for help on using the repository browser.