14 : dr2_(
std::
pow(iConfig.getParameter<double>(
"maxDeltaR"), 2)),
15 cut_(iConfig.getParameter<double>(
"maxPull")),
16 diagOnly_(iConfig.getParameter<
bool>(
"diagonalElementsOnly")),
17 useVertex_(iConfig.getParameter<
bool>(
"useVertexVariables")) {
19 if (track ==
"standAloneMuon")
21 else if (track ==
"combinedMuon")
23 else if (track ==
"track")
27 <<
"MatcherByPullsAlgorithm: track '" << track <<
"' is not known\n" 28 <<
"Allowed values are: 'track', 'combinedMuon', 'standAloneMuon' (as per reco::RecoCandidate object)\n";
49 double pull = ROOT::Math::Similarity(diff, invCov);
51 std::cout <<
"Tk charge/pt/eta/phi/vx/vy/vz " << tk.
charge() <<
"\t" << tk.
pt() <<
"\t" << tk.
eta() <<
"\t" << tk.
phi() <<
"\t" << tk.
vx() <<
"\t" << tk.
vy() <<
"\t" << tk.
vz() << std::endl;
52 std::cout <<
"MC charge/pt/eta/phi/vx/vy/vz " << c.
charge() <<
"\t" << c.
pt() <<
"\t" << c.
eta() <<
"\t" << c.
phi() <<
"\t" << c.
vx() <<
"\t" << c.
vy() <<
"\t" << c.
vz() << std::endl;
53 std::cout <<
"Delta: " << diff << std::endl;
55 for (
size_t i = 0;
i < 5; ++
i) {
61 for (
size_t i = 0;
i < 5; ++
i) {
66 std::cout <<
"Pull: " << pull << std::endl;
68 return std::pair<bool, float>(pull <
cut_, pull);
70 return std::pair<bool, float>(
false, 9e9);
74 const std::vector<reco::GenParticle> &
cands,
75 const std::vector<uint8_t> &good)
const {
77 return (tk ==
nullptr ? std::pair<int, float>(-1, 9e9) :
match(*tk, cands, good));
81 const std::vector<reco::GenParticle> &
cands,
82 const std::vector<uint8_t> &good)
const {
83 std::pair<int, float> best(-1, 9e9);
87 for (
int i = 0,
n = cands.size();
i <
n; ++
i) {
90 std::pair<bool, float>
m =
match(tk, cands[i], invCov);
91 if (m.first && (m.second < best.second)) {
93 best.second = m.second;
100 const std::vector<reco::GenParticle> &
cands,
101 const std::vector<uint8_t> &good,
102 std::vector<std::pair<double, int> > &matchesToFill)
const {
105 matchMany(*tk, cands, good, matchesToFill);
109 const std::vector<reco::GenParticle> &
cands,
110 const std::vector<uint8_t> &good,
111 std::vector<std::pair<double, int> > &matchesToFill)
const {
114 for (
int i = 0,
n = cands.size();
i <
n; ++
i) {
117 std::pair<bool, double>
m =
match(tk, cands[i], invCov);
119 matchesToFill.push_back(std::make_pair(m.second, i));
121 std::sort(matchesToFill.begin(), matchesToFill.end());
147 for (
size_t i = 0;
i < 5; ++
i) {
148 for (
size_t j =
i + 1;
j < 5; ++
j) {
162 invCov.Place_at(momCov, 0, 0);
double qoverp() const
q / p
T getParameter(std::string const &) const
bool isNonnull() const
Checks for non-null.
virtual double vx() const =0
x coordinate of vertex position
double theta() const
polar angle
bool diagOnly_
Use only the diagonal terms of the covariance matrix.
~MatcherByPullsAlgorithm()
MatcherByPullsAlgorithm(const edm::ParameterSet &)
std::pair< bool, float > match(const reco::Track &tk, const reco::Candidate &mc, const AlgebraicSymMatrix55 &invertedCovariance) const
double phi() const
azimuthal angle of momentum vector
virtual double vy() const =0
y coordinate of vertex position
virtual reco::TrackRef standAloneMuon() const
reference to a stand-alone muon Track
double dsz() const
dsz parameter (THIS IS NOT the SZ impact parameter to (0,0,0) if refPoint is far from (0...
virtual reco::TrackRef track() const
reference to a Track
double dr2_
DeltaR of the matching cone.
bool useVertex_
Use also dxy / dsz in the matching.
double eta() const
pseudorapidity of momentum vector
CovarianceMatrix covariance() const
return track covariance matrix
void fillInvCov(const reco::Track &tk, AlgebraicSymMatrix55 &invCov) const
Fill the inverse covariance matrix for the match(track, candidate, invCov) method.
double pt() const
track transverse momentum
ROOT::Math::SVector< double, 5 > AlgebraicVector5
T const * get() const
Returns C++ pointer to the item.
double cut_
Cut on the pull.
virtual double p() const =0
magnitude of momentum vector
double vz() const
z coordinate of the reference point on track
virtual double theta() const =0
momentum polar angle
virtual double eta() const =0
momentum pseudorapidity
virtual double pt() const =0
transverse momentum
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
virtual int charge() const =0
electric charge
double vy() const
y coordinate of the reference point on track
TrackChoice track_
Track to be used in matching.
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
virtual const Point & vertex() const =0
vertex position
int charge() const
track electric charge
virtual double vz() const =0
z coordinate of vertex position
const reco::Track * track(const reco::RecoCandidate &src) const
Get track out of Candidate, NULL if missing.
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
virtual double phi() const =0
momentum azimuthal angle
void matchMany(const reco::RecoCandidate &src, const std::vector< reco::GenParticle > &cands, const std::vector< uint8_t > &good, std::vector< std::pair< double, int > > &matchesToFill) const
Power< A, B >::type pow(const A &a, const B &b)
double vx() const
x coordinate of the reference point on track
virtual reco::TrackRef combinedMuon() const
reference to a stand-alone muon Track