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 241 of file DQMGenericClient.cc.

242  : metacharacters_("[\\^\\$\\.\\*\\+\\?\\|\\(\\)\\{\\}\\[\\]]"), nonPerlWildcard_("\\w\\*|^\\*") {
243  typedef std::vector<edm::ParameterSet> VPSet;
244  typedef std::vector<std::string> vstring;
245  typedef boost::escaped_list_separator<char> elsc;
246 
247  elsc commonEscapes("\\", " \t", "\'");
248 
249  verbose_ = pset.getUntrackedParameter<unsigned int>("verbose", 0);
250  runOnEndLumi_ = pset.getUntrackedParameter<bool>("runOnEndLumi", false);
251  runOnEndJob_ = pset.getUntrackedParameter<bool>("runOnEndJob", true);
252  makeGlobalEffPlot_ = pset.getUntrackedParameter<bool>("makeGlobalEffienciesPlot", true);
253 
254  // Parse efficiency commands
255  vstring effCmds = pset.getParameter<vstring>("efficiency");
256  for (vstring::const_iterator effCmd = effCmds.begin(); effCmd != effCmds.end(); ++effCmd) {
257  if (effCmd->empty())
258  continue;
259 
260  boost::tokenizer<elsc> tokens(*effCmd, commonEscapes);
261 
262  vector<string> args;
263  for (boost::tokenizer<elsc>::const_iterator iToken = tokens.begin(); iToken != tokens.end(); ++iToken) {
264  if (iToken->empty())
265  continue;
266  args.push_back(*iToken);
267  }
268 
269  if (args.size() < 4) {
270  LogInfo("DQMGenericClient") << "Wrong input to effCmds\n";
271  continue;
272  }
273 
274  EfficOption opt;
275  opt.name = args[0];
276  opt.title = args[1];
277  opt.numerator = args[2];
278  opt.denominator = args[3];
279  opt.isProfile = false;
280 
281  const string typeName = args.size() == 4 ? "eff" : args[4];
282  if (typeName == "eff")
283  opt.type = EfficType::efficiency;
284  else if (typeName == "fake")
285  opt.type = EfficType::fakerate;
286  else if (typeName == "simpleratio")
288  else
289  opt.type = EfficType::none;
290 
291  efficOptions_.push_back(opt);
292  }
293 
294  VPSet efficSets = pset.getUntrackedParameter<VPSet>("efficiencySets", VPSet());
295  for (VPSet::const_iterator efficSet = efficSets.begin(); efficSet != efficSets.end(); ++efficSet) {
296  EfficOption opt;
297  opt.name = efficSet->getUntrackedParameter<string>("name");
298  opt.title = efficSet->getUntrackedParameter<string>("title");
299  opt.numerator = efficSet->getUntrackedParameter<string>("numerator");
300  opt.denominator = efficSet->getUntrackedParameter<string>("denominator");
301  opt.isProfile = false;
302 
303  const string typeName = efficSet->getUntrackedParameter<string>("typeName", "eff");
304  if (typeName == "eff")
305  opt.type = EfficType::efficiency;
306  else if (typeName == "fake")
307  opt.type = EfficType::fakerate;
308  else if (typeName == "simpleratio")
310  else
311  opt.type = EfficType::none;
312 
313  efficOptions_.push_back(opt);
314  }
315 
316  // Parse efficiency profiles
317  vstring effProfileCmds = pset.getUntrackedParameter<vstring>("efficiencyProfile", vstring());
318  for (vstring::const_iterator effProfileCmd = effProfileCmds.begin(); effProfileCmd != effProfileCmds.end();
319  ++effProfileCmd) {
320  if (effProfileCmd->empty())
321  continue;
322 
323  boost::tokenizer<elsc> tokens(*effProfileCmd, commonEscapes);
324 
325  vector<string> args;
326  for (boost::tokenizer<elsc>::const_iterator iToken = tokens.begin(); iToken != tokens.end(); ++iToken) {
327  if (iToken->empty())
328  continue;
329  args.push_back(*iToken);
330  }
331 
332  if (args.size() < 4) {
333  LogInfo("DQMGenericClient") << "Wrong input to effProfileCmds\n";
334  continue;
335  }
336 
337  EfficOption opt;
338  opt.name = args[0];
339  opt.title = args[1];
340  opt.numerator = args[2];
341  opt.denominator = args[3];
342  opt.isProfile = true;
343 
344  const string typeName = args.size() == 4 ? "eff" : args[4];
345  if (typeName == "eff")
346  opt.type = EfficType::efficiency;
347  else if (typeName == "fake")
348  opt.type = EfficType::fakerate;
349  else if (typeName == "simpleratio")
351  else
352  opt.type = EfficType::none;
353 
354  efficOptions_.push_back(opt);
355  }
356 
357  VPSet effProfileSets = pset.getUntrackedParameter<VPSet>("efficiencyProfileSets", VPSet());
358  for (VPSet::const_iterator effProfileSet = effProfileSets.begin(); effProfileSet != effProfileSets.end();
359  ++effProfileSet) {
360  EfficOption opt;
361  opt.name = effProfileSet->getUntrackedParameter<string>("name");
362  opt.title = effProfileSet->getUntrackedParameter<string>("title");
363  opt.numerator = effProfileSet->getUntrackedParameter<string>("numerator");
364  opt.denominator = effProfileSet->getUntrackedParameter<string>("denominator");
365  opt.isProfile = true;
366 
367  const string typeName = effProfileSet->getUntrackedParameter<string>("typeName", "eff");
368  if (typeName == "eff")
369  opt.type = EfficType::efficiency;
370  else if (typeName == "fake")
371  opt.type = EfficType::fakerate;
372  else if (typeName == "simpleratio")
374  else
375  opt.type = EfficType::none;
376 
377  efficOptions_.push_back(opt);
378  }
379 
380  // Parse resolution commands
381  vstring resCmds = pset.getParameter<vstring>("resolution");
382  for (vstring::const_iterator resCmd = resCmds.begin(); resCmd != resCmds.end(); ++resCmd) {
383  if (resCmd->empty())
384  continue;
385  boost::tokenizer<elsc> tokens(*resCmd, commonEscapes);
386 
387  vector<string> args;
388  for (boost::tokenizer<elsc>::const_iterator iToken = tokens.begin(); iToken != tokens.end(); ++iToken) {
389  if (iToken->empty())
390  continue;
391  args.push_back(*iToken);
392  }
393 
394  if (args.size() != 3) {
395  LogInfo("DQMGenericClient") << "Wrong input to resCmds\n";
396  continue;
397  }
398 
399  ResolOption opt;
400  opt.namePrefix = args[0];
401  opt.titlePrefix = args[1];
402  opt.srcName = args[2];
403 
404  resolOptions_.push_back(opt);
405  }
406 
407  VPSet resolSets = pset.getUntrackedParameter<VPSet>("resolutionSets", VPSet());
408  for (VPSet::const_iterator resolSet = resolSets.begin(); resolSet != resolSets.end(); ++resolSet) {
409  ResolOption opt;
410  opt.namePrefix = resolSet->getUntrackedParameter<string>("namePrefix");
411  opt.titlePrefix = resolSet->getUntrackedParameter<string>("titlePrefix");
412  opt.srcName = resolSet->getUntrackedParameter<string>("srcName");
413 
414  resolOptions_.push_back(opt);
415  }
416 
417  // Parse profiles
418  vstring profileCmds = pset.getUntrackedParameter<vstring>("profile", vstring());
419  for (const auto& profileCmd : profileCmds) {
420  boost::tokenizer<elsc> tokens(profileCmd, commonEscapes);
421 
422  vector<string> args;
423  for (boost::tokenizer<elsc>::const_iterator iToken = tokens.begin(); iToken != tokens.end(); ++iToken) {
424  if (iToken->empty())
425  continue;
426  args.push_back(*iToken);
427  }
428 
429  if (args.size() != 3) {
430  LogInfo("DQMGenericClient") << "Wrong input to profileCmds\n";
431  continue;
432  }
433 
434  ProfileOption opt;
435  opt.name = args[0];
436  opt.title = args[1];
437  opt.srcName = args[2];
438 
439  profileOptions_.push_back(opt);
440  }
441 
442  VPSet profileSets = pset.getUntrackedParameter<VPSet>("profileSets", VPSet());
443  for (const auto& profileSet : profileSets) {
444  ProfileOption opt;
445  opt.name = profileSet.getUntrackedParameter<string>("name");
446  opt.title = profileSet.getUntrackedParameter<string>("title");
447  opt.srcName = profileSet.getUntrackedParameter<string>("srcName");
448 
449  profileOptions_.push_back(opt);
450  }
451 
452  // Parse Normalization commands
453  vstring normCmds = pset.getUntrackedParameter<vstring>("normalization", vstring());
454  for (vstring::const_iterator normCmd = normCmds.begin(); normCmd != normCmds.end(); ++normCmd) {
455  if (normCmd->empty())
456  continue;
457  boost::tokenizer<elsc> tokens(*normCmd, commonEscapes);
458 
459  vector<string> args;
460  for (boost::tokenizer<elsc>::const_iterator iToken = tokens.begin(); iToken != tokens.end(); ++iToken) {
461  if (iToken->empty())
462  continue;
463  args.push_back(*iToken);
464  }
465 
466  if (args.empty() or args.size() > 2) {
467  LogInfo("DQMGenericClient") << "Wrong input to normCmds\n";
468  continue;
469  }
470 
471  NormOption opt;
472  opt.name = args[0];
473  opt.normHistName = args.size() == 2 ? args[1] : args[0];
474 
475  normOptions_.push_back(opt);
476  }
477 
478  VPSet normSets = pset.getUntrackedParameter<VPSet>("normalizationSets", VPSet());
479  for (VPSet::const_iterator normSet = normSets.begin(); normSet != normSets.end(); ++normSet) {
480  NormOption opt;
481  opt.name = normSet->getUntrackedParameter<string>("name");
482  opt.normHistName = normSet->getUntrackedParameter<string>("normalizedTo", opt.name);
483 
484  normOptions_.push_back(opt);
485  }
486 
487  // Cumulative distributions
488  vstring cdCmds = pset.getUntrackedParameter<vstring>("cumulativeDists", vstring());
489  for (vstring::const_iterator cdCmd = cdCmds.begin(); cdCmd != cdCmds.end(); ++cdCmd) {
490  if (cdCmd->empty())
491  continue;
492  boost::tokenizer<elsc> tokens(*cdCmd, commonEscapes);
493 
494  vector<string> args;
495  for (boost::tokenizer<elsc>::const_iterator iToken = tokens.begin(); iToken != tokens.end(); ++iToken) {
496  if (iToken->empty())
497  continue;
498  args.push_back(*iToken);
499  }
500 
501  if (args.empty() || args.size() > 2) {
502  LogInfo("DQMGenericClient") << "Wrong input to cdCmds\n";
503  continue;
504  }
505 
506  CDOption opt;
507  opt.name = args[0];
508  opt.ascending = args.size() == 2 ? (args[1] != "descending") : true;
509 
510  cdOptions_.push_back(opt);
511  }
512 
513  VPSet cdSets = pset.getUntrackedParameter<VPSet>("cumulativeDistSets", VPSet());
514  for (VPSet::const_iterator cdSet = cdSets.begin(); cdSet != cdSets.end(); ++cdSet) {
515  CDOption opt;
516  opt.name = cdSet->getUntrackedParameter<string>("name");
517  opt.ascending = cdSet->getUntrackedParameter<bool>("ascending", true);
518 
519  cdOptions_.push_back(opt);
520  }
521 
522  // move under/overflows to first/last bins
523  vstring noFlowCmds = pset.getUntrackedParameter<vstring>("noFlowDists", vstring());
524  for (vstring::const_iterator noFlowCmd = noFlowCmds.begin(); noFlowCmd != noFlowCmds.end(); ++noFlowCmd) {
525  if (noFlowCmd->empty())
526  continue;
527  boost::tokenizer<elsc> tokens(*noFlowCmd, commonEscapes);
528 
529  vector<string> args;
530  for (boost::tokenizer<elsc>::const_iterator iToken = tokens.begin(); iToken != tokens.end(); ++iToken) {
531  if (iToken->empty())
532  continue;
533  args.push_back(*iToken);
534  }
535 
536  if (args.empty() || args.size() > 2) {
537  LogInfo("DQMGenericClient") << "Wrong input to noFlowCmds\n";
538  continue;
539  }
540 
541  NoFlowOption opt;
542  opt.name = args[0];
543 
544  noFlowOptions_.push_back(opt);
545  }
546 
547  VPSet noFlowSets = pset.getUntrackedParameter<VPSet>("noFlowDistSets", VPSet());
548  for (VPSet::const_iterator noFlowSet = noFlowSets.begin(); noFlowSet != noFlowSets.end(); ++noFlowSet) {
549  NoFlowOption opt;
550  opt.name = noFlowSet->getUntrackedParameter<string>("name");
551 
552  noFlowOptions_.push_back(opt);
553  }
554 
555  outputFileName_ = pset.getUntrackedParameter<string>("outputFileName", "");
556  subDirs_ = pset.getUntrackedParameter<vstring>("subDirs");
557 
558  resLimitedFit_ = pset.getUntrackedParameter<bool>("resolutionLimitedFit", false);
559  isWildcardUsed_ = false;
560 }

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 672 of file DQMGenericClient.cc.

