Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

TrState Class Reference

#include <TrState.h>

List of all members.

Public Types

enum  Type { HasMomentum, StraightLine }
enum  Location {
  BegVelo, EndVelo, AtTT, AtT,
  BegRICH1, EndRICH1, BegRICH2, EndRICH2,
  Calo, Muon
}

Public Methods

 TrState ()
 Default constructor. State defined to be of type TrState::HasMomentum. More...

 TrState (const Type &type)
 Constructor with specification of the state type. More...

 TrState (const TrState &state)
 Copy constructor. More...

virtual ~TrState ()
 Destructor. More...

virtual const CLID & clID () const
 Retrieve pointer to class definition structure. More...

unsigned int nParameters () const
 Retrieve the number of state parameters. More...

void positionAndMomentum (HepPoint3D &pos, HepVector3D &mom, HepSymMatrix &cov6D)
 Retrieve the position and momentum vectors and the corresponding 6D covariance matrix (pos:1->3,mom:4-6) of the state. More...

HepPoint3D position ()
 Retrieve the 3D-position vector of the state. More...

double x () const
 Retrieve the x-position of the state. More...

double y () const
 Retrieve the y-position of the state. More...

double z () const
 Retrieve the z-position of the state. More...

HepVector3D slopes () const
 Retrieve the slopes (Tx=dx/dz,Ty=dy/dz,1.) of the state. More...

double tx () const
 Retrieve the Tx=dx/dz slope of the state. More...

double ty () const
 Retrieve the Ty=dy/dz slope of the state. More...

virtual double qOverP () const
 Retrieve the charge-over-momentum Q/P of the state. More...

virtual double p () const
 Retrieve the momentum of the state. More...

virtual double pt () const
 Retrieve the transverse momentum of the state. More...

HepVector3D momentum () const
 Retrieve the momentum vector of the state. More...

double qOverPperp () const
 Retrieve the Q/Pperp (ratio of the charge to the component of the momentum transverse to the magnetic field) of the state. More...

virtual HepSymMatrix posMomCovariance () const
 Retrieve the 6D covariance matrix (x,y,z,px,py,pz) of the state. More...

HepSymMatrix errPosition () const
 Retrieve the errors on the 3D-position vector of the state. More...

double errX2 () const
 Retrieve the squared error on the x-position of the state. More...

double errY2 () const
 Retrieve the squared error on the y-position of the state. More...

HepSymMatrix errSlopes () const
 Retrieve the errors on the slopes of the state. More...

double errTx2 () const
 Retrieve the squared error on the x-slope Tx=dx/dz of the state. More...

double errTy2 () const
 Retrieve the squared error on the y-slope Ty=dy/dz of the state. More...

virtual double errQOverP2 () const
 Retrieve the squared error on the charge-over-momentum Q/P of the state. More...

virtual double errP2 () const
 Retrieve the squared error on the momentum of the state. More...

HepSymMatrix errMomentum () const
 Retrieve the errors on the momentum vector of the state. More...

virtual double errQOverPperp2 () const
 Retrieve the squared error on the Q/Pperp of the state. More...

virtual TrState * clone ()
 Clone the state. More...

virtual void reset ()
 Clear the state before re-using it. More...

void setState (const HepVector &state)
 Update the state vector. More...

virtual void setState (double x, double y, double z, double tx, double ty, double qOverP)
 Update the state vector (presumably of type TrState::HasMomentum). More...

void setState (double x, double y, double z, double tx, double ty)
 Update the state vector (presumably of type TrState::StraightLine). More...

void setCovariance (const HepSymMatrix &value)
 Update the state covariance. More...

void setX (double value)
 Update the x-position of the state. More...

void setY (double value)
 Update the y-position of the state. More...

void setTx (double value)
 Update the Tx slope of the state. More...

void setTy (double value)
 Update the Ty slope of the state. More...

virtual void setQOverP (double value)
 Update the Q/P value of the state. More...

unsigned int type () const
 Retrieve the type of the state. More...

unsigned int location () const
 Retrieve the location of the state. More...

void setLocation (unsigned int value)
 Update the location of the state. More...

const HepVector & state () const
 Retrieve the state vector. More...

