CMS 3D CMS Logo

Merger< InputCollection, OutputCollection, P > Class Template Reference

Merges an arbitrary number of collections into a single collection. More...

#include <PhysicsTools/UtilAlgos/interface/Merger.h>

Inheritance diagram for Merger< InputCollection, OutputCollection, P >:

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

List of all members.

Public Member Functions

 Merger (const edm::ParameterSet &)
 constructor from parameter set
 ~Merger ()
 destructor

Private Types

typedef std::vector
< edm::InputTag
vtag
 vector of strings

Private Member Functions

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

Private Attributes

vtag src_
 labels of the collections to be merged


Detailed Description

template<typename InputCollection, typename OutputCollection = InputCollection, typename P = typename edm::clonehelper::CloneTrait<InputCollection>::type>
class Merger< InputCollection, OutputCollection, P >

Merges an arbitrary number of collections into a single collection.

Template parameters:

Author:
Luca Lista, INFN
Version:
Revision
1.6

Id
Merger.h,v 1.6 2007/11/12 11:44:52 llista Exp

Definition at line 30 of file Merger.h.


Member Typedef Documentation

template<typename InputCollection, typename OutputCollection = InputCollection, typename P = typename edm::clonehelper::CloneTrait<InputCollection>::type>
typedef std::vector<edm::InputTag> Merger< InputCollection, OutputCollection, P >::vtag [private]

vector of strings

Definition at line 41 of file Merger.h.


Constructor & Destructor Documentation

template<typename InputCollection, typename OutputCollection, typename P>
Merger< InputCollection, OutputCollection, P >::Merger ( const edm::ParameterSet par  )  [inline, explicit]

constructor from parameter set

Definition at line 47 of file Merger.h.

00047                                                                                  : 
00048   src_( par.template getParameter<vtag>( "src" ) ) {
00049   produces<OutputCollection>();
00050 }

template<typename InputCollection, typename OutputCollection, typename P>
Merger< InputCollection, OutputCollection, P >::~Merger (  )  [inline]

destructor

Definition at line 53 of file Merger.h.

00053                                                       {
00054 }


Member Function Documentation

template<typename InputCollection, typename OutputCollection, typename P>
void Merger< InputCollection, OutputCollection, P >::produce ( edm::Event evt,
const edm::EventSetup  
) [inline, private, virtual]

process an event

Implements edm::EDProducer.

Definition at line 57 of file Merger.h.

References c, clone(), coll, edm::Event::getByLabel(), h, edm::Event::put(), s, and Merger< InputCollection, OutputCollection, P >::src_.

00057                                                                                                 {
00058   std::auto_ptr<OutputCollection> coll( new OutputCollection );
00059   for( vtag::const_iterator s = src_.begin(); s != src_.end(); ++ s ) {
00060     edm::Handle<InputCollection> h;
00061     evt.getByLabel( * s, h );
00062     for( typename InputCollection::const_iterator c = h->begin(); c != h->end(); ++c ) {
00063       coll->push_back( P::clone( * c ) );
00064     }
00065   }
00066   evt.put( coll );
00067 }


Member Data Documentation

template<typename InputCollection, typename OutputCollection = InputCollection, typename P = typename edm::clonehelper::CloneTrait<InputCollection>::type>
vtag Merger< InputCollection, OutputCollection, P >::src_ [private]

labels of the collections to be merged

Definition at line 43 of file Merger.h.

Referenced by Merger< InputCollection, OutputCollection, P >::produce().


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