1 #ifndef MuonAnalysis_MuonAssociators_interface_L1MuonMatcherAlgo_h
2 #define MuonAnalysis_MuonAssociators_interface_L1MuonMatcherAlgo_h
56 return propagated.
isValid() ?
match(propagated, l1, deltaR, deltaPhi) :
false;
63 return propagated.
isValid() ?
match(propagated, l1, deltaR, deltaPhi) :
false;
70 return propagated.
isValid() ?
match(propagated, l1, deltaR, deltaPhi) :
false;
83 return propagated.
isValid() ?
match(propagated, l1, deltaR, deltaPhi) : -1;
91 return propagated.
isValid() ?
match(propagated, l1, deltaR, deltaPhi) : -1;
99 return propagated.
isValid() ?
match(propagated, l1, deltaR, deltaPhi) : -1;
113 template<
typename Collection,
typename Selector>
123 template<
typename Collection,
typename Selector>
133 template<
typename Collection,
typename Selector>
158 template<
typename Collection,
typename Selector>
168 for (
int i = 0,
n = l1s.size();
i <
n; ++
i) {
169 const obj &l1 = l1s[
i];
172 double thisDeltaEta = pos.
eta() - l1.eta();
174 double thisPt = l1.pt();
176 bool betterMatch = (match == -1);
178 case SortByDeltaR: betterMatch = (thisDeltaR2 < minDeltaR2);
break;
179 case SortByDeltaEta: betterMatch = (fabs(thisDeltaEta) < fabs(minDeltaEta));
break;
180 case SortByDeltaPhi: betterMatch = (fabs(thisDeltaPhi) < fabs(minDeltaPhi));
break;
186 deltaPhi = thisDeltaPhi;
187 minDeltaR2 = thisDeltaR2;
188 minDeltaEta = thisDeltaEta;
189 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)
Call this method at the beginning of each run, to initialize geometry, magnetic field and propagators...
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.
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
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
Propagate an object (usually a track) to the second muon station. Support for other muon stations wil...
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
double deltaR2(const T1 &t1, const T2 &t2)
Container::value_type value_type
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.
double deltaR(double eta1, double eta2, double phi1, double phi2)
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...
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
StringCutObjectSelector< l1extra::L1MuonParticle > L1Selector
L1MuonMatcherAlgo(const edm::ParameterSet &iConfig)
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.