67 template<
typename Hand,
typename T>
70 const std::vector<T> &
values,
91 produces<PATPrimitiveCollection>(
"l1muons");
92 produces<PATPrimitiveCollection>(
"propagatedReco");
93 produces<PATTriggerAssociation>(
"propagatedReco");
94 produces<PATTriggerAssociation>();
96 produces<edm::ValueMap<float> >(
"deltaR");
97 produces<edm::ValueMap<float> >(
"deltaPhi");
98 produces<edm::ValueMap<int> >(
"quality");
99 produces<edm::ValueMap<int> >(
"bx");
101 produces<edm::ValueMap<int> >(
"iPhi");
102 produces<edm::ValueMap<int> >(
"tfIndex");
104 produces<edm::ValueMap<int> >(
"isolated");
105 produces<edm::ValueMap<reco::CandidatePtr> >();
106 produces<edm::ValueMap<reco::CandidatePtr> >(
"l1ToReco");
119 std::vector<l1t::Muon> l1ts;
120 std::vector<size_t> bxIdxs;
129 l1size = l1tBX->
size();
134 minBxIdx = l1tBX->
begin(minBX) - l1tBX->
begin();
138 bxIdxs.push_back(l1tBX->
end(ibx) - l1tBX->
begin());
142 l1size = l1s->size();
147 std::vector<edm::Ptr<reco::Candidate> > l1rawMatches(reco->size());
148 vector<int> isSelected(l1size, -1);
149 std::vector<edm::Ptr<reco::Candidate> > whichRecoMatch(l1size);
150 vector<int> propMatches(reco->size(), -1);
151 vector<int> fullMatches(reco->size(), -1);
152 vector<float> deltaRs(reco->size(), 999), deltaPhis(reco->size(), 999);
153 vector<int>
quality(reco->size(), 0), bx(reco->size(), -999),
isolated(reco->size(), -999);
154 vector<int> iPhi(reco->size(), 0), tfIndex(reco->size(), -999);
155 for (
int i = 0,
n = reco->size();
i <
n; ++
i) {
160 matcher_.
match(mu, *l1s, deltaRs[i], deltaPhis[i], propagated);
163 propMatches[
i] = propOut->size();
166 propOut->back().setCharge(mu.
charge());
174 whichRecoMatch[
match] = reco->ptrAt(i);
190 if (isSelected[match] == -1) {
191 isSelected[
match] = l1Out->size();
193 l1Out->back().addFilterLabel(
labelL1_);
194 l1Out->back().setCharge(charge);
197 fullMatches[
i] = isSelected[
match];
202 bx[
i] = l1tBX->
getFirstBX() + (std::upper_bound(bxIdxs.begin(),bxIdxs.end(),
match) - bxIdxs.begin());
223 propFiller.
insert(reco, propMatches.begin(), propMatches.end());
229 fullFiller.
insert(reco, fullMatches.begin(), fullMatches.end());
252 template<
typename Hand,
typename T>
256 const std::vector<T> &
values,
258 using namespace edm;
using namespace std;
259 unique_ptr<ValueMap<T> > valMap(
new ValueMap<T>());
261 filler.
insert(handle, values.begin(), values.end());
const_iterator end(int bx) const
T getParameter(std::string const &) const
void init(const edm::EventSetup &iSetup)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
unsigned size(int bx) const
const PolarLorentzVector & polarP4() const final
four-momentum Lorentz vector
bool writeExtraInfo_
Write out additional info as ValueMaps.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void storeExtraInfo(edm::Event &iEvent, const Hand &handle, const std::vector< T > &values, const std::string &label) const
Store extra information in a ValueMap.
Geom::Phi< T > phi() const
void insert(const H &h, I begin, I end)
L1MuonMatcher(const edm::ParameterSet &iConfig)
GlobalPoint globalPosition() const
pat::TriggerObjectStandAloneCollection PATPrimitiveCollection
int charge() const final
electric charge
L1MuonMatcherAlgo matcher_
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
pat::TriggerObjectStandAlone PATPrimitive
bool isol() const
get isolation
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
void beginRun(const edm::Run &iRun, const edm::EventSetup &iSetup) override
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
edm::EDGetTokenT< std::vector< l1extra::L1MuonParticle > > l1Token_
std::string labelL1_
Labels to set as filter names in the output.
#define DEFINE_FWK_MODULE(type)
int bx() const
get bunch crossing identifier
pat::TriggerObjectStandAloneMatch PATTriggerAssociation
edm::EDGetTokenT< l1t::MuonBxCollection > l1tToken_
Matcher of reconstructed objects to L1 Muons.
bool useStage2L1_
Allow to run both on legacy or stage2 (2016) L1 Muon trigger output.
~L1MuonMatcher() override
unsigned int quality() const
get quality
bool match(const reco::Track &tk, const l1extra::L1MuonParticle &l1, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const
virtual double pt() const =0
transverse momentum
virtual double mass() const =0
mass
int firstBX_
Skim stage2 BX vector.
edm::EDGetTokenT< edm::View< reco::Candidate > > recoToken_
Tokens for input collections.
virtual int charge() const =0
electric charge
Matcher of reconstructed objects to L1 Muons.
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
const_iterator begin(int bx) const
Analysis-level trigger object class (stand-alone)