CMS 3D CMS Logo

EgHLTOfflineClient.cc
Go to the documentation of this file.
2 
7 
9 
11 
13 
15 
16 #include <boost/algorithm/string.hpp>
17 
18 #include "TGraphAsymmErrors.h"
19 
21  eleHLTFilterNames_ = iConfig.getParameter<std::vector<std::string> >("eleHLTFilterNames");
22  eleHLTFilterNames2Leg_ = iConfig.getParameter<std::vector<std::string> >("eleHLTFilterNames2Leg");
23  eleTightLooseTrigNames_ = iConfig.getParameter<std::vector<std::string> >("eleTightLooseTrigNames");
24  phoHLTFilterNames_ = iConfig.getParameter<std::vector<std::string> >("phoHLTFilterNames");
25  phoHLTFilterNames2Leg_ = iConfig.getParameter<std::vector<std::string> >("phoHLTFilterNames2Leg");
26  phoTightLooseTrigNames_ = iConfig.getParameter<std::vector<std::string> >("phoTightLooseTrigNames");
27 
28  eleN1EffVars_ = iConfig.getParameter<std::vector<std::string> >("eleN1EffVars");
29  eleSingleEffVars_ = iConfig.getParameter<std::vector<std::string> >("eleSingleEffVars");
30  eleEffTags_ = iConfig.getParameter<std::vector<std::string> >("eleEffTags");
31  eleTrigTPEffVsVars_ = iConfig.getParameter<std::vector<std::string> >("eleTrigTPEffVsVars");
32  eleLooseTightTrigEffVsVars_ = iConfig.getParameter<std::vector<std::string> >("eleLooseTightTrigEffVsVars");
33  eleHLTvOfflineVars_ = iConfig.getParameter<std::vector<std::string> >("eleHLTvOfflineVars");
34 
35  phoN1EffVars_ = iConfig.getParameter<std::vector<std::string> >("phoN1EffVars");
36  phoSingleEffVars_ = iConfig.getParameter<std::vector<std::string> >("phoSingleEffVars");
37  phoEffTags_ = iConfig.getParameter<std::vector<std::string> >("phoEffTags");
38  phoTrigTPEffVsVars_ = iConfig.getParameter<std::vector<std::string> >("phoTrigTPEffVsVars");
39  phoLooseTightTrigEffVsVars_ = iConfig.getParameter<std::vector<std::string> >("phoLooseTightTrigEffVsVars");
40  phoHLTvOfflineVars_ = iConfig.getParameter<std::vector<std::string> >("phoHLTvOfflineVars");
41 
42  runClientEndLumiBlock_ = iConfig.getParameter<bool>("runClientEndLumiBlock");
43  runClientEndRun_ = iConfig.getParameter<bool>("runClientEndRun");
44  runClientEndJob_ = iConfig.getParameter<bool>("runClientEndJob");
45 
46  dirName_ = iConfig.getParameter<std::string>("DQMDirName");
47 
48  filterInactiveTriggers_ = iConfig.getParameter<bool>("filterInactiveTriggers");
49  hltTag_ = iConfig.getParameter<std::string>("hltTag");
50 }
51 
53 
55  if (runClientEndJob_)
56  runClient_(ibooker_, igetter_);
57 }
58 
60  if (!isSetup_) {
63  bool changed = false;
64  hltConfig.init(run, c, hltTag_, changed);
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);
72 
78  }
79  isSetup_ = true;
80  }
81 }
82 
84  DQMStore::IGetter& igetter_,
85  edm::LuminosityBlock const& iLumi,
86  edm::EventSetup const& iSetup) {
88  runClient_(ibooker_, igetter_);
89 }
90 
92  ibooker.setCurrentFolder(dirName_ + "/Client_Histos");
93 
94  std::vector<std::string> regions;
95  regions.emplace_back("eb");
96  regions.emplace_back("ee");
97 
98  for (auto const& eleHLTFilterName : eleHLTFilterNames_) {
99  //std::cout<<"FilterName: "<<eleHLTFilterNames_[filterNr]<<std::endl;
100  for (auto const& region : regions) {
101  for (auto const& eleEffTag : eleEffTags_) {
102  //----Morse----
103  ibooker.setCurrentFolder(dirName_ + "/Client_Histos/" + eleHLTFilterName);
104  //--------------
106  eleHLTFilterName, eleHLTFilterName + "_gsfEle_" + eleEffTag, region, eleN1EffVars_, ibooker, igetter);
107 
109  eleHLTFilterName, eleHLTFilterName + "_gsfEle_" + eleEffTag, region, eleSingleEffVars_, ibooker, igetter);
110 
111  createTrigTagProbeEffHistsNewAlgo(eleHLTFilterName, region, eleTrigTPEffVsVars_, "gsfEle", ibooker, igetter);
112 
114  eleHLTFilterName, eleHLTFilterName + "_gsfEle_passFilter", region, eleHLTvOfflineVars_, ibooker, igetter);
115  }
116  }
117  }
118  for (auto& filterNr : eleHLTFilterNames2Leg_) {
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("::"));
122 
123  std::string trigNameLeg2 = filterNr.substr(filterNr.find("::") + 2);
124 
125  ibooker.setCurrentFolder(dirName_ + "/Client_Histos/" + trigNameLeg2);
127  trigNameLeg1, trigNameLeg2, region, eleTrigTPEffVsVars_, "gsfEle", ibooker, igetter);
128  }
129  }
130  }
131 
132  for (auto const& phoHLTFilterName : phoHLTFilterNames_) {
133  for (auto const& region : regions) {
134  for (auto const& phoEffTag : phoEffTags_) {
135  //----Morse----
136  ibooker.setCurrentFolder(dirName_ + "/Client_Histos/" + phoHLTFilterName);
138  phoHLTFilterName, phoHLTFilterName + "_pho_" + phoEffTag, region, phoN1EffVars_, ibooker, igetter);
139 
141  phoHLTFilterName, phoHLTFilterName + "_pho_" + phoEffTag, region, phoSingleEffVars_, ibooker, igetter);
142 
143  createTrigTagProbeEffHistsNewAlgo(phoHLTFilterName, region, phoTrigTPEffVsVars_, "pho", ibooker, igetter);
144 
146  phoHLTFilterName, phoHLTFilterName + "_pho_passFilter", region, phoHLTvOfflineVars_, ibooker, igetter);
147 
148  //--------------
149  }
150  }
151  }
152 
153  for (auto const& region : regions) {
155 
157  eleTightLooseTrigNames_, region, eleLooseTightTrigEffVsVars_, "gsfEle_trigCuts", ibooker, igetter);
158 
160 
162  phoTightLooseTrigNames_, region, phoLooseTightTrigEffVsVars_, "pho_trigCuts", ibooker, igetter);
163  }
164  //----Morse-----
165  ibooker.setCurrentFolder(dirName_);
166  //----------
167 }
168 
170  const std::string& baseName,
171  const std::string& region,
172  const std::vector<std::string>& varNames,
173  DQMStore::IBooker& ibooker,
174  DQMStore::IGetter& igetter) {
175  //need to do Energy manually to get SC Energy
176  /*
177  MonitorElement* numer = dbe_->get(dirName_+"/Source_Histos/"+filterName+"/"+baseName+"_HLTenergy"+"_"+region);
178  MonitorElement* denom = dbe_->get(dirName_+"/Source_Histos/"+filterName+"/"+baseName+"_energy"+"_"+region);
179 
180  if(numer!=NULL && denom!=NULL){
181  std::string effHistName(baseName+"_HLToverOfflineSC_energy_"+region);//std::cout<<"hltVSoffline: "<<effHistName<<std::endl;
182  std::string effHistTitle(effHistName);
183  if(region=="eb" || region=="ee"){
184  if(region=="eb") effHistTitle = "Barrel "+baseName+" HLToverOfflineSC Energy";
185  if(region=="ee") effHistTitle = "Endcap "+baseName+" HLToverOfflineSC Energy";
186  FillHLTvsOfflineHist(filterName,effHistName,effHistTitle,numer,denom);
187  }
188  }//end Et
189  */
190 
191  //now eta, phi automatically
192  for (auto const& varName : varNames) {
193  MonitorElement* numer =
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 + "_" +
199  region); //std::cout<<"hltVSoffline: "<<effHistName<<std::endl;
200  std::string effHistTitle(effHistName);
201  if (region == "eb" || region == "ee") {
202  if (region == "eb")
203  effHistTitle = "Barrel " + baseName + " HLToverOffline " + varName;
204  if (region == "ee")
205  effHistTitle = "Endcap " + baseName + " HLToverOffline " + varName;
206  FillHLTvsOfflineHist(filterName, effHistName, effHistTitle, numer, denom, ibooker, igetter);
207  }
208  }
209  } //end loop over varNames
210 }
211 
213  const std::string& name,
214  const std::string& title,
215  const MonitorElement* numer,
216  const MonitorElement* denom,
217  DQMStore::IBooker& ibooker,
218  DQMStore::IGetter& igetter) {
219  TH1F* num = numer->getTH1F();
220  if (num->GetSumw2N() == 0)
221  num->Sumw2();
222 
223  TH1F* den = denom->getTH1F();
224  if (den->GetSumw2N() == 0)
225  den->Sumw2();
226 
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());
230  MonitorElement* eff = igetter.get(dirName_ + "/Client_Histos/" + filter + "/" + name);
231  if (eff == nullptr) {
232  eff = ibooker.book1D(name, h_eff);
233  } else { //I was having problems with collating the histograms, hence why I'm just resetting the histogram value
234  *eff->getTH1F() = *h_eff;
235  delete h_eff;
236  }
237  return eff;
238 }
239 
241  const std::string& baseName,
242  const std::string& region,
243  const std::vector<std::string>& varNames,
244  DQMStore::IBooker& ibooker,
245  DQMStore::IGetter& igetter) {
246  MonitorElement* numer =
247  igetter.get(dirName_ + "/Source_Histos/" + filterName + "/" + baseName + "_allCuts_" + region);
248 
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 + "_" +
254  region); //std::cout<<"N1: "<<effHistName<<std::endl;
255  //std::cout<<region<<" ";
256  //----Morse-----------
257  std::string effHistTitle(effHistName); //std::cout<<effHistTitle<<std::endl;
258  if (region == "eb" || region == "ee") {
259  if (region == "eb")
260  effHistTitle = "Barrel " + baseName + " N1eff " + varName;
261  if (region == "ee")
262  effHistTitle = "Endcap " + baseName + " N1eff " + varName;
263  } //std::cout<<effHistTitle<<std::endl;
264  makeEffMonElemFromPassAndAll(filterName, effHistName, effHistTitle, numer, denom, ibooker, igetter);
265  //---------------------
266  }
267  } //end loop over varNames
268 }
269 
271  const std::string& baseName,
272  const std::string& region,
273  const std::vector<std::string>& varNames,
274  DQMStore::IBooker& ibooker,
275  DQMStore::IGetter& igetter) {
276  MonitorElement* denom = igetter.get(dirName_ + "/Source_Histos/" + filterName + "/" + baseName + "_noCuts_" + region);
277 
278  for (auto const& varName : varNames) {
279  MonitorElement* numer =
280  igetter.get(dirName_ + "/Source_Histos/" + filterName + "/" + baseName + "_single_" + varName + "_" + region);
281  if (numer != nullptr && denom != nullptr) {
282  std::string effHistName(baseName + "_singleEff_" + varName + "_" +
283  region); //std::cout<<"Si: "<<effHistName<<std::endl;
284  //----Morse-----------
285  std::string effHistTitle(effHistName); //std::cout<<effHistTitle<<std::endl;
286  if (region == "eb" || region == "ee") {
287  if (region == "eb")
288  effHistTitle = "Barrel " + baseName + " SingleEff " + varName;
289  if (region == "ee")
290  effHistTitle = "Endcap " + baseName + " SingleEff " + varName;
291  } //std::cout<<effHistTitle<<std::endl;
292  makeEffMonElemFromPassAndAll(filterName, effHistName, effHistTitle, numer, denom, ibooker, igetter);
293  //--------------------
294  }
295  } //end loop over varNames
296 }
297 
299  const std::string& region,
300  const std::vector<std::string>& vsVarNames,
301  const std::string& objName,
302  DQMStore::IBooker& ibooker,
303  DQMStore::IGetter& igetter) {
304  for (auto const& vsVarName : vsVarNames) {
305  std::string allName(dirName_ + "/Source_Histos/" + filterName + "/" + filterName + "_trigTagProbe_" + objName +
306  "_all_" + vsVarName + "_" + region);
307  MonitorElement* all = igetter.get(allName);
308  if (all == nullptr) {
309  continue;
310  }
311  std::string passName(dirName_ + "/Source_Histos/" + filterName + "/" + filterName + "_trigTagProbe_" + objName +
312  "_pass_" + vsVarName + "_" + region);
313  MonitorElement* pass = igetter.get(passName);
314  if (pass == nullptr) {
315  continue;
316  }
317  //----Morse-----
318  std::string effHistTitle(filterName + "_trigTagProbeEff_" + objName + "_vs_" + vsVarName + "_" +
319  region); //std::cout<<effHistTitle<<std::endl;
320  if (region == "eb" || region == "ee") {
321  if (region == "eb")
322  effHistTitle = "Barrel " + filterName + "_" + objName + " TrigTagProbeEff vs " + vsVarName;
323  if (region == "ee")
324  effHistTitle = "Endcap " + filterName + "_" + objName + " TrigTagProbeEff vs " + vsVarName;
325  }
326  //------------
328  filterName + "_trigTagProbeEff_" + objName + "_vs_" + vsVarName + "_" + region,
329  effHistTitle,
330  pass,
331  all,
332  ibooker,
333  igetter);
334 
335  } //end loop over vsVarNames
336 }
337 
339  const std::string& region,
340  const std::vector<std::string>& vsVarNames,
341  const std::string& objName,
342  DQMStore::IBooker& ibooker,
343  DQMStore::IGetter& igetter) {
344  for (auto const& vsVarName : vsVarNames) {
345  /*
346  std::string allName(dirName_+"/Source_Histos/"+filterName+"/"+filterName+"_trigTagProbe_"+objName+"_all_"+vsVarNames[varNr]+"_"+region);
347  MonitorElement* all = dbe_->get(allName);
348  if(all==NULL){
349  //edm::LogInfo("EgHLTOfflineClient") <<" couldnt get hist "<<allName;
350  continue;
351  }*/
352  std::string passName(dirName_ + "/Source_Histos/" + filterName + "/" + filterName + "_trigTagProbe_" + objName +
353  "_passNotTag_" + vsVarName + "_" + region);
354  MonitorElement* passNotTag = igetter.get(passName);
355  if (passNotTag == nullptr) {
356  //edm::LogInfo("EgHLTOfflineClient") <<" couldnt get hist "<<passName;
357  continue;
358  }
359  std::string passTagTagName(dirName_ + "/Source_Histos/" + filterName + "/" + filterName + "_trigTagProbe_" +
360  objName + "_passTagTag_" + vsVarName + "_" + region);
361  MonitorElement* passTagTag = igetter.get(passTagTagName);
362  if (passTagTag == nullptr) {
363  //edm::LogInfo("EgHLTOfflineClient") <<" couldnt get hist "<<passTagTagName;
364  continue;
365  }
366  std::string failName(dirName_ + "/Source_Histos/" + filterName + "/" + filterName + "_trigTagProbe_" + objName +
367  "_fail_" + vsVarName + "_" + region);
368  MonitorElement* fail = igetter.get(failName);
369  if (fail == nullptr) {
370  //edm::LogInfo("EgHLTOfflineClient") <<" couldnt get hist "<<failName;
371  continue;
372  }
373  //----Morse-----
374  std::string effHistTitle(filterName + "_trigTagProbeEff_" + objName + "_vs_" + vsVarName + "_" +
375  region); //std::cout<<effHistTitle<<std::endl;
376  if (region == "eb" || region == "ee") {
377  if (region == "eb")
378  effHistTitle = "Barrel " + filterName + "_" + objName + " TrigTagProbeEff vs " + vsVarName;
379  if (region == "ee")
380  effHistTitle = "Endcap " + filterName + "_" + objName + " TrigTagProbeEff vs " + vsVarName;
381  } //std::cout<<effHistTitle<<std::endl;
382  //------------
384  filterName,
385  filterName + "_trigTagProbeEff_" + objName + "_vs_" + vsVarName + "_" + region,
386  effHistTitle,
387  passNotTag,
388  fail,
389  passTagTag,
390  ibooker,
391  igetter);
392  } //end loop over vsVarNames
393 }
394 
396  const std::string& filterNameLeg2,
397  const std::string& region,
398  const std::vector<std::string>& vsVarNames,
399  const std::string& objName,
400  DQMStore::IBooker& ibooker,
401  DQMStore::IGetter& igetter) {
402  for (auto const& vsVarName : vsVarNames) {
403  std::string allName(dirName_ + "/Source_Histos/" + filterNameLeg2 + "/" + filterNameLeg2 + "_trigTagProbe_" +
404  objName + "_all_" + vsVarName + "_" + region);
405  MonitorElement* all = igetter.get(allName);
406  if (all == nullptr) {
407  edm::LogInfo("EgHLTOfflineClient") << " couldnt get hist " << allName;
408  continue;
409  }
410 
411  std::string Leg2NotLeg1SourceName(dirName_ + "/Source_Histos/" + filterNameLeg2 + "/" + filterNameLeg2 +
412  "_trigTagProbe_" + objName + "_passLeg2failLeg1_" + vsVarName + "_" + region);
413  MonitorElement* Leg2NotLeg1Source = igetter.get(Leg2NotLeg1SourceName);
414  if (Leg2NotLeg1Source == nullptr) {
415  edm::LogInfo("EgHLTOfflineClient") << " couldnt get hist " << Leg2NotLeg1SourceName;
416  continue;
417  }
418 
419  std::string Leg1EffName(dirName_ + "/Client_Histos/" + filterNameLeg1 + "/" + filterNameLeg1 + "_trigTagProbeEff_" +
420  objName + "_vs_" + vsVarName + "_" + region);
421  MonitorElement* Leg1Eff = igetter.get(Leg1EffName);
422  if (Leg1Eff == nullptr) {
423  edm::LogInfo("EgHLTOfflineClient") << " couldnt get hist " << Leg1EffName;
424  continue;
425  }
426 
427  std::string effHistTitle(filterNameLeg2 + "_trigTagProbeEff2Leg_" + objName + "_vs_" + vsVarName + "_" +
428  region); //std::cout<<effHistTitle<<std::endl;
429  if (region == "eb" || region == "ee") {
430  if (region == "eb")
431  effHistTitle = "Barrel " + filterNameLeg2 + "_" + objName + " TrigTagProbeEff2Leg vs " + vsVarName;
432  if (region == "ee")
433  effHistTitle = "Endcap " + filterNameLeg2 + "_" + objName + " TrigTagProbeEff2Leg vs " + vsVarName;
434  } //std::cout<<effHistTitle<<std::endl;
435  makeEffMonElem2Leg(filterNameLeg2,
436  filterNameLeg2 + "_trigTagProbeEff2Leg_" + objName + "_vs_" + vsVarName + "_" + region,
437  effHistTitle,
438  Leg1Eff,
439  Leg2NotLeg1Source,
440  all,
441  ibooker,
442  igetter);
443  } //end loop over vsVarNames
444 }
445 
446 void EgHLTOfflineClient::createLooseTightTrigEff(const std::vector<std::string>& tightLooseTrigNames,
447  const std::string& region,
448  const std::vector<std::string>& vsVarNames,
449  const std::string& objName,
450  DQMStore::IBooker& ibooker,
451  DQMStore::IGetter& igetter) {
452  for (auto const& vsVarName : vsVarNames) {
453  for (auto const& tightLooseTrigName : tightLooseTrigNames) {
454  std::vector<std::string> splitString;
455  boost::split(splitString, tightLooseTrigName, boost::is_any_of(std::string(":")));
456  if (splitString.size() != 2) {
457  continue; //format incorrect
458  }
459 
460  const std::string& tightTrig = splitString[0];
461  const std::string& looseTrig = splitString[1];
462  MonitorElement* fail = igetter.get(dirName_ + "/Source_Histos/" + tightTrig + "_" + looseTrig + "_" + objName +
463  "_failTrig_" + vsVarName + "_" + region);
464  if (fail == nullptr) {
465  continue;
466  }
467 
468  MonitorElement* pass = igetter.get(dirName_ + "/Source_Histos/" + tightTrig + "_" + looseTrig + "_" + objName +
469  "_passTrig_" + vsVarName + "_" + region);
470  if (pass == nullptr) {
471  continue;
472  }
473 
474  const std::string newHistName(tightTrig + "_trigEffTo_" + looseTrig + "_" + objName + "_vs_" + vsVarName + "_" +
475  region);
476  //----Morse-----
477  std::string effHistTitle(newHistName); //std::cout<<effHistTitle<<std::endl;
478  if (region == "eb" || region == "ee") {
479  if (region == "eb")
480  effHistTitle = "Barrel " + tightTrig + "_TrigEffTo_" + looseTrig + "_" + objName + " vs " + vsVarName;
481  if (region == "ee")
482  effHistTitle = "Endcap " + tightTrig + "_TrigEffTo_" + looseTrig + "_" + objName + " vs " + vsVarName;
483  }
484  //------------
485  makeEffMonElemFromPassAndFail("LooseTight", newHistName, effHistTitle, pass, fail, ibooker, igetter);
486 
487  } //end loop over trigger pairs
488  } //end loop over vsVarNames
489 }
490 //-----Morse-------
492  const std::string& name,
493  const std::string& title,
494  const MonitorElement* pass,
495  const MonitorElement* all,
496  DQMStore::IBooker& ibooker,
497  DQMStore::IGetter& igetter) {
498  TH1F* passHist = pass->getTH1F();
499  if (passHist->GetSumw2N() == 0)
500  passHist->Sumw2();
501  TH1F* allHist = all->getTH1F();
502  if (allHist->GetSumw2N() == 0)
503  allHist->Sumw2();
504  auto* effHist = (TH1F*)passHist->Clone(name.c_str());
505  effHist->Divide(passHist, allHist, 1, 1, "B");
506  //----Morse---------
507  effHist->SetTitle(title.c_str());
508  //------------------
509  MonitorElement* eff = igetter.get(dirName_ + "/Client_Histos/" + filterName + "/" + name);
510  if (eff == nullptr) {
511  eff = ibooker.book1D(name, effHist);
512  } else { //I was having problems with collating the histograms, hence why I'm just resetting the histogram value
513  *eff->getTH1F() = *effHist;
514  delete effHist;
515  }
516  return eff;
517 }
518 
520  const std::string& filter,
521  const std::string& name,
522  const std::string& title,
523  const MonitorElement* passNotTag,
524  const MonitorElement* fail,
525  const MonitorElement* tagtag,
526  DQMStore::IBooker& ibooker,
527  DQMStore::IGetter& igetter) {
528  TH1F* passHist = passNotTag->getTH1F();
529  if (passHist->GetSumw2N() == 0)
530  passHist->Sumw2();
531  TH1F* failHist = fail->getTH1F();
532  if (failHist->GetSumw2N() == 0)
533  failHist->Sumw2();
534  TH1F* tagtagHist = tagtag->getTH1F();
535  if (tagtagHist->GetSumw2N() == 0)
536  tagtagHist->Sumw2();
537  auto* numer = (TH1F*)passHist->Clone(name.c_str());
538  if (numer->GetSumw2N() == 0)
539  numer->Sumw2();
540  numer->Add(tagtagHist, passHist, 2, 1);
541  auto* denom = (TH1F*)passHist->Clone(name.c_str());
542  if (denom->GetSumw2N() == 0)
543  denom->Sumw2();
544  denom->Add(tagtagHist, passHist, 2, 1);
545  denom->Add(failHist, 1);
546  auto* effHist = (TH1F*)passHist->Clone(name.c_str());
547  //TGraphAsymmErrors *effHist = new TGraphAsymmErrors(numer,denom,"cl=0.683 b(1,1) mode");
548  effHist->Divide(numer, denom, 1, 1, "B");
549  //effHist->Divide(numer,denom,"cl=0.683 b(1,1) mode");
550  //----Morse---------
551  effHist->SetTitle(title.c_str());
552  //------------------
553  MonitorElement* eff = igetter.get(dirName_ + "/Client_Histos/" + filter + "/" + name);
554  if (eff == nullptr) {
555  eff = ibooker.book1D(name, effHist);
556  } else { //I was having problems with collating the histograms, hence why I'm just resetting the histogram value
557  *eff->getTH1F() = *effHist;
558  //*eff->getTGraphAsymmErrors()=*effHist;
559  delete effHist;
560  }
561  return eff;
562 }
563 
565  const std::string& name,
566  const std::string& title,
567  const MonitorElement* Leg1Eff,
568  const MonitorElement* Leg2NotLeg1Source,
569  const MonitorElement* all,
570  DQMStore::IBooker& ibooker,
571  DQMStore::IGetter& igetter) {
572  TH1F* allHist = all->getTH1F();
573  if (allHist->GetSumw2() == nullptr)
574  allHist->Sumw2();
575  TH1F* Leg2NotLeg1SourceHist = Leg2NotLeg1Source->getTH1F();
576  if (Leg2NotLeg1SourceHist->GetSumw2() == nullptr)
577  Leg2NotLeg1SourceHist->Sumw2();
578 
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");
583 
584  TH1F* Leg1EffHist = Leg1Eff->getTH1F();
585  if (Leg1EffHist->GetSumw2() == nullptr)
586  Leg1EffHist->Sumw2();
587 
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");
592 
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);
598 
599  auto* effHist = (TH1F*)allHist->Clone(name.c_str());
600  if (effHist->GetSumw2() == nullptr)
601  effHist->Sumw2();
602  effHist->Add(effHistTerm1, effHistTerm2, 1, 1);
603  effHist->SetTitle(title.c_str());
604 
605  MonitorElement* eff = igetter.get(dirName_ + "/Client_Histos/" + filter + "/" + name);
606  if (eff == nullptr) {
607  eff = ibooker.book1D(name, effHist);
608  } else { //I was having problems with collating the histograms, hence why I'm just resetting the histogram value
609  *eff->getTH1F() = *effHist;
610  delete effHist;
611  }
612  return eff;
613 }
614 
615 //-----Morse-------
617  const std::string& name,
618  const std::string& title,
619  const MonitorElement* pass,
620  const MonitorElement* fail,
621  DQMStore::IBooker& ibooker,
622  DQMStore::IGetter& igetter) {
623  TH1F* failHist = fail->getTH1F();
624  if (failHist->GetSumw2N() == 0)
625  failHist->Sumw2();
626  TH1F* passHist = pass->getTH1F();
627  if (passHist->GetSumw2N() == 0)
628  passHist->Sumw2();
629 
630  auto* effHist = (TH1F*)passHist->Clone(name.c_str());
631  effHist->Add(failHist);
632  effHist->Divide(passHist, effHist, 1, 1, "B");
633  //----Morse---------
634  effHist->SetTitle(title.c_str());
635  //------------------
636  MonitorElement* eff = igetter.get(dirName_ + "/Client_Histos/" + filterName + "/" + name);
637  if (eff == nullptr) {
638  eff = ibooker.book1D(name, effHist);
639  } else { //I was having problems with collating the histograms, hence why I'm just reseting the histogram value
640  *eff->getTH1F() = *effHist;
641  delete effHist;
642  }
643  return eff;
644 }
void createTrigTagProbeEffHists(const std::string &filterName, const std::string &region, const std::vector< std::string > &vsVarNames, const std::string &objName, DQMStore::IBooker &, DQMStore::IGetter &)
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
void createTrigTagProbeEffHistsNewAlgo(const std::string &filterName, const std::string &region, const std::vector< std::string > &vsVarNames, const std::string &objName, DQMStore::IBooker &, DQMStore::IGetter &)
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
def all(container)
workaround iterator generators for ROOT classes
Definition: cmstools.py:25
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)
Definition: DQMStore.cc:32
std::vector< std::string > eleHLTFilterNames_
std::vector< std::string > phoHLTFilterNames2Leg_
std::vector< std::string > phoLooseTightTrigEffVsVars_
constexpr char const * varNames[]
std::vector< std::string > splitString(const std::string &fLine)
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 &region, const std::vector< std::string > &varNames, DQMStore::IBooker &, DQMStore::IGetter &)
void createLooseTightTrigEff(const std::vector< std::string > &tightLooseTrigNames, const std::string &region, const std::vector< std::string > &vsVarNames, const std::string &objName, DQMStore::IBooker &, DQMStore::IGetter &)
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 &region, const std::vector< std::string > &varNames, DQMStore::IBooker &, DQMStore::IGetter &)
Log< level::Info, false > LogInfo
void getActiveFilters(const HLTConfigProvider &hltConfig, std::vector< std::string > &activeFilters, std::vector< std::string > &activeEleFilters, std::vector< std::string > &activeEle2LegFilters, std::vector< std::string > &activePhoFilters, std::vector< std::string > &activePho2LegFilters)
MonitorElement * makeEffMonElemFromPassAndAll(const std::string &filterName, const std::string &name, const std::string &title, const MonitorElement *pass, const MonitorElement *all, DQMStore::IBooker &, DQMStore::IGetter &)
virtual TH1F * getTH1F() const
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:680
void runClient_(DQMStore::IBooker &, DQMStore::IGetter &)
void createTrigTagProbeEffHists2Leg(const std::string &filterNameLeg1, const std::string &filterNameLeg2, const std::string &region, 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 filterInactiveTriggers(std::vector< std::string > &namesToFilter, std::vector< std::string > &activeFilters)
void createN1EffHists(const std::string &filterName, const std::string &baseName, const std::string &region, 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())
Definition: DQMStore.h:98
void filterInactiveTightLooseTriggers(std::vector< std::string > &namesToFilter, const std::vector< std::string > &activeFilters)
MonitorElement * FillHLTvsOfflineHist(const std::string &filter, const std::string &name, const std::string &title, const MonitorElement *numer, const MonitorElement *denom, DQMStore::IBooker &, DQMStore::IGetter &)
Definition: Run.h:45
std::vector< std::string > eleHLTFilterNames2Leg_
~EgHLTOfflineClient() override
std::vector< std::string > eleSingleEffVars_