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

TrackLinearExtrapolator.cpp

Go to the documentation of this file.
00001 // $Id: TrackLinearExtrapolator.cpp,v 1.5 2005/06/29 13:46:18 erodrigu Exp $
00002 // Include files
00003 
00004 // from Gaudi
00005 #include "GaudiKernel/ToolFactory.h"
00006 
00007 // from TrEvent
00008 #include "Event/Track.h"
00009 #include "Event/State.h"
00010 #include "Event/TrackParameters.h"
00011 
00012 // local
00013 #include "TrackLinearExtrapolator.h"
00014 
00015 //-----------------------------------------------------------------------------
00016 // Implementation file for class : TrackLinearExtrapolator
00017 //
00018 // 2004-12-17 : Eduardo Rodrigues
00019 //-----------------------------------------------------------------------------
00020 
00021 // Declaration of the Tool Factory
00022 static const  ToolFactory<TrackLinearExtrapolator>          s_factory ;
00023 const        IToolFactory& TrackLinearExtrapolatorFactory = s_factory ;
00024 
00025 //=============================================================================
00026 // Extrapolate the State to z=zNew using the transport matrix  m_F
00027 // (i.e. it performs the mathematical calculation)
00028 //=============================================================================
00029 /*
00030 void TrackLinearExtrapolator::extrapolate( State* state ) const
00031 {
00032   // get reference to the State vector and covariance
00033   HepVector& tX = state -> stateVector();
00034   HepSymMatrix& tC = state -> covariance();
00035 
00036   // calculate new state
00037   tX = m_F * tX;           // X * F
00038   tC = tC.similarity(m_F); // F * C *F.T()
00039 }
00040 */
00041 
00042 //=============================================================================
00043 // Propagate a State to a given z-position
00044 //=============================================================================
00045 StatusCode TrackLinearExtrapolator::propagate( State& state,
00046                                                double zNew,
00047                                                ParticleID pid )
00048 {
00049   // create transport matrix
00050   unsigned int ndim = state.nParameters();
00051   
00052   m_F = HepMatrix(ndim, ndim, 1);
00053 
00054   // check current z-position
00055   double dz = zNew - state.z();
00056   // if ( fabs(dz) < TrackParameters::hiTolerance ) dz = 0.;
00057   m_F[0][2] = dz; // tx*dz
00058   m_F[1][3] = dz; // ty*dz
00059 
00060   debug() << "Transport matrix F =" << m_F << endreq;
00061   
00062   // extrapolate
00063   //extrapolate(state);
00064   //state -> setZ( zNew );
00065   updateState( state, zNew );
00066 
00067   debug() << " z propagation " << zNew
00068           << " propagated state " << state.stateVector()
00069           << " propagated cov   " << state.covariance()
00070           << " of particle pid " << pid.pid() << endreq;
00071 
00072   return StatusCode::SUCCESS;
00073 }
00074 
00075 //=============================================================================
00076 // Propagate a State to the intersection point with a given plane
00077 //=============================================================================
00078 StatusCode TrackLinearExtrapolator::propagate( State& state,
00079                                             HepPlane3D& plane,
00080                                             ParticleID pid )
00081 {
00082   // calculation of the z-position by linear extrapolation to the plane
00083   // ------------------------------------------------------------------
00084   // given the plane defined by (a,b,c,d) and the input state of
00085   // position (x0,y0,z0) and slopes (Tx,Ty),
00086   // the (x,y,z) of the intersection point verify the set of equations
00087   //    a*x + b*y + c*z + d = 0
00088   //    x = x0 + (z-z0)*Tx
00089   //    x = y0 + (z-z0)*Ty
00090   HepNormal3D nVec   = plane.normal();
00091   HepPoint3D  posVec = state.position();
00092   HepVector3D slpVec = state.slopes();
00093 
00094   double den = nVec.dot( slpVec );
00095 
00096   if ( den < TrackParameters::looseTolerance ) return StatusCode::FAILURE;
00097 
00098   slpVec *= ( state.z() );
00099   posVec -= slpVec;
00100   
00101   double nom = - ( nVec.dot( posVec ) + plane.d() );
00102   
00103   double zNew = nom / den;
00104 
00105   debug() << " z propagation " << zNew 
00106           << " of particle pid " << pid.pid() << endreq;
00107 
00108   return propagate( state, zNew, pid );
00109 }
00110 
00111 //=============================================================================
00112 // Standard constructor, initializes variables
00113 //=============================================================================
00114 TrackLinearExtrapolator::TrackLinearExtrapolator(const std::string& type,
00115                                                  const std::string& name,
00116                                                  const IInterface* parent )
00117   : TrackExtrapolator ( type, name, parent )
00118 {
00119   //declareInterface<ITrackExtrapolator>( this );
00120 }
00121 
00122 //=============================================================================
00123 // Destructor
00124 //=============================================================================
00125 TrackLinearExtrapolator::~TrackLinearExtrapolator() {};

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