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::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper edm::ProductRegistryHelper

Public Member Functions

 NtpProducer (const edm::ParameterSet &)
 constructor from parameter set More...
 
 NtpProducer (const edm::ParameterSet &)
 constructor from parameter set More...
 
 ~NtpProducer ()
 destructor 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)
 process an event More...
 
void produce (edm::Event &, const edm::EventSetup &) override
 process an event More...
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
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)
 
template<Transition B>
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 (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

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() [1/2]

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

constructor from parameter set

Definition at line 43 of file NtpProducer.h.

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 }

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

◆ ~NtpProducer() [1/2]

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

destructor

Definition at line 65 of file NtpProducer.h.

65 {}

◆ NtpProducer() [2/2]

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

constructor from parameter set

◆ ~NtpProducer() [2/2]

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

destructor

Member Function Documentation

◆ produce() [1/2]

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

process an event

Implements edm::EDProducer.

◆ produce() [2/2]

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.

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 }

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

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

StringObjectFunction
Definition: StringObjectFunction.h:16
L1TEGammaDiff_cfi.variables
variables
Definition: L1TEGammaDiff_cfi.py:5
DDAxes::x
edm::Handle
Definition: AssociativeIterator.h:50
NtpProducer::srcToken_
edm::EDGetTokenT< C > srcToken_
label of the collection to be read in
Definition: NtpProducer.h:34
BXlumiParameters_cfi.lumi
lumi
Definition: BXlumiParameters_cfi.py:6
NtpProducer::prefix_
std::string prefix_
Definition: NtpProducer.h:38
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
mps_fire.end
end
Definition: mps_fire.py:242
edm::EventNumber_t
unsigned long long EventNumber_t
Definition: RunLumiEventNumber.h:12
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MjjMonitor_cfi.quantity
quantity
Definition: MjjMonitor_cfi.py:10
edmPickEvents.event
event
Definition: edmPickEvents.py:273
iEvent
int iEvent
Definition: GenABIO.cc:224
submitPVResolutionJobs.q
q
Definition: submitPVResolutionJobs.py:84
eostools.move
def move(src, dest)
Definition: eostools.py:511
writedatasetfile.run
run
Definition: writedatasetfile.py:27
NtpProducer::lazyParser_
bool lazyParser_
Definition: NtpProducer.h:37
NtpProducer::eventInfo_
bool eventInfo_
Definition: NtpProducer.h:39
event
Definition: event.py:1
lumi
Definition: LumiSectionData.h:20
NtpProducer::tags_
std::vector< std::pair< std::string, StringObjectFunction< typename C::value_type > > > tags_
variable tags
Definition: NtpProducer.h:36