18 #include <boost/algorithm/string.hpp> 20 #include "TGraphAsymmErrors.h" 74 std::vector<std::string> activeFilters;
75 std::vector<std::string> activeEleFilters;
76 std::vector<std::string> activeEle2LegFilters;
77 std::vector<std::string> activePhoFilters;
78 std::vector<std::string> activePho2LegFilters;
80 activeEle2LegFilters, activePhoFilters, activePho2LegFilters);
105 std::vector<std::string>
regions;
106 regions.emplace_back(
"eb");
107 regions.emplace_back(
"ee");
111 for (
auto const & region : regions) {
117 eleHLTFilterName +
"_gsfEle_" + eleEffTag, region,
121 eleHLTFilterName +
"_gsfEle_" + eleEffTag, region,
128 eleHLTFilterName +
"_gsfEle_passFilter", region,
135 for (
auto const & region : regions) {
136 for (
size_t effNr = 0; effNr <
eleEffTags_.size(); effNr++) {
138 0, filterNr.find(
"::"));
141 filterNr.find(
"::") + 2);
151 for (
auto const & region : regions) {
156 phoHLTFilterName +
"_pho_" + phoEffTag, region,
160 phoHLTFilterName +
"_pho_" + phoEffTag, region,
167 phoHLTFilterName +
"_pho_passFilter", region,
175 for (
auto const & region : regions) {
216 for (
auto const & varName : varNames) {
219 if (numer !=
nullptr && denom !=
nullptr) {
220 std::string effHistName(baseName +
"_HLToverOffline_" + varName +
"_" + region);
222 if (region ==
"eb" || region ==
"ee") {
223 if (region ==
"eb") effHistTitle =
"Barrel " + baseName +
" HLToverOffline " + varName;
224 if (region ==
"ee") effHistTitle =
"Endcap " + baseName +
" HLToverOffline " + varName;
236 if (num->GetSumw2N() == 0) num->Sumw2();
239 if (den->GetSumw2N() == 0) den->Sumw2();
241 auto* h_eff = (TH1F*)num->Clone(name.c_str());
242 h_eff->Divide(num, den, 1, 1,
"B");
243 h_eff->SetTitle(title.c_str());
245 if (eff ==
nullptr) {
246 eff = ibooker.
book1D(name, h_eff);
261 for (
auto const & varName : varNames) {
263 if (numer !=
nullptr && denom !=
nullptr) {
264 std::string effHistName(baseName+
"_n1Eff_"+varName+
"_"+region);
268 if ( region ==
"eb" || region ==
"ee"){
269 if (region ==
"eb") effHistTitle =
"Barrel "+baseName+
" N1eff "+varName;
270 if (region ==
"ee") effHistTitle =
"Endcap "+baseName+
" N1eff "+varName;
286 for (
auto const & varName : varNames) {
288 if (numer !=
nullptr && denom !=
nullptr) {
289 std::string effHistName(baseName +
"_singleEff_" + varName +
"_" + region);
292 if (region ==
"eb" || region ==
"ee") {
293 if (region ==
"eb") effHistTitle =
"Barrel " + baseName +
" SingleEff " + varName;
294 if (region ==
"ee") effHistTitle =
"Endcap " + baseName +
" SingleEff " + varName;
304 const std::string& region,
const std::vector<std::string>& vsVarNames,
307 for (
auto const & vsVarName : vsVarNames) {
308 std::string allName(
dirName_ +
"/Source_Histos/" + filterName +
"/" + filterName +
"_trigTagProbe_" + objName +
"_all_" + vsVarName +
"_" + region);
310 if (all ==
nullptr) {
313 std::string passName(
dirName_ +
"/Source_Histos/" + filterName +
"/" + filterName +
"_trigTagProbe_" + objName +
"_pass_" + vsVarName +
"_" + region);
315 if (pass ==
nullptr) {
319 std::string effHistTitle(filterName +
"_trigTagProbeEff_" + objName +
"_vs_" + vsVarName +
"_" + region);
320 if (region ==
"eb" || region ==
"ee") {
321 if (region ==
"eb") effHistTitle =
"Barrel " + filterName +
"_" + objName +
" TrigTagProbeEff vs " + vsVarName;
322 if (region ==
"ee") effHistTitle =
"Endcap " + filterName +
"_" + objName +
" TrigTagProbeEff vs " + vsVarName;
326 filterName +
"_trigTagProbeEff_" + objName +
"_vs_" + vsVarName +
"_" + region,
327 effHistTitle, pass, all, ibooker, igetter);
333 const std::string& region,
const std::vector<std::string>& vsVarNames,
336 for (
auto const & vsVarName : vsVarNames) {
344 std::string passName(
dirName_+
"/Source_Histos/"+filterName+
"/"+filterName+
"_trigTagProbe_"+objName+
"_passNotTag_"+vsVarName+
"_"+region);
346 if (passNotTag ==
nullptr) {
350 std::string passTagTagName(
dirName_+
"/Source_Histos/"+filterName+
"/"+filterName+
"_trigTagProbe_"+objName+
"_passTagTag_"+vsVarName+
"_"+region);
352 if (passTagTag ==
nullptr) {
356 std::string failName(
dirName_+
"/Source_Histos/"+filterName+
"/"+filterName+
"_trigTagProbe_"+objName+
"_fail_"+vsVarName+
"_"+region);
358 if (fail ==
nullptr) {
363 std::string effHistTitle(filterName+
"_trigTagProbeEff_"+objName+
"_vs_"+vsVarName+
"_"+region);
364 if (region ==
"eb" || region ==
"ee") {
365 if (region ==
"eb") effHistTitle =
"Barrel " + filterName +
"_"+objName +
" TrigTagProbeEff vs " + vsVarName;
366 if (region ==
"ee") effHistTitle =
"Endcap " + filterName +
"_"+objName +
" TrigTagProbeEff vs " + vsVarName;
370 filterName +
"_trigTagProbeEff_" + objName +
"_vs_" + vsVarName +
"_" + region,
371 effHistTitle, passNotTag, fail, passTagTag, ibooker, igetter);
380 for (
auto const & vsVarName : vsVarNames) {
382 std::string allName(
dirName_+
"/Source_Histos/"+filterNameLeg2+
"/"+filterNameLeg2+
"_trigTagProbe_"+objName+
"_all_"+vsVarName+
"_"+region);
384 if (all ==
nullptr) {
385 edm::LogInfo(
"EgHLTOfflineClient") <<
" couldnt get hist "<<allName;
389 std::string Leg2NotLeg1SourceName(
dirName_+
"/Source_Histos/"+filterNameLeg2+
"/"+filterNameLeg2+
"_trigTagProbe_"+objName+
"_passLeg2failLeg1_"+vsVarName+
"_"+region);
391 if (Leg2NotLeg1Source ==
nullptr) {
392 edm::LogInfo(
"EgHLTOfflineClient") <<
" couldnt get hist "<<Leg2NotLeg1SourceName;
396 std::string Leg1EffName(
dirName_+
"/Client_Histos/"+filterNameLeg1+
"/"+filterNameLeg1+
"_trigTagProbeEff_"+objName+
"_vs_"+vsVarName+
"_"+region);
398 if (Leg1Eff ==
nullptr) {
399 edm::LogInfo(
"EgHLTOfflineClient") <<
" couldnt get hist "<<Leg1EffName;
403 std::string effHistTitle(filterNameLeg2+
"_trigTagProbeEff2Leg_"+objName+
"_vs_"+vsVarName+
"_"+region);
404 if (region ==
"eb" || region ==
"ee") {
405 if (region ==
"eb") effHistTitle =
"Barrel " + filterNameLeg2 +
"_" + objName +
" TrigTagProbeEff2Leg vs " + vsVarName;
406 if (region ==
"ee") effHistTitle =
"Endcap " + filterNameLeg2 +
"_" + objName +
" TrigTagProbeEff2Leg vs " + vsVarName;
409 filterNameLeg2 +
"_trigTagProbeEff2Leg_" + objName +
"_vs_" + vsVarName +
"_" + region,
410 effHistTitle, Leg1Eff, Leg2NotLeg1Source, all, ibooker, igetter);
416 const std::vector<std::string>& tightLooseTrigNames,
const std::string& region,
420 for (
auto const & vsVarName : vsVarNames) {
421 for (
auto const & tightLooseTrigName : tightLooseTrigNames) {
424 if (splitString.size() != 2) {
430 MonitorElement*
fail = igetter.
get(
dirName_ +
"/Source_Histos/" + tightTrig +
"_" + looseTrig +
"_" + objName +
"_failTrig_" + vsVarName +
"_" + region);
431 if (fail ==
nullptr) {
435 MonitorElement* pass = igetter.
get(
dirName_ +
"/Source_Histos/" + tightTrig +
"_" + looseTrig +
"_" + objName +
"_passTrig_" + vsVarName +
"_" + region);
436 if (pass ==
nullptr) {
440 const std::string newHistName(tightTrig +
"_trigEffTo_" + looseTrig +
"_" + objName +
"_vs_" + vsVarName +
"_" + region);
443 if (region ==
"eb" || region ==
"ee") {
444 if (region ==
"eb") effHistTitle =
"Barrel " + tightTrig +
"_TrigEffTo_" + looseTrig +
"_" + objName +
" vs " + vsVarName;
445 if (region ==
"ee") effHistTitle =
"Endcap " + tightTrig +
"_TrigEffTo_" + looseTrig +
"_" + objName +
" vs " + vsVarName;
460 TH1F* passHist = pass->
getTH1F();
461 if (passHist->GetSumw2N() == 0) passHist->Sumw2();
462 TH1F* allHist = all->
getTH1F();
463 if (allHist->GetSumw2N() == 0) allHist->Sumw2();
464 auto* effHist = (TH1F*) passHist->Clone(name.c_str());
465 effHist->Divide(passHist,allHist,1,1,
"B");
467 effHist->SetTitle(title.c_str());
470 if (eff ==
nullptr) {
471 eff = ibooker.
book1D(name,effHist);
484 TH1F* passHist = passNotTag->
getTH1F();
485 if (passHist->GetSumw2N() == 0) passHist->Sumw2();
486 TH1F* failHist = fail->
getTH1F();
487 if (failHist->GetSumw2N() == 0) failHist->Sumw2();
488 TH1F* tagtagHist = tagtag->
getTH1F();
489 if (tagtagHist->GetSumw2N() == 0) tagtagHist->Sumw2();
490 auto* numer = (TH1F*) passHist->Clone(name.c_str());
491 if (numer->GetSumw2N() == 0) numer->Sumw2();
492 numer->Add(tagtagHist,passHist,2,1);
493 auto* denom = (TH1F*) passHist->Clone(name.c_str());
494 if (denom->GetSumw2N() == 0) denom->Sumw2();
495 denom->Add(tagtagHist,passHist,2,1);
496 denom->Add(failHist,1);
497 auto* effHist = (TH1F*) passHist->Clone(name.c_str());
499 effHist->Divide(numer, denom, 1, 1,
"B");
502 effHist->SetTitle(title.c_str());
505 if (eff ==
nullptr) {
506 eff = ibooker.
book1D(name, effHist);
521 TH1F* allHist = all->
getTH1F();
522 if (allHist->GetSumw2() ==
nullptr) allHist->Sumw2();
523 TH1F* Leg2NotLeg1SourceHist = Leg2NotLeg1Source->
getTH1F();
524 if (Leg2NotLeg1SourceHist->GetSumw2() ==
nullptr) Leg2NotLeg1SourceHist->Sumw2();
526 auto* effHistLeg2NotLeg1 = (TH1F*)allHist->Clone(name.c_str());
527 if (effHistLeg2NotLeg1->GetSumw2() ==
nullptr) effHistLeg2NotLeg1->Sumw2();
528 effHistLeg2NotLeg1->Divide(Leg2NotLeg1SourceHist, allHist, 1, 1,
"B");
530 TH1F* Leg1EffHist = Leg1Eff->
getTH1F();
531 if (Leg1EffHist->GetSumw2() ==
nullptr) Leg1EffHist->Sumw2();
533 auto* effHistTerm1 = (TH1F*)allHist->Clone(name.c_str());
534 if (effHistTerm1->GetSumw2() ==
nullptr) effHistTerm1->Sumw2();
535 effHistTerm1->Multiply(Leg1EffHist, Leg1EffHist, 1, 1,
"B");
537 auto* effHistTerm2 = (TH1F*)allHist->Clone(name.c_str());
538 if (effHistTerm2->GetSumw2() ==
nullptr) effHistTerm2->Sumw2();
539 effHistTerm2->Multiply(Leg1EffHist, effHistLeg2NotLeg1, 1, 1,
"B");
540 effHistTerm2->Scale(2);
542 auto* effHist = (TH1F*)allHist->Clone(name.c_str());
543 if (effHist->GetSumw2() ==
nullptr) effHist->Sumw2();
544 effHist->Add(effHistTerm1, effHistTerm2, 1, 1);
545 effHist->SetTitle(title.c_str());
548 if (eff ==
nullptr) {
549 eff = ibooker.
book1D(name, effHist);
562 TH1F* failHist = fail->
getTH1F();
563 if (failHist->GetSumw2N() == 0) failHist->Sumw2();
564 TH1F* passHist = pass->
getTH1F();
565 if (passHist->GetSumw2N() == 0) passHist->Sumw2();
567 auto* effHist = (TH1F*) passHist->Clone(name.c_str());
568 effHist->Add(failHist);
569 effHist->Divide(passHist, effHist, 1, 1,
"B");
571 effHist->SetTitle(title.c_str());
574 if (eff ==
nullptr) {
575 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 &)
T getParameter(std::string const &) const
MonitorElement * FillHLTvsOfflineHist(const std::string &filter, const std::string &name, const std::string &title, const MonitorElement *numer, const MonitorElement *denom, DQMStore::IBooker &, DQMStore::IGetter &)
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
std::vector< std::string > splitString(const std::string &fLine)
std::vector< std::string > eleHLTFilterNames_
std::vector< std::string > phoHLTFilterNames2Leg_
std::vector< std::string > phoLooseTightTrigEffVsVars_
EgHLTOfflineClient(const EgHLTOfflineClient &rhs)
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_
void setCurrentFolder(std::string const &fullpath)
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 &)
MonitorElement * book1D(Args &&...args)
std::vector< std::string > phoEffTags_
MonitorElement * get(std::string const &path)
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 &)
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
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 &)
MonitorElement * makeEffMonElemFromPassAndAll(const std::string &filterName, const std::string &name, const std::string &title, const MonitorElement *pass, const MonitorElement *all, DQMStore::IBooker &, DQMStore::IGetter &)
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_
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 > phoHLTFilterNames_
std::vector< std::string > eleLooseTightTrigEffVsVars_
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 * 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 &)
std::vector< std::string > eleHLTFilterNames2Leg_
~EgHLTOfflineClient() override
std::vector< std::string > eleSingleEffVars_