Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // 23 // >> 24 // $Id: G4FastStep.hh,v 1.6 2001/07/11 10:08:23 gunter Exp $ >> 25 // GEANT4 tag $Name: geant4-05-00 $ 27 // 26 // 28 // << 27 // 29 //-------------------------------------------- 28 //--------------------------------------------------------------- 30 // 29 // 31 // G4FastStep.hh 30 // G4FastStep.hh 32 // 31 // 33 // Description: 32 // Description: 34 // The G4FastStep class insures a friendly 33 // The G4FastStep class insures a friendly interface 35 // to manage the primary/secondaries final << 34 // to manage the primary/secondaries final state for 36 // Fast Simulation Models. This includes fi 35 // Fast Simulation Models. This includes final states of parent 37 // particle (normalized direction of the mo << 36 // particle (normalized direction of the momentum, energy, etc) and 38 // secondary particles generated by the par 37 // secondary particles generated by the parameterisation. 39 // 38 // 40 // The G4FastStep class acts also as the G4 39 // The G4FastStep class acts also as the G4ParticleChange 41 // for the Fast Simulation Process. So it i << 40 // for the Fast Simulation Process. So it inherites from 42 // the G4VParticleChange class and redefine << 41 // the G4VParticleChange class and redefines the four virtual 43 // methods : 42 // methods : 44 // 43 // 45 // virtual G4Step* UpdateStepForAtRest(G4S 44 // virtual G4Step* UpdateStepForAtRest(G4Step* Step); 46 // virtual G4Step* UpdateStepForAlongStep( 45 // virtual G4Step* UpdateStepForAlongStep(G4Step* Step); 47 // virtual G4Step* UpdateStepForPostStep(G 46 // virtual G4Step* UpdateStepForPostStep(G4Step* Step); 48 // virtual void Initialize(const G4Track&) 47 // virtual void Initialize(const G4Track&); 49 // 48 // 50 // History: 49 // History: 51 // Oct 97: Verderi && MoraDeFreitas - First 50 // Oct 97: Verderi && MoraDeFreitas - First Implementation. 52 // Dec 97: Verderi - ForceSteppingHitInvoca 51 // Dec 97: Verderi - ForceSteppingHitInvocation(), 53 // Set/GetTotalEnergyDepo 52 // Set/GetTotalEnergyDeposited() methods. 54 // Apr 98: MoraDeFreitas - G4FastStep becom 53 // Apr 98: MoraDeFreitas - G4FastStep becomes the G4ParticleChange 55 // for the Fast Simulatio 54 // for the Fast Simulation Process. 56 // Nov 04: Verderi - Add ProposeXXX methods << 57 // for backward compatibi << 58 // 55 // 59 //-------------------------------------------- 56 //--------------------------------------------------------------- 60 57 >> 58 61 #ifndef G4FastStep_h 59 #ifndef G4FastStep_h 62 #define G4FastStep_h 60 #define G4FastStep_h 63 61 64 #include "G4ParticleMomentum.hh" << 65 #include "G4ThreeVector.hh" << 66 #include "G4ios.hh" << 67 #include "globals.hh" 62 #include "globals.hh" >> 63 #include "G4ios.hh" >> 64 #include "G4ThreeVector.hh" >> 65 #include "G4ParticleMomentum.hh" 68 class G4DynamicParticle; 66 class G4DynamicParticle; 69 #include "G4FastTrack.hh" << 70 #include "G4VParticleChange.hh" 67 #include "G4VParticleChange.hh" >> 68 #include "G4FastTrack.hh" 71 69 72 //------------------------------------------- 70 //------------------------------------------- 73 // 71 // 74 // G4FastStep class 72 // G4FastStep class 75 // 73 // 76 //------------------------------------------- 74 //------------------------------------------- 77 75 78 // Class Description: 76 // Class Description: 79 // The final state of the particles after par << 77 // The final state of the particles after parameterisation has to be returned through a G4FastStep 80 // reference. This final state is described a << 78 // reference. This final state is described has "requests" the tracking will apply after your 81 // parameterisation has been invoked. 79 // parameterisation has been invoked. 82 // 80 // 83 // To facilitate the developers work, changes << 81 // To facilitate the developers work, changes of position/normalized direction of the 84 // momentum/polarization can be specified in << 82 // momentum/polarization can be specified in the local coordinate system of the envelope or in the 85 // global one. 83 // global one. >> 84 // 86 // The default is local system coordinates. 85 // The default is local system coordinates. 87 // 86 // 88 87 89 class G4FastStep : public G4VParticleChange << 88 class G4FastStep: public G4VParticleChange 90 { 89 { 91 public: // Without description << 90 public: // with Description 92 //------------------------ << 91 void KillPrimaryTrack(); 93 // Constructor/Destructor << 92 // Set the kinetic energy of the primary to zero, and set the "fStopAndKill" signal 94 //------------------------ << 93 // used by the stepping. 95 G4FastStep() = default; << 94 96 ~G4FastStep() override = default; << 95 // -- Methods used to change the position, normalized direction of 97 << 96 // the momentum, time etc... of the primary. 98 G4FastStep(const G4FastStep& right) = dele << 97 // .. space and time: 99 G4FastStep& operator=(const G4FastStep& ri << 98 void SetPrimaryTrackFinalPosition (const G4ThreeVector &, 100 << 99 G4bool localCoordinates = true); 101 // Set the kinetic energy of the primary t << 100 // Set the primary position. 102 // used by the stepping. << 101 103 void KillPrimaryTrack(); << 102 void SetPrimaryTrackFinalTime (G4double); 104 << 103 // Set the primary final time. 105 // -- Methods used to change the position, << 104 106 // the momentum, time etc... of the primar << 105 void SetPrimaryTrackFinalProperTime (G4double); 107 // .. space and time: << 106 // Set the primary final Proper Time. 108 << 107 109 // Set the primary track final position. << 108 // .. dynamics: 110 void ProposePrimaryTrackFinalPosition(cons << 109 // Be careful: the Track Final Momentum means the normalized direction 111 << 110 // of the momentum! 112 // Set the primary track final position -- << 111 void SetPrimaryTrackFinalMomentum (const G4ThreeVector &, 113 [[deprecated("use ProposePrimaryTrackFinal << 112 G4bool localCoordinates = true); 114 void SetPrimaryTrackFinalPosition(const G4 << 113 // Set the primary final momentum. 115 << 114 116 // Set the primary track final time. << 115 void SetPrimaryTrackFinalKineticEnergy (G4double); 117 void ProposePrimaryTrackFinalTime(G4double << 116 // Set the primary final kinetic energy. 118 << 117 119 // Set the primary track final time -- mai << 118 void SetPrimaryTrackFinalKineticEnergyAndDirection(G4double, 120 [[deprecated("use ProposePrimaryTrackFinal << 119 const G4ThreeVector &, 121 void SetPrimaryTrackFinalTime(G4double); << 120 G4bool localCoordinates 122 << 121 = true); 123 // Set the primary final track Proper Time << 122 // Set the primary final kinetic energy and direction. 124 void ProposePrimaryTrackFinalProperTime(G4 << 123 125 << 124 void SetPrimaryTrackFinalPolarization(const G4ThreeVector &, 126 // Set the primary final track Proper Time << 125 G4bool localCoordinates = true); 127 [[deprecated("use ProposePrimaryTrackPrope << 126 // Set the primary final polarization. 128 void SetPrimaryTrackFinalProperTime(G4doub << 127 129 << 128 void SetPrimaryTrackPathLength (G4double); 130 // .. dynamics: << 129 // Set the true path length of the primary during the step. 131 << 130 132 // Be careful: the Track Final Momentum me << 131 void SetPrimaryTrackFinalEventBiasingWeight (G4double); 133 // of the momentum! << 132 // Set the weight applied for event biasing mechanism. 134 void ProposePrimaryTrackFinalMomentumDirec << 133 135 << 134 // ------------------------------ 136 << 135 // -- Management of secondaries: 137 // Set the primary track final momentum -- << 136 // ------------------------------ 138 // ProposePrimaryTrackMomentumDirection(.. << 137 139 [[deprecated("use ProposePrimaryTrackMomen << 138 // ---------------------------------------------------- 140 void SetPrimaryTrackFinalMomentum(const G4 << 139 // -- The creation of secondaries is Done in two steps: 141 << 140 // -- 1) Give the total number of secondaries 142 // Set the primary track final kinetic ene << 141 // -- that the FastStep returns 143 void ProposePrimaryTrackFinalKineticEnergy << 142 // -- to the tracking using: 144 << 143 // -- SetNumberOfSecondaryTracks() 145 // Set the primary track final kinetic ene << 144 // -- 146 [[deprecated("use ProposePrimaryTrackFinal << 145 // -- 2) Invoke the CreateSecondaryTrack() method 147 void SetPrimaryTrackFinalKineticEnergy(G4d << 146 // -- to create one secondary at each time. 148 << 147 // ---------------------------------------------------- 149 // Set the primary track final kinetic ene << 148 150 void ProposePrimaryTrackFinalKineticEnergy << 149 // -- Total Number of secondaries to be created, 151 << 150 // -- (to be called first) 152 << 151 void SetNumberOfSecondaryTracks(G4int); 153 // Set the primary track final kinetic ene << 152 // Set the total number of secondaries that will be created. 154 // compatibility. << 153 155 [[deprecated("use ProposePrimaryTrackFinal << 154 // -- Number of secondaries effectively stored: 156 void SetPrimaryTrackFinalKineticEnergyAndD << 155 // -- (incremented at each CreateSecondaryTrack() 157 << 156 // -- call) 158 << 157 G4int GetNumberOfSecondaryTracks(); 159 // Set the primary track final polarizatio << 158 // Returns the number of secondaries effectively stored. 160 void ProposePrimaryTrackFinalPolarization( << 159 161 << 160 // -- Create a secondary: the arguments are: 162 // Set the primary track final polarizatio << 161 // -- * G4DynamicsParticle: see header file, many constructors exist 163 [[deprecated("use ProposePrimaryTrackFinal << 162 // -- (allow to set particle type + energy + 164 void SetPrimaryTrackFinalPolarization(cons << 163 // -- the normalized direction of momentum...) 165 << 164 // -- * G4ThreeVector : Polarization (not in G4ParticleChange constructor) 166 // Set the true path length of the primary << 165 // -- * G4ThreeVector : Position 167 void ProposePrimaryTrackPathLength(G4doubl << 166 // -- * G4double : Time 168 << 167 // -- * G4bool : says if Position/Momentum are given in the 169 // Set the true path length of the primary << 168 // -- local coordinate system (true by default) 170 // compatibility. << 169 // -- Returned value: pointer to the track created. 171 [[deprecated("use ProposePrimaryTrackPathL << 170 G4Track* CreateSecondaryTrack(const G4DynamicParticle&, 172 void SetPrimaryTrackPathLength(G4double); << 171 G4ThreeVector, 173 << 172 G4ThreeVector, 174 // Set the weight applied for event biasin << 173 G4double, 175 void ProposePrimaryTrackFinalEventBiasingW << 174 G4bool localCoordinates=true); 176 << 175 // Create a secondary. The arguments are: 177 // Set the weight applied for event biasin << 176 // 178 [[deprecated("use ProposePrimaryTrackFinal << 177 // G4DynamicsParticle: see the G4DynamicsParticle reference, many constructors exist 179 void SetPrimaryTrackFinalEventBiasingWeigh << 178 // (allow to set particle type + energy + the normalized direction of 180 << 179 // momentum...); 181 // ------------------------------ << 180 // G4ThreeVector : Polarization; 182 // -- Management of secondaries: << 181 // G4ThreeVector : Position; 183 // ------------------------------ << 182 // G4double : Time; 184 << 183 // G4bool : says if Position/Momentum are given in the local envelope coordinate 185 // --------------------------------------- << 184 // system (true by default). 186 // -- The creation of secondaries is Done << 185 // 187 // -- 1) Give the total number of sec << 186 // Returned value: pointer to the track created. 188 // -- that the FastStep returns << 187 // 189 // -- to the tracking using: << 188 190 // -- SetNumberOfSecondaryTracks() << 189 //-- Create a secondary: the difference with he above declaration 191 // -- << 190 //-- is that the Polarization is not given and is assumed already set 192 // -- 2) Invoke the CreateSecondaryTr << 191 //-- in the G4DynamicParticle. 193 // -- to create one secondary at e << 192 //-- Returned value: pointer to the track created 194 // --------------------------------------- << 193 G4Track* CreateSecondaryTrack(const G4DynamicParticle&, 195 << 194 G4ThreeVector, 196 // Set the total number of secondaries tha << 195 G4double, 197 // -- Total Number of secondaries to be cr << 196 G4bool localCoordinates=true); 198 // -- (to be called first) << 197 // Create a secondary. The difference with he above declaration is that the Polarization is not 199 void SetNumberOfSecondaryTracks(G4int); << 198 // given and is assumed already set in the G4DynamicParticle. 200 << 199 // 201 // Returns the number of secondaries effec << 200 // Returned value: pointer to the track created 202 // -- Number of secondaries effectively st << 201 203 // -- (incremented at each CreateSecondary << 202 204 // -- call) << 203 205 G4int GetNumberOfSecondaryTracks(); << 204 G4Track* GetSecondaryTrack(G4int); 206 << 205 // Returns a pointer on the i-th secondary track created. 207 // -- Create a secondary: the arguments ar << 206 208 // -- * G4DynamicsParticle: see header << 207 //------------------------------------------------ 209 // -- (allow to << 208 // 210 // -- the normalized direction of momentum << 209 // Total energy deposit in the "fast Step" 211 // -- * G4ThreeVector : Polarizati << 210 // (a default should be provided in future, 212 // -- * G4ThreeVector : Position << 211 // which can be: 213 // -- * G4double : Time << 212 // delta energy of primary - 214 // -- * G4bool : says if Po << 213 // energy of the secondaries) 215 // -- local coor << 214 // This allow the user to Store a consistent 216 // -- Returned value: pointer to the track << 215 // information in the G4Trajectory. 217 G4Track* CreateSecondaryTrack(const G4Dyna << 216 // 218 G4bool local << 217 //------------------------------------------------ 219 << 218 void SetTotalEnergyDeposited(G4double anEnergyPart); 220 //-- Create a secondary: the difference wi << 219 // Set the total energy deposited. 221 //-- is that the Polarization is not given << 220 // It should be the delta energy of primary less the energy of the secondaries. 222 //-- in the G4DynamicParticle. << 221 223 //-- Returned value: pointer to the track << 222 G4double GetTotalEnergyDeposited() const; 224 G4Track* CreateSecondaryTrack(const G4Dyna << 223 // Returns the total energy deposited. 225 G4bool local << 224 226 << 225 void ForceSteppingHitInvocation(); 227 // Returns a pointer on the i-th secondary << 226 // Control of the stepping manager Hit invocation. 228 G4Track* GetSecondaryTrack(G4int); << 227 // 229 << 228 // In a usual parameterisation, the control of the hits production is under the user 230 //---------------------------------------- << 229 // responsability in his G4VFastSimulationModel (he generally produces several hits at once.) 231 // << 230 // 232 // Total energy deposit in the "fast Ste << 231 // However, in the particular case the G4FastSimulation user's model acts as the physics 233 // (a default should be provided in futu << 232 // replacement only (ie replaces all the ***DoIt() and leads to the construction of a meaningful 234 // which can be: << 233 // G4Step), the user can delegate to the G4SteppingManager the responsability to invoke 235 // delta energy of primary - << 234 // the Hit()method of the current sensitive if any. 236 // energy of the secondaries) << 235 // 237 // This allow the user to Store a consis << 236 // By default, the G4SteppingManager is asked to NOT invoke this Hit() method when parameterisation 238 // information in the G4Trajectory. << 237 // is invoked. 239 // << 238 // 240 //---------------------------------------- << 239 241 // Set the total energy deposited. << 240 242 void ProposeTotalEnergyDeposited(G4double << 241 public: // Without description 243 << 242 //======================================================= 244 // Set the total energy deposited -- kept << 243 // Implementation section and kernel interfaces. 245 // It should be the delta energy of primar << 244 //======================================================= 246 [[deprecated("use ProposeTotalEnergyDeposi << 245 //------------------------ 247 void SetTotalEnergyDeposited(G4double anEn << 246 // Constructor/Destructor 248 << 247 //------------------------ 249 // Returns the total energy deposited. << 248 G4FastStep(); 250 G4double GetTotalEnergyDeposited() const; << 249 virtual ~G4FastStep(); 251 << 250 252 // Control of the stepping manager Hit inv << 251 // equal/unequal operator 253 // << 252 G4bool operator==(const G4FastStep &right) const; 254 // In a usual parameterisation, the contro << 253 G4bool operator!=(const G4FastStep &right) const; 255 // responsability in his G4VFastSimulation << 254 256 // << 255 protected: 257 // However, in the particular case the G4F << 256 // hide copy constructor and assignment operator as protected 258 // replacement only (ie replaces all the * << 257 G4FastStep (const G4FastStep &right); 259 // G4Step), the user can delegate to the G << 258 G4FastStep & operator= (const G4FastStep &right); 260 // the Hit()method of the current sensitiv << 259 261 // << 260 public: 262 // By default, the G4SteppingManager is as << 261 // =============================================== 263 // parameterisation is invoked. << 262 // Stepping interface. 264 void ForceSteppingHitInvocation(); << 263 // =============================================== 265 << 264 // --- the following methods are for updating G4Step ----- 266 // ======================================= << 265 // Return the pointer to the G4Step after updating the Step information 267 // Stepping interface. << 266 // by using final state information of the track given by a Model. 268 // ======================================= << 267 // 269 // --- the following methods are for updat << 268 // The Fast Simulation Mechanism doesn't change the track's final 270 // Return the pointer to the G4Step after << 269 // state on the AlongDoIt loop, so the default one all we need. 271 // by using final state information of the << 270 //virtual G4Step* UpdateStepForAlongStep(G4Step* Step); 272 // << 271 273 // The Fast Simulation Mechanism doesn't c << 272 G4Step* UpdateStepForAtRest(G4Step* Step); 274 // state on the AlongDoIt loop, so the def << 273 G4Step* UpdateStepForPostStep(G4Step* Step); 275 // virtual G4Step* UpdateStepForAlongStep( << 274 276 << 275 // A Model gives the final state of the particle 277 G4Step* UpdateStepForAtRest(G4Step* Step) << 276 // based on information of G4FastTrack. So the 278 G4Step* UpdateStepForPostStep(G4Step* Step << 277 // Initialize method is an interface to the 279 << 278 // G4FastSimulationManager to Initialize the 280 // A Model gives the final state of the pa << 279 // G4FastStep. 281 // based on information of G4FastTrack. So << 280 282 // Initialize method is an interface to th << 281 void Initialize(const G4FastTrack&); 283 // G4FastSimulationManager to Initialize t << 282 284 // G4FastStep. << 283 private: 285 << 284 //=================================================== 286 void Initialize(const G4FastTrack&); << 285 // Private Internal methods (implementation). 287 << 286 //=================================================== 288 // for Debug << 287 289 void DumpInfo() const override; << 288 // G4FastStep should never be Initialized in this way 290 G4bool CheckIt(const G4Track&) override; << 289 // but we must define it to avoid compiler warnings. 291 << 290 void Initialize(const G4Track&); 292 private: << 291 293 //======================================== << 292 // -- Utility functions -- 294 // Private Internal methods (implementatio << 293 //--- methods to keep information of the final state-- 295 //======================================== << 294 // IMPORTANT NOTE: Although the name of the class and methods are 296 << 295 // "Change", what it stores (and returns in get) are the "FINAL" 297 // G4FastStep should never be Initialized << 296 // values of the Position, the normalized direction of Momentum, 298 // but we must define it to avoid compiler << 297 // etc. 299 void Initialize(const G4Track&) override; << 298 300 << 299 // Set theMomentumChange vector: it is the final unitary momentum 301 // -- Utility functions -- << 300 // direction. 302 //--- methods to keep information of the f << 301 void SetMomentumChange(G4double Px, G4double Py, G4double Pz); 303 // IMPORTANT NOTE: Although the name of t << 302 void SetMomentumChange(const G4ThreeVector& Pfinal); 304 // "Change", what it stores (and returns << 303 305 // values of the Position, the normalize << 304 //===================================================== 306 // etc. << 305 // Data members. 307 << 306 //===================================================== 308 // Set theMomentumChange vector: it is the << 307 // theMomentumChange is the vector containing the final momentum 309 // direction. << 308 // direction after the invoked process. The application of the change 310 void SetMomentumChange(G4double Px, G4doub << 309 // of the momentum direction of the particle is not Done here. 311 void SetMomentumChange(const G4ThreeVector << 310 // The responsibility to apply the change is up the entity 312 << 311 // which invoked the process. 313 //======================================== << 312 G4ParticleMomentum theMomentumChange; 314 // Data members. << 313 315 //======================================== << 314 // The changed (final) polarization of a given particle. 316 // theMomentumChange is the vector contai << 315 G4ThreeVector thePolarizationChange; 317 // direction after the invoked process. T << 316 318 // of the momentum direction of the parti << 317 // The final kinetic energy of the current particle. 319 // The responsibility to apply the change << 318 G4double theEnergyChange; 320 // which invoked the process. << 319 321 G4ParticleMomentum theMomentumChange; << 320 // The changed (final) position of a given particle. 322 << 321 G4ThreeVector thePositionChange; 323 // The changed (final) polarization of a << 322 324 G4ThreeVector thePolarizationChange; << 323 // The changed (final) global time of a given particle. 325 << 324 G4double theTimeChange; 326 // The final kinetic energy of the curren << 325 327 G4double theEnergyChange = 0.0; << 326 // The changed (final) proper time of a given particle. 328 << 327 G4double theProperTimeChange; 329 // The changed (final) position of a give << 328 330 G4ThreeVector thePositionChange; << 329 // The reference G4FastTrack 331 << 330 const G4FastTrack* fFastTrack; 332 // The changed (final) global time of a g << 331 333 G4double theTimeChange = 0.0; << 332 // weight for event biasing mechanism: 334 << 333 G4double theWeightChange; 335 // The changed (final) proper time of a g << 334 336 G4double theProperTimeChange = 0.0; << 335 337 << 336 public: 338 // The reference G4FastTrack << 337 // for Debug 339 const G4FastTrack* fFastTrack = nullptr; << 338 void DumpInfo() const; 340 << 339 G4bool CheckIt(const G4Track&); 341 // weight for event biasing mechanism: << 342 G4double theWeightChange = 0.0; << 343 }; 340 }; 344 341 345 //******************************************** 342 //******************************************************************* 346 // 343 // 347 // Inline functions 344 // Inline functions 348 // 345 // 349 //******************************************** 346 //******************************************************************* 350 347 351 #include "G4FastStep.icc" 348 #include "G4FastStep.icc" 352 349 353 #endif 350 #endif 354 351