Matcher of reconstructed objects to L1 Muons. More...
#include <HLTriggerOffline/Muon/interface/L1MuonMatcherAlgo.h>
Public Member Functions | |
TrajectoryStateOnSurface | extrapolate (const reco::Track &tk) const |
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails. | |
TrajectoryStateOnSurface | extrapolate (const reco::Candidate &tk) const |
Extrapolate reco::Candidate to the muon station 2, return an invalid TSOS if it fails. | |
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. | |
L1MuonMatcherAlgo (const edm::ParameterSet &iConfig) | |
bool | match (const reco::Track &tk, const l1extra::L1MuonParticle &l1, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const |
bool | match (const reco::Candidate &c, const l1extra::L1MuonParticle &l1, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const |
bool | match (TrajectoryStateOnSurface &propagated, const l1extra::L1MuonParticle &l1, float &deltaR, float &deltaPhi) const |
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 | match (TrajectoryStateOnSurface &propagated, const std::vector< l1extra::L1MuonParticle > &l1, float &deltaR, float &deltaPhi) const |
template<typename Collection , typename Selector > | |
int | matchGeneric (const reco::Track &tk, const Collection &l1, const Selector &sel, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const |
template<typename Collection , typename Selector > | |
int | matchGeneric (const reco::Candidate &c, const Collection &l1, const Selector &sel, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const |
template<typename Collection , typename Selector > | |
int | matchGeneric (TrajectoryStateOnSurface &propagated, const Collection &l1, const Selector &sel, float &deltaR, float &deltaPhi) const |
const PropagateToMuon & | propagatorToMuon () const |
Return the propagator to second muon station (in case it's needed) | |
PropagateToMuon & | propagatorToMuon () |
Return the propagator to second muon station (in case it's needed) | |
~L1MuonMatcherAlgo () | |
Private Types | |
typedef StringCutObjectSelector < l1extra::L1MuonParticle > | L1Selector |
Private Attributes | |
double | deltaPhi_ |
double | deltaR2_ |
Matching cuts. | |
L1Selector | preselectionCut_ |
Preselection cut to apply to L1 candidates before matching. | |
PropagateToMuon | prop_ |
bool | sortByDeltaPhi_ |
Sort by deltaPhi instead of deltaR. |
Matcher of reconstructed objects to L1 Muons.
Definition at line 28 of file L1MuonMatcherAlgo.h.
typedef StringCutObjectSelector<l1extra::L1MuonParticle> L1MuonMatcherAlgo::L1Selector [private] |
Definition at line 121 of file L1MuonMatcherAlgo.h.
L1MuonMatcherAlgo::L1MuonMatcherAlgo | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 5 of file L1MuonMatcherAlgo.cc.
: prop_(iConfig), preselectionCut_(iConfig.existsAs<std::string>("preselection") ? iConfig.getParameter<std::string>("preselection") : ""), deltaR2_(std::pow(iConfig.getParameter<double>("maxDeltaR"),2)), deltaPhi_(iConfig.existsAs<double>("maxDeltaPhi") ? iConfig.getParameter<double>("maxDeltaPhi") : 10), sortByDeltaPhi_(iConfig.existsAs<bool>("sortByDeltaPhi") ? iConfig.getParameter<bool>("sortByDeltaPhi") : false) { }
L1MuonMatcherAlgo::~L1MuonMatcherAlgo | ( | ) |
Definition at line 14 of file L1MuonMatcherAlgo.cc.
{}
TrajectoryStateOnSurface L1MuonMatcherAlgo::extrapolate | ( | const reco::Track & | tk | ) | const [inline] |
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.
Definition at line 37 of file L1MuonMatcherAlgo.h.
References PropagateToMuon::extrapolate(), and prop_.
Referenced by match(), and matchGeneric().
{ return prop_.extrapolate(tk); }
TrajectoryStateOnSurface L1MuonMatcherAlgo::extrapolate | ( | const FreeTrajectoryState & | state | ) | const [inline] |
Extrapolate a FreeTrajectoryState to the muon station 2, return an invalid TSOS if it fails.
Definition at line 43 of file L1MuonMatcherAlgo.h.
References PropagateToMuon::extrapolate(), and prop_.
{ return prop_.extrapolate(state); }
TrajectoryStateOnSurface L1MuonMatcherAlgo::extrapolate | ( | const reco::Candidate & | tk | ) | const [inline] |
Extrapolate reco::Candidate to the muon station 2, return an invalid TSOS if it fails.
Definition at line 40 of file L1MuonMatcherAlgo.h.
References PropagateToMuon::extrapolate(), and prop_.
{ return prop_.extrapolate(tk); }
void L1MuonMatcherAlgo::init | ( | const edm::EventSetup & | iSetup | ) |
Call this method at the beginning of each run, to initialize geometry, magnetic field and propagators.
Definition at line 17 of file L1MuonMatcherAlgo.cc.
References PropagateToMuon::init(), and prop_.
Referenced by HLTMuonValidator::beginRun().
bool L1MuonMatcherAlgo::match | ( | const reco::Candidate & | c, |
const l1extra::L1MuonParticle & | l1, | ||
float & | deltaR, | ||
float & | deltaPhi, | ||
TrajectoryStateOnSurface & | propagated | ||
) | const [inline] |
Try to match one track to one L1. Return true if succeeded (and update deltaR, deltaPhi and propagated TSOS accordingly) The preselection cut on L1, if specified in the config, is applied before the match
Definition at line 59 of file L1MuonMatcherAlgo.h.
References extrapolate(), TrajectoryStateOnSurface::isValid(), and match().
int L1MuonMatcherAlgo::match | ( | const reco::Candidate & | c, |
const std::vector< l1extra::L1MuonParticle > & | l1, | ||
float & | deltaR, | ||
float & | deltaPhi, | ||
TrajectoryStateOnSurface & | propagated | ||
) | const [inline] |
Find the best match to L1, and return its index in the vector (and update deltaR, deltaPhi and propagated TSOS accordingly) Returns -1 if the match fails The preselection cut on L1, if specified in the config, is applied before the match
Definition at line 79 of file L1MuonMatcherAlgo.h.
References extrapolate(), TrajectoryStateOnSurface::isValid(), and match().
{ propagated = extrapolate(c); return propagated.isValid() ? match(propagated, l1, deltaR, deltaPhi) : -1; }
bool L1MuonMatcherAlgo::match | ( | TrajectoryStateOnSurface & | propagated, |
const l1extra::L1MuonParticle & | l1, | ||
float & | deltaR, | ||
float & | deltaPhi | ||
) | const |
Try to match one track to one L1. Return true if succeeded (and update deltaR, deltaPhi accordingly) The preselection cut on L1, if specified in the config, is applied before the match
Definition at line 22 of file L1MuonMatcherAlgo.cc.
References Geom::deltaPhi(), deltaPhi_, Geom::deltaR2(), deltaR2_, reco::LeafCandidate::eta(), PV3DBase< T, PVType, FrameType >::eta(), TrajectoryStateOnSurface::globalPosition(), reco::LeafCandidate::phi(), PV3DBase< T, PVType, FrameType >::phi(), pos, preselectionCut_, and mathSSE::sqrt().
{ if (preselectionCut_(l1)) { GlobalPoint pos = propagated.globalPosition(); double thisDeltaPhi = ::deltaPhi(double(pos.phi()), l1.phi()); double thisDeltaR2 = ::deltaR2(double(pos.eta()), double(pos.phi()), l1.eta(), l1.phi()); if ((fabs(thisDeltaPhi) < deltaPhi_) && (thisDeltaR2 < deltaR2_)) { deltaR = std::sqrt(thisDeltaR2); deltaPhi = thisDeltaPhi; return true; } } return false; }
int L1MuonMatcherAlgo::match | ( | const reco::Track & | tk, |
const std::vector< l1extra::L1MuonParticle > & | l1, | ||
float & | deltaR, | ||
float & | deltaPhi, | ||
TrajectoryStateOnSurface & | propagated | ||
) | const [inline] |
Find the best match to L1, and return its index in the vector (and update deltaR, deltaPhi and propagated TSOS accordingly) Returns -1 if the match fails The preselection cut on L1, if specified in the config, is applied before the match
Definition at line 71 of file L1MuonMatcherAlgo.h.
References extrapolate(), TrajectoryStateOnSurface::isValid(), and match().
{ propagated = extrapolate(tk); return propagated.isValid() ? match(propagated, l1, deltaR, deltaPhi) : -1; }
int L1MuonMatcherAlgo::match | ( | TrajectoryStateOnSurface & | propagated, |
const std::vector< l1extra::L1MuonParticle > & | l1, | ||
float & | deltaR, | ||
float & | deltaPhi | ||
) | const |
Find the best match to L1, and return its index in the vector (and update deltaR, deltaPhi accordingly) Returns -1 if the match fails The preselection cut on L1, if specified in the config, is applied before the match
Definition at line 37 of file L1MuonMatcherAlgo.cc.
References matchGeneric(), and preselectionCut_.
{ return matchGeneric(propagated, l1s, preselectionCut_, deltaR, deltaPhi); /* int match = -1; double minDeltaPhi = deltaPhi_; double minDeltaR2 = deltaR2_; GlobalPoint pos = propagated.globalPosition(); for (int i = 0, n = l1s.size(); i < n; ++i) { const l1extra::L1MuonParticle &l1 = l1s[i]; if (preselectionCut_(l1)) { double thisDeltaPhi = ::deltaPhi(double(pos.phi()), l1.phi()); double thisDeltaR2 = ::deltaR2(double(pos.eta()), double(pos.phi()), l1.eta(), l1.phi()); if ((fabs(thisDeltaPhi) < deltaPhi_) && (thisDeltaR2 < deltaR2_)) { // check both if (sortByDeltaPhi_ ? (fabs(thisDeltaPhi) < fabs(minDeltaPhi)) : (thisDeltaR2 < minDeltaR2)) { // sort on one match = i; deltaR = std::sqrt(thisDeltaR2); deltaPhi = thisDeltaPhi; if (sortByDeltaPhi_) minDeltaPhi = thisDeltaPhi; else minDeltaR2 = thisDeltaR2; } } } } return match; */ }
bool L1MuonMatcherAlgo::match | ( | const reco::Track & | tk, |
const l1extra::L1MuonParticle & | l1, | ||
float & | deltaR, | ||
float & | deltaPhi, | ||
TrajectoryStateOnSurface & | propagated | ||
) | const [inline] |
Try to match one track to one L1. Return true if succeeded (and update deltaR, deltaPhi and propagated TSOS accordingly) The preselection cut on L1, if specified in the config, is applied before the match
Definition at line 52 of file L1MuonMatcherAlgo.h.
References extrapolate(), and TrajectoryStateOnSurface::isValid().
Referenced by match(), and matchGeneric().
int L1MuonMatcherAlgo::matchGeneric | ( | const reco::Track & | tk, |
const Collection & | l1, | ||
const Selector & | sel, | ||
float & | deltaR, | ||
float & | deltaPhi, | ||
TrajectoryStateOnSurface & | propagated | ||
) | const [inline] |
Find the best match to L1, and return its index in the vector (and update deltaR, deltaPhi and propagated TSOS accordingly) Returns -1 if the match fails Only the objects passing the selector will be allowed for the match. If you don't need a selector, just use an AnySelector (CommonTools/Utils) which accepts everything
Definition at line 95 of file L1MuonMatcherAlgo.h.
References extrapolate(), and TrajectoryStateOnSurface::isValid().
Referenced by match(), and matchGeneric().
{ propagated = extrapolate(tk); return propagated.isValid() ? matchGeneric(propagated, l1, sel, deltaR, deltaPhi) : -1; }
int L1MuonMatcherAlgo::matchGeneric | ( | TrajectoryStateOnSurface & | propagated, |
const Collection & | l1, | ||
const Selector & | sel, | ||
float & | deltaR, | ||
float & | deltaPhi | ||
) | const |
Find the best match to L1, and return its index in the vector (and update deltaR, deltaPhi accordingly) Returns -1 if the match fails Only the objects passing the selector will be allowed for the match. The selector defaults to an AnySelector (CommonTools/Utils) which just accepts everything
Definition at line 134 of file L1MuonMatcherAlgo.h.
References Geom::deltaPhi(), deltaPhi_, Geom::deltaR2(), deltaR2_, PV3DBase< T, PVType, FrameType >::eta(), TrajectoryStateOnSurface::globalPosition(), i, match(), benchmark_cfg::minDeltaPhi, n, VarParsing::obj, PV3DBase< T, PVType, FrameType >::phi(), pos, runTheMatrix::sel, sortByDeltaPhi_, and mathSSE::sqrt().
{ typedef typename Collection::value_type obj; int match = -1; double minDeltaPhi = deltaPhi_; double minDeltaR2 = deltaR2_; GlobalPoint pos = propagated.globalPosition(); for (int i = 0, n = l1s.size(); i < n; ++i) { const obj &l1 = l1s[i]; if (sel(l1)) { double thisDeltaPhi = ::deltaPhi(double(pos.phi()), l1.phi()); double thisDeltaR2 = ::deltaR2(double(pos.eta()), double(pos.phi()), l1.eta(), l1.phi()); if ((fabs(thisDeltaPhi) < deltaPhi_) && (thisDeltaR2 < deltaR2_)) { // check both if (sortByDeltaPhi_ ? (fabs(thisDeltaPhi) < fabs(minDeltaPhi)) : (thisDeltaR2 < minDeltaR2)) { // sort on one match = i; deltaR = std::sqrt(thisDeltaR2); deltaPhi = thisDeltaPhi; if (sortByDeltaPhi_) minDeltaPhi = thisDeltaPhi; else minDeltaR2 = thisDeltaR2; } } } } return match; }
int L1MuonMatcherAlgo::matchGeneric | ( | const reco::Candidate & | c, |
const Collection & | l1, | ||
const Selector & | sel, | ||
float & | deltaR, | ||
float & | deltaPhi, | ||
TrajectoryStateOnSurface & | propagated | ||
) | const [inline] |
Find the best match to L1, and return its index in the vector (and update deltaR, deltaPhi and propagated TSOS accordingly) Returns -1 if the match fails Only the objects passing the selector will be allowed for the match. If you don't need a selector, just use an AnySelector (CommonTools/Utils) which accepts everything
Definition at line 105 of file L1MuonMatcherAlgo.h.
References extrapolate(), TrajectoryStateOnSurface::isValid(), and matchGeneric().
{ propagated = extrapolate(c); return propagated.isValid() ? matchGeneric(propagated, l1, sel, deltaR, deltaPhi) : -1; }
const PropagateToMuon& L1MuonMatcherAlgo::propagatorToMuon | ( | ) | const [inline] |
Return the propagator to second muon station (in case it's needed)
Definition at line 48 of file L1MuonMatcherAlgo.h.
References prop_.
{ return prop_; }
PropagateToMuon& L1MuonMatcherAlgo::propagatorToMuon | ( | ) | [inline] |
Return the propagator to second muon station (in case it's needed)
Definition at line 46 of file L1MuonMatcherAlgo.h.
References prop_.
{ return prop_; }
double L1MuonMatcherAlgo::deltaPhi_ [private] |
Definition at line 126 of file L1MuonMatcherAlgo.h.
Referenced by match(), and matchGeneric().
double L1MuonMatcherAlgo::deltaR2_ [private] |
Matching cuts.
Definition at line 126 of file L1MuonMatcherAlgo.h.
Referenced by match(), and matchGeneric().
Preselection cut to apply to L1 candidates before matching.
Definition at line 123 of file L1MuonMatcherAlgo.h.
Referenced by match().
PropagateToMuon L1MuonMatcherAlgo::prop_ [private] |
Definition at line 119 of file L1MuonMatcherAlgo.h.
Referenced by extrapolate(), init(), and propagatorToMuon().
bool L1MuonMatcherAlgo::sortByDeltaPhi_ [private] |
Sort by deltaPhi instead of deltaR.
Definition at line 129 of file L1MuonMatcherAlgo.h.
Referenced by matchGeneric().