CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Attributes
EDMtoMEConverter Class Reference

#include <EDMtoMEConverter.h>

Inheritance diagram for EDMtoMEConverter:
edm::one::EDProducer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources, edm::EndLuminosityBlockProducer, edm::EndRunProducer > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

class  Tokens
 

Public Types

using TagList = std::vector< uint32_t >
 
- 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 beginJob () final
 
void beginLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &) final
 
void beginRun (const edm::Run &, const edm::EventSetup &) final
 
 EDMtoMEConverter (const edm::ParameterSet &)
 
void endJob () final
 
void endLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &, edm::EventSetup const &) override
 
void endRun (const edm::Run &, const edm::EventSetup &) final
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) override
 
template<class T >
void getData (DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, T &iGetFrom)
 
void produce (edm::Event &, edm::EventSetup const &) final
 
 ~EDMtoMEConverter () override
 
- Public Member Functions inherited from edm::one::EDProducer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources, edm::EndLuminosityBlockProducer, edm::EndRunProducer >
 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)
 

Private Attributes

bool convertOnEndLumi
 
bool convertOnEndRun
 
edm::EDPutTokenT< DQMTokendqmLumiToken_
 
edm::EDPutTokenT< DQMTokendqmRunToken_
 
int frequency
 
std::string name
 
std::tuple< Tokens< TH1F >, Tokens< TH1S >, Tokens< TH1D >, Tokens< TH2F >, Tokens< TH2S >, Tokens< TH2D >, Tokens< TH3F >, Tokens< TProfile >, Tokens< TProfile2D >, Tokens< double >, Tokens< int >, Tokens< long long >, Tokens< TString > > tokens_
 
int verbosity
 

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 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)
 

Detailed Description

Class to take dqm monitor elements and convert into a ROOT dataformat stored in Run tree of edm file

Author
M. Strang SUNY-Buffalo

Definition at line 52 of file EDMtoMEConverter.h.

Member Typedef Documentation

using EDMtoMEConverter::TagList = std::vector<uint32_t>

Definition at line 78 of file EDMtoMEConverter.h.

Constructor & Destructor Documentation

EDMtoMEConverter::EDMtoMEConverter ( const edm::ParameterSet iPSet)
explicit

Definition at line 221 of file EDMtoMEConverter.cc.

References constexpr, edm::EDConsumerBase::consumesCollector(), convertOnEndLumi, convertOnEndRun, dqmLumiToken_, dqmRunToken_, frequency, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), name, AlCaHLTBitMon_QueryRunRegistry::string, tokens_, verbosity, and ~EDMtoMEConverter().

221  :
222  verbosity(0), frequency(0)
223 {
224  const edm::InputTag& runInputTag = iPSet.getParameter<edm::InputTag>("runInputTag");
225  const edm::InputTag& lumiInputTag = iPSet.getParameter<edm::InputTag>("lumiInputTag");
227 
228  for_each(tokens_, [&](auto& tok) {
229  tok.set(runInputTag, lumiInputTag, iC);
230  });
231 
232  constexpr char MsgLoggerCat[] = "EDMtoMEConverter_EDMtoMEConverter";
233 
234  // get information from parameter set
235  name = iPSet.getUntrackedParameter<std::string>("Name");
236  verbosity = iPSet.getUntrackedParameter<int>("Verbosity");
237  frequency = iPSet.getUntrackedParameter<int>("Frequency");
238 
239  convertOnEndLumi = iPSet.getUntrackedParameter<bool>("convertOnEndLumi",true);
240  convertOnEndRun = iPSet.getUntrackedParameter<bool>("convertOnEndRun",true);
241 
242  // use value of first digit to determine default output level (inclusive)
243  // 0 is none, 1 is basic, 2 is fill output, 3 is gather output
244  verbosity %= 10;
245 
246  // print out Parameter Set information being used
247  if (verbosity >= 0) {
248  edm::LogInfo(MsgLoggerCat)
249  << "\n===============================\n"
250  << "Initialized as EDAnalyzer with parameter values:\n"
251  << " Name = " << name << "\n"
252  << " Verbosity = " << verbosity << "\n"
253  << " Frequency = " << frequency << "\n"
254  << "===============================\n";
255  }
256 
257  assert(sizeof(int64_t) == sizeof(long long));
258  usesResource("DQMStore");
259 
260  dqmLumiToken_ = produces<DQMToken,edm::Transition::EndLuminosityBlock>("endLumi");
261  dqmRunToken_ = produces<DQMToken,edm::Transition::EndRun>("endRun");
262 } // end constructor
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
#define constexpr
std::tuple< Tokens< TH1F >, Tokens< TH1S >, Tokens< TH1D >, Tokens< TH2F >, Tokens< TH2S >, Tokens< TH2D >, Tokens< TH3F >, Tokens< TProfile >, Tokens< TProfile2D >, Tokens< double >, Tokens< int >, Tokens< long long >, Tokens< TString > > tokens_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::EDPutTokenT< DQMToken > dqmRunToken_
edm::EDPutTokenT< DQMToken > dqmLumiToken_
EDMtoMEConverter::~EDMtoMEConverter ( )
overridedefault

