CMS 3D CMS Logo

Public Member Functions | Private Attributes

GetLineCovMatrix Class Reference

#include <GetLineCovMatrix.h>

List of all members.

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.

{

  PointOne = pointOne;
  PointTwo = pointTwo;

  CombinedErrorMatrix = CLHEP::HepMatrix(6, 6, 0);
 
  CombinedErrorMatrix[0][0] = ErrorOne.cxx();
  CombinedErrorMatrix[1][0] = ErrorOne.cyx(); 
  CombinedErrorMatrix[0][1] = ErrorOne.cyx();
  CombinedErrorMatrix[1][1] = ErrorOne.cyy();
  CombinedErrorMatrix[2][0] = ErrorOne.czx();
  CombinedErrorMatrix[0][2] = ErrorOne.czx(); 
  CombinedErrorMatrix[2][1] = ErrorOne.czy();
  CombinedErrorMatrix[1][2] = ErrorOne.czy(); 
  CombinedErrorMatrix[2][2] = ErrorOne.czz();
    
  CombinedErrorMatrix[3][3] = ErrorTwo.cxx();
  CombinedErrorMatrix[4][3] = ErrorTwo.cyx(); 
  CombinedErrorMatrix[3][4] = ErrorTwo.cyx();
  CombinedErrorMatrix[4][4] = ErrorTwo.cyy();
  CombinedErrorMatrix[5][3] = ErrorTwo.czx();
  CombinedErrorMatrix[3][5] = ErrorTwo.czx(); 
  CombinedErrorMatrix[5][4] = ErrorTwo.czy();
  CombinedErrorMatrix[4][5] = ErrorTwo.czy(); 
  CombinedErrorMatrix[5][5] = ErrorTwo.czz();

  B = CLHEP::HepMatrix(3, 6, 0);  
}
GetLineCovMatrix::~GetLineCovMatrix ( ) [inline]

Definition at line 18 of file GetLineCovMatrix.h.

{}

Member Function Documentation

GlobalError GetLineCovMatrix::GetMatrix ( GlobalPoint  PointThree)

Definition at line 36 of file GetLineCovMatrix.cc.

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

{ 
  // the linear equation is  K = PointOne + (PointTwo-PointOne)*s
  double s;  
  if( !fabs(PointTwo.x() - PointOne.x()) < 0.00000001 ) 
    s =  (PointThree.x() - PointOne.x()) / (PointTwo.x() -  PointOne.x()) ; 
  else {
    if( !fabs(PointTwo.y() - PointOne.y()) < 0.00000001 ) 
      s =  (PointThree.y() - PointOne.y()) / (PointTwo.y() -  PointOne.y()) ;   
    else { 
      if( !fabs(PointTwo.z() - PointOne.z()) < 0.00000001 ) 
        s =  (PointThree.z() - PointOne.z()) / (PointTwo.z() -  PointOne.z()) ;
      else {
        GlobalError EmptyError(0, 0, 0, 0, 0, 0);
        return EmptyError;
      }
    }
  }

  B[0][0] = 1-s;    
  B[0][3] = s;
  B[1][1] = 1-s;   
  B[1][4] = s;
  B[2][2] = 1-s;  
  B[2][5] = s;

  CLHEP::HepMatrix Result = B * CombinedErrorMatrix * B.T();
  
  GlobalError TheGlobalError( Result[0][0],  Result[1][0],  Result[1][1], Result[2][0],  Result[2][1],  Result[2][2] );
  return TheGlobalError;
}

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().

Definition at line 24 of file GetLineCovMatrix.h.

Referenced by GetLineCovMatrix(), and GetMatrix().

Definition at line 25 of file GetLineCovMatrix.h.

Referenced by GetLineCovMatrix(), and GetMatrix().