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