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) {
74 TProfile *profile =
ComputeEff(num, den, nameHist);
76 TString x_axis_title = TString(num->GetXaxis()->GetTitle());
77 TString
title = TString::Format(
"Segment Efficiency;%s;Eff.", x_axis_title.Data());
79 profile->SetTitle(title.Data());
97 TString eta_label_den = TString(
dbe_path_) +
"me0_simsegment_eta";
98 TString eta_label_num = TString(
dbe_path_) +
"me0_matchedsimsegment_eta";
99 TString pt_label_den = TString(
dbe_path_) +
"me0_simsegment_pt";
100 TString pt_label_num = TString(
dbe_path_) +
"me0_matchedsimsegment_pt";
101 TString phi_label_den = TString(
dbe_path_) +
"me0_simsegment_phi";
102 TString phi_label_num = TString(
dbe_path_) +
"me0_matchedsimsegment_phi";
104 if (ig.
get(eta_label_num.Data()) !=
nullptr && ig.
get(eta_label_den.Data()) !=
nullptr) {
105 TH1F *num_vs_eta = (TH1F *)ig.
get(eta_label_num.Data())->getTH1F()->Clone();
107 TH1F *den_vs_eta = (TH1F *)ig.
get(eta_label_den.Data())->getTH1F()->Clone();
110 ProcessBooking(ibooker, ig,
"me0segment_eff_vs_eta", num_vs_eta, den_vs_eta);
116 edm::LogWarning(
"MuonME0SegHarvestor") <<
"Can not find histograms: " << eta_label_num <<
" or " << eta_label_den;
118 if (ig.
get(pt_label_num.Data()) !=
nullptr && ig.
get(pt_label_den.Data()) !=
nullptr) {
119 TH1F *num_vs_pt = (TH1F *)ig.
get(pt_label_num.Data())->getTH1F()->Clone();
121 TH1F *den_vs_pt = (TH1F *)ig.
get(pt_label_den.Data())->getTH1F()->Clone();
124 ProcessBooking(ibooker, ig,
"me0segment_eff_vs_pt", num_vs_pt, den_vs_pt);
130 edm::LogWarning(
"MuonME0SegHarvestor") <<
"Can not find histograms: " << pt_label_num <<
" or " << pt_label_den;
132 if (ig.
get(phi_label_num.Data()) !=
nullptr && ig.
get(phi_label_den.Data()) !=
nullptr) {
133 TH1F *num_vs_phi = (TH1F *)ig.
get(phi_label_num.Data())->getTH1F()->Clone();
135 TH1F *den_vs_phi = (TH1F *)ig.
get(phi_label_den.Data())->getTH1F()->Clone();
138 ProcessBooking(ibooker, ig,
"me0segment_eff_vs_phi", num_vs_phi, den_vs_phi);
144 edm::LogWarning(
"MuonME0SegHarvestor") <<
"Can not find histograms: " << phi_label_num <<
" or " << phi_label_den;
virtual void setCurrentFolder(std::string const &fullpath)
#define DEFINE_FWK_MODULE(type)
MuonME0SegHarvestor(const edm::ParameterSet &)
constructor
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
void ProcessBooking(DQMStore::IBooker &, DQMStore::IGetter &, std::string nameHist, TH1F *num, TH1F *den)
~MuonME0SegHarvestor() override
destructor
virtual MonitorElement * get(std::string const &fullpath) const
TProfile * ComputeEff(TH1F *num, TH1F *denum, std::string nameHist)
Log< level::Warning, false > LogWarning
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override