#include <CastedRefProducer.h>
Public Types | |
typedef base_ref_vector::value_type | base_ref |
typedef edm::RefToBaseVector < BaseType > | base_ref_vector |
typedef edm::Ref < DerivedCollection > | derived_ref |
typedef edm::RefVector < DerivedCollection > | OutputCollection |
Public Member Functions | |
CastedRefProducer (const edm::ParameterSet &pset) | |
constructor from parameter set | |
virtual void | produce (edm::Event &evt, const edm::EventSetup &es) |
process an event | |
~CastedRefProducer () | |
destructor | |
Private Attributes | |
edm::InputTag | src_ |
labels of the collection to be converted |
Definition at line 25 of file CastedRefProducer.h.
typedef base_ref_vector::value_type reco::tautools::CastedRefProducer< DerivedCollection, BaseType >::base_ref |
Definition at line 28 of file CastedRefProducer.h.
typedef edm::RefToBaseVector<BaseType> reco::tautools::CastedRefProducer< DerivedCollection, BaseType >::base_ref_vector |
Definition at line 27 of file CastedRefProducer.h.
typedef edm::Ref<DerivedCollection> reco::tautools::CastedRefProducer< DerivedCollection, BaseType >::derived_ref |
Definition at line 29 of file CastedRefProducer.h.
typedef edm::RefVector<DerivedCollection> reco::tautools::CastedRefProducer< DerivedCollection, BaseType >::OutputCollection |
Definition at line 30 of file CastedRefProducer.h.
reco::tautools::CastedRefProducer< DerivedCollection, BaseType >::CastedRefProducer | ( | const edm::ParameterSet & | pset | ) | [inline, explicit] |
constructor from parameter set
Definition at line 32 of file CastedRefProducer.h.
:src_(pset.template getParameter<edm::InputTag>("src")) { produces<OutputCollection>(); }
reco::tautools::CastedRefProducer< DerivedCollection, BaseType >::~CastedRefProducer | ( | ) | [inline] |
virtual void reco::tautools::CastedRefProducer< DerivedCollection, BaseType >::produce | ( | edm::Event & | evt, |
const edm::EventSetup & | es | ||
) | [inline, virtual] |
process an event
Implements edm::EDProducer.
Definition at line 39 of file CastedRefProducer.h.
References edm::RefToBaseVector< T >::at(), coll, edm::Event::getByLabel(), i, LaserDQM_cfg::input, edm::Event::put(), edm::RefToBaseVector< T >::size(), and reco::tautools::CastedRefProducer< DerivedCollection, BaseType >::src_.
{ // Output collection std::auto_ptr<OutputCollection> coll(new OutputCollection()); // Get input edm::Handle<edm::View<BaseType> > input; evt.getByLabel(src_, input); // Get references to the base const base_ref_vector &baseRefs = input->refVector(); for(size_t i = 0; i < baseRefs.size(); ++i) { // Cast the base class to the derived class base_ref base = baseRefs.at(i); derived_ref derived = base.template castTo<derived_ref>(); coll->push_back(derived); } evt.put( coll ); }
edm::InputTag reco::tautools::CastedRefProducer< DerivedCollection, BaseType >::src_ [private] |
labels of the collection to be converted
Definition at line 57 of file CastedRefProducer.h.
Referenced by reco::tautools::CastedRefProducer< DerivedCollection, BaseType >::produce().