680  {
681  if (!igetter.dirExists(startDir)) {
682  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
683  LogInfo("DQMGenericClient") << "computeEfficiency() : "
684  << "Cannot find sub-directory " << startDir << endl;
685  }
686  return;
687  }
688 
689  ibooker.cd();
690 
691  ME* simME = igetter.get(startDir + "/" + simMEName);
692  ME* recoME = igetter.get(startDir + "/" + recoMEName);
693 
694  if (!simME) {
695  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
696  LogInfo("DQMGenericClient") << "computeEfficiency() : "
697  << "No sim-ME '" << simMEName << "' found\n";
698  }
699  return;
700  }
701 
702  if (!recoME) {
703  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
704  LogInfo("DQMGenericClient") << "computeEfficiency() : "
705  << "No reco-ME '" << recoMEName << "' found\n";
706  }
707  return;
708  }
709 
710  // Treat everything as the base class, TH1
711 
712  TH1* hSim = simME->getTH1();
713  TH1* hReco = recoME->getTH1();
714 
715  if (!hSim || !hReco) {
716  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
717  LogInfo("DQMGenericClient") << "computeEfficiency() : "
718  << "Cannot create TH1 from ME\n";
719  }
720  return;
721  }
722 
723  string efficDir = startDir;
724  string newEfficMEName = efficMEName;
725  string::size_type shiftPos;
726  if (string::npos != (shiftPos = efficMEName.rfind('/'))) {
727  efficDir += "/" + efficMEName.substr(0, shiftPos);
728  newEfficMEName.erase(0, shiftPos + 1);
729  }
730  ibooker.setCurrentFolder(efficDir);
731 
732  if (makeProfile) {
733  TProfile* efficHist = (hReco->GetXaxis()->GetXbins()->GetSize() == 0)
734  ? new TProfile(newEfficMEName.c_str(),
735  efficMETitle.c_str(),
736  hReco->GetXaxis()->GetNbins(),
737  hReco->GetXaxis()->GetXmin(),
738  hReco->GetXaxis()->GetXmax())
739  : new TProfile(newEfficMEName.c_str(),
740  efficMETitle.c_str(),
741  hReco->GetXaxis()->GetNbins(),
742  hReco->GetXaxis()->GetXbins()->GetArray());
743 
744  efficHist->GetXaxis()->SetTitle(hSim->GetXaxis()->GetTitle());
745  efficHist->GetYaxis()->SetTitle(hSim->GetYaxis()->GetTitle());
746 
747  for (int i = 1; i <= hReco->GetNbinsX(); i++) {
748  const double nReco = hReco->GetBinContent(i);
749  const double nSim = hSim->GetBinContent(i);
750 
751  if (!std::string(hSim->GetXaxis()->GetBinLabel(i)).empty())
752  efficHist->GetXaxis()->SetBinLabel(i, hSim->GetXaxis()->GetBinLabel(i));
753 
754  if (nSim == 0 or nReco < 0 or nReco > nSim)
755  continue;
756  const double effVal = nReco / nSim;
757  const double errLo = TEfficiency::ClopperPearson(nSim, nReco, 0.683, false);
758  const double errUp = TEfficiency::ClopperPearson(nSim, nReco, 0.683, true);
759  const double errVal = (effVal - errLo > errUp - effVal) ? effVal - errLo : errUp - effVal;
760  efficHist->SetBinContent(i, effVal);
761  efficHist->SetBinEntries(i, 1);
762  efficHist->SetBinError(i, std::hypot(effVal, errVal));
763  }
764  ibooker.bookProfile(newEfficMEName, efficHist);
765  delete efficHist;
766  }
767 
768  else {
769  TH1* efficHist = (TH1*)hSim->Clone(newEfficMEName.c_str());
770  efficHist->SetTitle(efficMETitle.c_str());
771 
772  // Here is where you have trouble --- you need
773  // to understand what type of hist you have.
774 
775  ME* efficME = nullptr;
776 
777  // Parse the class name
778  // This works, but there might be a better way
779  TClass* myHistClass = efficHist->IsA();
780  TString histClassName = myHistClass->GetName();
781 
782  if (histClassName == "TH1F") {
783  efficME = ibooker.book1D(newEfficMEName, (TH1F*)efficHist);
784  } else if (histClassName == "TH2F") {
785  efficME = ibooker.book2D(newEfficMEName, (TH2F*)efficHist);
786  } else if (histClassName == "TH3F") {
787  efficME = ibooker.book3D(newEfficMEName, (TH3F*)efficHist);
788  }
789 
790  delete efficHist;
791 
792  if (!efficME) {
793  LogInfo("DQMGenericClient") << "computeEfficiency() : "
794  << "Cannot book effic-ME from the DQM\n";
795  return;
796  }
797 
798  // Update: 2009-9-16 slaunwhj
799  // call the most generic efficiency function
800  // works up to 3-d histograms
801 
802  generic_eff(hSim, hReco, efficME, type);
803 
804  // const int nBin = efficME->getNbinsX();
805  // for(int bin = 0; bin <= nBin; ++bin) {
806  // const float nSim = simME ->getBinContent(bin);
807  // const float nReco = recoME->getBinContent(bin);
808  // float eff =0;
809  // if (type=="fake")eff = nSim ? 1-nReco/nSim : 0.;
810  // else eff= nSim ? nReco/nSim : 0.;
811  // const float err = nSim && eff <= 1 ? sqrt(eff*(1-eff)/nSim) : 0.;
812  // efficME->setBinContent(bin, eff);
813  // efficME->setBinError(bin, err);
814  // }
815  efficME->setEntries(simME->getEntries());
816  }
817 
818  // Global efficiency
819  if (makeGlobalEffPlot_) {
820  ME* globalEfficME = igetter.get(efficDir + "/globalEfficiencies");
821  if (!globalEfficME)
822  globalEfficME = ibooker.book1D("globalEfficiencies", "Global efficiencies", 1, 0, 1);
823  if (!globalEfficME) {
824  LogInfo("DQMGenericClient") << "computeEfficiency() : "
825  << "Cannot book globalEffic-ME from the DQM\n";
826  return;
827  }
828  globalEfficME->setEfficiencyFlag();
829  TH1F* hGlobalEffic = globalEfficME->getTH1F();
830  if (!hGlobalEffic) {
831  LogInfo("DQMGenericClient") << "computeEfficiency() : "
832  << "Cannot create TH1F from ME, globalEfficME\n";
833  return;
834  }
835 
836  const float nSimAll = hSim->GetEntries();
837  const float nRecoAll = hReco->GetEntries();
838  float efficAll = 0;
840  efficAll = nSimAll ? nRecoAll / nSimAll : 0;
841  else if (type == EfficType::fakerate)
842  efficAll = nSimAll ? 1 - nRecoAll / nSimAll : 0;
843  float errorAll = 0;
844  if (type == EfficType::simpleratio) {
845  if (nSimAll) {
846  const float x = nRecoAll / nSimAll;
847  errorAll = std::sqrt(1.f / nSimAll * x * (1 + x));
848  }
849  } else
850  errorAll = nSimAll && efficAll < 1 ? sqrt(efficAll * (1 - efficAll) / nSimAll) : 0;
851 
852  const int iBin = hGlobalEffic->Fill(newEfficMEName.c_str(), 0);
853  hGlobalEffic->SetBinContent(iBin, efficAll);
854  hGlobalEffic->SetBinError(iBin, errorAll);
855  }
856 }

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 935 of file DQMGenericClient.cc.

