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:
one::DQMEDAnalyzer< T > one::dqmimplementation::DQMBaseClass< T... >

Classes

class  Count1D
 
struct  GroupConfig
 
class  Plot
 
class  Plot1D
 
class  Profile1D
 
struct  SelGroupConfig
 

Public Types

typedef nanoaod::FlatTable FlatTable
 

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
 NanoAODDQM (const edm::ParameterSet &)
 
- Public Member Functions inherited from one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

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
 

Static Private Member Functions

static std::unique_ptr< PlotmakePlot (DQMStore::IBooker &booker, const edm::ParameterSet &cfg)
 

Private Attributes

std::map< std::string, GroupConfiggroups_
 

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:193
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 &   
)
overrideprotected

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
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
std::map< std::string, GroupConfig > groups_
Definition: NanoAODDQM.cc:160
dbl *** dir
Definition: mlp_gen.cc:35
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 {}
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().