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);
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::pair< uint32_t, EncodedEventId > UniqueSimTrackId
#define DEFINE_FWK_MODULE(type)
constexpr bool isUninitialized() const noexcept
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
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_
T getParameter(std::string const &) const
edm::EDGetTokenT< TrackingParticleCollection > trackingParticleToken_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< TrackingParticle > TrackingParticleCollection