CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
DQMGenericClient Class Reference
Inheritance diagram for DQMGenericClient:

Classes

struct  CDOption
 
struct  EfficOption
 
struct  NoFlowOption
 
struct  NormOption
 
struct  ProfileOption
 
struct  ResolOption
 

Public Types

enum  EfficType { EfficType::none = 0, EfficType::efficiency, EfficType::fakerate, EfficType::simpleratio }
 

Public Member Functions

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)
 
void computeProfile (DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &startDir, const std::string &profileMEName, const std::string &profileMETitle, const std::string &srcMEName)
 
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 dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 
void dqmEndLuminosityBlock (DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c) override
 
void dqmEndRun (DQMStore::IBooker &, DQMStore::IGetter &, edm::Run const &, edm::EventSetup const &) override
 
 DQMGenericClient (const edm::ParameterSet &pset)
 
void limitedFit (MonitorElement *srcME, MonitorElement *meanME, MonitorElement *sigmaME)
 
void makeCumulativeDist (DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &startDir, const std::string &cdName, bool ascending=true)
 
void makeNoFlowDist (DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &startDir, const std::string &cdName)
 
void normalizeToEntries (DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &startDir, const std::string &histName, const std::string &normHistName)
 
 ~DQMGenericClient () override
 

Private Member Functions

void findAllSubdirectories (DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, std::string dir, std::set< std::string > *myList, const TString &pattern)
 
void generic_eff (TH1 *denom, TH1 *numer, MonitorElement *efficiencyHist, const EfficType type=EfficType::efficiency)
 
void makeAllPlots (DQMStore::IBooker &, DQMStore::IGetter &)
 
void removeMEIfBooked (const std::string &meName, DQMStore::IGetter &igetter)
 

Private Attributes

std::vector< CDOptioncdOptions_
 
std::vector< EfficOptionefficOptions_
 
bool isWildcardUsed_
 
bool makeGlobalEffPlot_
 
TPRegexp metacharacters_
 
std::vector< NoFlowOptionnoFlowOptions_
 
TPRegexp nonPerlWildcard_
 
std::vector< NormOptionnormOptions_
 
std::string outputFileName_
 
std::vector< ProfileOptionprofileOptions_
 
bool resLimitedFit_
 
std::vector< ResolOptionresolOptions_
 
bool runOnEndJob_
 
bool runOnEndLumi_
 
std::vector< std::string > subDirs_
 
DQMStoretheDQM
 
unsigned int verbose_
 

Detailed Description

Definition at line 35 of file DQMGenericClient.cc.

Member Enumeration Documentation

◆ EfficType

Enumerator
none 
efficiency 
fakerate 
simpleratio 

Definition at line 47 of file DQMGenericClient.cc.

47 { none = 0, efficiency, fakerate, simpleratio };

Constructor & Destructor Documentation

◆ DQMGenericClient()

DQMGenericClient::DQMGenericClient ( const edm::ParameterSet pset)

Definition at line 240 of file DQMGenericClient.cc.

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 
273  EfficOption opt;
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) {
295  EfficOption opt;
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 
336  EfficOption opt;
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) {
359  EfficOption opt;
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 
398  ResolOption opt;
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) {
408  ResolOption opt;
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 
433  ProfileOption opt;
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) {
443  ProfileOption opt;
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 
540  NoFlowOption opt;
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) {
548  NoFlowOption opt;
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 }

References writedatasetfile::args, cdOptions_, efficiency, efficOptions_, postValidation_cfi::efficSet(), fakerate, isWildcardUsed_, makeGlobalEffPlot_, noFlowOptions_, none, normOptions_, runTheMatrix::opt, or, outputFileName_, profileOptions_, muonDTDigis_cfi::pset, resLimitedFit_, resolOptions_, runOnEndJob_, runOnEndLumi_, simpleratio, subDirs_, dqmiodumpindices::typeName, verbose_, and HistogramManager_cfi::VPSet().

◆ ~DQMGenericClient()

DQMGenericClient::~DQMGenericClient ( )
inlineoverride

Definition at line 38 of file DQMGenericClient.cc.

38 {};

Member Function Documentation

◆ computeEfficiency()

void DQMGenericClient::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 at line 671 of file DQMGenericClient.cc.

679  {
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 }

References dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::book2D(), dqm::implementation::IBooker::book3D(), dqm::implementation::IBooker::bookProfile(), dqm::implementation::NavigatorBase::cd(), dqm::implementation::IGetter::dirExists(), efficiency, relativeConstraints::empty, f, fakerate, generic_eff(), dqm::implementation::IGetter::get(), mps_fire::i, isWildcardUsed_, makeGlobalEffPlot_, or, dqm::implementation::NavigatorBase::setCurrentFolder(), simpleratio, mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, verbose_, and x.

Referenced by makeAllPlots().

◆ computeProfile()

void DQMGenericClient::computeProfile ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
const std::string &  startDir,
const std::string &  profileMEName,
const std::string &  profileMETitle,
const std::string &  srcMEName 
)

Definition at line 934 of file DQMGenericClient.cc.

939  {
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 }

References dqm::implementation::IBooker::bookProfile(), dqm::implementation::NavigatorBase::cd(), dqm::implementation::IGetter::dirExists(), dqm::implementation::IGetter::get(), isWildcardUsed_, PostProcessor_cff::profile, dqm::implementation::NavigatorBase::setCurrentFolder(), and verbose_.

Referenced by makeAllPlots().

◆ computeResolution()

void DQMGenericClient::computeResolution ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
const std::string &  startDir,
const std::string &  fitMEPrefix,
const std::string &  fitMETitlePrefix,
const std::string &  srcMEName 
)

Definition at line 857 of file DQMGenericClient.cc.

862  {
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 }

References dqm::implementation::IBooker::book1D(), dqm::implementation::NavigatorBase::cd(), dqm::implementation::IGetter::dirExists(), dqm::implementation::IGetter::get(), FitSlicesYTool::getFittedMeanWithError(), FitSlicesYTool::getFittedSigmaWithError(), isWildcardUsed_, dqmiolumiharvest::j, limitedFit(), postValidation_cfi::namePrefix, PFElectronDQMAnalyzer_cfi::nBin, resLimitedFit_, dqm::implementation::NavigatorBase::setCurrentFolder(), postValidation_cfi::srcName, L1TdeStage2uGMT_cff::titlePrefix, and verbose_.

Referenced by makeAllPlots().

◆ dqmEndJob()

void DQMGenericClient::dqmEndJob ( DQMStore::IBooker ,
DQMStore::IGetter  
)
inlineoverride

Definition at line 45 of file DQMGenericClient.cc.

45 {};

◆ dqmEndLuminosityBlock()

void DQMGenericClient::dqmEndLuminosityBlock ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
const edm::LuminosityBlock lumiSeg,
const edm::EventSetup c 
)
override

Definition at line 561 of file DQMGenericClient.cc.

564  {
565  if (runOnEndLumi_) {
566  makeAllPlots(ibooker, igetter);
567  }
568 }

References makeAllPlots(), and runOnEndLumi_.

◆ dqmEndRun()

void DQMGenericClient::dqmEndRun ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
edm::Run const &  ,
edm::EventSetup const &   
)
override

Definition at line 570 of file DQMGenericClient.cc.

573  {
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 }

References makeAllPlots(), outputFileName_, runOnEndJob_, dqm::implementation::DQMStore::save(), and theDQM.

◆ findAllSubdirectories()

void DQMGenericClient::findAllSubdirectories ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
std::string  dir,
std::set< std::string > *  myList,
const TString &  pattern = TString("") 
)
private

Definition at line 1190 of file DQMGenericClient.cc.

1194  {
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 }

References dqm::implementation::NavigatorBase::cd(), DeadROC_duringRun::dir, dqm::implementation::IGetter::dirExists(), TrackerOfflineValidation_Dqm_cff::dirName, dqm::implementation::IGetter::getSubdirs(), PatBasicFWLiteJetAnalyzer_Selector_cfg::myList, nonPerlWildcard_, topSingleLeptonDQM_PU_cfi::pattern, and fetchall_from_DQM_v2::regexp.

Referenced by makeAllPlots().

◆ generic_eff()

void DQMGenericClient::generic_eff ( TH1 *  denom,
TH1 *  numer,
MonitorElement efficiencyHist,
const EfficType  type = EfficType::efficiency 
)
private

Definition at line 1228 of file DQMGenericClient.cc.

1228  {
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 }

References makePileupJSON::denom, f, fakerate, LogDebug, funct::pow(), dqm::impl::MonitorElement::setBinContent(), dqm::impl::MonitorElement::setBinError(), dqm::impl::MonitorElement::setEfficiencyFlag(), simpleratio, and mathSSE::sqrt().

