EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4TrackUserInfoV1.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4TrackUserInfoV1.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef G4MAIN_PHG4TRACKUSERINFOV1_H
4 #define G4MAIN_PHG4TRACKUSERINFOV1_H
5 
6 #include <Geant4/G4VUserTrackInformation.hh>
7 
8 #include <iostream>
9 #include <ostream> // for operator<<, basic_ostre...
10 
11 class PHG4Shower;
12 
13 // Made this with "V1" in the name in case we ever want to inherit from
14 // it with other versions...
15 
16 // Use the UserTrackInformation to attach a flag telling the framework
17 // to save the track in the truth output. Other uses might include keeping
18 // track of the
19 
20 class PHG4TrackUserInfoV1 : public G4VUserTrackInformation
21 {
22  public:
24  : G4VUserTrackInformation("TrackUserInfoV1")
25  , usertrackid(0)
26  , userparentid(0)
27  , userprimaryid(0)
28  , wanted(0)
29  , keep(0)
30  , shower(nullptr)
31  {
32  }
33  ~PHG4TrackUserInfoV1() override {}
34 
35  void Print() const override
36  {
37  std::cout << "PHG4TrackUserInfoV1: " << std::endl;
38  std::cout << " UserTrackId = " << usertrackid << std::endl;
39  std::cout << " UserParentId = " << userparentid << std::endl;
40  std::cout << " UserPrimaryId = " << userprimaryid << std::endl;
41  std::cout << " Wanted = " << wanted << std::endl;
42  std::cout << " Keep = " << keep << std::endl;
43  }
44 
45  void SetUserTrackId(const int val) { usertrackid = val; }
46  int GetUserTrackId() const { return usertrackid; }
47 
48  void SetUserParentId(const int val) { userparentid = val; }
49  int GetUserParentId() const { return userparentid; }
50 
51  void SetUserPrimaryId(const int val) { userprimaryid = val; }
52  int GetUserPrimaryId() const { return userprimaryid; }
53 
54  void SetWanted(const int val) { wanted = val; }
55  int GetWanted() const { return wanted; }
56 
57  void SetKeep(const int val) { keep = val; }
58  int GetKeep() const { return keep; }
59 
60  void SetShower(PHG4Shower* ptr) { shower = ptr; }
61  PHG4Shower* GetShower() const { return shower; }
62 
63  private:
67  int wanted;
68  int keep;
70 };
71 
72 // Utility function to wrap up the operations involved with adding user info
73 // to the track.
74 class G4Track;
75 
76 namespace PHG4TrackUserInfo
77 {
78 void SetUserTrackId(G4Track* track, const int usertrackid);
79 void SetUserParentId(G4Track* track, const int userparentid);
80 void SetUserPrimaryId(G4Track* track, const int userprimaryid);
81 void SetWanted(G4Track* track, const int wanted);
82 void SetKeep(G4Track* track, const int keep);
83 void SetShower(G4Track* track, PHG4Shower* ptr);
84 } // namespace PHG4TrackUserInfo
85 
86 #endif