Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fillDescription to CommonTools/UtilAlgos/interface/Merger.h - 133X #43733

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions CommonTools/UtilAlgos/interface/Merger.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
*/
#include "FWCore/Framework/interface/global/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/transform.h"
#include "FWCore/Utilities/interface/InputTag.h"
Expand All @@ -34,19 +36,20 @@ class Merger : public edm::global::EDProducer<> {
explicit Merger(const edm::ParameterSet&);
/// destructor
~Merger() override;
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

private:
/// process an event
void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
/// vector of strings
typedef std::vector<edm::EDGetTokenT<InputCollection> > vtoken;
typedef std::vector<edm::EDGetTokenT<InputCollection>> vtoken;
/// labels of the collections to be merged
vtoken srcToken_;
};

template <typename InputCollection, typename OutputCollection, typename P>
Merger<InputCollection, OutputCollection, P>::Merger(const edm::ParameterSet& par)
: srcToken_(edm::vector_transform(par.template getParameter<std::vector<edm::InputTag> >("src"),
: srcToken_(edm::vector_transform(par.template getParameter<std::vector<edm::InputTag>>("src"),
[this](edm::InputTag const& tag) { return consumes<InputCollection>(tag); })) {
produces<OutputCollection>();
}
Expand All @@ -69,4 +72,15 @@ void Merger<InputCollection, OutputCollection, P>::produce(edm::StreamID,
evt.put(std::move(coll));
}

template <typename InputCollection, typename OutputCollection, typename P>
void Merger<InputCollection, OutputCollection, P>::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<std::vector<edm::InputTag>>("src",
{
edm::InputTag("collection1"),
edm::InputTag("collection2"),
});
descriptions.addWithDefaultLabel(desc);
}

#endif