EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CbmRichGeoTest.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file CbmRichGeoTest.h
1 
10 #ifndef CBMRICHGEOTEST
11 #define CBMRICHGEOTEST
12 
13 #include "FairTask.h"
14 class TH1;
15 class TH2;
16 class TH1D;
17 class TH2D;
18 class TH3D;
19 class TClonesArray;
22 class CbmRichRing;
23 class CbmRichRingLight;
24 class CbmGeoRichPar;
25 class TCanvas;
26 
27 #include <vector>
28 
29 using namespace std;
30 
39 class CbmRichGeoTest : public FairTask
40 {
41 
42 public:
47 
51  virtual ~CbmRichGeoTest();
52 
56  void SetParContainers();
57 
61  virtual InitStatus Init();
62 
66  virtual void Exec(
67  Option_t* option);
68 
72  virtual void Finish();
73 
82  void CreateStudyReport(
83  const string& title,
84  const vector<string>& resultDirectories,
85  const vector<string>& studyNames,
86  const string& outputDir);
87 
92  void SetOutputDir(const string& dir) {fOutputDir = dir;}
93 
98  void SetRichDetectorType(const string& type) {fRichDetectorType = type;}
99 
100 private:
101 
105  void InitHistograms();
106 
110  void DrawSummaryPlotsTemp();
111 
112 
116  void FillMcHist();
117 
121  void RingParameters();
122 
129  void FitAndFillHistEllipse(
130  Int_t histIndex,
131  CbmRichRingLight* ring,
132  Double_t momentum);
133 
140  void FitAndFillHistCircle(
141  Int_t histIndex,
142  CbmRichRingLight* ring,
143  Double_t momentum);
144 
152  void FillMcVsHitFitEllipse(
153  CbmRichRingLight* ring,
154  CbmRichRingLight* ringMc);
155 
163  void FillMcVsHitFitCircle(
164  CbmRichRingLight* ring,
165  CbmRichRingLight* ringMc);
166 
170  void HitsAndPoints();
171 
176  TH1D* CreateAccVsMinNofHitsHist();
177 
181  void DrawHist();
182 
188  void DrawRing(
189  CbmRichRingLight* ringHit,
190  CbmRichRingLight* ringPoint);
198  void CreateH2MeanRms(
199  TH2D* hist,
200  TH1D** meanHist,
201  TH1D** rmsHist);
202 
203  void DrawH1andFit(
204  TH1D* hist);
205 
206  void DrawH2MeanRms(
207  TH2D* hist,
208  const string& canvasName);
209 
210  void FitH1OneOverX(
211  TH1D* hist,
212  double xMinFit,
213  double xMaxFit,
214  double xMin,
215  double xMax,
216  const string& canvasName);
217 
218 // /**
219 // * \brief Create property tree an store different statistics there.
220 // */
221 // void CreatePTree();
222 
228  string CalcEfficiency(
229  TH1* histRec,
230  TH1* histAcc);
231 
235  TH1D* DivideH1(
236  TH1D* h1,
237  TH1D* h2,
238  const string& name,
239  const string& title,
240  const string& axisX,
241  const string& axisY);
242 
243  TH2D* DivideH2(
244  TH1D* h1,
245  TH1D* h2,
246  const string& name,
247  const string& title,
248  const string& axisX,
249  const string& axisY,
250  const string& axisZ);
251 
252  TCanvas* CreateCanvas(
253  const string& name,
254  const string& title,
255  int width,
256  int height);
257 
258  void DrawH3(
259  TH3D* h,
260  const string& cName,
261  const string& zAxisTitle,
262  double zMin,
263  double zMax,
264  bool doFit = false);
265 
266  void SaveCanvasToImage();
267 
272 
276  CbmRichGeoTest& operator=(const CbmRichGeoTest&);
277 
278  string fRichDetectorType; // "standard" or prototype
279 
280  string fOutputDir; // output dir for results
281 
282  TClonesArray* fRichHits;
283  TClonesArray* fRichRings;
284  TClonesArray* fRichPoints;
285  TClonesArray* fMCTracks;
286  TClonesArray* fRichRingMatches;
287 
288  Double_t fDetZOrig; // X-coordinate of photodetector (original from parameter file)
289  Double_t fTheta; // angle by which photodetector was tilted around x-axis
290  Double_t fPhi; // angle by which photodetector was tilted around y-axis
291  TObjArray* fSensNodes;
292  TObjArray* fPassNodes;
294 
295  // rings will be fitted on a fly
298 
299  vector<TCanvas*> fCanvas;
300 
301  Int_t fEventNum;
302  Int_t fMinNofHits; // Min number of hits in ring for detector acceptance calculation.
303 
304  TH2D* fhHitsXY; // distribution of X and Y position of hits
305  TH2D* fhPointsXY; // distribution of X and Y position of points
306  TH1D* fhNofPhotonsPerHit; // Number of photons per hit
307 
308  // fitting parameters
309  // [0] = hits fit, [1] = MC points fit
310  vector<TH1D*> fhNofHits; // number of hits per ring
311  // for ellipse
312  vector<TH2D*> fhAaxisVsMom; // major axis (A) vs. MC momentum
313  vector<TH2D*> fhBaxisVsMom; // minor axis (B) vs. MC momentum
314  vector<TH1D*> fhBoverA; // B/A distribution
315  vector<TH2D*> fhXcYcEllipse; // (Xc, Yc) of ellipse center
316  vector<TH2D*> fhChi2EllipseVsMom; // Chi2
317  // for circle
318  vector<TH2D*> fhXcYcCircle; // (Xc, Yc) of circle center
319  vector<TH2D*> fhRadiusVsMom; // circle radius vs. MC momentum
320  vector<TH2D*> fhChi2CircleVsMom; // chi2
321  vector<TH2D*> fhDRVsMom; // dR
322 
323  // R, A, B distribution for different number of hits from 0 to 40
327 
328  // Difference between MC Points and Hits fit
329  // for ellipse fitting parameters
330  TH2D* fhDiffAaxis; // major axis (A)
331  TH2D* fhDiffBaxis; // minor axis (B)
332  TH2D* fhDiffXcEllipse; // Xc of ellipse center
333  TH2D* fhDiffYcEllipse; // Yc of ellipse center
334  // for circle fitting parameters
335  TH2D* fhDiffXcCircle; // Xc of circle center
336  TH2D* fhDiffYcCircle; // Xc of circle center
337  TH2D* fhDiffRadius; // circle radius
338 
339  // Hits and points
340  TH1D* fhDiffXhit;
341  TH1D* fhDiffYhit;
342 
343  // fitting efficiency
344  Double_t fMinAaxis;
345  Double_t fMaxAaxis;
346  Double_t fMinBaxis;
347  Double_t fMaxBaxis;
348  Double_t fMinRadius;
349  Double_t fMaxRadius;
350  TH1D* fhNofHitsAll; // distribution of the number of hits in ring for all
351  TH1D* fhNofHitsCircleFit; // distribution of the number of hits in ring
352  // for good fitted rings using circle fitting
353  TH1D* fhNofHitsEllipseFit; // distribution of the number of hits in ring
354  // for good fitted rings using ellipse fitting
357 
358  // Detector acceptance vs (pt,y) and p for e+/- and pi+/-
363 
368 
369 
370  // numbers in dependence on XY position onto the photodetector
371  TH3D* fhNofHitsXYZ; // number of hits
372  TH3D* fhNofPointsXYZ; // number of points
373  TH3D* fhBoverAXYZ; // B/A ratio
374  TH3D* fhBaxisXYZ; // B axis
375  TH3D* fhAaxisXYZ; // A axis
376  TH3D* fhRadiusXYZ; // Radius
377  TH3D* fhdRXYZ; // dR
378 
379  vector<TH1*> fHists; // store all TH1 pointers of the histogram
380 
381  Int_t fNofDrawnRings; // store number of drawn rings
382 
383  ClassDef(CbmRichGeoTest,1)
384 };
385 
386 #endif
387