940  {
941  if (!igetter.dirExists(startDir)) {
942  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
943  LogInfo("DQMGenericClient") << "computeProfile() : "
944  << "Cannot find sub-directory " << startDir << endl;
945  }
946  return;
947  }
948 
949  ibooker.cd();
950 
951  ME* srcME = igetter.get(startDir + "/" + srcMEName);
952  if (!srcME) {
953  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
954  LogInfo("DQMGenericClient") << "computeProfile() : "
955  << "No source ME '" << srcMEName << "' found\n";
956  }
957  return;
958  }
959 
960  TH2F* hSrc = srcME->getTH2F();
961  if (!hSrc) {
962  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
963  LogInfo("DQMGenericClient") << "computeProfile() : "
964  << "Cannot create TH2F from source-ME\n";
965  }
966  return;
967  }
968 
969  string profileDir = startDir;
970  string newProfileMEName = profileMEName;
971  string::size_type shiftPos;
972  if (string::npos != (shiftPos = profileMEName.rfind('/'))) {
973  profileDir += "/" + profileMEName.substr(0, shiftPos);
974  newProfileMEName.erase(0, shiftPos + 1);
975  }
976  ibooker.setCurrentFolder(profileDir);
977 
978  std::unique_ptr<TProfile> profile(hSrc->ProfileX()); // We own the pointer
979  profile->SetTitle(profileMETitle.c_str());
980  ibooker.bookProfile(profileMEName, profile.get()); // ibooker makes a copy
981 }

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 858 of file DQMGenericClient.cc.

