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::EDConsumerBase 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
 
- 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 ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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)
 

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, 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
static std::string const input
Definition: EdmProvDump.cc:44
edm::RefVector< DerivedCollection > OutputCollection
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:402
base_ref_vector::value_type base_ref
JetCorrectorParametersCollection coll
Definition: classes.h:10
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().