Referenced by EDMtoMEConverter().

Member Function Documentation

void EDMtoMEConverter::beginJob ( void  )
inlinefinalvirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 64 of file EDMtoMEConverter.h.

64 {};
void EDMtoMEConverter::beginLuminosityBlock ( const edm::LuminosityBlock ,
const edm::EventSetup  
)
inlinefinal

Definition at line 68 of file EDMtoMEConverter.h.

68 {};
void EDMtoMEConverter::beginRun ( const edm::Run ,
const edm::EventSetup  
)
inlinefinal

Definition at line 66 of file EDMtoMEConverter.h.

66 {};
void EDMtoMEConverter::endJob ( void  )
inlinefinalvirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 65 of file EDMtoMEConverter.h.

65 {};
void EDMtoMEConverter::endLuminosityBlock ( const edm::LuminosityBlock ,
const edm::EventSetup  
)
inlinefinal

Definition at line 69 of file EDMtoMEConverter.h.

69 {};
void EDMtoMEConverter::endLuminosityBlockProduce ( edm::LuminosityBlock iLumi,
edm::EventSetup const &  iSetup 
)
override

Definition at line 279 of file EDMtoMEConverter.cc.

References b, convertOnEndLumi, dqmLumiToken_, fastjetJetProducer_validation_cfg::DQMStore, g, getData(), Utilities::operator, and edm::LuminosityBlock::put().

Referenced by produce().

280 {
281  if (convertOnEndLumi) {
282  DQMStore * store = edm::Service<DQMStore>().operator->();
283  store->meBookerGetter([&](DQMStore::IBooker &b, DQMStore::IGetter &g) {
284  getData(b, g, iLumi);
285  });
286  }
287 
288  iLumi.put(dqmLumiToken_, std::make_unique<DQMToken>());
289 }
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 g
Definition: Activities.doc:4
void put(std::unique_ptr< PROD > product)
Put a new product.
edm::EDPutTokenT< DQMToken > dqmLumiToken_
double b
Definition: hdecay.h:120
void getData(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, T &iGetFrom)
void EDMtoMEConverter::endRun ( const edm::Run ,
const edm::EventSetup  
)
inlinefinal

Definition at line 67 of file EDMtoMEConverter.h.

67 {};
void EDMtoMEConverter::endRunProduce ( edm::Run run,
edm::EventSetup const &  setup 
)
override

Definition at line 266 of file EDMtoMEConverter.cc.

References b, convertOnEndRun, dqmRunToken_, fastjetJetProducer_validation_cfg::DQMStore, g, getData(), Utilities::operator, and edm::Run::put().

Referenced by produce().