HepVector & state ()
 Retrieve the state vector (non-const). More...

const HepSymMatrix & covariance () const
 Retrieve the state covariance matrix (indexes 1,...,5 for x, y, tx, ty, Q/p). More...

HepSymMatrix & covariance ()
 Retrieve the state covariance matrix (indexes 1,...,5 for x, y, tx, ty, Q/p) (non-const). More...

virtual StreamBuffer & serialize (StreamBuffer &s) const
 Serialize the object for writing. More...

virtual StreamBuffer & serialize (StreamBuffer &s)
 Serialize the object for reading. More...

virtual std::ostream & fillStream (std::ostream &s) const
 Fill the ASCII output stream. More...


Static Public Methods

const CLID & classID ()

Private Attributes

unsigned int m_type
 the type of the state. More...

unsigned int m_location
 the location of the state. More...

HepVector m_state
 the state vector. More...

HepSymMatrix m_covariance
 the state covariance matrix (indexes 1,...,5 for x, y, tx, ty, Q/p). More...

double m_z
 the z-position of the state. More...


Detailed Description

TrState is the base class of offline and online track states.

Author:
Jose Hernando, Eduardo Rodrigues created Mon Nov 1 17:21:47 2004

Definition at line 51 of file TrState.h.


Member Enumeration Documentation

enum TrState::Location
 

Enumeration values:
BegVelo 
EndVelo 
AtTT 
AtT 
BegRICH1 
EndRICH1 
BegRICH2 
EndRICH2 
Calo 
Muon 

Definition at line 57 of file TrState.h.

enum TrState::Type
 

Enumeration values:
HasMomentum 
StraightLine 

Definition at line 56 of file TrState.h.


Constructor & Destructor Documentation

TrState::TrState  
 

Default constructor. State defined to be of type TrState::HasMomentum.

Definition at line 16 of file TrState.cpp.

References HasMomentum, m_covariance, m_state, m_type, and m_z.

Referenced by clone.

00016                  {
00017   m_type       = TrState::HasMomentum;
00018   m_z          = 0.;
00019   m_state      = HepVector(5,0);
00020   m_covariance = HepSymMatrix(5,0);
00021 }

TrState::TrState const Type   type
 

Constructor with specification of the state type.

Definition at line 26 of file TrState.cpp.

References m_covariance, m_state, m_type, m_z, and type.

00026                                   :
00027   KeyedObject<int>()
00028 {
00029   m_type       = type;
00030   m_z          = 0.;
00031   m_state      = HepVector(5,0);
00032   m_covariance = HepSymMatrix(5,0);
00033 }

TrState::TrState const TrState &    state
 

Copy constructor.

Definition at line 38 of file TrState.cpp.

References m_covariance, m_state, m_type, m_z, and state.

00038                                       :
00039   KeyedObject<int>()
00040 {
00041   m_type       = state.type();
00042   m_z          = state.z();
00043   m_state      = state.state();
00044   m_covariance = state.covariance();
00045 }

virtual TrState::~TrState   [inline, virtual]
 

Destructor.

Definition at line 69 of file TrState.h.

00069 {}


Member Function Documentation

const CLID & TrState::classID   [inline, static]
 

Definition at line 235 of file TrState.h.

References CLID_TrState.

Referenced by clID.

00236 {
00237   return CLID_TrState;
00238 }

const CLID & TrState::clID   const [inline, virtual]
 

Retrieve pointer to class definition structure.

Definition at line 230 of file TrState.h.

References classID.

00231 {
00232   return TrState::classID();
00233 }

TrState * TrState::clone   [virtual]
 

Clone the state.

Definition at line 138 of file TrState.cpp.

References TrState.

00139 {
00140   return new TrState(*this);
00141 };

HepSymMatrix & TrState::covariance   [inline]
 

Retrieve the state covariance matrix (indexes 1,...,5 for x, y, tx, ty, Q/p) (non-const).

Definition at line 473 of file TrState.h.

References m_covariance.

00474 {
00475   return m_covariance;
00476 }

const HepSymMatrix & TrState::covariance   const [inline]
 

Retrieve the state covariance matrix (indexes 1,...,5 for x, y, tx, ty, Q/p).

