Geant4 Cross Reference |
1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 // G4Step 27 // 28 // Class description: 29 // 30 // This class represents the Step of a particle being tracked. 31 // It includes information of: 32 // 1) List of Step points which compose the Step, 33 // 2) static information of particle which generated the Step, 34 // 3) trackID and parent particle ID of the Step, 35 // 4) termination condition of the Step. 36 37 // Authors: 38 // Katsuya Amako (e-mail: Katsuya.Amako@kek.jp) 39 // Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp) 40 // Revisions: 41 // Hisaya Kurashige, 1998-2007 42 // -------------------------------------------------------------------- 43 #ifndef G4Step_hh 44 #define G4Step_hh 1 45 46 #include <cstdlib> // Include from 'system' 47 #include <cmath> // Include from 'system' 48 #include "G4ios.hh" // Include from 'system' 49 #include <iomanip> // Include from 'system' 50 #include "globals.hh" // Include from 'global' 51 #include "G4ThreeVector.hh" // Include from 'global' 52 #include "G4VPhysicalVolume.hh" // Include from 'geometry' 53 #include "G4StepPoint.hh" // Include from 'track' 54 #include "G4StepStatus.hh" // Include from 'track' 55 #include "G4TrackVector.hh" // Include from 'tracking' 56 57 class G4Polyline; // Forward declaration. 58 class G4Track; // Forward declaration. 59 60 class G4Step 61 { 62 public: 63 G4Step(); 64 ~G4Step(); 65 // Constructor/Destructor 66 67 G4Step(const G4Step&); 68 G4Step& operator=(const G4Step&); 69 // Copy Constructor and assignment operator 70 71 inline G4Track* GetTrack() const; 72 inline void SetTrack(G4Track* value); 73 // Current track 74 75 inline G4StepPoint* GetPreStepPoint() const; 76 inline void SetPreStepPoint(G4StepPoint* value); 77 inline G4StepPoint* ResetPreStepPoint(G4StepPoint* value=nullptr); 78 // Pre-Step points 79 // If Set method is invoked, the previous StepPoint object is deleted. 80 // If Reset method is invoked, the previous StepPoint object is not deleted 81 // but its pointer is returned. Thus it's the caller's responsibility to 82 // properly delete it. 83 84 inline G4StepPoint* GetPostStepPoint() const; 85 inline void SetPostStepPoint(G4StepPoint* value); 86 inline G4StepPoint* ResetPostStepPoint(G4StepPoint* value=nullptr); 87 // Post-Step points 88 // If Set method is invoked, the previous StepPoint object is deleted. 89 // If Reset method is invoked, the previous StepPoint object is not deleted 90 // but its pointer is returned. Thus it's the caller's responsibility to 91 // properly delete it. 92 93 inline G4double GetStepLength() const; 94 inline void SetStepLength(G4double value); 95 // Before the end of the AlongStepDoIt loop, StepLength keeps 96 // the initial value which is determined by the shortest geometrical Step 97 // proposed by a physics process. After finishing the AlongStepDoIt, 98 // it will be set equal to 'StepLength' in G4Step 99 100 inline G4double GetTotalEnergyDeposit() const; 101 inline void SetTotalEnergyDeposit(G4double value); 102 // Total energy deposit 103 104 inline G4double GetNonIonizingEnergyDeposit() const; 105 inline void SetNonIonizingEnergyDeposit(G4double value); 106 // Total non-ionizing energy deposit 107 108 inline G4SteppingControl GetControlFlag() const; 109 inline void SetControlFlag(G4SteppingControl StepControlFlag); 110 // Control flag for stepping 111 112 inline void AddTotalEnergyDeposit(G4double value); 113 inline void ResetTotalEnergyDeposit(); 114 // Manipulation of total energy deposit 115 116 inline void AddNonIonizingEnergyDeposit(G4double value); 117 inline void ResetNonIonizingEnergyDeposit(); 118 // Manipulation of non-ionizing energy deposit 119 120 inline G4bool IsFirstStepInVolume() const; 121 inline G4bool IsLastStepInVolume() const; 122 123 inline void SetFirstStepFlag(); 124 inline void ClearFirstStepFlag(); 125 inline void SetLastStepFlag(); 126 inline void ClearLastStepFlag(); 127 // Get/Set/Clear flag for initial/last step 128 // NOTE: flags are not used 129 130 inline G4ThreeVector GetDeltaPosition() const; 131 inline G4double GetDeltaTime() const; 132 // Difference of position, time, momentum and energy 133 134 inline G4ThreeVector GetDeltaMomentum() const; 135 inline G4double GetDeltaEnergy() const; 136 // These methods provide difference between track energy and momentum 137 // at a step, it is incorrect to use these methods to compute energy 138 // deposition in media during the step, because secondary particles may 139 // be produced. For energy deposition use the method GetTotalEnergyDeposit() 140 141 inline void InitializeStep(G4Track* aValue); 142 // Initialize contents of G4Step 143 144 inline void UpdateTrack(); 145 // Update track by using G4Step information 146 147 inline void CopyPostToPreStepPoint(); 148 // Copy PostStepPoint to PreStepPoint 149 150 inline void SetPointerToVectorOfAuxiliaryPoints(std::vector<G4ThreeVector>* vec); 151 inline std::vector<G4ThreeVector>* GetPointerToVectorOfAuxiliaryPoints() const; 152 // Auxiliary points modifiers 153 154 // --- Secondary buckets --- 155 156 inline std::size_t GetNumberOfSecondariesInCurrentStep() const; 157 // Secondaries in the current step 158 159 const std::vector<const G4Track*>* GetSecondaryInCurrentStep() const; 160 161 inline const G4TrackVector* GetSecondary() const; 162 inline G4TrackVector* GetfSecondary(); 163 inline G4TrackVector* NewSecondaryVector(); 164 // NOTE: Secondary bucket of the Step contains 165 // all secondaries during tracking the current track 166 // (i.e. NOT secondaries produced in the current step) 167 // all these methods give same object (i.e. G4TrackVector ) 168 // but 2nd one will create bucket in addition 169 170 inline void DeleteSecondaryVector(); 171 // Just delete secondary bucket 172 // NOTE: G4Track objects inside the bucket are not deleted 173 174 inline void SetSecondary(G4TrackVector* value); 175 // Add secondary tracks to the bucket 176 177 protected: 178 179 G4double fTotalEnergyDeposit = 0.0; 180 // Accumulated total energy deposit in the current Step 181 182 G4double fNonIonizingEnergyDeposit = 0.0; 183 // Accumulated non-ionizing energy deposit in the current Step 184 185 private: 186 187 G4StepPoint* fpPreStepPoint = nullptr; 188 G4StepPoint* fpPostStepPoint = nullptr; 189 G4double fStepLength = 0.0; 190 // Step length which may be updated at each invocation of 191 // AlongStepDoIt and PostStepDoIt 192 193 G4Track* fpTrack = nullptr; 194 195 G4SteppingControl fpSteppingControlFlag = NormalCondition; 196 // A flag to control SteppingManager behavior from process 197 198 G4bool fFirstStepInVolume = false; 199 G4bool fLastStepInVolume = false; 200 // Flags for initial/last step 201 202 G4TrackVector* fSecondary = nullptr; 203 // Secondary bucket implemented by using std::vector of G4Track* 204 205 std::size_t nSecondaryByLastStep = 0; 206 // number of secondaries which have been created by the last step 207 208 std::vector<const G4Track*>* secondaryInCurrentStep = nullptr; 209 210 std::vector<G4ThreeVector>* fpVectorOfAuxiliaryPointsPointer = nullptr; 211 }; 212 213 #include "G4Step.icc" 214 215 #endif 216