37 #include <unordered_set> 43 const std::set<std::pair<uint32_t, EncodedEventId>>& selectedIds) {
44 std::vector<edm::DetSet<T>> linkVector;
46 for (
auto&& detSet : simLinkColl) {
49 for (
auto&& simLink : detSet) {
50 std::pair<uint32_t, EncodedEventId> trkid(simLink.SimTrackId(), simLink.eventId());
51 if (selectedIds.count(trkid) > 0) {
56 linkVector.push_back(
std::move(newDetSet));
89 produces<edm::DetSetVector<PixelDigiSimLink>>(
"siPixel");
94 produces<edm::DetSetVector<StripDigiSimLink>>(
"siStrip");
100 produces<edm::DetSetVector<PixelDigiSimLink>>(
"siphase2OT");
110 std::set<std::pair<uint32_t, EncodedEventId>> selectedIds;
112 auto const& trackingParticle = tpColl[itp];
118 for (
auto const& trk : trackingParticle.g4Tracks()) {
119 selectedIds.emplace(trk.trackId(),
eid);
125 auto sipixelLinkVector = pruneByTpAssoc(sipixelLinkColl, selectedIds);
127 auto sipixelOut = std::make_unique<edm::DetSetVector<PixelDigiSimLink>>(sipixelLinkVector);
133 auto sistripLinkVector = pruneByTpAssoc(sistripLinkColl, selectedIds);
135 auto sistripOut = std::make_unique<edm::DetSetVector<StripDigiSimLink>>(sistripLinkVector);
142 auto siphase2OTLinkVector = pruneByTpAssoc(siphase2OTLinkColl, selectedIds);
144 auto siphase2OTOut = std::make_unique<edm::DetSetVector<PixelDigiSimLink>>(siphase2OTLinkVector);
157 descriptions.
add(
"digiSimLinkPrunerDefault", desc);
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
void push_back(const T &t)
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
std::vector< TrackingParticle > TrackingParticleCollection
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< edm::DetSetVector< PixelDigiSimLink > > siphase2OTSimLinksToken_
bool get(ProductID const &oid, Handle< PROD > &result) const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::EDGetTokenT< edm::DetSetVector< StripDigiSimLink > > sistripSimLinksToken_
DigiSimLinkPruner(const edm::ParameterSet &)
edm::EDGetTokenT< edm::DetSetVector< PixelDigiSimLink > > sipixelSimLinksToken_
edm::EDGetTokenT< TrackingParticleCollection > trackingParticleToken_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
bool isUninitialized() const