863  {
864  if (!igetter.dirExists(startDir)) {
865  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
866  LogInfo("DQMGenericClient") << "computeResolution() : "
867  << "Cannot find sub-directory " << startDir << endl;
868  }
869  return;
870  }
871 
872  ibooker.cd();
873 
874  ME* srcME = igetter.get(startDir + "/" + srcName);
875  if (!srcME) {
876  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
877  LogInfo("DQMGenericClient") << "computeResolution() : "
878  << "No source ME '" << srcName << "' found\n";
879  }
880  return;
881  }
882 
883  TH2F* hSrc = srcME->getTH2F();
884  if (!hSrc) {
885  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
886  LogInfo("DQMGenericClient") << "computeResolution() : "
887  << "Cannot create TH2F from source-ME\n";
888  }
889  return;
890  }
891 
892  const int nBin = hSrc->GetNbinsX();
893 
894  string newDir = startDir;
895  string newPrefix = namePrefix;
896  string::size_type shiftPos;
897  if (string::npos != (shiftPos = namePrefix.rfind('/'))) {
898  newDir += "/" + namePrefix.substr(0, shiftPos);
899  newPrefix.erase(0, shiftPos + 1);
900  }
901 
902  ibooker.setCurrentFolder(newDir);
903 
904  float* lowedgesfloats = new float[nBin + 1];
905  ME* meanME;
906  ME* sigmaME;
907  if (hSrc->GetXaxis()->GetXbins()->GetSize()) {
908  for (int j = 0; j < nBin + 1; ++j)
909  lowedgesfloats[j] = (float)hSrc->GetXaxis()->GetXbins()->GetAt(j);
910  meanME = ibooker.book1D(newPrefix + "_Mean", titlePrefix + " Mean", nBin, lowedgesfloats);
911  sigmaME = ibooker.book1D(newPrefix + "_Sigma", titlePrefix + " Sigma", nBin, lowedgesfloats);
912  } else {
913  meanME = ibooker.book1D(
914  newPrefix + "_Mean", titlePrefix + " Mean", nBin, hSrc->GetXaxis()->GetXmin(), hSrc->GetXaxis()->GetXmax());
915  sigmaME = ibooker.book1D(
916  newPrefix + "_Sigma", titlePrefix + " Sigma", nBin, hSrc->GetXaxis()->GetXmin(), hSrc->GetXaxis()->GetXmax());
917  }
918 
919  if (meanME && sigmaME) {
920  meanME->setEfficiencyFlag();
921  sigmaME->setEfficiencyFlag();
922 
923  if (!resLimitedFit_) {
924  FitSlicesYTool fitTool(srcME);
925  fitTool.getFittedMeanWithError(meanME);
926  fitTool.getFittedSigmaWithError(sigmaME);
928  } else {
929  limitedFit(srcME, meanME, sigmaME);
930  }
931  }
932  delete[] lowedgesfloats;
933 }

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 562 of file DQMGenericClient.cc.

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

