16 tracks_(consumes<
std::vector<
pat::IsolatedTrack>>(params.getParameter<
edm::InputTag>(
"tracks"))),
20 leptons_.push_back(consumes<reco::CandidateView>(
tag));
22 produces<std::vector<pat::IsolatedTrack>>();
28 auto out = std::make_unique<std::vector<pat::IsolatedTrack>>();
30 std::vector<reco::CandidatePtr> leptonPfCands;
32 for (
const auto & token :
leptons_) {
34 for (
const auto & lep : *leptons) {
35 for (
unsigned int i = 0,
n = lep.numberOfSourceCandidatePtrs();
i <
n; ++
i) {
36 auto ptr = lep.sourceCandidatePtr(
i);
37 if (ptr.isNonnull()) leptonPfCands.push_back(ptr);
41 std::sort(leptonPfCands.begin(), leptonPfCands.end());
45 for (
const auto &
track : *tracks) {
47 if (
track.packedCandRef().isNonnull()) {
49 if (std::binary_search(leptonPfCands.begin(), leptonPfCands.end(), pfCand)) {
62 std::vector<edm::EDGetTokenT<reco::CandidateView>>
leptons_;
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
IsolatedTrackCleaner(edm::ParameterSet const ¶ms)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< std::vector< pat::IsolatedTrack > > tracks_
StringCutObjectSelector< pat::IsolatedTrack > cut_
~IsolatedTrackCleaner() override
std::vector< edm::EDGetTokenT< reco::CandidateView > > leptons_