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