PandaRoot
PndSTEAnalysisTask.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
33 #ifndef PndSTEAnalysisTask_H_
34 #define PndSTEAnalysisTask_H_
35 
36 #include "FairTask.h"
37 #include "PndTrackCand.h"
38 #include "PndTrack.h"
39 #include "PndMCTrack.h"
40 #include "TClonesArray.h"
41 #include "PndSciTHit.h"
42 #include "FairLink.h"
43 
44 #include "TH2.h"
45 
46 #include <vector>
47 #include <map>
48 
49 class TClonesArray;
50 
51 class PndSTEAnalysisTask : public FairTask {
52  public:
54  PndSTEAnalysisTask() : FairTask("Pnd Stt Track Extrapolator Analysis Task"){};
55 
57  virtual ~PndSTEAnalysisTask(){};
58 
60  virtual InitStatus Init();
61 
63  virtual void Exec(Option_t *opt);
64 
65  virtual void FinishEvent();
66 
67  virtual void Finish();
68 
70  void SetInputTrackBranchName(TString val) { fTrackBranchName = val; };
71 
73  void SetInputHitBranchName(TString val) { fHitBranchName = val; };
74 
76  void SetAnalyzeBtofHits(bool val) { fAnalyzeBtofHits = val; };
77 
79  void SetHitCut(int val) { fCut = val; };
80 
81  private:
83  void InitHitArray(TString);
84 
86  void InitTrackArray(TString);
87 
89  void InitHistograms();
90 
92  void AssociateTrackWithMCTrack(PndTrack *);
93 
95  void AssociateBToFHitWithMCTrack(PndSciTHit *);
96 
98  void AnalyzeBToFHits(PndTrack *);
99 
100  bool fAnalyzeBtofHits = false;
101 
102  TString fHitBranchName = "SciTHit"; // Default hit branch name for BTOF hits
103  TString fTrackBranchName = "Track"; // Default track branch name
104 
105  int eventCount; // Counter for the number of events
106 
107  int fCorrectlyAssignedHits = 0; // Number of correctly assigned BTOF hits
108  int fWronglyAssignedHits = 0; // Number of wrongly assigned BTOF hits
109  int fNotAssignedHits = 0; // Number of BTOF hits that are not assigned
110 
111  int fCut; // Minimum number of hits in a track so that it is well reconstructed (~15-18 for SttCellTrackFinder)
112  int numHits; // Number of hits in a track, used to fill histograms
113 
114  TClonesArray *trackArray;
115  TClonesArray *hitArray;
116 
117  std::map<PndTrack *, std::vector<int> > fMapRecoTrackIndices; // Maps the PndTrack to a vector with its entry number and index
118  std::map<double, std::vector<int> > fMapBToFHitIndices; // Maps the time of a BTOF hit to a vector with its entry number and index
119 
121  TH1 *hMomRes;
122  TH1 *hRelMomRes;
123  TH1 *hMomResWithCut;
124  TH1 *hMomRelResWithCut;
125  TH1 *hMomResCutAwayPart;
126  TH1 *hMomRelResCutAwayPart;
127 
128  TH1 *hMomRealisticExpanded;
129  TH1 *hRelMomRealisticExpanded;
130 
131  TH1 *hMomResWithCutPTCut;
132  TH1 *hMomRelResWithCutPTCut;
133  TH1 *hMomResCutAwayPartPTCut;
134  TH1 *hMomRelResCutAwayPartPTCut;
135 
136  TH2 *hMomRealistic;
137  TH2 *hRelMomRealistic;
138  TH2 *hMomAngleRealistic;
139  TH2 *hRelMomAngleRealistic;
140  TH2 *hMomNumHitsRealistic;
141  TH2 *hRelMomNumHitsRealistic;
142 
143  TH2 *hPositiveRes_NumHits;
144  TH2 *hNegativeRes_NumHits;
145  TH2 *hGoodRes_NumHits;
146 
147  TH2 *hPositiveRes_RecoMom;
148  TH2 *hNegativeRes_RecoMom;
149  TH2 *hGoodRes_RecoMom;
150  TH2 *hPositiveRes_MCMom;
151  TH2 *hNegativeRes_MCMom;
152  TH2 *hGoodRes_MCMom;
153  TH2 *hPositiveRes_MCTheta;
154  TH2 *hNegativeRes_MCTheta;
155  TH2 *hGoodRes_MCTheta;
156  TH2 *hPositiveRes_NumMCTracks;
157  TH2 *hNegativeRes_NumMCTracks;
158  TH2 *hGoodRes_NumMCTracks;
159 
160  TH2 *hPositiveRelRes_NumHits;
161  TH2 *hNegativeRelRes_NumHits;
162  TH2 *hGoodRelRes_NumHits;
163  TH2 *hPositiveRelRes_RecoMom;
164  TH2 *hNegativeRelRes_RecoMom;
165  TH2 *hGoodRelRes_RecoMom;
166  TH2 *hPositiveRelRes_MCMom;
167  TH2 *hNegativeRelRes_MCMom;
168  TH2 *hGoodRelRes_MCMom;
169  TH2 *hPositiveRelRes_MCTheta;
170  TH2 *hNegativeRelRes_MCTheta;
171  TH2 *hGoodRelRes_MCTheta;
172  TH2 *hPositiveRelRes_NumMCTracks;
173  TH2 *hNegativeRelRes_NumMCTracks;
174  TH2 *hGoodRelRes_NumMCTracks;
175  TH2 *hAllRelRes_NumMCTracks;
176  TH2 *hAllRes_NumMCTracks;
177 
178  TH2 *hTotMom;
179  TH2 *hTotMomRel;
180 
181  TH2 *hTotMomFiltered;
182  TH2 *hTotMomRelFiltered;
183 
184  TH2 *hNumMCTracksAbsolute;
185  TH2 *hNumMCTracksRelative;
186 
187  TH2 *hMomFiltered;
188  TH2 *hMomRelFiltered;
189 
190  TH1 *hMomResFiltered;
191  TH1 *hMomRelResFiltered;
192 
193  TH1 *hNumMcTracksPerIdealTrack;
194 
195  ClassDef(PndSTEAnalysisTask, 1);
196 };
197 
198 #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.