Referenced by computeEfficiency().

◆ limitedFit()

void DQMGenericClient::limitedFit ( MonitorElement srcME,
MonitorElement meanME,
MonitorElement sigmaME 
)

Definition at line 1137 of file DQMGenericClient.cc.

1137  {
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 }

References generateEDF::cont, submitPVResolutionJobs::err, dqm::legacy::MonitorElement::getTH2F(), timingPdfMaker::histo, mps_fire::i, dqm::impl::MonitorElement::setBinContent(), dqm::impl::MonitorElement::setBinError(), testProducerWithPsetDescEmpty_cfi::x1, and testProducerWithPsetDescEmpty_cfi::x2.

Referenced by computeResolution().

◆ makeAllPlots()

void DQMGenericClient::makeAllPlots ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)
private

Definition at line 598 of file DQMGenericClient.cc.

598  {
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 }

References cdOptions_, computeEfficiency(), computeProfile(), computeResolution(), TrackerOfflineValidation_Dqm_cff::dirName, efficOptions_, findAllSubdirectories(), isWildcardUsed_, makeCumulativeDist(), makeNoFlowDist(), metacharacters_, noFlowOptions_, normalizeToEntries(), normOptions_, topSingleLeptonDQM_PU_cfi::pattern, profileOptions_, resolOptions_, PostProcessorHcalIsoTrack_cfi::subDir, and subDirs_.

Referenced by dqmEndLuminosityBlock(), and dqmEndRun().

◆ makeCumulativeDist()

void DQMGenericClient::makeCumulativeDist ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
const std::string &  startDir,
const std::string &  cdName,
bool  ascending = true 
)

Definition at line 1045 of file DQMGenericClient.cc.

1049  {
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 }

References dqm::implementation::NavigatorBase::cd(), hippyaddtobaddatafiles::cd(), dqm::implementation::IGetter::dirExists(), dqm::implementation::IGetter::get(), mps_fire::i, isWildcardUsed_, and verbose_.

Referenced by makeAllPlots().

◆ makeNoFlowDist()

void DQMGenericClient::makeNoFlowDist ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
const std::string &  startDir,
const std::string &  cdName 
)

Definition at line 1095 of file DQMGenericClient.cc.

1098  {
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 }

References dqm::implementation::NavigatorBase::cd(), dqm::implementation::IGetter::dirExists(), dqm::implementation::IGetter::get(), isWildcardUsed_, and verbose_.

Referenced by makeAllPlots().

◆ normalizeToEntries()

void DQMGenericClient::normalizeToEntries ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
const std::string &  startDir,
const std::string &  histName,
const std::string &  normHistName 
)

Definition at line 982 of file DQMGenericClient.cc.

986  {
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 }

References dqm::implementation::NavigatorBase::cd(), dqm::implementation::IGetter::dirExists(), dqm::implementation::IGetter::get(), gpuVertexFinder::hist, isWildcardUsed_, and verbose_.

Referenced by makeAllPlots().

◆ removeMEIfBooked()

void DQMGenericClient::removeMEIfBooked ( const std::string &  meName,
DQMStore::IGetter igetter 
)
private

Member Data Documentation

◆ cdOptions_

std::vector<CDOption> DQMGenericClient::cdOptions_
private

Definition at line 136 of file DQMGenericClient.cc.

Referenced by DQMGenericClient(), and makeAllPlots().

◆ efficOptions_

std::vector<EfficOption> DQMGenericClient::efficOptions_
private

Definition at line 132 of file DQMGenericClient.cc.

Referenced by DQMGenericClient(), and makeAllPlots().

◆ isWildcardUsed_

bool DQMGenericClient::isWildcardUsed_
private

◆ makeGlobalEffPlot_

bool DQMGenericClient::makeGlobalEffPlot_
private

Definition at line 124 of file DQMGenericClient.cc.

Referenced by computeEfficiency(), and DQMGenericClient().

◆ metacharacters_

TPRegexp DQMGenericClient::metacharacters_
private

Definition at line 119 of file DQMGenericClient.cc.

Referenced by makeAllPlots().

◆ noFlowOptions_

std::vector<NoFlowOption> DQMGenericClient::noFlowOptions_
private

Definition at line 137 of file DQMGenericClient.cc.

Referenced by DQMGenericClient(), and makeAllPlots().

◆ nonPerlWildcard_

TPRegexp DQMGenericClient::nonPerlWildcard_
private

