#include <CollectionCombiner.h>
Public Member Functions | |
CollectionCombiner (const edm::ParameterSet &) | |
~CollectionCombiner () | |
Private Member Functions | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
std::vector< edm::InputTag > | labels |
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.
Definition at line 29 of file CollectionCombiner.h.
CollectionCombiner< Collection >::CollectionCombiner | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 42 of file CollectionCombiner.h.
References edm::ParameterSet::getParameter(), and reco_calib_source_client_cfg::labels.
{ labels = iConfig.getParameter<std::vector<edm::InputTag> >("labels"); produces<Collection>(); }
CollectionCombiner< Collection >::~CollectionCombiner | ( | ) |
Definition at line 47 of file CollectionCombiner.h.
{}
void CollectionCombiner< Collection >::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | es | ||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 50 of file CollectionCombiner.h.
References edm::Event::getByLabel(), patZpeak::handle, i, reco_calib_source_client_cfg::labels, and edm::Event::put().
{ unsigned int i=0,i_max=labels.size(); edm::Handle<Collection> handle; std::auto_ptr<Collection> merged(new Collection()); for (;i!=i_max;++i){ iEvent.getByLabel(labels[i], handle); merged->insert(merged->end(), handle->begin(), handle->end()); } iEvent.put(merged); }
std::vector<edm::InputTag> CollectionCombiner< Collection >::labels [private] |
Definition at line 38 of file CollectionCombiner.h.