CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DQMGenericClient.cc
Go to the documentation of this file.
1 /*
2  * Class:DQMGenericClient
3  *
4  * DQM histogram post processor
5  *
6  *
7  * \author Junghwan Goh - SungKyunKwan University
8  */
9 
15 
16 #include <TH1.h>
17 #include <TH1F.h>
18 #include <TH2F.h>
19 #include <TClass.h>
20 #include <TString.h>
21 #include <TPRegexp.h>
22 #include <TDirectory.h>
23 #include <TEfficiency.h>
24 
25 #include <set>
26 #include <cmath>
27 #include <string>
28 #include <vector>
29 #include <climits>
30 #include <boost/tokenizer.hpp>
31 
32 using namespace std;
33 using namespace edm;
34 
35 class DQMGenericClient : public DQMEDHarvester {
36 public:
38  ~DQMGenericClient() override{};
39 
40  void dqmEndLuminosityBlock(DQMStore::IBooker& ibooker,
41  DQMStore::IGetter& igetter,
42  const edm::LuminosityBlock& lumiSeg,
43  const edm::EventSetup& c) override;
44  void dqmEndRun(DQMStore::IBooker&, DQMStore::IGetter&, edm::Run const&, edm::EventSetup const&) override;
46 
47  enum class EfficType { none = 0, efficiency, fakerate, simpleratio };
48 
49  struct EfficOption {
53  bool isProfile;
54  };
55 
56  struct ResolOption {
57  std::string namePrefix, titlePrefix;
59  };
60 
61  struct ProfileOption {
64  };
65 
66  struct NormOption {
68  };
69 
70  struct CDOption {
72  bool ascending;
73  };
74 
75  struct NoFlowOption {
77  };
78 
79  void computeEfficiency(DQMStore::IBooker& ibooker,
80  DQMStore::IGetter& igetter,
81  const std::string& startDir,
82  const std::string& efficMEName,
83  const std::string& efficMETitle,
84  const std::string& recoMEName,
85  const std::string& simMEName,
87  const bool makeProfile = false);
88  void computeResolution(DQMStore::IBooker& ibooker,
89  DQMStore::IGetter& igetter,
90  const std::string& startDir,
91  const std::string& fitMEPrefix,
92  const std::string& fitMETitlePrefix,
93  const std::string& srcMEName);
94  void computeProfile(DQMStore::IBooker& ibooker,
95  DQMStore::IGetter& igetter,
96  const std::string& startDir,
97  const std::string& profileMEName,
98  const std::string& profileMETitle,
99  const std::string& srcMEName);
100 
101  void normalizeToEntries(DQMStore::IBooker& ibooker,
102  DQMStore::IGetter& igetter,
103  const std::string& startDir,
104  const std::string& histName,
105  const std::string& normHistName);
106  void makeCumulativeDist(DQMStore::IBooker& ibooker,
107  DQMStore::IGetter& igetter,
108  const std::string& startDir,
109  const std::string& cdName,
110  bool ascending = true);
111  void makeNoFlowDist(DQMStore::IBooker& ibooker,
112  DQMStore::IGetter& igetter,
113  const std::string& startDir,
114  const std::string& cdName);
115 
116  void limitedFit(MonitorElement* srcME, MonitorElement* meanME, MonitorElement* sigmaME);
117 
118 private:
119  TPRegexp metacharacters_;
121  unsigned int verbose_;
127 
129  std::vector<std::string> subDirs_;
131 
132  std::vector<EfficOption> efficOptions_;
133  std::vector<ResolOption> resolOptions_;
134  std::vector<ProfileOption> profileOptions_;
135  std::vector<NormOption> normOptions_;
136  std::vector<CDOption> cdOptions_;
137  std::vector<NoFlowOption> noFlowOptions_;
138 
139  void generic_eff(TH1* denom, TH1* numer, MonitorElement* efficiencyHist, const EfficType type = EfficType::efficiency);
140 
141  void findAllSubdirectories(DQMStore::IBooker& ibooker,
142  DQMStore::IGetter& igetter,
144  std::set<std::string>* myList,
145  const TString& pattern);
146 
147  void makeAllPlots(DQMStore::IBooker&, DQMStore::IGetter&);
148 
149  void removeMEIfBooked(const std::string& meName, DQMStore::IGetter& igetter);
150 };
151 
153 public:
156  const bool oldAddDir = TH1::AddDirectoryStatus();
157  TH1::AddDirectory(true);
158  // ... create your hists
159  TH2F* h = me->getTH2F();
160  TF1 fgaus("fgaus", "gaus", h->GetYaxis()->GetXmin(), h->GetYaxis()->GetXmax(), TF1::EAddToList::kNo);
161  h->FitSlicesY(&fgaus, 0, -1, 0, "QNR SERIAL");
162  string name(h->GetName());
163  h0 = (TH1*)gDirectory->Get((name + "_0").c_str());
164  h1 = (TH1*)gDirectory->Get((name + "_1").c_str());
165  h2 = (TH1*)gDirectory->Get((name + "_2").c_str());
166  h3 = (TH1*)gDirectory->Get((name + "_chi2").c_str());
167  TH1::AddDirectory(oldAddDir);
168  }
169 
172  delete h0;
173  delete h1;
174  delete h2;
175  delete h3;
176  }
179  if (!(h1 && me))
180  throw cms::Exception("FitSlicesYTool") << "Pointer =0 : h1=" << h1 << " me=" << me;
181  if (h1->GetNbinsX() == me->getNbinsX()) {
182  for (int bin = 0; bin != h1->GetNbinsX(); bin++) {
183  me->setBinContent(bin + 1, h1->GetBinContent(bin + 1));
184  // me->setBinEntries(bin+1, 1.);
185  }
186  } else {
187  throw cms::Exception("FitSlicesYTool") << "Different number of bins!";
188  }
189  }
192  if (!(h2 && me))
193  throw cms::Exception("FitSlicesYTool") << "Pointer =0 : h1=" << h1 << " me=" << me;
194  if (h2->GetNbinsX() == me->getNbinsX()) {
195  for (int bin = 0; bin != h2->GetNbinsX(); bin++) {
196  me->setBinContent(bin + 1, h2->GetBinContent(bin + 1));
197  // me->setBinEntries(bin+1, 1.);
198  }
199  } else {
200  throw cms::Exception("FitSlicesYTool") << "Different number of bins!";
201  }
202  }
205  if (!(h1 && me))
206  throw cms::Exception("FitSlicesYTool") << "Pointer =0 : h1=" << h1 << " me=" << me;
207  if (h1->GetNbinsX() == me->getNbinsX()) {
208  for (int bin = 0; bin != h1->GetNbinsX(); bin++) {
209  me->setBinContent(bin + 1, h1->GetBinContent(bin + 1));
210  // me->setBinEntries(bin+1, 1.);
211  me->setBinError(bin + 1, h1->GetBinError(bin + 1));
212  }
213  } else {
214  throw cms::Exception("FitSlicesYTool") << "Different number of bins!";
215  }
216  }
219  if (!(h2 && me))
220  throw cms::Exception("FitSlicesYTool") << "Pointer =0 : h1=" << h1 << " me=" << me;
221  if (h2->GetNbinsX() == me->getNbinsX()) {
222  for (int bin = 0; bin != h2->GetNbinsX(); bin++) {
223  me->setBinContent(bin + 1, h2->GetBinContent(bin + 1));
224  // me->setBinEntries(bin+1, 1.);
225  me->setBinError(bin + 1, h2->GetBinError(bin + 1));
226  }
227  } else {
228  throw cms::Exception("FitSlicesYTool") << "Different number of bins!";
229  }
230  }
231 
232 private:
233  TH1* h0;
234  TH1* h1;
235  TH1* h2;
236  TH1* h3;
237 };
238 
240 
242  : metacharacters_("[\\^\\$\\.\\*\\+\\?\\|\\(\\)\\{\\}\\[\\]]"), nonPerlWildcard_("\\w\\*|^\\*") {
243  typedef std::vector<edm::ParameterSet> VPSet;
244  typedef std::vector<std::string> vstring;
245  typedef boost::escaped_list_separator<char> elsc;
246 
247  elsc commonEscapes("\\", " \t", "\'");
248 
249  verbose_ = pset.getUntrackedParameter<unsigned int>("verbose", 0);
250  runOnEndLumi_ = pset.getUntrackedParameter<bool>("runOnEndLumi", false);
251  runOnEndJob_ = pset.getUntrackedParameter<bool>("runOnEndJob", true);
252  makeGlobalEffPlot_ = pset.getUntrackedParameter<bool>("makeGlobalEffienciesPlot", true);
253 
254  // Parse efficiency commands
255  vstring effCmds = pset.getParameter<vstring>("efficiency");
256  for (vstring::const_iterator effCmd = effCmds.begin(); effCmd != effCmds.end(); ++effCmd) {
257  if (effCmd->empty())
258  continue;
259 
260  boost::tokenizer<elsc> tokens(*effCmd, commonEscapes);
261 
262  vector<string> args;
263  for (boost::tokenizer<elsc>::const_iterator iToken = tokens.begin(); iToken != tokens.end(); ++iToken) {
264  if (iToken->empty())
265  continue;
266  args.push_back(*iToken);
267  }
268 
269  if (args.size() < 4) {
270  LogInfo("DQMGenericClient") << "Wrong input to effCmds\n";
271  continue;
272  }
273 
275  opt.name = args[0];
276  opt.title = args[1];
277  opt.numerator = args[2];
278  opt.denominator = args[3];
279  opt.isProfile = false;
280 
281  const string typeName = args.size() == 4 ? "eff" : args[4];
282  if (typeName == "eff")
284  else if (typeName == "fake")
286  else if (typeName == "simpleratio")
288  else
289  opt.type = EfficType::none;
290 
291  efficOptions_.push_back(opt);
292  }
293 
294  VPSet efficSets = pset.getUntrackedParameter<VPSet>("efficiencySets", VPSet());
295  for (VPSet::const_iterator efficSet = efficSets.begin(); efficSet != efficSets.end(); ++efficSet) {
297  opt.name = efficSet->getUntrackedParameter<string>("name");
298  opt.title = efficSet->getUntrackedParameter<string>("title");
299  opt.numerator = efficSet->getUntrackedParameter<string>("numerator");
300  opt.denominator = efficSet->getUntrackedParameter<string>("denominator");
301  opt.isProfile = false;
302 
303  const string typeName = efficSet->getUntrackedParameter<string>("typeName", "eff");
304  if (typeName == "eff")
306  else if (typeName == "fake")
308  else if (typeName == "simpleratio")
310  else
311  opt.type = EfficType::none;
312 
313  efficOptions_.push_back(opt);
314  }
315 
316  // Parse efficiency profiles
317  vstring effProfileCmds = pset.getUntrackedParameter<vstring>("efficiencyProfile", vstring());
318  for (vstring::const_iterator effProfileCmd = effProfileCmds.begin(); effProfileCmd != effProfileCmds.end();
319  ++effProfileCmd) {
320  if (effProfileCmd->empty())
321  continue;
322 
323  boost::tokenizer<elsc> tokens(*effProfileCmd, commonEscapes);
324 
325  vector<string> args;
326  for (boost::tokenizer<elsc>::const_iterator iToken = tokens.begin(); iToken != tokens.end(); ++iToken) {
327  if (iToken->empty())
328  continue;
329  args.push_back(*iToken);
330  }
331 
332  if (args.size() < 4) {
333  LogInfo("DQMGenericClient") << "Wrong input to effProfileCmds\n";
334  continue;
335  }
336 
338  opt.name = args[0];
339  opt.title = args[1];
340  opt.numerator = args[2];
341  opt.denominator = args[3];
342  opt.isProfile = true;
343 
344  const string typeName = args.size() == 4 ? "eff" : args[4];
345  if (typeName == "eff")
347  else if (typeName == "fake")
349  else if (typeName == "simpleratio")
351  else
352  opt.type = EfficType::none;
353 
354  efficOptions_.push_back(opt);
355  }
356 
357  VPSet effProfileSets = pset.getUntrackedParameter<VPSet>("efficiencyProfileSets", VPSet());
358  for (VPSet::const_iterator effProfileSet = effProfileSets.begin(); effProfileSet != effProfileSets.end();
359  ++effProfileSet) {
361  opt.name = effProfileSet->getUntrackedParameter<string>("name");
362  opt.title = effProfileSet->getUntrackedParameter<string>("title");
363  opt.numerator = effProfileSet->getUntrackedParameter<string>("numerator");
364  opt.denominator = effProfileSet->getUntrackedParameter<string>("denominator");
365  opt.isProfile = true;
366 
367  const string typeName = effProfileSet->getUntrackedParameter<string>("typeName", "eff");
368  if (typeName == "eff")
370  else if (typeName == "fake")
372  else if (typeName == "simpleratio")
374  else
375  opt.type = EfficType::none;
376 
377  efficOptions_.push_back(opt);
378  }
379 
380  // Parse resolution commands
381  vstring resCmds = pset.getParameter<vstring>("resolution");
382  for (vstring::const_iterator resCmd = resCmds.begin(); resCmd != resCmds.end(); ++resCmd) {
383  if (resCmd->empty())
384  continue;
385  boost::tokenizer<elsc> tokens(*resCmd, commonEscapes);
386 
387  vector<string> args;
388  for (boost::tokenizer<elsc>::const_iterator iToken = tokens.begin(); iToken != tokens.end(); ++iToken) {
389  if (iToken->empty())
390  continue;
391  args.push_back(*iToken);
392  }
393 
394  if (args.size() != 3) {
395  LogInfo("DQMGenericClient") << "Wrong input to resCmds\n";
396  continue;
397  }
398 
400  opt.namePrefix = args[0];
401  opt.titlePrefix = args[1];
402  opt.srcName = args[2];
403 
404  resolOptions_.push_back(opt);
405  }
406 
407  VPSet resolSets = pset.getUntrackedParameter<VPSet>("resolutionSets", VPSet());
408  for (VPSet::const_iterator resolSet = resolSets.begin(); resolSet != resolSets.end(); ++resolSet) {
410  opt.namePrefix = resolSet->getUntrackedParameter<string>("namePrefix");
411  opt.titlePrefix = resolSet->getUntrackedParameter<string>("titlePrefix");
412  opt.srcName = resolSet->getUntrackedParameter<string>("srcName");
413 
414  resolOptions_.push_back(opt);
415  }
416 
417  // Parse profiles
418  vstring profileCmds = pset.getUntrackedParameter<vstring>("profile", vstring());
419  for (const auto& profileCmd : profileCmds) {
420  boost::tokenizer<elsc> tokens(profileCmd, commonEscapes);
421 
422  vector<string> args;
423  for (boost::tokenizer<elsc>::const_iterator iToken = tokens.begin(); iToken != tokens.end(); ++iToken) {
424  if (iToken->empty())
425  continue;
426  args.push_back(*iToken);
427  }
428 
429  if (args.size() != 3) {
430  LogInfo("DQMGenericClient") << "Wrong input to profileCmds\n";
431  continue;
432  }
433 
435  opt.name = args[0];
436  opt.title = args[1];
437  opt.srcName = args[2];
438 
439  profileOptions_.push_back(opt);
440  }
441 
442  VPSet profileSets = pset.getUntrackedParameter<VPSet>("profileSets", VPSet());
443  for (const auto& profileSet : profileSets) {
445  opt.name = profileSet.getUntrackedParameter<string>("name");
446  opt.title = profileSet.getUntrackedParameter<string>("title");
447  opt.srcName = profileSet.getUntrackedParameter<string>("srcName");
448 
449  profileOptions_.push_back(opt);
450  }
451 
452  // Parse Normalization commands
453  vstring normCmds = pset.getUntrackedParameter<vstring>("normalization", vstring());
454  for (vstring::const_iterator normCmd = normCmds.begin(); normCmd != normCmds.end(); ++normCmd) {
455  if (normCmd->empty())
456  continue;
457  boost::tokenizer<elsc> tokens(*normCmd, commonEscapes);
458 
459  vector<string> args;
460  for (boost::tokenizer<elsc>::const_iterator iToken = tokens.begin(); iToken != tokens.end(); ++iToken) {
461  if (iToken->empty())
462  continue;
463  args.push_back(*iToken);
464  }
465 
466  if (args.empty() or args.size() > 2) {
467  LogInfo("DQMGenericClient") << "Wrong input to normCmds\n";
468  continue;
469  }
470 
471  NormOption opt;
472  opt.name = args[0];
473  opt.normHistName = args.size() == 2 ? args[1] : args[0];
474 
475  normOptions_.push_back(opt);
476  }
477 
478  VPSet normSets = pset.getUntrackedParameter<VPSet>("normalizationSets", VPSet());
479  for (VPSet::const_iterator normSet = normSets.begin(); normSet != normSets.end(); ++normSet) {
480  NormOption opt;
481  opt.name = normSet->getUntrackedParameter<string>("name");
482  opt.normHistName = normSet->getUntrackedParameter<string>("normalizedTo", opt.name);
483 
484  normOptions_.push_back(opt);
485  }
486 
487  // Cumulative distributions
488  vstring cdCmds = pset.getUntrackedParameter<vstring>("cumulativeDists", vstring());
489  for (vstring::const_iterator cdCmd = cdCmds.begin(); cdCmd != cdCmds.end(); ++cdCmd) {
490  if (cdCmd->empty())
491  continue;
492  boost::tokenizer<elsc> tokens(*cdCmd, commonEscapes);
493 
494  vector<string> args;
495  for (boost::tokenizer<elsc>::const_iterator iToken = tokens.begin(); iToken != tokens.end(); ++iToken) {
496  if (iToken->empty())
497  continue;
498  args.push_back(*iToken);
499  }
500 
501  if (args.empty() || args.size() > 2) {
502  LogInfo("DQMGenericClient") << "Wrong input to cdCmds\n";
503  continue;
504  }
505 
506  CDOption opt;
507  opt.name = args[0];
508  opt.ascending = args.size() == 2 ? (args[1] != "descending") : true;
509 
510  cdOptions_.push_back(opt);
511  }
512 
513  VPSet cdSets = pset.getUntrackedParameter<VPSet>("cumulativeDistSets", VPSet());
514  for (VPSet::const_iterator cdSet = cdSets.begin(); cdSet != cdSets.end(); ++cdSet) {
515  CDOption opt;
516  opt.name = cdSet->getUntrackedParameter<string>("name");
517  opt.ascending = cdSet->getUntrackedParameter<bool>("ascending", true);
518 
519  cdOptions_.push_back(opt);
520  }
521 
522  // move under/overflows to first/last bins
523  vstring noFlowCmds = pset.getUntrackedParameter<vstring>("noFlowDists", vstring());
524  for (vstring::const_iterator noFlowCmd = noFlowCmds.begin(); noFlowCmd != noFlowCmds.end(); ++noFlowCmd) {
525  if (noFlowCmd->empty())
526  continue;
527  boost::tokenizer<elsc> tokens(*noFlowCmd, commonEscapes);
528 
529  vector<string> args;
530  for (boost::tokenizer<elsc>::const_iterator iToken = tokens.begin(); iToken != tokens.end(); ++iToken) {
531  if (iToken->empty())
532  continue;
533  args.push_back(*iToken);
534  }
535 
536  if (args.empty() || args.size() > 2) {
537  LogInfo("DQMGenericClient") << "Wrong input to noFlowCmds\n";
538  continue;
539  }
540 
542  opt.name = args[0];
543 
544  noFlowOptions_.push_back(opt);
545  }
546 
547  VPSet noFlowSets = pset.getUntrackedParameter<VPSet>("noFlowDistSets", VPSet());
548  for (VPSet::const_iterator noFlowSet = noFlowSets.begin(); noFlowSet != noFlowSets.end(); ++noFlowSet) {
550  opt.name = noFlowSet->getUntrackedParameter<string>("name");
551 
552  noFlowOptions_.push_back(opt);
553  }
554 
555  outputFileName_ = pset.getUntrackedParameter<string>("outputFileName", "");
556  subDirs_ = pset.getUntrackedParameter<vstring>("subDirs");
557 
558  resLimitedFit_ = pset.getUntrackedParameter<bool>("resolutionLimitedFit", false);
559  isWildcardUsed_ = false;
560 }
561 
563  DQMStore::IGetter& igetter,
564  const edm::LuminosityBlock& lumiSeg,
565  const edm::EventSetup& c) {
566  if (runOnEndLumi_) {
567  makeAllPlots(ibooker, igetter);
568  }
569 }
570 
572  DQMStore::IGetter& igetter,
573  edm::Run const&,
574  edm::EventSetup const&) {
575  // Create new MEs in endRun, even though we are requested to do it in endJob.
576  // This gives the QTests a chance to run, before summaries are created in
577  // endJob. The negative side effect is that we cannot run the GenericClient
578  // for plots produced in Harvesting, but that seems rather rare.
579  //
580  // It is important that this is still save in the presence of multiple runs,
581  // first because in multi-run harvesting, we accumulate statistics over all
582  // runs and have full statistics at the endRun of the last run, and second,
583  // because we set the efficiencyFlag so any further aggregation should produce
584  // correct results. Also, all operations should be idempotent; running them
585  // more than once does no harm.
586 
587  // needed to access the DQMStore::save method
588  theDQM = nullptr;
590 
591  if (runOnEndJob_) {
592  makeAllPlots(ibooker, igetter);
593  }
594 
595  if (!outputFileName_.empty())
597 }
598 
600  typedef vector<string> vstring;
601 
602  // Process wildcard in the sub-directory
603  set<string> subDirSet;
604 
605  for (vstring::const_iterator iSubDir = subDirs_.begin(); iSubDir != subDirs_.end(); ++iSubDir) {
606  string subDir = *iSubDir;
607 
608  if (subDir[subDir.size() - 1] == '/')
609  subDir.erase(subDir.size() - 1);
610 
611  if (TString(subDir).Contains(metacharacters_)) {
612  isWildcardUsed_ = true;
613 
614  const string::size_type shiftPos = subDir.rfind('/');
615  const string searchPath = subDir.substr(0, shiftPos);
616  const string pattern = subDir.substr(shiftPos + 1, subDir.length());
617  //std::cout << "\n\n\n\nLooking for all subdirs of " << subDir << std::endl;
618 
619  findAllSubdirectories(ibooker, igetter, searchPath, &subDirSet, pattern);
620 
621  } else {
622  subDirSet.insert(subDir);
623  }
624  }
625 
626  for (set<string>::const_iterator iSubDir = subDirSet.begin(); iSubDir != subDirSet.end(); ++iSubDir) {
627  const string& dirName = *iSubDir;
628 
629  // First normalize, then move under/overflows, then make
630  // cumulative, and only then efficiency This allows to use the
631  // cumulative distributions for efficiency calculation
632  for (vector<NormOption>::const_iterator normOption = normOptions_.begin(); normOption != normOptions_.end();
633  ++normOption) {
634  normalizeToEntries(ibooker, igetter, dirName, normOption->name, normOption->normHistName);
635  }
636 
637  for (vector<NoFlowOption>::const_iterator noFlowOption = noFlowOptions_.begin();
638  noFlowOption != noFlowOptions_.end();
639  ++noFlowOption) {
640  makeNoFlowDist(ibooker, igetter, dirName, noFlowOption->name);
641  }
642 
643  for (vector<CDOption>::const_iterator cdOption = cdOptions_.begin(); cdOption != cdOptions_.end(); ++cdOption) {
644  makeCumulativeDist(ibooker, igetter, dirName, cdOption->name, cdOption->ascending);
645  }
646 
647  for (vector<EfficOption>::const_iterator efficOption = efficOptions_.begin(); efficOption != efficOptions_.end();
648  ++efficOption) {
649  computeEfficiency(ibooker,
650  igetter,
651  dirName,
652  efficOption->name,
653  efficOption->title,
654  efficOption->numerator,
655  efficOption->denominator,
656  efficOption->type,
657  efficOption->isProfile);
658  }
659 
660  for (vector<ResolOption>::const_iterator resolOption = resolOptions_.begin(); resolOption != resolOptions_.end();
661  ++resolOption) {
663  ibooker, igetter, dirName, resolOption->namePrefix, resolOption->titlePrefix, resolOption->srcName);
664  }
665 
666  for (const auto& profileOption : profileOptions_) {
667  computeProfile(ibooker, igetter, dirName, profileOption.name, profileOption.title, profileOption.srcName);
668  }
669  }
670 }
671 
673  DQMStore::IGetter& igetter,
674  const string& startDir,
675  const string& efficMEName,
676  const string& efficMETitle,
677  const string& recoMEName,
678  const string& simMEName,
679  const EfficType type,
680  const bool makeProfile) {
681  if (!igetter.dirExists(startDir)) {
682  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
683  LogInfo("DQMGenericClient") << "computeEfficiency() : "
684  << "Cannot find sub-directory " << startDir << endl;
685  }
686  return;
687  }
688 
689  ibooker.cd();
690 
691  ME* simME = igetter.get(startDir + "/" + simMEName);
692  ME* recoME = igetter.get(startDir + "/" + recoMEName);
693 
694  if (!simME) {
695  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
696  LogInfo("DQMGenericClient") << "computeEfficiency() : "
697  << "No sim-ME '" << simMEName << "' found\n";
698  }
699  return;
700  }
701 
702  if (!recoME) {
703  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
704  LogInfo("DQMGenericClient") << "computeEfficiency() : "
705  << "No reco-ME '" << recoMEName << "' found\n";
706  }
707  return;
708  }
709 
710  // Treat everything as the base class, TH1
711 
712  TH1* hSim = simME->getTH1();
713  TH1* hReco = recoME->getTH1();
714 
715  if (!hSim || !hReco) {
716  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
717  LogInfo("DQMGenericClient") << "computeEfficiency() : "
718  << "Cannot create TH1 from ME\n";
719  }
720  return;
721  }
722 
723  string efficDir = startDir;
724  string newEfficMEName = efficMEName;
725  string::size_type shiftPos;
726  if (string::npos != (shiftPos = efficMEName.rfind('/'))) {
727  efficDir += "/" + efficMEName.substr(0, shiftPos);
728  newEfficMEName.erase(0, shiftPos + 1);
729  }
730  ibooker.setCurrentFolder(efficDir);
731 
732  if (makeProfile) {
733  TProfile* efficHist = (hReco->GetXaxis()->GetXbins()->GetSize() == 0)
734  ? new TProfile(newEfficMEName.c_str(),
735  efficMETitle.c_str(),
736  hReco->GetXaxis()->GetNbins(),
737  hReco->GetXaxis()->GetXmin(),
738  hReco->GetXaxis()->GetXmax())
739  : new TProfile(newEfficMEName.c_str(),
740  efficMETitle.c_str(),
741  hReco->GetXaxis()->GetNbins(),
742  hReco->GetXaxis()->GetXbins()->GetArray());
743 
744  efficHist->GetXaxis()->SetTitle(hSim->GetXaxis()->GetTitle());
745  efficHist->GetYaxis()->SetTitle(hSim->GetYaxis()->GetTitle());
746 
747  for (int i = 1; i <= hReco->GetNbinsX(); i++) {
748  const double nReco = hReco->GetBinContent(i);
749  const double nSim = hSim->GetBinContent(i);
750 
751  if (!std::string(hSim->GetXaxis()->GetBinLabel(i)).empty())
752  efficHist->GetXaxis()->SetBinLabel(i, hSim->GetXaxis()->GetBinLabel(i));
753 
754  if (nSim == 0 or nReco < 0 or nReco > nSim)
755  continue;
756  const double effVal = nReco / nSim;
757  const double errLo = TEfficiency::ClopperPearson(nSim, nReco, 0.683, false);
758  const double errUp = TEfficiency::ClopperPearson(nSim, nReco, 0.683, true);
759  const double errVal = (effVal - errLo > errUp - effVal) ? effVal - errLo : errUp - effVal;
760  efficHist->SetBinContent(i, effVal);
761  efficHist->SetBinEntries(i, 1);
762  efficHist->SetBinError(i, std::hypot(effVal, errVal));
763  }
764  ibooker.bookProfile(newEfficMEName, efficHist);
765  delete efficHist;
766  }
767 
768  else {
769  TH1* efficHist = (TH1*)hSim->Clone(newEfficMEName.c_str());
770  efficHist->SetTitle(efficMETitle.c_str());
771 
772  // Here is where you have trouble --- you need
773  // to understand what type of hist you have.
774 
775  ME* efficME = nullptr;
776 
777  // Parse the class name
778  // This works, but there might be a better way
779  TClass* myHistClass = efficHist->IsA();
780  TString histClassName = myHistClass->GetName();
781 
782  if (histClassName == "TH1F") {
783  efficME = ibooker.book1D(newEfficMEName, (TH1F*)efficHist);
784  } else if (histClassName == "TH2F") {
785  efficME = ibooker.book2D(newEfficMEName, (TH2F*)efficHist);
786  } else if (histClassName == "TH3F") {
787  efficME = ibooker.book3D(newEfficMEName, (TH3F*)efficHist);
788  }
789 
790  delete efficHist;
791 
792  if (!efficME) {
793  LogInfo("DQMGenericClient") << "computeEfficiency() : "
794  << "Cannot book effic-ME from the DQM\n";
795  return;
796  }
797 
798  // Update: 2009-9-16 slaunwhj
799  // call the most generic efficiency function
800  // works up to 3-d histograms
801 
802  generic_eff(hSim, hReco, efficME, type);
803 
804  // const int nBin = efficME->getNbinsX();
805  // for(int bin = 0; bin <= nBin; ++bin) {
806  // const float nSim = simME ->getBinContent(bin);
807  // const float nReco = recoME->getBinContent(bin);
808  // float eff =0;
809  // if (type=="fake")eff = nSim ? 1-nReco/nSim : 0.;
810  // else eff= nSim ? nReco/nSim : 0.;
811  // const float err = nSim && eff <= 1 ? sqrt(eff*(1-eff)/nSim) : 0.;
812  // efficME->setBinContent(bin, eff);
813  // efficME->setBinError(bin, err);
814  // }
815  efficME->setEntries(simME->getEntries());
816  }
817 
818  // Global efficiency
819  if (makeGlobalEffPlot_) {
820  ME* globalEfficME = igetter.get(efficDir + "/globalEfficiencies");
821  if (!globalEfficME)
822  globalEfficME = ibooker.book1D("globalEfficiencies", "Global efficiencies", 1, 0, 1);
823  if (!globalEfficME) {
824  LogInfo("DQMGenericClient") << "computeEfficiency() : "
825  << "Cannot book globalEffic-ME from the DQM\n";
826  return;
827  }
828  globalEfficME->setEfficiencyFlag();
829  TH1F* hGlobalEffic = globalEfficME->getTH1F();
830  if (!hGlobalEffic) {
831  LogInfo("DQMGenericClient") << "computeEfficiency() : "
832  << "Cannot create TH1F from ME, globalEfficME\n";
833  return;
834  }
835 
836  const float nSimAll = hSim->GetEntries();
837  const float nRecoAll = hReco->GetEntries();
838  float efficAll = 0;
839  if (type == EfficType::efficiency || type == EfficType::simpleratio)
840  efficAll = nSimAll ? nRecoAll / nSimAll : 0;
841  else if (type == EfficType::fakerate)
842  efficAll = nSimAll ? 1 - nRecoAll / nSimAll : 0;
843  float errorAll = 0;
844  if (type == EfficType::simpleratio) {
845  if (nSimAll) {
846  const float x = nRecoAll / nSimAll;
847  errorAll = std::sqrt(1.f / nSimAll * x * (1 + x));
848  }
849  } else
850  errorAll = nSimAll && efficAll < 1 ? sqrt(efficAll * (1 - efficAll) / nSimAll) : 0;
851 
852  const int iBin = hGlobalEffic->Fill(newEfficMEName.c_str(), 0);
853  hGlobalEffic->SetBinContent(iBin, efficAll);
854  hGlobalEffic->SetBinError(iBin, errorAll);
855  }
856 }
857 
859  DQMStore::IGetter& igetter,
860  const string& startDir,
861  const string& namePrefix,
862  const string& titlePrefix,
863  const std::string& srcName) {
864  if (!igetter.dirExists(startDir)) {
865  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
866  LogInfo("DQMGenericClient") << "computeResolution() : "
867  << "Cannot find sub-directory " << startDir << endl;
868  }
869  return;
870  }
871 
872  ibooker.cd();
873 
874  ME* srcME = igetter.get(startDir + "/" + srcName);
875  if (!srcME) {
876  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
877  LogInfo("DQMGenericClient") << "computeResolution() : "
878  << "No source ME '" << srcName << "' found\n";
879  }
880  return;
881  }
882 
883  TH2F* hSrc = srcME->getTH2F();
884  if (!hSrc) {
885  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
886  LogInfo("DQMGenericClient") << "computeResolution() : "
887  << "Cannot create TH2F from source-ME\n";
888  }
889  return;
890  }
891 
892  const int nBin = hSrc->GetNbinsX();
893 
894  string newDir = startDir;
895  string newPrefix = namePrefix;
896  string::size_type shiftPos;
897  if (string::npos != (shiftPos = namePrefix.rfind('/'))) {
898  newDir += "/" + namePrefix.substr(0, shiftPos);
899  newPrefix.erase(0, shiftPos + 1);
900  }
901 
902  ibooker.setCurrentFolder(newDir);
903 
904  float* lowedgesfloats = new float[nBin + 1];
905  ME* meanME;
906  ME* sigmaME;
907  if (hSrc->GetXaxis()->GetXbins()->GetSize()) {
908  for (int j = 0; j < nBin + 1; ++j)
909  lowedgesfloats[j] = (float)hSrc->GetXaxis()->GetXbins()->GetAt(j);
910  meanME = ibooker.book1D(newPrefix + "_Mean", titlePrefix + " Mean", nBin, lowedgesfloats);
911  sigmaME = ibooker.book1D(newPrefix + "_Sigma", titlePrefix + " Sigma", nBin, lowedgesfloats);
912  } else {
913  meanME = ibooker.book1D(
914  newPrefix + "_Mean", titlePrefix + " Mean", nBin, hSrc->GetXaxis()->GetXmin(), hSrc->GetXaxis()->GetXmax());
915  sigmaME = ibooker.book1D(
916  newPrefix + "_Sigma", titlePrefix + " Sigma", nBin, hSrc->GetXaxis()->GetXmin(), hSrc->GetXaxis()->GetXmax());
917  }
918 
919  if (meanME && sigmaME) {
920  meanME->setEfficiencyFlag();
921  sigmaME->setEfficiencyFlag();
922 
923  if (!resLimitedFit_) {
924  FitSlicesYTool fitTool(srcME);
925  fitTool.getFittedMeanWithError(meanME);
926  fitTool.getFittedSigmaWithError(sigmaME);
928  } else {
929  limitedFit(srcME, meanME, sigmaME);
930  }
931  }
932  delete[] lowedgesfloats;
933 }
934 
936  DQMStore::IGetter& igetter,
937  const std::string& startDir,
938  const std::string& profileMEName,
939  const std::string& profileMETitle,
940  const std::string& srcMEName) {
941  if (!igetter.dirExists(startDir)) {
942  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
943  LogInfo("DQMGenericClient") << "computeProfile() : "
944  << "Cannot find sub-directory " << startDir << endl;
945  }
946  return;
947  }
948 
949  ibooker.cd();
950 
951  ME* srcME = igetter.get(startDir + "/" + srcMEName);
952  if (!srcME) {
953  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
954  LogInfo("DQMGenericClient") << "computeProfile() : "
955  << "No source ME '" << srcMEName << "' found\n";
956  }
957  return;
958  }
959 
960  TH2F* hSrc = srcME->getTH2F();
961  if (!hSrc) {
962  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
963  LogInfo("DQMGenericClient") << "computeProfile() : "
964  << "Cannot create TH2F from source-ME\n";
965  }
966  return;
967  }
968 
969  string profileDir = startDir;
970  string newProfileMEName = profileMEName;
971  string::size_type shiftPos;
972  if (string::npos != (shiftPos = profileMEName.rfind('/'))) {
973  profileDir += "/" + profileMEName.substr(0, shiftPos);
974  newProfileMEName.erase(0, shiftPos + 1);
975  }
976  ibooker.setCurrentFolder(profileDir);
977 
978  std::unique_ptr<TProfile> profile(hSrc->ProfileX()); // We own the pointer
979  profile->SetTitle(profileMETitle.c_str());
980  ibooker.bookProfile(profileMEName, profile.get()); // ibooker makes a copy
981 }
982 
984  DQMStore::IGetter& igetter,
985  const std::string& startDir,
986  const std::string& histName,
987  const std::string& normHistName) {
988  if (!igetter.dirExists(startDir)) {
989  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
990  LogInfo("DQMGenericClient") << "normalizeToEntries() : "
991  << "Cannot find sub-directory " << startDir << endl;
992  }
993  return;
994  }
995 
996  ibooker.cd();
997 
998  ME* element = igetter.get(startDir + "/" + histName);
999  ME* normME = igetter.get(startDir + "/" + normHistName);
1000 
1001  if (!element) {
1002  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
1003  LogInfo("DQMGenericClient") << "normalizeToEntries() : "
1004  << "No such element '" << histName << "' found\n";
1005  }
1006  return;
1007  }
1008 
1009  if (!normME) {
1010  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
1011  LogInfo("DQMGenericClient") << "normalizeToEntries() : "
1012  << "No such element '" << normHistName << "' found\n";
1013  }
1014  return;
1015  }
1016 
1017  TH1F* hist = element->getTH1F();
1018  if (!hist) {
1019  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
1020  LogInfo("DQMGenericClient") << "normalizeToEntries() : "
1021  << "Cannot create TH1F from ME\n";
1022  }
1023  return;
1024  }
1025 
1026  TH1F* normHist = normME->getTH1F();
1027  if (!normHist) {
1028  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
1029  LogInfo("DQMGenericClient") << "normalizeToEntries() : "
1030  << "Cannot create TH1F from ME\n";
1031  }
1032  return;
1033  }
1034 
1035  const double entries = normHist->GetEntries();
1036  if (entries != 0) {
1037  hist->Scale(1. / entries);
1038  } else {
1039  LogInfo("DQMGenericClient") << "normalizeToEntries() : "
1040  << "Zero entries in histogram\n";
1041  }
1042 
1043  return;
1044 }
1045 
1047  DQMStore::IGetter& igetter,
1048  const std::string& startDir,
1049  const std::string& cdName,
1050  bool ascending) {
1051  if (!igetter.dirExists(startDir)) {
1052  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
1053  LogInfo("DQMGenericClient") << "makeCumulativeDist() : "
1054  << "Cannot find sub-directory " << startDir << endl;
1055  }
1056  return;
1057  }
1058 
1059  ibooker.cd();
1060 
1061  ME* element_cd = igetter.get(startDir + "/" + cdName);
1062 
1063  if (!element_cd) {
1064  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
1065  LogInfo("DQMGenericClient") << "makeCumulativeDist() : "
1066  << "No such element '" << cdName << "' found\n";
1067  }
1068  return;
1069  }
1070 
1071  TH1F* cd = element_cd->getTH1F();
1072 
1073  if (!cd) {
1074  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
1075  LogInfo("DQMGenericClient") << "makeCumulativeDist() : "
1076  << "Cannot create TH1F from ME\n";
1077  }
1078  return;
1079  }
1080 
1081  int n_bins = cd->GetNbinsX() + 1;
1082 
1083  if (ascending) {
1084  for (int i = 1; i <= n_bins; i++) {
1085  cd->SetBinContent(i, cd->GetBinContent(i) + cd->GetBinContent(i - 1));
1086  }
1087  } else {
1088  for (int i = n_bins - 1; i >= 0; i--) { // n_bins points to the overflow bin
1089  cd->SetBinContent(i, cd->GetBinContent(i) + cd->GetBinContent(i + 1));
1090  }
1091  }
1092 
1093  return;
1094 }
1095 
1097  DQMStore::IGetter& igetter,
1098  const std::string& startDir,
1099  const std::string& noFlowName) {
1100  if (!igetter.dirExists(startDir)) {
1101  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
1102  LogInfo("DQMGenericClient") << "makeNoFlowDist() : "
1103  << "Cannot find sub-directory " << startDir << endl;
1104  }
1105  return;
1106  }
1107 
1108  ibooker.cd();
1109 
1110  ME* element_noFlow = igetter.get(startDir + "/" + noFlowName);
1111 
1112  if (!element_noFlow) {
1113  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
1114  LogInfo("DQMGenericClient") << "makeNoFlowDist() : "
1115  << "No such element '" << noFlowName << "' found\n";
1116  }
1117  return;
1118  }
1119 
1120  TH1F* noFlow = element_noFlow->getTH1F();
1121 
1122  if (!noFlow) {
1123  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
1124  LogInfo("DQMGenericClient") << "makeNoFlowDist() : "
1125  << "Cannot create TH1F from ME\n";
1126  }
1127  return;
1128  }
1129 
1130  noFlow->AddBinContent(1, noFlow->GetBinContent(0));
1131  noFlow->SetBinContent(0, 0.);
1132 
1133  const auto lastBin = noFlow->GetNbinsX();
1134  noFlow->AddBinContent(lastBin, noFlow->GetBinContent(lastBin + 1));
1135  noFlow->SetBinContent(lastBin + 1, 0.);
1136 }
1137 
1139  TH2F* histo = srcME->getTH2F();
1140 
1141  static int i = 0;
1142  i++;
1143 
1144  // Fit slices projected along Y from bins in X
1145  double cont_min = 100; //Minimum number of entries
1146  Int_t binx = histo->GetXaxis()->GetNbins();
1147 
1148  for (int i = 1; i <= binx; i++) {
1149  TString iString(i);
1150  TH1* histoY = histo->ProjectionY(" ", i, i);
1151  double cont = histoY->GetEntries();
1152 
1153  if (cont >= cont_min) {
1154  float minfit = histoY->GetMean() - histoY->GetRMS();
1155  float maxfit = histoY->GetMean() + histoY->GetRMS();
1156 
1157  TF1* fitFcn = new TF1(TString("g") + histo->GetName() + iString, "gaus", minfit, maxfit);
1158  double x1, x2;
1159  fitFcn->GetRange(x1, x2);
1160  //To avoid DQMGenericClient maintains state between fit calls
1161  fitFcn->SetParameters(histoY->Integral(), histoY->GetMean(), histoY->GetRMS());
1162 
1163  histoY->Fit(fitFcn, "QR0 SERIAL", "", x1, x2);
1164 
1165  // histoY->Fit(fitFcn->GetName(),"RME");
1166  double* par = fitFcn->GetParameters();
1167  const double* err = fitFcn->GetParErrors();
1168 
1169  meanME->setBinContent(i, par[1]);
1170  meanME->setBinError(i, err[1]);
1171  // meanME->setBinEntries(i, 1.);
1172  // meanME->setBinError(i,sqrt(err[1]*err[1]+par[1]*par[1]));
1173 
1174  sigmaME->setBinContent(i, par[2]);
1175  sigmaME->setBinError(i, err[2]);
1176  // sigmaME->setBinEntries(i, 1.);
1177  // sigmaME->setBinError(i,sqrt(err[2]*err[2]+par[2]*par[2]));
1178 
1179  if (fitFcn)
1180  delete fitFcn;
1181  if (histoY)
1182  delete histoY;
1183  } else {
1184  if (histoY)
1185  delete histoY;
1186  continue;
1187  }
1188  }
1189 }
1190 
1191 //=================================
1192 
1194  DQMStore::IGetter& igetter,
1195  std::string dir,
1196  std::set<std::string>* myList,
1197  const TString& _pattern = TString("")) {
1198  TString pattern = _pattern;
1199  if (!igetter.dirExists(dir)) {
1200  LogError("DQMGenericClient") << " DQMGenericClient::findAllSubdirectories ==> Missing folder " << dir << " !!!";
1201  return;
1202  }
1203  if (pattern != "") {
1204  if (pattern.Contains(nonPerlWildcard_))
1205  pattern.ReplaceAll("*", ".*");
1206  TPRegexp regexp(pattern);
1207  ibooker.cd(dir);
1208  vector<string> foundDirs = igetter.getSubdirs();
1209  for (vector<string>::const_iterator iDir = foundDirs.begin(); iDir != foundDirs.end(); ++iDir) {
1210  TString dirName = iDir->substr(iDir->rfind('/') + 1, iDir->length());
1211  if (dirName.Contains(regexp))
1212  findAllSubdirectories(ibooker, igetter, *iDir, myList);
1213  }
1214  }
1215  //std::cout << "Looking for directory " << dir ;
1216  else if (igetter.dirExists(dir)) {
1217  //std::cout << "... it exists! Inserting it into the list ";
1218  myList->insert(dir);
1219  //std::cout << "... now list has size " << myList->size() << std::endl;
1220  ibooker.cd(dir);
1221  findAllSubdirectories(ibooker, igetter, dir, myList, "*");
1222  } else {
1223  //std::cout << "... DOES NOT EXIST!!! Skip bogus dir" << std::endl;
1224 
1225  LogInfo("DQMGenericClient") << "Trying to find sub-directories of " << dir << " failed because " << dir
1226  << " does not exist";
1227  }
1228  return;
1229 }
1230 
1231 void DQMGenericClient::generic_eff(TH1* denom, TH1* numer, MonitorElement* efficiencyHist, const EfficType type) {
1232  for (int iBinX = 1; iBinX < denom->GetNbinsX() + 1; iBinX++) {
1233  for (int iBinY = 1; iBinY < denom->GetNbinsY() + 1; iBinY++) {
1234  for (int iBinZ = 1; iBinZ < denom->GetNbinsZ() + 1; iBinZ++) {
1235  int globalBinNum = denom->GetBin(iBinX, iBinY, iBinZ);
1236 
1237  float numerVal = numer->GetBinContent(globalBinNum);
1238  float denomVal = denom->GetBinContent(globalBinNum);
1239 
1240  float effVal = 0;
1241 
1242  // fake eff is in use
1243  if (type == EfficType::fakerate) {
1244  effVal = denomVal ? (1 - numerVal / denomVal) : 0;
1245  } else {
1246  effVal = denomVal ? numerVal / denomVal : 0;
1247  }
1248 
1249  float errVal = 0;
1250  if (type == EfficType::simpleratio) {
1251  // errVal = denomVal ? 1.f/denomVal*effVal*(1+effVal) : 0;
1252  float numerErr = numer->GetBinError(globalBinNum);
1253  float denomErr = denom->GetBinError(globalBinNum);
1254  float denomsq = denomVal * denomVal;
1255  errVal = denomVal ? sqrt(pow(1.f / denomVal * numerErr, 2.0) + pow(numerVal / denomsq * denomErr, 2)) : 0;
1256  } else {
1257  errVal = (denomVal && (effVal <= 1)) ? sqrt(effVal * (1 - effVal) / denomVal) : 0;
1258  }
1259 
1260  LogDebug("DQMGenericClient") << "(iBinX, iBinY, iBinZ) = " << iBinX << ", " << iBinY << ", " << iBinZ
1261  << "), global bin = " << globalBinNum << "eff = " << numerVal << " / "
1262  << denomVal << " = " << effVal << " ... setting the error for that bin ... "
1263  << endl
1264  << endl;
1265 
1266  efficiencyHist->setBinContent(globalBinNum, effVal);
1267  efficiencyHist->setBinError(globalBinNum, errVal);
1268  efficiencyHist->setEfficiencyFlag();
1269  }
1270  }
1271  }
1272 
1273  //efficiencyHist->setMinimum(0.0);
1274  //efficiencyHist->setMaximum(1.0);
1275 }
1276 
1278 
1279 /* vim:set ts=2 sts=2 sw=2 expandtab: */
std::vector< EfficOption > efficOptions_
~FitSlicesYTool()
Destructor.
T getUntrackedParameter(std::string const &, T const &) const
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
virtual TH2F * getTH2F() const
const edm::EventSetup & c
std::vector< ProfileOption > profileOptions_
tuple cont
load Luminosity info ##
Definition: generateEDF.py:628
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
void dqmEndRun(DQMStore::IBooker &, DQMStore::IGetter &, edm::Run const &, edm::EventSetup const &) override
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
vector< string > vstring
Definition: ExoticaDQM.cc:8
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const
Definition: DQMStore.cc:700
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
virtual bool dirExists(std::string const &path) const
Definition: DQMStore.cc:730
void makeCumulativeDist(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &startDir, const std::string &cdName, bool ascending=true)
FitSlicesYTool(MonitorElement *me)
Log< level::Error, false > LogError
uint16_t size_type
std::vector< ResolOption > resolOptions_
Definition: ME.h:11
list denominator
Definition: cuy.py:485
void getFittedMeanWithError(MonitorElement *me)
Fill the ME with the mean value (with error) of the gaussian fit in each slice.
void getFittedSigma(MonitorElement *me)
Fill the ME with the sigma value of the gaussian fit in each slice.
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:322
T sqrt(T t)
Definition: SSEVec.h:19
std::vector< std::string > subDirs_
void makeAllPlots(DQMStore::IBooker &, DQMStore::IGetter &)
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:673
void normalizeToEntries(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &startDir, const std::string &histName, const std::string &normHistName)
void computeResolution(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &startDir, const std::string &fitMEPrefix, const std::string &fitMETitlePrefix, const std::string &srcMEName)
void makeNoFlowDist(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &startDir, const std::string &cdName)
void getFittedSigmaWithError(MonitorElement *me)
Fill the ME with the sigma value (with error) of the gaussian fit in each slice.
std::string outputFileName_
void getFittedMean(MonitorElement *me)
Fill the ME with the mean value of the gaussian fit in each slice.
__shared__ Hist hist
Log< level::Info, false > LogInfo
void findAllSubdirectories(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, std::string dir, std::set< std::string > *myList, const TString &pattern)
unsigned int verbose_
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
dqm::legacy::MonitorElement MonitorElement
void dqmEndLuminosityBlock(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c) override
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::vector< CDOption > cdOptions_
DQM_DEPRECATED void save(std::string const &filename, std::string const &path="")
Definition: DQMStore.cc:784
void computeEfficiency(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &startDir, const std::string &efficMEName, const std::string &efficMETitle, const std::string &recoMEName, const std::string &simMEName, const EfficType type=EfficType::efficiency, const bool makeProfile=false)
dqm::harvesting::MonitorElement ME
dqm::harvesting::MonitorElement MonitorElement
std::vector< NoFlowOption > noFlowOptions_
~DQMGenericClient() override
DQMGenericClient(const edm::ParameterSet &pset)
void computeProfile(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &startDir, const std::string &profileMEName, const std::string &profileMETitle, const std::string &srcMEName)
virtual void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
MonitorElement * book3D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ, FUNC onbooking=NOOP())
Definition: DQMStore.h:290
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
void limitedFit(MonitorElement *srcME, MonitorElement *meanME, MonitorElement *sigmaME)
Definition: Run.h:45
void generic_eff(TH1 *denom, TH1 *numer, MonitorElement *efficiencyHist, const EfficType type=EfficType::efficiency)
#define LogDebug(id)
std::vector< NormOption > normOptions_