12 #ifndef TauAnalysis_MCEmbeddingTools_CollectionMerger_H
13 #define TauAnalysis_MCEmbeddingTools_CollectionMerger_H
38 template <
typename T1,
typename T2>
49 std::map<std::string, std::vector<edm::EDGetTokenT<MergeCollection> > >
inputs_;
55 bool print_pixel =
false);
62 template <
typename T1,
typename T2>
64 std::vector<edm::InputTag> inCollections = iConfig.
getParameter<std::vector<edm::InputTag> >(
"mergCollections");
65 for (
auto const &inCollection : inCollections) {
66 inputs_[inCollection.instance()].push_back(consumes<MergeCollection>(inCollection));
68 for (
const auto &toproduce : inputs_) {
70 produces<MergeCollection>(toproduce.first);
74 template <
typename T1,
typename T2>
79 template <
typename T1,
typename T2>
81 for (
auto input_ : inputs_) {
83 std::vector<edm::Handle<MergeCollection> > inputCollections;
84 inputCollections.resize(input_.second.size());
85 for (
unsigned id = 0;
id < input_.second.size();
id++) {
86 iEvent.
getByToken(input_.second[
id], inputCollections[
id]);
88 fill_output_obj(output, inputCollections);
std::map< std::string, std::vector< edm::EDGetTokenT< MergeCollection > > > inputs_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
~CollectionMerger() override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void produce(edm::Event &, const edm::EventSetup &) override
void fill_output_obj_muonchamber(std::unique_ptr< MergeCollection > &output, std::vector< edm::Handle< MergeCollection > > &inputCollections)
void fill_output_obj_calo(std::unique_ptr< MergeCollection > &output, std::vector< edm::Handle< MergeCollection > > &inputCollections)
T getParameter(std::string const &) const
void fill_output_obj(std::unique_ptr< MergeCollection > &output, std::vector< edm::Handle< MergeCollection > > &inputCollections)
CollectionMerger(const edm::ParameterSet &)
void fill_output_obj_tracker(std::unique_ptr< MergeCollection > &output, std::vector< edm::Handle< MergeCollection > > &inputCollections, bool print_pixel=false)