EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrackFastSimEval.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TrackFastSimEval.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef TRACKFASTSIMEVAL_H
4 #define TRACKFASTSIMEVAL_H
5 
6 #include <fun4all/SubsysReco.h>
7 
8 #include <map>
9 #include <set>
10 #include <string>
11 
12 //Forward declarations
13 class PHCompositeNode;
15 class SvtxTrackMap;
16 class SvtxVertexMap;
17 class TTree;
18 class TH2D;
19 
20 //Brief: basic ntuple and histogram creation for sim evaluation
21 class TrackFastSimEval : public SubsysReco
22 {
23  public:
24  //Default constructor
25  TrackFastSimEval(const std::string& name = "TrackFastSimEval",
26  const std::string& filename = "g4eval.root",
27  const std::string& trackmapname = "SvtxTrackMap");
28 
29  //Initialization, called for initialization
30  int Init(PHCompositeNode*);
31 
32  //Process Event, called for each event
34 
35  //End, write and close files
36  int End(PHCompositeNode*);
37 
38  //Change output filename
39  void set_filename(const char* file)
40  {
41  if (file) _outfile_name = file;
42  }
43 
44  //Flags of different kinds of outputs
45  enum Flag
46  {
47  //all disabled
48  NONE = 0,
49  };
50 
51  //Set the flag
52  //Flags should be set like set_flag(TrackFastSimEval::TRUTH, true) from macro
53  void set_flag(const Flag& flag, const bool& value)
54  {
55  if (value)
56  _flags |= flag;
57  else
58  _flags &= (~flag);
59  }
60 
61  //User modules
62  void reset_variables();
63  void AddProjection(const std::string& name);
64 
65  private:
68 
69  //output filename
70  std::string _outfile_name;
71 
72  //name of SvtxTrackMap collection
73  std::string _trackmapname;
74 
75  //Event counter
76  int _event;
77 
78  //Get all the nodes
80 
81  //flags
82  unsigned int _flags;
83 
84  //TTrees
85  TTree* _eval_tree_tracks;
86  TTree* _eval_tree_vertex;
87  int event;
88  //-- truth
89  int gtrackID;
90  int gflavor;
91  float gpx;
92  float gpy;
93  float gpz;
94  float gvx;
95  float gvy;
96  float gvz;
97  float gvt;
98 
99  //-- reco
100  int trackID;
101  int charge;
102  int nhits;
103  float px;
104  float py;
105  float pz;
106  float pcax;
107  float pcay;
108  float pcaz;
109  float dca2d;
110 
111  static const int nproj = 3;
112  // projections hits/mom
113  float proj[3][nproj];
114  float proj_p[3][nproj];
115  // hits/mom at reference
116  float ref[3][nproj];
117  float ref_p[3][nproj];
118 
119  //vertex
120  float vx;
121  float vy;
122  float vz;
123  float deltavx;
124  float deltavy;
125  float deltavz;
126  int ntracks;
127  int n_from_truth;
128 
129  //Histos
132 
133  //Node pointers
137 
138  std::map<std::string, int> m_ProjectionNameMap;
139 };
140 
141 #endif //* TRACKFASTSIMEVAL_H *//