12 #include "TGraphAsymmErrors.h"
40 TProfile *efficHist =
new TProfile(
name.c_str(),
42 denum->GetXaxis()->GetNbins(),
43 denum->GetXaxis()->GetXmin(),
44 denum->GetXaxis()->GetXmax());
46 for (
int i = 1;
i <= denum->GetNbinsX();
i++) {
47 double nNum =
num->GetBinContent(
i);
48 double nDenum = denum->GetBinContent(
i);
49 if (nDenum == 0 || nNum == 0) {
57 <<
"Alert! specific bin's num is bigger than denum " <<
i <<
" " << nNum <<
" " << nDenum;
59 const double effVal = nNum / nDenum;
60 efficHist->SetBinContent(
i, effVal);
61 efficHist->SetBinEntries(
i, 1);
62 efficHist->SetBinError(
i, 0);
63 const double errLo = TEfficiency::ClopperPearson((
int)nDenum, (
int)nNum, 0.683,
false);
64 const double errUp = TEfficiency::ClopperPearson((
int)nDenum, (
int)nNum, 0.683,
true);
65 const double errVal = (effVal - errLo > errUp - effVal) ? effVal - errLo : errUp - effVal;
66 efficHist->SetBinError(
i,
sqrt(effVal * effVal + errVal * errVal));
73 if (
num !=
nullptr && den !=
nullptr) {
76 TString x_axis_title = TString(
num->GetXaxis()->GetTitle());
77 TString
title = TString::Format(
"Digi Efficiency;%s;Eff.", x_axis_title.Data());
96 hist1->SetName(
name.c_str());
97 for (
int bin = 1;
bin <= hist1->GetNbinsX(); ++
bin) {
98 double R_min = hist1->GetBinCenter(
bin) - 0.5 * hist1->GetBinWidth(
bin);
99 double R_max = hist1->GetBinCenter(
bin) + 0.5 * hist1->GetBinWidth(
bin);
101 double Area =
TMath::Pi() * (R_max * R_max - R_min * R_min);
102 hist1->SetBinContent(
bin, (hist1->GetBinContent(
bin)) / Area);
103 hist1->SetBinError(
bin, (hist1->GetBinError(
bin)) / Area);
106 int nEvts = hist2->GetEntries();
109 hist1->Scale(1.0 /
scale);
115 if (hist1 !=
nullptr && hist2 !=
nullptr) {
118 TString x_axis_title = TString(hist1->GetXaxis()->GetTitle());
119 TString origTitle = TString(hist1->GetTitle());
120 TString
title = TString::Format((origTitle +
";%s;Rate [Hz/cm^{2}]").Data(), x_axis_title.Data());
127 if (hist1 ==
nullptr)
129 if (hist2 ==
nullptr)
138 const char *l_suffix[6] = {
"_l1",
"_l2",
"_l3",
"_l4",
"_l5",
"_l6"};
139 const char *r_suffix[2] = {
"-1",
"1"};
141 TString eta_label_den_tot = TString(
dbe_path_) +
"me0_strip_dg_den_eta_tot";
142 TString eta_label_num_tot = TString(
dbe_path_) +
"me0_strip_dg_num_eta_tot";
143 if (ig.
get(eta_label_num_tot.Data()) !=
nullptr && ig.
get(eta_label_den_tot.Data()) !=
nullptr) {
144 TH1F *num_vs_eta_tot = (TH1F *)ig.
get(eta_label_num_tot.Data())->getTH1F()->Clone();
145 num_vs_eta_tot->Sumw2();
146 TH1F *den_vs_eta_tot = (TH1F *)ig.
get(eta_label_den_tot.Data())->getTH1F()->Clone();
147 den_vs_eta_tot->Sumw2();
149 ProcessBooking(ibooker, ig,
"me0_strip_dg_eta_tot", num_vs_eta_tot, den_vs_eta_tot);
151 delete num_vs_eta_tot;
152 delete den_vs_eta_tot;
156 <<
"Can not find histograms: " << eta_label_num_tot <<
" or " << eta_label_den_tot;
158 for (
int i = 0;
i < 2;
i++) {
159 for (
int j = 0;
j < 6;
j++) {
160 TString eta_label_den = TString(
dbe_path_) +
"me0_strip_dg_den_eta" + r_suffix[
i] + l_suffix[
j];
161 TString eta_label_num = TString(
dbe_path_) +
"me0_strip_dg_num_eta" + r_suffix[
i] + l_suffix[
j];
163 if (ig.
get(eta_label_num.Data()) !=
nullptr && ig.
get(eta_label_den.Data()) !=
nullptr) {
164 TH1F *num_vs_eta = (TH1F *)ig.
get(eta_label_num.Data())->getTH1F()->Clone();
166 TH1F *den_vs_eta = (TH1F *)ig.
get(eta_label_den.Data())->getTH1F()->Clone();
179 <<
"Can not find histograms: " << eta_label_num <<
" " << eta_label_den;
183 TString label_eleBkg = TString(
dbe_path_) +
"me0_strip_dg_bkgElePos_radius";
184 TString label_neuBkg = TString(
dbe_path_) +
"me0_strip_dg_bkgNeutral_radius";
185 TString label_totBkg = TString(
dbe_path_) +
"me0_strip_dg_bkg_radius_tot";
186 TString label_evts = TString(
dbe_path_) +
"num_evts";
188 if (ig.
get(label_evts.Data()) !=
nullptr) {
189 TH1F *numEvts = (TH1F *)ig.
get(label_evts.Data())->getTH1F()->Clone();
191 if (ig.
get(label_eleBkg.Data()) !=
nullptr) {
192 TH1F *eleBkg = (TH1F *)ig.
get(label_eleBkg.Data())->getTH1F()->Clone();
198 if (ig.
get(label_neuBkg.Data()) !=
nullptr) {
199 TH1F *neuBkg = (TH1F *)ig.
get(label_neuBkg.Data())->getTH1F()->Clone();
205 if (ig.
get(label_totBkg.Data()) !=
nullptr) {
206 TH1F *totBkg = (TH1F *)ig.
get(label_totBkg.Data())->getTH1F()->Clone();