267 {
268  if (convertOnEndRun) {
269  DQMStore * store = edm::Service<DQMStore>().operator->();
270  store->meBookerGetter([&](DQMStore::IBooker &b, DQMStore::IGetter &g) {
271  getData(b, g, iRun);
272  });
273  }
274 
275 
276  iRun.put(dqmRunToken_, std::make_unique<DQMToken>());
277 }
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 g
Definition: Activities.doc:4
edm::EDPutTokenT< DQMToken > dqmRunToken_
double b
Definition: hdecay.h:120
void getData(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, T &iGetFrom)
template<class T >
void EDMtoMEConverter::getData ( DQMStore::IBooker iBooker,
DQMStore::IGetter iGetter,
T iGetFrom 
)

Definition at line 294 of file EDMtoMEConverter.cc.

References constexpr, gather_cfg::cout, dir, mps_fire::i, edm::HandleBase::isValid(), name, split, AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, DQMStore::IBooker::tag(), tokens_, and verbosity.

Referenced by endLuminosityBlockProduce(), endRunProduce(), and produce().

295 {
296  constexpr char MsgLoggerCat[] = "EDMtoMEConverter_getData";
297 
298  if (verbosity >= 0)
299  edm::LogInfo (MsgLoggerCat) << "\nRestoring MonitorElements.";
300 
301  for_each(tokens_, [&](const auto& tok) {
302  using Tokens_T = typename std::decay<decltype(tok)>::type;
303  using METype = typename Tokens_T::type;
304  using MEtoEDM_T = typename Tokens_T::Product;
305  edm::Handle<MEtoEDM_T> metoedm;
306  tok.getData(iGetFrom, metoedm);
307  if(!metoedm.isValid()) {
308  //edm::LogWarning(MsgLoggerCat)
309  // << "MEtoEDM<TH1F> doesn't exist in run";
310  return;
311  }
312 
313  std::vector<typename MEtoEDM_T::MEtoEDMObject> metoedmobject =
314  metoedm->getMEtoEdmObject();
315 
316  for (unsigned int i = 0; i < metoedmobject.size(); ++i) {
317  // get full path of monitor element
318  const std::string& pathname = metoedmobject[i].name;
319  if (verbosity > 0) std::cout << pathname << std::endl;
320 
322 
323  // deconstruct path from fullpath
324  StringList fulldir = StringOps::split(pathname,"/");
325  std::string name = *(fulldir.end() - 1);
326 
327  for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
328  dir += fulldir[j];
329  if (j != fulldir.size() - 2) dir += "/";
330  }
331 
332  // define new monitor element
333  MonitorElement *me = AddMonitorElement<METype>::call(iBooker, iGetter, &metoedmobject[i].object, dir, name, iGetFrom);
334  maybeSetLumiFlag(me, iGetFrom);
335 
336  // attach taglist
337  for(const auto& tag: metoedmobject[i].tags) {
338  iBooker.tag(me, tag);
339  }
340  } // end loop thorugh metoedmobject
341  });
342 }
type
Definition: HCALResponse.h:21
#define constexpr
std::tuple< Tokens< TH1F >, Tokens< TH1S >, Tokens< TH1D >, Tokens< TH2F >, Tokens< TH2S >, Tokens< TH2D >, Tokens< TH3F >, Tokens< TProfile >, Tokens< TProfile2D >, Tokens< double >, Tokens< int >, Tokens< long long >, Tokens< TString > > tokens_
void tag(MonitorElement *, unsigned int)
Definition: DQMStore.cc:286
bool isValid() const
Definition: HandleBase.h:74
dbl *** dir
Definition: mlp_gen.cc:35
double split
Definition: MVATrainer.cc:139
void EDMtoMEConverter::produce ( edm::Event ,
edm::EventSetup const &   
)
inlinefinalvirtual

Member Data Documentation

bool EDMtoMEConverter::convertOnEndLumi
private

Definition at line 86 of file EDMtoMEConverter.h.

Referenced by EDMtoMEConverter(), and endLuminosityBlockProduce().

bool EDMtoMEConverter::convertOnEndRun
private

Definition at line 87 of file EDMtoMEConverter.h.

Referenced by EDMtoMEConverter(), and endRunProduce().

edm::EDPutTokenT<DQMToken> EDMtoMEConverter::dqmLumiToken_
private

