Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
STrackMatcherComparator.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file STrackMatcherComparator.h
1 // ----------------------------------------------------------------------------
2 // 'STrackMatcherComparator.h'
3 // Derek Anderson
4 // 01.30.2024
5 //
6 // Small module to produce plots from the output of the
7 // SvtxEvaluator and FillMatchedClusTree modules.
8 // ----------------------------------------------------------------------------
9 
10 #ifndef STRACKMATCHERCOMPARATOR_H
11 #define STRACKMATCHERCOMPARATOR_H
12 
13 // c++ utilities
14 #include <string>
15 #include <optional>
16 // root libraries
17 #include <TFile.h>
18 #include <TTree.h>
19 #include <TNtuple.h>
20 #include <TDirectory.h>
21 // analysis utilities
25 
26 // make common namespaces implicit
27 using namespace std;
28 
29 // forward declarations
30 class PHCompositeNode;
31 
32 
33 
34 // STrackMatcherComparator definition -----------------------------------------
35 
37 
38  // accessors
39  enum Src {
42  OldTuple
43  };
44  enum Var {
53  Phi,
54  Eta,
55  Pt,
63  PhiRes
64  };
65  enum Type {
69  Normal
70  };
71  enum Comp {
73  VsNumTpc
74  };
75 
76  public:
77 
78  // ctor/dtor
79  STrackMatcherComparator(optional<STrackMatcherComparatorConfig> config = nullopt);
81 
82  // public methods
83  void Init();
84  void Analyze();
85  void End();
86 
87  // setters
89  void SetHistDef(STrackMatcherComparatorHistDef& histo) {m_hist = histo;}
90 
91  // getters
94 
95  private:
96 
97  // internal methods
98  void OpenOutput();
99  void OpenInput();
100  void InitHists();
101  void GetNewTreeHists();
102  void GetNewTupleHists();
103  void GetOldTupleHists();
104  void MakeRatiosAndPlots(const vector<vector<TH1D*>> vecNewHists1D, const vector<vector<vector<TH2D*>>> vecNewHists2D, const int iDir, const string sLabel);
105  void SaveHistograms();
106  void CloseInput();
107  void CloseOutput();
108 
109  // helper functions
110  void FillHistogram1D(const STrackMatcherComparatorHistContent& content, const Type type, const vector<vector<TH1D*>> vecHist1D);
111  void FillHistogram2D(const STrackMatcherComparatorHistContent& content, const Type type, const Comp comparison, const double value, const vector<vector<vector<TH2D*>>> vecHist2D);
112  bool IsNearSector(const float phi);
113 
114  // configuration & histogram info
117 
118  // i/o files
119  TFile* m_outFile = NULL;
120  TFile* m_treeInFileTrue = NULL;
121  TFile* m_treeInFileReco = NULL;
122  TFile* m_tupleInFileTrue = NULL;
123  TFile* m_tupleInFileReco = NULL;
124  TFile* m_oldInFileTrue = NULL;
125  TFile* m_oldInFileReco = NULL;
126 
127  // input trees/tuples
128  TTree* m_tTreeTrue = NULL;
129  TTree* m_tTreeReco = NULL;
130  TNtuple* m_ntTupleTrue = NULL;
131  TNtuple* m_ntTupleReco = NULL;
132  TNtuple* m_ntOldTrue = NULL;
133  TNtuple* m_ntOldReco = NULL;
134 
135  // output directories
136  vector<TDirectory*> m_vecHistDirs;
137  vector<TDirectory*> m_vecRatioDirs;
138  vector<TDirectory*> m_vecPlotDirs;
139 
140  // 1d histogram vectors
141  vector<vector<TH1D*>> m_vecTreeHists1D;
142  vector<vector<TH1D*>> m_vecTupleHists1D;
143  vector<vector<TH1D*>> m_vecOldHists1D;
144 
145  // 2d histogram vectors
146  vector<vector<vector<TH2D*>>> m_vecTreeHists2D;
147  vector<vector<vector<TH2D*>>> m_vecTupleHists2D;
148  vector<vector<vector<TH2D*>>> m_vecOldHists2D;
149 
150  // class-wide constants
151  struct Consts {
152  size_t nDirHist;
153  size_t nDirRatio;
154  size_t nDirPlot;
155  size_t nVtx;
156  size_t nSide;
157  size_t nAxes;
158  size_t nSectors;
159  } m_const = {3, 2, 2, 4, 4, 3, 12};
160 
161 };
162 
163 #endif
164 
165 // end ------------------------------------------------------------------------