00001 // $Id: TrackProjector.cpp,v 1.3 2005/04/13 16:54:13 erodrigu Exp $ 00002 // Include files 00003 00004 // from Gaudi 00005 #include "GaudiKernel/ToolFactory.h" 00006 00007 // from TrackEvent 00008 #include "Event/State.h" 00009 #include "Event/Measurement.h" 00010 00011 // local 00012 #include "TrackProjectors/TrackProjector.h" 00013 00014 //----------------------------------------------------------------------------- 00015 // Implementation file for class : TrackProjector 00016 // 00017 // 2005-03-10 : Jose Hernando, Eduardo Rodrigues 00018 //----------------------------------------------------------------------------- 00019 00020 // Declaration of the Tool Factory 00021 static const ToolFactory<TrackProjector> s_factory ; 00022 const IToolFactory& TrackProjectorFactory = s_factory ; 00023 00024 //============================================================================= 00025 // Retrieve the projection matrix H of the (last) projection 00026 //============================================================================= 00027 const HepVector& TrackProjector::projectionMatrix() const 00028 { 00029 return m_H; 00030 } 00031 00032 //============================================================================= 00033 // Retrieve the chi squared of the (last) projection 00034 //============================================================================= 00035 double TrackProjector::chi2() const 00036 { 00037 return m_errResidual != 0 ? (m_residual/m_errResidual)*(m_residual/m_errResidual) : 0.; 00038 } 00039 00040 //============================================================================= 00041 // Retrieve the residual of the (last) projection 00042 //============================================================================= 00043 double TrackProjector::residual() const 00044 { 00045 return m_residual; 00046 } 00047 00048 //============================================================================= 00049 // Retrieve the error on the residual of the (last) projection 00050 //============================================================================= 00051 double TrackProjector::errResidual() const 00052 { 00053 return m_errResidual; 00054 } 00055 00056 //============================================================================= 00057 // Standard constructor, initializes variables 00058 //============================================================================= 00059 TrackProjector::TrackProjector( const std::string& type, 00060 const std::string& name, 00061 const IInterface* parent ) 00062 : GaudiTool ( type, name , parent ) 00063 , m_H() 00064 { 00065 declareInterface<ITrackProjector>( this ); 00066 m_residual = 0.; 00067 m_errResidual = 0.; 00068 m_H = HepVector(5,0); 00069 } 00070 00071 //============================================================================= 00072 // Destructor 00073 //============================================================================= 00074 TrackProjector::~TrackProjector() {}; 00075 00076 //============================================================================= 00077 00078 //============================================================================= 00079 // Compute the residual 00080 //============================================================================= 00081 void TrackProjector::computeResidual(const State& state, 00082 const Measurement& meas) 00083 { 00084 m_residual = meas.measure() - dot( m_H, state.state() ); 00085 } 00086 00087 //============================================================================= 00088 // Compute the error on the residual 00089 //============================================================================= 00090 void TrackProjector::computeErrorResidual( const State& state, 00091 const Measurement& meas ) 00092 { 00093 double error = meas.errMeasure(); 00094 const HepSymMatrix& C = state.covariance(); 00095 double resError = error * error + C.similarity( m_H ); 00096 m_errResidual = sqrt( resError ); 00097 }