CMS 3D CMS Logo

KinematicVertex.cc
Go to the documentation of this file.
7 
9 {vl = false;}
10 
11 KinematicVertex::KinematicVertex(const VertexState state, float totalChiSq,
12  float degreesOfFr):
13  theState(state),theChiSquared(totalChiSq),theNDF(degreesOfFr)
14 
15 {
16  vl = true;
17  tree = nullptr;
18  pVertex = nullptr;
19 }
20 
22 {
23 // theVertexPosition = vertex.position();
24 // theVPositionError = vertex.error();
25  vl = true;
26  theState = VertexState(vertex.position(), vertex.error());
27  theChiSquared = vertex.totalChiSquared();
28  theNDF = vertex.degreesOfFreedom();
29  tree = nullptr;
30  pVertex = nullptr;
31 }
32 
35  float totalChiSq, float degreesOfFr):
36  theState(state) ,
37  theChiSquared(totalChiSq),theNDF(degreesOfFr) , pVertex(prVertex)
38 {
39  vl = true;
40  tree = nullptr;
41 }
42 
43 
44 
46 {
47  bool res = false;
48  if(vertexIsValid()&& other.vertexIsValid())
49  {
50  GlobalPoint cPos = this->position();
51  GlobalPoint oPos = other.position();
52  AlgebraicMatrix33 const & cCov = this->error().matrix();
53  AlgebraicMatrix33 const & oCov = other.error().matrix();
54  if((cPos.x()==oPos.x())&&(cPos.y()==oPos.y())&&(cPos.z()==oPos.z())
55  &&(cCov==oCov))
56  res = true;
57  }else if(!(vertexIsValid()) && !(other.vertexIsValid())){
58  if(this == &other) res = true;
59  }
60  return res;
61 }
62 
64 {
65  bool res = false;
66  if(*this == *other) res = true;
67  return res;
68 }
69 
70 
72 {
73  bool res = false;
74  if(this < &other) res=true;
75  return res;
76 }
77 
79 {return vl;}
80 
82 {}
83 
85 {
86  return theState.position();
87 }
88 
90 {
91  return theState.error();
92 }
93 
95 {return theChiSquared;}
96 
98 {return theNDF;}
99 
101 {return tree;}
102 
104 { tree = tr;}
105 
107 {return pVertex;}
108 
110 {return theState;}
111 
113 {
114  //If the vertex is invalid, return an invalid TV !
115  if (!vertexIsValid() || tree==nullptr) return reco::Vertex();
116 
117 //accessing the tree components, move pointer to top
118  if (!tree->findDecayVertex(this)) return reco::Vertex();
119  std::vector<RefCountedKinematicParticle> daughters = tree->daughterParticles();
120 
122 // RecoVertex::convertError(theVertexState.error()),
123  theState.error().matrix(),
124  chiSquared(), degreesOfFreedom(), daughters.size() );
125 
126  for (std::vector<RefCountedKinematicParticle>::const_iterator i = daughters.begin();
127  i != daughters.end(); ++i) {
128 
129  const TransientTrackKinematicParticle * ttkp = dynamic_cast<const TransientTrackKinematicParticle * >(&(**i));
130  if(ttkp != nullptr) {
132  if ((ttt!=nullptr) && (ttt->persistentTrackRef().isNonnull())) {
134  vertex.add(reco::TrackBaseRef(tr), ttkp->refittedTransientTrack().track(), 1.);
135  } else {
136  const reco::GsfTransientTrack * ttt = dynamic_cast<const reco::GsfTransientTrack*>(ttkp->initialTransientTrack()->basicTransientTrack());
137  if ((ttt!=nullptr) && (ttt->persistentTrackRef().isNonnull())) {
139  vertex.add(reco::TrackBaseRef(tr), ttkp->refittedTransientTrack().track(), 1.);
140  }
141  }
142  }
143  }
144  return vertex;
145 }
146 
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:253
const reco::TransientTrack * initialTransientTrack() const
float degreesOfFreedom() const
bool vertexIsValid() const
const AlgebraicSymMatrix33 matrix() const
T y() const
Definition: PV3DBase.h:63
void setTreePointer(KinematicTree *tr) const
GlobalPoint position() const
Definition: VertexState.h:69
GlobalPoint position() const
Definition: Electron.h:4
GlobalError error() const
TrackRef persistentTrackRef() const
ReferenceCountingPointer< KinematicVertex > vertexBeforeConstraint() const
VertexState theState
bool operator==(const KinematicVertex &other) const
T z() const
Definition: PV3DBase.h:64
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:74
~KinematicVertex() override
Definition: tree.py:1
GsfTrackRef persistentTrackRef() const
T x() const
Definition: PV3DBase.h:62
bool operator<(const KinematicVertex &other) const
GlobalError error() const
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepStd< double, 3, 3 > > AlgebraicMatrix33