Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:18:11

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     , usertrackid(0)
0026     , userparentid(0)
0027     , userprimaryid(0)
0028     , wanted(0)
0029     , keep(0)
0030     , shower(nullptr)
0031   {
0032   }
0033   ~PHG4TrackUserInfoV1() override {}
0034 
0035   void Print() const override
0036   {
0037     std::cout << "PHG4TrackUserInfoV1: " << std::endl;
0038     std::cout << "   UserTrackId = " << usertrackid << std::endl;
0039     std::cout << "   UserParentId = " << userparentid << std::endl;
0040     std::cout << "   UserPrimaryId = " << userprimaryid << std::endl;
0041     std::cout << "   Wanted = " << wanted << std::endl;
0042     std::cout << "   Keep = " << keep << std::endl;
0043   }
0044 
0045   void SetUserTrackId(const int val) { usertrackid = val; }
0046   int GetUserTrackId() const { return usertrackid; }
0047 
0048   void SetUserParentId(const int val) { userparentid = val; }
0049   int GetUserParentId() const { return userparentid; }
0050 
0051   void SetUserPrimaryId(const int val) { userprimaryid = val; }
0052   int GetUserPrimaryId() const { return userprimaryid; }
0053 
0054   void SetWanted(const int val) { wanted = val; }
0055   int GetWanted() const { return wanted; }
0056 
0057   void SetKeep(const int val) { keep = val; }
0058   int GetKeep() const { return keep; }
0059 
0060   void SetShower(PHG4Shower* ptr) { shower = ptr; }
0061   PHG4Shower* GetShower() const { return shower; }
0062 
0063  private:
0064   int usertrackid;
0065   int userparentid;
0066   int userprimaryid;
0067   int wanted;
0068   int keep;
0069   PHG4Shower* shower;
0070 };
0071 
0072 // Utility function to wrap up the operations involved with adding user info
0073 // to the track.
0074 class G4Track;
0075 
0076 namespace PHG4TrackUserInfo
0077 {
0078   void SetUserTrackId(G4Track* track, const int usertrackid);
0079   void SetUserParentId(G4Track* track, const int userparentid);
0080   void SetUserPrimaryId(G4Track* track, const int userprimaryid);
0081   void SetWanted(G4Track* track, const int wanted);
0082   void SetKeep(G4Track* track, const int keep);
0083   void SetShower(G4Track* track, PHG4Shower* ptr);
0084 }  // namespace PHG4TrackUserInfo
0085 
0086 #endif