References makeAllPlots(), and runOnEndLumi_.

◆ dqmEndRun()

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

Definition at line 571 of file DQMGenericClient.cc.

574  {
575  // Create new MEs in endRun, even though we are requested to do it in endJob.
576  // This gives the QTests a chance to run, before summaries are created in
577  // endJob. The negative side effect is that we cannot run the GenericClient
578  // for plots produced in Harvesting, but that seems rather rare.
579  //
580  // It is important that this is still save in the presence of multiple runs,
581  // first because in multi-run harvesting, we accumulate statistics over all
582  // runs and have full statistics at the endRun of the last run, and second,
583  // because we set the efficiencyFlag so any further aggregation should produce
584  // correct results. Also, all operations should be idempotent; running them
585  // more than once does no harm.
586 
587  // needed to access the DQMStore::save method
588  theDQM = nullptr;
589  theDQM = Service<DQMStore>().operator->();
590 
591  if (runOnEndJob_) {
592  makeAllPlots(ibooker, igetter);
593  }
594 
595  if (!outputFileName_.empty())
597 }

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 1193 of file DQMGenericClient.cc.

1197  {
1198  TString pattern = _pattern;
1199  if (!igetter.dirExists(dir)) {
1200  LogError("DQMGenericClient") << " DQMGenericClient::findAllSubdirectories ==> Missing folder " << dir << " !!!";
1201  return;
1202  }
1203  if (pattern != "") {
1204  if (pattern.Contains(nonPerlWildcard_))
1205  pattern.ReplaceAll("*", ".*");
1206  TPRegexp regexp(pattern);
1207  ibooker.cd(dir);
1208  vector<string> foundDirs = igetter.getSubdirs();
1209  for (vector<string>::const_iterator iDir = foundDirs.begin(); iDir != foundDirs.end(); ++iDir) {
1210  TString dirName = iDir->substr(iDir->rfind('/') + 1, iDir->length());
1211  if (dirName.Contains(regexp))
1212  findAllSubdirectories(ibooker, igetter, *iDir, myList);
1213  }
1214  }
1215  //std::cout << "Looking for directory " << dir ;
1216  else if (igetter.dirExists(dir)) {
1217  //std::cout << "... it exists! Inserting it into the list ";
1218  myList->insert(dir);
1219  //std::cout << "... now list has size " << myList->size() << std::endl;
1220  ibooker.cd(dir);
1221  findAllSubdirectories(ibooker, igetter, dir, myList, "*");
1222  } else {
1223  //std::cout << "... DOES NOT EXIST!!! Skip bogus dir" << std::endl;
1224 
1225  LogInfo("DQMGenericClient") << "Trying to find sub-directories of " << dir << " failed because " << dir
1226  << " does not exist";
1227  }
1228  return;
1229 }

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 1231 of file DQMGenericClient.cc.

