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
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 != 0)
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 float eta() const =0
momentum pseudorapidity
double theta() const
polar angle
bool diagOnly_
Use only the diagonal terms of the covariance matrix.
~MatcherByPullsAlgorithm()
MatcherByPullsAlgorithm(const edm::ParameterSet &)
virtual double vx() const =0
x coordinate of vertex position
std::pair< bool, float > match(const reco::Track &tk, const reco::Candidate &mc, const AlgebraicSymMatrix55 &invertedCovariance) const
virtual float phi() const =0
momentum azimuthal angle
double phi() const
azimuthal angle of momentum vector
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
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 double vy() const =0
y coordinate of vertex position
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.
virtual double p() const =0
magnitude of momentum vector
virtual float pt() const =0
transverse momentum
double eta() const
pseudorapidity of momentum vector
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
virtual double theta() const =0
momentum polar angle
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
double deltaR2(const T1 &t1, const T2 &t2)
virtual const Point & vertex() const =0
vertex position
virtual int charge() const =0
electric charge
T const * get() const
Returns C++ pointer to the item.
double cut_
Cut on the pull.
double vz() const
z coordinate of the reference point on track
ROOT::Math::SVector< double, 5 > AlgebraicVector5
virtual double vz() const =0
z coordinate of vertex position
double vy() const
y coordinate of the reference point on track
TrackChoice track_
Track to be used in matching.
int charge() const
track electric charge
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...
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