CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
reco::tautools::CastedRefProducer< DerivedCollection, BaseType > Class Template Reference

#include <CastedRefProducer.h>

Inheritance diagram for reco::tautools::CastedRefProducer< DerivedCollection, BaseType >:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

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 Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 

Public Member Functions

 CastedRefProducer (const edm::ParameterSet &pset)
 constructor from parameter set More...
 
virtual void produce (edm::Event &evt, const edm::EventSetup &es)
 process an event More...
 
 ~CastedRefProducer ()
 destructor More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

edm::InputTag src_
 labels of the collection to be converted More...
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

template<typename DerivedCollection, typename BaseType>
class reco::tautools::CastedRefProducer< DerivedCollection, BaseType >

Definition at line 25 of file CastedRefProducer.h.

Member Typedef Documentation

template<typename DerivedCollection , typename BaseType >
typedef base_ref_vector::value_type reco::tautools::CastedRefProducer< DerivedCollection, BaseType >::base_ref

Definition at line 28 of file CastedRefProducer.h.

template<typename DerivedCollection , typename BaseType >
typedef edm::RefToBaseVector<BaseType> reco::tautools::CastedRefProducer< DerivedCollection, BaseType >::base_ref_vector

Definition at line 27 of file CastedRefProducer.h.

template<typename DerivedCollection , typename BaseType >
typedef edm::Ref<DerivedCollection> reco::tautools::CastedRefProducer< DerivedCollection, BaseType >::derived_ref

Definition at line 29 of file CastedRefProducer.h.

template<typename DerivedCollection , typename BaseType >
typedef edm::RefVector<DerivedCollection> reco::tautools::CastedRefProducer< DerivedCollection, BaseType >::OutputCollection

Definition at line 30 of file CastedRefProducer.h.

Constructor & Destructor Documentation

template<typename DerivedCollection , typename BaseType >
reco::tautools::CastedRefProducer< DerivedCollection, BaseType >::CastedRefProducer ( const edm::ParameterSet pset)
inlineexplicit

constructor from parameter set

Definition at line 32 of file CastedRefProducer.h.

33  :src_(pset.template getParameter<edm::InputTag>("src")) {
34  produces<OutputCollection>();
35  }
edm::InputTag src_
labels of the collection to be converted
template<typename DerivedCollection , typename BaseType >
reco::tautools::CastedRefProducer< DerivedCollection, BaseType >::~CastedRefProducer ( )
inline

destructor

Definition at line 37 of file CastedRefProducer.h.

37 {};

Member Function Documentation

template<typename DerivedCollection , typename BaseType >
virtual void reco::tautools::CastedRefProducer< DerivedCollection, BaseType >::produce ( edm::Event evt,
const edm::EventSetup es 
)
inlinevirtual

process an event

Implements edm::EDProducer.

Definition at line 39 of file CastedRefProducer.h.

References edm::RefToBaseVector< T >::at(), newFWLiteAna::base, coll, edm::Event::getByLabel(), i, LaserDQM_cfg::input, edm::Event::put(), edm::RefToBaseVector< T >::size(), and reco::tautools::CastedRefProducer< DerivedCollection, BaseType >::src_.

39  {
40  // Output collection
41  std::auto_ptr<OutputCollection> coll(new OutputCollection());
42  // Get input
44  evt.getByLabel(src_, input);
45  // Get references to the base
46  const base_ref_vector &baseRefs = input->refVector();
47  for(size_t i = 0; i < baseRefs.size(); ++i) {
48  // Cast the base class to the derived class
49  base_ref base = baseRefs.at(i);
50  derived_ref derived = base.template castTo<derived_ref>();
51  coll->push_back(derived);
52  }
53  evt.put( coll );
54  }
tuple base
Main Program
Definition: newFWLiteAna.py:92
edm::Ref< DerivedCollection > derived_ref
int i
Definition: DBlmapReader.cc:9
void push_back(key_type i, value_type const &j, label_type const &flav="")
edm::RefToBaseVector< BaseType > base_ref_vector
edm::RefVector< DerivedCollection > OutputCollection
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
base_ref_vector::value_type base_ref
JetCorrectorParametersCollection coll
Definition: classes.h:14
edm::InputTag src_
labels of the collection to be converted

Member Data Documentation

template<typename DerivedCollection , typename BaseType >
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().