#include <PhysicsTools/UtilAlgos/interface/NtpProducer.h>
Public Member Functions | |
NtpProducer (const edm::ParameterSet &) | |
constructor from parameter set | |
~NtpProducer () | |
destructor | |
Protected Member Functions | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
process an event | |
Private Attributes | |
edm::InputTag | src_ |
label of the collection to be read in | |
std::vector< std::pair < std::string, StringObjectFunction < typename C::value_type > > > | tags_ |
variable tags |
Template parameters:
Definition at line 20 of file NtpProducer.h.
NtpProducer< C >::NtpProducer | ( | const edm::ParameterSet & | par | ) | [inline] |
constructor from parameter set
Definition at line 39 of file NtpProducer.h.
References end, ecalRecalibSequence_cff::tag, and NtpProducer< C >::tags_.
00039 : 00040 src_( par.template getParameter<edm::InputTag>( "src" ) ) { 00041 std::vector<edm::ParameterSet> variables = 00042 par.template getParameter<std::vector<edm::ParameterSet> >("variables"); 00043 std::vector<edm::ParameterSet>::const_iterator 00044 q = variables.begin(), end = variables.end(); 00045 for (; q!=end; ++q) { 00046 std::string tag = q->getUntrackedParameter<std::string>("tag"); 00047 StringObjectFunction<typename C::value_type> quantity(q->getUntrackedParameter<std::string>("quantity")); 00048 tags_.push_back(std::make_pair(tag, quantity)); 00049 produces<std::vector<float> >(tag).setBranchAlias(tag); 00050 } 00051 }
NtpProducer< C >::~NtpProducer | ( | ) | [inline] |
void NtpProducer< C >::produce | ( | edm::Event & | iEvent, | |
const edm::EventSetup & | ||||
) | [inline, protected, virtual] |
process an event
Implements edm::EDProducer.
Definition at line 58 of file NtpProducer.h.
References coll, end, edm::Event::getByLabel(), edm::Event::put(), NtpProducer< C >::src_, NtpProducer< C >::tags_, and x.
00058 { 00059 edm::Handle<C> coll; 00060 iEvent.getByLabel(src_, coll); 00061 00062 typename std::vector<std::pair<std::string, StringObjectFunction<typename C::value_type> > >::const_iterator 00063 q = tags_.begin(), end = tags_.end(); 00064 for(;q!=end; ++q) { 00065 std::auto_ptr<std::vector<float> > x(new std::vector<float>); 00066 x->reserve(coll->size()); 00067 for (typename C::const_iterator elem=coll->begin(); elem!=coll->end(); ++elem ) { 00068 x->push_back(q->second(*elem)); 00069 } 00070 iEvent.put(x, q->first); 00071 } 00072 }
edm::InputTag NtpProducer< C >::src_ [private] |
label of the collection to be read in
Definition at line 33 of file NtpProducer.h.
Referenced by NtpProducer< C >::produce().
std::vector<std::pair<std::string, StringObjectFunction<typename C::value_type> > > NtpProducer< C >::tags_ [private] |
variable tags
Definition at line 35 of file NtpProducer.h.
Referenced by NtpProducer< C >::NtpProducer(), and NtpProducer< C >::produce().