Definition at line 468 of file TrState.h.

References m_covariance.

Referenced by posMomCovariance.

00469 {
00470   return m_covariance;
00471 }

HepSymMatrix TrState::errMomentum   const [inline]
 

Retrieve the errors on the momentum vector of the state.

Definition at line 369 of file TrState.h.

References HasMomentum, m_type, and posMomCovariance.

00370 {
00371    
00372   if ( m_type == TrState::HasMomentum ) {
00373     return posMomCovariance().sub(4,6);
00374   }
00375   else {
00376     // print out an error message ...
00377     return HepSymMatrix(3,0);
00378   }
00379         
00380 }

double TrState::errP2   const [virtual]
 

Retrieve the squared error on the momentum of the state.

Definition at line 100 of file TrState.cpp.

References errQOverP2, and m_state.

00101 {
00102   if ( m_state[4] != 0. ) return errQOverP2() / pow( m_state[4], 4. );
00103   return 0.;
00104 };

HepSymMatrix TrState::errPosition   const [inline]
 

Retrieve the errors on the 3D-position vector of the state.

Definition at line 322 of file TrState.h.

References posMomCovariance.

00323 {
00324    
00325   return posMomCovariance().sub(1,3);
00326         
00327 }

double TrState::errQOverP2   const [virtual]
 

Retrieve the squared error on the charge-over-momentum Q/P of the state.

Definition at line 92 of file TrState.cpp.

References m_covariance.

Referenced by errP2.

00093 {
00094   return m_covariance.fast(5,5);
00095 };

double TrState::errQOverPperp2   const [virtual]
 

Retrieve the squared error on the Q/Pperp of the state.

Definition at line 109 of file TrState.cpp.

References m_covariance, qOverP, tx, and ty.

00110 {
00111   double tx2        = tx() * tx();
00112   double ty2        = ty() * ty();
00113   double qOverP2    = qOverP() * qOverP();
00114   double transSlope = 1. + tx2;
00115   double norm       = 1 + tx2 + ty2;
00116 
00117   double QOverPperpError = ( (norm/transSlope) * m_covariance[4][4] )
00118 
00119     + ( qOverP2 * tx2 * ty2*ty2 * m_covariance[2][2]/
00120        (pow(transSlope,3.)*norm))
00121 
00122     + ( qOverP2 * ty2 * m_covariance[3][3] / (norm*transSlope) )
00123 
00124     - ( 2. * qOverP() * tx() * ty2 * m_covariance[2][4]
00125         / ( transSlope*transSlope ) )
00126 
00127     + 2. * qOverP() * ty() * m_covariance[3][4] / transSlope
00128 
00129     - 2. * ( qOverP2 * tx() * ty() * ty2 * m_covariance[2][3]
00130          / ( norm* transSlope*transSlope ) );
00131 
00132   return QOverPperpError;
00133 };

HepSymMatrix TrState::errSlopes   const [inline]
 

Retrieve the errors on the slopes of the state.

Definition at line 343 of file TrState.h.

References m_covariance.

00344 {
00345    
00346   HepSymMatrix err = m_covariance.sub(3,5);
00347   err.fast(2,1) = 0.;
00348   err.fast(3,1) = 0.;
00349   err.fast(3,2) = 0.;
00350   err.fast(3,3) = 0.;
00351   return err;
00352         
00353 }

double TrState::errTx2   const [inline]
 

Retrieve the squared error on the x-slope Tx=dx/dz of the state.

Definition at line 355 of file TrState.h.

References m_covariance.

00356 {
00357    
00358   return m_covariance.fast(3,3);
00359         
00360 }

double TrState::errTy2   const [inline]
 

Retrieve the squared error on the y-slope Ty=dy/dz of the state.

Definition at line 362 of file TrState.h.

References m_covariance.

00363 {
00364    
00365   return m_covariance.fast(4,4);
00366         
00367 }

double TrState::errX2   const [inline]
 

Retrieve the squared error on the x-position of the state.

Definition at line 329 of file TrState.h.

References m_covariance.

00330 {
00331    
00332   return m_covariance.fast(1,1);
00333         
00334 }

double TrState::errY2   const [inline]
 

Retrieve the squared error on the y-position of the state.

