CMS 3D CMS Logo

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