CbmRoot
CbmRichRadiusCorrection.h
Go to the documentation of this file.
1 
10 #ifndef CBM_RICH_RADIUS_CORRECTION
11 #define CBM_RICH_RADIUS_CORRECTION
12 
13 #include "CbmRichRingLight.h"
14 #include "TDirectory.h"
15 #include "TFile.h"
16 #include "TH2D.h"
17 #include "TROOT.h"
18 #include "TSystem.h"
19 
20 #include <iostream>
21 #include <string>
22 
23 using std::cout;
24 using std::endl;
25 using std::string;
26 
36 public:
41  static void DoCorrection(CbmRichRingLight* ring) {
42  if (NULL == fhMapAaxisXY || NULL == fhMapBaxisXY) { Init(); }
43  if (NULL == fhMapAaxisXY || NULL == fhMapBaxisXY) return;
44 
45  double centerX = ring->GetCenterX();
46  double centerY = ring->GetCenterY();
47  double axisA =
48  ring->GetAaxis()
49  + fhMapAaxisXY->GetBinContent(fhMapAaxisXY->FindBin(centerX, centerY));
50  double axisB =
51  ring->GetBaxis()
52  + fhMapBaxisXY->GetBinContent(fhMapBaxisXY->FindBin(centerX, centerY));
53 
54  ring->SetAaxis(axisA);
55  ring->SetBaxis(axisB);
56  }
57 
58 private:
64  static void Init() {
65  string fileName = gSystem->Getenv("VMCWORKDIR");
66  fileName += "/parameters/rich/radius_correction_map_compact.root";
67 
68  TDirectory* current = gDirectory;
69  TFile* file = new TFile(fileName.c_str(), "READ");
70 
71  if (NULL == file || !file->IsOpen()) {
72  cout << " -E- Read correction maps " << endl;
73  cout << " -E- Could not open input file " << fileName << endl;
74  return;
75  } else {
76  cout << " -I- Map Correction input file: " << fileName << endl;
77  }
78 
79  gROOT->cd();
80 
81  fhMapAaxisXY = (TH2D*) file->Get("fh_mapaxisAXY")->Clone();
82  fhMapBaxisXY = (TH2D*) file->Get("fh_mapaxisBXY")->Clone();
83 
84  file->Close();
85  delete file;
86  current->cd();
87  }
88 
89  static TH2D* fhMapAaxisXY;
90  static TH2D* fhMapBaxisXY;
91 };
92 
93 #endif
CbmRichRadiusCorrection
Definition: CbmRichRadiusCorrection.h:35
CbmRichRingLight::SetAaxis
void SetAaxis(double a)
Definition: CbmRichRingLight.h:166
CbmRichRadiusCorrection::Init
static void Init()
Initialize histograms for radius correction procedure. This procedure will be invoked automatically b...
Definition: CbmRichRadiusCorrection.h:64
CbmRichRingLight::GetAaxis
float GetAaxis() const
Definition: CbmRichRingLight.h:163
CbmRichRingLight::GetCenterY
float GetCenterY() const
Definition: CbmRichRingLight.h:160
CbmRichRingLight.h
CbmRichRadiusCorrection::fhMapBaxisXY
static TH2D * fhMapBaxisXY
Definition: CbmRichRadiusCorrection.h:90
CbmRichRingLight::GetBaxis
float GetBaxis() const
Definition: CbmRichRingLight.h:164
CbmRichRadiusCorrection::DoCorrection
static void DoCorrection(CbmRichRingLight *ring)
Perform A and B parameters correction.
Definition: CbmRichRadiusCorrection.h:41
CbmRichRadiusCorrection::fhMapAaxisXY
static TH2D * fhMapAaxisXY
Definition: CbmRichRadiusCorrection.h:89
CbmRichRingLight::SetBaxis
void SetBaxis(double b)
Definition: CbmRichRingLight.h:167
CbmRichRingLight::GetCenterX
float GetCenterX() const
Definition: CbmRichRingLight.h:159
CbmRichRingLight
Definition: CbmRichRingLight.h:39