Definition at line 336 of file TrState.h.

References m_covariance.

00337 {
00338    
00339   return m_covariance.fast(2,2);
00340         
00341 }

std::ostream & TrState::fillStream std::ostream &    s const [inline, virtual]
 

Fill the ASCII output stream.

Definition at line 502 of file TrState.h.

References m_covariance, m_location, m_state, m_type, and m_z.

00503 {
00504   s << "{ "
00505     << " type:\t" << m_type << std::endl
00506     << "   location:\t" << m_location << std::endl
00507     << "   state:\t" << m_state << std::endl
00508     << "   covariance:\t" << m_covariance << std::endl
00509     << "   z:\t" << (float)m_z << " } ";
00510   return s;
00511 }

unsigned int TrState::location   const [inline]
 

Retrieve the location of the state.

Definition at line 448 of file TrState.h.

References m_location.

00449 {
00450   return m_location;
00451 }

HepVector3D TrState::momentum   const [inline]
 

Retrieve the momentum vector of the state.

Definition at line 305 of file TrState.h.

References p, and slopes.

Referenced by positionAndMomentum.

00306 {
00307    
00308   HepVector3D mom = slopes();
00309   mom *= ( p() / mom.mag() );
00310   return mom;
00311         
00312 }

unsigned int TrState::nParameters   const [inline]
 

Retrieve the number of state parameters.

Definition at line 240 of file TrState.h.

References m_state.

Referenced by setCovariance.

00241 {
00242    
00243   return (unsigned int) m_state.num_row();
00244         
00245 }

double TrState::p   const [virtual]
 

Retrieve the momentum of the state.

Definition at line 58 of file TrState.cpp.

References m_state.

Referenced by momentum.

00059 {
00060   if ( m_state[4] != 0. ) return fabs( 1./m_state[4] );
00061   return 0.;
00062 };

HepPoint3D TrState::position   [inline]
 

Retrieve the 3D-position vector of the state.

Definition at line 256 of file TrState.h.

References m_state, and m_z.

Referenced by positionAndMomentum.

00257 {
00258    
00259   return HepPoint3D( m_state[0], m_state[1], m_z );
00260         
00261 }

void TrState::positionAndMomentum HepPoint3D &    pos,
HepVector3D &    mom,
HepSymMatrix &    cov6D
[inline]
 

Retrieve the position and momentum vectors and the corresponding 6D covariance matrix (pos:1->3,mom:4-6) of the state.

Definition at line 247 of file TrState.h.

References momentum, position, and posMomCovariance.

00248 {
00249    
00250   pos   = position();
00251   mom   = momentum();
00252   cov6D = posMomCovariance();
00253         
00254 }

HepSymMatrix TrState::posMomCovariance   const [virtual]
 

Retrieve the 6D covariance matrix (x,y,z,px,py,pz) of the state.

Definition at line 80 of file TrState.cpp.

References covariance.

Referenced by errMomentum, errPosition, and positionAndMomentum.

00081 {
00082   HepSymMatrix cov = covariance();
00083   // to be written ...
00084 
00085   return cov;
00086   
00087 };

double TrState::pt   const [virtual]
 

Retrieve the transverse momentum of the state.

Definition at line 67 of file TrState.cpp.

References m_state.

00068 {
00069   if ( m_state[4] != 0. ) {
00070     double txy2 = m_state[2]*m_state[2] + m_state[3]*m_state[3];
00071     return sqrt( txy2/(1.+txy2) ) / fabs( m_state[4] );
00072   }
00073   return 0.;
00074 };

double TrState::qOverP   const [virtual]
 

Retrieve the charge-over-momentum Q/P of the state.

Definition at line 50 of file TrState.cpp.

References m_state.

Referenced by errQOverPperp2, qOverPperp, and setState.

00051 {
00052   return m_state[4];
00053 };

double TrState::qOverPperp   const [inline]
 

Retrieve the Q/Pperp (ratio of the charge to the component of the momentum transverse to the magnetic field) of the state.

Definition at line 314 of file TrState.h.

References qOverP, tx, and ty.

00315 {
00316    
00317   double tx2 = tx() * tx();
00318   return ( qOverP() * sqrt( (1.+ tx2 + ty()*ty()) / (1. + tx2 ) ) );
00319         
00320 }

