CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Attributes
NtpProducer< C > Class Template Reference

#include <NtpProducer.h>

Inheritance diagram for NtpProducer< C >:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 NtpProducer (const edm::ParameterSet &)
 constructor from parameter set More...
 
 ~NtpProducer () override
 destructor More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () 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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~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
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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 produce (edm::Event &, const edm::EventSetup &) override
 process an event More...
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Private Attributes

bool eventInfo_
 
bool lazyParser_
 
std::string prefix_
 
edm::EDGetTokenT< C > srcToken_
 label of the collection to be read in More...
 
std::vector< std::pair< std::string, StringObjectFunction< typename C::value_type > > > tags_
 variable tags More...
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer 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
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 

Detailed Description

template<typename C>
class NtpProducer< C >

Creates histograms defined in config file

Author
: Luca Lista, INFN

Template parameters:

Definition at line 21 of file NtpProducer.h.

Constructor & Destructor Documentation

◆ NtpProducer()

template<typename C >
NtpProducer< C >::NtpProducer ( const edm::ParameterSet par)

constructor from parameter set

Definition at line 43 of file NtpProducer.h.

References mps_fire::end, NtpProducer< C >::eventInfo_, NtpProducer< C >::lazyParser_, NtpProducer< C >::prefix_, submitPVResolutionJobs::q, MjjMonitor_cfi::quantity, AlCaHLTBitMon_QueryRunRegistry::string, makeGlobalPositionRcd_cfg::tag, NtpProducer< C >::tags_, and L1TEGammaDiff_cfi::variables.

44  : srcToken_(consumes<C>(par.template getParameter<edm::InputTag>("src"))),
45  lazyParser_(par.template getUntrackedParameter<bool>("lazyParser", false)),
46  prefix_(par.template getUntrackedParameter<std::string>("prefix", "")),
47  eventInfo_(par.template getUntrackedParameter<bool>("eventInfo", true)) {
48  std::vector<edm::ParameterSet> variables = par.template getParameter<std::vector<edm::ParameterSet> >("variables");
49  std::vector<edm::ParameterSet>::const_iterator q = variables.begin(), end = variables.end();
50  if (eventInfo_) {
51  produces<edm::EventNumber_t>(prefix_ + "EventNumber").setBranchAlias(prefix_ + "EventNumber");
52  produces<unsigned int>(prefix_ + "RunNumber").setBranchAlias(prefix_ + "RunNumber");
53  produces<unsigned int>(prefix_ + "LumiBlock").setBranchAlias(prefix_ + "Lumiblock");
54  }
55  for (; q != end; ++q) {
56  std::string tag = prefix_ + q->getUntrackedParameter<std::string>("tag");
57  StringObjectFunction<typename C::value_type> quantity(q->getUntrackedParameter<std::string>("quantity"),
58  lazyParser_);
59  tags_.push_back(std::make_pair(tag, quantity));
60  produces<std::vector<float> >(tag).setBranchAlias(tag);
61  }
62 }
bool eventInfo_
Definition: NtpProducer.h:39
std::string prefix_
Definition: NtpProducer.h:38
edm::EDGetTokenT< C > srcToken_
label of the collection to be read in
Definition: NtpProducer.h:34
std::vector< std::pair< std::string, StringObjectFunction< typename C::value_type > > > tags_
variable tags
Definition: NtpProducer.h:36
bool lazyParser_
Definition: NtpProducer.h:37

◆ ~NtpProducer()

template<typename C >
NtpProducer< C >::~NtpProducer ( )
override

destructor

Definition at line 65 of file NtpProducer.h.

65 {}

Member Function Documentation

◆ produce()

template<typename C >
void NtpProducer< C >::produce ( edm::Event iEvent,
const edm::EventSetup  
)
overrideprotectedvirtual

process an event

Implements edm::EDProducer.

Definition at line 68 of file NtpProducer.h.

References mps_fire::end, edmPickEvents::event, iEvent, BXlumiParameters_cfi::lumi, eostools::move(), submitPVResolutionJobs::q, writedatasetfile::run, and x.

68  {
69  edm::Handle<C> coll;
70  iEvent.getByToken(srcToken_, coll);
71  if (eventInfo_) {
72  std::unique_ptr<edm::EventNumber_t> event(new edm::EventNumber_t);
73  std::unique_ptr<unsigned int> run(new unsigned int);
74  std::unique_ptr<unsigned int> lumi(new unsigned int);
75  *event = iEvent.id().event();
76  *run = iEvent.id().run();
77  *lumi = iEvent.luminosityBlock();
78  iEvent.put(std::move(event), prefix_ + "EventNumber");
79  iEvent.put(std::move(run), prefix_ + "RunNumber");
80  iEvent.put(std::move(lumi), prefix_ + "LumiBlock");
81  }
82  typename std::vector<std::pair<std::string, StringObjectFunction<typename C::value_type> > >::const_iterator
83  q = tags_.begin(),
84  end = tags_.end();
85  for (; q != end; ++q) {
86  std::unique_ptr<std::vector<float> > x(new std::vector<float>);
87  x->reserve(coll->size());
88  for (typename C::const_iterator elem = coll->begin(); elem != coll->end(); ++elem) {
89  x->push_back(q->second(*elem));
90  }
91  iEvent.put(std::move(x), q->first);
92  }
93 }
bool eventInfo_
Definition: NtpProducer.h:39
std::string prefix_
Definition: NtpProducer.h:38
unsigned long long EventNumber_t
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< C > srcToken_
label of the collection to be read in
Definition: NtpProducer.h:34
std::vector< std::pair< std::string, StringObjectFunction< typename C::value_type > > > tags_
variable tags
Definition: NtpProducer.h:36
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1

Member Data Documentation

◆ eventInfo_

template<typename C >
bool NtpProducer< C >::eventInfo_
private

Definition at line 39 of file NtpProducer.h.

Referenced by NtpProducer< C >::NtpProducer().

◆ lazyParser_

template<typename C >
bool NtpProducer< C >::lazyParser_
private

Definition at line 37 of file NtpProducer.h.

Referenced by NtpProducer< C >::NtpProducer().

◆ prefix_

template<typename C >
std::string NtpProducer< C >::prefix_
private

Definition at line 38 of file NtpProducer.h.

Referenced by NtpProducer< C >::NtpProducer().

◆ srcToken_

template<typename C >
edm::EDGetTokenT<C> NtpProducer< C >::srcToken_
private

label of the collection to be read in

Definition at line 34 of file NtpProducer.h.

◆ tags_

template<typename C >
std::vector<std::pair<std::string, StringObjectFunction<typename C::value_type> > > NtpProducer< C >::tags_
private

variable tags

Definition at line 36 of file NtpProducer.h.

Referenced by NtpProducer< C >::NtpProducer().