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"))
23 else throw cms::Exception(
"Configuration") <<
"MatcherByPullsAlgorithm: track '"<<track<<
"' is not known\n" <<
24 "Allowed values are: 'track', 'combinedMuon', 'standAloneMuon' (as per reco::RecoCandidate object)\n";
46 double pull = ROOT::Math::Similarity(diff, invCov);
48 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;
49 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;
50 std::cout <<
"Delta: " << diff << std::endl;
52 for (
size_t i = 0;
i < 5; ++
i) {
58 for (
size_t i = 0;
i < 5; ++
i) {
63 std::cout <<
"Pull: " << pull << std::endl;
65 return std::pair<bool,float>(pull <
cut_, pull);
67 return std::pair<bool,float>(
false,9e9);
74 const std::vector<reco::GenParticle> &cands,
75 const std::vector<uint8_t> &good)
const 78 return (tk ==
nullptr ?
79 std::pair<int,float>(-1,9e9) :
80 match(*tk, cands, good));
85 const std::vector<reco::GenParticle> &cands,
86 const std::vector<uint8_t> &good)
const 88 std::pair<int,float> best(-1,9e9);
91 for (
int i = 0,
n = cands.size();
i <
n; ++
i) {
92 if (!good[
i])
continue;
93 std::pair<bool,float>
m =
match(tk, cands[i], invCov);
94 if (m.first && (m.second < best.second)) {
96 best.second = m.second;
104 const std::vector<reco::GenParticle> &cands,
105 const std::vector<uint8_t> &good,
106 std::vector<std::pair<double,int> > &matchesToFill)
const 109 if (tk !=
nullptr)
matchMany(*tk, cands, good, matchesToFill);
114 const std::vector<reco::GenParticle> &cands,
115 const std::vector<uint8_t> &good,
116 std::vector<std::pair<double,int> > &matchesToFill)
const 120 for (
int i = 0,
n = cands.size();
i <
n; ++
i) {
121 if (!good[
i])
continue;
122 std::pair<bool,double>
m =
match(tk, cands[i], invCov);
123 if (m.first) matchesToFill.push_back(std::make_pair(m.second,i));
125 std::sort(matchesToFill.begin(),matchesToFill.end());
152 for (
size_t i = 0;
i < 5; ++
i) {
for (
size_t j =
i+1; j < 5; ++j) {
159 if (
diagOnly_) { momCov(0,1) = 0; momCov(0,2) = 0; momCov(1,2) = 0; }
161 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
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
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
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
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
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
ROOT::Math::SVector< double, 5 > AlgebraicVector5
virtual double pt() const =0
transverse momentum
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
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.
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