Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:13

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 // Author: Mathieu Karamitros
0028 
0029 // The code is developed in the framework of the ESA AO7146
0030 //
0031 // We would be very happy hearing from you, send us your feedback! :)
0032 //
0033 // In order for Geant4-DNA to be maintained and still open-source,
0034 // article citations are crucial. 
0035 // If you use Geant4-DNA chemistry and you publish papers about your software, 
0036 // in addition to the general paper on Geant4-DNA:
0037 //
0038 // Int. J. Model. Simul. Sci. Comput. 1 (2010) 157–178
0039 //
0040 // we would be very happy if you could please also cite the following
0041 // reference papers on chemistry:
0042 //
0043 // J. Comput. Phys. 274 (2014) 841-882
0044 // Prog. Nucl. Sci. Tec. 2 (2011) 503-508 
0045 
0046 #ifndef G4TRACKINGINFORMATION_HH
0047 #define G4TRACKINGINFORMATION_HH
0048 
0049 #include "globals.hh"
0050 #include <vector>
0051 #include <map>
0052 #include "G4StepStatus.hh"
0053 #include "G4ThreeVector.hh"
0054 #include "G4TouchableHandle.hh"
0055 #include "G4TrackState.hh"
0056 #include "G4memory.hh"
0057 #include "G4ITStepProcessorState_Lock.hh"
0058 
0059 class G4ITStepProcessor;
0060 
0061 using  G4SelectedAtRestDoItVector = std::vector<G4int>;
0062 using  G4SelectedAlongStepDoItVector = std::vector<G4int>;
0063 using  G4SelectedPostStepDoItVector = std::vector<G4int>;
0064 using  G4SelectedPostStepAtTimeDoItVector = std::vector<G4int>;
0065 
0066 class G4Trajectory_Lock;
0067 class G4Track;
0068 struct G4ProcessState_Lock;
0069 class G4TrackingInformation;
0070 class G4SaveNavigatorState_Lock;
0071 struct G4ITNavigatorState_Lock;
0072 
0073 /** The class G4TrackingInformation (hold by G4IT)
0074  *  emcompasses processes informations computed
0075  *  at the PS/AS/AtRest/InteractionLength stage,
0076  *  and also, the selection of processes for the
0077  *  given step.
0078  */
0079 class G4TrackingInformation
0080 {
0081 public:
0082   G4TrackingInformation();
0083   ~G4TrackingInformation();
0084 
0085   //________________________________________________
0086   /** If the track is the one having the minimum step time,
0087    *  then it "leads" the step. It will interact will all the
0088    *  other tracks will be transported.
0089    */
0090   inline bool IsLeadingStep()
0091   {
0092     return fStepLeader;
0093   }
0094   inline void SetLeadingStep(bool value)
0095   {
0096     fStepLeader = value;
0097   }
0098 
0099   //________________________________________________
0100   /** Every process should store the information
0101    * computed at the InteractionLegth stage in the track.
0102    */
0103 
0104   G4shared_ptr<G4ProcessState_Lock> GetProcessState(size_t index);
0105 
0106   inline void RecordProcessState(G4shared_ptr<G4ProcessState_Lock>,
0107                                  size_t index);
0108 
0109   //___________________________________________________
0110 
0111   void SetStepProcessorState(G4ITStepProcessorState_Lock*);
0112   G4ITStepProcessorState_Lock* GetStepProcessorState();
0113 
0114   /*
0115    std::map<int,G4VTrackStateHandle> fTrackStates;
0116    std::map<void*,G4VTrackStateHandle> fMultipleTrackStates;
0117 
0118    void SetTrackState(void* adress, G4VTrackStateHandle state)
0119    {
0120    fMultipleTrackStates[adress] = state;
0121    }
0122    G4VTrackStateHandle GetTrackState(void* adress)
0123    {
0124    return fMultipleTrackStates[adress];
0125    }
0126 
0127    void SetTrackState(G4VTrackStateHandle state)
0128    {
0129    fTrackStates[state->GetID()] = state;
0130    }
0131    template<typename T> G4VTrackStateHandle GetTrackState()
0132    {
0133    return fTrackStates[G4TrackStateID<T>::GetID()] ;
0134    }
0135    */
0136 
0137   G4TrackStateManager& GetTrackStateManager()
0138   {
0139     return fTrackStateManager;
0140   }
0141   /*
0142    G4TrackStateManager& GetTrackStateManager() const
0143    {
0144    return fTrackStateManager;
0145    }
0146    */
0147   inline G4Trajectory_Lock* GetTrajectory_Lock()
0148   {
0149     return fpTrajectory_Lock;
0150   }
0151 
0152   inline void SetTrajectory_Lock(G4Trajectory_Lock* trajLock)
0153   {
0154     fpTrajectory_Lock = trajLock;
0155   }
0156 
0157   void RecordCurrentPositionNTime(G4Track*);
0158   inline const G4ThreeVector& GetPreStepPosition() const;
0159   inline G4double GetPreStepLocalTime() const;
0160   inline G4double GetPreStepGlobalTime() const;
0161 
0162   inline void SetNavigatorState(G4ITNavigatorState_Lock *);
0163   inline G4ITNavigatorState_Lock* GetNavigatorState() const;
0164 
0165   //-------------
0166 protected:
0167   //-------------
0168   friend class G4ITStepProcessor;
0169   //_______________________________________________________
0170   G4bool fStepLeader{false};
0171   //_______________________________________________________
0172   G4Trajectory_Lock* fpTrajectory_Lock;
0173 
0174   G4TrackStateManager fTrackStateManager;
0175 
0176   //_______________________________________________________
0177   G4ThreeVector fRecordedTrackPosition;
0178   G4double fRecordedTrackLocalTime;
0179   G4double fRecordedTrackGlobalTime;
0180 
0181   //_______________________________________________________
0182   G4ITNavigatorState_Lock* fNavigatorState;
0183 //    G4SaveNavigatorState_Lock* fNavigatorState;
0184 
0185 //_______________________________________________________
0186   /** Holds the information related to processes
0187    *  Indexed on GetPhysIntVector
0188    * (cf. G4ITStepProcessor header)
0189    */
0190 //    std::vector<G4ProcessState_Lock*> fProcessState;
0191   std::vector<G4shared_ptr<G4ProcessState_Lock> > fProcessState;
0192 
0193   //_______________________________________________________
0194   G4ITStepProcessorState_Lock* fpStepProcessorState{nullptr};
0195 
0196   //_______________________________________________________
0197   /** Copy constructor
0198    *  \param other Object to copy from
0199    */
0200   G4TrackingInformation(const G4TrackingInformation& other);
0201 
0202   /** Assignment operator
0203    *  \param other Object to assign from
0204    *  \return A reference to this
0205    */
0206   G4TrackingInformation& operator=(const G4TrackingInformation& other);
0207 };
0208 
0209 inline
0210 void G4TrackingInformation::SetStepProcessorState(G4ITStepProcessorState_Lock* state)
0211 {
0212   fpStepProcessorState = state;
0213 }
0214 
0215 inline G4ITStepProcessorState_Lock* G4TrackingInformation::GetStepProcessorState()
0216 {
0217   return fpStepProcessorState;
0218 }
0219 /*
0220  inline void G4TrackingInformation::RecordProcessState(G4ProcessState_Lock* state,
0221  size_t index)
0222  {
0223  // G4cout << "G4TrackingInformation::RecordProcessState" << G4endl;
0224  fProcessState[index] = state;
0225  }*/
0226 
0227 inline
0228 void G4TrackingInformation::RecordProcessState(G4shared_ptr<G4ProcessState_Lock> state,
0229                                                size_t index)
0230 {
0231   // G4cout << "G4TrackingInformation::RecordProcessState" << G4endl;
0232   fProcessState[index] = state;
0233 }
0234 
0235 inline G4double G4TrackingInformation::GetPreStepGlobalTime() const
0236 {
0237   return fRecordedTrackGlobalTime;
0238 }
0239 
0240 inline G4double G4TrackingInformation::GetPreStepLocalTime() const
0241 {
0242   return fRecordedTrackLocalTime;
0243 }
0244 
0245 inline const G4ThreeVector& G4TrackingInformation::GetPreStepPosition() const
0246 {
0247   return fRecordedTrackPosition;
0248 }
0249 
0250 inline void G4TrackingInformation::SetNavigatorState(G4ITNavigatorState_Lock* state)
0251 {
0252   // G4cout << "Set Navigator state : " << state << G4endl;
0253   fNavigatorState = state;
0254 }
0255 
0256 inline G4ITNavigatorState_Lock* G4TrackingInformation::GetNavigatorState() const
0257 {
0258   return fNavigatorState;
0259 }
0260 
0261 #endif // G4TRACKINGINFORMATION_HH