PandaRoot
PndSTEAnalysisTask.h
Go to the documentation of this file.
1 
21 #ifndef PndSTEAnalysisTask_H_
22 #define PndSTEAnalysisTask_H_
23 
24 #include "FairTask.h"
25 #include "PndTrackCand.h"
26 #include "PndTrack.h"
27 #include "PndMCTrack.h"
28 #include "TClonesArray.h"
29 #include "PndSciTHit.h"
30 #include "FairLink.h"
31 
32 #include "TH2.h"
33 
34 #include <vector>
35 #include <map>
36 
37 class TClonesArray;
38 
39 class PndSTEAnalysisTask : public FairTask {
40  public:
42  PndSTEAnalysisTask() : FairTask("Pnd Stt Track Extrapolator Analysis Task"){};
43 
45  virtual ~PndSTEAnalysisTask(){};
46 
48  virtual InitStatus Init();
49 
51  virtual void Exec(Option_t *opt);
52 
53  virtual void FinishEvent();
54 
55  virtual void Finish();
56 
58  void SetInputTrackBranchName(TString val) { fTrackBranchName = val; };
59 
61  void SetInputHitBranchName(TString val) { fHitBranchName = val; };
62 
64  void SetAnalyzeBtofHits(bool val) { fAnalyzeBtofHits = val; };
65 
67  void SetHitCut(int val) { fCut = val; };
68 
69  private:
71  void InitHitArray(TString);
72 
74  void InitTrackArray(TString);
75 
77  void InitHistograms();
78 
80  void AssociateTrackWithMCTrack(PndTrack *);
81 
83  void AssociateBToFHitWithMCTrack(PndSciTHit *);
84 
86  void AnalyzeBToFHits(PndTrack *);
87 
88  bool fAnalyzeBtofHits = false;
89 
90  TString fHitBranchName = "SciTHit"; // Default hit branch name for BTOF hits
91  TString fTrackBranchName = "Track"; // Default track branch name
92 
93  int eventCount; // Counter for the number of events
94 
95  int fCorrectlyAssignedHits = 0; // Number of correctly assigned BTOF hits
96  int fWronglyAssignedHits = 0; // Number of wrongly assigned BTOF hits
97  int fNotAssignedHits = 0; // Number of BTOF hits that are not assigned
98 
99  int fCut; // Minimum number of hits in a track so that it is well reconstructed (~15-18 for SttCellTrackFinder)
100  int numHits; // Number of hits in a track, used to fill histograms
101 
102  TClonesArray *trackArray;
103  TClonesArray *hitArray;
104 
105  std::map<PndTrack *, std::vector<int> > fMapRecoTrackIndices; // Maps the PndTrack to a vector with its entry number and index
106  std::map<double, std::vector<int> > fMapBToFHitIndices; // Maps the time of a BTOF hit to a vector with its entry number and index
107 
109  TH1 *hMomRes;
110  TH1 *hRelMomRes;
111  TH1 *hMomResWithCut;
112  TH1 *hMomRelResWithCut;
113  TH1 *hMomResCutAwayPart;
114  TH1 *hMomRelResCutAwayPart;
115 
116  TH1 *hMomRealisticExpanded;
117  TH1 *hRelMomRealisticExpanded;
118 
119  TH1 *hMomResWithCutPTCut;
120  TH1 *hMomRelResWithCutPTCut;
121  TH1 *hMomResCutAwayPartPTCut;
122  TH1 *hMomRelResCutAwayPartPTCut;
123 
124  TH2 *hMomRealistic;
125  TH2 *hRelMomRealistic;
126  TH2 *hMomAngleRealistic;
127  TH2 *hRelMomAngleRealistic;
128  TH2 *hMomNumHitsRealistic;
129  TH2 *hRelMomNumHitsRealistic;
130 
131  TH2 *hPositiveRes_NumHits;
132  TH2 *hNegativeRes_NumHits;
133  TH2 *hGoodRes_NumHits;
134 
135  TH2 *hPositiveRes_RecoMom;
136  TH2 *hNegativeRes_RecoMom;
137  TH2 *hGoodRes_RecoMom;
138  TH2 *hPositiveRes_MCMom;
139  TH2 *hNegativeRes_MCMom;
140  TH2 *hGoodRes_MCMom;
141  TH2 *hPositiveRes_MCTheta;
142  TH2 *hNegativeRes_MCTheta;
143  TH2 *hGoodRes_MCTheta;
144  TH2 *hPositiveRes_NumMCTracks;
145  TH2 *hNegativeRes_NumMCTracks;
146  TH2 *hGoodRes_NumMCTracks;
147 
148  TH2 *hPositiveRelRes_NumHits;
149  TH2 *hNegativeRelRes_NumHits;
150  TH2 *hGoodRelRes_NumHits;
151  TH2 *hPositiveRelRes_RecoMom;
152  TH2 *hNegativeRelRes_RecoMom;
153  TH2 *hGoodRelRes_RecoMom;
154  TH2 *hPositiveRelRes_MCMom;
155  TH2 *hNegativeRelRes_MCMom;
156  TH2 *hGoodRelRes_MCMom;
157  TH2 *hPositiveRelRes_MCTheta;
158  TH2 *hNegativeRelRes_MCTheta;
159  TH2 *hGoodRelRes_MCTheta;
160  TH2 *hPositiveRelRes_NumMCTracks;
161  TH2 *hNegativeRelRes_NumMCTracks;
162  TH2 *hGoodRelRes_NumMCTracks;
163  TH2 *hAllRelRes_NumMCTracks;
164  TH2 *hAllRes_NumMCTracks;
165 
166  TH2 *hTotMom;
167  TH2 *hTotMomRel;
168 
169  TH2 *hTotMomFiltered;
170  TH2 *hTotMomRelFiltered;
171 
172  TH2 *hNumMCTracksAbsolute;
173  TH2 *hNumMCTracksRelative;
174 
175  TH2 *hMomFiltered;
176  TH2 *hMomRelFiltered;
177 
178  TH1 *hMomResFiltered;
179  TH1 *hMomRelResFiltered;
180 
181  TH1 *hNumMcTracksPerIdealTrack;
182 
183  ClassDef(PndSTEAnalysisTask, 1);
184 };
185 
186 #endif /* PndSTEAnalysisTask_H_ */
virtual void Exec(Option_t *opt)
void SetAnalyzeBtofHits(bool val)
Function for analyzing the efficiency of the BToF hit finding.
virtual void FinishEvent()
void SetInputHitBranchName(TString val)
Function to set the input hit branch name.
void SetInputTrackBranchName(TString val)
Function to set the input track branch name.
virtual void Finish()
void SetHitCut(int val)
Function to set the cutoff value for the number of hits.
virtual InitStatus Init()
Initializes and loads the data for the task.