37 std::map<std::string, MonitorElement*>
effHistos;
43 : passNfailHistoNames(pSet.getUntrackedParameter<
std::
vector<
std::
string>>(
"histoNames")),
45 edm::LogVerbatim(
"DQMOffline|MuonDPG|TnPEfficiencyClient") <<
"TnPEfficiencyClient: Constructor called";
49 edm::LogVerbatim(
"DQMOffline|MuonDPG|TnPEfficiencyClient") <<
"TnPEfficiencyClient: Constructor called";
58 edm::LogVerbatim(
"DQMOffline|MuonDPG|TnPEfficiencyClient") <<
"TnPEfficiencyClient: endluminosityBlock";
62 edm::LogVerbatim(
"DQMOffline|MuonDPG|TnPEfficiencyClient") <<
"TnPEfficiencyClient: endRun";
69 TH1::SetDefaultSumw2(kTRUE);
72 TH1::SetDefaultSumw2(kTRUE);
83 int fir = passHistoName.find(
'_');
84 int sec = passHistoName.find(
'_', fir + 1);
87 std::string effHistoName = chName +
"_chamberEff_" + specifier;
89 if (!me_pass || !me_fail) {
90 edm::LogWarning(
"TnPEfficiencyClient") <<
"Monitor Element not available" << std::endl;
97 edm::LogWarning(
"TnPEfficiencyClient") <<
"Monitor Element not available" << std::endl;
101 TH1F* h1_pass = me_pass->
getTH1F();
102 TH1F* h1_fail = me_fail->
getTH1F();
104 const int nBinX_pass = h1_pass->GetNbinsX();
105 const int nBinX_fail = h1_fail->GetNbinsX();
107 if (nBinX_pass != nBinX_fail) {
109 <<
"Histograms with different number of bins: unable to compute the ratio" << std::endl;
113 TH1F* h1_den = (TH1F*)h1_pass->Clone();
114 TH1F* h1_num = (TH1F*)h1_pass->Clone();
117 h1_den->Add(h1_fail);
119 h1_num->Divide(h1_den);
120 TH1F* h1_ratio = (TH1F*)h1_num->Clone();
123 effHistos[effHistoName]->setTitle(effHistoName);
124 effHistos[effHistoName]->setAxisTitle(
"Efficiency", 2);
131 <<
"Monitor Element not available: unable to compute the ratio" << std::endl;
135 TH2F* h2_pass = me_pass->
getTH2F();
136 TH2F* h2_fail = me_fail->
getTH2F();
138 const int nBinX_pass = h2_pass->GetNbinsX();
139 const int nBinX_fail = h2_fail->GetNbinsX();
140 const int nBinY_pass = h2_pass->GetNbinsY();
141 const int nBinY_fail = h2_fail->GetNbinsY();
143 if ((nBinX_pass != nBinX_fail) || (nBinY_pass != nBinY_fail)) {
145 <<
"Histograms with different number of bins: unable to compute the ratio" << std::endl;
149 TH2F* h2_den = (TH2F*)h2_pass->Clone();
150 TH2F* h2_num = (TH2F*)h2_pass->Clone();
153 h2_den->Add(h2_fail);
155 h2_num->Divide(h2_den);
156 TH2F* h2_ratio = (TH2F*)h2_num->Clone();
159 effHistos[effHistoName]->setTitle(effHistoName);
160 effHistos[effHistoName]->setAxisTitle(
"Efficiency", 3);
Log< level::Info, true > LogVerbatim
~TnPEfficiencyClient() override
std::map< std::string, MonitorElement * > effHistos
std::string topFolder() const
Return the top folder.
virtual void setCurrentFolder(std::string const &fullpath)
Kind kind() const
Get the type of the monitor element.
static const uint32_t DQM_PROP_TYPE_TH1F
virtual TH2F * getTH2F() const
std::vector< std::string > passNfailHistoNames
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
#define DEFINE_FWK_MODULE(type)
TnPEfficiencyClient(const edm::ParameterSet &pSet)
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
virtual TH1F * getTH1F() const
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
virtual MonitorElement * get(std::string const &fullpath) const
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
void beginRun(const edm::Run &, const edm::EventSetup &) override
static const uint32_t DQM_PROP_TYPE_TH2F