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 // This class represents the Step of a particle being tracked. 30 // This class represents the Step of a particl << 30 // It includes information of 31 // It includes information of: << 32 // 1) List of Step points which compose th 31 // 1) List of Step points which compose the Step, 33 // 2) static information of particle which << 32 // 2) static information of particle which generated the >> 33 // 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 // Contact: 38 // Katsuya Amako (e-mail: Katsuya.Amako@kek << 38 // Questions and comments to this code should be sent to 39 // Takashi Sasaki (e-mail: Takashi.Sasaki@ke << 39 // Katsuya Amako (e-mail: Katsuya.Amako@kek.jp) 40 // Revisions: << 40 // Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp) 41 // Hisaya Kurashige, 1998-2007 << 41 // 42 // ------------------------------------------- << 42 // --------------------------------------------------------------- >> 43 // Modified for the new G4ParticleChange 12 Mar. 1998 H.Kurahige >> 44 // Correct treatment of touchable in G4Step::UpdateTrack >> 45 // 12 May. 1998 H.Kurashige >> 46 // --------------------------------------------------------------- >> 47 // Separate implementation of inline functions inti G4Step.icc >> 48 // Add updating mass/charge 6 Oct. 1999 H.Kurashige >> 49 // add nonIonizingEnergyLoss 26 Mar. 2007 H.Kurashige >> 50 // --------------------------------------------------------------- 43 #ifndef G4Step_hh 51 #ifndef G4Step_hh 44 #define G4Step_hh 1 52 #define G4Step_hh 1 45 53 46 #include <cstdlib> // Include fr << 54 #include <stdlib.h> // Include from 'system' 47 #include <cmath> // Include fr << 55 #include <cmath> // Include from 'system' 48 #include "G4ios.hh" // Include fr << 56 #include "G4ios.hh" // Include from 'system' 49 #include <iomanip> // Include fr << 57 #include <iomanip> // Include from 'system' 50 #include "globals.hh" // Include fr << 58 #include "globals.hh" // Include from 'global' 51 #include "G4ThreeVector.hh" // Include fr << 59 #include "G4ThreeVector.hh" // Include from 'global' 52 #include "G4VPhysicalVolume.hh" // Include fr << 60 #include "G4VPhysicalVolume.hh" // Include from 'geometry' 53 #include "G4StepPoint.hh" // Include fr << 61 #include "G4StepPoint.hh" // Include from 'track' 54 #include "G4StepStatus.hh" // Include fr << 62 #include "G4StepStatus.hh" // Include from 'track' 55 #include "G4TrackVector.hh" // Include fr << 63 class G4Polyline; // Forward declaration. 56 << 64 class G4Track; // Forward declaration. 57 class G4Polyline; // Forward de << 65 #include "G4TrackVector.hh" // Include from 'tracking' 58 class G4Track; // Forward de << 59 66 >> 67 //////////// 60 class G4Step 68 class G4Step >> 69 //////////// 61 { 70 { 62 public: << 71 63 G4Step(); << 72 //-------- >> 73 public: >> 74 >> 75 // Constructor/Destrcutor >> 76 G4Step(); 64 ~G4Step(); 77 ~G4Step(); 65 // Constructor/Destructor << 66 78 67 G4Step(const G4Step&); << 79 // Copy Counstructor and assignment operator 68 G4Step& operator=(const G4Step&); << 80 G4Step(const G4Step& ); 69 // Copy Constructor and assignment opera << 81 G4Step & operator=(const G4Step &); 70 << 82 71 inline G4Track* GetTrack() const; << 83 //-------- 72 inline void SetTrack(G4Track* value); << 84 public: // with description 73 // Current track << 85 74 << 86 // Get/Set functions 75 inline G4StepPoint* GetPreStepPoint() cons << 87 76 inline void SetPreStepPoint(G4StepPoint* v << 88 // current track 77 inline G4StepPoint* ResetPreStepPoint(G4St << 89 G4Track* GetTrack() const; 78 // Pre-Step points << 90 void SetTrack(G4Track* value); 79 // If Set method is invoked, the previou << 91 80 // If Reset method is invoked, the previ << 92 // step points 81 // but its pointer is returned. Thus it' << 93 G4StepPoint* GetPreStepPoint() const; 82 // properly delete it. << 94 void SetPreStepPoint(G4StepPoint* value); 83 << 95 84 inline G4StepPoint* GetPostStepPoint() con << 96 G4StepPoint* GetPostStepPoint() const; 85 inline void SetPostStepPoint(G4StepPoint* << 97 void SetPostStepPoint(G4StepPoint* value); 86 inline G4StepPoint* ResetPostStepPoint(G4S << 98 87 // Post-Step points << 99 // step length 88 // If Set method is invoked, the previou << 100 G4double GetStepLength() const; 89 // If Reset method is invoked, the previ << 101 void SetStepLength(G4double value); 90 // but its pointer is returned. Thus it' << 102 // Before the end of the AlongStepDoIt loop,StepLength keeps 91 // properly delete it. << 103 // the initial value which is determined by the shortest geometrical Step 92 << 104 // proposed by a physics process. After finishing the AlongStepDoIt, 93 inline G4double GetStepLength() const; << 105 // it will be set equal to 'StepLength' in G4Step. 94 inline void SetStepLength(G4double value); << 106 95 // Before the end of the AlongStepDoIt l << 107 // total energy deposit 96 // the initial value which is determined << 108 G4double GetTotalEnergyDeposit() const; 97 // proposed by a physics process. After << 109 void SetTotalEnergyDeposit(G4double value); 98 // it will be set equal to 'StepLength' << 110 99 << 111 // total non-ionizing energy deposit 100 inline G4double GetTotalEnergyDeposit() co << 112 G4double GetNonIonizingEnergyDeposit() const; 101 inline void SetTotalEnergyDeposit(G4double << 113 void SetNonIonizingEnergyDeposit(G4double value); 102 // Total energy deposit << 114 103 << 115 // control flag for stepping 104 inline G4double GetNonIonizingEnergyDeposi << 116 G4SteppingControl GetControlFlag() const; 105 inline void SetNonIonizingEnergyDeposit(G4 << 117 void SetControlFlag(G4SteppingControl StepControlFlag); 106 // Total non-ionizing energy deposit << 118 107 << 119 // manipulation of total energy deposit 108 inline G4SteppingControl GetControlFlag() << 120 void AddTotalEnergyDeposit(G4double value); 109 inline void SetControlFlag(G4SteppingContr << 121 void ResetTotalEnergyDeposit(); 110 // Control flag for stepping << 122 111 << 123 // manipulation of non-ionizing energy deposit 112 inline void AddTotalEnergyDeposit(G4double << 124 void AddNonIonizingEnergyDeposit(G4double value); 113 inline void ResetTotalEnergyDeposit(); << 125 void ResetNonIonizingEnergyDeposit(); 114 // Manipulation of total energy deposit << 126 115 << 116 inline void AddNonIonizingEnergyDeposit(G4 << 117 inline void ResetNonIonizingEnergyDeposit( << 118 // Manipulation of non-ionizing energy d << 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 s << 128 // NOTE: flags are not used << 129 << 130 inline G4ThreeVector GetDeltaPosition() co << 131 inline G4double GetDeltaTime() const; << 132 // Difference of position, time, momentu << 133 << 134 inline G4ThreeVector GetDeltaMomentum() co << 135 inline G4double GetDeltaEnergy() const; << 136 // These methods provide difference betw << 137 // at a step, it is incorrect to use the << 138 // deposition in media during the step, << 139 // be produced. For energy deposition us << 140 << 141 inline void InitializeStep(G4Track* aValue << 142 // Initialize contents of G4Step << 143 << 144 inline void UpdateTrack(); << 145 // Update track by using G4Step informat << 146 << 147 inline void CopyPostToPreStepPoint(); << 148 // Copy PostStepPoint to PreStepPoint << 149 << 150 inline void SetPointerToVectorOfAuxiliaryP << 151 inline std::vector<G4ThreeVector>* GetPoin << 152 // Auxiliary points modifiers << 153 << 154 // --- Secondary buckets --- << 155 << 156 inline std::size_t GetNumberOfSecondariesI << 157 // Secondaries in the current step << 158 << 159 const std::vector<const G4Track*>* GetSeco << 160 << 161 inline const G4TrackVector* GetSecondary() << 162 inline G4TrackVector* GetfSecondary(); << 163 inline G4TrackVector* NewSecondaryVector() << 164 // NOTE: Secondary bucket of the Step co << 165 // all secondaries during tracking << 166 // (i.e. NOT secondaries produced << 167 // all these methods give same object (i << 168 // but 2nd one will create bucket in add << 169 << 170 inline void DeleteSecondaryVector(); << 171 // Just delete secondary bucket << 172 // NOTE: G4Track objects inside the buck << 173 << 174 inline void SetSecondary(G4TrackVector* va << 175 // Add secondary tracks to the bucket << 176 127 177 protected: << 128 // Get/Set/Clear flag for initial/last step >> 129 // NOTE: following flags are not used >> 130 G4bool IsFirstStepInVolume() const; >> 131 G4bool IsLastStepInVolume() const; 178 132 179 G4double fTotalEnergyDeposit = 0.0; << 133 void SetFirstStepFlag(); 180 // Accumulated total energy deposit in t << 134 void ClearFirstStepFlag(); >> 135 void SetLastStepFlag(); >> 136 void ClearLastStepFlag(); 181 137 182 G4double fNonIonizingEnergyDeposit = 0.0; << 138 // difference of position, time, momentum and energy >> 139 G4ThreeVector GetDeltaPosition() const; >> 140 G4double GetDeltaTime() const; >> 141 >> 142 // These methods will be deleted >> 143 // NOTE: use GetTotalEnergyDeposit() to obtain >> 144 // energy loss in the material >> 145 // >> 146 G4ThreeVector GetDeltaMomentum() const; >> 147 G4double GetDeltaEnergy() const; >> 148 >> 149 // Other member functions >> 150 >> 151 void InitializeStep( G4Track* aValue ); >> 152 // initialize contents of G4Step >> 153 >> 154 void UpdateTrack( ); >> 155 // update track by using G4Step information >> 156 >> 157 void CopyPostToPreStepPoint( ); >> 158 // copy PostStepPoint to PreStepPoint >> 159 >> 160 G4Polyline* CreatePolyline () const; >> 161 // for visualization >> 162 >> 163 //----------- >> 164 protected: >> 165 //----------- >> 166 >> 167 // Member data >> 168 >> 169 G4double fTotalEnergyDeposit; >> 170 // Accumulated total energy deposit in the current Step >> 171 >> 172 G4double fNonIonizingEnergyDeposit; 183 // Accumulated non-ionizing energy deposi 173 // Accumulated non-ionizing energy deposit in the current Step 184 174 185 private: << 175 //--------- >> 176 private: >> 177 //--------- >> 178 >> 179 // Member data >> 180 >> 181 G4StepPoint* fpPreStepPoint; >> 182 G4StepPoint* fpPostStepPoint; >> 183 G4double fStepLength; >> 184 // Step length which may be updated at each invocation of >> 185 // AlongStepDoIt and PostStepDoIt >> 186 G4Track* fpTrack; >> 187 // >> 188 G4SteppingControl fpSteppingControlFlag; >> 189 // A flag to control SteppingManager behavior from process >> 190 >> 191 // flag for initial/last step >> 192 G4bool fFirstStepInVolume; >> 193 G4bool fLastStepInVolume; 186 194 187 G4StepPoint* fpPreStepPoint = nullptr; << 195 // Secondary buckets 188 G4StepPoint* fpPostStepPoint = nullptr; << 189 G4double fStepLength = 0.0; << 190 // Step length which may be updated at e << 191 // AlongStepDoIt and PostStepDoIt << 192 196 193 G4Track* fpTrack = nullptr; << 197 public: >> 198 >> 199 // secondaries in the current step >> 200 size_t GetNumberOfSecondariesInCurrentStep() const; >> 201 >> 202 const std::vector<const G4Track*>* GetSecondaryInCurrentStep() const; >> 203 >> 204 // NOTE: Secondary bucket of the Step contains >> 205 // all secondaries during tracking the current track >> 206 // (i.e. NOT secondaries produced in the current step) >> 207 // all following methods give same object (i.e. G4TrackVector ) >> 208 // but 2nd one will create bucket in addition >> 209 const G4TrackVector* GetSecondary() const ; >> 210 G4TrackVector* GetfSecondary(); >> 211 G4TrackVector* NewSecondaryVector(); 194 212 195 G4SteppingControl fpSteppingControlFlag = << 213 // just delete secondary bucket 196 // A flag to control SteppingManager beh << 214 // NOTE: G4Track objects inside the bucket are not deleted >> 215 void DeleteSecondaryVector(); 197 216 198 G4bool fFirstStepInVolume = false; << 217 // Add secondary tracks to the bucket 199 G4bool fLastStepInVolume = false; << 218 void SetSecondary( G4TrackVector* value); 200 // Flags for initial/last step << 201 219 202 G4TrackVector* fSecondary = nullptr; << 220 private: 203 // Secondary bucket implemented by using << 204 221 205 std::size_t nSecondaryByLastStep = 0; << 222 // Secondary bucket implemented by using std::vector of G4Track* 206 // number of secondaries which have been << 223 G4TrackVector* fSecondary; 207 224 208 std::vector<const G4Track*>* secondaryInCu << 225 // number of secondaries which have been created by the last step >> 226 size_t nSecondaryByLastStep; 209 227 210 std::vector<G4ThreeVector>* fpVectorOfAuxi << 228 typedef const G4Track* CT; >> 229 std::vector<CT>* secondaryInCurrentStep; >> 230 >> 231 // Prototyping implementation of smooth representation of curved >> 232 // trajectories. (jacek 30/10/2002) >> 233 >> 234 public: >> 235 // Auxiliary points are ThreeVectors for now; change to >> 236 // G4VAuxiliaryPoints or some such (jacek 30/10/2002) >> 237 void SetPointerToVectorOfAuxiliaryPoints( std::vector<G4ThreeVector>* theNewVectorPointer ) >> 238 { >> 239 fpVectorOfAuxiliaryPointsPointer = theNewVectorPointer; >> 240 } >> 241 std::vector<G4ThreeVector>* GetPointerToVectorOfAuxiliaryPoints() const >> 242 { >> 243 return fpVectorOfAuxiliaryPointsPointer; >> 244 } >> 245 >> 246 private: >> 247 // Explicity including the word "Pointer" in the name as I keep >> 248 // forgetting the * (jacek 30/10/2002) >> 249 std::vector<G4ThreeVector>* fpVectorOfAuxiliaryPointsPointer; 211 }; 250 }; 212 251 213 #include "G4Step.icc" 252 #include "G4Step.icc" >> 253 214 254 215 #endif 255 #endif 216 256