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 // 27 // Author: Mathieu Karamitros 28 29 // The code is developed in the framework of the ESA AO7146 30 // 31 // We would be very happy hearing from you, send us your feedback! :) 32 // 33 // In order for Geant4-DNA to be maintained and still open-source, 34 // article citations are crucial. 35 // If you use Geant4-DNA chemistry and you publish papers about your software, 36 // in addition to the general paper on Geant4-DNA: 37 // 38 // Int. J. Model. Simul. Sci. Comput. 1 (2010) 157–178 39 // 40 // we would be very happy if you could please also cite the following 41 // reference papers on chemistry: 42 // 43 // J. Comput. Phys. 274 (2014) 841-882 44 // Prog. Nucl. Sci. Tec. 2 (2011) 503-508 45 46 #ifndef G4TRACKINGINFORMATION_HH 47 #define G4TRACKINGINFORMATION_HH 48 49 #include "globals.hh" 50 #include <vector> 51 #include <map> 52 #include "G4StepStatus.hh" 53 #include "G4ThreeVector.hh" 54 #include "G4TouchableHandle.hh" 55 #include "G4TrackState.hh" 56 #include "G4memory.hh" 57 #include "G4ITStepProcessorState_Lock.hh" 58 59 class G4ITStepProcessor; 60 61 using G4SelectedAtRestDoItVector = std::vector<G4int>; 62 using G4SelectedAlongStepDoItVector = std::vector<G4int>; 63 using G4SelectedPostStepDoItVector = std::vector<G4int>; 64 using G4SelectedPostStepAtTimeDoItVector = std::vector<G4int>; 65 66 class G4Trajectory_Lock; 67 class G4Track; 68 struct G4ProcessState_Lock; 69 class G4TrackingInformation; 70 class G4SaveNavigatorState_Lock; 71 struct G4ITNavigatorState_Lock; 72 73 /** The class G4TrackingInformation (hold by G4IT) 74 * emcompasses processes informations computed 75 * at the PS/AS/AtRest/InteractionLength stage, 76 * and also, the selection of processes for the 77 * given step. 78 */ 79 class G4TrackingInformation 80 { 81 public: 82 G4TrackingInformation(); 83 ~G4TrackingInformation(); 84 85 //________________________________________________ 86 /** If the track is the one having the minimum step time, 87 * then it "leads" the step. It will interact will all the 88 * other tracks will be transported. 89 */ 90 inline bool IsLeadingStep() 91 { 92 return fStepLeader; 93 } 94 inline void SetLeadingStep(bool value) 95 { 96 fStepLeader = value; 97 } 98 99 //________________________________________________ 100 /** Every process should store the information 101 * computed at the InteractionLegth stage in the track. 102 */ 103 104 G4shared_ptr<G4ProcessState_Lock> GetProcessState(size_t index); 105 106 inline void RecordProcessState(G4shared_ptr<G4ProcessState_Lock>, 107 size_t index); 108 109 //___________________________________________________ 110 111 void SetStepProcessorState(G4ITStepProcessorState_Lock*); 112 G4ITStepProcessorState_Lock* GetStepProcessorState(); 113 114 /* 115 std::map<int,G4VTrackStateHandle> fTrackStates; 116 std::map<void*,G4VTrackStateHandle> fMultipleTrackStates; 117 118 void SetTrackState(void* adress, G4VTrackStateHandle state) 119 { 120 fMultipleTrackStates[adress] = state; 121 } 122 G4VTrackStateHandle GetTrackState(void* adress) 123 { 124 return fMultipleTrackStates[adress]; 125 } 126 127 void SetTrackState(G4VTrackStateHandle state) 128 { 129 fTrackStates[state->GetID()] = state; 130 } 131 template<typename T> G4VTrackStateHandle GetTrackState() 132 { 133 return fTrackStates[G4TrackStateID<T>::GetID()] ; 134 } 135 */ 136 137 G4TrackStateManager& GetTrackStateManager() 138 { 139 return fTrackStateManager; 140 } 141 /* 142 G4TrackStateManager& GetTrackStateManager() const 143 { 144 return fTrackStateManager; 145 } 146 */ 147 inline G4Trajectory_Lock* GetTrajectory_Lock() 148 { 149 return fpTrajectory_Lock; 150 } 151 152 inline void SetTrajectory_Lock(G4Trajectory_Lock* trajLock) 153 { 154 fpTrajectory_Lock = trajLock; 155 } 156 157 void RecordCurrentPositionNTime(G4Track*); 158 inline const G4ThreeVector& GetPreStepPosition() const; 159 inline G4double GetPreStepLocalTime() const; 160 inline G4double GetPreStepGlobalTime() const; 161 162 inline void SetNavigatorState(G4ITNavigatorState_Lock *); 163 inline G4ITNavigatorState_Lock* GetNavigatorState() const; 164 165 //------------- 166 protected: 167 //------------- 168 friend class G4ITStepProcessor; 169 //_______________________________________________________ 170 G4bool fStepLeader{false}; 171 //_______________________________________________________ 172 G4Trajectory_Lock* fpTrajectory_Lock; 173 174 G4TrackStateManager fTrackStateManager; 175 176 //_______________________________________________________ 177 G4ThreeVector fRecordedTrackPosition; 178 G4double fRecordedTrackLocalTime; 179 G4double fRecordedTrackGlobalTime; 180 181 //_______________________________________________________ 182 G4ITNavigatorState_Lock* fNavigatorState; 183 // G4SaveNavigatorState_Lock* fNavigatorState; 184 185 //_______________________________________________________ 186 /** Holds the information related to processes 187 * Indexed on GetPhysIntVector 188 * (cf. G4ITStepProcessor header) 189 */ 190 // std::vector<G4ProcessState_Lock*> fProcessState; 191 std::vector<G4shared_ptr<G4ProcessState_Lock> > fProcessState; 192 193 //_______________________________________________________ 194 G4ITStepProcessorState_Lock* fpStepProcessorState{nullptr}; 195 196 //_______________________________________________________ 197 /** Copy constructor 198 * \param other Object to copy from 199 */ 200 G4TrackingInformation(const G4TrackingInformation& other); 201 202 /** Assignment operator 203 * \param other Object to assign from 204 * \return A reference to this 205 */ 206 G4TrackingInformation& operator=(const G4TrackingInformation& other); 207 }; 208 209 inline 210 void G4TrackingInformation::SetStepProcessorState(G4ITStepProcessorState_Lock* state) 211 { 212 fpStepProcessorState = state; 213 } 214 215 inline G4ITStepProcessorState_Lock* G4TrackingInformation::GetStepProcessorState() 216 { 217 return fpStepProcessorState; 218 } 219 /* 220 inline void G4TrackingInformation::RecordProcessState(G4ProcessState_Lock* state, 221 size_t index) 222 { 223 // G4cout << "G4TrackingInformation::RecordProcessState" << G4endl; 224 fProcessState[index] = state; 225 }*/ 226 227 inline 228 void G4TrackingInformation::RecordProcessState(G4shared_ptr<G4ProcessState_Lock> state, 229 size_t index) 230 { 231 fProcessState[index] = std::move(state); 232 } 233 234 inline G4double G4TrackingInformation::GetPreStepGlobalTime() const 235 { 236 return fRecordedTrackGlobalTime; 237 } 238 239 inline G4double G4TrackingInformation::GetPreStepLocalTime() const 240 { 241 return fRecordedTrackLocalTime; 242 } 243 244 inline const G4ThreeVector& G4TrackingInformation::GetPreStepPosition() const 245 { 246 return fRecordedTrackPosition; 247 } 248 249 inline void G4TrackingInformation::SetNavigatorState(G4ITNavigatorState_Lock* state) 250 { 251 // G4cout << "Set Navigator state : " << state << G4endl; 252 fNavigatorState = state; 253 } 254 255 inline G4ITNavigatorState_Lock* G4TrackingInformation::GetNavigatorState() const 256 { 257 return fNavigatorState; 258 } 259 260 #endif // G4TRACKINGINFORMATION_HH 261