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

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

Member Typedef Documentation

◆ FlatTable

Definition at line 44 of file NanoAODDQM.cc.

Constructor & Destructor Documentation

◆ NanoAODDQM()

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

Definition at line 200 of file NanoAODDQM.cc.

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

200  {
201  const edm::ParameterSet &vplots = iConfig.getParameter<edm::ParameterSet>("vplots");
202  for (const std::string &name : vplots.getParameterNamesForType<edm::ParameterSet>()) {
203  auto &group = groups_[name];
204  const auto &pset = vplots.getParameter<edm::ParameterSet>(name);
205  group.plotPSets = pset.getParameter<std::vector<edm::ParameterSet>>("plots");
206  group.selGroups.emplace_back(); // no selection (all entries)
207  const auto &cuts = pset.getParameter<edm::ParameterSet>("sels");
208  for (const std::string &cname : cuts.getParameterNamesForType<std::string>()) {
209  group.selGroups.emplace_back(cname, cuts.getParameter<std::string>(cname));
210  }
211  }
212  consumesMany<FlatTable>();
213 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TkSoA const *__restrict__ CAHitNtupletGeneratorKernelsGPU::QualityCuts cuts
std::map< std::string, GroupConfig > groups_
Definition: NanoAODDQM.cc:197

Member Function Documentation

◆ analyze()

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

Reimplemented from DQMEDAnalyzer.

Definition at line 279 of file NanoAODDQM.cc.

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

279  {
280  std::vector<edm::Handle<FlatTable>> alltables;
281  iEvent.getManyByType(alltables);
282  std::map<std::string, std::pair<const FlatTable *, std::vector<const FlatTable *>>> maintables;
283 
284  for (const auto &htab : alltables) {
285  if (htab->extension())
286  continue;
287  maintables[htab->name()] = std::make_pair(htab.product(), std::vector<const FlatTable *>());
288  }
289  for (const auto &htab : alltables) {
290  if (htab->extension()) {
291  if (maintables.find(htab->name()) == maintables.end())
292  throw cms::Exception("LogicError", "Missing main table for " + htab->name());
293  maintables[htab->name()].second.push_back(htab.product());
294  }
295  }
296 
297  FlatTable merged;
298  for (auto &pair : groups_) {
299  const std::string &name = pair.first;
300  if (maintables.find(name) == maintables.end())
301  continue; // may happen for missing collections
302  auto &tables = maintables[name];
303  const FlatTable *table = tables.first;
304  if (!tables.second.empty()) {
305  merged = *tables.first;
306  for (auto *other : tables.second) {
307  merged.addExtension(*other);
308  }
309  table = &merged;
310  }
311  std::vector<bool> selbits;
312  for (auto &sel : pair.second.selGroups) {
313  sel.fillSel(*table, selbits);
314 
315  for (auto &plot : sel.plots) {
316  plot->fill(*table, selbits);
317  }
318  }
319  }
320 }
nanoaod::FlatTable FlatTable
Definition: NanoAODDQM.cc:44
int iEvent
Definition: GenABIO.cc:224
std::map< std::string, GroupConfig > groups_
Definition: NanoAODDQM.cc:197

◆ bookHistograms()

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

Implements DQMEDAnalyzer.

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

257  {
258  booker.setCurrentFolder("Physics/NanoAODDQM");
259 
260  for (auto &pair : groups_) {
261  booker.setCurrentFolder("Physics/NanoAODDQM/" + pair.first);
262  for (auto &sels : pair.second.selGroups) {
263  std::string dir("Physics/NanoAODDQM/" + pair.first);
264  if (!sels.nullCut())
265  dir += "/" + sels.name;
266  booker.setCurrentFolder(dir);
267  auto &plots = sels.plots;
268  plots.clear();
269  plots.reserve(pair.second.plotPSets.size());
270  for (const auto &cfg : pair.second.plotPSets) {
271  auto plot = makePlot(booker, cfg);
272  if (plot)
273  plots.push_back(std::move(plot));
274  }
275  }
276  }
277 }
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:157
std::map< std::string, GroupConfig > groups_
Definition: NanoAODDQM.cc:197
def move(src, dest)
Definition: eostools.py:511

◆ fillDescriptions()

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

Definition at line 215 of file NanoAODDQM.cc.

References edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addVPSet(), edm::ConfigurationDescriptions::addWithDefaultLabel(), 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.

215  {
217 
219  sels.setComment("a paramerter set to define the selections to be made from the table row");
221 
223  edm::ParameterDescription<std::string> title("title", true, edm::Comment("title of the plot"));
224  edm::ParameterDescription<uint32_t> nbins("nbins", true, edm::Comment("number of bins of the plot"));
225  edm::ParameterDescription<double> min("min", true, edm::Comment("starting value of the x axis"));
226  edm::ParameterDescription<double> max("max", true, edm::Comment("ending value of the x axis"));
228  "column", true, edm::Comment("name of the raw to fill the content of the plot"));
230  "xcolumn", true, edm::Comment("name of the raw to fill the x content of the plot"));
232  "ycolumn", true, edm::Comment("name of the raw to fill the y content of the plot"));
233 
235  plot.setComment("a parameter set that defines a DQM histogram");
236  plot.ifValue(
237  edm::ParameterDescription<std::string>("kind", "none", true, edm::Comment("the type of histogram")),
238  "none" >> (name) or //it should really be edm::EmptyGroupDescription(), but name is used in python by modifiers
239  "count1d" >> (name and title and nbins and min and max) or
240  "hist1d" >> (name and title and nbins and min and max and column) or
241  "prof1d" >> (name and title and nbins and min and max and xcolumn and ycolumn));
242 
244  vplot.setComment(
245  "a parameter set to define all the plots to be made from a table row selected from the name of the PSet");
246  vplot.add<edm::ParameterSetDescription>("sels", sels);
247  vplot.addVPSet("plots", plot);
248 
250  vplots.setComment("a parameter set to define all the set of plots to be made from the tables");
252  desc.add<edm::ParameterSetDescription>("vplots", vplots);
253 
254  descriptions.addWithDefaultLabel(desc);
255 }
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 157 of file NanoAODDQM.cc.

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

Referenced by bookHistograms().

157  {
158  const std::string &kind = cfg.getParameter<std::string>("kind");
159  if (kind == "none")
160  return nullptr;
161  if (kind == "count1d")
162  return std::make_unique<Count1D>(booker, cfg);
163  if (kind == "hist1d")
164  return std::make_unique<Plot1D>(booker, cfg);
165  if (kind == "prof1d")
166  return std::make_unique<Profile1D>(booker, cfg);
167  throw cms::Exception("Configuration", "Unsupported plot kind '" + kind + "'");
168  }

Member Data Documentation

◆ groups_

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

Definition at line 197 of file NanoAODDQM.cc.

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