void TrState::reset   [virtual]
 

Clear the state before re-using it.

Definition at line 146 of file TrState.cpp.

References m_covariance, m_state, and m_z.

00147 {
00148   m_z          = 0.;
00149   m_state      = HepVector(5,0);
00150   m_covariance = HepSymMatrix(5,0);
00151 };

StreamBuffer & TrState::serialize StreamBuffer &    s [inline, virtual]
 

Serialize the object for reading.

Definition at line 489 of file TrState.h.

References m_covariance, m_location, m_state, m_type, and m_z.

00490 {
00491   float l_z;
00492   KeyedObject<int>::serialize(s);
00493   s >> m_type
00494     >> m_location
00495     >> m_state
00496     >> m_covariance
00497     >> l_z;
00498   m_z = l_z;
00499   return s;
00500 }

StreamBuffer & TrState::serialize StreamBuffer &    s const [inline, virtual]
 

Serialize the object for writing.

Definition at line 478 of file TrState.h.

References m_covariance, m_location, m_state, m_type, and m_z.

00479 {
00480   KeyedObject<int>::serialize(s);
00481   s << m_type
00482     << m_location
00483     << m_state
00484     << m_covariance
00485     << (float)m_z;
00486   return s;
00487 }

void TrState::setCovariance const HepSymMatrix &    value [inline]
 

Update the state covariance.

Definition at line 400 of file TrState.h.

References m_covariance, and nParameters.

00401 {
00402    
00403   if ( value.num_row() == (int) nParameters() ) {
00404     m_covariance = value;
00405   }
00406   else {
00407     std::cerr << "ERROR   The dimension of the covariance matrix does not match that of the state!"
00408               << "ERROR   Using the default covariance matrix." << std::endl;
00409     int dim = nParameters();
00410     m_covariance = HepSymMatrix(dim,0);
00411   }
00412         
00413 }

void TrState::setLocation unsigned int    value [inline]
 

Update the location of the state.

Definition at line 453 of file TrState.h.

References m_location.

00454 {
00455   m_location = value; 
00456 }

void TrState::setQOverP double    value [virtual]
 

Update the Q/P value of the state.

Definition at line 178 of file TrState.cpp.

References m_state.

00179 {
00180   m_state[4] = value;
00181 };

void TrState::setState double    x,
double    y,
double    z,
double    tx,
double    ty
[inline]
 

Update the state vector (presumably of type TrState::StraightLine).

Definition at line 389 of file TrState.h.

References m_state, m_z, tx, ty, x, y, and z.

00390 {
00391    
00392   m_state[0] = x;
00393   m_state[1] = y;
00394   m_state[2] = tx;
00395   m_state[3] = ty;
00396   m_z        = z;
00397         
00398 }

void TrState::setState double    x,
double    y,
double    z,
double    tx,
double    ty,
double    qOverP
[virtual]
 

Update the state vector (presumably of type TrState::HasMomentum).

Definition at line 156 of file TrState.cpp.

References m_state, m_type, m_z, qOverP, StraightLine, tx, ty, x, y, and z.

00159 {
00160   m_state[0] = x;
00161   m_state[1] = y;
00162   m_state[2] = tx;
00163   m_state[3] = ty;
00164   m_z        = z;
00165   if ( m_type == TrState::StraightLine ) {
00166     std::cerr
00167       << "ERROR   You're trying to set the Q/P value for a state of type TrState::StraightLine!"
00168       << "ERROR   This value will be discarded." << std::endl;
00169   }
00170   else {
00171      m_state[4] = qOverP;
00172   }
00173 };

void TrState::setState const HepVector &    state [inline]
 

Update the state vector.

Definition at line 382 of file TrState.h.

References m_state, and state.

00383 {
00384    
00385   m_state = state;
00386         
00387 }

void TrState::setTx double    value [inline]
 

Update the Tx slope of the state.

Definition at line 429 of file TrState.h.

References m_state.

00430 {
00431    
00432   m_state[2] = value;
00433         
00434 }

void TrState::setTy double    value [inline]
 

Update the Ty slope of the state.