1231  {
1232  for (int iBinX = 1; iBinX < denom->GetNbinsX() + 1; iBinX++) {
1233  for (int iBinY = 1; iBinY < denom->GetNbinsY() + 1; iBinY++) {
1234  for (int iBinZ = 1; iBinZ < denom->GetNbinsZ() + 1; iBinZ++) {
1235  int globalBinNum = denom->GetBin(iBinX, iBinY, iBinZ);
1236 
1237  float numerVal = numer->GetBinContent(globalBinNum);
1238  float denomVal = denom->GetBinContent(globalBinNum);
1239 
1240  float effVal = 0;
1241 
1242  // fake eff is in use
1243  if (type == EfficType::fakerate) {
1244  effVal = denomVal ? (1 - numerVal / denomVal) : 0;
1245  } else {
1246  effVal = denomVal ? numerVal / denomVal : 0;
1247  }
1248 
1249  float errVal = 0;
1250  if (type == EfficType::simpleratio) {
1251  // errVal = denomVal ? 1.f/denomVal*effVal*(1+effVal) : 0;
1252  float numerErr = numer->GetBinError(globalBinNum);
1253  float denomErr = denom->GetBinError(globalBinNum);
1254  float denomsq = denomVal * denomVal;
1255  errVal = denomVal ? sqrt(pow(1.f / denomVal * numerErr, 2.0) + pow(numerVal / denomsq * denomErr, 2)) : 0;
1256  } else {
1257  errVal = (denomVal && (effVal <= 1)) ? sqrt(effVal * (1 - effVal) / denomVal) : 0;
1258  }
1259 
1260  LogDebug("DQMGenericClient") << "(iBinX, iBinY, iBinZ) = " << iBinX << ", " << iBinY << ", " << iBinZ
1261  << "), global bin = " << globalBinNum << "eff = " << numerVal << " / "
1262  << denomVal << " = " << effVal << " ... setting the error for that bin ... "
1263  << endl
1264  << endl;
1265 
1266  efficiencyHist->setBinContent(globalBinNum, effVal);
1267  efficiencyHist->setBinError(globalBinNum, errVal);
1268  efficiencyHist->setEfficiencyFlag();
1269  }
1270  }
1271  }
1272 
1273  //efficiencyHist->setMinimum(0.0);
1274  //efficiencyHist->setMaximum(1.0);
1275 }

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 1138 of file DQMGenericClient.cc.

