16 #include <boost/algorithm/string.hpp>
18 #include "TGraphAsymmErrors.h"
65 std::vector<std::string> activeFilters;
66 std::vector<std::string> activeEleFilters;
67 std::vector<std::string> activeEle2LegFilters;
68 std::vector<std::string> activePhoFilters;
69 std::vector<std::string> activePho2LegFilters;
71 hltConfig, activeFilters, activeEleFilters, activeEle2LegFilters, activePhoFilters, activePho2LegFilters);
94 std::vector<std::string>
regions;
95 regions.emplace_back(
"eb");
96 regions.emplace_back(
"ee");
100 for (
auto const&
region : regions) {
106 eleHLTFilterName, eleHLTFilterName +
"_gsfEle_" + eleEffTag,
region,
eleN1EffVars_, ibooker, igetter);
119 for (
auto const&
region : regions) {
120 for (
size_t effNr = 0; effNr <
eleEffTags_.size(); effNr++) {
121 std::string trigNameLeg1 = filterNr.substr(0, filterNr.find(
"::"));
123 std::string trigNameLeg2 = filterNr.substr(filterNr.find(
"::") + 2);
133 for (
auto const&
region : regions) {
138 phoHLTFilterName, phoHLTFilterName +
"_pho_" + phoEffTag,
region,
phoN1EffVars_, ibooker, igetter);
153 for (
auto const&
region : regions) {
172 const std::vector<std::string>&
varNames,
192 for (
auto const& varName : varNames) {
194 igetter.
get(
dirName_ +
"/Source_Histos/" + filterName +
"/" + baseName +
"_HLT" + varName +
"_" + region);
196 igetter.
get(
dirName_ +
"/Source_Histos/" + filterName +
"/" + baseName +
"_" + varName +
"_" + region);
197 if (numer !=
nullptr && denom !=
nullptr) {
198 std::string effHistName(baseName +
"_HLToverOffline_" + varName +
"_" +
201 if (region ==
"eb" || region ==
"ee") {
203 effHistTitle =
"Barrel " + baseName +
" HLToverOffline " + varName;
205 effHistTitle =
"Endcap " + baseName +
" HLToverOffline " + varName;
220 if (num->GetSumw2N() == 0)
224 if (den->GetSumw2N() == 0)
227 auto* h_eff = (TH1F*)num->Clone(name.c_str());
228 h_eff->Divide(num, den, 1, 1,
"B");
229 h_eff->SetTitle(title.c_str());
231 if (eff ==
nullptr) {
232 eff = ibooker.
book1D(name, h_eff);
243 const std::vector<std::string>&
varNames,
247 igetter.
get(
dirName_ +
"/Source_Histos/" + filterName +
"/" + baseName +
"_allCuts_" + region);
249 for (
auto const& varName : varNames) {
251 igetter.
get(
dirName_ +
"/Source_Histos/" + filterName +
"/" + baseName +
"_n1_" + varName +
"_" + region);
252 if (numer !=
nullptr && denom !=
nullptr) {
253 std::string effHistName(baseName +
"_n1Eff_" + varName +
"_" +
258 if (region ==
"eb" || region ==
"ee") {
260 effHistTitle =
"Barrel " + baseName +
" N1eff " + varName;
262 effHistTitle =
"Endcap " + baseName +
" N1eff " + varName;
273 const std::vector<std::string>&
varNames,
278 for (
auto const& varName : varNames) {
280 igetter.
get(
dirName_ +
"/Source_Histos/" + filterName +
"/" + baseName +
"_single_" + varName +
"_" + region);
281 if (numer !=
nullptr && denom !=
nullptr) {
282 std::string effHistName(baseName +
"_singleEff_" + varName +
"_" +
286 if (region ==
"eb" || region ==
"ee") {
288 effHistTitle =
"Barrel " + baseName +
" SingleEff " + varName;
290 effHistTitle =
"Endcap " + baseName +
" SingleEff " + varName;
300 const std::vector<std::string>& vsVarNames,
304 for (
auto const& vsVarName : vsVarNames) {
305 std::string allName(
dirName_ +
"/Source_Histos/" + filterName +
"/" + filterName +
"_trigTagProbe_" + objName +
306 "_all_" + vsVarName +
"_" + region);
308 if (all ==
nullptr) {
311 std::string passName(
dirName_ +
"/Source_Histos/" + filterName +
"/" + filterName +
"_trigTagProbe_" + objName +
312 "_pass_" + vsVarName +
"_" + region);
314 if (pass ==
nullptr) {
318 std::string effHistTitle(filterName +
"_trigTagProbeEff_" + objName +
"_vs_" + vsVarName +
"_" +
320 if (region ==
"eb" || region ==
"ee") {
322 effHistTitle =
"Barrel " + filterName +
"_" + objName +
" TrigTagProbeEff vs " + vsVarName;
324 effHistTitle =
"Endcap " + filterName +
"_" + objName +
" TrigTagProbeEff vs " + vsVarName;
328 filterName +
"_trigTagProbeEff_" + objName +
"_vs_" + vsVarName +
"_" + region,
340 const std::vector<std::string>& vsVarNames,
344 for (
auto const& vsVarName : vsVarNames) {
352 std::string passName(
dirName_ +
"/Source_Histos/" + filterName +
"/" + filterName +
"_trigTagProbe_" + objName +
353 "_passNotTag_" + vsVarName +
"_" + region);
355 if (passNotTag ==
nullptr) {
359 std::string passTagTagName(
dirName_ +
"/Source_Histos/" + filterName +
"/" + filterName +
"_trigTagProbe_" +
360 objName +
"_passTagTag_" + vsVarName +
"_" + region);
362 if (passTagTag ==
nullptr) {
366 std::string failName(
dirName_ +
"/Source_Histos/" + filterName +
"/" + filterName +
"_trigTagProbe_" + objName +
367 "_fail_" + vsVarName +
"_" + region);
369 if (fail ==
nullptr) {
374 std::string effHistTitle(filterName +
"_trigTagProbeEff_" + objName +
"_vs_" + vsVarName +
"_" +
376 if (region ==
"eb" || region ==
"ee") {
378 effHistTitle =
"Barrel " + filterName +
"_" + objName +
" TrigTagProbeEff vs " + vsVarName;
380 effHistTitle =
"Endcap " + filterName +
"_" + objName +
" TrigTagProbeEff vs " + vsVarName;
385 filterName +
"_trigTagProbeEff_" + objName +
"_vs_" + vsVarName +
"_" + region,
398 const std::vector<std::string>& vsVarNames,
402 for (
auto const& vsVarName : vsVarNames) {
403 std::string allName(
dirName_ +
"/Source_Histos/" + filterNameLeg2 +
"/" + filterNameLeg2 +
"_trigTagProbe_" +
404 objName +
"_all_" + vsVarName +
"_" + region);
406 if (all ==
nullptr) {
407 edm::LogInfo(
"EgHLTOfflineClient") <<
" couldnt get hist " << allName;
411 std::string Leg2NotLeg1SourceName(
dirName_ +
"/Source_Histos/" + filterNameLeg2 +
"/" + filterNameLeg2 +
412 "_trigTagProbe_" + objName +
"_passLeg2failLeg1_" + vsVarName +
"_" + region);
414 if (Leg2NotLeg1Source ==
nullptr) {
415 edm::LogInfo(
"EgHLTOfflineClient") <<
" couldnt get hist " << Leg2NotLeg1SourceName;
419 std::string Leg1EffName(
dirName_ +
"/Client_Histos/" + filterNameLeg1 +
"/" + filterNameLeg1 +
"_trigTagProbeEff_" +
420 objName +
"_vs_" + vsVarName +
"_" + region);
422 if (Leg1Eff ==
nullptr) {
423 edm::LogInfo(
"EgHLTOfflineClient") <<
" couldnt get hist " << Leg1EffName;
427 std::string effHistTitle(filterNameLeg2 +
"_trigTagProbeEff2Leg_" + objName +
"_vs_" + vsVarName +
"_" +
429 if (region ==
"eb" || region ==
"ee") {
431 effHistTitle =
"Barrel " + filterNameLeg2 +
"_" + objName +
" TrigTagProbeEff2Leg vs " + vsVarName;
433 effHistTitle =
"Endcap " + filterNameLeg2 +
"_" + objName +
" TrigTagProbeEff2Leg vs " + vsVarName;
436 filterNameLeg2 +
"_trigTagProbeEff2Leg_" + objName +
"_vs_" + vsVarName +
"_" + region,
448 const std::vector<std::string>& vsVarNames,
452 for (
auto const& vsVarName : vsVarNames) {
453 for (
auto const& tightLooseTrigName : tightLooseTrigNames) {
456 if (splitString.size() != 2) {
463 "_failTrig_" + vsVarName +
"_" + region);
464 if (fail ==
nullptr) {
469 "_passTrig_" + vsVarName +
"_" + region);
470 if (pass ==
nullptr) {
474 const std::string newHistName(tightTrig +
"_trigEffTo_" + looseTrig +
"_" + objName +
"_vs_" + vsVarName +
"_" +
478 if (region ==
"eb" || region ==
"ee") {
480 effHistTitle =
"Barrel " + tightTrig +
"_TrigEffTo_" + looseTrig +
"_" + objName +
" vs " + vsVarName;
482 effHistTitle =
"Endcap " + tightTrig +
"_TrigEffTo_" + looseTrig +
"_" + objName +
" vs " + vsVarName;
498 TH1F* passHist = pass->
getTH1F();
499 if (passHist->GetSumw2N() == 0)
501 TH1F* allHist = all->
getTH1F();
502 if (allHist->GetSumw2N() == 0)
504 auto* effHist = (TH1F*)passHist->Clone(name.c_str());
505 effHist->Divide(passHist, allHist, 1, 1,
"B");
507 effHist->SetTitle(title.c_str());
510 if (eff ==
nullptr) {
511 eff = ibooker.
book1D(name, effHist);
528 TH1F* passHist = passNotTag->
getTH1F();
529 if (passHist->GetSumw2N() == 0)
531 TH1F* failHist = fail->
getTH1F();
532 if (failHist->GetSumw2N() == 0)
534 TH1F* tagtagHist = tagtag->
getTH1F();
535 if (tagtagHist->GetSumw2N() == 0)
537 auto* numer = (TH1F*)passHist->Clone(name.c_str());
538 if (numer->GetSumw2N() == 0)
540 numer->Add(tagtagHist, passHist, 2, 1);
541 auto*
denom = (TH1F*)passHist->Clone(name.c_str());
542 if (
denom->GetSumw2N() == 0)
544 denom->Add(tagtagHist, passHist, 2, 1);
545 denom->Add(failHist, 1);
546 auto* effHist = (TH1F*)passHist->Clone(name.c_str());
548 effHist->Divide(numer,
denom, 1, 1,
"B");
551 effHist->SetTitle(title.c_str());
554 if (eff ==
nullptr) {
555 eff = ibooker.
book1D(name, effHist);
572 TH1F* allHist = all->
getTH1F();
573 if (allHist->GetSumw2() ==
nullptr)
575 TH1F* Leg2NotLeg1SourceHist = Leg2NotLeg1Source->
getTH1F();
576 if (Leg2NotLeg1SourceHist->GetSumw2() ==
nullptr)
577 Leg2NotLeg1SourceHist->Sumw2();
579 auto* effHistLeg2NotLeg1 = (TH1F*)allHist->Clone(name.c_str());
580 if (effHistLeg2NotLeg1->GetSumw2() ==
nullptr)
581 effHistLeg2NotLeg1->Sumw2();
582 effHistLeg2NotLeg1->Divide(Leg2NotLeg1SourceHist, allHist, 1, 1,
"B");
584 TH1F* Leg1EffHist = Leg1Eff->
getTH1F();
585 if (Leg1EffHist->GetSumw2() ==
nullptr)
586 Leg1EffHist->Sumw2();
588 auto* effHistTerm1 = (TH1F*)allHist->Clone(name.c_str());
589 if (effHistTerm1->GetSumw2() ==
nullptr)
590 effHistTerm1->Sumw2();
591 effHistTerm1->Multiply(Leg1EffHist, Leg1EffHist, 1, 1,
"B");
593 auto* effHistTerm2 = (TH1F*)allHist->Clone(name.c_str());
594 if (effHistTerm2->GetSumw2() ==
nullptr)
595 effHistTerm2->Sumw2();
596 effHistTerm2->Multiply(Leg1EffHist, effHistLeg2NotLeg1, 1, 1,
"B");
597 effHistTerm2->Scale(2);
599 auto* effHist = (TH1F*)allHist->Clone(name.c_str());
600 if (effHist->GetSumw2() ==
nullptr)
602 effHist->Add(effHistTerm1, effHistTerm2, 1, 1);
603 effHist->SetTitle(title.c_str());
606 if (eff ==
nullptr) {
607 eff = ibooker.
book1D(name, effHist);
623 TH1F* failHist = fail->
getTH1F();
624 if (failHist->GetSumw2N() == 0)
626 TH1F* passHist = pass->
getTH1F();
627 if (passHist->GetSumw2N() == 0)
630 auto* effHist = (TH1F*)passHist->Clone(name.c_str());
631 effHist->Add(failHist);
632 effHist->Divide(passHist, effHist, 1, 1,
"B");
634 effHist->SetTitle(title.c_str());
637 if (eff ==
nullptr) {
638 eff = ibooker.
book1D(name, effHist);
void createTrigTagProbeEffHists(const std::string &filterName, const std::string ®ion, const std::vector< std::string > &vsVarNames, const std::string &objName, DQMStore::IBooker &, DQMStore::IGetter &)
const edm::EventSetup & c
void createTrigTagProbeEffHistsNewAlgo(const std::string &filterName, const std::string ®ion, const std::vector< std::string > &vsVarNames, const std::string &objName, DQMStore::IBooker &, DQMStore::IGetter &)
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
MonitorElement * makeEffMonElemFromPassAndFailAndTagTag(const std::string &filter, const std::string &name, const std::string &title, const MonitorElement *pass, const MonitorElement *fail, const MonitorElement *tagtag, DQMStore::IBooker &, DQMStore::IGetter &)
virtual void setCurrentFolder(std::string const &fullpath)
std::vector< std::string > eleHLTFilterNames_
std::vector< std::string > phoHLTFilterNames2Leg_
virtual TH1F * getTH1F() const
std::vector< std::string > phoLooseTightTrigEffVsVars_
constexpr char const * varNames[]
std::vector< std::string > splitString(const std::string &fLine)
bool runClientEndLumiBlock_
std::vector< std::string > phoTrigTPEffVsVars_
std::vector< std::string > eleTightLooseTrigNames_
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
std::vector< std::string > phoN1EffVars_
std::vector< std::string > eleHLTvOfflineVars_
std::vector< std::string > eleTrigTPEffVsVars_
void createSingleEffHists(const std::string &filterName, const std::string &baseName, const std::string ®ion, const std::vector< std::string > &varNames, DQMStore::IBooker &, DQMStore::IGetter &)
void createLooseTightTrigEff(const std::vector< std::string > &tightLooseTrigNames, const std::string ®ion, const std::vector< std::string > &vsVarNames, const std::string &objName, DQMStore::IBooker &, DQMStore::IGetter &)
virtual MonitorElement * get(std::string const &fullpath) const
std::vector< std::string > phoEffTags_
MonitorElement * makeEffMonElemFromPassAndFail(const std::string &filterName, const std::string &name, const std::string &title, const MonitorElement *pass, const MonitorElement *fail, DQMStore::IBooker &, DQMStore::IGetter &)
std::vector< std::string > phoSingleEffVars_
void createHLTvsOfflineHists(const std::string &filterName, const std::string &baseName, const std::string ®ion, const std::vector< std::string > &varNames, DQMStore::IBooker &, DQMStore::IGetter &)
Log< level::Info, false > LogInfo
MonitorElement * makeEffMonElemFromPassAndAll(const std::string &filterName, const std::string &name, const std::string &title, const MonitorElement *pass, const MonitorElement *all, DQMStore::IBooker &, DQMStore::IGetter &)
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
T getParameter(std::string const &) const
void runClient_(DQMStore::IBooker &, DQMStore::IGetter &)
bool filterInactiveTriggers_
void createTrigTagProbeEffHists2Leg(const std::string &filterNameLeg1, const std::string &filterNameLeg2, const std::string ®ion, const std::vector< std::string > &vsVarNames, const std::string &objName, DQMStore::IBooker &, DQMStore::IGetter &)
std::vector< std::string > eleN1EffVars_
std::vector< std::string > phoTightLooseTrigNames_
std::vector< std::string > phoHLTvOfflineVars_
std::vector< std::string > phoHLTFilterNames_
EgHLTOfflineClient(const edm::ParameterSet &)
std::vector< std::string > eleLooseTightTrigEffVsVars_
MonitorElement * makeEffMonElem2Leg(const std::string &filter, const std::string &name, const std::string &title, const MonitorElement *Leg1Eff, const MonitorElement *Leg2NotLeg1Source, const MonitorElement *all, DQMStore::IBooker &, DQMStore::IGetter &)
void createN1EffHists(const std::string &filterName, const std::string &baseName, const std::string ®ion, const std::vector< std::string > &varNames, DQMStore::IBooker &, DQMStore::IGetter &)
std::vector< std::string > eleEffTags_
void beginRun(const edm::Run &run, const edm::EventSetup &c) override
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
MonitorElement * FillHLTvsOfflineHist(const std::string &filter, const std::string &name, const std::string &title, const MonitorElement *numer, const MonitorElement *denom, DQMStore::IBooker &, DQMStore::IGetter &)
std::vector< std::string > eleHLTFilterNames2Leg_
~EgHLTOfflineClient() override
std::vector< std::string > eleSingleEffVars_