Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/management/include/G4VProcess.hh

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/management/include/G4VProcess.hh (Version 11.3.0) and /processes/management/include/G4VProcess.hh (Version 11.1.3)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 // G4VProcess                                      26 // G4VProcess
 27 //                                                 27 //
 28 // Class description:                              28 // Class description:
 29 //                                                 29 //
 30 // This class is the virtual class for physics     30 // This class is the virtual class for physics process objects. 
 31 // It defines public methods which describe th     31 // It defines public methods which describe the behavior of 
 32 // a physics process.                              32 // a physics process.
 33                                                    33 
 34 // Authors:                                        34 // Authors:
 35 // - 2 December 1995, G.Cosmo - First implemen     35 // - 2 December 1995, G.Cosmo - First implementation, based on object model
 36 // - 18 December 1996, H.Kurashige - New Physi     36 // - 18 December 1996, H.Kurashige - New Physics scheme
 37 // -------------------------------------------     37 // --------------------------------------------------------------------
 38 #ifndef G4VProcess_hh                              38 #ifndef G4VProcess_hh 
 39 #define G4VProcess_hh 1                            39 #define G4VProcess_hh 1
 40                                                    40 
 41 #include <cmath>                                   41 #include <cmath>
 42                                                    42 
 43 #include "globals.hh"                              43 #include "globals.hh"
 44 #include "G4ios.hh"                                44 #include "G4ios.hh"
 45 #include "Randomize.hh"                            45 #include "Randomize.hh"              
 46                                                    46 
 47 #include "G4PhysicsTable.hh"                       47 #include "G4PhysicsTable.hh"
 48 #include "G4VParticleChange.hh"                    48 #include "G4VParticleChange.hh"
 49 #include "G4ForceCondition.hh"                     49 #include "G4ForceCondition.hh"
 50 #include "G4GPILSelection.hh"                      50 #include "G4GPILSelection.hh"
 51 #include "G4ParticleChange.hh"                     51 #include "G4ParticleChange.hh"
 52 #include "G4ProcessType.hh"                        52 #include "G4ProcessType.hh"
 53                                                    53 
 54 class G4ParticleDefinition;                        54 class G4ParticleDefinition;
 55 class G4DynamicParticle;                           55 class G4DynamicParticle;
 56 class G4Track;                                     56 class G4Track;
 57 class G4Step;                                      57 class G4Step;
 58 class G4ProcessTable;                              58 class G4ProcessTable;
 59                                                    59 
 60 class G4VProcess                                   60 class G4VProcess 
 61 {                                                  61 {
 62                                                    62 
 63   public:                                          63   public:
 64                                                    64 
 65     G4VProcess(const G4String& aName = "NoName     65     G4VProcess(const G4String& aName = "NoName",
 66                G4ProcessType aType = fNotDefin     66                G4ProcessType aType = fNotDefined);
 67       // Constructor requires the process name     67       // Constructor requires the process name and type
 68                                                    68 
 69     G4VProcess(const G4VProcess& right);           69     G4VProcess(const G4VProcess& right);
 70       // Copy constructor copies the name but      70       // Copy constructor copies the name but does not copy the 
 71       // physics table (null pointer is assign     71       // physics table (null pointer is assigned instead)
 72                                                    72 
 73     virtual ~G4VProcess();                         73     virtual ~G4VProcess();
 74       // Destructor                                74       // Destructor 
 75                                                    75 
 76     G4VProcess& operator=(const G4VProcess&) =     76     G4VProcess& operator=(const G4VProcess&) = delete;
 77                                                    77 
 78     G4bool operator==(const G4VProcess& right)     78     G4bool operator==(const G4VProcess& right) const;
 79     G4bool operator!=(const G4VProcess& right)     79     G4bool operator!=(const G4VProcess& right) const;
 80       // Equality operators                        80       // Equality operators
 81                                                    81 
 82     ////////////////////////////                   82     ////////////////////////////
 83     // DoIt    /////////////////                   83     // DoIt    /////////////////
 84     ////////////////////////////                   84     ////////////////////////////
 85                                                    85 
 86     virtual G4VParticleChange* PostStepDoIt(       86     virtual G4VParticleChange* PostStepDoIt(
 87                              const G4Track& tr     87                              const G4Track& track,
 88                              const G4Step& ste     88                              const G4Step& stepData
 89                             ) = 0;                 89                             ) = 0;
 90                                                    90 
 91     virtual G4VParticleChange* AlongStepDoIt(      91     virtual G4VParticleChange* AlongStepDoIt(
 92                              const G4Track& tr     92                              const G4Track& track,
 93                              const G4Step& ste     93                              const G4Step& stepData
 94                             ) = 0;                 94                             ) = 0;
 95     virtual G4VParticleChange* AtRestDoIt(         95     virtual G4VParticleChange* AtRestDoIt(
 96                              const G4Track& tr     96                              const G4Track& track,
 97                              const G4Step& ste     97                              const G4Step& stepData
 98                             ) = 0;                 98                             ) = 0;
 99       // A virtual base class function that ha     99       // A virtual base class function that has to be overridden
100       // by any subclass. The DoIt() method ac    100       // by any subclass. The DoIt() method actually performs the
101       // physics process and determines either    101       // physics process and determines either momentum change
102       // of the production of secondaries etc.    102       // of the production of secondaries etc.
103       //    Arguments                             103       //    Arguments
104       //      const G4Track& track:               104       //      const G4Track& track:
105       //        reference to the current G4Tra    105       //        reference to the current G4Track information
106       //      const G4Step&  stepData:            106       //      const G4Step&  stepData:
107       //        reference to the current G4Ste    107       //        reference to the current G4Step information
108                                                   108 
109     //////////////////////////                    109     //////////////////////////
110     // GPIL    ///////////////                    110     // GPIL    ///////////////
111     //////////////////////////                    111     //////////////////////////
112                                                   112 
113     virtual G4double AlongStepGetPhysicalInter    113     virtual G4double AlongStepGetPhysicalInteractionLength(
114                              const G4Track& tr    114                              const G4Track& track,
115                              G4double previous    115                              G4double previousStepSize,
116                              G4double currentM    116                              G4double currentMinimumStep,
117                              G4double& propose    117                              G4double& proposedSafety,
118                              G4GPILSelection*     118                              G4GPILSelection* selection) = 0;
119                                                   119 
120     virtual G4double AtRestGetPhysicalInteract    120     virtual G4double AtRestGetPhysicalInteractionLength(
121                              const G4Track& tr    121                              const G4Track& track,
122                              G4ForceCondition*    122                              G4ForceCondition* condition ) = 0;
123                                                   123 
124     virtual G4double PostStepGetPhysicalIntera    124     virtual G4double PostStepGetPhysicalInteractionLength(
125                              const G4Track& tr    125                              const G4Track& track,
126                              G4double previous    126                              G4double previousStepSize,
127                              G4ForceCondition*    127                              G4ForceCondition* condition ) = 0;
128       //  Returns the Step-size (actual length    128       //  Returns the Step-size (actual length) which is allowed 
129       //  by "this" process. (for AtRestGetPhy    129       //  by "this" process. (for AtRestGetPhysicalInteractionLength,
130       //  return value is Step-time) The Numbe    130       //  return value is Step-time) The NumberOfInteractionLengthLeft is
131       //  recalculated by using previousStepSi    131       //  recalculated by using previousStepSize and the Step-size is 
132       //  calucalted accoding to the resultant    132       //  calucalted accoding to the resultant NumberOfInteractionLengthLeft.
133       //  using NumberOfInteractionLengthLeft,    133       //  using NumberOfInteractionLengthLeft, which is recalculated at 
134       //    arguments                             134       //    arguments
135       //      const G4Track&    track:            135       //      const G4Track&    track:
136       //        reference to the current G4Tra    136       //        reference to the current G4Track information
137       //      G4double*          previousStepS    137       //      G4double*          previousStepSize: 
138       //        the Step-size (actual length)     138       //        the Step-size (actual length) of the previous Step 
139       //        of this track. Negative calue     139       //        of this track. Negative calue indicates that
140       //        NumberOfInteractionLengthLeft     140       //        NumberOfInteractionLengthLeft must be reset.
141       //        the current physical interacti    141       //        the current physical interaction legth of this process
142       //      G4ForceCondition* condition:        142       //      G4ForceCondition* condition:
143       //        the flag indicates DoIt of thi    143       //        the flag indicates DoIt of this process is forced 
144       //        to be called                      144       //        to be called
145       //         Forced:    Corresponding DoIt    145       //         Forced:    Corresponding DoIt is forced
146       //         NotForced: Corresponding DoIt    146       //         NotForced: Corresponding DoIt is called 
147       //                    if the Step size o    147       //                    if the Step size of this Step is determined 
148       //                    by this process       148       //                    by this process
149       //        !! AlongStepDoIt is always cal    149       //        !! AlongStepDoIt is always called !! 
150       //      G4double& currentMinimumStep:       150       //      G4double& currentMinimumStep:
151       //        this value is used for transfo    151       //        this value is used for transformation of
152       //        true path length to geometrica    152       //        true path length to geometrical path length
153                                                   153 
154     inline G4double GetCurrentInteractionLengt    154     inline G4double GetCurrentInteractionLength() const;
155       // Returns currentInteractionLength         155       // Returns currentInteractionLength
156                                                   156 
157     ////////// PIL factor ////////                157     ////////// PIL factor ////////
158     //                                            158     //
159     inline void SetPILfactor(G4double value);     159     inline void SetPILfactor(G4double value);
160     inline G4double GetPILfactor() const;         160     inline G4double GetPILfactor() const;
161       // Set/Get factor for PhysicsInteraction    161       // Set/Get factor for PhysicsInteractionLength 
162       // which is passed to G4SteppingManager     162       // which is passed to G4SteppingManager for both AtRest and PostStep
163                                                   163 
164     // These three GPIL methods are used by St    164     // These three GPIL methods are used by Stepping Manager.
165     // They invoke virtual GPIL methods listed    165     // They invoke virtual GPIL methods listed above.
166     // As for AtRest and PostStep the returned    166     // As for AtRest and PostStep the returned value is multipled by
167     // thePILfactor                               167     // thePILfactor 
168     //                                            168     // 
169     inline G4double AlongStepGPIL( const G4Tra    169     inline G4double AlongStepGPIL( const G4Track& track,
170                                    G4double pr    170                                    G4double previousStepSize,
171                                    G4double cu    171                                    G4double currentMinimumStep,
172                                    G4double& p    172                                    G4double& proposedSafety,
173                                    G4GPILSelec    173                                    G4GPILSelection* selection );
174                                                   174 
175     inline G4double AtRestGPIL( const G4Track&    175     inline G4double AtRestGPIL( const G4Track& track,
176                                 G4ForceConditi    176                                 G4ForceCondition* condition );
177                                                   177 
178     inline G4double PostStepGPIL( const G4Trac    178     inline G4double PostStepGPIL( const G4Track& track,
179                                   G4double pre    179                                   G4double previousStepSize,
180                                   G4ForceCondi    180                                   G4ForceCondition* condition );
181                                                   181 
182     virtual G4bool IsApplicable(const G4Partic    182     virtual G4bool IsApplicable(const G4ParticleDefinition&) { return true; }
183       // Returns true if this process object i    183       // Returns true if this process object is applicable to
184       // the particle type. Process will not b    184       // the particle type. Process will not be registered to a
185       // particle if IsApplicable is false        185       // particle if IsApplicable is false   
186                                                   186 
187     virtual void BuildPhysicsTable(const G4Par    187     virtual void BuildPhysicsTable(const G4ParticleDefinition&) {}
188       // Messaged by the Particle definition (    188       // Messaged by the Particle definition (via the Process manager)
189       // whenever cross-section tables have to    189       // whenever cross-section tables have to be rebuilt (i.e. if new
190       // materials have been defined).            190       // materials have been defined). 
191       // It is overloaded by individual proces    191       // It is overloaded by individual processes when they need physics
192       // tables                                   192       // tables
193                                                   193 
194     virtual void PreparePhysicsTable(const G4P    194     virtual void PreparePhysicsTable(const G4ParticleDefinition&) {}
195       // Messaged by the Particle definition (    195       // Messaged by the Particle definition (via the Process manager)
196       // whenever cross-section tables have to    196       // whenever cross-section tables have to be prepared for rebuild
197       // (i.e. if new materials have been defi    197       // (i.e. if new materials have been defined). 
198       // It is overloaded by individual proces    198       // It is overloaded by individual processes when they need physics
199       // tables                                   199       // tables
200                                                   200 
201     // Processes which Build physics tables in    201     // Processes which Build physics tables independent of cuts
202     // (for example in their constructors) sho    202     // (for example in their constructors) should preferably use private 
203     // void BuildThePhysicsTable() and void Pr    203     // void BuildThePhysicsTable() and void PreparePhysicsTable().
204     // *Not* another BuildPhysicsTable            204     // *Not* another BuildPhysicsTable
205                                                   205 
206     virtual G4bool StorePhysicsTable(const G4P    206     virtual G4bool StorePhysicsTable(const G4ParticleDefinition* ,
207                                      const G4S    207                                      const G4String&, G4bool) { return true; }
208       // Store PhysicsTable in a file.            208       // Store PhysicsTable in a file.
209       // Return false in case of failure at I/    209       // Return false in case of failure at I/O
210                                                   210 
211     virtual G4bool RetrievePhysicsTable(const     211     virtual G4bool RetrievePhysicsTable(const G4ParticleDefinition* ,
212                                       const G4    212                                       const G4String&, G4bool) { return false; }
213       // Retrieve Physics from a file.            213       // Retrieve Physics from a file.
214       // Return true if the Physics Table can     214       // Return true if the Physics Table can be built by using file.
215       // Return false if the process has no fu    215       // Return false if the process has no functionality or in case
216       // of failure. File name should be defin    216       // of failure. File name should be defined by each process and the
217       // file should be placed under the direc    217       // file should be placed under the directory specified by the argument
218                                                   218 
219     const G4String& GetPhysicsTableFileName(co    219     const G4String& GetPhysicsTableFileName(const G4ParticleDefinition* ,
220                                             co    220                                             const G4String& directory,
221                                             co    221                                             const G4String& tableName,
222                                             G4    222                                             G4bool ascii = false);
223       // This method is utility for Store/Retr    223       // This method is utility for Store/RetreivePhysicsTable
224                                                   224 
225     inline const G4String& GetProcessName() co    225     inline const G4String& GetProcessName() const;
226       // Returns the name of the process          226       // Returns the name of the process
227                                                   227 
228     inline G4ProcessType GetProcessType() cons    228     inline G4ProcessType GetProcessType() const;
229       // Returns the process type                 229       // Returns the process type
230                                                   230 
231     inline void SetProcessType(G4ProcessType);    231     inline void SetProcessType(G4ProcessType);
232       // Sets the process type                    232       // Sets the process type
233                                                   233 
234     inline G4int GetProcessSubType() const;       234     inline G4int GetProcessSubType() const;
235       // Returns the process sub type             235       // Returns the process sub type
236                                                   236 
237     inline void SetProcessSubType(G4int);         237     inline void SetProcessSubType(G4int);
238       // Sets the process sub type                238       // Sets the process sub type
239                                                   239 
240     static const G4String& GetProcessTypeName(    240     static const G4String& GetProcessTypeName(G4ProcessType);
241       // Returns the process type name            241       // Returns the process type name
242                                                   242 
243     virtual const G4VProcess* GetCreatorProces    243     virtual const G4VProcess* GetCreatorProcess() const;
244       // Returns the process to be used as Cre    244       // Returns the process to be used as CreatorProcess for secondaries
245       // coming from this process                 245       // coming from this process
246                                                   246 
247     virtual void StartTracking(G4Track*);         247     virtual void StartTracking(G4Track*);
248     virtual void EndTracking();                   248     virtual void EndTracking();
249       // Inform Start/End of tracking for each    249       // Inform Start/End of tracking for each track to the physics process 
250                                                   250 
251     virtual void SetProcessManager(const G4Pro    251     virtual void SetProcessManager(const G4ProcessManager*); 
252       // A process manager sets its own pointe    252       // A process manager sets its own pointer when the process
253       // is registered in the process Manager     253       // is registered in the process Manager
254     virtual const G4ProcessManager* GetProcess    254     virtual const G4ProcessManager* GetProcessManager(); 
255       // Get the process manager which the pro    255       // Get the process manager which the process belongs to
256                                                   256   
257     virtual void ResetNumberOfInteractionLengt    257     virtual void ResetNumberOfInteractionLengthLeft();
258       // Reset (determine the value of) Number    258       // Reset (determine the value of) NumberOfInteractionLengthLeft
259                                                   259 
260     inline G4double GetNumberOfInteractionLeng    260     inline G4double GetNumberOfInteractionLengthLeft() const;
261       // Get NumberOfInteractionLengthLeft        261       // Get NumberOfInteractionLengthLeft
262                                                   262 
263     inline G4double GetTotalNumberOfInteractio    263     inline G4double GetTotalNumberOfInteractionLengthTraversed() const;
264       // Get NumberOfInteractionLength after      264       // Get NumberOfInteractionLength after
265       //  ResetNumberOfInteractionLengthLeft()    265       //  ResetNumberOfInteractionLengthLeft() is invoked
266                                                   266 
267     inline G4bool isAtRestDoItIsEnabled() cons    267     inline G4bool isAtRestDoItIsEnabled() const;
268     inline G4bool isAlongStepDoItIsEnabled() c    268     inline G4bool isAlongStepDoItIsEnabled() const;
269     inline G4bool isPostStepDoItIsEnabled() co    269     inline G4bool isPostStepDoItIsEnabled() const;
270       // These methods indicate which DoIt is     270       // These methods indicate which DoIt is enabled.
271       // They are used by G4ProcessManager to     271       // They are used by G4ProcessManager to check
272       // that ordering parameters are properly    272       // that ordering parameters are properly set
273                                                   273   
274     virtual void  DumpInfo() const;               274     virtual void  DumpInfo() const;
275       // Dump out process information             275       // Dump out process information    
276                                                   276 
277     virtual void ProcessDescription(std::ostre    277     virtual void ProcessDescription(std::ostream& outfile) const;
278       // Write out to html file for automatic     278       // Write out to html file for automatic documentation
279                                                   279 
280     inline void  SetVerboseLevel(G4int value);    280     inline void  SetVerboseLevel(G4int value);
281     inline G4int GetVerboseLevel() const;         281     inline G4int GetVerboseLevel() const;
282       // set/get control flag for output messa    282       // set/get control flag for output message
283       //  0: Silent                               283       //  0: Silent
284       //  1: Warning message                      284       //  1: Warning message
285       //  2: More                                 285       //  2: More
286                                                   286 
287     virtual void SetMasterProcess(G4VProcess*     287     virtual void SetMasterProcess(G4VProcess* masterP);
288       // Sets the master thread process instan    288       // Sets the master thread process instance
289     inline const G4VProcess* GetMasterProcess(    289     inline const G4VProcess* GetMasterProcess() const;
290       // Returns the master thread process ins    290       // Returns the master thread process instance.
291       // Can be used to initialise worker type    291       // Can be used to initialise worker type processes
292       // instances from master one (e.g. to sh    292       // instances from master one (e.g. to share a read-only table)
293       // if ( this != GetMasterProcess() ) { /    293       // if ( this != GetMasterProcess() ) { /*worker*/ }
294       // else { /* master or sequential */ }      294       // else { /* master or sequential */ }
295                                                   295 
296     virtual void BuildWorkerPhysicsTable(const    296     virtual void BuildWorkerPhysicsTable(const G4ParticleDefinition& part);
297       // Messaged by the Particle definition (    297       // Messaged by the Particle definition (via the Process manager)
298       // in worker threads. See BuildWorkerPhy    298       // in worker threads. See BuildWorkerPhyiscsTable() method.
299       // Can be used to share among threads ph    299       // Can be used to share among threads physics tables.
300       // Use GetMasterProcess() to get pointer    300       // Use GetMasterProcess() to get pointer of master process from
301       // worker thread.                           301       // worker thread.
302       // By default this method makes a forwar    302       // By default this method makes a forward call to BuildPhysicsTable()
303                                                   303     
304     virtual void PrepareWorkerPhysicsTable(con    304     virtual void PrepareWorkerPhysicsTable(const G4ParticleDefinition&);
305       // Messaged by the Particle definition (    305       // Messaged by the Particle definition (via the Process manager)
306       // in worker threads. See Preparephysics    306       // in worker threads. See PreparephysicsTable().
307       // Can be used to share among threads ph    307       // Can be used to share among threads physics tables.
308       // Use GetMasterProcess() to get pointer    308       // Use GetMasterProcess() to get pointer of master process from
309       // worker thread                            309       // worker thread
310       // By default this method makes a forwar    310       // By default this method makes a forward call to PreparePhysicsTable()
311                                                   311 
312   protected:                                      312   protected:
313                                                   313 
314     inline void SubtractNumberOfInteractionLen    314     inline void SubtractNumberOfInteractionLengthLeft(G4double prevStepSize);
315       // Subtract NumberOfInteractionLengthLef    315       // Subtract NumberOfInteractionLengthLeft by the value corresponding
316       // to previousStepSize                      316       // to previousStepSize      
317                                                   317  
318     inline void ClearNumberOfInteractionLength    318     inline void ClearNumberOfInteractionLengthLeft();
319       // This method should be at the end of P    319       // This method should be at the end of PostStepDoIt() and AtRestDoIt()!
320                                                   320 
321   protected:                                      321   protected:
322                                                   322 
323     const G4ProcessManager* aProcessManager =     323     const G4ProcessManager* aProcessManager = nullptr; 
324                                                   324  
325     G4VParticleChange* pParticleChange = nullp    325     G4VParticleChange* pParticleChange = nullptr;
326       // The pointer to G4VParticleChange obje    326       // The pointer to G4VParticleChange object 
327       // which is modified and returned by add    327       // which is modified and returned by address by the DoIt() method.
328       // This pointer should be set in each ph    328       // This pointer should be set in each physics process
329       // after construction of derived class o    329       // after construction of derived class object
330                                                   330 
331     G4ParticleChange aParticleChange;             331     G4ParticleChange aParticleChange;
332       // This object is kept for compatibility    332       // This object is kept for compatibility with old scheme.
333       // May be removed in future                 333       // May be removed in future
334                                                   334 
335     G4double theNumberOfInteractionLengthLeft     335     G4double theNumberOfInteractionLengthLeft = -1.0;
336       // The flight length left for the curren    336       // The flight length left for the current tracking particle
337       // in unit of "Interaction length"          337       // in unit of "Interaction length"
338                                                   338 
339     G4double currentInteractionLength = -1.0;     339     G4double currentInteractionLength = -1.0;
340       // The InteractionLength in the current     340       // The InteractionLength in the current material
341                                                   341 
342     G4double theInitialNumberOfInteractionLeng    342     G4double theInitialNumberOfInteractionLength = -1.0;
343       // The initial value when ResetNumberOfI    343       // The initial value when ResetNumberOfInteractionLengthLeft() is invoked
344                                                   344 
345     G4String theProcessName;                      345     G4String theProcessName;
346       // The name of the process                  346       // The name of the process
347                                                   347 
348     G4String thePhysicsTableFileName;             348     G4String thePhysicsTableFileName;
349                                                   349 
350     G4ProcessType theProcessType = fNotDefined    350     G4ProcessType theProcessType = fNotDefined;
351       // The type of the process                  351       // The type of the process
352                                                   352 
353     G4int theProcessSubType = -1;                 353     G4int theProcessSubType = -1;
354       // The sub type of the process              354       // The sub type of the process
355                                                   355 
356     G4double thePILfactor = 1.0;                  356     G4double thePILfactor = 1.0;
357       // Factor for PhysicsInteractionLength      357       // Factor for PhysicsInteractionLength
358       // which is passed to G4SteppingManager     358       // which is passed to G4SteppingManager
359                                                   359  
360     G4int verboseLevel = 0;                       360     G4int verboseLevel = 0;
361       // Controle flag for output message         361       // Controle flag for output message
362                                                   362 
363     G4bool enableAtRestDoIt = true;               363     G4bool enableAtRestDoIt = true;
364     G4bool enableAlongStepDoIt = true;            364     G4bool enableAlongStepDoIt = true;
365     G4bool enablePostStepDoIt = true;             365     G4bool enablePostStepDoIt = true;
366                                                   366 
367   private:                                        367   private:
368                                                   368  
369     G4VProcess();                                 369     G4VProcess();  
370       // Hidden default constructor               370       // Hidden default constructor
371                                                   371 
372   private:                                        372   private:
373                                                   373 
374     G4VProcess* masterProcessShadow = nullptr;    374     G4VProcess* masterProcessShadow = nullptr;
375       // For multi-threaded: pointer to the in    375       // For multi-threaded: pointer to the instance of this process
376       // for the master thread                    376       // for the master thread
377                                                   377 
378     G4ProcessTable* fProcessTable = nullptr;      378     G4ProcessTable* fProcessTable = nullptr;
379 };                                                379 };
380                                                   380 
381 // -----------------------------------------      381 // -----------------------------------------
382 //  inlined function members implementation       382 //  inlined function members implementation
383 // -----------------------------------------      383 // -----------------------------------------
384                                                   384 
385 inline                                            385 inline 
386 const G4String& G4VProcess::GetProcessName() c    386 const G4String& G4VProcess::GetProcessName() const
387 {                                                 387 {
388   return theProcessName;                          388   return theProcessName;
389 }                                                 389 }
390                                                   390 
391 inline                                            391 inline      
392 G4ProcessType G4VProcess::GetProcessType() con    392 G4ProcessType G4VProcess::GetProcessType() const
393 {                                                 393 {
394   return theProcessType;                          394   return theProcessType;
395 }                                                 395 }
396                                                   396 
397 inline                                            397 inline
398 void G4VProcess::SetProcessType(G4ProcessType     398 void G4VProcess::SetProcessType(G4ProcessType aType)
399 {                                                 399 {
400   theProcessType = aType;                         400   theProcessType = aType;
401 }                                                 401 }
402                                                   402 
403 inline                                            403 inline
404  G4int G4VProcess::GetProcessSubType() const      404  G4int G4VProcess::GetProcessSubType() const
405 {                                                 405 {
406   return theProcessSubType;                       406   return theProcessSubType;
407 }                                                 407 }
408                                                   408 
409 inline                                            409 inline
410 void G4VProcess::SetProcessSubType(G4int value    410 void G4VProcess::SetProcessSubType(G4int value)
411 {                                                 411 {
412   theProcessSubType = value;                      412   theProcessSubType = value;
413 }                                                 413 }
414                                                   414 
415 inline                                            415 inline
416 void G4VProcess::SetVerboseLevel(G4int value)     416 void G4VProcess::SetVerboseLevel(G4int value)
417 {                                                 417 {
418   verboseLevel = value;                           418   verboseLevel = value;
419 }                                                 419 }
420                                                   420 
421 inline                                            421 inline
422 G4int G4VProcess::GetVerboseLevel() const         422 G4int G4VProcess::GetVerboseLevel() const
423 {                                                 423 {
424   return  verboseLevel;                           424   return  verboseLevel;
425 }                                                 425 }
426                                                   426 
427 inline                                            427 inline
428 void G4VProcess::ClearNumberOfInteractionLengt    428 void G4VProcess::ClearNumberOfInteractionLengthLeft()
429 {                                                 429 {
430   theInitialNumberOfInteractionLength = -1.0;     430   theInitialNumberOfInteractionLength = -1.0; 
431   theNumberOfInteractionLengthLeft =  -1.0;       431   theNumberOfInteractionLengthLeft =  -1.0;
432 }                                                 432 }
433                                                   433 
434 inline                                            434 inline
435 G4double G4VProcess::GetNumberOfInteractionLen    435 G4double G4VProcess::GetNumberOfInteractionLengthLeft() const
436 {                                                 436 {
437   return theNumberOfInteractionLengthLeft;        437   return theNumberOfInteractionLengthLeft;
438 }                                                 438 }
439                                                   439 
440 inline                                            440 inline
441 G4double G4VProcess::GetTotalNumberOfInteracti    441 G4double G4VProcess::GetTotalNumberOfInteractionLengthTraversed() const
442 {                                                 442 {
443   return theInitialNumberOfInteractionLength -    443   return theInitialNumberOfInteractionLength - theNumberOfInteractionLengthLeft;
444 }                                                 444 }
445                                                   445 
446 inline                                            446 inline
447 G4double G4VProcess::GetCurrentInteractionLeng    447 G4double G4VProcess::GetCurrentInteractionLength() const
448 {                                                 448 {
449   return currentInteractionLength;                449   return currentInteractionLength;
450 }                                                 450 }
451                                                   451 
452 inline                                            452 inline
453 void G4VProcess::SetPILfactor(G4double value)     453 void G4VProcess::SetPILfactor(G4double value)
454 {                                                 454 {
455   if (value>0.) { thePILfactor = value; }         455   if (value>0.) { thePILfactor = value; }
456 }                                                 456 }
457                                                   457 
458 inline                                            458 inline
459 G4double G4VProcess::GetPILfactor() const         459 G4double G4VProcess::GetPILfactor() const
460 {                                                 460 {
461   return thePILfactor;                            461   return thePILfactor;
462 }                                                 462 }
463                                                   463 
464 inline                                            464 inline
465 G4double G4VProcess::AlongStepGPIL( const G4Tr    465 G4double G4VProcess::AlongStepGPIL( const G4Track& track,
466                                     G4double      466                                     G4double  previousStepSize,
467                                     G4double      467                                     G4double  currentMinimumStep,
468                                     G4double&     468                                     G4double& proposedSafety,
469                                     G4GPILSele    469                                     G4GPILSelection* selection )
470 {                                                 470 {
471   return AlongStepGetPhysicalInteractionLength    471   return AlongStepGetPhysicalInteractionLength(track, previousStepSize,
472                              currentMinimumSte    472                              currentMinimumStep, proposedSafety, selection);
473 }                                                 473 }
474                                                   474 
475 inline                                            475 inline
476 G4double G4VProcess::AtRestGPIL( const G4Track    476 G4double G4VProcess::AtRestGPIL( const G4Track& track,
477                                  G4ForceCondit    477                                  G4ForceCondition* condition )
478 {                                                 478 {
479   return thePILfactor * AtRestGetPhysicalInter    479   return thePILfactor * AtRestGetPhysicalInteractionLength(track, condition);
480 }                                                 480 }
481                                                   481 
482 inline                                            482 inline
483 G4double G4VProcess::PostStepGPIL( const G4Tra    483 G4double G4VProcess::PostStepGPIL( const G4Track& track,
484                                    G4double pr    484                                    G4double previousStepSize,
485                                    G4ForceCond    485                                    G4ForceCondition* condition )
486 {                                                 486 {
487   return thePILfactor *                           487   return thePILfactor *
488       PostStepGetPhysicalInteractionLength(tra    488       PostStepGetPhysicalInteractionLength(track, previousStepSize, condition);
489 }                                                 489 }
490                                                   490       
491 inline                                            491 inline 
492 void G4VProcess::SetProcessManager(const G4Pro    492 void G4VProcess::SetProcessManager(const G4ProcessManager* procMan)
493 {                                                 493 {
494   aProcessManager = procMan;                      494   aProcessManager = procMan; 
495 }                                                 495 }
496                                                   496 
497 inline                                            497 inline
498 const G4ProcessManager* G4VProcess::GetProcess    498 const G4ProcessManager* G4VProcess::GetProcessManager()
499 {                                                 499 {
500   return aProcessManager;                         500   return aProcessManager; 
501 }                                                 501 }
502                                                   502 
503 inline                                            503 inline
504 G4bool G4VProcess::isAtRestDoItIsEnabled() con    504 G4bool G4VProcess::isAtRestDoItIsEnabled() const
505 {                                                 505 {
506   return enableAtRestDoIt;                        506   return enableAtRestDoIt;
507 }                                                 507 }
508                                                   508 
509 inline                                            509 inline
510 G4bool G4VProcess::isAlongStepDoItIsEnabled()     510 G4bool G4VProcess::isAlongStepDoItIsEnabled() const
511 {                                                 511 {
512   return enableAlongStepDoIt;                     512   return enableAlongStepDoIt;
513 }                                                 513 }
514                                                   514 
515 inline                                            515 inline
516 G4bool G4VProcess::isPostStepDoItIsEnabled() c    516 G4bool G4VProcess::isPostStepDoItIsEnabled() const
517 {                                                 517 {
518   return enablePostStepDoIt;                      518   return enablePostStepDoIt;
519 }                                                 519 }
520                                                   520 
521 inline                                            521 inline
522 const G4VProcess* G4VProcess::GetMasterProcess    522 const G4VProcess* G4VProcess::GetMasterProcess() const
523 {                                                 523 {
524   return masterProcessShadow;                     524   return masterProcessShadow;
525 }                                                 525 }
526                                                   526 
527 inline                                            527 inline
528 void G4VProcess::SubtractNumberOfInteractionLe    528 void G4VProcess::SubtractNumberOfInteractionLengthLeft( G4double prevStepSize )
529 {                                                 529 {
530   if (currentInteractionLength>0.0)               530   if (currentInteractionLength>0.0)
531   {                                               531   {
532     theNumberOfInteractionLengthLeft -= prevSt    532     theNumberOfInteractionLengthLeft -= prevStepSize/currentInteractionLength;
533     if(theNumberOfInteractionLengthLeft<0.)       533     if(theNumberOfInteractionLengthLeft<0.)
534     {                                             534     {
535        theNumberOfInteractionLengthLeft=CLHEP:    535        theNumberOfInteractionLengthLeft=CLHEP::perMillion;
536     }                                             536     }
537   }                                               537   }
538   else                                            538   else
539   {                                               539   {
540 #ifdef G4VERBOSE                                  540 #ifdef G4VERBOSE
541     if (verboseLevel>0)                           541     if (verboseLevel>0)
542     {                                             542     {
543       G4cerr << "G4VProcess::SubtractNumberOfI    543       G4cerr << "G4VProcess::SubtractNumberOfInteractionLengthLeft()";
544       G4cerr << " [" << theProcessName << "]"     544       G4cerr << " [" << theProcessName << "]" <<G4endl;
545       G4cerr << " currentInteractionLength = "    545       G4cerr << " currentInteractionLength = "
546              << currentInteractionLength << "     546              << currentInteractionLength << " [mm]";
547       G4cerr << " previousStepSize = " << prev    547       G4cerr << " previousStepSize = " << prevStepSize << " [mm]";
548       G4cerr << G4endl;                           548       G4cerr << G4endl;
549     }                                             549     }
550 #endif                                            550 #endif
551     G4String msg = "Negative currentInteractio    551     G4String msg = "Negative currentInteractionLength for ";
552     msg += theProcessName;                        552     msg += theProcessName;
553     G4Exception("G4VProcess::SubtractNumberOfI    553     G4Exception("G4VProcess::SubtractNumberOfInteractionLengthLeft()",
554                 "ProcMan201", EventMustBeAbort    554                 "ProcMan201", EventMustBeAborted, msg);
555   }                                               555   }
556 }                                                 556 }
557                                                   557 
558 #endif                                            558 #endif
559                                                   559