|
||||
File indexing completed on 2025-01-18 09:58:16
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 // 0027 // 0028 // 0029 //--------------------------------------------------------------- 0030 // 0031 // G4FastStep.hh 0032 // 0033 // Description: 0034 // The G4FastStep class insures a friendly interface 0035 // to manage the primary/secondaries final state for 0036 // Fast Simulation Models. This includes final states of parent 0037 // particle (normalized direction of the momentum, energy, etc) and 0038 // secondary particles generated by the parameterisation. 0039 // 0040 // The G4FastStep class acts also as the G4ParticleChange 0041 // for the Fast Simulation Process. So it inherites from 0042 // the G4VParticleChange class and redefines the four virtual 0043 // methods : 0044 // 0045 // virtual G4Step* UpdateStepForAtRest(G4Step* Step); 0046 // virtual G4Step* UpdateStepForAlongStep(G4Step* Step); 0047 // virtual G4Step* UpdateStepForPostStep(G4Step* Step); 0048 // virtual void Initialize(const G4Track&); 0049 // 0050 // History: 0051 // Oct 97: Verderi && MoraDeFreitas - First Implementation. 0052 // Dec 97: Verderi - ForceSteppingHitInvocation(), 0053 // Set/GetTotalEnergyDeposited() methods. 0054 // Apr 98: MoraDeFreitas - G4FastStep becomes the G4ParticleChange 0055 // for the Fast Simulation Process. 0056 // Nov 04: Verderi - Add ProposeXXX methods. SetXXX ones are kept 0057 // for backward compatibility. 0058 // 0059 //--------------------------------------------------------------- 0060 0061 #ifndef G4FastStep_h 0062 #define G4FastStep_h 0063 0064 #include "G4ParticleMomentum.hh" 0065 #include "G4ThreeVector.hh" 0066 #include "G4ios.hh" 0067 #include "globals.hh" 0068 class G4DynamicParticle; 0069 #include "G4FastTrack.hh" 0070 #include "G4VParticleChange.hh" 0071 0072 //------------------------------------------- 0073 // 0074 // G4FastStep class 0075 // 0076 //------------------------------------------- 0077 0078 // Class Description: 0079 // The final state of the particles after parameterisation has to be returned through a G4FastStep 0080 // reference. This final state is described as "requests" the tracking will apply after your 0081 // parameterisation has been invoked. 0082 // 0083 // To facilitate the developers work, changes of position/normalized direction of the 0084 // momentum/polarization can be specified in the local coordinate system of the envelope or in the 0085 // global one. 0086 // The default is local system coordinates. 0087 // 0088 0089 class G4FastStep : public G4VParticleChange 0090 { 0091 public: // Without description 0092 //------------------------ 0093 // Constructor/Destructor 0094 //------------------------ 0095 G4FastStep() = default; 0096 ~G4FastStep() override = default; 0097 0098 G4FastStep(const G4FastStep& right) = delete; 0099 G4FastStep& operator=(const G4FastStep& right) = delete; 0100 0101 // Set the kinetic energy of the primary to zero, and set the "fStopAndKill" signal 0102 // used by the stepping. 0103 void KillPrimaryTrack(); 0104 0105 // -- Methods used to change the position, normalized direction of 0106 // the momentum, time etc... of the primary. 0107 // .. space and time: 0108 0109 // Set the primary track final position. 0110 void ProposePrimaryTrackFinalPosition(const G4ThreeVector&, G4bool localCoordinates = true); 0111 0112 // Set the primary track final position -- maintained for backward compatibility. 0113 [[deprecated("use ProposePrimaryTrackFinalPosition instead")]] 0114 void SetPrimaryTrackFinalPosition(const G4ThreeVector&, G4bool localCoordinates = true); 0115 0116 // Set the primary track final time. 0117 void ProposePrimaryTrackFinalTime(G4double); 0118 0119 // Set the primary track final time -- maintained for backward compatibility. 0120 [[deprecated("use ProposePrimaryTrackFinalTime instead")]] 0121 void SetPrimaryTrackFinalTime(G4double); 0122 0123 // Set the primary final track Proper Time. 0124 void ProposePrimaryTrackFinalProperTime(G4double); 0125 0126 // Set the primary final track Proper Time -- maintained for backward compatibility. 0127 [[deprecated("use ProposePrimaryTrackProperTime instead")]] 0128 void SetPrimaryTrackFinalProperTime(G4double); 0129 0130 // .. dynamics: 0131 0132 // Be careful: the Track Final Momentum means the normalized direction 0133 // of the momentum! 0134 void ProposePrimaryTrackFinalMomentumDirection(const G4ThreeVector&, 0135 G4bool localCoordinates = true); 0136 0137 // Set the primary track final momentum -- maintained for backward compatibility. Same as 0138 // ProposePrimaryTrackMomentumDirection(...) 0139 [[deprecated("use ProposePrimaryTrackMomentumDirection instead")]] 0140 void SetPrimaryTrackFinalMomentum(const G4ThreeVector&, G4bool localCoordinates = true); 0141 0142 // Set the primary track final kinetic energy. 0143 void ProposePrimaryTrackFinalKineticEnergy(G4double); 0144 0145 // Set the primary track final kinetic energy-- maintained for backward compatibility. 0146 [[deprecated("use ProposePrimaryTrackFinalKineticEnergy instead")]] 0147 void SetPrimaryTrackFinalKineticEnergy(G4double); 0148 0149 // Set the primary track final kinetic energy and direction. 0150 void ProposePrimaryTrackFinalKineticEnergyAndDirection(G4double, const G4ThreeVector&, 0151 G4bool localCoordinates = true); 0152 0153 // Set the primary track final kinetic energy and direction -- maintained for backward 0154 // compatibility. 0155 [[deprecated("use ProposePrimaryTrackFinalKineticEnergyAndDirection instead")]] 0156 void SetPrimaryTrackFinalKineticEnergyAndDirection(G4double, const G4ThreeVector&, 0157 G4bool localCoordinates = true); 0158 0159 // Set the primary track final polarization. 0160 void ProposePrimaryTrackFinalPolarization(const G4ThreeVector&, G4bool localCoordinates = true); 0161 0162 // Set the primary track final polarization. 0163 [[deprecated("use ProposePrimaryTrackFinalPolarization instead")]] 0164 void SetPrimaryTrackFinalPolarization(const G4ThreeVector&, G4bool localCoordinates = true); 0165 0166 // Set the true path length of the primary track during the step. 0167 void ProposePrimaryTrackPathLength(G4double); 0168 0169 // Set the true path length of the primary track during the step -- maintained for backward 0170 // compatibility. 0171 [[deprecated("use ProposePrimaryTrackPathLength instead")]] 0172 void SetPrimaryTrackPathLength(G4double); 0173 0174 // Set the weight applied for event biasing mechanism. 0175 void ProposePrimaryTrackFinalEventBiasingWeight(G4double); 0176 0177 // Set the weight applied for event biasing mechanism -- kept for backward compatibility. 0178 [[deprecated("use ProposePrimaryTrackFinalEventBiasingWeight instead")]] 0179 void SetPrimaryTrackFinalEventBiasingWeight(G4double); 0180 0181 // ------------------------------ 0182 // -- Management of secondaries: 0183 // ------------------------------ 0184 0185 // ---------------------------------------------------- 0186 // -- The creation of secondaries is Done in two steps: 0187 // -- 1) Give the total number of secondaries 0188 // -- that the FastStep returns 0189 // -- to the tracking using: 0190 // -- SetNumberOfSecondaryTracks() 0191 // -- 0192 // -- 2) Invoke the CreateSecondaryTrack() method 0193 // -- to create one secondary at each time. 0194 // ---------------------------------------------------- 0195 0196 // Set the total number of secondaries that will be created. 0197 // -- Total Number of secondaries to be created, 0198 // -- (to be called first) 0199 void SetNumberOfSecondaryTracks(G4int); 0200 0201 // Returns the number of secondaries effectively stored. 0202 // -- Number of secondaries effectively stored: 0203 // -- (incremented at each CreateSecondaryTrack() 0204 // -- call) 0205 G4int GetNumberOfSecondaryTracks(); 0206 0207 // -- Create a secondary: the arguments are: 0208 // -- * G4DynamicsParticle: see header file, many constructors exist 0209 // -- (allow to set particle type + energy + 0210 // -- the normalized direction of momentum...) 0211 // -- * G4ThreeVector : Polarization (not in G4ParticleChange constructor) 0212 // -- * G4ThreeVector : Position 0213 // -- * G4double : Time 0214 // -- * G4bool : says if Position/Momentum are given in the 0215 // -- local coordinate system (true by default) 0216 // -- Returned value: pointer to the track created. 0217 G4Track* CreateSecondaryTrack(const G4DynamicParticle&, G4ThreeVector, G4ThreeVector, G4double, 0218 G4bool localCoordinates = true); 0219 0220 //-- Create a secondary: the difference with he above declaration 0221 //-- is that the Polarization is not given and is assumed already set 0222 //-- in the G4DynamicParticle. 0223 //-- Returned value: pointer to the track created 0224 G4Track* CreateSecondaryTrack(const G4DynamicParticle&, G4ThreeVector, G4double, 0225 G4bool localCoordinates = true); 0226 0227 // Returns a pointer on the i-th secondary track created. 0228 G4Track* GetSecondaryTrack(G4int); 0229 0230 //------------------------------------------------ 0231 // 0232 // Total energy deposit in the "fast Step" 0233 // (a default should be provided in future, 0234 // which can be: 0235 // delta energy of primary - 0236 // energy of the secondaries) 0237 // This allow the user to Store a consistent 0238 // information in the G4Trajectory. 0239 // 0240 //------------------------------------------------ 0241 // Set the total energy deposited. 0242 void ProposeTotalEnergyDeposited(G4double anEnergyPart); 0243 0244 // Set the total energy deposited -- kept for backward compatibility. 0245 // It should be the delta energy of primary less the energy of the secondaries. 0246 [[deprecated("use ProposeTotalEnergyDeposited instead")]] 0247 void SetTotalEnergyDeposited(G4double anEnergyPart); 0248 0249 // Returns the total energy deposited. 0250 G4double GetTotalEnergyDeposited() const; 0251 0252 // Control of the stepping manager Hit invocation. 0253 // 0254 // In a usual parameterisation, the control of the hits production is under the user 0255 // responsability in his G4VFastSimulationModel (he generally produces several hits at once.) 0256 // 0257 // However, in the particular case the G4FastSimulation user's model acts as the physics 0258 // replacement only (ie replaces all the ***DoIt() and leads to the construction of a meaningful 0259 // G4Step), the user can delegate to the G4SteppingManager the responsability to invoke 0260 // the Hit()method of the current sensitive if any. 0261 // 0262 // By default, the G4SteppingManager is asked to NOT invoke this Hit() method when 0263 // parameterisation is invoked. 0264 void ForceSteppingHitInvocation(); 0265 0266 // =============================================== 0267 // Stepping interface. 0268 // =============================================== 0269 // --- the following methods are for updating G4Step ----- 0270 // Return the pointer to the G4Step after updating the Step information 0271 // by using final state information of the track given by a Model. 0272 // 0273 // The Fast Simulation Mechanism doesn't change the track's final 0274 // state on the AlongDoIt loop, so the default one all we need. 0275 // virtual G4Step* UpdateStepForAlongStep(G4Step* Step); 0276 0277 G4Step* UpdateStepForAtRest(G4Step* Step) override; 0278 G4Step* UpdateStepForPostStep(G4Step* Step) override; 0279 0280 // A Model gives the final state of the particle 0281 // based on information of G4FastTrack. So the 0282 // Initialize method is an interface to the 0283 // G4FastSimulationManager to Initialize the 0284 // G4FastStep. 0285 0286 void Initialize(const G4FastTrack&); 0287 0288 // for Debug 0289 void DumpInfo() const override; 0290 G4bool CheckIt(const G4Track&) override; 0291 0292 private: 0293 //=================================================== 0294 // Private Internal methods (implementation). 0295 //=================================================== 0296 0297 // G4FastStep should never be Initialized in this way 0298 // but we must define it to avoid compiler warnings. 0299 void Initialize(const G4Track&) override; 0300 0301 // -- Utility functions -- 0302 //--- methods to keep information of the final state-- 0303 // IMPORTANT NOTE: Although the name of the class and methods are 0304 // "Change", what it stores (and returns in get) are the "FINAL" 0305 // values of the Position, the normalized direction of Momentum, 0306 // etc. 0307 0308 // Set theMomentumChange vector: it is the final unitary momentum 0309 // direction. 0310 void SetMomentumChange(G4double Px, G4double Py, G4double Pz); 0311 void SetMomentumChange(const G4ThreeVector& Pfinal); 0312 0313 //===================================================== 0314 // Data members. 0315 //===================================================== 0316 // theMomentumChange is the vector containing the final momentum 0317 // direction after the invoked process. The application of the change 0318 // of the momentum direction of the particle is not Done here. 0319 // The responsibility to apply the change is up the entity 0320 // which invoked the process. 0321 G4ParticleMomentum theMomentumChange; 0322 0323 // The changed (final) polarization of a given particle. 0324 G4ThreeVector thePolarizationChange; 0325 0326 // The final kinetic energy of the current particle. 0327 G4double theEnergyChange = 0.0; 0328 0329 // The changed (final) position of a given particle. 0330 G4ThreeVector thePositionChange; 0331 0332 // The changed (final) global time of a given particle. 0333 G4double theTimeChange = 0.0; 0334 0335 // The changed (final) proper time of a given particle. 0336 G4double theProperTimeChange = 0.0; 0337 0338 // The reference G4FastTrack 0339 const G4FastTrack* fFastTrack = nullptr; 0340 0341 // weight for event biasing mechanism: 0342 G4double theWeightChange = 0.0; 0343 }; 0344 0345 //******************************************************************* 0346 // 0347 // Inline functions 0348 // 0349 //******************************************************************* 0350 0351 #include "G4FastStep.icc" 0352 0353 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |