CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Protected Member Functions | Static Private Member Functions | Private Attributes
NanoAODDQM Class Reference
Inheritance diagram for NanoAODDQM:
DQMEDAnalyzer edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

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::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

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
 
virtual void analyze (edm::Event const &, edm::EventSetup const &)
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual void dqmBeginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
virtual void dqmEndLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmEndRun (edm::Run const &, edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &, edm::EventSetup const &) final
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void dqmBeginRun (const edm::Run &, const edm::EventSetup &) override
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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

- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 36 of file NanoAODDQM.cc.

Member Typedef Documentation

Definition at line 38 of file NanoAODDQM.cc.

Constructor & Destructor Documentation

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

Definition at line 188 of file NanoAODDQM.cc.

References L1TMuonDQMOffline_cfi::cuts, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNamesForType(), watchdog::group, groups_, NanoAODDQM::Plot::name(), muonDTDigis_cfi::pset, AlCaHLTBitMon_QueryRunRegistry::string, and nanoDQM_cff::vplots.

188  {
189  const edm::ParameterSet &vplots = iConfig.getParameter<edm::ParameterSet>("vplots");
191  auto &group = groups_[name];
192  const auto &pset = vplots.getParameter<edm::ParameterSet>(name);
193  group.plotPSets = pset.getParameter<std::vector<edm::ParameterSet>>("plots");
194  group.selGroups.emplace_back(); // no selection (all entries)
195  const auto &cuts = pset.getParameter<edm::ParameterSet>("sels");
196  for (const std::string &cname : cuts.getParameterNamesForType<std::string>()) {
197  group.selGroups.emplace_back(cname, cuts.getParameter<std::string>(cname));
198  }
199  }
200  consumesMany<FlatTable>();
201 }
T getParameter(std::string const &) const
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:168
std::map< std::string, GroupConfig > groups_
Definition: NanoAODDQM.cc:185

Member Function Documentation

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

Definition at line 225 of file NanoAODDQM.cc.

References nanoaod::FlatTable::addExtension(), DEFINE_FWK_MODULE, edm::Event::getManyByType(), groups_, NanoAODDQM::Plot::name(), trackingPlots::other, plotFactory::plot, EgammaValidation_Wenu_cff::sel, AlCaHLTBitMon_QueryRunRegistry::string, and postprocess-scan-build::tables.

225  {
226  std::vector<edm::Handle<FlatTable>> alltables;
227  iEvent.getManyByType(alltables);
228  std::map<std::string, std::pair<const FlatTable *, std::vector<const FlatTable *>>> maintables;
229 
230  for (const auto &htab : alltables) {
231  if (htab->extension())
232  continue;
233  maintables[htab->name()] = std::make_pair(htab.product(), std::vector<const FlatTable *>());
234  }
235  for (const auto &htab : alltables) {
236  if (htab->extension()) {
237  if (maintables.find(htab->name()) == maintables.end())
238  throw cms::Exception("LogicError", "Missing main table for " + htab->name());
239  maintables[htab->name()].second.push_back(htab.product());
240  }
241  }
242 
243  FlatTable merged;
244  for (auto &pair : groups_) {
245  const std::string &name = pair.first;
246  if (maintables.find(name) == maintables.end())
247  continue; // may happen for missing collections
248  auto &tables = maintables[name];
249  const FlatTable *table = tables.first;
250  if (!tables.second.empty()) {
251  merged = *tables.first;
252  for (auto *other : tables.second) {
253  merged.addExtension(*other);
254  }
255  table = &merged;
256  }
257  std::vector<bool> selbits;
258  for (auto &sel : pair.second.selGroups) {
259  sel.fillSel(*table, selbits);
260 
261  for (auto &plot : sel.plots) {
262  plot->fill(*table, selbits);
263  }
264  }
265  }
266 }
nanoaod::FlatTable FlatTable
Definition: NanoAODDQM.cc:38
void getManyByType(std::vector< Handle< PROD >> &results) const
Definition: Event.h:516
std::map< std::string, GroupConfig > groups_
Definition: NanoAODDQM.cc:185
void NanoAODDQM::bookHistograms ( DQMStore::IBooker booker,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotectedvirtual

Implements DQMEDAnalyzer.

Definition at line 203 of file NanoAODDQM.cc.

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

203  {
204  booker.setCurrentFolder("Physics/NanoAODDQM");
205 
206  for (auto &pair : groups_) {
207  booker.setCurrentFolder("Physics/NanoAODDQM/" + pair.first);
208  for (auto &sels : pair.second.selGroups) {
209  std::string dir("Physics/NanoAODDQM/" + pair.first);
210  if (!sels.nullCut())
211  dir += "/" + sels.name;
212  booker.setCurrentFolder(dir);
213  auto &plots = sels.plots;
214  plots.clear();
215  plots.reserve(pair.second.plotPSets.size());
216  for (const auto &cfg : pair.second.plotPSets) {
217  auto plot = makePlot(booker, cfg);
218  if (plot)
219  plots.push_back(std::move(plot));
220  }
221  }
222  }
223 }
static std::unique_ptr< Plot > makePlot(DQMStore::IBooker &booker, const edm::ParameterSet &cfg)
Definition: NanoAODDQM.cc:145
std::map< std::string, GroupConfig > groups_
Definition: NanoAODDQM.cc:185
def move(src, dest)
Definition: eostools.py:511
void NanoAODDQM::dqmBeginRun ( const edm::Run ,
const edm::EventSetup  
)
inlineoverrideprotected

Definition at line 46 of file NanoAODDQM.cc.

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

Definition at line 145 of file NanoAODDQM.cc.

References looper::cfg, Exception, edm::ParameterSet::getParameter(), CalibrationSummaryClient_cfi::kind, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by bookHistograms().

145  {
146  const std::string &kind = cfg.getParameter<std::string>("kind");
147  if (kind == "none")
148  return nullptr;
149  if (kind == "count1d")
150  return std::make_unique<Count1D>(booker, cfg);
151  if (kind == "hist1d")
152  return std::make_unique<Plot1D>(booker, cfg);
153  if (kind == "prof1d")
154  return std::make_unique<Profile1D>(booker, cfg);
155  throw cms::Exception("Configuration", "Unsupported plot kind '" + kind + "'");
156  }
T getParameter(std::string const &) const

Member Data Documentation

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

Definition at line 185 of file NanoAODDQM.cc.

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