CbmRoot
CbmRichMCbmQaReal.h
Go to the documentation of this file.
1 #ifndef MCBM_RICH_QA_REAL
2 #define MCBM_RICH_QA_REAL
3 
4 #include "CbmEvent.h"
6 #include "FairTask.h"
7 
8 #include "CbmHistManager.h" // for ROOTCLING
9 
10 class TClonesArray;
11 class CbmRichRing;
12 class CbmRichHit;
13 #include "CbmTofTracklet.h"
14 class TVector3;
15 class CbmDigiManager;
17 #include "CbmTofDigi.h"
18 
19 #include <map>
20 #include <vector>
21 
22 using namespace std;
23 
24 
25 class CbmRichMCbmQaReal : public FairTask {
26 
27 public:
32 
36  virtual ~CbmRichMCbmQaReal() {};
37 
41  virtual InitStatus Init();
42 
46  virtual void Exec(Option_t* option);
47 
51  virtual void Finish();
52 
57  void SetOutputDir(const string& dir) { fOutputDir = dir; }
58 
59 
63  void DrawFromFile(const string& fileName, const string& outputDir);
64 
68  void DoRestrictToAcc() { fRestrictToAcc = true; }
69 
70 
74  void DoRestrictToFullAcc(bool val = true) { fRestrictToFullAcc = val; }
75 
76 
80  void DoDrawCanvas(bool val = true) { fDoDrawCanvas = val; }
81 
85  void DoWriteHistToFile(bool val = true) { fDoWriteHistToFile = val; }
86 
87 
91  void XOffsetHistos(Double_t val = 0.) { fXOffsetHisto = val; }
92 
96  void SetMaxNofDrawnEvents(Int_t val = 100) { fMaxNofDrawnEvents = val; }
97 
101  void SetTriggerTofHits(Int_t val = 0) { fTriggerTofHits = val; }
102 
106  void SetTriggerRichHits(Int_t val = 0) { fTriggerRichHits = val; }
107 
111  void SetTotRich(Double_t min, Double_t max) {
112  fTotRichMin = min;
113  fTotRichMax = max;
114  }
115 
116  bool isOnTarget(CbmTofTracklet* tTrack) {
117 
118  Double_t val = std::sqrt(tTrack->GetFitX(0.) * tTrack->GetFitX(0.)
119  + tTrack->GetFitY(0.) * tTrack->GetFitY(0.));
120  if (val < 10.) return true;
121 
122  return false;
123  }
124 
125 private:
127 
128  //TClonesArray* fT0Digis;
129  const std::vector<CbmTofDigi>* fT0Digis = nullptr;
130 
131  TClonesArray* fRichHits;
132 
133  TClonesArray* fRichRings;
134 
135  TClonesArray* fTofHits;
136 
137  TClonesArray* fTofTracks;
138 
139  TClonesArray* fCbmEvent;
140 
141 
143 
144 
145  Double_t fXOffsetHisto;
146 
147  Double_t fTotRichMin;
148 
149  Double_t fTotRichMax;
150 
151  Int_t fEventNum;
152 
154 
156 
158 
160 
162 
163  Int_t fTracksinRich = 0;
164 
165  Int_t fRingsWithTrack[6] =
166  {0, 0, 0, 0, 0, 0}; //rwt;ring;track;ringCut;trackCut;combinations;
167 
168  Int_t fTracksinRichWithRichHits[4] = {0, 0, 0, 0};
169 
170 
171  string fOutputDir; // output dir for results
172 
173  bool fRestrictToAcc = false;
174  bool fRestrictToFullAcc = false;
175 
176  bool fDoWriteHistToFile = true;
177  bool fDoDrawCanvas = true;
178 
179  bool fDigiHitsInitialized = false;
180 
181  bool RestrictToFullAcc(CbmTofTracklet* track);
182  bool RestrictToFullAcc(TVector3& pos);
183  bool RestrictToFullAcc(Double_t x, Double_t y);
184 
185  Double_t fCbmEventStartTime = 0.;
186  CbmEvent* fEventPnt = nullptr;
187 
188  std::array<Double_t, 2304> offset_read;
189  std::array<Double_t, 2304> offset;
190  std::array<uint32_t, 2304> offset_cnt;
191 
192  CbmRichMCbmSEDisplay* fSeDisplay = nullptr;
193 
194  CbmRichMCbmSEDisplay* fSeDsply_TR = nullptr;
195 
199  void InitHistograms();
200 
204  void DrawHist();
205 
206  void RichRings();
207 
208  void DrawRing(CbmRichRing* ring);
209 
210  void DrawEvent(CbmEvent* ev, std::vector<int>& ringIndx, bool full);
211 
212  void DrawRing(CbmRichRing* ring, std::vector<CbmTofTracklet*> track) {
213  DrawRing(ring, track, false);
214  };
215 
216  void
217  DrawRing(CbmRichRing* ring, std::vector<CbmTofTracklet*> track, bool full);
218 
219  void DrawRichTofEv(const std::vector<int> richHitIndx,
220  const std::vector<int> tofTrackIndx);
221 
222  std::pair<int, double>
223  FindClosestTrack(const CbmRichRing* ring,
224  const std::vector<CbmTofTracklet*> track);
225 
226  std::pair<int, double> FindClosestRing(CbmTofTracklet* track,
227  std::vector<int>& ringIndx);
228 
229  bool isAccmRICH(CbmTofTracklet* track);
230 
231  template<typename T = CbmRichHit>
232  bool doToT(T* hit) {
233  if ((hit->GetToT() > fTotRichMin) && (hit->GetToT() < fTotRichMax))
234  return true;
235  return false;
236  }
237 
238  Double_t getBeta(CbmTofTracklet* track);
239 
240  Double_t getBeta(CbmRichRing* ring);
241 
242  void
243  analyseRing(CbmRichRing* ring, CbmEvent* ev, std::pair<int, double>& clTrack);
244 
245  Bool_t cutRadius(CbmRichRing* ring);
246  Bool_t cutDistance(std::pair<int, double>& clTrack);
247 
248 
253 
258 
259 
260  ClassDef(CbmRichMCbmQaReal, 1)
261 };
262 
263 #endif
CbmRichMCbmQaReal::DoRestrictToAcc
void DoRestrictToAcc()
Definition: CbmRichMCbmQaReal.h:68
CbmRichMCbmQaReal::offset_read
std::array< Double_t, 2304 > offset_read
Definition: CbmRichMCbmQaReal.h:188
CbmRichMCbmQaReal::fTriggerTofHits
Int_t fTriggerTofHits
Definition: CbmRichMCbmQaReal.h:161
CbmRichRingFinderHoughImpl.h
Ring finder implementation based on Hough Transform method.
CbmRichMCbmQaReal::fTofHits
TClonesArray * fTofHits
Definition: CbmRichMCbmQaReal.h:135
CbmRichMCbmQaReal::fTofTracks
TClonesArray * fTofTracks
Definition: CbmRichMCbmQaReal.h:137
CbmRichMCbmQaReal::fRichRings
TClonesArray * fRichRings
Definition: CbmRichMCbmQaReal.h:133
CbmRichMCbmQaReal::offset_cnt
std::array< uint32_t, 2304 > offset_cnt
Definition: CbmRichMCbmQaReal.h:190
CbmRichMCbmSEDisplay
Definition: CbmRichMCbmSEDisplay.h:17
CbmRichMCbmQaReal::fXOffsetHisto
Double_t fXOffsetHisto
Definition: CbmRichMCbmQaReal.h:145
CbmRichMCbmQaReal::fNofDrawnRings
Int_t fNofDrawnRings
Definition: CbmRichMCbmQaReal.h:153
sqrt
friend F32vec4 sqrt(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:41
CbmRichMCbmQaReal::offset
std::array< Double_t, 2304 > offset
Definition: CbmRichMCbmQaReal.h:189
CbmRichMCbmQaReal::doToT
bool doToT(T *hit)
Definition: CbmRichMCbmQaReal.h:232
CbmTofTracklet
Provides information on attaching a TofHit to a TofTrack.
Definition: CbmTofTracklet.h:25
CbmRichMCbmQaReal::SetTotRich
void SetTotRich(Double_t min, Double_t max)
Definition: CbmRichMCbmQaReal.h:111
CbmRichMCbmQaReal::isOnTarget
bool isOnTarget(CbmTofTracklet *tTrack)
Definition: CbmRichMCbmQaReal.h:116
CbmRichMCbmQaReal::fNofDrawnRichTofEv
Int_t fNofDrawnRichTofEv
Definition: CbmRichMCbmQaReal.h:155
CbmRichRing
Definition: CbmRichRing.h:17
CbmRichMCbmQaReal::DoWriteHistToFile
void DoWriteHistToFile(bool val=true)
Definition: CbmRichMCbmQaReal.h:85
CbmRichMCbmQaReal::operator=
CbmRichMCbmQaReal & operator=(const CbmRichMCbmQaReal &)
Assignment operator.
CbmRichMCbmQaReal::XOffsetHistos
void XOffsetHistos(Double_t val=0.)
Definition: CbmRichMCbmQaReal.h:91
CbmTofDigi.h
CbmRichMCbmQaReal::fTotRichMin
Double_t fTotRichMin
Definition: CbmRichMCbmQaReal.h:147
CbmRichMCbmQaReal
Definition: CbmRichMCbmQaReal.h:25
CbmHistManager.h
Histogram manager.
CbmTofTracklet.h
min
friend F32vec4 min(const F32vec4 &a, const F32vec4 &b)
Definition: L1/vectors/P4_F32vec4.h:33
CbmEvent.h
CbmRichMCbmQaReal::fEventNum
Int_t fEventNum
Definition: CbmRichMCbmQaReal.h:151
CbmHistManager
Histogram manager.
Definition: CbmHistManager.h:41
CbmRichMCbmQaReal::DrawEvent
void DrawEvent(CbmEvent *ev, std::vector< int > &ringIndx, bool full)
CbmRichMCbmQaReal::fRichHits
TClonesArray * fRichHits
Definition: CbmRichMCbmQaReal.h:131
CbmRichMCbmQaReal::SetTriggerTofHits
void SetTriggerTofHits(Int_t val=0)
Definition: CbmRichMCbmQaReal.h:101
CbmRichMCbmQaReal::fTotRichMax
Double_t fTotRichMax
Definition: CbmRichMCbmQaReal.h:149
CbmRichMCbmQaReal::DrawRing
void DrawRing(CbmRichRing *ring, std::vector< CbmTofTracklet * > track)
Definition: CbmRichMCbmQaReal.h:212
CbmRichMCbmQaReal::CbmRichMCbmQaReal
CbmRichMCbmQaReal(const CbmRichMCbmQaReal &)
Copy constructor.
CbmDigiManager
CbmDigiManager.
Definition: CbmDigiManager.h:37
CbmRichMCbmQaReal::fHM
CbmHistManager * fHM
Definition: CbmRichMCbmQaReal.h:142
fDigiMan
CbmDigiManager * fDigiMan
Definition: CbmTofAnaTestbeam.cxx:88
CbmTofTracklet::GetFitX
Double_t GetFitX(Double_t Z)
Definition: CbmTofTracklet.cxx:516
CbmRichMCbmQaReal::SetOutputDir
void SetOutputDir(const string &dir)
Set output directory where you want to write results (figures and json).
Definition: CbmRichMCbmQaReal.h:57
x
Double_t x
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmTofTracklet::GetFitY
Double_t GetFitY(Double_t Z)
Definition: CbmTofTracklet.cxx:520
y
Double_t y
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmRichMCbmQaReal::DoDrawCanvas
void DoDrawCanvas(bool val=true)
Definition: CbmRichMCbmQaReal.h:80
CbmEvent
Class characterising one event by a collection of links (indices) to data objects,...
Definition: CbmEvent.h:30
pos
TVector3 pos
Definition: CbmMvdSensorDigiToHitTask.cxx:60
CbmRichMCbmQaReal::~CbmRichMCbmQaReal
virtual ~CbmRichMCbmQaReal()
Standard destructor.
Definition: CbmRichMCbmQaReal.h:36
max
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
Definition: L1/vectors/P4_F32vec4.h:36
CbmRichMCbmQaReal::fTriggerRichHits
Int_t fTriggerRichHits
Definition: CbmRichMCbmQaReal.h:159
CbmRichMCbmQaReal::SetMaxNofDrawnEvents
void SetMaxNofDrawnEvents(Int_t val=100)
Definition: CbmRichMCbmQaReal.h:96
CbmRichMCbmQaReal::fOutputDir
string fOutputDir
Definition: CbmRichMCbmQaReal.h:171
CbmRichMCbmQaReal::fCbmEvent
TClonesArray * fCbmEvent
Definition: CbmRichMCbmQaReal.h:139
CbmRichMCbmQaReal::fMaxNofDrawnEvents
Int_t fMaxNofDrawnEvents
Definition: CbmRichMCbmQaReal.h:157
CbmRichHit
Definition: CbmRichHit.h:19
CbmRichMCbmQaReal::SetTriggerRichHits
void SetTriggerRichHits(Int_t val=0)
Definition: CbmRichMCbmQaReal.h:106
CbmRichMCbmQaReal::DoRestrictToFullAcc
void DoRestrictToFullAcc(bool val=true)
Definition: CbmRichMCbmQaReal.h:74