BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
Calibration_cluster_ZDC.C
Go to the documentation of this file.
1
2using namespace std;
3
4void Calibration_cluster_ZDC(char* fname = "bmn_run0543.root")
5{
6 gROOT->LoadMacro("$VMCWORKDIR/macro/run/bmnloadlibs.C");
7 bmnloadlibs();
8 /////////////////////////////////////////////////////////////////////////////////////
9 int RUN;
10 sscanf(&fname[strlen(fname) - 8], "%d", &RUN);
11
12 const char* mapping;
13 if (RUN < 470)
14 mapping = "ZDC_map_Feb20.txt";
15 else
16 mapping = "ZDC_map_Mar08.txt";
17
18 BmnZDCRaw2Digit ZDC(mapping, fname);
19 ZDC.setParStart(1.0);
20 ZDC.setParStep(0.1);
21 ZDC.setError(10.0);
22 ZDC.setNorm(13.670104);
23 ZDC.setLogFunction(1);
24
25 ZDC.print();
26
27 cout << "Process RUN: " << RUN << endl;
28
29 /////////////////////////////////////////////////////////////////////////////////////
30 TFile* _f_in = new TFile(fname, "READ");
31 TTree* _t_in = (TTree*)_f_in->Get("BMN_RAW");
32 TClonesArray* zdc_raw = new TClonesArray("BmnADCDigit");
33 _t_in->SetBranchAddress("bmn_zdc", &zdc_raw);
34 /////////////////////////////////////////////////////////////////////////////////////
35
36 int numbers[9] = {22, 23, 24, 28, 29, 30, 36, 37, 38};
37
38 for (int ev = 0; ev < _t_in->GetEntries(); ev++) {
39
40 if ((ev % 1000) == 0)
41 printf("Calibration ZDC, event %d\n", ev);
42
43 zdc_raw->Clear();
44
45 _t_in->GetEntry(ev);
46
47 if (ZDC.fillCalibrateCluster(zdc_raw, 0., 0., 48., 3))
48 break;
49 }
50 /////////////////////////////////////////////////////////////////////////////////////
51 ZDC.calibrate();
52 ZDC.drawzdc();
53 /////////////////////////////////////////////////////////////////////////////////////
54
55 _f_in->Close();
56}
57
59{
60 // example of macro called when a mouse event occurs in a pad.
61 // Example:
62 // Root > TFile f("hsimple.root");
63 // Root > hpxpy.Draw();
64 // Root > c1.AddExec("exsel","select_hist()");
65 // When moving the mouse in the canvas, a second canvas shows the
66 // projection along X of the bin corresponding to the Y position
67 // of the mouse. The resulting histogram is fitted with a gaussian.
68 // A "dynamic" line shows the current bin position in Y.
69 // This more elaborated example can be used as a starting point
70 // to develop more powerful interactive applications exploiting CINT
71 // as a development engine.
72 // Author: Rene Brun
73
74 int event = gPad->GetEvent();
75 if (event != 11)
76 return;
77
78 TObject* select = gPad->GetSelected();
79 if (!select)
80 return;
81 if (!(select->InheritsFrom("TH1")))
82 return;
83
84 // create or set the new canvas c2
85 TCanvas* csingle = 0;
86 if ((csingle = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("csingle")))
87 ;
88 else
89 csingle = new TCanvas("csingle");
90 csingle->cd();
91
92 // draw slice corresponding to mouse position
93 if (!(select->InheritsFrom("TH1F"))) {
94 TH1F* h = (TH1F*)select;
95 h->Draw();
96 } else if (!(select->InheritsFrom("TH2F"))) {
97 TH2F* h = (TH2F*)select;
98 h->Draw();
99 } else if (!(select->InheritsFrom("TProfile"))) {
100 TProfile* h = (TProfile*)select;
101 h->Draw();
102 } else if (!(select->InheritsFrom("TH1D"))) {
103 TH1D* h = (TH1D*)select;
104 h->Draw();
105 } else if (!(select->InheritsFrom("TH2D"))) {
106 TH2D* h = (TH2D*)select;
107 h->Draw();
108 } else if (!(select->InheritsFrom("TProfile2D"))) {
109 TProfile2D* h = (TProfile2D*)select;
110 h->Draw();
111 } else
112 return;
113 csingle->Update();
114}
#define gROOT
#define gPad
int fillCalibrateCluster(TClonesArray *data, Float_t x, Float_t y, Float_t e, Int_t clsize)
void setParStart(Float_t p)
void drawzdc(int nohist=0)
void setError(Float_t s)
void setNorm(Float_t n)
void setParStep(Float_t p)
void setLogFunction(Int_t u)
TVirtualPad * cd(Int_t subpadnumber=0) override
void Update() override
void Clear(Option_t *option="") override
T * Get(const char *namecycle)
void Close(Option_t *option="") override
void Draw(Option_t *option="") override
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
virtual Long64_t GetEntries() const
Int_t SetBranchAddress(const char *bname, T **add, TBranch **ptr=nullptr)
void Calibration_cluster_ZDC(char *fname="bmn_run0543.root")
void select_hist()
Definition json.hpp:4446