CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
GetLineCovMatrix Class Reference

#include <GetLineCovMatrix.h>

Public Member Functions

 GetLineCovMatrix (GlobalPoint, GlobalPoint, GlobalError, GlobalError)
 
GlobalError GetMatrix (GlobalPoint)
 
 ~GetLineCovMatrix ()
 

Private Attributes

CLHEP::HepMatrix B
 
CLHEP::HepMatrix CombinedErrorMatrix
 
GlobalPoint PointOne
 
GlobalPoint PointTwo
 

Detailed Description

Definition at line 12 of file GetLineCovMatrix.h.

Constructor & Destructor Documentation

GetLineCovMatrix::GetLineCovMatrix ( GlobalPoint  pointOne,
GlobalPoint  pointTwo,
GlobalError  ErrorOne,
GlobalError  ErrorTwo 
)

Definition at line 4 of file GetLineCovMatrix.cc.

References CombinedErrorMatrix, GlobalErrorBase< T, ErrorWeightType >::cxx(), GlobalErrorBase< T, ErrorWeightType >::cyx(), GlobalErrorBase< T, ErrorWeightType >::cyy(), GlobalErrorBase< T, ErrorWeightType >::czx(), GlobalErrorBase< T, ErrorWeightType >::czy(), GlobalErrorBase< T, ErrorWeightType >::czz(), PointOne, and PointTwo.

5 {
6 
7  PointOne = pointOne;
8  PointTwo = pointTwo;
9 
10  CombinedErrorMatrix = CLHEP::HepMatrix(6, 6, 0);
11 
12  CombinedErrorMatrix[0][0] = ErrorOne.cxx();
13  CombinedErrorMatrix[1][0] = ErrorOne.cyx();
14  CombinedErrorMatrix[0][1] = ErrorOne.cyx();
15  CombinedErrorMatrix[1][1] = ErrorOne.cyy();
16  CombinedErrorMatrix[2][0] = ErrorOne.czx();
17  CombinedErrorMatrix[0][2] = ErrorOne.czx();
18  CombinedErrorMatrix[2][1] = ErrorOne.czy();
19  CombinedErrorMatrix[1][2] = ErrorOne.czy();
20  CombinedErrorMatrix[2][2] = ErrorOne.czz();
21 
22  CombinedErrorMatrix[3][3] = ErrorTwo.cxx();
23  CombinedErrorMatrix[4][3] = ErrorTwo.cyx();
24  CombinedErrorMatrix[3][4] = ErrorTwo.cyx();
25  CombinedErrorMatrix[4][4] = ErrorTwo.cyy();
26  CombinedErrorMatrix[5][3] = ErrorTwo.czx();
27  CombinedErrorMatrix[3][5] = ErrorTwo.czx();
28  CombinedErrorMatrix[5][4] = ErrorTwo.czy();
29  CombinedErrorMatrix[4][5] = ErrorTwo.czy();
30  CombinedErrorMatrix[5][5] = ErrorTwo.czz();
31 
32  B = CLHEP::HepMatrix(3, 6, 0);
33 }
GlobalPoint PointTwo
GlobalPoint PointOne
CLHEP::HepMatrix CombinedErrorMatrix
GetLineCovMatrix::~GetLineCovMatrix ( )
inline

Definition at line 18 of file GetLineCovMatrix.h.

18 {}

Member Function Documentation

GlobalError GetLineCovMatrix::GetMatrix ( GlobalPoint  PointThree)

Definition at line 36 of file GetLineCovMatrix.cc.

References CombinedErrorMatrix, PointOne, PointTwo, alignCSCRings::s, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by AddTvTrack::getSecondaryVertices().

37 {
38  // the linear equation is K = PointOne + (PointTwo-PointOne)*s
39  double s;
40  if( !(fabs(PointTwo.x() - PointOne.x()) < 0.00000001) )
41  s = (PointThree.x() - PointOne.x()) / (PointTwo.x() - PointOne.x()) ;
42  else {
43  if( !(fabs(PointTwo.y() - PointOne.y()) < 0.00000001) )
44  s = (PointThree.y() - PointOne.y()) / (PointTwo.y() - PointOne.y()) ;
45  else {
46  if( !(fabs(PointTwo.z() - PointOne.z()) < 0.00000001) )
47  s = (PointThree.z() - PointOne.z()) / (PointTwo.z() - PointOne.z()) ;
48  else {
49  GlobalError EmptyError(0, 0, 0, 0, 0, 0);
50  return EmptyError;
51  }
52  }
53  }
54 
55  B[0][0] = 1-s;
56  B[0][3] = s;
57  B[1][1] = 1-s;
58  B[1][4] = s;
59  B[2][2] = 1-s;
60  B[2][5] = s;
61 
62  CLHEP::HepMatrix Result = B * CombinedErrorMatrix * B.T();
63 
64  GlobalError TheGlobalError( Result[0][0], Result[1][0], Result[1][1], Result[2][0], Result[2][1], Result[2][2] );
65  return TheGlobalError;
66 }
T y() const
Definition: PV3DBase.h:63
GlobalPoint PointTwo
T z() const
Definition: PV3DBase.h:64
GlobalPoint PointOne
CLHEP::HepMatrix CombinedErrorMatrix
T x() const
Definition: PV3DBase.h:62

Member Data Documentation

CLHEP::HepMatrix GetLineCovMatrix::B
private

Definition at line 27 of file GetLineCovMatrix.h.

CLHEP::HepMatrix GetLineCovMatrix::CombinedErrorMatrix
private

Definition at line 26 of file GetLineCovMatrix.h.

Referenced by GetLineCovMatrix(), and GetMatrix().

GlobalPoint GetLineCovMatrix::PointOne
private

Definition at line 24 of file GetLineCovMatrix.h.

Referenced by GetLineCovMatrix(), and GetMatrix().

GlobalPoint GetLineCovMatrix::PointTwo
private

Definition at line 25 of file GetLineCovMatrix.h.

Referenced by GetLineCovMatrix(), and GetMatrix().