CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
CollectionCombiner< Collection > Class Template Reference

#include <CollectionCombiner.h>

Inheritance diagram for CollectionCombiner< Collection >:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 CollectionCombiner (const edm::ParameterSet &)
 
 ~CollectionCombiner ()
 
- 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 Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)
 

Private Attributes

std::vector< edm::InputTaglabels
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (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 Collection>
class CollectionCombiner< Collection >

Description: this templated EDProducer can merge (no duplicate removal) any number of collection of the same type. the usage is to declare a concrete combiner in SealModule: typedef CollectionCombiner<std::vector< Trajectory> > TrajectoryCombiner; DEFINE_FWK_MODULE(TrajectoryCombiner); edm::View cannot be used, because the template argument is used for the input and the output type.

Author
Jean-Roch Vlimant

Definition at line 29 of file CollectionCombiner.h.

Constructor & Destructor Documentation

template<typename Collection >
CollectionCombiner< Collection >::CollectionCombiner ( const edm::ParameterSet iConfig)
explicit

Definition at line 42 of file CollectionCombiner.h.

References edm::ParameterSet::getParameter(), and L1TDQM_cfg::labels.

42  {
43  labels = iConfig.getParameter<std::vector<edm::InputTag> >("labels");
44  produces<Collection>();
45 }
T getParameter(std::string const &) const
std::vector< edm::InputTag > labels
template<typename Collection >
CollectionCombiner< Collection >::~CollectionCombiner ( )

Definition at line 47 of file CollectionCombiner.h.

47 {}

Member Function Documentation

template<typename Collection >
void CollectionCombiner< Collection >::produce ( edm::Event iEvent,
const edm::EventSetup es 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 50 of file CollectionCombiner.h.

References edm::Event::getByLabel(), patZpeak::handle, i, L1TDQM_cfg::labels, and edm::Event::put().

51 {
52  unsigned int i=0,i_max=labels.size();
54  std::auto_ptr<Collection> merged(new Collection());
55  for (;i!=i_max;++i){
56  iEvent.getByLabel(labels[i], handle);
57  merged->insert(merged->end(), handle->begin(), handle->end());
58  }
59  iEvent.put(merged);
60 }
int i
Definition: DBlmapReader.cc:9
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
tuple handle
Definition: patZpeak.py:22
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
std::vector< edm::InputTag > labels

Member Data Documentation

template<typename Collection >
std::vector<edm::InputTag> CollectionCombiner< Collection >::labels
private

Definition at line 38 of file CollectionCombiner.h.