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   // TODO: change the measurement to get the type, 
00030   // selectProjector(meas.type());
00031   StatusCode sc = StatusCode::SUCCESS;
00032   if ( Measurement::OT != m_selectedMeasType) 
00033     sc = selectProjector( Measurement::OT );
00034   if (sc.isFailure()) return Warning(" Not able to select projector");
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     return Warning(" No ITrackProjector in TrackMasterProjector for measurement type ");
00047   m_selectedProjector = m_projectors[type];
00048   m_selectedMeasType  = type;    
00049   return StatusCode::SUCCESS;
00050 }
00051 
00052 //=============================================================================
00053 // Retrieve the projection matrix H of the (last) projection
00054 //=============================================================================
00055 const HepVector& TrackMasterProjector::projectionMatrix() const
00056 {
00057   return m_selectedProjector->projectionMatrix();
00058 }
00059 
00060 //=============================================================================
00061 // Retrieve the chi squared of the (last) projection
00062 //=============================================================================
00063 double TrackMasterProjector::chi2() const
00064 {
00065   return m_selectedProjector -> chi2();
00066 }
00067 
00068 //=============================================================================
00069 // Retrieve the residual of the (last) projection
00070 //=============================================================================
00071 double TrackMasterProjector::residual() const
00072 {
00073   return m_selectedProjector -> residual();
00074 }
00075 
00076 //=============================================================================
00077 // Retrieve the error on the residual of the (last) projection
00078 //=============================================================================
00079 double TrackMasterProjector::errResidual() const
00080 {
00081   return m_selectedProjector -> errResidual();
00082 }
00083 
00084 //=============================================================================
00085 // Initialize
00086 //=============================================================================
00087 StatusCode TrackMasterProjector::initialize()
00088 {
00089   StatusCode sc = GaudiTool::initialize();
00090   if ( sc.isFailure() )
00091     return Error( "Failed to initialize!", sc );
00092 
00093   m_projectors[Measurement::OT]      = tool<ITrackProjector>( m_OTProjName );
00094   m_projectors[Measurement::ST]      = tool<ITrackProjector>( m_ITProjName );
00095   m_projectors[Measurement::VeloR]   = tool<ITrackProjector>( m_VeloRProjName );
00096   m_projectors[Measurement::VeloPhi] = tool<ITrackProjector>( m_VeloPhiProjName );
00097 
00098   return StatusCode::SUCCESS;
00099 }
00100 
00101 //=============================================================================
00102 // Standard constructor, initializes variables
00103 //=============================================================================
00104 TrackMasterProjector::TrackMasterProjector( const std::string& type,
00105                                             const std::string& name,
00106                                             const IInterface* parent )
00107   : GaudiTool ( type, name , parent )
00108 {
00109   declareInterface<ITrackProjector>( this );
00110 
00111   declareProperty( "OTProjector",      m_OTProjName = "TrackOTProjector" );
00112   declareProperty( "ITProjector",      m_ITProjName = "TrackITProjector" );
00113   declareProperty( "VeloRProjector",   m_VeloRProjName = "TrackVeloRProjector" );
00114   declareProperty( "VeloPhiProjector", m_VeloPhiProjName = "TrackVeloPhiProjector" );
00115 
00116   m_projectors.clear();
00117   m_selectedProjector = NULL;
00118   // TODO: set a unknown measurement type in Measurement
00119   m_selectedMeasType = Measurement::OT;
00120 }
00121 
00122 //=============================================================================
00123 // Destructor
00124 //=============================================================================
00125 TrackMasterProjector::~TrackMasterProjector() {}; 
00126 
00127 //=============================================================================

Generated on Fri May 27 13:59:37 2005 for New Track Event Model by doxygen 1.4.1