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.2 2005/03/16 14:10:05 hernando 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 -> state();
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 ) {
00057     m_F[0][2] = dz; // tx*dz
00058     m_F[1][3] = dz; // ty*dz
00059     // extrapolate
00060     //extrapolate(state);
00061     //state -> setZ( zNew );
00062     updateState( state, zNew );
00063   }
00064 
00065   debug() << " z propagation " << zNew 
00066           << " of particle pid " << pid.pid() << endreq;
00067 
00068   return StatusCode::SUCCESS;
00069 }
00070 
00071 //=============================================================================
00072 // Propagate a State to the intersection point with a given plane
00073 //=============================================================================
00074 StatusCode TrackLinearExtrapolator::propagate( State& state,
00075                                             HepPlane3D& plane,
00076                                             ParticleID pid )
00077 {
00078   // calculation of the z-position by linear extrapolation to the plane
00079   // ------------------------------------------------------------------
00080   // given the plane defined by (a,b,c,d) and the input state of
00081   // position (x0,y0,z0) and slopes (Tx,Ty),
00082   // the (x,y,z) of the intersection point verify the set of equations
00083   //    a*x + b*y + c*z + d = 0
00084   //    x = x0 + (z-z0)*Tx
00085   //    x = y0 + (z-z0)*Ty
00086   HepNormal3D nVec   = plane.normal();
00087   HepPoint3D  posVec = state.position();
00088   HepVector3D slpVec = state.slopes();
00089 
00090   double den = nVec.dot( slpVec );
00091 
00092   if ( den < TrackParameters::looseTolerance ) return StatusCode::FAILURE;
00093 
00094   slpVec *= ( state.z() );
00095   posVec -= slpVec;
00096   
00097   double nom = - ( nVec.dot( posVec ) + plane.d() );
00098   
00099   double zNew = nom / den;
00100 
00101   debug() << " z propagation " << zNew 
00102           << " of particle pid " << pid.pid() << endreq;
00103 
00104   return propagate( state, zNew, pid );
00105 }
00106 
00107 //=============================================================================
00108 // Standard constructor, initializes variables
00109 //=============================================================================
00110 TrackLinearExtrapolator::TrackLinearExtrapolator(const std::string& type,
00111                                                  const std::string& name,
00112                                                  const IInterface* parent )
00113   : TrackExtrapolator ( type, name, parent )
00114   , m_F()
00115 {
00116   //declareInterface<ITrackExtrapolator>( this );
00117 
00118   // create transport matrix
00119   m_F = HepMatrix(5, 5, 1);
00120 }
00121 
00122 //=============================================================================
00123 // Destructor
00124 //=============================================================================
00125 TrackLinearExtrapolator::~TrackLinearExtrapolator() {};

Generated on Thu Apr 7 22:43:27 2005 for New Track Event Model by doxygen 1.4.1