BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
Calibration_all_ZDC.C
Go to the documentation of this file.
1
2
using namespace
std
;
3
4
void
Calibration_all_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
for
(
int
ev = 0; ev < _t_in->
GetEntries
(); ev++) {
37
38
if
((ev % 10000) == 0)
39
printf(
"Calibration ZDC, event %d\n"
, ev);
40
41
zdc_raw->
Clear
();
42
43
_t_in->
GetEntry
(ev);
44
45
if
(ZDC.
fillCalibrateAll
(zdc_raw, 0., 0., 48.))
46
break
;
47
}
48
/////////////////////////////////////////////////////////////////////////////////////
49
ZDC.
calibrate
();
50
ZDC.
drawzdc
();
51
/////////////////////////////////////////////////////////////////////////////////////
52
53
_f_in->
Close
();
54
}
55
56
void
select_hist
()
57
{
58
// example of macro called when a mouse event occurs in a pad.
59
// Example:
60
// Root > TFile f("hsimple.root");
61
// Root > hpxpy.Draw();
62
// Root > c1.AddExec("exsel","select_hist()");
63
// When moving the mouse in the canvas, a second canvas shows the
64
// projection along X of the bin corresponding to the Y position
65
// of the mouse. The resulting histogram is fitted with a gaussian.
66
// A "dynamic" line shows the current bin position in Y.
67
// This more elaborated example can be used as a starting point
68
// to develop more powerful interactive applications exploiting CINT
69
// as a development engine.
70
// Author: Rene Brun
71
72
int
event
=
gPad
->GetEvent();
73
if
(event != 11)
74
return
;
75
76
TObject
* select =
gPad
->GetSelected();
77
if
(!select)
78
return
;
79
if
(!(select->InheritsFrom(
"TH1"
)))
80
return
;
81
82
// create or set the new canvas c2
83
TCanvas
* csingle = 0;
84
if
((csingle = (
TCanvas
*)
gROOT
->GetListOfCanvases()->FindObject(
"csingle"
)))
85
;
86
else
87
csingle =
new
TCanvas
(
"csingle"
);
88
csingle->
cd
();
89
90
// draw slice corresponding to mouse position
91
if
(!(select->InheritsFrom(
"TH1F"
))) {
92
TH1F
* h = (
TH1F
*)select;
93
h->
Draw
();
94
}
else
if
(!(select->InheritsFrom(
"TH2F"
))) {
95
TH2F
* h = (
TH2F
*)select;
96
h->
Draw
();
97
}
else
if
(!(select->InheritsFrom(
"TProfile"
))) {
98
TProfile
* h = (
TProfile
*)select;
99
h->
Draw
();
100
}
else
if
(!(select->InheritsFrom(
"TH1D"
))) {
101
TH1D
* h = (
TH1D
*)select;
102
h->
Draw
();
103
}
else
if
(!(select->InheritsFrom(
"TH2D"
))) {
104
TH2D
* h = (
TH2D
*)select;
105
h->
Draw
();
106
}
else
if
(!(select->InheritsFrom(
"TProfile2D"
))) {
107
TProfile2D
* h = (
TProfile2D
*)select;
108
h->
Draw
();
109
}
else
110
return
;
111
csingle->
Update
();
112
}
gROOT
#define gROOT
gPad
#define gPad
BmnZDCRaw2Digit
Definition
BmnZDCRaw2Digit.h:65
BmnZDCRaw2Digit::setParStart
void setParStart(Float_t p)
Definition
BmnZDCRaw2Digit.h:81
BmnZDCRaw2Digit::print
void print()
Definition
BmnZDCRaw2Digit.cxx:320
BmnZDCRaw2Digit::drawzdc
void drawzdc(int nohist=0)
Definition
BmnZDCRaw2Digit.cxx:1472
BmnZDCRaw2Digit::setError
void setError(Float_t s)
Definition
BmnZDCRaw2Digit.h:90
BmnZDCRaw2Digit::fillCalibrateAll
int fillCalibrateAll(TClonesArray *data, Float_t x, Float_t y, Float_t e)
Definition
BmnZDCRaw2Digit.cxx:996
BmnZDCRaw2Digit::calibrate
void calibrate()
Definition
BmnZDCRaw2Digit.cxx:1101
BmnZDCRaw2Digit::setNorm
void setNorm(Float_t n)
Definition
BmnZDCRaw2Digit.h:93
BmnZDCRaw2Digit::setParStep
void setParStep(Float_t p)
Definition
BmnZDCRaw2Digit.h:78
BmnZDCRaw2Digit::setLogFunction
void setLogFunction(Int_t u)
Definition
BmnZDCRaw2Digit.h:108
TCanvas
TCanvas::cd
TVirtualPad * cd(Int_t subpadnumber=0) override
TCanvas::Update
void Update() override
TClonesArray
TClonesArray::Clear
void Clear(Option_t *option="") override
TDirectoryFile::Get
T * Get(const char *namecycle)
TFile
TFile::Close
void Close(Option_t *option="") override
TH1D
TH1F
TH1::Draw
void Draw(Option_t *option="") override
TH2D
TH2F
TObject
TProfile2D
TProfile
TTree
TTree::GetEntry
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
TTree::GetEntries
virtual Long64_t GetEntries() const
TTree::SetBranchAddress
Int_t SetBranchAddress(const char *bname, T **add, TBranch **ptr=nullptr)
Calibration_all_ZDC
void Calibration_all_ZDC(char *fname="bmn_run0543.root")
Definition
Calibration_all_ZDC.C:4
select_hist
void select_hist()
Definition
Calibration_all_ZDC.C:56
std
Definition
json.hpp:4446
macro
detectors
zdc
Calibration_all_ZDC.C
Generated on
for BmnRoot by
1.17.0