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 
102  // RecoVertex::convertError(theVertexState.error()),
103  theState.error().matrix(),
104  chiSquared(),
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 =
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 }
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepStd< double, 3, 3 > > AlgebraicMatrix33
const reco::TransientTrack * initialTransientTrack() const
float degreesOfFreedom() const
bool vertexIsValid() const
const AlgebraicSymMatrix33 matrix() const
T y() const
Definition: PV3DBase.h:60
void setTreePointer(KinematicTree *tr) const
GlobalPoint position() const
Definition: VertexState.h:62
GlobalPoint position() const
Definition: Electron.h:6
GlobalError error() const
TrackRef persistentTrackRef() const
ReferenceCountingPointer< KinematicVertex > vertexBeforeConstraint() const
VertexState theState
bool operator==(const KinematicVertex &other) const
T z() const
Definition: PV3DBase.h:61
float totalChiSquared() const
math::XYZPoint Point
point in the space
Definition: Vertex.h:39
float degreesOfFreedom() const
KinematicTree * correspondingTree() const
ReferenceCountingPointer< KinematicVertex > pVertex
const BasicTransientTrack * basicTransientTrack() const
const Track & track() const
float chiSquared() const
VertexState vertexState() const
GlobalPoint position() const
KinematicTree * tree
reco::TransientTrack refittedTransientTrack() const
GlobalError error() const
Definition: VertexState.h:64
~KinematicVertex() override
Definition: tree.py:1
GsfTrackRef persistentTrackRef() const
T x() const
Definition: PV3DBase.h:59
bool operator<(const KinematicVertex &other) const
GlobalError error() const