1 #ifndef SimGeneral_PremixingModule_PreMixingDigiSimLinkWorker_h
2 #define SimGeneral_PremixingModule_PreMixingDigiSimLinkWorker_h
15 template <
typename DigiSimLinkCollection>
26 std::vector<PileupSummaryInfo>
const& ps,
34 std::unique_ptr<DigiSimLinkCollection>
merged_;
37 template <
typename DigiSimLinkCollection>
41 : signalToken_(iC.consumes<DigiSimLinkCollection>(ps.getParameter<
edm::
InputTag>(
"labelSig"))),
42 pileupTag_(ps.getParameter<
edm::
InputTag>(
"pileInputTag")),
43 collectionDM_(ps.getParameter<
std::
string>(
"collectionDM")) {
47 template <
typename DigiSimLinkCollection>
51 iEvent.getByToken(signalToken_, digis);
54 merged_ = std::make_unique<DigiSimLinkCollection>(*digis);
56 merged_ = std::make_unique<DigiSimLinkCollection>();
60 template <
typename DigiSimLinkCollection>
66 for (
const auto& detsetSource : *digis) {
67 auto& detsetTarget = merged_->find_or_insert(detsetSource.detId());
68 std::copy(detsetSource.begin(), detsetSource.end(), std::back_inserter(detsetTarget));
73 template <
typename DigiSimLinkCollection>
76 std::vector<PileupSummaryInfo>
const& ps,