21 iConfig.getParameter<edm::
InputTag>(
"candidates"))),
23 iConfig.getParameter<edm::
InputTag>(
"lostTracks"))),
27 produces<pat::PackedCandidateRefVector>(
"lostTracks" +
sel);
28 produces<pat::PackedCandidateRefVector>(
"pfCandidates" +
sel);
31 muonIDMap_[
sel] = std::make_unique<StringCutObjectSelector<reco::Muon>>(
"passed('" +
sel +
"')");
32 produces<pat::PackedCandidateRefVector>(
"lostTracks" +
sel);
33 produces<pat::PackedCandidateRefVector>(
"pfCandidates" +
sel);
50 std::map<std::string, std::unique_ptr<StringCutObjectSelector<reco::Muon>>>
muonIDMap_;
61 std::map<std::string, std::unique_ptr<pat::PackedCandidateRefVector>> lostTrackMap, candMap;
73 const auto& muonTrack =
muon.innerTrack();
79 const auto& lostTrack = track2LostTrack[muonTrack];
80 if (lostTrack.isNonnull()) {
81 for (
const auto&
sel : muonSelectors_) {
83 lostTrackMap[
sel]->push_back(lostTrack);
85 for (
const auto&
sel : muonIDs_) {
87 lostTrackMap[
sel]->push_back(lostTrack);
95 const auto& candTrack = candidate2PF[cand]->trackRef();
97 if (candTrack.isNonnull() && muonTrack == candTrack) {
98 for (
const auto&
sel : muonSelectors_) {
100 candMap[
sel]->push_back(cand);
102 for (
const auto&
sel : muonIDs_) {
104 candMap[
sel]->push_back(cand);
111 for (
auto&
s : lostTrackMap) {
114 for (
auto&
s : candMap) {
124 ->setComment(
"packed PF candidate input collection");
126 desc.
add<std::vector<std::string>>(
"muonSelectors", {
"AllTrackerMuons",
"TMOneStationTight"})
127 ->setComment(
"muon selectors");
128 desc.
add<std::vector<std::string>>(
"muonIDs", {})->setComment(
"muon IDs");
129 descriptions.
add(
"packedCandidateMuonID", desc);
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
static void fillDescriptions(edm::ConfigurationDescriptions &)
~PackedCandidateMuonSelectorProducer() override=default
#define DEFINE_FWK_MODULE(type)
const edm::EDGetTokenT< edm::Association< reco::PFCandidateCollection > > candidate2PFToken_
std::vector< l1t::PFCandidate > PFCandidateCollection
std::vector< pat::PackedCandidate > PackedCandidateCollection
const edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > track2LostTrackToken_
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
std::map< std::string, std::unique_ptr< StringCutObjectSelector< reco::Muon > > > muonIDMap_
edm::Ref< pat::PackedCandidateCollection > PackedCandidateRef
bool get(ProductID const &oid, Handle< PROD > &result) const
void produce(edm::Event &, const edm::EventSetup &) override
PackedCandidateMuonSelectorProducer(const edm::ParameterSet &iConfig)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const edm::EDGetTokenT< reco::MuonCollection > muonToken_
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
const std::vector< std::string > muonIDs_
static TrackQuality qualityByName(const std::string &name)
SelectionType selectionTypeFromString(const std::string &label)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< Muon > MuonCollection
const std::vector< std::string > muonSelectors_
const edm::EDGetTokenT< pat::PackedCandidateCollection > candidateToken_
const edm::EDGetTokenT< pat::PackedCandidateCollection > lostTrackToken_