CbmRoot
Loading...
Searching...
No Matches
CbmRichRadiusCorrection.h
Go to the documentation of this file.
1/* Copyright (C) 2012-2021 UGiessen/JINR-LIT, Giessen/Dubna
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Semen Lebedev [committer] */
4
14#ifndef CBM_RICH_RADIUS_CORRECTION
15#define CBM_RICH_RADIUS_CORRECTION
16
17#include "CbmRichRingLight.h"
18#include "TDirectory.h"
19#include "TFile.h"
20#include "TH2D.h"
21#include "TROOT.h"
22#include "TSystem.h"
23
24#include <iostream>
25#include <string>
26
27using std::cout;
28using std::endl;
29using std::string;
30
40 public:
45 static void DoCorrection(CbmRichRingLight* ring)
46 {
47 if (NULL == fhMapAaxisXY || NULL == fhMapBaxisXY) {
48 Init();
49 }
50 if (NULL == fhMapAaxisXY || NULL == fhMapBaxisXY) return;
51
52 double centerX = ring->GetCenterX();
53 double centerY = ring->GetCenterY();
54 double axisA = ring->GetAaxis() + fhMapAaxisXY->GetBinContent(fhMapAaxisXY->FindBin(centerX, centerY));
55 double axisB = ring->GetBaxis() + fhMapBaxisXY->GetBinContent(fhMapBaxisXY->FindBin(centerX, centerY));
56
57 ring->SetAaxis(axisA);
58 ring->SetBaxis(axisB);
59 }
60
61 private:
67 static void Init()
68 {
69 string fileName = gSystem->Getenv("VMCWORKDIR");
70 fileName += "/parameters/rich/radius_correction_map_compact.root";
71
73 TFile* oldFile = gFile;
74 TDirectory* oldDir = gDirectory;
75
76 TFile* file = new TFile(fileName.c_str(), "READ");
77
78 if (NULL == file || !file->IsOpen()) {
79 cout << " -E- Read correction maps " << endl;
80 cout << " -E- Could not open input file " << fileName << endl;
81 return;
82 }
83 else {
84 cout << " -I- Map Correction input file: " << fileName << endl;
85 }
86
87 gROOT->cd();
88
89 fhMapAaxisXY = (TH2D*) file->Get("fh_mapaxisAXY")->Clone();
90 fhMapBaxisXY = (TH2D*) file->Get("fh_mapaxisBXY")->Clone();
91
92 file->Close();
93 delete file;
94
96 gFile = oldFile;
97 gDirectory = oldDir;
98 }
99
100 static TH2D* fhMapAaxisXY;
101 static TH2D* fhMapBaxisXY;
102};
103
104#endif
static void Init()
Initialize histograms for radius correction procedure. This procedure will be invoked automatically b...
static void DoCorrection(CbmRichRingLight *ring)
Perform A and B parameters correction.
float GetCenterX() const
float GetAaxis() const
void SetBaxis(double b)
float GetCenterY() const
void SetAaxis(double a)
float GetBaxis() const