CMS 3D CMS Logo

CollectionCombiner< Collection > Class Template Reference

Description: this templated EDProducer can merge (no duplicate removal) any number of collection of the same type. More...

#include <RecoMuon/TrackerSeedGenerator/plugins/CollectionCombiner.h>

Inheritance diagram for CollectionCombiner< Collection >:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 CollectionCombiner (const edm::ParameterSet &)
 ~CollectionCombiner ()

Private Member Functions

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

Private Attributes

std::vector< edm::InputTaglabels


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_ANOTHER_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  )  [inline, explicit]

Definition at line 44 of file CollectionCombiner.h.

References edm::ParameterSet::getParameter(), and CollectionCombiner< Collection >::labels.

00044                                                                                 {
00045   labels = iConfig.getParameter<std::vector<edm::InputTag> >("labels");
00046   produces<Collection>();
00047 }

template<typename Collection>
CollectionCombiner< Collection >::~CollectionCombiner (  )  [inline]

Definition at line 49 of file CollectionCombiner.h.

00049 {}


Member Function Documentation

template<typename Collection>
void CollectionCombiner< Collection >::beginJob ( const edm::EventSetup  )  [inline, private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 51 of file CollectionCombiner.h.

00051 {}

template<typename Collection>
void CollectionCombiner< Collection >::endJob ( void   )  [inline, private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 53 of file CollectionCombiner.h.

00053 {}

template<typename Collection>
void CollectionCombiner< Collection >::produce ( edm::Event iEvent,
const edm::EventSetup es 
) [inline, private, virtual]

Implements edm::EDProducer.

Definition at line 55 of file CollectionCombiner.h.

References edm::Event::getByLabel(), i, CollectionCombiner< Collection >::labels, and edm::Event::put().

00056 {
00057   uint i=0,i_max=labels.size();
00058   edm::Handle<Collection> handle;
00059   std::auto_ptr<Collection> merged(new Collection());
00060   for (;i!=i_max;++i){
00061     iEvent.getByLabel(labels[i], handle);
00062     merged->insert(merged->end(), handle->begin(), handle->end());
00063   }
00064   iEvent.put(merged);
00065 }


Member Data Documentation

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

Definition at line 40 of file CollectionCombiner.h.

Referenced by CollectionCombiner< Collection >::CollectionCombiner(), and CollectionCombiner< Collection >::produce().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:16:27 2009 for CMSSW by  doxygen 1.5.4