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::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 >
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache 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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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

- 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 Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Definition at line 36 of file NanoAODDQM.cc.

Member Typedef Documentation

◆ FlatTable

Definition at line 38 of file NanoAODDQM.cc.

Constructor & Destructor Documentation

◆ NanoAODDQM()

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

Definition at line 189 of file NanoAODDQM.cc.

189  {
190  const edm::ParameterSet &vplots = iConfig.getParameter<edm::ParameterSet>("vplots");
191  for (const std::string &name : vplots.getParameterNamesForType<edm::ParameterSet>()) {
192  auto &group = groups_[name];
193  const auto &pset = vplots.getParameter<edm::ParameterSet>(name);
194  group.plotPSets = pset.getParameter<std::vector<edm::ParameterSet>>("plots");
195  group.selGroups.emplace_back(); // no selection (all entries)
196  const auto &cuts = pset.getParameter<edm::ParameterSet>("sels");
197  for (const std::string &cname : cuts.getParameterNamesForType<std::string>()) {
198  group.selGroups.emplace_back(cname, cuts.getParameter<std::string>(cname));
199  }
200  }
201  consumesMany<FlatTable>();
202 }

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

Member Function Documentation

◆ analyze()

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

Reimplemented from DQMEDAnalyzer.

Definition at line 226 of file NanoAODDQM.cc.

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

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.

◆ bookHistograms()

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

Implements DQMEDAnalyzer.

Definition at line 204 of file NanoAODDQM.cc.

204  {
205  booker.setCurrentFolder("Physics/NanoAODDQM");
206 
207  for (auto &pair : groups_) {
208  booker.setCurrentFolder("Physics/NanoAODDQM/" + pair.first);
209  for (auto &sels : pair.second.selGroups) {
210  std::string dir("Physics/NanoAODDQM/" + pair.first);
211  if (!sels.nullCut())
212  dir += "/" + sels.name;
213  booker.setCurrentFolder(dir);
214  auto &plots = sels.plots;
215  plots.clear();
216  plots.reserve(pair.second.plotPSets.size());
217  for (const auto &cfg : pair.second.plotPSets) {
218  auto plot = makePlot(booker, cfg);
219  if (plot)
220  plots.push_back(std::move(plot));
221  }
222  }
223  }
224 }

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.

◆ makePlot()

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

Definition at line 146 of file NanoAODDQM.cc.

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

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

Referenced by bookHistograms().

Member Data Documentation

◆ groups_

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

Definition at line 186 of file NanoAODDQM.cc.

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

nanoDQM_cff.vplots
vplots
Definition: nanoDQM_cff.py:22
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
postprocess-scan-build.tables
tables
Definition: postprocess-scan-build.py:10
plotFactory.plot
plot
Definition: plotFactory.py:109
trackingPlots.other
other
Definition: trackingPlots.py:1467
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
HLTObjectsMonitor_cfi.plots
plots
Definition: HLTObjectsMonitor_cfi.py:17
iEvent
int iEvent
Definition: GenABIO.cc:224
CalibrationSummaryClient_cfi.kind
kind
Definition: CalibrationSummaryClient_cfi.py:37
NanoAODDQM::FlatTable
nanoaod::FlatTable FlatTable
Definition: NanoAODDQM.cc:38
looper.cfg
cfg
Definition: looper.py:297
eostools.move
def move(src, dest)
Definition: eostools.py:511
Exception
Definition: hltDiff.cc:246
NanoAODDQM::makePlot
static std::unique_ptr< Plot > makePlot(DQMStore::IBooker &booker, const edm::ParameterSet &cfg)
Definition: NanoAODDQM.cc:146
NanoAODDQM::groups_
std::map< std::string, GroupConfig > groups_
Definition: NanoAODDQM.cc:186
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
cms::Exception
Definition: Exception.h:70
L1TMuonDQMOffline_cfi.cuts
cuts
Definition: L1TMuonDQMOffline_cfi.py:41
EgammaValidation_Wenu_cff.sel
sel
Definition: EgammaValidation_Wenu_cff.py:33
TableParser.table
table
Definition: TableParser.py:111
nanoDQM_cfi.sels
sels
Definition: nanoDQM_cfi.py:9
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23
watchdog.group
group
Definition: watchdog.py:82