BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
BmnPreparationECAL.C
Go to the documentation of this file.
1
2
void
BmnPreparationECAL
(
char
* fname =
"bmn_run4926_raw.root"
)
3
{
4
gROOT
->LoadMacro(
"$VMCWORKDIR/macro/run/bmnloadlibs.C"
);
5
bmnloadlibs();
6
/////////////////////////////////////////////////////////////////////////////////////
7
int
RUN;
8
sscanf(&fname[strlen(fname) - 13],
"%d"
, &RUN);
9
10
char
mapping[128] = {
"ECAL_map_period_7.txt"
};
11
12
BmnECALRaw2Digit
* ECAL =
new
BmnECALRaw2Digit
(mapping, fname);
13
ECAL->print();
14
15
cout <<
"Process RUN: "
<< RUN << endl;
16
17
/////////////////////////////////////////////////////////////////////////////////////
18
TFile
* _f_in =
new
TFile
(fname,
"READ"
);
19
TTree
* _t_in = (
TTree
*)_f_in->
Get
(
"BMN_RAW"
);
20
TClonesArray
* ecal_raw =
new
TClonesArray
(
"BmnADCDigit"
);
21
_t_in->
SetBranchAddress
(
"ADC"
, &ecal_raw);
22
/////////////////////////////////////////////////////////////////////////////////////
23
24
for
(
int
ev = 0; ev < _t_in->
GetEntries
(); ev++) {
25
26
if
((ev % 5000) == 0)
27
printf(
"Preparation ECAL, event %d\n"
, ev);
28
29
ecal_raw->
Clear
();
30
31
_t_in->
GetEntry
(ev);
32
33
ECAL->fillAmplitudes(ecal_raw);
34
ECAL->fillSampleProfilesAll(ecal_raw, 0., 0., 48.);
35
}
36
/////////////////////////////////////////////////////////////////////////////////////
37
ECAL->drawecal(1);
// draw ECAL modules with module number and calibration coefficient
38
ECAL->drawprof(229);
// average waveform for module 229
39
/////////////////////////////////////////////////////////////////////////////////////
40
41
_f_in->
Close
();
42
}
43
44
void
select_hist
()
45
{
46
// example of macro called when a mouse event occurs in a pad.
47
// Example:
48
// Root > TFile f("hsimple.root");
49
// Root > hpxpy.Draw();
50
// Root > c1.AddExec("exsel","select_hist()");
51
// When moving the mouse in the canvas, a second canvas shows the
52
// projection along X of the bin corresponding to the Y position
53
// of the mouse. The resulting histogram is fitted with a gaussian.
54
// A "dynamic" line shows the current bin position in Y.
55
// This more elaborated example can be used as a starting point
56
// to develop more powerful interactive applications exploiting CINT
57
// as a development engine.
58
// Author: Rene Brun
59
60
int
event
=
gPad
->GetEvent();
61
if
(event != 11)
62
return
;
63
64
TObject
* select =
gPad
->GetSelected();
65
if
(!select)
66
return
;
67
if
(!(select->InheritsFrom(
"TH1"
)))
68
return
;
69
70
// create or set the new canvas c2
71
TCanvas
* csingle = 0;
72
if
((csingle = (
TCanvas
*)
gROOT
->GetListOfCanvases()->FindObject(
"csingle"
)))
73
;
74
else
75
csingle =
new
TCanvas
(
"csingle"
);
76
csingle->
cd
();
77
78
// draw slice corresponding to mouse position
79
if
(!(select->InheritsFrom(
"TH1F"
))) {
80
TH1F
* h = (
TH1F
*)select;
81
h->
Draw
();
82
}
else
if
(!(select->InheritsFrom(
"TH2F"
))) {
83
TH2F
* h = (
TH2F
*)select;
84
h->
Draw
();
85
}
else
if
(!(select->InheritsFrom(
"TProfile"
))) {
86
TProfile
* h = (
TProfile
*)select;
87
h->
Draw
();
88
}
else
if
(!(select->InheritsFrom(
"TH1D"
))) {
89
TH1D
* h = (
TH1D
*)select;
90
h->
Draw
();
91
}
else
if
(!(select->InheritsFrom(
"TH2D"
))) {
92
TH2D
* h = (
TH2D
*)select;
93
h->
Draw
();
94
}
else
if
(!(select->InheritsFrom(
"TProfile2D"
))) {
95
TProfile2D
* h = (
TProfile2D
*)select;
96
h->
Draw
();
97
}
else
98
return
;
99
csingle->
Update
();
100
}
gROOT
#define gROOT
gPad
#define gPad
BmnECALRaw2Digit
Definition
BmnECALRaw2Digit.h:16
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)
BmnPreparationECAL
void BmnPreparationECAL(char *fname="bmn_run4926_raw.root")
Definition
BmnPreparationECAL.C:2
select_hist
void select_hist()
Definition
BmnPreparationECAL.C:44
install
macro
detectors
ecal
BmnPreparationECAL.C
Generated on
for BmnRoot by
1.17.0