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 230 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.

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

Member Function Documentation

◆ analyze()

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

Reimplemented from DQMEDAnalyzer.

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

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

◆ bookHistograms()

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

Implements DQMEDAnalyzer.

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

288  {
289  booker.setCurrentFolder("Physics/NanoAODDQM");
290 
291  for (auto &pair : groups_) {
292  booker.setCurrentFolder("Physics/NanoAODDQM/" + pair.first);
293  for (auto &sels : pair.second.selGroups) {
294  std::string dir("Physics/NanoAODDQM/" + pair.first);
295  if (!sels.nullCut())
296  dir += "/" + sels.name;
297  booker.setCurrentFolder(dir);
298  auto &plots = sels.plots;
299  plots.clear();
300  plots.reserve(pair.second.plotPSets.size());
301  for (const auto &cfg : pair.second.plotPSets) {
302  auto plot = makePlot(booker, cfg);
303  if (plot)
304  plots.push_back(std::move(plot));
305  }
306  }
307  }
308 }
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:186
std::map< std::string, GroupConfig > groups_
Definition: NanoAODDQM.cc:226
def move(src, dest)
Definition: eostools.py:511

◆ fillDescriptions()

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

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

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

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

Referenced by bookHistograms().

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

Member Data Documentation

◆ getterOfProducts_

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

Definition at line 227 of file NanoAODDQM.cc.

Referenced by analyze(), and NanoAODDQM().

◆ groups_

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

Definition at line 226 of file NanoAODDQM.cc.

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