Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:22:01

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef G4MAIN_PHG4TRACKUSERINFOV1_H
0004 #define G4MAIN_PHG4TRACKUSERINFOV1_H
0005 
0006 #include <Geant4/G4VUserTrackInformation.hh>
0007 
0008 #include <iostream>
0009 #include <ostream>  // for operator<<, basic_ostre...
0010 
0011 class PHG4Shower;
0012 
0013 // Made this with "V1" in the name in case we ever want to inherit from
0014 // it with other versions...
0015 
0016 // Use the UserTrackInformation to attach a flag telling the framework
0017 // to save the track in the truth output.  Other uses might include keeping
0018 // track of the
0019 
0020 class PHG4TrackUserInfoV1 : public G4VUserTrackInformation
0021 {
0022  public:
0023   PHG4TrackUserInfoV1()
0024     : G4VUserTrackInformation("TrackUserInfoV1")
0025   {
0026   }
0027 
0028   ~PHG4TrackUserInfoV1() override = default;
0029 
0030   void Print() const override
0031   {
0032     std::cout << "PHG4TrackUserInfoV1: " << std::endl;
0033     std::cout << "   UserTrackId = " << usertrackid << std::endl;
0034     std::cout << "   UserParentId = " << userparentid << std::endl;
0035     std::cout << "   UserPrimaryId = " << userprimaryid << std::endl;
0036     std::cout << "   Wanted = " << wanted << std::endl;
0037     std::cout << "   Keep = " << keep << std::endl;
0038   }
0039 
0040   void SetUserTrackId(const int val) { usertrackid = val; }
0041   int GetUserTrackId() const { return usertrackid; }
0042 
0043   void SetUserParentId(const int val) { userparentid = val; }
0044   int GetUserParentId() const { return userparentid; }
0045 
0046   void SetUserPrimaryId(const int val) { userprimaryid = val; }
0047   int GetUserPrimaryId() const { return userprimaryid; }
0048 
0049   void SetWanted(const int val) { wanted = val; }
0050   int GetWanted() const { return wanted; }
0051 
0052   void SetKeep(const int val) { keep = val; }
0053   int GetKeep() const { return keep; }
0054 
0055   void SetShower(PHG4Shower* ptr) { shower = ptr; }
0056   PHG4Shower* GetShower() const { return shower; }
0057 
0058  private:
0059   int usertrackid{0};
0060   int userparentid{0};
0061   int userprimaryid{0};
0062   int wanted{0};
0063   int keep{0};
0064   PHG4Shower* shower{nullptr};
0065 };
0066 
0067 // Utility function to wrap up the operations involved with adding user info
0068 // to the track.
0069 class G4Track;
0070 
0071 namespace PHG4TrackUserInfo
0072 {
0073   void SetUserTrackId(G4Track* track, const int usertrackid);
0074   void SetUserParentId(G4Track* track, const int userparentid);
0075   void SetUserPrimaryId(G4Track* track, const int userprimaryid);
0076   void SetWanted(G4Track* track, const int trkid);
0077   void SetKeep(G4Track* track, const int trkid);
0078   void SetShower(G4Track* track, PHG4Shower* shower);
0079 }  // namespace PHG4TrackUserInfo
0080 
0081 #endif