1138  {
1139  TH2F* histo = srcME->getTH2F();
1140 
1141  static int i = 0;
1142  i++;
1143 
1144  // Fit slices projected along Y from bins in X
1145  double cont_min = 100; //Minimum number of entries
1146  Int_t binx = histo->GetXaxis()->GetNbins();
1147 
1148  for (int i = 1; i <= binx; i++) {
1149  TString iString(i);
1150  TH1* histoY = histo->ProjectionY(" ", i, i);
1151  double cont = histoY->GetEntries();
1152 
1153  if (cont >= cont_min) {
1154  float minfit = histoY->GetMean() - histoY->GetRMS();
1155  float maxfit = histoY->GetMean() + histoY->GetRMS();
1156 
1157  TF1* fitFcn = new TF1(TString("g") + histo->GetName() + iString, "gaus", minfit, maxfit);
1158  double x1, x2;
1159  fitFcn->GetRange(x1, x2);
1160  //To avoid DQMGenericClient maintains state between fit calls
1161  fitFcn->SetParameters(histoY->Integral(), histoY->GetMean(), histoY->GetRMS());
1162 
1163  histoY->Fit(fitFcn, "QR0 SERIAL", "", x1, x2);
1164 
1165  // histoY->Fit(fitFcn->GetName(),"RME");
1166  double* par = fitFcn->GetParameters();
1167  const double* err = fitFcn->GetParErrors();
1168 
1169  meanME->setBinContent(i, par[1]);
1170  meanME->setBinError(i, err[1]);
1171  // meanME->setBinEntries(i, 1.);
1172  // meanME->setBinError(i,sqrt(err[1]*err[1]+par[1]*par[1]));
1173 
1174  sigmaME->setBinContent(i, par[2]);
1175  sigmaME->setBinError(i, err[2]);
1176  // sigmaME->setBinEntries(i, 1.);
1177  // sigmaME->setBinError(i,sqrt(err[2]*err[2]+par[2]*par[2]));
1178 
1179  if (fitFcn)
1180  delete fitFcn;
1181  if (histoY)
1182  delete histoY;
1183  } else {
1184  if (histoY)
1185  delete histoY;
1186  continue;
1187  }
1188  }
1189 }

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 599 of file DQMGenericClient.cc.

599  {
600  typedef vector<string> vstring;
601 
602  // Process wildcard in the sub-directory
603  set<string> subDirSet;
604 
605  for (vstring::const_iterator iSubDir = subDirs_.begin(); iSubDir != subDirs_.end(); ++iSubDir) {
606  string subDir = *iSubDir;
607 
608  if (subDir[subDir.size() - 1] == '/')
609  subDir.erase(subDir.size() - 1);
610 
611  if (TString(subDir).Contains(metacharacters_)) {
612  isWildcardUsed_ = true;
613 
614  const string::size_type shiftPos = subDir.rfind('/');
615  const string searchPath = subDir.substr(0, shiftPos);
616  const string pattern = subDir.substr(shiftPos + 1, subDir.length());
617  //std::cout << "\n\n\n\nLooking for all subdirs of " << subDir << std::endl;
618 
619  findAllSubdirectories(ibooker, igetter, searchPath, &subDirSet, pattern);
620 
621  } else {
622  subDirSet.insert(subDir);
623  }
624  }
625 
626  for (set<string>::const_iterator iSubDir = subDirSet.begin(); iSubDir != subDirSet.end(); ++iSubDir) {
627  const string& dirName = *iSubDir;
628 
629  // First normalize, then move under/overflows, then make
630  // cumulative, and only then efficiency This allows to use the
631  // cumulative distributions for efficiency calculation
632  for (vector<NormOption>::const_iterator normOption = normOptions_.begin(); normOption != normOptions_.end();
633  ++normOption) {
634  normalizeToEntries(ibooker, igetter, dirName, normOption->name, normOption->normHistName);
635  }
636 
637  for (vector<NoFlowOption>::const_iterator noFlowOption = noFlowOptions_.begin();
638  noFlowOption != noFlowOptions_.end();
639  ++noFlowOption) {
640  makeNoFlowDist(ibooker, igetter, dirName, noFlowOption->name);
641  }
642 
643  for (vector<CDOption>::const_iterator cdOption = cdOptions_.begin(); cdOption != cdOptions_.end(); ++cdOption) {
644  makeCumulativeDist(ibooker, igetter, dirName, cdOption->name, cdOption->ascending);
645  }
646 
647  for (vector<EfficOption>::const_iterator efficOption = efficOptions_.begin(); efficOption != efficOptions_.end();
648  ++efficOption) {
649  computeEfficiency(ibooker,
650  igetter,
651  dirName,
652  efficOption->name,
653  efficOption->title,
654  efficOption->numerator,
655  efficOption->denominator,
656  efficOption->type,
657  efficOption->isProfile);
658  }
659 
660  for (vector<ResolOption>::const_iterator resolOption = resolOptions_.begin(); resolOption != resolOptions_.end();
661  ++resolOption) {
663  ibooker, igetter, dirName, resolOption->namePrefix, resolOption->titlePrefix, resolOption->srcName);
664  }
665 
666  for (const auto& profileOption : profileOptions_) {
667  computeProfile(ibooker, igetter, dirName, profileOption.name, profileOption.title, profileOption.srcName);
668  }
669  }
670 }

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 1046 of file DQMGenericClient.cc.

