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 <stdlib.h> // 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 << 78 // Pre-Step points 81 // Pre-Step points 79 // If Set method is invoked, the previou << 82 80 // If Reset method is invoked, the previ << 83 G4StepPoint* GetPostStepPoint() const; 81 // but its pointer is returned. Thus it' << 84 void SetPostStepPoint(G4StepPoint* value); 82 // properly delete it. << 83 << 84 inline G4StepPoint* GetPostStepPoint() con << 85 inline void SetPostStepPoint(G4StepPoint* << 86 inline G4StepPoint* ResetPostStepPoint(G4S << 87 // Post-Step points 85 // Post-Step points 88 // If Set method is invoked, the previou << 89 // If Reset method is invoked, the previ << 90 // but its pointer is returned. Thus it' << 91 // properly delete it. << 92 86 93 inline G4double GetStepLength() const; << 87 G4double GetStepLength() const; 94 inline void SetStepLength(G4double value); << 88 void SetStepLength(G4double value); 95 // Before the end of the AlongStepDoIt l 89 // Before the end of the AlongStepDoIt loop, StepLength keeps 96 // the initial value which is determined 90 // the initial value which is determined by the shortest geometrical Step 97 // proposed by a physics process. After 91 // proposed by a physics process. After finishing the AlongStepDoIt, 98 // it will be set equal to 'StepLength' 92 // it will be set equal to 'StepLength' in G4Step 99 93 100 inline G4double GetTotalEnergyDeposit() co << 94 G4double GetTotalEnergyDeposit() const; 101 inline void SetTotalEnergyDeposit(G4double << 95 void SetTotalEnergyDeposit(G4double value); 102 // Total energy deposit 96 // Total energy deposit 103 97 104 inline G4double GetNonIonizingEnergyDeposi << 98 G4double GetNonIonizingEnergyDeposit() const; 105 inline void SetNonIonizingEnergyDeposit(G4 << 99 void SetNonIonizingEnergyDeposit(G4double value); 106 // Total non-ionizing energy deposit 100 // Total non-ionizing energy deposit 107 101 108 inline G4SteppingControl GetControlFlag() << 102 G4SteppingControl GetControlFlag() const; 109 inline void SetControlFlag(G4SteppingContr << 103 void SetControlFlag(G4SteppingControl StepControlFlag); 110 // Control flag for stepping 104 // Control flag for stepping 111 105 112 inline void AddTotalEnergyDeposit(G4double << 106 void AddTotalEnergyDeposit(G4double value); 113 inline void ResetTotalEnergyDeposit(); << 107 void ResetTotalEnergyDeposit(); 114 // Manipulation of total energy deposit 108 // Manipulation of total energy deposit 115 109 116 inline void AddNonIonizingEnergyDeposit(G4 << 110 void AddNonIonizingEnergyDeposit(G4double value); 117 inline void ResetNonIonizingEnergyDeposit( << 111 void ResetNonIonizingEnergyDeposit(); 118 // Manipulation of non-ionizing energy d 112 // Manipulation of non-ionizing energy deposit 119 113 120 inline G4bool IsFirstStepInVolume() const; << 114 G4bool IsFirstStepInVolume() const; 121 inline G4bool IsLastStepInVolume() const; << 115 G4bool IsLastStepInVolume() const; 122 116 123 inline void SetFirstStepFlag(); << 117 void SetFirstStepFlag(); 124 inline void ClearFirstStepFlag(); << 118 void ClearFirstStepFlag(); 125 inline void SetLastStepFlag(); << 119 void SetLastStepFlag(); 126 inline void ClearLastStepFlag(); << 120 void ClearLastStepFlag(); 127 // Get/Set/Clear flag for initial/last s 121 // Get/Set/Clear flag for initial/last step 128 // NOTE: flags are not used 122 // NOTE: flags are not used 129 123 130 inline G4ThreeVector GetDeltaPosition() co << 124 G4ThreeVector GetDeltaPosition() const; 131 inline G4double GetDeltaTime() const; << 125 G4double GetDeltaTime() const; 132 // Difference of position, time, momentu 126 // Difference of position, time, momentum and energy 133 127 134 inline G4ThreeVector GetDeltaMomentum() co << 128 G4ThreeVector GetDeltaMomentum() const; 135 inline G4double GetDeltaEnergy() const; << 129 G4double GetDeltaEnergy() const; 136 // These methods provide difference betw << 130 // These methods will be deleted 137 // at a step, it is incorrect to use the << 131 // NOTE: use GetTotalEnergyDeposit() to obtain energy loss in material 138 // deposition in media during the step, << 139 // be produced. For energy deposition us << 140 132 141 inline void InitializeStep(G4Track* aValue << 133 void InitializeStep(G4Track* aValue); 142 // Initialize contents of G4Step 134 // Initialize contents of G4Step 143 135 144 inline void UpdateTrack(); << 136 void UpdateTrack(); 145 // Update track by using G4Step informat 137 // Update track by using G4Step information 146 138 147 inline void CopyPostToPreStepPoint(); << 139 void CopyPostToPreStepPoint(); 148 // Copy PostStepPoint to PreStepPoint 140 // Copy PostStepPoint to PreStepPoint 149 141 >> 142 G4Polyline* CreatePolyline() const; >> 143 // For visualization >> 144 150 inline void SetPointerToVectorOfAuxiliaryP 145 inline void SetPointerToVectorOfAuxiliaryPoints(std::vector<G4ThreeVector>* vec); 151 inline std::vector<G4ThreeVector>* GetPoin 146 inline std::vector<G4ThreeVector>* GetPointerToVectorOfAuxiliaryPoints() const; 152 // Auxiliary points modifiers 147 // Auxiliary points modifiers 153 148 154 // --- Secondary buckets --- 149 // --- Secondary buckets --- 155 150 156 inline std::size_t GetNumberOfSecondariesI << 151 std::size_t GetNumberOfSecondariesInCurrentStep() const; 157 // Secondaries in the current step 152 // Secondaries in the current step 158 153 159 const std::vector<const G4Track*>* GetSeco 154 const std::vector<const G4Track*>* GetSecondaryInCurrentStep() const; 160 155 161 inline const G4TrackVector* GetSecondary() << 156 const G4TrackVector* GetSecondary() const; 162 inline G4TrackVector* GetfSecondary(); << 157 G4TrackVector* GetfSecondary(); 163 inline G4TrackVector* NewSecondaryVector() << 158 G4TrackVector* NewSecondaryVector(); 164 // NOTE: Secondary bucket of the Step co 159 // NOTE: Secondary bucket of the Step contains 165 // all secondaries during tracking 160 // all secondaries during tracking the current track 166 // (i.e. NOT secondaries produced 161 // (i.e. NOT secondaries produced in the current step) 167 // all these methods give same object (i 162 // all these methods give same object (i.e. G4TrackVector ) 168 // but 2nd one will create bucket in add 163 // but 2nd one will create bucket in addition 169 164 170 inline void DeleteSecondaryVector(); << 165 void DeleteSecondaryVector(); 171 // Just delete secondary bucket 166 // Just delete secondary bucket 172 // NOTE: G4Track objects inside the buck 167 // NOTE: G4Track objects inside the bucket are not deleted 173 168 174 inline void SetSecondary(G4TrackVector* va << 169 void SetSecondary(G4TrackVector* value); 175 // Add secondary tracks to the bucket 170 // Add secondary tracks to the bucket 176 171 177 protected: 172 protected: 178 173 179 G4double fTotalEnergyDeposit = 0.0; 174 G4double fTotalEnergyDeposit = 0.0; 180 // Accumulated total energy deposit in t 175 // Accumulated total energy deposit in the current Step 181 176 182 G4double fNonIonizingEnergyDeposit = 0.0; 177 G4double fNonIonizingEnergyDeposit = 0.0; 183 // Accumulated non-ionizing energy deposi 178 // Accumulated non-ionizing energy deposit in the current Step 184 179 185 private: 180 private: 186 181 187 G4StepPoint* fpPreStepPoint = nullptr; 182 G4StepPoint* fpPreStepPoint = nullptr; 188 G4StepPoint* fpPostStepPoint = nullptr; 183 G4StepPoint* fpPostStepPoint = nullptr; 189 G4double fStepLength = 0.0; 184 G4double fStepLength = 0.0; 190 // Step length which may be updated at e 185 // Step length which may be updated at each invocation of 191 // AlongStepDoIt and PostStepDoIt 186 // AlongStepDoIt and PostStepDoIt 192 187 193 G4Track* fpTrack = nullptr; 188 G4Track* fpTrack = nullptr; 194 189 195 G4SteppingControl fpSteppingControlFlag = 190 G4SteppingControl fpSteppingControlFlag = NormalCondition; 196 // A flag to control SteppingManager beh 191 // A flag to control SteppingManager behavior from process 197 192 198 G4bool fFirstStepInVolume = false; 193 G4bool fFirstStepInVolume = false; 199 G4bool fLastStepInVolume = false; 194 G4bool fLastStepInVolume = false; 200 // Flags for initial/last step 195 // Flags for initial/last step 201 196 202 G4TrackVector* fSecondary = nullptr; 197 G4TrackVector* fSecondary = nullptr; 203 // Secondary bucket implemented by using 198 // Secondary bucket implemented by using std::vector of G4Track* 204 199 205 std::size_t nSecondaryByLastStep = 0; 200 std::size_t nSecondaryByLastStep = 0; 206 // number of secondaries which have been 201 // number of secondaries which have been created by the last step 207 202 208 std::vector<const G4Track*>* secondaryInCu 203 std::vector<const G4Track*>* secondaryInCurrentStep = nullptr; 209 204 210 std::vector<G4ThreeVector>* fpVectorOfAuxi 205 std::vector<G4ThreeVector>* fpVectorOfAuxiliaryPointsPointer = nullptr; 211 }; 206 }; 212 207 213 #include "G4Step.icc" 208 #include "G4Step.icc" 214 209 215 #endif 210 #endif 216 211