Definition at line 120 of file DQMGenericClient.cc.

Referenced by findAllSubdirectories().

◆ normOptions_

std::vector<NormOption> DQMGenericClient::normOptions_
private

Definition at line 135 of file DQMGenericClient.cc.

Referenced by DQMGenericClient(), and makeAllPlots().

◆ outputFileName_

std::string DQMGenericClient::outputFileName_
private

Definition at line 130 of file DQMGenericClient.cc.

Referenced by dqmEndRun(), and DQMGenericClient().

◆ profileOptions_

std::vector<ProfileOption> DQMGenericClient::profileOptions_
private

Definition at line 134 of file DQMGenericClient.cc.

Referenced by DQMGenericClient(), and makeAllPlots().

◆ resLimitedFit_

bool DQMGenericClient::resLimitedFit_
private

Definition at line 126 of file DQMGenericClient.cc.

Referenced by computeResolution(), and DQMGenericClient().

◆ resolOptions_

std::vector<ResolOption> DQMGenericClient::resolOptions_
private

Definition at line 133 of file DQMGenericClient.cc.

Referenced by DQMGenericClient(), and makeAllPlots().

◆ runOnEndJob_

bool DQMGenericClient::runOnEndJob_
private

Definition at line 123 of file DQMGenericClient.cc.

Referenced by dqmEndRun(), and DQMGenericClient().

◆ runOnEndLumi_

bool DQMGenericClient::runOnEndLumi_
private

Definition at line 122 of file DQMGenericClient.cc.

Referenced by dqmEndLuminosityBlock(), and DQMGenericClient().

◆ subDirs_

std::vector<std::string> DQMGenericClient::subDirs_
private

Definition at line 129 of file DQMGenericClient.cc.

Referenced by DQMGenericClient(), and makeAllPlots().

◆ theDQM

DQMStore* DQMGenericClient::theDQM
private

Definition at line 128 of file DQMGenericClient.cc.

Referenced by dqmEndRun().

◆ verbose_

unsigned int DQMGenericClient::verbose_
private
writedatasetfile.args
args
Definition: writedatasetfile.py:18
mps_fire.i
i
Definition: mps_fire.py:428
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
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
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
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
dqm::implementation::IGetter::getSubdirs
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const
Definition: DQMStore.cc:678
DDAxes::x
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
L1TObjectsTimingClient_cff.efficiency
efficiency
Definition: L1TObjectsTimingClient_cff.py:10
runTheMatrix.opt
opt
Definition: runTheMatrix.py:306
DQMGenericClient::efficOptions_
std::vector< EfficOption > efficOptions_
Definition: DQMGenericClient.cc:132
DQMGenericClient::makeGlobalEffPlot_
bool makeGlobalEffPlot_
Definition: DQMGenericClient.cc:124
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
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
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
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
DQMGenericClient::EfficType::fakerate
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
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::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:233
DQMGenericClient::EfficType::simpleratio
DQMGenericClient::nonPerlWildcard_
TPRegexp nonPerlWildcard_
Definition: DQMGenericClient.cc:120
PatBasicFWLiteJetAnalyzer_Selector_cfg.myList
myList
Definition: PatBasicFWLiteJetAnalyzer_Selector_cfg.py:14
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
gpuVertexFinder::hist
__shared__ Hist hist
Definition: gpuClusterTracksDBSCAN.h:48
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
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
submitPVResolutionJobs.err
err
Definition: submitPVResolutionJobs.py:85
postValidation_cfi.efficSet
def efficSet(nameIn, titleIn, numeratorIn, denominatorIn, typeIn="eff")
Definition: postValidation_cfi.py:4
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:404
DQMGenericClient::runOnEndJob_
bool runOnEndJob_
Definition: DQMGenericClient.cc:123
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::isWildcardUsed_
bool isWildcardUsed_
Definition: DQMGenericClient.cc:125
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
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
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
DQMGenericClient::generic_eff
void generic_eff(TH1 *denom, TH1 *numer, MonitorElement *efficiencyHist, const EfficType type=EfficType::efficiency)
Definition: DQMGenericClient.cc:1228
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
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
DQMGenericClient::makeNoFlowDist
void makeNoFlowDist(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &startDir, const std::string &cdName)
Definition: DQMGenericClient.cc:1095
DQMGenericClient::EfficType::efficiency
DQMGenericClient::verbose_
unsigned int verbose_
Definition: DQMGenericClient.cc:121
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::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:491