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