CMS 3D CMS Logo

Merger.h
Go to the documentation of this file.
1 #ifndef UtilAlgos_Merger_h
2 #define UtilAlgos_Merger_h
3 
26 #include <vector>
27 
28 template <typename InputCollection,
31 class Merger : public edm::global::EDProducer<> {
32 public:
34  explicit Merger(const edm::ParameterSet&);
36  ~Merger() override;
37 
38 private:
40  void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
42  typedef std::vector<edm::EDGetTokenT<InputCollection> > vtoken;
45 };
46 
47 template <typename InputCollection, typename OutputCollection, typename P>
49  : srcToken_(edm::vector_transform(par.template getParameter<std::vector<edm::InputTag> >("src"),
50  [this](edm::InputTag const& tag) { return consumes<InputCollection>(tag); })) {
51  produces<OutputCollection>();
52 }
53 
54 template <typename InputCollection, typename OutputCollection, typename P>
56 
57 template <typename InputCollection, typename OutputCollection, typename P>
59  edm::Event& evt,
60  const edm::EventSetup&) const {
61  std::unique_ptr<OutputCollection> coll(new OutputCollection);
62  for (typename vtoken::const_iterator s = srcToken_.begin(); s != srcToken_.end(); ++s) {
64  evt.getByToken(*s, h);
65  for (typename InputCollection::const_iterator c = h->begin(); c != h->end(); ++c) {
66  coll->push_back(P::clone(*c));
67  }
68  }
69  evt.put(std::move(coll));
70 }
71 
72 #endif
edm::StreamID
Definition: StreamID.h:30
Merger::Merger
Merger(const edm::ParameterSet &)
constructor from parameter set
Definition: Merger.h:48
Merger::vtoken
std::vector< edm::EDGetTokenT< InputCollection > > vtoken
vector of strings
Definition: Merger.h:42
edm
HLT enums.
Definition: AlignableModifier.h:19
h
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
Definition: L1TUtmAlgorithmRcd.h:4
Merger
Definition: Merger.h:31
watchdog.const
const
Definition: watchdog.py:83
edm::Handle
Definition: AssociativeIterator.h:50
alignCSCRings.s
s
Definition: alignCSCRings.py:92
CloneTrait.h
clone
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
edm::clonehelper::CloneTrait
Definition: CloneTrait.h:12
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
h
edm::global::EDProducer
Definition: EDProducer.h:32
edm::vector_transform
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:132
edm::EventSetup
Definition: EventSetup.h:57
svgfig.template
def template(fileName, svg, replaceme="REPLACEME")
Definition: svgfig.py:521
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
InputTag.h
Merger::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
process an event
Definition: Merger.h:58
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
transform.h
Merger::srcToken_
vtoken srcToken_
labels of the collections to be merged
Definition: Merger.h:44
SimL1EmulatorRepack_GT2_cff.InputCollection
InputCollection
Definition: SimL1EmulatorRepack_GT2_cff.py:16
ParameterSet.h
EDProducer.h
P
std::pair< OmniClusterRef, TrackingParticleRef > P
Definition: BDHadronTrackMonitoringAnalyzer.cc:202
Merger::~Merger
~Merger() override
destructor
Definition: Merger.h:55
edm::Event
Definition: Event.h:73
HLTTauReferences_cfi.OutputCollection
OutputCollection
Definition: HLTTauReferences_cfi.py:92