CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Attributes
L1MuonMatcherAlgo Class Reference

Matcher of reconstructed objects to L1 Muons. More...

#include "MuonAnalysis/MuonAssociators/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. More...
 
TrajectoryStateOnSurface extrapolate (const reco::Track &tk) const
 Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails. More...
 
TrajectoryStateOnSurface extrapolate (const reco::Candidate &tk) const
 Extrapolate reco::Candidate to the muon station 2, return an invalid TSOS if it fails. More...
 
TrajectoryStateOnSurface extrapolate (const reco::Candidate &tk) const
 Extrapolate reco::Candidate to the muon station 2, return an invalid TSOS if it fails. More...
 
TrajectoryStateOnSurface extrapolate (const FreeTrajectoryState &state) const
 Extrapolate a FreeTrajectoryState to the muon station 2, return an invalid TSOS if it fails. More...
 
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 SimVertices to know where to start from. More...
 
TrajectoryStateOnSurface extrapolate (const FreeTrajectoryState &state) const
 Extrapolate a FreeTrajectoryState to the muon station 2, return an invalid TSOS if it fails. More...
 
void init (const edm::EventSetup &iSetup)
 Call this method at the beginning of each run, to initialize geometry, magnetic field and propagators. More...
 
void init (const edm::EventSetup &iSetup)
 Call this method at the beginning of each run, to initialize geometry, magnetic field and propagators. More...
 
 L1MuonMatcherAlgo (const edm::ParameterSet &iConfig)
 
 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::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 (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
 
bool match (const SimTrack &tk, const edm::SimVertexContainer &vtxs, const l1extra::L1MuonParticle &l1, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const
 
int match (const reco::Track &tk, const std::vector< 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::Candidate &c, const std::vector< l1extra::L1MuonParticle > &l1, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const
 
int match (const reco::Track &tk, 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
 
int match (const reco::Candidate &c, const std::vector< l1extra::L1MuonParticle > &l1, 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
 
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
 
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
 
PropagateToMuonpropagatorToMuon ()
 Return the propagator to second muon station (in case it's needed) More...
 
const PropagateToMuonpropagatorToMuon () const
 Return the propagator to second muon station (in case it's needed) More...
 
PropagateToMuonpropagatorToMuon ()
 Return the propagator to second muon station (in case it's needed) More...
 
const PropagateToMuonpropagatorToMuon () const
 Return the propagator to second muon station (in case it's needed) More...
 
void setL1PhiOffset (double l1PhiOffset)
 Add this offset to the L1 phi before doing the match, to correct for different scales in L1 vs offline. More...
 
 ~L1MuonMatcherAlgo ()
 
 ~L1MuonMatcherAlgo ()
 

Private Types

typedef
StringCutObjectSelector
< l1extra::L1MuonParticle
L1Selector
 
typedef
StringCutObjectSelector
< l1extra::L1MuonParticle
L1Selector
 
enum  SortBy { SortByDeltaR, SortByDeltaPhi, SortByDeltaEta, SortByPt }
 Sort by deltaPhi or deltaEta instead of deltaR. More...
 

Private Attributes

double deltaEta_
 
double deltaPhi_
 
double deltaR2_
 Matching cuts. More...
 
double l1PhiOffset_
 offset to be added to the L1 phi before the match More...
 
L1Selector preselectionCut_
 Preselection cut to apply to L1 candidates before matching. More...
 
PropagateToMuon prop_
 
SortBy sortBy_
 
bool sortByDeltaPhi_
 Sort by deltaPhi instead of deltaR. More...
 

Detailed Description

Matcher of reconstructed objects to L1 Muons.

Author
Giovanni Petrucciani
Giovanni Petrucciani
Version
Id:
L1MuonMatcherAlgo.h,v 1.8 2010/07/01 07:40:52 gpetrucc Exp

Definition at line 26 of file L1MuonMatcherAlgo.h.

Member Typedef Documentation

Definition at line 119 of file L1MuonMatcherAlgo.h.

Definition at line 143 of file L1MuonMatcherAlgo.h.

Member Enumeration Documentation

Sort by deltaPhi or deltaEta instead of deltaR.

Enumerator
SortByDeltaR 
SortByDeltaPhi 
SortByDeltaEta 
SortByPt 

Definition at line 151 of file L1MuonMatcherAlgo.h.

Constructor & Destructor Documentation

L1MuonMatcherAlgo::L1MuonMatcherAlgo ( const edm::ParameterSet iConfig)
explicit

Definition at line 5 of file L1MuonMatcherAlgo.cc.

5  :
6  prop_(iConfig),
7  preselectionCut_(iConfig.existsAs<std::string>("preselection") ? iConfig.getParameter<std::string>("preselection") : ""),
8  deltaR2_(std::pow(iConfig.getParameter<double>("maxDeltaR"),2)),
9  deltaPhi_(iConfig.existsAs<double>("maxDeltaPhi") ? iConfig.getParameter<double>("maxDeltaPhi") : 10),
10  sortByDeltaPhi_(iConfig.existsAs<bool>("sortByDeltaPhi") ? iConfig.getParameter<bool>("sortByDeltaPhi") : false)
11 {
12 }
L1Selector preselectionCut_
Preselection cut to apply to L1 candidates before matching.
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:184
PropagateToMuon prop_
bool sortByDeltaPhi_
Sort by deltaPhi instead of deltaR.
double deltaR2_
Matching cuts.
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
L1MuonMatcherAlgo::~L1MuonMatcherAlgo ( )

Definition at line 14 of file L1MuonMatcherAlgo.cc.

14 {}
L1MuonMatcherAlgo::L1MuonMatcherAlgo ( const edm::ParameterSet iConfig)
explicit
L1MuonMatcherAlgo::~L1MuonMatcherAlgo ( )

Member Function Documentation

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 35 of file L1MuonMatcherAlgo.h.

References PropagateToMuon::extrapolate(), and prop_.

Referenced by match(), and matchGeneric().

35 { return prop_.extrapolate(tk); }
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.
PropagateToMuon prop_
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 36 of file L1MuonMatcherAlgo.h.

References PropagateToMuon::extrapolate(), and prop_.

36 { return prop_.extrapolate(tk); }
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.
PropagateToMuon prop_
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 38 of file L1MuonMatcherAlgo.h.

References PropagateToMuon::extrapolate(), and prop_.

38 { return prop_.extrapolate(tk); }
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.
PropagateToMuon prop_
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 39 of file L1MuonMatcherAlgo.h.

References PropagateToMuon::extrapolate(), and prop_.

39 { return prop_.extrapolate(tk); }
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.
PropagateToMuon prop_
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 41 of file L1MuonMatcherAlgo.h.

References PropagateToMuon::extrapolate(), and prop_.

41 { return prop_.extrapolate(state); }
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.
PropagateToMuon prop_
TrajectoryStateOnSurface L1MuonMatcherAlgo::extrapolate ( const SimTrack tk,
const edm::SimVertexContainer vtx 
) const
inline

Extrapolate a SimTrack to the muon station 2, return an invalid TSOS if it fails. Requires SimVertices to know where to start from.

Definition at line 42 of file L1MuonMatcherAlgo.h.

References PropagateToMuon::extrapolate(), and prop_.

42 { return prop_.extrapolate(tk, vtx); }
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.
PropagateToMuon prop_
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 45 of file L1MuonMatcherAlgo.h.

References PropagateToMuon::extrapolate(), and prop_.

45 { return prop_.extrapolate(state); }
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.
PropagateToMuon prop_
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 HLTMuonPlotter::beginRun().

17  {
18  prop_.init(iSetup);
19 }
PropagateToMuon prop_
void init(const edm::EventSetup &iSetup)
Call this method at the beginning of each run, to initialize geometry, magnetic field and propagators...
void L1MuonMatcherAlgo::init ( const edm::EventSetup iSetup)

Call this method at the beginning of each run, to initialize geometry, magnetic field and propagators.

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 50 of file L1MuonMatcherAlgo.h.

References extrapolate(), and TrajectoryStateOnSurface::isValid().

Referenced by match(), and matchGeneric().

50  {
51  propagated = extrapolate(tk);
52  return propagated.isValid() ? match(propagated, l1, deltaR, deltaPhi) : false;
53  }
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
bool match(const reco::Track &tk, const l1extra::L1MuonParticle &l1, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const
volatile std::atomic< bool > shutdown_flag false
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 54 of file L1MuonMatcherAlgo.h.

References extrapolate(), TrajectoryStateOnSurface::isValid(), and match().

54  {
55  propagated = extrapolate(tk);
56  return propagated.isValid() ? match(propagated, l1, deltaR, deltaPhi) : false;
57  }
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
bool match(const reco::Track &tk, const l1extra::L1MuonParticle &l1, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const
volatile std::atomic< bool > shutdown_flag false
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 57 of file L1MuonMatcherAlgo.h.

References extrapolate(), TrajectoryStateOnSurface::isValid(), and match().

57  {
58  propagated = extrapolate(c);
59  return propagated.isValid() ? match(propagated, l1, deltaR, deltaPhi) : false;
60  }
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
bool match(const reco::Track &tk, const l1extra::L1MuonParticle &l1, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const
volatile std::atomic< bool > shutdown_flag false
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 61 of file L1MuonMatcherAlgo.h.

References extrapolate(), TrajectoryStateOnSurface::isValid(), and match().

61  {
62  propagated = extrapolate(c);
63  return propagated.isValid() ? match(propagated, l1, deltaR, deltaPhi) : false;
64  }
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
bool match(const reco::Track &tk, const l1extra::L1MuonParticle &l1, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const
volatile std::atomic< bool > shutdown_flag false
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 SiPixelRawToDigiRegional_cfi::deltaPhi, deltaPhi_, reco::deltaR2(), deltaR2_, PV3DBase< T, PVType, FrameType >::eta(), reco::LeafCandidate::eta(), TrajectoryStateOnSurface::globalPosition(), PV3DBase< T, PVType, FrameType >::phi(), reco::LeafCandidate::phi(), preselectionCut_, and mathSSE::sqrt().

22  {
23  if (preselectionCut_(l1)) {
24  GlobalPoint pos = propagated.globalPosition();
25  double thisDeltaPhi = ::deltaPhi(double(pos.phi()), l1.phi());
26  double thisDeltaR2 = ::deltaR2(double(pos.eta()), double(pos.phi()), l1.eta(), l1.phi());
27  if ((fabs(thisDeltaPhi) < deltaPhi_) && (thisDeltaR2 < deltaR2_)) {
28  deltaR = std::sqrt(thisDeltaR2);
29  deltaPhi = thisDeltaPhi;
30  return true;
31  }
32  }
33  return false;
34 }
L1Selector preselectionCut_
Preselection cut to apply to L1 candidates before matching.
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
GlobalPoint globalPosition() const
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
T sqrt(T t)
Definition: SSEVec.h:48
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
Definition: deltaR.h:58
T eta() const
Definition: PV3DBase.h:76
double deltaR2_
Matching cuts.
bool L1MuonMatcherAlgo::match ( const SimTrack tk,
const edm::SimVertexContainer vtxs,
const l1extra::L1MuonParticle l1,
float &  deltaR,
float &  deltaPhi,
TrajectoryStateOnSurface propagated 
) const
inline

Try to match one simtrack 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 68 of file L1MuonMatcherAlgo.h.

References extrapolate(), TrajectoryStateOnSurface::isValid(), and match().

68  {
69  propagated = extrapolate(tk, vtxs);
70  return propagated.isValid() ? match(propagated, l1, deltaR, deltaPhi) : false;
71  }
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
bool match(const reco::Track &tk, const l1extra::L1MuonParticle &l1, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const
volatile std::atomic< bool > shutdown_flag 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 69 of file L1MuonMatcherAlgo.h.

References extrapolate(), TrajectoryStateOnSurface::isValid(), and match().

69  {
70  propagated = extrapolate(tk);
71  return propagated.isValid() ? match(propagated, l1, deltaR, deltaPhi) : -1;
72  }
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
bool match(const reco::Track &tk, const l1extra::L1MuonParticle &l1, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const
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

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 77 of file L1MuonMatcherAlgo.h.

References extrapolate(), TrajectoryStateOnSurface::isValid(), and match().

77  {
78  propagated = extrapolate(c);
79  return propagated.isValid() ? match(propagated, l1, deltaR, deltaPhi) : -1;
80  }
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
bool match(const reco::Track &tk, const l1extra::L1MuonParticle &l1, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const
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 81 of file L1MuonMatcherAlgo.h.

References extrapolate(), TrajectoryStateOnSurface::isValid(), and match().

81  {
82  propagated = extrapolate(tk);
83  return propagated.isValid() ? match(propagated, l1, deltaR, deltaPhi) : -1;
84  }
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
bool match(const reco::Track &tk, const l1extra::L1MuonParticle &l1, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const
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_.

37  {
38  return matchGeneric(propagated, l1s, preselectionCut_, deltaR, deltaPhi);
39 /*
40  int match = -1;
41  double minDeltaPhi = deltaPhi_;
42  double minDeltaR2 = deltaR2_;
43  GlobalPoint pos = propagated.globalPosition();
44  for (int i = 0, n = l1s.size(); i < n; ++i) {
45  const l1extra::L1MuonParticle &l1 = l1s[i];
46  if (preselectionCut_(l1)) {
47  double thisDeltaPhi = ::deltaPhi(double(pos.phi()), l1.phi());
48  double thisDeltaR2 = ::deltaR2(double(pos.eta()), double(pos.phi()), l1.eta(), l1.phi());
49  if ((fabs(thisDeltaPhi) < deltaPhi_) && (thisDeltaR2 < deltaR2_)) { // check both
50  if (sortByDeltaPhi_ ? (fabs(thisDeltaPhi) < fabs(minDeltaPhi)) : (thisDeltaR2 < minDeltaR2)) { // sort on one
51  match = i;
52  deltaR = std::sqrt(thisDeltaR2);
53  deltaPhi = thisDeltaPhi;
54  if (sortByDeltaPhi_) minDeltaPhi = thisDeltaPhi; else minDeltaR2 = thisDeltaR2;
55  }
56  }
57  }
58  }
59  return match;
60 */
61 }
L1Selector preselectionCut_
Preselection cut to apply to L1 candidates before matching.
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
int matchGeneric(const reco::Track &tk, const Collection &l1, const Selector &sel, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const
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 89 of file L1MuonMatcherAlgo.h.

References extrapolate(), TrajectoryStateOnSurface::isValid(), and match().

89  {
90  propagated = extrapolate(c);
91  return propagated.isValid() ? match(propagated, l1, deltaR, deltaPhi) : -1;
92  }
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
bool match(const reco::Track &tk, const l1extra::L1MuonParticle &l1, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const
int L1MuonMatcherAlgo::match ( const SimTrack tk,
const edm::SimVertexContainer vtxs,
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 97 of file L1MuonMatcherAlgo.h.

References extrapolate(), TrajectoryStateOnSurface::isValid(), and match().

97  {
98  propagated = extrapolate(tk, vtxs);
99  return propagated.isValid() ? match(propagated, l1, deltaR, deltaPhi) : -1;
100  }
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
bool match(const reco::Track &tk, const l1extra::L1MuonParticle &l1, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const
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

template<typename Collection , typename Selector >
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 93 of file L1MuonMatcherAlgo.h.

References extrapolate(), and TrajectoryStateOnSurface::isValid().

Referenced by match(), and matchGeneric().

93  {
94  propagated = extrapolate(tk);
95  return propagated.isValid() ? matchGeneric(propagated, l1, sel, deltaR, deltaPhi) : -1;
96  }
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
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 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 103 of file L1MuonMatcherAlgo.h.

References extrapolate(), TrajectoryStateOnSurface::isValid(), and matchGeneric().

103  {
104  propagated = extrapolate(c);
105  return propagated.isValid() ? matchGeneric(propagated, l1, sel, deltaR, deltaPhi) : -1;
106  }
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
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 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 132 of file L1MuonMatcherAlgo.h.

References SiPixelRawToDigiRegional_cfi::deltaPhi, deltaPhi_, reco::deltaR2(), deltaR2_, PV3DBase< T, PVType, FrameType >::eta(), TrajectoryStateOnSurface::globalPosition(), i, match(), benchmark_cfg::minDeltaPhi, n, getGTfromDQMFile::obj, PV3DBase< T, PVType, FrameType >::phi(), EgammaValidation_Wenu_cff::sel, sortByDeltaPhi_, and mathSSE::sqrt().

132  {
133  typedef typename Collection::value_type obj;
134  int match = -1;
135  double minDeltaPhi = deltaPhi_;
136  double minDeltaR2 = deltaR2_;
137  GlobalPoint pos = propagated.globalPosition();
138  for (int i = 0, n = l1s.size(); i < n; ++i) {
139  const obj &l1 = l1s[i];
140  if (sel(l1)) {
141  double thisDeltaPhi = ::deltaPhi(double(pos.phi()), l1.phi());
142  double thisDeltaR2 = ::deltaR2(double(pos.eta()), double(pos.phi()), l1.eta(), l1.phi());
143  if ((fabs(thisDeltaPhi) < deltaPhi_) && (thisDeltaR2 < deltaR2_)) { // check both
144  if (sortByDeltaPhi_ ? (fabs(thisDeltaPhi) < fabs(minDeltaPhi)) : (thisDeltaR2 < minDeltaR2)) { // sort on one
145  match = i;
146  deltaR = std::sqrt(thisDeltaR2);
147  deltaPhi = thisDeltaPhi;
148  if (sortByDeltaPhi_) minDeltaPhi = thisDeltaPhi; else minDeltaR2 = thisDeltaR2;
149  }
150  }
151  }
152  }
153  return match;
154 }
int i
Definition: DBlmapReader.cc:9
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
GlobalPoint globalPosition() const
bool sortByDeltaPhi_
Sort by deltaPhi instead of deltaR.
T sqrt(T t)
Definition: SSEVec.h:48
Container::value_type value_type
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
bool match(const reco::Track &tk, const l1extra::L1MuonParticle &l1, float &deltaR, float &deltaPhi, TrajectoryStateOnSurface &propagated) const
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
Definition: deltaR.h:58
T eta() const
Definition: PV3DBase.h:76
double deltaR2_
Matching cuts.
template<typename Collection , typename Selector >
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 114 of file L1MuonMatcherAlgo.h.

References extrapolate(), TrajectoryStateOnSurface::isValid(), and matchGeneric().

114  {
115  propagated = extrapolate(tk);
116  return propagated.isValid() ? matchGeneric(propagated, l1, sel, deltaR, deltaPhi) : -1;
117  }
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
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 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 124 of file L1MuonMatcherAlgo.h.

References extrapolate(), TrajectoryStateOnSurface::isValid(), and matchGeneric().

124  {
125  propagated = extrapolate(c);
126  return propagated.isValid() ? matchGeneric(propagated, l1, sel, deltaR, deltaPhi) : -1;
127  }
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
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 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

PropagateToMuon& L1MuonMatcherAlgo::propagatorToMuon ( )
inline

Return the propagator to second muon station (in case it's needed)

Definition at line 44 of file L1MuonMatcherAlgo.h.

References prop_.

44 { return prop_; }
PropagateToMuon prop_
const PropagateToMuon& L1MuonMatcherAlgo::propagatorToMuon ( ) const
inline

Return the propagator to second muon station (in case it's needed)

Definition at line 46 of file L1MuonMatcherAlgo.h.

References prop_.

46 { return prop_; }
PropagateToMuon prop_
PropagateToMuon& L1MuonMatcherAlgo::propagatorToMuon ( )
inline

Return the propagator to second muon station (in case it's needed)

Definition at line 48 of file L1MuonMatcherAlgo.h.

References prop_.

48 { return prop_; }
PropagateToMuon prop_
const PropagateToMuon& L1MuonMatcherAlgo::propagatorToMuon ( ) const
inline

Return the propagator to second muon station (in case it's needed)

Definition at line 50 of file L1MuonMatcherAlgo.h.

References prop_.

50 { return prop_; }
PropagateToMuon prop_
void L1MuonMatcherAlgo::setL1PhiOffset ( double  l1PhiOffset)
inline

Add this offset to the L1 phi before doing the match, to correct for different scales in L1 vs offline.

Definition at line 138 of file L1MuonMatcherAlgo.h.

References l1PhiOffset_.

138 { l1PhiOffset_ = l1PhiOffset; }
double l1PhiOffset_
offset to be added to the L1 phi before the match

Member Data Documentation

double L1MuonMatcherAlgo::deltaEta_
private

Definition at line 148 of file L1MuonMatcherAlgo.h.

double L1MuonMatcherAlgo::deltaPhi_
private

Definition at line 124 of file L1MuonMatcherAlgo.h.

Referenced by match(), and matchGeneric().

double L1MuonMatcherAlgo::deltaR2_
private

Matching cuts.

Definition at line 124 of file L1MuonMatcherAlgo.h.

Referenced by match(), and matchGeneric().

double L1MuonMatcherAlgo::l1PhiOffset_
private

offset to be added to the L1 phi before the match

Definition at line 155 of file L1MuonMatcherAlgo.h.

Referenced by setL1PhiOffset().

L1Selector L1MuonMatcherAlgo::preselectionCut_
private

Preselection cut to apply to L1 candidates before matching.

Definition at line 121 of file L1MuonMatcherAlgo.h.

Referenced by match().

PropagateToMuon L1MuonMatcherAlgo::prop_
private

Definition at line 117 of file L1MuonMatcherAlgo.h.

Referenced by extrapolate(), init(), and propagatorToMuon().

SortBy L1MuonMatcherAlgo::sortBy_
private

Definition at line 152 of file L1MuonMatcherAlgo.h.

bool L1MuonMatcherAlgo::sortByDeltaPhi_
private

Sort by deltaPhi instead of deltaR.

Definition at line 127 of file L1MuonMatcherAlgo.h.

Referenced by matchGeneric().