38 #include <unordered_set>
43 std::vector<edm::DetSet<T>> pruneByTpAssoc(
45 const std::unordered_set<UniqueSimTrackId, UniqueSimTrackIdHash>& selectedIds) {
46 std::vector<edm::DetSet<T>> linkVector;
48 for (
auto&& detSet : simLinkColl) {
51 for (
auto&& simLink : detSet) {
53 if (selectedIds.count(trkid) > 0) {
58 linkVector.push_back(
std::move(newDetSet));
87 : trackingParticleToken_(
89 sipixelSimLinksToken_(
91 produces<edm::DetSetVector<PixelDigiSimLink>>(
"siPixel");
96 produces<edm::DetSetVector<StripDigiSimLink>>(
"siStrip");
102 produces<edm::DetSetVector<PixelDigiSimLink>>(
"siphase2OT");
112 std::unordered_set<UniqueSimTrackId, UniqueSimTrackIdHash> selectedIds;
114 auto const& trackingParticle = tpColl[itp];
120 for (
auto const& trk : trackingParticle.g4Tracks()) {
121 selectedIds.emplace(trk.trackId(),
eid);
127 auto sipixelLinkVector = pruneByTpAssoc(sipixelLinkColl, selectedIds);
129 auto sipixelOut = std::make_unique<edm::DetSetVector<PixelDigiSimLink>>(sipixelLinkVector);
135 auto sistripLinkVector = pruneByTpAssoc(sistripLinkColl, selectedIds);
137 auto sistripOut = std::make_unique<edm::DetSetVector<StripDigiSimLink>>(sistripLinkVector);
144 auto siphase2OTLinkVector = pruneByTpAssoc(siphase2OTLinkColl, selectedIds);
146 auto siphase2OTOut = std::make_unique<edm::DetSetVector<PixelDigiSimLink>>(siphase2OTLinkVector);
159 descriptions.
add(
"digiSimLinkPrunerDefault",
desc);