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 // G4Step 26 // G4Step 27 // 27 // 28 // Class description: 28 // Class description: 29 // 29 // 30 // This class represents the Step of a particl 30 // This class represents the Step of a particle being tracked. 31 // It includes information of: 31 // It includes information of: 32 // 1) List of Step points which compose th 32 // 1) List of Step points which compose the Step, 33 // 2) static information of particle which 33 // 2) static information of particle which generated the Step, 34 // 3) trackID and parent particle ID of th 34 // 3) trackID and parent particle ID of the Step, 35 // 4) termination condition of the Step. 35 // 4) termination condition of the Step. 36 36 37 // Authors: 37 // Authors: 38 // Katsuya Amako (e-mail: Katsuya.Amako@kek 38 // Katsuya Amako (e-mail: Katsuya.Amako@kek.jp) 39 // Takashi Sasaki (e-mail: Takashi.Sasaki@ke 39 // Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp) 40 // Revisions: 40 // Revisions: 41 // Hisaya Kurashige, 1998-2007 41 // Hisaya Kurashige, 1998-2007 42 // ------------------------------------------- 42 // -------------------------------------------------------------------- 43 #ifndef G4Step_hh 43 #ifndef G4Step_hh 44 #define G4Step_hh 1 44 #define G4Step_hh 1 45 45 46 #include <cstdlib> // Include fr << 46 #include <cstdlib> // Include from 'system' 47 #include <cmath> // Include fr 47 #include <cmath> // Include from 'system' 48 #include "G4ios.hh" // Include fr 48 #include "G4ios.hh" // Include from 'system' 49 #include <iomanip> // Include fr 49 #include <iomanip> // Include from 'system' 50 #include "globals.hh" // Include fr 50 #include "globals.hh" // Include from 'global' 51 #include "G4ThreeVector.hh" // Include fr 51 #include "G4ThreeVector.hh" // Include from 'global' 52 #include "G4VPhysicalVolume.hh" // Include fr 52 #include "G4VPhysicalVolume.hh" // Include from 'geometry' 53 #include "G4StepPoint.hh" // Include fr 53 #include "G4StepPoint.hh" // Include from 'track' 54 #include "G4StepStatus.hh" // Include fr 54 #include "G4StepStatus.hh" // Include from 'track' 55 #include "G4TrackVector.hh" // Include fr 55 #include "G4TrackVector.hh" // Include from 'tracking' >> 56 #include "G4Profiler.hh" // Include from 'global' 56 57 57 class G4Polyline; // Forward de 58 class G4Polyline; // Forward declaration. 58 class G4Track; // Forward de 59 class G4Track; // Forward declaration. 59 60 60 class G4Step 61 class G4Step 61 { 62 { 62 public: 63 public: >> 64 // the profiler aliases are only used when compiled with GEANT4_USE_TIMEMORY >> 65 using ProfilerConfig = G4ProfilerConfig<G4ProfileType::Step>; >> 66 63 G4Step(); 67 G4Step(); 64 ~G4Step(); 68 ~G4Step(); 65 // Constructor/Destructor 69 // Constructor/Destructor 66 70 67 G4Step(const G4Step&); 71 G4Step(const G4Step&); 68 G4Step& operator=(const G4Step&); 72 G4Step& operator=(const G4Step&); 69 // Copy Constructor and assignment opera 73 // Copy Constructor and assignment operator 70 74 71 inline G4Track* GetTrack() const; << 75 G4Track* GetTrack() const; 72 inline void SetTrack(G4Track* value); << 76 void SetTrack(G4Track* value); 73 // Current track 77 // Current track 74 78 75 inline G4StepPoint* GetPreStepPoint() cons << 79 G4StepPoint* GetPreStepPoint() const; 76 inline void SetPreStepPoint(G4StepPoint* v << 80 void SetPreStepPoint(G4StepPoint* value); 77 inline G4StepPoint* ResetPreStepPoint(G4St << 81 G4StepPoint* ResetPreStepPoint(G4StepPoint* value=nullptr); 78 // Pre-Step points 82 // Pre-Step points 79 // If Set method is invoked, the previou 83 // If Set method is invoked, the previous StepPoint object is deleted. 80 // If Reset method is invoked, the previ 84 // If Reset method is invoked, the previous StepPoint object is not deleted 81 // but its pointer is returned. Thus it' 85 // but its pointer is returned. Thus it's the caller's responsibility to 82 // properly delete it. 86 // properly delete it. 83 87 84 inline G4StepPoint* GetPostStepPoint() con << 88 G4StepPoint* GetPostStepPoint() const; 85 inline void SetPostStepPoint(G4StepPoint* << 89 void SetPostStepPoint(G4StepPoint* value); 86 inline G4StepPoint* ResetPostStepPoint(G4S << 90 G4StepPoint* ResetPostStepPoint(G4StepPoint* value=nullptr); 87 // Post-Step points 91 // Post-Step points 88 // If Set method is invoked, the previou 92 // If Set method is invoked, the previous StepPoint object is deleted. 89 // If Reset method is invoked, the previ 93 // If Reset method is invoked, the previous StepPoint object is not deleted 90 // but its pointer is returned. Thus it' 94 // but its pointer is returned. Thus it's the caller's responsibility to 91 // properly delete it. 95 // properly delete it. 92 96 93 inline G4double GetStepLength() const; << 97 G4double GetStepLength() const; 94 inline void SetStepLength(G4double value); << 98 void SetStepLength(G4double value); 95 // Before the end of the AlongStepDoIt l 99 // Before the end of the AlongStepDoIt loop, StepLength keeps 96 // the initial value which is determined 100 // the initial value which is determined by the shortest geometrical Step 97 // proposed by a physics process. After 101 // proposed by a physics process. After finishing the AlongStepDoIt, 98 // it will be set equal to 'StepLength' 102 // it will be set equal to 'StepLength' in G4Step 99 103 100 inline G4double GetTotalEnergyDeposit() co << 104 G4double GetTotalEnergyDeposit() const; 101 inline void SetTotalEnergyDeposit(G4double << 105 void SetTotalEnergyDeposit(G4double value); 102 // Total energy deposit 106 // Total energy deposit 103 107 104 inline G4double GetNonIonizingEnergyDeposi << 108 G4double GetNonIonizingEnergyDeposit() const; 105 inline void SetNonIonizingEnergyDeposit(G4 << 109 void SetNonIonizingEnergyDeposit(G4double value); 106 // Total non-ionizing energy deposit 110 // Total non-ionizing energy deposit 107 111 108 inline G4SteppingControl GetControlFlag() << 112 G4SteppingControl GetControlFlag() const; 109 inline void SetControlFlag(G4SteppingContr << 113 void SetControlFlag(G4SteppingControl StepControlFlag); 110 // Control flag for stepping 114 // Control flag for stepping 111 115 112 inline void AddTotalEnergyDeposit(G4double << 116 void AddTotalEnergyDeposit(G4double value); 113 inline void ResetTotalEnergyDeposit(); << 117 void ResetTotalEnergyDeposit(); 114 // Manipulation of total energy deposit 118 // Manipulation of total energy deposit 115 119 116 inline void AddNonIonizingEnergyDeposit(G4 << 120 void AddNonIonizingEnergyDeposit(G4double value); 117 inline void ResetNonIonizingEnergyDeposit( << 121 void ResetNonIonizingEnergyDeposit(); 118 // Manipulation of non-ionizing energy d 122 // Manipulation of non-ionizing energy deposit 119 123 120 inline G4bool IsFirstStepInVolume() const; << 124 G4bool IsFirstStepInVolume() const; 121 inline G4bool IsLastStepInVolume() const; << 125 G4bool IsLastStepInVolume() const; 122 126 123 inline void SetFirstStepFlag(); << 127 void SetFirstStepFlag(); 124 inline void ClearFirstStepFlag(); << 128 void ClearFirstStepFlag(); 125 inline void SetLastStepFlag(); << 129 void SetLastStepFlag(); 126 inline void ClearLastStepFlag(); << 130 void ClearLastStepFlag(); 127 // Get/Set/Clear flag for initial/last s 131 // Get/Set/Clear flag for initial/last step 128 // NOTE: flags are not used 132 // NOTE: flags are not used 129 133 130 inline G4ThreeVector GetDeltaPosition() co << 134 G4ThreeVector GetDeltaPosition() const; 131 inline G4double GetDeltaTime() const; << 135 G4double GetDeltaTime() const; 132 // Difference of position, time, momentu 136 // Difference of position, time, momentum and energy 133 137 134 inline G4ThreeVector GetDeltaMomentum() co << 138 G4ThreeVector GetDeltaMomentum() const; 135 inline G4double GetDeltaEnergy() const; << 139 G4double GetDeltaEnergy() const; 136 // These methods provide difference betw << 140 // These methods will be deleted 137 // at a step, it is incorrect to use the << 141 // NOTE: use GetTotalEnergyDeposit() to obtain energy loss in material 138 // deposition in media during the step, << 139 // be produced. For energy deposition us << 140 142 141 inline void InitializeStep(G4Track* aValue << 143 void InitializeStep(G4Track* aValue); 142 // Initialize contents of G4Step 144 // Initialize contents of G4Step 143 145 144 inline void UpdateTrack(); << 146 void UpdateTrack(); 145 // Update track by using G4Step informat 147 // Update track by using G4Step information 146 148 147 inline void CopyPostToPreStepPoint(); << 149 void CopyPostToPreStepPoint(); 148 // Copy PostStepPoint to PreStepPoint 150 // Copy PostStepPoint to PreStepPoint 149 151 >> 152 G4Polyline* CreatePolyline() const; >> 153 // For visualization >> 154 150 inline void SetPointerToVectorOfAuxiliaryP 155 inline void SetPointerToVectorOfAuxiliaryPoints(std::vector<G4ThreeVector>* vec); 151 inline std::vector<G4ThreeVector>* GetPoin 156 inline std::vector<G4ThreeVector>* GetPointerToVectorOfAuxiliaryPoints() const; 152 // Auxiliary points modifiers 157 // Auxiliary points modifiers 153 158 154 // --- Secondary buckets --- 159 // --- Secondary buckets --- 155 160 156 inline std::size_t GetNumberOfSecondariesI << 161 std::size_t GetNumberOfSecondariesInCurrentStep() const; 157 // Secondaries in the current step 162 // Secondaries in the current step 158 163 159 const std::vector<const G4Track*>* GetSeco 164 const std::vector<const G4Track*>* GetSecondaryInCurrentStep() const; 160 165 161 inline const G4TrackVector* GetSecondary() << 166 const G4TrackVector* GetSecondary() const; 162 inline G4TrackVector* GetfSecondary(); << 167 G4TrackVector* GetfSecondary(); 163 inline G4TrackVector* NewSecondaryVector() << 168 G4TrackVector* NewSecondaryVector(); 164 // NOTE: Secondary bucket of the Step co 169 // NOTE: Secondary bucket of the Step contains 165 // all secondaries during tracking 170 // all secondaries during tracking the current track 166 // (i.e. NOT secondaries produced 171 // (i.e. NOT secondaries produced in the current step) 167 // all these methods give same object (i 172 // all these methods give same object (i.e. G4TrackVector ) 168 // but 2nd one will create bucket in add 173 // but 2nd one will create bucket in addition 169 174 170 inline void DeleteSecondaryVector(); << 175 void DeleteSecondaryVector(); 171 // Just delete secondary bucket 176 // Just delete secondary bucket 172 // NOTE: G4Track objects inside the buck 177 // NOTE: G4Track objects inside the bucket are not deleted 173 178 174 inline void SetSecondary(G4TrackVector* va << 179 void SetSecondary(G4TrackVector* value); 175 // Add secondary tracks to the bucket 180 // Add secondary tracks to the bucket 176 181 177 protected: 182 protected: 178 183 179 G4double fTotalEnergyDeposit = 0.0; 184 G4double fTotalEnergyDeposit = 0.0; 180 // Accumulated total energy deposit in t 185 // Accumulated total energy deposit in the current Step 181 186 182 G4double fNonIonizingEnergyDeposit = 0.0; 187 G4double fNonIonizingEnergyDeposit = 0.0; 183 // Accumulated non-ionizing energy deposi 188 // Accumulated non-ionizing energy deposit in the current Step 184 189 185 private: 190 private: 186 191 187 G4StepPoint* fpPreStepPoint = nullptr; 192 G4StepPoint* fpPreStepPoint = nullptr; 188 G4StepPoint* fpPostStepPoint = nullptr; 193 G4StepPoint* fpPostStepPoint = nullptr; 189 G4double fStepLength = 0.0; 194 G4double fStepLength = 0.0; 190 // Step length which may be updated at e 195 // Step length which may be updated at each invocation of 191 // AlongStepDoIt and PostStepDoIt 196 // AlongStepDoIt and PostStepDoIt 192 197 193 G4Track* fpTrack = nullptr; 198 G4Track* fpTrack = nullptr; 194 199 195 G4SteppingControl fpSteppingControlFlag = 200 G4SteppingControl fpSteppingControlFlag = NormalCondition; 196 // A flag to control SteppingManager beh 201 // A flag to control SteppingManager behavior from process 197 202 198 G4bool fFirstStepInVolume = false; 203 G4bool fFirstStepInVolume = false; 199 G4bool fLastStepInVolume = false; 204 G4bool fLastStepInVolume = false; 200 // Flags for initial/last step 205 // Flags for initial/last step 201 206 202 G4TrackVector* fSecondary = nullptr; 207 G4TrackVector* fSecondary = nullptr; 203 // Secondary bucket implemented by using 208 // Secondary bucket implemented by using std::vector of G4Track* 204 209 205 std::size_t nSecondaryByLastStep = 0; 210 std::size_t nSecondaryByLastStep = 0; 206 // number of secondaries which have been 211 // number of secondaries which have been created by the last step 207 212 208 std::vector<const G4Track*>* secondaryInCu 213 std::vector<const G4Track*>* secondaryInCurrentStep = nullptr; 209 214 210 std::vector<G4ThreeVector>* fpVectorOfAuxi 215 std::vector<G4ThreeVector>* fpVectorOfAuxiliaryPointsPointer = nullptr; 211 }; 216 }; 212 217 213 #include "G4Step.icc" 218 #include "G4Step.icc" 214 219 215 #endif 220 #endif 216 221