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