Definition at line 123 of file EDMtoMEConverter.h.

Referenced by EDMtoMEConverter(), and endLuminosityBlockProduce().

edm::EDPutTokenT<DQMToken> EDMtoMEConverter::dqmRunToken_
private

Definition at line 124 of file EDMtoMEConverter.h.

Referenced by EDMtoMEConverter(), and endRunProduce().

int EDMtoMEConverter::frequency
private

Definition at line 84 of file EDMtoMEConverter.h.

Referenced by EDMtoMEConverter().

std::string EDMtoMEConverter::name
private

Definition at line 82 of file EDMtoMEConverter.h.

Referenced by ElectronMVAID.ElectronMVAID::__call__(), dirstructure.Directory::__create_pie_image(), DisplayManager.DisplayManager::__del__(), dqm_interfaces.DirID::__eq__(), dirstructure.Directory::__get_full_path(), dirstructure.Comparison::__get_img_name(), dataset.Dataset::__getDataType(), dataset.Dataset::__getFileInfoList(), dirstructure.Comparison::__make_image(), core.autovars.NTupleVariable::__repr__(), core.autovars.NTupleObjectType::__repr__(), core.autovars.NTupleObject::__repr__(), core.autovars.NTupleCollection::__repr__(), dirstructure.Directory::__repr__(), dqm_interfaces.DirID::__repr__(), dirstructure.Comparison::__repr__(), config.Service::__setattr__(), config.CFG::__str__(), counter.Counter::__str__(), average.Average::__str__(), core.autovars.NTupleObjectType::addSubObjects(), core.autovars.NTupleObjectType::addVariables(), core.autovars.NTupleObjectType::allVars(), dirstructure.Directory::calcStats(), validation.Sample::digest(), python.rootplot.utilities.Hist::divide(), python.rootplot.utilities.Hist::divide_wilson(), DisplayManager.DisplayManager::Draw(), TreeCrawler.Package::dump(), EDMtoMEConverter(), core.autovars.NTupleVariable::fillBranch(), core.autovars.NTupleObject::fillBranches(), core.autovars.NTupleCollection::fillBranchesScalar(), core.autovars.NTupleCollection::fillBranchesVector(), core.autovars.NTupleCollection::get_cpp_declaration(), core.autovars.NTupleCollection::get_cpp_wrapper_class(), core.autovars.NTupleCollection::get_py_wrapper_class(), utils.StatisticalTest::get_status(), getData(), production_tasks.Task::getname(), dataset.CMSDataset::getPrimaryDatasetEntries(), dataset.PrivateDataset::getPrimaryDatasetEntries(), VIDSelectorBase.VIDSelectorBase::initialize(), personalPlayback.Applet::log(), core.autovars.NTupleVariable::makeBranch(), core.autovars.NTupleObject::makeBranches(), core.autovars.NTupleCollection::makeBranchesScalar(), core.autovars.NTupleCollection::makeBranchesVector(), dirstructure.Directory::print_report(), dataset.BaseDataset::printInfo(), dataset.Dataset::printInfo(), production_tasks.MonitorJobs::run(), python.rootplot.utilities.Hist::TGraph(), python.rootplot.utilities.Hist::TH1F(), Vispa.Views.PropertyView.Property::valueChanged(), counter.Counter::write(), and average.Average::write().

std::tuple< Tokens<TH1F>, Tokens<TH1S>, Tokens<TH1D>, Tokens<TH2F>, Tokens<TH2S>, Tokens<TH2D>, Tokens<TH3F>, Tokens<TProfile>, Tokens<TProfile2D>, Tokens<double>, Tokens<int>, Tokens<long long>, Tokens<TString> > EDMtoMEConverter::tokens_
private

Definition at line 121 of file EDMtoMEConverter.h.

Referenced by EDMtoMEConverter(), and getData().

int EDMtoMEConverter::verbosity
private

Definition at line 83 of file EDMtoMEConverter.h.

Referenced by EDMtoMEConverter(), and getData().