CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 = 0;
18  pVertex = 0;
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 = 0;
30  pVertex = 0;
31 }
32 
35  float totalChiSq, float degreesOfFr):
36  theState(state) ,
37  theChiSquared(totalChiSq),theNDF(degreesOfFr) , pVertex(prVertex)
38 {
39  vl = true;
40  tree = 0;
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==0) 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 
121  reco::Vertex vertex(reco::Vertex::Point(theState.position()),
122 // RecoVertex::convertError(theVertexState.error()),
123  theState.error().matrix_new(),
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 != 0) {
132  if ((ttt!=0) && (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!=0) && (ttt->persistentTrackRef().isNonnull())) {
139  vertex.add(reco::TrackBaseRef(tr), ttkp->refittedTransientTrack().track(), 1.);
140  }
141  }
142  }
143  }
144  return vertex;
145 }
146 
int i
Definition: DBlmapReader.cc:9
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
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:50
GlobalPoint position() const
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
virtual ~KinematicVertex()
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:55
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