CMS 3D CMS Logo

KinematicVertex.cc
Go to the documentation of this file.
7 
9 
10 KinematicVertex::KinematicVertex(const VertexState state, float totalChiSq, float degreesOfFr)
11  : theState(state),
12  theChiSquared(totalChiSq),
13  theNDF(degreesOfFr)
14 
15 {
16  vl = true;
17  tree = nullptr;
18  pVertex = nullptr;
19 }
20 
22  // theVertexPosition = vertex.position();
23  // theVPositionError = vertex.error();
24  vl = true;
25  theState = VertexState(vertex.position(), vertex.error());
26  theChiSquared = vertex.totalChiSquared();
27  theNDF = vertex.degreesOfFreedom();
28  tree = nullptr;
29  pVertex = nullptr;
30 }
31 
34  float totalChiSq,
35  float degreesOfFr)
36  : theState(state), theChiSquared(totalChiSq), theNDF(degreesOfFr), pVertex(prVertex) {
37  vl = true;
38  tree = nullptr;
39 }
40 
42  bool res = false;
43  if (vertexIsValid() && other.vertexIsValid()) {
44  GlobalPoint cPos = this->position();
45  GlobalPoint oPos = other.position();
46  AlgebraicMatrix33 const& cCov = this->error().matrix();
47  AlgebraicMatrix33 const& oCov = other.error().matrix();
48  if ((cPos.x() == oPos.x()) && (cPos.y() == oPos.y()) && (cPos.z() == oPos.z()) && (cCov == oCov))
49  res = true;
50  } else if (!(vertexIsValid()) && !(other.vertexIsValid())) {
51  if (this == &other)
52  res = true;
53  }
54  return res;
55 }
56 
58  bool res = false;
59  if (*this == *other)
60  res = true;
61  return res;
62 }
63 
65  bool res = false;
66  if (this < &other)
67  res = true;
68  return res;
69 }
70 
71 bool KinematicVertex::vertexIsValid() const { return vl; }
72 
74 
76 
78 
79 float KinematicVertex::chiSquared() const { return theChiSquared; }
80 
81 float KinematicVertex::degreesOfFreedom() const { return theNDF; }
82 
84 
86 
88 
90 
92  //If the vertex is invalid, return an invalid TV !
93  if (!vertexIsValid() || tree == nullptr)
94  return reco::Vertex();
95 
96  //accessing the tree components, move pointer to top
97  if (!tree->findDecayVertex(this))
98  return reco::Vertex();
99  std::vector<RefCountedKinematicParticle> daughters = tree->daughterParticles();
100 
101  reco::Vertex vertex(reco::Vertex::Point(theState.position()),
102  // RecoVertex::convertError(theVertexState.error()),
103  theState.error().matrix(),
104  chiSquared(),
105  degreesOfFreedom(),
106  daughters.size());
107 
108  for (std::vector<RefCountedKinematicParticle>::const_iterator i = daughters.begin(); i != daughters.end(); ++i) {
109  const TransientTrackKinematicParticle* ttkp = dynamic_cast<const TransientTrackKinematicParticle*>(&(**i));
110  if (ttkp != nullptr) {
111  const reco::TrackTransientTrack* ttt =
112  dynamic_cast<const reco::TrackTransientTrack*>(ttkp->initialTransientTrack()->basicTransientTrack());
113  if ((ttt != nullptr) && (ttt->persistentTrackRef().isNonnull())) {
115  vertex.add(reco::TrackBaseRef(tr), ttkp->refittedTransientTrack().track(), 1.);
116  } else {
117  const reco::GsfTransientTrack* ttt =
118  dynamic_cast<const reco::GsfTransientTrack*>(ttkp->initialTransientTrack()->basicTransientTrack());
119  if ((ttt != nullptr) && (ttt->persistentTrackRef().isNonnull())) {
121  vertex.add(reco::TrackBaseRef(tr), ttkp->refittedTransientTrack().track(), 1.);
122  }
123  }
124  }
125  }
126  return vertex;
127 }
KinematicVertex::setTreePointer
void setTreePointer(KinematicTree *tr) const
Definition: KinematicVertex.cc:85
KinematicVertex::pVertex
ReferenceCountingPointer< KinematicVertex > pVertex
Definition: KinematicVertex.h:118
mps_fire.i
i
Definition: mps_fire.py:428
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
reco::GsfTransientTrack
Definition: GsfTransientTrack.h:18
KinematicVertex::vertexIsValid
bool vertexIsValid() const
Definition: KinematicVertex.cc:71
CachingVertex
Definition: CachingVertex.h:22
KinematicParticle::refittedTransientTrack
reco::TransientTrack refittedTransientTrack() const
Definition: KinematicParticle.cc:30
tree
Definition: tree.py:1
KinematicParticle.h
KinematicVertex::chiSquared
float chiSquared() const
Definition: KinematicVertex.cc:79
KinematicTree
Definition: KinematicTree.h:36
KinematicVertex::theChiSquared
float theChiSquared
Definition: KinematicVertex.h:116
GlobalErrorBase::matrix
const AlgebraicSymMatrix33 matrix() const
Definition: GlobalErrorBase.h:121
AlgebraicMatrix33
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepStd< double, 3, 3 > > AlgebraicMatrix33
Definition: AlgebraicROOTObjects.h:41
ReferenceCountingPointer< KinematicVertex >
edm::Ref< TrackCollection >
Utilities.operator
operator
Definition: Utilities.py:24
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
GsfTransientTrack.h
reco::TransientTrack::basicTransientTrack
const BasicTransientTrack * basicTransientTrack() const
Definition: TransientTrack.h:110
KinematicVertex::theNDF
float theNDF
Definition: KinematicVertex.h:117
KinematicVertex
Definition: KinematicVertex.h:20
BPhysicsValidation_cfi.daughters
daughters
Definition: BPhysicsValidation_cfi.py:11
KinematicVertex::vertexBeforeConstraint
ReferenceCountingPointer< KinematicVertex > vertexBeforeConstraint() const
Definition: KinematicVertex.cc:87
KinematicVertex::vl
bool vl
Definition: KinematicVertex.h:111
VertexState::error
GlobalError error() const
Definition: VertexState.h:64
KinematicVertex.h
trackingPlots.other
other
Definition: trackingPlots.py:1464
Point3DBase< float, GlobalTag >
KinematicTree.h
KinematicVertex::degreesOfFreedom
float degreesOfFreedom() const
Definition: KinematicVertex.cc:81
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
KinematicVertex::position
GlobalPoint position() const
Definition: KinematicVertex.cc:75
KinematicVertex::tree
KinematicTree * tree
Definition: KinematicVertex.h:110
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
TrackTransientTrack.h
GlobalErrorBase< double, ErrorMatrixTag >
reco::GsfTransientTrack::persistentTrackRef
GsfTrackRef persistentTrackRef() const
Definition: GsfTransientTrack.h:90
KinematicVertex::operator==
bool operator==(const KinematicVertex &other) const
Definition: KinematicVertex.cc:41
KinematicVertex::theState
VertexState theState
Definition: KinematicVertex.h:113
res
Definition: Electron.h:6
KinematicVertex::vertexState
VertexState vertexState() const
Definition: KinematicVertex.cc:89
reco::Vertex::Point
math::XYZPoint Point
point in the space
Definition: Vertex.h:40
HltBtagValidation_cff.Vertex
Vertex
Definition: HltBtagValidation_cff.py:32
KinematicVertex::KinematicVertex
KinematicVertex()
Definition: KinematicVertex.cc:8
reco::TransientTrack::track
const Track & track() const
Definition: TransientTrack.h:115
RunInfoPI::state
state
Definition: RunInfoPayloadInspectoHelper.h:16
KinematicVertex::error
GlobalError error() const
Definition: KinematicVertex.cc:77
VertexState
Definition: VertexState.h:13
edm::RefToBase< reco::Track >
VertexState::position
GlobalPoint position() const
Definition: VertexState.h:62
TransientTrackKinematicParticle
Definition: TransientTrackKinematicParticle.h:17
TransientTrackKinematicParticle.h
KinematicVertex::~KinematicVertex
~KinematicVertex() override
Definition: KinematicVertex.cc:73
reco::TrackTransientTrack
Definition: TrackTransientTrack.h:18
KinematicVertex::correspondingTree
KinematicTree * correspondingTree() const
Definition: KinematicVertex.cc:83
TransientTrackKinematicParticle::initialTransientTrack
const reco::TransientTrack * initialTransientTrack() const
Definition: TransientTrackKinematicParticle.cc:82
reco::Vertex
Definition: Vertex.h:35
reco::TrackTransientTrack::persistentTrackRef
TrackRef persistentTrackRef() const
Definition: TrackTransientTrack.h:78
KinematicVertex::operator<
bool operator<(const KinematicVertex &other) const
Definition: KinematicVertex.cc:64