BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
BmnHistZDC.cxx
Go to the documentation of this file.
1
#include "
BmnHistZDC.h
"
2
3
#include "
TGaxis.h
"
4
5
BmnHistZDC::BmnHistZDC
(
TString
title,
TString
path)
6
:
BmnHist
()
7
{
8
fTitle
= title;
9
fName
= title +
"_cl"
;
10
TGaxis::SetMaxDigits
(2);
11
TString
name;
12
name =
fTitle
+
"_h2d_Grid"
;
13
h2d_grid
=
new
TH2D
(name,
"ZDC Grid"
, 20, 0, 20, 20, 0, 20);
14
h2d_grid
->GetXaxis()->SetTitle(
"iX"
);
15
h2d_grid
->GetXaxis()->SetTitleColor(
kOrange
+ 10);
16
h2d_grid
->GetYaxis()->SetTitle(
"iY"
);
17
h2d_grid
->GetYaxis()->SetTitleColor(
kOrange
+ 10);
18
h2d_grid
->GetZaxis()->SetNoExponent(
kFALSE
);
19
name =
fTitle
+
"_h2d_Profile"
;
20
h2d_profile
=
new
TH2D
(name,
"ZDC Profile"
, 200, -700, 700, 200, -700, 700);
21
h2d_profile
->GetXaxis()->SetTitle(
"X"
);
22
h2d_profile
->GetXaxis()->SetTitleColor(
kOrange
+ 10);
23
h2d_profile
->GetYaxis()->SetTitle(
"Y"
);
24
h2d_profile
->GetYaxis()->SetTitleColor(
kOrange
+ 10);
25
name =
fTitle
+
"_X_Amplitude"
;
26
hx
=
new
TH1D
(name,
"ZDC X Amplitude"
, 200, -700, 700);
27
name =
fTitle
+
"_Y_Amplitude"
;
28
hy
=
new
TH1D
(name,
"ZDC Y Amplitude"
, 200, -700, 700);
29
name =
fTitle
+
"CanvasAmplitudes"
;
30
canAmps
=
new
TCanvas
(name, name, PAD_WIDTH *
ZDC_ROWS
, PAD_HEIGHT *
ZDC_COLS
);
31
canAmps
->Divide(
ZDC_ROWS
,
ZDC_COLS
);
32
canAmpsPads
.resize(
ZDC_ROWS
*
ZDC_COLS
);
33
NamesAmps
.resize(
ZDC_ROWS
*
ZDC_COLS
);
34
35
PadInfo
* p =
new
PadInfo
();
36
p->
current
=
hx
;
37
canAmpsPads
[0] = p;
38
PadInfo
* p1 =
new
PadInfo
();
39
p1->
current
=
hy
;
40
canAmpsPads
[1] = p1;
41
42
for
(
Int_t
rowIndex = 0; rowIndex <
ZDC_ROWS
; rowIndex++) {
43
for
(
Int_t
colIndex = 0; colIndex <
ZDC_COLS
; colIndex++) {
44
Int_t
iPad = rowIndex *
ZDC_COLS
+ colIndex;
45
canAmps
->GetPad(iPad + 1)->SetGrid();
46
NamesAmps
[iPad] =
canAmpsPads
[iPad]->current->GetName();
47
TH1
* h =
canAmpsPads
[iPad]->current;
48
h->
SetTitleSize
(0.06,
"XY"
);
49
h->
SetLabelSize
(0.08,
"XY"
);
50
h->
GetXaxis
()->
SetTitle
(
"Coordinate"
);
51
h->
GetXaxis
()->
SetTitleColor
(
kOrange
+ 10);
52
h->
GetYaxis
()->
SetTitle
(
"Amplitude"
);
53
h->
GetYaxis
()->
SetTitleColor
(
kOrange
+ 10);
54
h->
GetYaxis
()->
SetTitleOffset
(1.4);
55
h->
GetYaxis
()->
SetNoExponent
(
kFALSE
);
56
}
57
}
58
}
59
60
BmnHistZDC::~BmnHistZDC
()
61
{
62
if
(
fDir
!= NULL)
63
return
;
64
delete
h2d_grid
;
65
delete
h2d_profile
;
66
delete
hx
;
67
delete
hy
;
68
if
(
fDir
)
69
return
;
70
for
(
auto
pad :
canAmpsPads
)
71
delete
pad;
72
}
73
74
void
BmnHistZDC::Register
(
THttpServer
* serv)
75
{
76
fServer
= serv;
77
fServer
->Register(
"/"
,
this
);
78
TString
path =
"/"
+
fTitle
+
"/"
;
79
fServer
->Register(path,
h2d_grid
);
80
fServer
->Register(path,
h2d_profile
);
81
fServer
->Register(path,
canAmps
);
82
TString
cmd =
"/"
+
fName
+
"/->Reset()"
;
83
fServer
->SetItemField(path.Data(),
"_monitoring"
,
"2000"
);
84
fServer
->SetItemField(path.Data(),
"_layout"
,
"grid3x3"
);
85
TString
cmdTitle = path +
"Reset"
;
86
fServer
->RegisterCommand(cmdTitle.
Data
(), cmd.
Data
(),
"button;"
);
87
fServer
->Restrict(cmdTitle,
"visible=shift"
);
88
fServer
->Restrict(cmdTitle,
"allow=shift"
);
89
cmd =
"/"
+
fName
+
"/->SetRefRun(%arg1%)"
;
90
cmdTitle = path +
"SetRefRun"
;
91
fServer
->RegisterCommand(cmdTitle.
Data
(), cmd.
Data
(),
"button;"
);
92
}
93
94
void
BmnHistZDC::SetDir
(
TFile
* outFile = NULL,
TTree
* recoTree = NULL)
95
{
96
frecoTree
= recoTree;
97
fDir
= NULL;
98
if
(outFile != NULL)
99
fDir
= outFile->mkdir(
fTitle
+
"_hists"
);
100
h2d_grid
->SetDirectory(
fDir
);
101
h2d_profile
->SetDirectory(
fDir
);
102
hx
->SetDirectory(
fDir
);
103
hy
->SetDirectory(
fDir
);
104
}
105
106
void
BmnHistZDC::DrawBoth
()
107
{
108
BmnHist::DrawRef
(
canAmps
, &
canAmpsPads
);
109
return
;
110
}
111
112
void
BmnHistZDC::FillFromDigi
(
DigiArrays
* fDigiArrays)
113
{
114
TClonesArray
* digits = fDigiArrays->
zdc
;
115
if
(!digits)
116
return
;
117
Double_t
xAmp = 0;
118
Double_t
yAmp = 0;
119
Double_t
Amp = 0;
120
for
(
Int_t
iDig = 0; iDig < digits->
GetEntriesFast
(); iDig++) {
121
BmnZDCDigit
* dig = (
BmnZDCDigit
*)digits->
At
(iDig);
122
Int_t
ix = dig->
GetIX
();
123
Int_t
iy = dig->
GetIY
();
124
Double_t
amp = dig->
GetAmp
();
125
Amp += amp;
126
h2d_grid
->Fill(ix, iy, dig->
GetAmp
());
127
xAmp += amp * dig->
GetX
();
128
yAmp += amp * dig->
GetY
();
129
}
130
if
(Amp == 0)
131
return
;
132
xAmp /= Amp;
133
yAmp /= Amp;
134
h2d_profile
->Fill(xAmp, yAmp, Amp);
135
hx
->Fill(xAmp, Amp);
136
hy
->Fill(yAmp, Amp);
137
}
138
139
BmnStatus
BmnHistZDC::SetRefRun
(
Int_t
id
)
140
{
141
TString
FileName =
Form
(
"bmn_run%04d_hist.root"
,
id
);
142
printf(
"SetRefRun: %s\n"
, FileName.
Data
());
143
if
(
refRunName
!= FileName) {
144
refRunName
= FileName;
145
refID
= id;
146
BmnHist::LoadRefRun
(
refID
,
refPath
+ FileName,
fTitle
,
canAmpsPads
,
NamesAmps
);
147
DrawBoth
();
148
}
149
return
kBMNSUCCESS
;
150
}
151
152
void
BmnHistZDC::ClearRefRun
()
153
{
154
for
(
auto
pad :
canAmpsPads
) {
155
if
(pad->ref)
156
delete
pad->ref;
157
pad->ref = NULL;
158
}
159
refID
= 0;
160
}
161
162
void
BmnHistZDC::Reset
()
163
{
164
h2d_grid
->Reset();
165
h2d_profile
->Reset();
166
hx
->Reset();
167
hy
->Reset();
168
}
Int_t
int Int_t
kFALSE
constexpr Bool_t kFALSE
Double_t
double Double_t
kOrange
kOrange
TGaxis.h
Form
char * Form(const char *fmt,...)
BmnStatus
BmnStatus
Define status code.
Definition
BmnEnums.h:93
kBMNSUCCESS
@ kBMNSUCCESS
Success.
Definition
BmnEnums.h:94
BmnCaloDigit::GetX
Float_t GetX() const
Definition
BmnCaloDigit.h:31
BmnCaloDigit::GetY
Float_t GetY() const
Definition
BmnCaloDigit.h:32
BmnCaloDigit::GetAmp
Float_t GetAmp() const
Definition
BmnCaloDigit.h:34
BmnHistZDC::hx
TH1D * hx
Definition
BmnHistZDC.h:39
BmnHistZDC::DrawBoth
void DrawBoth()
Definition
BmnHistZDC.cxx:106
BmnHistZDC::hy
TH1D * hy
Definition
BmnHistZDC.h:40
BmnHistZDC::SetDir
void SetDir(TFile *outFile, TTree *recoTree)
Definition
BmnHistZDC.cxx:94
BmnHistZDC::h2d_profile
TH2D * h2d_profile
Definition
BmnHistZDC.h:38
BmnHistZDC::SetRefRun
BmnStatus SetRefRun(Int_t id)
Definition
BmnHistZDC.cxx:139
BmnHistZDC::canAmpsPads
vector< PadInfo * > canAmpsPads
Definition
BmnHistZDC.h:42
BmnHistZDC::canAmps
TCanvas * canAmps
Definition
BmnHistZDC.h:41
BmnHistZDC::~BmnHistZDC
virtual ~BmnHistZDC()
Definition
BmnHistZDC.cxx:60
BmnHistZDC::Reset
void Reset()
Definition
BmnHistZDC.cxx:162
BmnHistZDC::FillFromDigi
void FillFromDigi(DigiArrays *fDigiArrays)
Definition
BmnHistZDC.cxx:112
BmnHistZDC::h2d_grid
TH2D * h2d_grid
Definition
BmnHistZDC.h:37
BmnHistZDC::ClearRefRun
void ClearRefRun()
Definition
BmnHistZDC.cxx:152
BmnHistZDC::NamesAmps
vector< TString > NamesAmps
Definition
BmnHistZDC.h:43
BmnHistZDC::BmnHistZDC
BmnHistZDC(TString title="ZDC", TString path="")
Definition
BmnHistZDC.cxx:5
BmnHistZDC::Register
void Register(THttpServer *serv)
Definition
BmnHistZDC.cxx:74
BmnHist::frecoTree
TTree * frecoTree
Definition
BmnHist.h:88
BmnHist::refID
Int_t refID
Definition
BmnHist.h:92
BmnHist::refPath
TString refPath
Definition
BmnHist.h:90
BmnHist::fDir
TDirectory * fDir
Definition
BmnHist.h:89
BmnHist::DrawRef
static void DrawRef(unique_ptr< TCanvas > &canGemStrip, vector< PadInfo * > *canGemStripPads)
Definition
BmnHist.cxx:15
BmnHist::refRunName
TString refRunName
Definition
BmnHist.h:91
BmnHist::LoadRefRun
static BmnStatus LoadRefRun(Int_t refID, TString FullName, TString fTitle, vector< PadInfo * > canPads, vector< TString > Names)
Definition
BmnHist.cxx:100
BmnHist::fServer
THttpServer * fServer
Definition
BmnHist.h:87
BmnHist::BmnHist
BmnHist(Int_t periodID=7, BmnSetup setup=kBMNSETUP)
Definition
BmnHist.cxx:3
BmnZDCDigit
Definition
BmnZDCDigit.h:7
BmnZDCDigit::GetIX
UChar_t GetIX() const
Definition
BmnZDCDigit.h:36
BmnZDCDigit::GetIY
UChar_t GetIY() const
Definition
BmnZDCDigit.h:37
DigiArrays
Definition
DigiArrays.h:10
DigiArrays::zdc
TClonesArray * zdc
Definition
DigiArrays.h:132
PadInfo
Storage for pad content and it's options.
Definition
PadInfo.h:20
PadInfo::current
TH1 * current
Definition
PadInfo.h:78
TAttAxis::SetTitleOffset
virtual void SetTitleOffset(Float_t offset=1)
TAttAxis::SetTitleColor
virtual void SetTitleColor(Color_t color=1)
TAxis::SetNoExponent
void SetNoExponent(Bool_t noExponent=kTRUE)
TCanvas
TFile
TGaxis::SetMaxDigits
static void SetMaxDigits(Int_t maxd=5)
TH1D
TH1
TH1::SetTitleSize
virtual void SetTitleSize(Float_t size=0.02, Option_t *axis="X")
TH1::GetXaxis
TAxis * GetXaxis()
TH1::GetYaxis
TAxis * GetYaxis()
TH1::SetLabelSize
virtual void SetLabelSize(Float_t size=0.02, Option_t *axis="X")
TH2D
THttpServer
TNamed::SetTitle
virtual void SetTitle(const char *title="")
TNamed::fTitle
TString fTitle
TNamed::fName
TString fName
TObjArray::GetEntriesFast
Int_t GetEntriesFast() const
TObjArray::At
TObject * At(Int_t idx) const override
TObject::TClonesArray
friend friend class TClonesArray
TString
TString::Data
const char * Data() const
TTree
BmnHistZDC.h
ZDC_COLS
#define ZDC_COLS
Definition
BmnHistZDC.h:20
ZDC_ROWS
#define ZDC_ROWS
Definition
BmnHistZDC.h:19
monitor
BmnHistZDC.cxx
Generated on
for BmnRoot by
1.17.0