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 ()
 destructor More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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 & itemsToGetFromEvent () 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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)
 process an event More...
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 process an event More...
 
- 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)
 

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

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

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

constructor from parameter set

Definition at line 43 of file NtpProducer.h.

References end, NtpProducer< C >::eventInfo_, NtpProducer< C >::lazyParser_, NtpProducer< C >::prefix_, lumiQueryAPI::q, tauVariables_cff::quantity, AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, NtpProducer< C >::tags_, and objects.autophobj::variables.

43  :
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 =
49  par.template getParameter<std::vector<edm::ParameterSet> >("variables");
50  std::vector<edm::ParameterSet>::const_iterator
51  q = variables.begin(), end = variables.end();
52  if(eventInfo_){
53  produces<edm::EventNumber_t>( prefix_+"EventNumber" ).setBranchAlias( prefix_ + "EventNumber" );
54  produces<unsigned int>( prefix_ + "RunNumber" ).setBranchAlias( prefix_ + "RunNumber" );
55  produces<unsigned int>( prefix_ + "LumiBlock" ).setBranchAlias( prefix_ + "Lumiblock" );
56  }
57  for (; q!=end; ++q) {
58  std::string tag = prefix_ + q->getUntrackedParameter<std::string>("tag");
59  StringObjectFunction<typename C::value_type> quantity(q->getUntrackedParameter<std::string>("quantity"), lazyParser_);
60  tags_.push_back(std::make_pair(tag, quantity));
61  produces<std::vector<float> >(tag).setBranchAlias(tag);
62 
63  }
64 }
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
#define end
Definition: vmac.h:37
std::vector< std::pair< std::string, StringObjectFunction< typename C::value_type > > > tags_
variable tags
Definition: NtpProducer.h:36
bool lazyParser_
Definition: NtpProducer.h:37
template<typename C >
NtpProducer< C >::~NtpProducer ( )

destructor

Definition at line 67 of file NtpProducer.h.

67  {
68 }
template<typename C >
NtpProducer< C >::NtpProducer ( const edm::ParameterSet )

constructor from parameter set

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

destructor

Member Function Documentation

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

process an event

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

process an event

Definition at line 71 of file NtpProducer.h.

References coll, HTMLExport::elem(), end, edm::EventID::event(), event(), NtpProducer< C >::eventInfo_, edm::Event::getByToken(), edm::EventBase::id(), csvLumiCalc::lumi, edm::EventBase::luminosityBlock(), eostools::move(), NtpProducer< C >::prefix_, edm::Event::put(), lumiQueryAPI::q, edm::EventID::run(), findQualityFiles::run, NtpProducer< C >::srcToken_, NtpProducer< C >::tags_, and x.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

71  {
73  iEvent.getByToken(srcToken_, coll);
74  if(eventInfo_){
75  std::unique_ptr<edm::EventNumber_t> event( new edm::EventNumber_t );
76  std::unique_ptr<unsigned int> run( new unsigned int );
77  std::unique_ptr<unsigned int> lumi( new unsigned int );
78  *event = iEvent.id().event();
79  *run = iEvent.id().run();
80  *lumi = iEvent.luminosityBlock();
81  iEvent.put(std::move(event), prefix_ + "EventNumber" );
82  iEvent.put(std::move(run), prefix_ + "RunNumber" );
83  iEvent.put(std::move(lumi), prefix_ + "LumiBlock" );
84  }
85  typename std::vector<std::pair<std::string, StringObjectFunction<typename C::value_type> > >::const_iterator
86  q = tags_.begin(), end = tags_.end();
87  for(;q!=end; ++q) {
88  std::unique_ptr<std::vector<float> > x(new std::vector<float>);
89  x->reserve(coll->size());
90  for (typename C::const_iterator elem=coll->begin(); elem!=coll->end(); ++elem ) {
91  x->push_back(q->second(*elem));
92  }
93  iEvent.put(std::move(x), q->first);
94  }
95 }
RunNumber_t run() const
Definition: EventID.h:39
EventNumber_t event() const
Definition: EventID.h:41
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool eventInfo_
Definition: NtpProducer.h:39
std::string prefix_
Definition: NtpProducer.h:38
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
edm::EDGetTokenT< C > srcToken_
label of the collection to be read in
Definition: NtpProducer.h:34
unsigned long long EventNumber_t
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:61
#define end
Definition: vmac.h:37
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
def elem(elemtype, innerHTML='', html_class='', kwargs)
Definition: HTMLExport.py:18
JetCorrectorParametersCollection coll
Definition: classes.h:10
std::vector< std::pair< std::string, StringObjectFunction< typename C::value_type > > > tags_
variable tags
Definition: NtpProducer.h:36
edm::EventID id() const
Definition: EventBase.h:58
def move(src, dest)
Definition: eostools.py:510
Definition: event.py:1

Member Data Documentation

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

Definition at line 39 of file NtpProducer.h.

Referenced by NtpProducer< C >::NtpProducer(), and NtpProducer< C >::produce().

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

Definition at line 37 of file NtpProducer.h.

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

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

Definition at line 38 of file NtpProducer.h.

Referenced by NtpProducer< C >::NtpProducer(), and NtpProducer< C >::produce().

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.

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

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(), and NtpProducer< C >::produce().