Definition at line 436 of file TrState.h.

References m_state.

00437 {
00438    
00439   m_state[3] = value;
00440         
00441 }

void TrState::setX double    value [inline]
 

Update the x-position of the state.

Definition at line 415 of file TrState.h.

References m_state.

00416 {
00417    
00418   m_state[0] = value;
00419         
00420 }

void TrState::setY double    value [inline]
 

Update the y-position of the state.

Definition at line 422 of file TrState.h.

References m_state.

00423 {
00424    
00425   m_state[1] = value;
00426         
00427 }

HepVector3D TrState::slopes   const [inline]
 

Retrieve the slopes (Tx=dx/dz,Ty=dy/dz,1.) of the state.

Definition at line 284 of file TrState.h.

References m_state.

Referenced by momentum.

00285 {
00286    
00287   return HepVector3D( m_state[2], m_state[3], 1.);
00288         
00289 }

HepVector & TrState::state   [inline]
 

Retrieve the state vector (non-const).

Definition at line 463 of file TrState.h.

References m_state.

00464 {
00465   return m_state;
00466 }

const HepVector & TrState::state   const [inline]
 

Retrieve the state vector.

Definition at line 458 of file TrState.h.

References m_state.

Referenced by setState, and TrState.

00459 {
00460   return m_state;
00461 }

double TrState::tx   const [inline]
 

Retrieve the Tx=dx/dz slope of the state.

Definition at line 291 of file TrState.h.

References m_state.

Referenced by errQOverPperp2, qOverPperp, and setState.

00292 {
00293    
00294   return m_state[2];
00295         
00296 }

double TrState::ty   const [inline]
 

Retrieve the Ty=dy/dz slope of the state.

Definition at line 298 of file TrState.h.

References m_state.

Referenced by errQOverPperp2, qOverPperp, and setState.

00299 {
00300    
00301   return m_state[3];
00302         
00303 }

unsigned int TrState::type   const [inline]
 

Retrieve the type of the state.

Definition at line 443 of file TrState.h.

References m_type.

Referenced by TrState.

00444 {
00445   return m_type;
00446 }

double TrState::x   const [inline]
 

Retrieve the x-position of the state.

Definition at line 263 of file TrState.h.

References m_state.

Referenced by setState.

00264 {
00265    
00266   return m_state[0];
00267         
00268 }

double TrState::y   const [inline]
 

Retrieve the y-position of the state.

Definition at line 270 of file TrState.h.

References m_state.

Referenced by setState.

00271 {
00272    
00273   return m_state[1];
00274         
00275 }

double TrState::z   const [inline]
 

Retrieve the z-position of the state.

Definition at line 277 of file TrState.h.

References m_z.

Referenced by setState.

00278 {
00279    
00280   return m_z;
00281         
00282 }


Member Data Documentation

HepSymMatrix TrState::m_covariance [private]
 

the state covariance matrix (indexes 1,...,5 for x, y, tx, ty, Q/p).

Definition at line 220 of file TrState.h.

Referenced by covariance, errQOverP2, errQOverPperp2, errSlopes, errTx2, errTy2, errX2, errY2, fillStream, reset, serialize, setCovariance, and TrState.

unsigned int TrState::m_location [private]
 

the location of the state.

Definition at line 218 of file TrState.h.

Referenced by fillStream, location, serialize, and setLocation.

HepVector TrState::m_state [private]
 

the state vector.

Definition at line 219 of file TrState.h.

Referenced by errP2, fillStream, nParameters, p, position, pt, qOverP, reset, serialize, setQOverP, setState, setTx, setTy, setX, setY, slopes, state, TrState, tx, ty, x, and y.

unsigned int TrState::m_type [private]
 

the type of the state.

Definition at line 217 of file TrState.h.

Referenced by errMomentum, fillStream, serialize, setState, TrState, and type.

double TrState::m_z [private]
 

the z-position of the state.

Definition at line 221 of file TrState.h.

Referenced by fillStream, position, reset, serialize, setState, TrState, and z.


The documentation for this class was generated from the following files:
Generated on Mon Nov 1 17:29:46 2004 for New Track Event Model by doxygen 1.2.14 written by Dimitri van Heesch, © 1997-2002