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;
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) {
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 {
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());
134 return muon.standAloneMuon().isNonnull() ?
muon.standAloneMuon().get() :
nullptr;
136 return muon.combinedMuon().isNonnull() ?
muon.combinedMuon().get() :
nullptr;
138 return muon.track().isNonnull() ?
muon.track().get() :
nullptr;
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
void fillInvCov(const reco::Track &tk, AlgebraicSymMatrix55 &invCov) const
Fill the inverse covariance matrix for the match(track, candidate, invCov) method.
double vx() const
x coordinate of the reference point on track
bool diagOnly_
Use only the diagonal terms of the covariance matrix.
~MatcherByPullsAlgorithm()
MatcherByPullsAlgorithm(const edm::ParameterSet &)
const reco::Track * track(const reco::RecoCandidate &src) const
Get track out of Candidate, NULL if missing.
double dsz() const
dsz parameter (THIS IS NOT the SZ impact parameter to (0,0,0) if refPoint is far from (0...
double dr2_
DeltaR of the matching cone.
double pt() const
track transverse momentum
bool useVertex_
Use also dxy / dsz in the matching.
int charge() const
track electric charge
CovarianceMatrix covariance() const
return track covariance matrix
double vz() const
z coordinate of the reference point on track
std::pair< bool, float > match(const reco::Track &tk, const reco::Candidate &mc, const AlgebraicSymMatrix55 &invertedCovariance) const
ROOT::Math::SVector< double, 5 > AlgebraicVector5
double phi() const
azimuthal angle of momentum vector
double cut_
Cut on the pull.
double eta() const
pseudorapidity of momentum vector
auto const good
min quality of good
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
double theta() const
polar angle
TrackChoice track_
Track to be used in matching.
double vy() const
y coordinate of the reference point on track
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
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
Power< A, B >::type pow(const A &a, const B &b)
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...