Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

TrackMasterProjector.cpp

Go to the documentation of this file.
00001 // Include files 
00002 // -------------
00003 // from Gaudi
00004 #include "GaudiKernel/ToolFactory.h"
00005 
00006 // from TrackEvent
00007 #include "Event/State.h"
00008 #include "Event/Measurement.h"
00009 
00010 // local
00011 #include "TrackMasterProjector.h"
00012 
00013 //-----------------------------------------------------------------------------
00014 // Implementation file for class : TrackMasterProjector
00015 //
00016 // 2005-03-12 : Jose Hernando, Eduardo Rodrigues
00017 //-----------------------------------------------------------------------------
00018 
00019 // Declaration of the Tool Factory
00020 static const  ToolFactory<TrackMasterProjector>          s_factory ;
00021 const        IToolFactory& TrackMasterProjectorFactory = s_factory ;
00022 
00023 //=============================================================================
00024 //  Project a state onto a measurement.
00025 // It returns the chi squared of the projection
00026 //=============================================================================
00027 StatusCode TrackMasterProjector::project( const State& state, 
00028                                           Measurement& meas )
00029 {
00030   if ( meas.type() != m_selectedMeasType) {
00031     StatusCode sc = selectProjector( meas.type() );
00032     if ( sc.isFailure() )
00033       return Error( "Unable to project this measurement!" );
00034   }
00035 
00036   return m_selectedProjector -> project( state, meas );  
00037 }
00038 
00039 //=============================================================================
00040 // select the projector
00041 //=============================================================================
00042 StatusCode TrackMasterProjector::selectProjector
00043 ( const Measurement::Type& type ) 
00044 {
00045   if ( m_projectors.find(type) == m_projectors.end() ) {
00046     fatal() << "No TrackXxxProjector in TrackMasterProjector for this measurement of type = " << type << "!";
00047     return StatusCode::FAILURE;
00048   }
00049 
00050   m_selectedProjector = m_projectors[type];
00051   m_selectedMeasType  = type;
00052 
00053   return StatusCode::SUCCESS;
00054 }
00055 
00056 //=============================================================================
00057 // Retrieve the projection matrix H of the (last) projection
00058 //=============================================================================
00059 const HepVector& TrackMasterProjector::projectionMatrix() const
00060 {
00061   return m_selectedProjector -> projectionMatrix();
00062 }
00063 
00064 //=============================================================================
00065 // Retrieve the chi squared of the (last) projection
00066 //=============================================================================
00067 double TrackMasterProjector::chi2() const
00068 {
00069   return m_selectedProjector -> chi2();
00070 }
00071 
00072 //=============================================================================
00073 // Retrieve the residual of the (last) projection
00074 //=============================================================================
00075 double TrackMasterProjector::residual() const
00076 {
00077   return m_selectedProjector -> residual();
00078 }
00079 
00080 //=============================================================================
00081 // Retrieve the error on the residual of the (last) projection
00082 //=============================================================================
00083 double TrackMasterProjector::errResidual() const
00084 {
00085   return m_selectedProjector -> errResidual();
00086 }
00087 
00088 //=============================================================================
00089 // Initialize
00090 //=============================================================================
00091 StatusCode TrackMasterProjector::initialize()
00092 {
00093   StatusCode sc = GaudiTool::initialize();
00094   if ( sc.isFailure() )
00095     return Error( "Failed to initialize!", sc );
00096 
00097   m_projectors[Measurement::OT]      = tool<ITrackProjector>( m_OTProjName );
00098   m_projectors[Measurement::ST]      = tool<ITrackProjector>( m_ITProjName );
00099   m_projectors[Measurement::VeloR]   = tool<ITrackProjector>( m_VeloRProjName );
00100   m_projectors[Measurement::VeloPhi] = tool<ITrackProjector>( m_VeloPhiProjName );
00101 
00102   return StatusCode::SUCCESS;
00103 }
00104 
00105 //=============================================================================
00106 // Standard constructor, initializes variables
00107 //=============================================================================
00108 TrackMasterProjector::TrackMasterProjector( const std::string& type,
00109                                             const std::string& name,
00110                                             const IInterface* parent )
00111   : GaudiTool ( type, name , parent )
00112 {
00113   declareInterface<ITrackProjector>( this );
00114 
00115   declareProperty( "OTProjector",      m_OTProjName = "TrackOTProjector" );
00116   declareProperty( "ITProjector",      m_ITProjName = "TrackITProjector" );
00117   declareProperty( "VeloRProjector",   m_VeloRProjName = "TrackVeloRProjector" );
00118   declareProperty( "VeloPhiProjector", m_VeloPhiProjName = "TrackVeloPhiProjector" );
00119 
00120   m_projectors.clear();
00121   m_selectedProjector = NULL;
00122   m_selectedMeasType = Measurement::Unknown;
00123 }
00124 
00125 //=============================================================================
00126 // Destructor
00127 //=============================================================================
00128 TrackMasterProjector::~TrackMasterProjector() {}; 
00129 
00130 //=============================================================================

Generated on Mon Jul 4 13:54:29 2005 for New Track Event Model by doxygen 1.4.1