00001 // $Id: TrackProjector.cpp,v 1.6 2005/05/26 09:34:41 cattanem 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 "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 // Dummy implementation of method, to please Windows linker 00026 //============================================================================= 00027 StatusCode TrackProjector::project( const State&, Measurement& ) 00028 { 00029 return StatusCode::FAILURE; 00030 } 00031 00032 //============================================================================= 00033 // Retrieve the projection matrix H of the (last) projection 00034 //============================================================================= 00035 const HepVector& TrackProjector::projectionMatrix() const 00036 { 00037 return m_H; 00038 } 00039 00040 //============================================================================= 00041 // Retrieve the chi squared of the (last) projection 00042 //============================================================================= 00043 double TrackProjector::chi2() const 00044 { 00045 return m_errResidual != 0 ? (m_residual/m_errResidual)*(m_residual/m_errResidual) : 0.; 00046 } 00047 00048 //============================================================================= 00049 // Retrieve the residual of the (last) projection 00050 //============================================================================= 00051 double TrackProjector::residual() const 00052 { 00053 return m_residual; 00054 } 00055 00056 //============================================================================= 00057 // Retrieve the error on the residual of the (last) projection 00058 //============================================================================= 00059 double TrackProjector::errResidual() const 00060 { 00061 return m_errResidual; 00062 } 00063 00064 //============================================================================= 00065 // Standard constructor, initializes variables 00066 //============================================================================= 00067 TrackProjector::TrackProjector( const std::string& type, 00068 const std::string& name, 00069 const IInterface* parent ) 00070 : GaudiTool ( type, name , parent ) 00071 , m_H() 00072 { 00073 declareInterface<ITrackProjector>( this ); 00074 m_residual = 0.; 00075 m_errResidual = 0.; 00076 m_H = HepVector(5,0); 00077 } 00078 00079 //============================================================================= 00080 // Destructor 00081 //============================================================================= 00082 TrackProjector::~TrackProjector() {}; 00083 00084 //============================================================================= 00085 00086 //============================================================================= 00087 // Compute the residual 00088 //============================================================================= 00089 void TrackProjector::computeResidual(const State& state, 00090 const Measurement& meas) 00091 { 00092 m_residual = meas.measure() - dot( m_H, state.stateVector() ); 00093 } 00094 00095 //============================================================================= 00096 // Compute the error on the residual 00097 //============================================================================= 00098 void TrackProjector::computeErrorResidual( const State& state, 00099 const Measurement& meas ) 00100 { 00101 double error = meas.errMeasure(); 00102 const HepSymMatrix& C = state.covariance(); 00103 double resError = error * error + C.similarity( m_H ); 00104 m_errResidual = sqrt( resError ); 00105 }