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::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns > 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 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 &ev, edm::EventSetup const &es) final
 
virtual void analyze (edm::Event const &, edm::EventSetup const &)
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) override
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
 DQMEDAnalyzer (DQMEDAnalyzer const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer &&)=delete
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) override
 
 ~DQMEDAnalyzer () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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
 
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)
 
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
 
void endRun (const edm::Run &, const edm::EventSetup &) override
 
- 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 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 163 of file NanoAODDQM.cc.

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

164 {
165  const edm::ParameterSet & vplots = iConfig.getParameter<edm::ParameterSet>("vplots");
166  for (const std::string & name : vplots.getParameterNamesForType<edm::ParameterSet>()) {
167  auto & group = groups_[name];
168  const auto & pset = vplots.getParameter<edm::ParameterSet>(name);
169  group.plotPSets = pset.getParameter<std::vector<edm::ParameterSet>>("plots");
170  group.selGroups.emplace_back(); // no selection (all entries)
171  const auto & cuts = pset.getParameter<edm::ParameterSet>("sels");
172  for (const std::string & cname : cuts.getParameterNamesForType<std::string>()) {
173  group.selGroups.emplace_back(cname, cuts.getParameter<std::string>(cname));
174  }
175  }
176  consumesMany<FlatTable>();
177 }
T getParameter(std::string const &) const
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:194
std::map< std::string, GroupConfig > groups_
Definition: NanoAODDQM.cc:160

Member Function Documentation

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

Definition at line 199 of file NanoAODDQM.cc.

References nanoaod::FlatTable::addExtension(), DEFINE_FWK_MODULE, edm::Event::getManyByType(), groups_, NanoAODDQM::Plot::name(), trackingPlots::other, plotFactory::plot, triggerObjects_cff::sel, AlCaHLTBitMon_QueryRunRegistry::string, and dataDML::tables.

199  {
200  std::vector<edm::Handle<FlatTable>> alltables;
201  iEvent.getManyByType(alltables);
202  std::map<std::string, std::pair<const FlatTable *, std::vector<const FlatTable *>>> maintables;
203 
204  for (const auto & htab : alltables) {
205  if (htab->extension()) continue;
206  maintables[htab->name()] = std::make_pair(htab.product(), std::vector<const FlatTable *>());
207  }
208  for (const auto & htab : alltables) {
209  if (htab->extension()) {
210  if (maintables.find(htab->name()) == maintables.end()) throw cms::Exception("LogicError","Missing main table for "+htab->name());
211  maintables[htab->name()].second.push_back(htab.product());
212  }
213  }
214 
215  FlatTable merged;
216  for (auto & pair : groups_) {
217  const std::string & name = pair.first;
218  if (maintables.find(name) == maintables.end()) continue; // may happen for missing collections
219  auto & tables = maintables[name];
220  const FlatTable * table = tables.first;
221  if (!tables.second.empty()) {
222  merged = *tables.first;
223  for (auto * other : tables.second) {
224  merged.addExtension(*other);
225  }
226  table = & merged;
227  }
228  std::vector<bool> selbits;
229  for (auto & sel : pair.second.selGroups) {
230  sel.fillSel(*table, selbits);
231 
232  for (auto & plot : sel.plots) {
233  plot->fill(*table, selbits);
234  }
235  }
236  }
237 }
void getManyByType(std::vector< Handle< PROD > > &results) const
Definition: Event.h:569
nanoaod::FlatTable FlatTable
Definition: NanoAODDQM.cc:38
std::map< std::string, GroupConfig > groups_
Definition: NanoAODDQM.cc:160
void NanoAODDQM::bookHistograms ( DQMStore::IBooker booker,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotectedvirtual

Implements DQMEDAnalyzer.

Definition at line 179 of file NanoAODDQM.cc.

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

179  {
180  booker.setCurrentFolder("Physics/NanoAODDQM");
181 
182  for (auto & pair : groups_) {
183  booker.setCurrentFolder("Physics/NanoAODDQM/"+pair.first);
184  for (auto & sels : pair.second.selGroups) {
185  std::string dir("Physics/NanoAODDQM/"+pair.first);
186  if (!sels.nullCut()) dir += "/" + sels.name;
187  booker.setCurrentFolder(dir);
188  auto & plots = sels.plots;
189  plots.clear();
190  plots.reserve(pair.second.plotPSets.size());
191  for (const auto & cfg : pair.second.plotPSets) {
192  auto plot = makePlot(booker, cfg);
193  if (plot) plots.push_back(std::move(plot));
194  }
195  }
196  }
197 }
static std::unique_ptr< Plot > makePlot(DQMStore::IBooker &booker, const edm::ParameterSet &cfg)
Definition: NanoAODDQM.cc:124
std::map< std::string, GroupConfig > groups_
Definition: NanoAODDQM.cc:160
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
dbl *** dir
Definition: mlp_gen.cc:35
def move(src, dest)
Definition: eostools.py:510
void NanoAODDQM::dqmBeginRun ( const edm::Run ,
const edm::EventSetup  
)
inlineoverrideprotected

Definition at line 46 of file NanoAODDQM.cc.

46 {}
void NanoAODDQM::endRun ( const edm::Run ,
const edm::EventSetup  
)
inlineoverrideprotected

Definition at line 47 of file NanoAODDQM.cc.

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

Definition at line 124 of file NanoAODDQM.cc.

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

Referenced by bookHistograms().

124  {
125  const std::string & kind = cfg.getParameter<std::string>("kind");
126  if (kind == "none") return nullptr;
127  if (kind == "count1d") return std::make_unique<Count1D>(booker,cfg);
128  if (kind == "hist1d") return std::make_unique<Plot1D>(booker,cfg);
129  if (kind == "prof1d") return std::make_unique<Profile1D>(booker,cfg);
130  throw cms::Exception("Configuration", "Unsupported plot kind '"+kind+"'");
131  }
T getParameter(std::string const &) const

Member Data Documentation

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

Definition at line 160 of file NanoAODDQM.cc.

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