14 #include "TGraphAsymmErrors.h" 61 TProfile *efficHist =
new TProfile(name.c_str(),
63 denum->GetXaxis()->GetNbins(),
64 denum->GetXaxis()->GetXmin(),
65 denum->GetXaxis()->GetXmax());
67 for (
int i = 1;
i <= denum->GetNbinsX();
i++) {
68 double nNum = num->GetBinContent(
i);
69 double nDenum = denum->GetBinContent(
i);
70 if (nDenum == 0 || nNum == 0) {
77 LogDebug(
"MuonGEMDigisHarvestor") <<
"Alert! specific bin's num is bigger than denum";
79 const double effVal = nNum / nDenum;
80 efficHist->SetBinContent(
i, effVal);
81 efficHist->SetBinEntries(
i, 1);
82 efficHist->SetBinError(
i, 0);
83 const double errLo = TEfficiency::ClopperPearson((
int)nDenum, (
int)nNum, 0.683,
false);
84 const double errUp = TEfficiency::ClopperPearson((
int)nDenum, (
int)nNum, 0.683,
true);
85 const double errVal = (effVal - errLo > errUp - effVal) ? effVal - errLo : errUp - effVal;
86 efficHist->SetBinError(
i,
sqrt(effVal * effVal + errVal * errVal));
98 if (ig.
get(dbe_label.Data()) !=
nullptr && sh_hist !=
nullptr && track_hist !=
nullptr) {
99 TH1F *
hist = (TH1F *)ig.
get(dbe_label.Data())->getTH1F()->Clone();
101 TProfile *profile_sh =
ComputeEff(hist, sh_hist);
102 profile_sh->SetName((profile->GetName() +
std::string(
"_sh")).c_str());
103 TString x_axis_title = TString(hist->GetXaxis()->GetTitle());
104 TString
title = TString::Format(
105 "Eff. for a SimTrack to have an associated GEM digi in %s;%s;Eff.", suffix.Data(), x_axis_title.Data());
106 TString title2 = TString::Format(
107 "Eff. for a SimTrack to have an associated GEM digi in " 108 "%s with a matched SimHit;%s;Eff.",
110 x_axis_title.Data());
111 profile->SetTitle(title.Data());
112 profile_sh->SetTitle(title2.Data());
114 ibooker.
bookProfile(profile_sh->GetName(), profile_sh);
116 LogDebug(
"MuonGEMDigisHarvestor") <<
"Can not found histogram of " << dbe_label;
117 if (track_hist ==
nullptr)
118 LogDebug(
"MuonGEMDigisHarvestor") <<
"track not found";
119 if (sh_hist ==
nullptr)
120 LogDebug(
"MuonGEMDigisHarvestor") <<
"sh_hist not found";
127 TH1F *gem_trk_eta[3];
128 TH1F *gem_trk_phi[3][2];
131 TH1F *sh_phi[3][4][3];
173 for (
unsigned int i = 0;
i <
s_suffix.size();
i++) {
176 if (ig.
get(eta_label.Data()) !=
nullptr) {
177 gem_trk_eta[
i] = (TH1F *)ig.
get(eta_label.Data())->getTH1F()->Clone();
178 gem_trk_eta[
i]->Sumw2();
180 LogDebug(
"MuonGEMDigisHarvestor") <<
"Can not found track_eta";
181 for (
unsigned int k = 0;
k <
c_suffix.size();
k++) {
183 if (ig.
get(phi_label.Data()) !=
nullptr) {
184 gem_trk_phi[
i][
k] = (TH1F *)ig.
get(phi_label.Data())->getTH1F()->Clone();
185 gem_trk_phi[
i][
k]->Sumw2();
187 LogDebug(
"MuonGEMDigisHarvestor") <<
"Can not found track_phi";
190 if (ig.
get(eta_label.Data()) !=
nullptr && ig.
get(phi_label.Data()) !=
nullptr) {
191 for (
unsigned int j = 0; j <
l_suffix.size(); j++) {
194 if (ig.
get(eta_label.Data()) !=
nullptr) {
195 sh_eta[
i][j] = (TH1F *)ig.
get(eta_label.Data())->getTH1F()->Clone();
196 sh_eta[
i][j]->Sumw2();
198 LogDebug(
"MuonGEMDigisHarvestor") <<
"Can not found eta histogram : " << eta_label;
199 ProcessBooking(ibooker, ig,
"dg_eta", suffix, gem_trk_eta[i], sh_eta[i][j]);
200 ProcessBooking(ibooker, ig,
"pad_eta", suffix, gem_trk_eta[i], sh_eta[i][j]);
201 ProcessBooking(ibooker, ig,
"copad_eta", suffix, gem_trk_eta[i], sh_eta[i][j]);
202 for (
unsigned int k = 0;
k <
c_suffix.size();
k++) {
205 if (ig.
get(phi_label.Data()) !=
nullptr) {
206 sh_phi[
i][j][
k] = (TH1F *)ig.
get(phi_label.Data())->getTH1F()->Clone();
207 sh_phi[
i][j][
k]->Sumw2();
209 LogDebug(
"MuonGEMDigisHarvestor") <<
"Can not found phi plots : " << phi_label;
212 ProcessBooking(ibooker, ig,
"dg_phi", suffix, gem_trk_phi[i][k], sh_phi[i][j][k]);
213 ProcessBooking(ibooker, ig,
"pad_phi", suffix, gem_trk_phi[i][k], sh_phi[i][j][k]);
214 ProcessBooking(ibooker, ig,
"copad_phi", suffix, gem_trk_phi[i][k], sh_phi[i][j][k]);
218 LogDebug(
"MuonGEMDigisHarvestor") <<
"Can not find eta or phi of all track";
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
static const std::array< std::string, 4 > l_suffix
MonitorElement * bookProfile(Args &&...args)
void setCurrentFolder(std::string const &fullpath)
TProfile * ComputeEff(TH1F *num, TH1F *denum)
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
static const std::array< std::string, 2 > s_suffix
#define DEFINE_FWK_MODULE(type)
MuonGEMDigisHarvestor(const edm::ParameterSet &)
constructor
MonitorElement * get(std::string const &path)
std::string compareable_dbe_hist_prefix_
std::string compareable_dbe_path_
~MuonGEMDigisHarvestor() override
destructor
void ProcessBooking(DQMStore::IBooker &, DQMStore::IGetter &, const char *label, TString suffix, TH1F *track_hist, TH1F *sh_hist)
std::string dbe_hist_prefix_
static const std::array< std::string, 3 > c_suffix