Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-03-23 16:00:31

0001 #ifndef SimG4Core_CMSG4TrackInterface_h
0002 #define SimG4Core_CMSG4TrackInterface_h 1
0003 
0004 //
0005 // Package:     SimG4Core/Physics
0006 // Class  :     SimTrackInterface
0007 //
0008 // 10.03.2025   V.Ivantchenko
0009 //
0010 // An interface between Geant4 and CMSSW
0011 
0012 #include "G4ThreadLocalSingleton.hh"
0013 
0014 class G4Track;
0015 
0016 class CMSG4TrackInterface {
0017   friend class G4ThreadLocalSingleton<CMSG4TrackInterface>;
0018 
0019 public:
0020   static CMSG4TrackInterface* instance();
0021 
0022   ~CMSG4TrackInterface();
0023 
0024   const G4Track* getCurrentTrack() { return track_; }
0025 
0026   void setCurrentTrack(const G4Track* p) { track_ = p; }
0027 
0028   int getThreadID() { return threadID_; }
0029 
0030   void setThreadID(int n) { threadID_ = n; }
0031 
0032   CMSG4TrackInterface(CMSG4TrackInterface&) = delete;
0033   CMSG4TrackInterface& operator=(const CMSG4TrackInterface& right) = delete;
0034 
0035 private:
0036   CMSG4TrackInterface();
0037 
0038   static G4ThreadLocal CMSG4TrackInterface* interface_;
0039 
0040   const G4Track* track_{nullptr};
0041   int threadID_{-1};
0042 };
0043 
0044 #endif