CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Private Member Functions | Private Attributes
NanoAODDQM Class Reference
Inheritance diagram for NanoAODDQM:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Classes

class  Count1D
 
struct  GroupConfig
 
class  Plot
 
class  Plot1D
 
class  Profile1D
 
struct  SelGroupConfig
 

Public Types

typedef nanoaod::FlatTable FlatTable
 
- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
 NanoAODDQM (const edm::ParameterSet &)
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr< DQMEDAnalyzerGlobalCacheinitializeGlobalCache (edm::ParameterSet const &)
 

Protected Member Functions

void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 

Static Private Member Functions

static std::unique_ptr< PlotmakePlot (DQMStore::IBooker &booker, const edm::ParameterSet &cfg)
 

Private Attributes

edm::GetterOfProducts< FlatTablegetterOfProducts_
 
std::map< std::string, GroupConfiggroups_
 

Additional Inherited Members

- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Definition at line 46 of file NanoAODDQM.cc.

Member Typedef Documentation

◆ FlatTable

Definition at line 48 of file NanoAODDQM.cc.

Constructor & Destructor Documentation

◆ NanoAODDQM()

NanoAODDQM::NanoAODDQM ( const edm::ParameterSet iConfig)

Definition at line 233 of file NanoAODDQM.cc.

References edm::ParameterSet::getParameter(), getterOfProducts_, watchdog::group, groups_, Skims_PA_cff::name, muonDTDigis_cfi::pset, AlCaHLTBitMon_QueryRunRegistry::string, and nanoDQM_cfi::vplots.

