RecoBTag
SecondaryVertex
src
TrackKinematics.cc
Go to the documentation of this file.
1
#include <cmath>
2
#include <vector>
3
4
#include <Math/GenVector/PxPyPzE4D.h>
5
#include <Math/GenVector/PxPyPzM4D.h>
6
7
#include "
DataFormats/BTauReco/interface/ParticleMasses.h
"
8
#include "
DataFormats/Math/interface/LorentzVector.h
"
9
#include "
DataFormats/TrackReco/interface/Track.h
"
10
#include "
DataFormats/VertexReco/interface/Vertex.h
"
11
12
#include "
RecoBTag/SecondaryVertex/interface/TrackKinematics.h
"
13
14
using namespace
reco
;
15
16
TrackKinematics::TrackKinematics
() :
n
(0), sumWeights(0) {}
17
18
TrackKinematics::TrackKinematics
(
const
std::vector<Track> &
tracks
) :
n
(0), sumWeights(0) {
19
for
(std::vector<Track>::const_iterator iter =
tracks
.begin(); iter !=
tracks
.end(); iter++)
20
add
(*iter);
21
}
22
23
TrackKinematics::TrackKinematics
(
const
TrackRefVector
&
tracks
) :
n
(0), sumWeights(0) {
24
for
(
TrackRefVector::const_iterator
iter =
tracks
.begin(); iter !=
tracks
.end(); iter++)
25
add
(**iter);
26
}
27
28
TrackKinematics::TrackKinematics
(
const
std::vector<CandidatePtr> &
tracks
) :
n
(0), sumWeights(0) {
29
for
(std::vector<CandidatePtr>::const_iterator iter =
tracks
.begin(); iter !=
tracks
.end(); iter++)
30
add
(*iter);
31
}
32
33
TrackKinematics::TrackKinematics
(
const
CandidatePtrVector
&
tracks
) :
n
(0), sumWeights(0) {
34
for
(
CandidatePtrVector::const_iterator
iter =
tracks
.begin(); iter !=
tracks
.end(); iter++)
35
add
(*iter);
36
}
37
38
TrackKinematics::TrackKinematics
(
const
Vertex
&
vertex
) :
n
(0), sumWeights(0) {
39
bool
hasRefittedTracks =
vertex
.hasRefittedTracks();
40
for
(
Vertex::trackRef_iterator
iter =
vertex
.tracks_begin(); iter !=
vertex
.tracks_end(); ++iter) {
41
if
(hasRefittedTracks)
42
add
(
vertex
.refittedTrack(*iter),
vertex
.trackWeight(*iter));
43
else
44
add
(**iter,
vertex
.trackWeight(*iter));
45
}
46
}
47
48
TrackKinematics
&
TrackKinematics::operator+=
(
const
TrackKinematics
&
other
) {
49
n
+=
other
.n;
50
sumWeights
+=
other
.sumWeights;
51
sum
+=
other
.sum;
52
weightedSum
+=
other
.weightedSum;
53
54
return
*
this
;
55
}
56
57
void
TrackKinematics::add
(
const
Track
&
track
,
double
weight
) {
58
ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> > vec;
59
60
vec.SetPx(
track
.px());
61
vec.SetPy(
track
.py());
62
vec.SetPz(
track
.pz());
63
vec.SetM(
ParticleMasses::piPlus
);
64
65
n
++;
66
sumWeights
+=
weight
;
67
sum
+= vec;
68
weightedSum
+=
weight
* vec;
69
}
70
71
void
TrackKinematics::add
(
const
CandidatePtr
&
track
) {
72
double
weight
= 1.0;
73
74
n
++;
75
sumWeights
+=
weight
;
76
sum
+=
track
->p4();
77
weightedSum
+=
weight
*
track
->p4();
78
}
reco::Vertex::trackRef_iterator
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
Definition:
Vertex.h:38
reco::TrackKinematics
Definition:
TrackKinematics.h:16
PDWG_EXOHSCP_cff.tracks
tracks
Definition:
PDWG_EXOHSCP_cff.py:28
reco::ParticleMasses::piPlus
const double piPlus
Definition:
ParticleMasses.h:9
HLT_FULL_cff.track
track
Definition:
HLT_FULL_cff.py:11713
dqmiodumpmetadata.n
n
Definition:
dqmiodumpmetadata.py:28
ParticleMasses.h
reco::TrackKinematics::TrackKinematics
TrackKinematics()
Definition:
TrackKinematics.cc:16
mps_merge.weight
weight
Definition:
mps_merge.py:88
edm::PtrVectorItr
Definition:
PtrVector.h:51
edm::RefVector< TrackCollection >
reco
fixed size matrix
Definition:
AlignmentAlgorithmBase.h:45
reco::TrackKinematics::operator+=
TrackKinematics & operator+=(const TrackKinematics &other)
Definition:
TrackKinematics.cc:48
Track.h
edm::PtrVector< Candidate >
reco::Track
Definition:
Track.h:27
trackingPlots.other
other
Definition:
trackingPlots.py:1467
Vertex.h
bphysicsOniaDQM_cfi.vertex
vertex
Definition:
bphysicsOniaDQM_cfi.py:7
LorentzVector.h
TrackKinematics.h
edm::Ptr< Candidate >
reco::TrackKinematics::sum
math::XYZTLorentzVector sum
Definition:
TrackKinematics.h:53
edm::RefVectorIterator
Definition:
EDProductfwd.h:33
reco::TrackKinematics::sumWeights
double sumWeights
Definition:
TrackKinematics.h:52
reco::TrackKinematics::n
unsigned int n
Definition:
TrackKinematics.h:51
reco::TrackKinematics::weightedSum
math::XYZTLorentzVector weightedSum
Definition:
TrackKinematics.h:54
weight
Definition:
weight.py:1
reco::Vertex
Definition:
Vertex.h:35
reco::TrackKinematics::add
void add(const reco::Track &track, double weight=1.0)
Definition:
TrackKinematics.cc:57
Generated for CMSSW Reference Manual by
1.8.16