13 #include "TGraphAsymmErrors.h" 41 TProfile *efficHist =
new TProfile(name.c_str(),
43 denum->GetXaxis()->GetNbins(),
44 denum->GetXaxis()->GetXmin(),
45 denum->GetXaxis()->GetXmax());
47 for (
int i = 1;
i <= denum->GetNbinsX();
i++) {
48 double nNum = num->GetBinContent(
i);
49 double nDenum = denum->GetBinContent(
i);
50 if (nDenum == 0 || nNum == 0) {
58 <<
"Alert! specific bin's num is bigger than denum " <<
i <<
" " << nNum <<
" " << nDenum;
60 const double effVal = nNum / nDenum;
61 efficHist->SetBinContent(
i, effVal);
62 efficHist->SetBinEntries(
i, 1);
63 efficHist->SetBinError(
i, 0);
64 const double errLo = TEfficiency::ClopperPearson((
int)nDenum, (
int)nNum, 0.683,
false);
65 const double errUp = TEfficiency::ClopperPearson((
int)nDenum, (
int)nNum, 0.683,
true);
66 const double errVal = (effVal - errLo > errUp - effVal) ? effVal - errLo : errUp - effVal;
67 efficHist->SetBinError(
i,
sqrt(effVal * effVal + errVal * errVal));
74 if (num !=
nullptr && den !=
nullptr) {
77 TString x_axis_title = TString(num->GetXaxis()->GetTitle());
78 TString
title = TString::Format(
"Segment Efficiency;%s;Eff.", x_axis_title.Data());
80 profile->SetTitle(title.Data());
98 TString eta_label_den = TString(
dbe_path_) +
"me0_simsegment_eta";
99 TString eta_label_num = TString(
dbe_path_) +
"me0_matchedsimsegment_eta";
100 TString pt_label_den = TString(
dbe_path_) +
"me0_simsegment_pt";
101 TString pt_label_num = TString(
dbe_path_) +
"me0_matchedsimsegment_pt";
102 TString phi_label_den = TString(
dbe_path_) +
"me0_simsegment_phi";
103 TString phi_label_num = TString(
dbe_path_) +
"me0_matchedsimsegment_phi";
105 if (ig.
get(eta_label_num.Data()) !=
nullptr && ig.
get(eta_label_den.Data()) !=
nullptr) {
106 TH1F *num_vs_eta = (TH1F *)ig.
get(eta_label_num.Data())->getTH1F()->Clone();
108 TH1F *den_vs_eta = (TH1F *)ig.
get(eta_label_den.Data())->getTH1F()->Clone();
111 ProcessBooking(ibooker, ig,
"me0segment_eff_vs_eta", num_vs_eta, den_vs_eta);
117 edm::LogWarning(
"MuonME0SegHarvestor") <<
"Can not find histograms: " << eta_label_num <<
" or " << eta_label_den;
119 if (ig.
get(pt_label_num.Data()) !=
nullptr && ig.
get(pt_label_den.Data()) !=
nullptr) {
120 TH1F *num_vs_pt = (TH1F *)ig.
get(pt_label_num.Data())->getTH1F()->Clone();
122 TH1F *den_vs_pt = (TH1F *)ig.
get(pt_label_den.Data())->getTH1F()->Clone();
125 ProcessBooking(ibooker, ig,
"me0segment_eff_vs_pt", num_vs_pt, den_vs_pt);
131 edm::LogWarning(
"MuonME0SegHarvestor") <<
"Can not find histograms: " << pt_label_num <<
" or " << pt_label_den;
133 if (ig.
get(phi_label_num.Data()) !=
nullptr && ig.
get(phi_label_den.Data()) !=
nullptr) {
134 TH1F *num_vs_phi = (TH1F *)ig.
get(phi_label_num.Data())->getTH1F()->Clone();
136 TH1F *den_vs_phi = (TH1F *)ig.
get(phi_label_den.Data())->getTH1F()->Clone();
139 ProcessBooking(ibooker, ig,
"me0segment_eff_vs_phi", num_vs_phi, den_vs_phi);
145 edm::LogWarning(
"MuonME0SegHarvestor") <<
"Can not find histograms: " << phi_label_num <<
" or " << phi_label_den;
MonitorElement * bookProfile(Args &&...args)
void setCurrentFolder(std::string const &fullpath)
MuonME0SegHarvestor(const edm::ParameterSet &)
constructor
#define DEFINE_FWK_MODULE(type)
void ProcessBooking(DQMStore::IBooker &, DQMStore::IGetter &, std::string nameHist, TH1F *num, TH1F *den)
~MuonME0SegHarvestor() override
destructor
MonitorElement * get(std::string const &path)
TProfile * ComputeEff(TH1F *num, TH1F *denum, std::string nameHist)
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override