47 linkToPackedPF_(iConfig.getParameter<
bool>("linkToPackedPFCandidates")),
48 saveTeVMuons_(iConfig.getParameter<std::
string>("saveTeVMuons")),
49 modifyMuon_(iConfig.getParameter<
bool>("modifyMuons"))
51 if (linkToPackedPF_) {
52 const std::vector<edm::InputTag> & pf = (iConfig.
existsAs<std::vector<edm::InputTag>>(
"pfCandidates") ?
53 iConfig.
getParameter<std::vector<edm::InputTag>>(
"pfCandidates") :
55 const std::vector<edm::InputTag> & pf2pc = (iConfig.
existsAs<std::vector<edm::InputTag>>(
"packedPFCandidates") ?
56 iConfig.
getParameter<std::vector<edm::InputTag>>(
"packedPFCandidates") :
58 if (pf.size() != pf2pc.size())
throw cms::Exception(
"Configuration") <<
"Mismatching pfCandidates and packedPFCandidates\n";
59 for (
const edm::InputTag &
tag : pf) pf_.push_back(consumes<reco::PFCandidateCollection>(
tag));
67 muonModifier_->setConsumes(sumes);
69 muonModifier_.reset(
nullptr);
71 produces<std::vector<pat::Muon> >();
87 auto_ptr<vector<pat::Muon> >
out(
new vector<pat::Muon>());
88 out->reserve(
src->size());
92 std::map<reco::CandidatePtr,pat::PackedCandidateRef> mu2pc;
96 for (
unsigned int ipfh = 0, npfh =
pf_.size(); ipfh < npfh; ++ipfh) {
99 const auto & pfcoll = (*pf);
100 const auto & pfmap = (*pf2pc);
101 for (
unsigned int i = 0,
n = pf->size();
i <
n; ++
i) {
108 for (vector<pat::Muon>::const_iterator it =
src->begin(), ed =
src->end(); it != ed; ++it) {
const edm::EDGetTokenT< pat::MuonCollection > src_
T getParameter(std::string const &) const
void embedDytMuon()
embed reference to the above dyt Track
bool isNonnull() const
Checks for non-null.
void embedTpfmsMuon()
embed reference to the above tpfms Track
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
PATMuonSlimmer(const edm::ParameterSet &iConfig)
virtual ~PATMuonSlimmer()
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
const bool linkToPackedPF_
virtual void produce(edm::Event &iEvent, const edm::EventSetup &iSetup)
std::vector< pat::PackedCandidate > PackedCandidateCollection
std::vector< edm::EDGetTokenT< reco::PFCandidateCollection > > pf_
std::unique_ptr< pat::ObjectModifier< pat::Muon > > muonModifier_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
reco::MuonRef muonRef() const
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
std::vector< Muon > MuonCollection
Particle reconstructed by the particle flow algorithm.
std::vector< edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > > pf2pc_
const StringCutObjectSelector< pat::Muon > saveTeVMuons_
void embedPickyMuon()
embed reference to the above picky Track
Analysis-level muon class.
edm::Ptr< reco::Candidate > refToOrig_
virtual void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) overridefinal