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.push_back(
"eb");
107 regions.push_back(
"ee");
111 for (
size_t regionNr = 0; regionNr < regions.size(); regionNr++) {
112 for (
size_t effNr = 0; effNr <
eleEffTags_.size(); effNr++) {
135 for (
size_t regionNr = 0; regionNr < regions.size(); regionNr++) {
136 for (
size_t effNr = 0; effNr <
eleEffTags_.size(); effNr++) {
151 for (
size_t regionNr = 0; regionNr < regions.size(); regionNr++) {
152 for (
size_t effNr = 0; effNr <
phoEffTags_.size(); effNr++) {
175 for (
size_t regionNr = 0; regionNr < regions.size(); regionNr++) {
216 for (
size_t varNr = 0; varNr < varNames.size(); varNr++) {
217 MonitorElement* numer = igetter.
get(
dirName_+
"/Source_Histos/"+filterName+
"/"+baseName+
"_HLT"+varNames[varNr]+
"_"+region);
219 if (numer !=
NULL && denom !=
NULL) {
220 std::string effHistName(baseName +
"_HLToverOffline_" + varNames[varNr] +
"_" + region);
222 if (region ==
"eb" || region ==
"ee") {
223 if (region ==
"eb") effHistTitle =
"Barrel " + baseName +
" HLToverOffline " + varNames[varNr];
224 if (region ==
"ee") effHistTitle =
"Endcap " + baseName +
" HLToverOffline " + varNames[varNr];
236 if (num->GetSumw2N() == 0) num->Sumw2();
239 if (den->GetSumw2N() == 0) den->Sumw2();
241 TH1F* h_eff = (TH1F*)num->Clone(name.c_str());
242 h_eff->Divide(num, den, 1, 1,
"B");
243 h_eff->SetTitle(title.c_str());
246 eff = ibooker.
book1D(name, h_eff);
261 for (
size_t varNr = 0; varNr < varNames.size(); varNr++) {
262 MonitorElement* denom = igetter.
get(
dirName_+
"/Source_Histos/"+filterName+
"/"+baseName+
"_n1_"+varNames[varNr]+
"_"+region);
263 if (numer !=
NULL && denom !=
NULL) {
264 std::string effHistName(baseName+
"_n1Eff_"+varNames[varNr]+
"_"+region);
268 if ( region ==
"eb" || region ==
"ee"){
269 if (region ==
"eb") effHistTitle =
"Barrel "+baseName+
" N1eff "+varNames[varNr];
270 if (region ==
"ee") effHistTitle =
"Endcap "+baseName+
" N1eff "+varNames[varNr];
286 for (
size_t varNr = 0; varNr < varNames.size(); varNr++) {
287 MonitorElement* numer = igetter.
get(
dirName_+
"/Source_Histos/"+filterName+
"/"+baseName+
"_single_"+varNames[varNr]+
"_"+region);
288 if (numer !=
NULL && denom !=
NULL) {
289 std::string effHistName(baseName +
"_singleEff_" + varNames[varNr] +
"_" + region);
292 if (region ==
"eb" || region ==
"ee") {
293 if (region ==
"eb") effHistTitle =
"Barrel " + baseName +
" SingleEff " + varNames[varNr];
294 if (region ==
"ee") effHistTitle =
"Endcap " + baseName +
" SingleEff " + varNames[varNr];
307 for (
size_t varNr = 0; varNr < vsVarNames.size(); varNr++) {
308 std::string allName(
dirName_ +
"/Source_Histos/" + filterName +
"/" + filterName +
"_trigTagProbe_" + objName +
"_all_" + vsVarNames[varNr] +
"_" + region);
313 std::string passName(
dirName_ +
"/Source_Histos/" + filterName +
"/" + filterName +
"_trigTagProbe_" + objName +
"_pass_" + vsVarNames[varNr] +
"_" + region);
319 std::string effHistTitle(filterName +
"_trigTagProbeEff_" + objName +
"_vs_" + vsVarNames[varNr] +
"_" + region);
320 if (region ==
"eb" || region ==
"ee") {
321 if (region ==
"eb") effHistTitle =
"Barrel " + filterName +
"_" + objName +
" TrigTagProbeEff vs " + vsVarNames[varNr];
322 if (region ==
"ee") effHistTitle =
"Endcap " + filterName +
"_" + objName +
" TrigTagProbeEff vs " + vsVarNames[varNr];
326 filterName +
"_trigTagProbeEff_" + objName +
"_vs_" + vsVarNames[varNr] +
"_" + region,
327 effHistTitle, pass, all, ibooker, igetter);
336 for (
size_t varNr = 0; varNr < vsVarNames.size(); varNr++) {
344 std::string passName(
dirName_+
"/Source_Histos/"+filterName+
"/"+filterName+
"_trigTagProbe_"+objName+
"_passNotTag_"+vsVarNames[varNr]+
"_"+region);
346 if (passNotTag ==
NULL) {
350 std::string passTagTagName(
dirName_+
"/Source_Histos/"+filterName+
"/"+filterName+
"_trigTagProbe_"+objName+
"_passTagTag_"+vsVarNames[varNr]+
"_"+region);
352 if (passTagTag ==
NULL) {
356 std::string failName(
dirName_+
"/Source_Histos/"+filterName+
"/"+filterName+
"_trigTagProbe_"+objName+
"_fail_"+vsVarNames[varNr]+
"_"+region);
363 std::string effHistTitle(filterName+
"_trigTagProbeEff_"+objName+
"_vs_"+vsVarNames[varNr]+
"_"+region);
364 if (region ==
"eb" || region ==
"ee") {
365 if (region ==
"eb") effHistTitle =
"Barrel " + filterName +
"_"+objName +
" TrigTagProbeEff vs " + vsVarNames[varNr];
366 if (region ==
"ee") effHistTitle =
"Endcap " + filterName +
"_"+objName +
" TrigTagProbeEff vs " + vsVarNames[varNr];
370 filterName +
"_trigTagProbeEff_" + objName +
"_vs_" + vsVarNames[varNr] +
"_" + region,
371 effHistTitle, passNotTag, fail, passTagTag, ibooker, igetter);
377 const std::vector<std::string>& vsVarNames,
const std::string& objName,
380 for (
size_t varNr = 0; varNr < vsVarNames.size(); varNr++) {
382 std::string allName(
dirName_+
"/Source_Histos/"+filterNameLeg2+
"/"+filterNameLeg2+
"_trigTagProbe_"+objName+
"_all_"+vsVarNames[varNr]+
"_"+region);
385 edm::LogInfo(
"EgHLTOfflineClient") <<
" couldnt get hist "<<allName;
389 std::string Leg2NotLeg1SourceName(
dirName_+
"/Source_Histos/"+filterNameLeg2+
"/"+filterNameLeg2+
"_trigTagProbe_"+objName+
"_passLeg2failLeg1_"+vsVarNames[varNr]+
"_"+region);
391 if (Leg2NotLeg1Source ==
NULL) {
392 edm::LogInfo(
"EgHLTOfflineClient") <<
" couldnt get hist "<<Leg2NotLeg1SourceName;
396 std::string Leg1EffName(
dirName_+
"/Client_Histos/"+filterNameLeg1+
"/"+filterNameLeg1+
"_trigTagProbeEff_"+objName+
"_vs_"+vsVarNames[varNr]+
"_"+region);
398 if (Leg1Eff ==
NULL) {
399 edm::LogInfo(
"EgHLTOfflineClient") <<
" couldnt get hist "<<Leg1EffName;
403 std::string effHistTitle(filterNameLeg2+
"_trigTagProbeEff2Leg_"+objName+
"_vs_"+vsVarNames[varNr]+
"_"+region);
404 if (region ==
"eb" || region ==
"ee") {
405 if (region ==
"eb") effHistTitle =
"Barrel " + filterNameLeg2 +
"_" + objName +
" TrigTagProbeEff2Leg vs " + vsVarNames[varNr];
406 if (region ==
"ee") effHistTitle =
"Endcap " + filterNameLeg2 +
"_" + objName +
" TrigTagProbeEff2Leg vs " + vsVarNames[varNr];
409 filterNameLeg2 +
"_trigTagProbeEff2Leg_" + objName +
"_vs_" + vsVarNames[varNr] +
"_" + region,
410 effHistTitle, Leg1Eff, Leg2NotLeg1Source, all, ibooker, igetter);
417 const std::vector<std::string>& vsVarNames,
const std::string& objName,
420 for (
size_t varNr = 0; varNr < vsVarNames.size(); varNr++) {
421 for (
size_t trigNr = 0; trigNr < tightLooseTrigNames.size(); trigNr++) {
424 if (splitString.size() != 2) {
430 MonitorElement*
fail = igetter.
get(
dirName_ +
"/Source_Histos/" + tightTrig +
"_" + looseTrig +
"_" + objName +
"_failTrig_" + vsVarNames[varNr] +
"_" + region);
435 MonitorElement* pass = igetter.
get(
dirName_ +
"/Source_Histos/" + tightTrig +
"_" + looseTrig +
"_" + objName +
"_passTrig_" + vsVarNames[varNr] +
"_" + region);
440 const std::string newHistName(tightTrig +
"_trigEffTo_" + looseTrig +
"_" + objName +
"_vs_" + vsVarNames[varNr] +
"_" + region);
443 if (region ==
"eb" || region ==
"ee") {
444 if (region ==
"eb") effHistTitle =
"Barrel " + tightTrig +
"_TrigEffTo_" + looseTrig +
"_" + objName +
" vs " + vsVarNames[varNr];
445 if (region ==
"ee") effHistTitle =
"Endcap " + tightTrig +
"_TrigEffTo_" + looseTrig +
"_" + objName +
" vs " + vsVarNames[varNr];
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 TH1F* effHist = (TH1F*) passHist->Clone(name.c_str());
465 effHist->Divide(passHist,allHist,1,1,
"B");
467 effHist->SetTitle(title.c_str());
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 TH1F* numer = (TH1F*) passHist->Clone(name.c_str());
491 if (numer->GetSumw2N() == 0) numer->Sumw2();
492 numer->Add(tagtagHist,passHist,2,1);
493 TH1F* 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 TH1F* effHist = (TH1F*) passHist->Clone(name.c_str());
499 effHist->Divide(numer, denom, 1, 1,
"B");
502 effHist->SetTitle(title.c_str());
506 eff = ibooker.
book1D(name, effHist);
521 TH1F* allHist = all->
getTH1F();
522 if (allHist->GetSumw2() == 0) allHist->Sumw2();
523 TH1F* Leg2NotLeg1SourceHist = Leg2NotLeg1Source->
getTH1F();
524 if (Leg2NotLeg1SourceHist->GetSumw2() == 0) Leg2NotLeg1SourceHist->Sumw2();
526 TH1F* effHistLeg2NotLeg1 = (TH1F*)allHist->Clone(name.c_str());
527 if (effHistLeg2NotLeg1->GetSumw2() == 0) effHistLeg2NotLeg1->Sumw2();
528 effHistLeg2NotLeg1->Divide(Leg2NotLeg1SourceHist, allHist, 1, 1,
"B");
530 TH1F* Leg1EffHist = Leg1Eff->
getTH1F();
531 if (Leg1EffHist->GetSumw2() == 0) Leg1EffHist->Sumw2();
533 TH1F* effHistTerm1 = (TH1F*)allHist->Clone(name.c_str());
534 if (effHistTerm1->GetSumw2() == 0) effHistTerm1->Sumw2();
535 effHistTerm1->Multiply(Leg1EffHist, Leg1EffHist, 1, 1,
"B");
537 TH1F* effHistTerm2 = (TH1F*)allHist->Clone(name.c_str());
538 if (effHistTerm2->GetSumw2() == 0) effHistTerm2->Sumw2();
539 effHistTerm2->Multiply(Leg1EffHist, effHistLeg2NotLeg1, 1, 1,
"B");
540 effHistTerm2->Scale(2);
542 TH1F* effHist = (TH1F*)allHist->Clone(name.c_str());
543 if (effHist->GetSumw2() == 0) effHist->Sumw2();
544 effHist->Add(effHistTerm1, effHistTerm2, 1, 1);
545 effHist->SetTitle(title.c_str());
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 TH1F* 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());
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 > eleHLTFilterNames_
std::vector< std::string > phoHLTFilterNames2Leg_
MonitorElement * get(const std::string &path)
std::vector< std::string > phoLooseTightTrigEffVsVars_
EgHLTOfflineClient(const EgHLTOfflineClient &rhs)
constexpr char const * varNames[]
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
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_
virtual ~EgHLTOfflineClient()
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_
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 &)
void setCurrentFolder(const std::string &fullpath)
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 &)
TH1F * getTH1F(void) const
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_
volatile std::atomic< bool > shutdown_flag false
virtual 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_
std::vector< std::string > eleSingleEffVars_