1050  {
1051  if (!igetter.dirExists(startDir)) {
1052  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
1053  LogInfo("DQMGenericClient") << "makeCumulativeDist() : "
1054  << "Cannot find sub-directory " << startDir << endl;
1055  }
1056  return;
1057  }
1058 
1059  ibooker.cd();
1060 
1061  ME* element_cd = igetter.get(startDir + "/" + cdName);
1062 
1063  if (!element_cd) {
1064  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
1065  LogInfo("DQMGenericClient") << "makeCumulativeDist() : "
1066  << "No such element '" << cdName << "' found\n";
1067  }
1068  return;
1069  }
1070 
1071  TH1F* cd = element_cd->getTH1F();
1072 
1073  if (!cd) {
1074  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
1075  LogInfo("DQMGenericClient") << "makeCumulativeDist() : "
1076  << "Cannot create TH1F from ME\n";
1077  }
1078  return;
1079  }
1080 
1081  int n_bins = cd->GetNbinsX() + 1;
1082 
1083  if (ascending) {
1084  for (int i = 1; i <= n_bins; i++) {
1085  cd->SetBinContent(i, cd->GetBinContent(i) + cd->GetBinContent(i - 1));
1086  }
1087  } else {
1088  for (int i = n_bins - 1; i >= 0; i--) { // n_bins points to the overflow bin
1089  cd->SetBinContent(i, cd->GetBinContent(i) + cd->GetBinContent(i + 1));
1090  }
1091  }
1092 
1093  return;
1094 }

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 1096 of file DQMGenericClient.cc.

1099  {
1100  if (!igetter.dirExists(startDir)) {
1101  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
1102  LogInfo("DQMGenericClient") << "makeNoFlowDist() : "
1103  << "Cannot find sub-directory " << startDir << endl;
1104  }
1105  return;
1106  }
1107 
1108  ibooker.cd();
1109 
1110  ME* element_noFlow = igetter.get(startDir + "/" + noFlowName);
1111 
1112  if (!element_noFlow) {
1113  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
1114  LogInfo("DQMGenericClient") << "makeNoFlowDist() : "
1115  << "No such element '" << noFlowName << "' found\n";
1116  }
1117  return;
1118  }
1119 
1120  TH1F* noFlow = element_noFlow->getTH1F();
1121 
1122  if (!noFlow) {
1123  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
1124  LogInfo("DQMGenericClient") << "makeNoFlowDist() : "
1125  << "Cannot create TH1F from ME\n";
1126  }
1127  return;
1128  }
1129 
1130  noFlow->AddBinContent(1, noFlow->GetBinContent(0));
1131  noFlow->SetBinContent(0, 0.);
1132 
1133  const auto lastBin = noFlow->GetNbinsX();
1134  noFlow->AddBinContent(lastBin, noFlow->GetBinContent(lastBin + 1));
1135  noFlow->SetBinContent(lastBin + 1, 0.);
1136 }

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 983 of file DQMGenericClient.cc.

987  {
988  if (!igetter.dirExists(startDir)) {
989  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
990  LogInfo("DQMGenericClient") << "normalizeToEntries() : "
991  << "Cannot find sub-directory " << startDir << endl;
992  }
993  return;
994  }
995 
996  ibooker.cd();
997 
998  ME* element = igetter.get(startDir + "/" + histName);
999  ME* normME = igetter.get(startDir + "/" + normHistName);
1000 
1001  if (!element) {
1002  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
1003  LogInfo("DQMGenericClient") << "normalizeToEntries() : "
1004  << "No such element '" << histName << "' found\n";
1005  }
1006  return;
1007  }
1008 
1009  if (!normME) {
1010  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
1011  LogInfo("DQMGenericClient") << "normalizeToEntries() : "
1012  << "No such element '" << normHistName << "' found\n";
1013  }
1014  return;
1015  }
1016 
1017  TH1F* hist = element->getTH1F();
1018  if (!hist) {
1019  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
1020  LogInfo("DQMGenericClient") << "normalizeToEntries() : "
1021  << "Cannot create TH1F from ME\n";
1022  }
1023  return;
1024  }
1025 
1026  TH1F* normHist = normME->getTH1F();
1027  if (!normHist) {
1028  if (verbose_ >= 2 || (verbose_ == 1 && !isWildcardUsed_)) {
1029  LogInfo("DQMGenericClient") << "normalizeToEntries() : "
1030  << "Cannot create TH1F from ME\n";
1031  }
1032  return;
1033  }
1034 
1035  const double entries = normHist->GetEntries();
1036  if (entries != 0) {
1037  hist->Scale(1. / entries);
1038  } else {
1039  LogInfo("DQMGenericClient") << "normalizeToEntries() : "
1040  << "Zero entries in histogram\n";
1041  }
1042 
1043  return;
1044 }

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:146
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:672
DQMGenericClient::makeAllPlots
void makeAllPlots(DQMStore::IBooker &, DQMStore::IGetter &)
Definition: DQMGenericClient.cc:599
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:278
generateEDF.cont
cont
load Luminosity info ##
Definition: generateEDF.py:628
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:700
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:307
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:1046
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:784
DQMGenericClient::resolOptions_
std::vector< ResolOption > resolOptions_
Definition: DQMGenericClient.cc:133
DQMGenericClient::cdOptions_
std::vector< CDOption > cdOptions_
Definition: DQMGenericClient.cc:136
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:983
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:39
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
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
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:682
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:1193
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:858
dqm::impl::MonitorElement::setBinError
virtual void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
Definition: MonitorElement.cc:700
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:673
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:1231
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:1096
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:730
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:1138
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:935
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23
dqm::legacy::MonitorElement::getTH2F
virtual TH2F * getTH2F() const
Definition: MonitorElement.h:491