1 #ifndef MuonAnalysis_MuonAssociators_interface_L1MuonMatcherAlgo_h 2 #define MuonAnalysis_MuonAssociators_interface_L1MuonMatcherAlgo_h 16 #include <type_traits> 58 return propagated.
isValid() ?
match(propagated, l1, deltaR, deltaPhi) :
false;
65 return propagated.
isValid() ?
match(propagated, l1, deltaR, deltaPhi) :
false;
72 return propagated.
isValid() ?
match(propagated, l1, deltaR, deltaPhi) :
false;
88 return propagated.
isValid() ?
match(propagated, l1, deltaR, deltaPhi) : -1;
96 return propagated.
isValid() ?
match(propagated, l1, deltaR, deltaPhi) : -1;
104 return propagated.
isValid() ?
match(propagated, l1, deltaR, deltaPhi) : -1;
122 return propagated.
isValid() ?
match(propagated, l1, deltaR, deltaPhi) : -1;
130 return propagated.
isValid() ?
match(propagated, l1, deltaR, deltaPhi) : -1;
138 return propagated.
isValid() ?
match(propagated, l1, deltaR, deltaPhi) : -1;
154 template<
typename Collection,
typename Selector>
164 template<
typename Collection,
typename Selector>
174 template<
typename Collection,
typename Selector>
207 return cand.gmtMuonCand().rank();
211 inline int L1MuonMatcherAlgo::genericQuality<l1t::Muon>(
const l1t::Muon &
cand)
const 213 return cand.hwQual();
224 template<
typename Collection,
typename Selector>
236 for (
int i = 0,
n =
l1s.size();
i <
n; ++
i) {
237 const obj &l1 =
l1s[
i];
240 double thisDeltaEta = pos.
eta() - l1.eta();
242 int thisQual = genericQuality<obj>(l1);
243 double thisPt = l1.pt();
245 bool betterMatch = (match == -1);
247 case SortByDeltaR: betterMatch = (thisDeltaR2 < minDeltaR2);
break;
248 case SortByDeltaEta: betterMatch = (fabs(thisDeltaEta) < fabs(minDeltaEta));
break;
249 case SortByDeltaPhi: betterMatch = (fabs(thisDeltaPhi) < fabs(minDeltaPhi));
break;
252 case SortByQual: betterMatch = (thisQual > maxQual || ((thisQual == maxQual) && (thisPt > maxPt)));
break;
257 deltaPhi = thisDeltaPhi;
258 minDeltaR2 = thisDeltaR2;
259 minDeltaEta = thisDeltaEta;
260 minDeltaPhi = thisDeltaPhi;
L1Selector preselectionCut_
Preselection cut to apply to L1 candidates before matching.
TrajectoryStateOnSurface extrapolate(const FreeTrajectoryState &state) const
Extrapolate a FreeTrajectoryState to the muon station 2, return an invalid TSOS if it fails...
void init(const edm::EventSetup &iSetup)
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
int matchGeneric(const reco::Candidate &c, const Collection &l1, const Selector &sel, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const
int match(const SimTrack &tk, const edm::SimVertexContainer &vtxs, const std::vector< l1extra::L1MuonParticle > &l1, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const
StringCutObjectSelector< reco::Candidate, true > L1Selector
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.
Geom::Phi< T > phi() const
TrajectoryStateOnSurface extrapolate(const SimTrack &tk, const edm::SimVertexContainer &vtx) const
Extrapolate a SimTrack to the muon station 2, return an invalid TSOS if it fails. Requires SimVertice...
GlobalPoint globalPosition() const
const PropagateToMuon & propagatorToMuon() const
Return the propagator to second muon station (in case it's needed)
bool match(const SimTrack &tk, const edm::SimVertexContainer &vtxs, const l1extra::L1MuonParticle &l1, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const
int match(const SimTrack &tk, const edm::SimVertexContainer &vtxs, const std::vector< l1t::Muon > &l1, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const
int match(const reco::Candidate &c, const std::vector< l1t::Muon > &l1, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const
Propagate an object (usually a track) to the second muon station. Support for other muon stations wil...
Container::value_type value_type
int match(const reco::Track &tk, const std::vector< l1extra::L1MuonParticle > &l1, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const
int match(const reco::Candidate &c, const std::vector< l1extra::L1MuonParticle > &l1, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const
int genericQuality(const T &cand) const
Functor that operates on <T>
PropagateToMuon & propagatorToMuon()
Return the propagator to second muon station (in case it's needed)
SortBy
Sort by deltaPhi or deltaEta instead of deltaR.
bool match(const reco::Candidate &c, const l1extra::L1MuonParticle &l1, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const
void setL1PhiOffset(double l1PhiOffset)
Add this offset to the L1 phi before doing the match, to correct for different scales in L1 vs offlin...
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
bool match(const reco::Track &tk, const l1extra::L1MuonParticle &l1, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const
std::vector< SimVertex > SimVertexContainer
int matchGeneric(const reco::Track &tk, const Collection &l1, const Selector &sel, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const
L1MuonMatcherAlgo(const edm::ParameterSet &iConfig)
int match(const reco::Track &tk, const std::vector< l1t::Muon > &l1, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const
Matcher of reconstructed objects to L1 Muons.
TrajectoryStateOnSurface extrapolate(const reco::Candidate &tk) const
Extrapolate reco::Candidate to the muon station 2, return an invalid TSOS if it fails.
double l1PhiOffset_
offset to be added to the L1 phi before the match
double deltaR2_
Matching cuts.