233  : getterOfProducts_(edm::ProcessMatch("*"), this) {
234  const edm::ParameterSet &vplots = iConfig.getParameter<edm::ParameterSet>("vplots");
235  for (const std::string &name : vplots.getParameterNamesForType<edm::ParameterSet>()) {
236  auto &group = groups_[name];
237  const auto &pset = vplots.getParameter<edm::ParameterSet>(name);
238  group.plotPSets = pset.getParameter<std::vector<edm::ParameterSet>>("plots");
239  group.selGroups.emplace_back(); // no selection (all entries)
240  const auto &cuts = pset.getParameter<edm::ParameterSet>("sels");
241  for (const std::string &cname : cuts.getParameterNamesForType<std::string>()) {
242  group.selGroups.emplace_back(cname, cuts.getParameter<std::string>(cname));
243  }
244  }
245  callWhenNewProductsRegistered(getterOfProducts_);
246 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::map< std::string, GroupConfig > groups_
Definition: NanoAODDQM.cc:229
edm::GetterOfProducts< FlatTable > getterOfProducts_
Definition: NanoAODDQM.cc:230

Member Function Documentation

◆ analyze()

void NanoAODDQM::analyze ( const edm::Event iEvent,
const edm::EventSetup  
)
overridevirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 313 of file NanoAODDQM.cc.

References nanoaod::FlatTable::addExtension(), getterOfProducts_, groups_, iEvent, Skims_PA_cff::name, trackingPlots::other, plotFactory::plot, EgammaValidation_Wenu_cff::sel, AlCaHLTBitMon_QueryRunRegistry::string, TableParser::table, and postprocess-scan-build::tables.

313  {
314  std::vector<edm::Handle<FlatTable>> alltables;
315  getterOfProducts_.fillHandles(iEvent, alltables);
316  std::map<std::string, std::pair<const FlatTable *, std::vector<const FlatTable *>>> maintables;
317 
318  for (const auto &htab : alltables) {
319  if (htab->extension())
320  continue;
321  maintables[htab->name()] = std::make_pair(htab.product(), std::vector<const FlatTable *>());
322  }
323  for (const auto &htab : alltables) {
324  if (htab->extension()) {
325  if (maintables.find(htab->name()) == maintables.end())
326  throw cms::Exception("LogicError", "Missing main table for " + htab->name());
327  maintables[htab->name()].second.push_back(htab.product());
328  }
329  }
330 
331  FlatTable merged;
332  for (auto &pair : groups_) {
333  const std::string &name = pair.first;
334  if (maintables.find(name) == maintables.end())
335  continue; // may happen for missing collections
336  auto &tables = maintables[name];
337  const FlatTable *table = tables.first;
338  if (!tables.second.empty()) {
339  merged = *tables.first;
340  for (auto *other : tables.second) {
341  merged.addExtension(*other);
342  }
343  table = &merged;
344  }
345  std::vector<bool> selbits;
346  for (auto &sel : pair.second.selGroups) {
347  sel.fillSel(*table, selbits);
348 
349  for (auto &plot : sel.plots) {
350  plot->fill(*table, selbits);
351  }
352  }
353  }
354 }
nanoaod::FlatTable FlatTable
Definition: NanoAODDQM.cc:48
int iEvent
Definition: GenABIO.cc:224
std::map< std::string, GroupConfig > groups_
Definition: NanoAODDQM.cc:229
edm::GetterOfProducts< FlatTable > getterOfProducts_
Definition: NanoAODDQM.cc:230

◆ bookHistograms()

void NanoAODDQM::bookHistograms ( DQMStore::IBooker booker,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotectedvirtual

Implements DQMEDAnalyzer.

Definition at line 291 of file NanoAODDQM.cc.

References looper::cfg, DeadROC_duringRun::dir, groups_, makePlot(), eostools::move(), plotFactory::plot, HLTObjectsMonitor_cfi::plots, nanoDQM_cfi::sels, dqm::implementation::NavigatorBase::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.

291  {
292  booker.setCurrentFolder("Physics/NanoAODDQM");
293 
294  for (auto &pair : groups_) {
295  booker.setCurrentFolder("Physics/NanoAODDQM/" + pair.first);
296  for (auto &sels : pair.second.selGroups) {
297  std::string dir("Physics/NanoAODDQM/" + pair.first);
298  if (!sels.nullCut())
299  dir += "/" + sels.name;
300  booker.setCurrentFolder(dir);
301  auto &plots = sels.plots;
302  plots.clear();
303  plots.reserve(pair.second.plotPSets.size());
304  for (const auto &cfg : pair.second.plotPSets) {
305  auto plot = makePlot(booker, cfg);
306  if (plot)
307  plots.push_back(std::move(plot));
308  }
309  }
310  }
311 }
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
static std::unique_ptr< Plot > makePlot(DQMStore::IBooker &booker, const edm::ParameterSet &cfg)
Definition: NanoAODDQM.cc:189
std::map< std::string, GroupConfig > groups_
Definition: NanoAODDQM.cc:229
def move(src, dest)
Definition: eostools.py:511

◆ fillDescriptions()

void NanoAODDQM::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 248 of file NanoAODDQM.cc.

References edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addVPSet(), edm::ConfigurationDescriptions::addWithDefaultLabel(), nanoDQM_cfi::bitset, submitPVResolutionJobs::desc, SiStripPI::max, SiStripPI::min, Skims_PA_cff::name, LaserClient_cfi::nbins, or, plotFactory::plot, edm::RequireZeroOrMore, nanoDQM_cfi::sels, edm::ParameterSetDescription::setComment(), runGCPTkAlMap::title, and nanoDQM_cfi::vplots.

248  {
250 
252  sels.setComment("a paramerter set to define the selections to be made from the table row");
254 
256  edm::ParameterDescription<std::string> title("title", true, edm::Comment("title of the plot"));
257  edm::ParameterDescription<uint32_t> nbins("nbins", true, edm::Comment("number of bins of the plot"));
258  edm::ParameterDescription<double> min("min", true, edm::Comment("starting value of the x axis"));
259  edm::ParameterDescription<double> max("max", true, edm::Comment("ending value of the x axis"));
260  edm::ParameterDescription<bool> bitset("bitset", false, true, edm::Comment("plot individual bits of values"));
262  "column", true, edm::Comment("name of the raw to fill the content of the plot"));
264  "xcolumn", true, edm::Comment("name of the raw to fill the x content of the plot"));
266  "ycolumn", true, edm::Comment("name of the raw to fill the y content of the plot"));
267 
269  plot.setComment("a parameter set that defines a DQM histogram");
270  plot.ifValue(
271  edm::ParameterDescription<std::string>("kind", "none", true, edm::Comment("the type of histogram")),
272  "none" >> (name) or //it should really be edm::EmptyGroupDescription(), but name is used in python by modifiers
273  "count1d" >> (name and title and nbins and min and max) or
274  "hist1d" >> (name and title and nbins and min and max and column and bitset) or
275  "prof1d" >> (name and title and nbins and min and max and xcolumn and ycolumn));
276 
278  vplot.setComment(
279  "a parameter set to define all the plots to be made from a table row selected from the name of the PSet");
280  vplot.add<edm::ParameterSetDescription>("sels", sels);
281  vplot.addVPSet("plots", plot);
282 
284  vplots.setComment("a parameter set to define all the set of plots to be made from the tables");
286  desc.add<edm::ParameterSetDescription>("vplots", vplots);
287 
288  descriptions.addWithDefaultLabel(desc);
289 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
ParameterDescriptionBase * addVPSet(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
void setComment(std::string const &value)
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
ParameterDescriptionBase * add(U const &iLabel, T const &value)

◆ makePlot()

static std::unique_ptr<Plot> NanoAODDQM::makePlot ( DQMStore::IBooker booker,
const edm::ParameterSet cfg 
)
inlinestaticprivate

Definition at line 189 of file NanoAODDQM.cc.

References looper::cfg, Exception, CalibrationSummaryClient_cfi::kind, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by bookHistograms().

189  {
190  const std::string &kind = cfg.getParameter<std::string>("kind");
191  if (kind == "none")
192  return nullptr;
193  if (kind == "count1d")
194  return std::make_unique<Count1D>(booker, cfg);
195  if (kind == "hist1d")
196  return std::make_unique<Plot1D>(booker, cfg);
197  if (kind == "prof1d")
198  return std::make_unique<Profile1D>(booker, cfg);
199  throw cms::Exception("Configuration", "Unsupported plot kind '" + kind + "'");
200  }

Member Data Documentation

◆ getterOfProducts_

edm::GetterOfProducts<FlatTable> NanoAODDQM::getterOfProducts_
private

Definition at line 230 of file NanoAODDQM.cc.

Referenced by analyze(), and NanoAODDQM().

◆ groups_

std::map<std::string, GroupConfig> NanoAODDQM::groups_
private

Definition at line 229 of file NanoAODDQM.cc.

Referenced by analyze(), bookHistograms(), and NanoAODDQM().