test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
KVFHelper.cc
Go to the documentation of this file.
2 using namespace std;
3 
4 template <unsigned int N>
5 double KVFHelper<N>::vertexChi2(const CachingVertex<N> & vertexA,
6  const CachingVertex<N> & vertexB) const
7 {
8  return vertexChi2(vertexA.vertexState(), vertexB.vertexState());
9 }
10 
11 
12 template <unsigned int N>
13 double KVFHelper<N>::vertexChi2(const VertexState & vertexA,
14  const VertexState & vertexB) const
15 {
16 // std::cout <<"Start\n";
17  GlobalPoint inPosition = vertexA.position();
18  GlobalPoint fnPosition = vertexB.position();
19 // std::cout << inPosition<< fnPosition<<std::endl;
20 
21  AlgebraicVector3 oldVertexPositionV;
22  oldVertexPositionV(0) = inPosition.x();
23  oldVertexPositionV(1) = inPosition.y();
24  oldVertexPositionV(2) = inPosition.z();
25 
26  AlgebraicVector3 newVertexPositionV;
27  newVertexPositionV(0) = fnPosition.x();
28  newVertexPositionV(1) = fnPosition.y();
29  newVertexPositionV(2) = fnPosition.z();
30 
31 
32  AlgebraicVector3 positionResidual = newVertexPositionV - oldVertexPositionV;
33 
34  return ROOT::Math::Similarity(positionResidual, vertexA.weight().matrix());
35 }
36 
37 
38 template <unsigned int N>
40 {
41  return trackParameterChi2(track->linearizedTrack(), track->refittedState());
42 }
43 
44 
45 template <unsigned int N>
47  const RefCountedLinearizedTrackState linTrack,
48  const RefCountedRefittedTrackState refittedTrackState) const
49 {
50 
51  typedef ROOT::Math::SMatrix<double,N,N,ROOT::Math::MatRepSym<double,N> > AlgebraicSymMatrixNN;
52  typedef ROOT::Math::SVector<double,N> AlgebraicVectorN;
53 
54  AlgebraicVectorN parameterResiduals = linTrack->predictedStateParameters() -
55  linTrack->refittedParamFromEquation(refittedTrackState);
56  linTrack->checkParameters(parameterResiduals);
57  int error;
58  float lChi2 = ROOT::Math::Similarity(parameterResiduals, linTrack->predictedStateWeight(error));
59  if (error != 0) return BDpair(false, -1.);
60  return BDpair(true, lChi2);
61 }
62 
63 template class KVFHelper<5>;
64 template class KVFHelper<6>;
std::pair< bool, double > BDpair
Definition: KVFHelper.h:18
VertexState const & vertexState() const
const AlgebraicSymMatrix33 matrix() const
T y() const
Definition: PV3DBase.h:63
GlobalPoint position() const
Definition: VertexState.h:69
double vertexChi2(const VertexState &vertexA, const VertexState &VertexB) const
Definition: KVFHelper.cc:13
BDpair trackParameterChi2(const RefCountedLinearizedTrackState linTrack, const RefCountedRefittedTrackState refittedTrackState) const
Definition: KVFHelper.cc:46
T z() const
Definition: PV3DBase.h:64
ROOT::Math::SVector< double, 3 > AlgebraicVector3
GlobalWeight weight() const
Definition: VertexState.h:85
T x() const
Definition: PV3DBase.h:62