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 53 of file NanoAODDQM.cc.

Member Typedef Documentation

◆ FlatTable

Definition at line 55 of file NanoAODDQM.cc.

Constructor & Destructor Documentation

◆ NanoAODDQM()

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

Definition at line 238 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.

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

Member Function Documentation

◆ analyze()

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

Reimplemented from DQMEDAnalyzer.

Definition at line 318 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, and TableParser::table.

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

◆ bookHistograms()

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

Implements DQMEDAnalyzer.

Definition at line 296 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.

296  {
297  booker.setCurrentFolder("Physics/NanoAODDQM");
298 
299  for (auto &pair : groups_) {
300  booker.setCurrentFolder("Physics/NanoAODDQM/" + pair.first);
301  for (auto &sels : pair.second.selGroups) {
302  std::string dir("Physics/NanoAODDQM/" + pair.first);
303  if (!sels.nullCut())
304  dir += "/" + sels.name;
305  booker.setCurrentFolder(dir);
306  auto &plots = sels.plots;
307  plots.clear();
308  plots.reserve(pair.second.plotPSets.size());
309  for (const auto &cfg : pair.second.plotPSets) {
310  auto plot = makePlot(booker, cfg);
311  if (plot)
312  plots.push_back(std::move(plot));
313  }
314  }
315  }
316 }
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:193
std::map< std::string, GroupConfig > groups_
Definition: NanoAODDQM.cc:234
def move(src, dest)
Definition: eostools.py:511

◆ fillDescriptions()

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

Definition at line 253 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.

253  {
255 
257  sels.setComment("a paramerter set to define the selections to be made from the table row");
259 
261  edm::ParameterDescription<std::string> title("title", true, edm::Comment("title of the plot"));
262  edm::ParameterDescription<uint32_t> nbins("nbins", true, edm::Comment("number of bins of the plot"));
263  edm::ParameterDescription<double> min("min", true, edm::Comment("starting value of the x axis"));
264  edm::ParameterDescription<double> max("max", true, edm::Comment("ending value of the x axis"));
265  edm::ParameterDescription<bool> bitset("bitset", false, true, edm::Comment("plot individual bits of values"));
267  "column", true, edm::Comment("name of the raw to fill the content of the plot"));
269  "xcolumn", true, edm::Comment("name of the raw to fill the x content of the plot"));
271  "ycolumn", true, edm::Comment("name of the raw to fill the y content of the plot"));
272 
274  plot.setComment("a parameter set that defines a DQM histogram");
275  plot.ifValue(
276  edm::ParameterDescription<std::string>("kind", "none", true, edm::Comment("the type of histogram")),
277  "none" >> (name) or //it should really be edm::EmptyGroupDescription(), but name is used in python by modifiers
278  "count1d" >> (name and title and nbins and min and max) or
279  "hist1d" >> (name and title and nbins and min and max and column and bitset) or
280  "prof1d" >> (name and title and nbins and min and max and xcolumn and ycolumn));
281 
283  vplot.setComment(
284  "a parameter set to define all the plots to be made from a table row selected from the name of the PSet");
285  vplot.add<edm::ParameterSetDescription>("sels", sels);
286  vplot.addVPSet("plots", plot);
287 
289  vplots.setComment("a parameter set to define all the set of plots to be made from the tables");
291  desc.add<edm::ParameterSetDescription>("vplots", vplots);
292 
293  descriptions.addWithDefaultLabel(desc);
294 }
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 193 of file NanoAODDQM.cc.

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

Referenced by bookHistograms().

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

Member Data Documentation

◆ getterOfProducts_

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

Definition at line 235 of file NanoAODDQM.cc.

Referenced by analyze(), and NanoAODDQM().

◆ groups_

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

Definition at line 234 of file NanoAODDQM.cc.

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