00001 // $Id: $ // Include files 00002 00003 // local 00004 #include "Event/TrTrack.h" 00005 00006 //----------------------------------------------------------------------------- 00007 // Implementation file for class : TrTrack 00008 // 00009 // 2004-10-07 : Eduardo Rodrigues 00010 //----------------------------------------------------------------------------- 00011 00012 00013 //============================================================================= 00014 // Retrieve the position and momentum vectors and the corresponding 00015 // 6D covariance matrix (pos:1->3,mom:4-6) of a track closest to the beam-line 00016 //============================================================================= 00017 StatusCode TrTrack::positionAndMomentum( HepPoint3D &pos, 00018 HepVector3D &mom, 00019 HepSymMatrix &cov6D ) 00020 { 00021 m_physicsState.positionAndMomentum( pos, mom, cov6D ); 00022 00023 return StatusCode::SUCCESS; 00024 } 00025 00026 //============================================================================= 00027 // Retrieve the 3D-position (+ errors) of a track closest to the beam-line 00028 //============================================================================= 00029 StatusCode TrTrack::position( HepPoint3D &pos, 00030 HepSymMatrix &errPos ) 00031 { 00032 pos = m_physicsState.position(); 00033 errPos = m_physicsState.errPosition(); 00034 00035 return StatusCode::SUCCESS; 00036 }; 00037 00038 //============================================================================= 00039 // Retrieve the slopes (dx/dz,dy/dz,1) of a track closest to the beam-line 00040 //============================================================================= 00041 StatusCode TrTrack::slopes( HepVector3D &slopes, 00042 HepSymMatrix &errSlopes ) 00043 { 00044 slopes = m_physicsState.slopes(); 00045 errSlopes = m_physicsState.errSlopes(); 00046 00047 return StatusCode::SUCCESS; 00048 }; 00049 00050 //============================================================================= 00051 // Retrieve the momentum of a track closest to the beam-line 00052 //============================================================================= 00053 double TrTrack::p() 00054 { 00055 return m_physicsState.p(); 00056 }; 00057 00058 //============================================================================= 00059 // Retrieve the transverse momentum of a track closest to the beam-line 00060 //============================================================================= 00061 double TrTrack::pt() 00062 { 00063 return m_physicsState.pt(); 00064 }; 00065 00066 //============================================================================= 00067 // Retrieve the momentum vector (+ errors) of a track closest to the beam-line 00068 //============================================================================= 00069 StatusCode TrTrack::momentum( HepVector3D &mom, 00070 HepSymMatrix &errMom ) 00071 { 00072 mom = m_physicsState.momentum(); 00073 errMom = m_physicsState.errMomentum(); 00074 00075 return StatusCode::SUCCESS; 00076 }; 00077 00078 //============================================================================= 00079 // Retrieve the 6D covariance matrix (x,y,z,px,py,pz) 00080 // of a track closest to the beam-line 00081 //============================================================================= 00082 StatusCode TrTrack::posMomCovariance( HepSymMatrix &cov6D ) 00083 { 00084 cov6D = m_physicsState.posMomCovariance(); 00085 00086 return StatusCode::SUCCESS; 00087 }; 00088 00089 //============================================================================= 00090 // Retrieve the pointer to the state closest to the given z-position 00091 //============================================================================= 00092 TrState* TrTrack::closestState( double z ) { 00093 double minDist = 999999999.; 00094 TrState* best = 0; 00095 for ( std::vector<TrState*>::iterator it = m_states.begin() ; 00096 m_states.end() != it; it++ ) { 00097 if ( minDist > fabs( z - (*it)->z() ) ) { 00098 minDist = fabs( z-(*it)->z() ); 00099 best = *it; 00100 } 00101 } 00102 return best; 00103 } 00104 00105 //============================================================================= 00106 // Retrieve the pointer to the state closest to the given plane 00107 //============================================================================= 00108 TrState* TrTrack::closestState( HepPlane3D &plane ) { 00109 double minDist = 999999999.; 00110 double dist; 00111 TrState* best = 0; 00112 for ( std::vector<TrState*>::iterator it = m_states.begin() ; 00113 m_states.end() != it; it++ ) { 00114 dist = plane.distance( ((*it) -> position()) ); 00115 if ( minDist > dist ) { 00116 minDist = dist; 00117 best = *it; 00118 } 00119 } 00120 return best; 00121 } 00122 00123 //============================================================================= 00124 // Clone the track 00125 //============================================================================= 00126 TrTrack* TrTrack::clone() const 00127 { 00128 return new TrTrack(*this); 00129 }; 00130 00131 //============================================================================= 00132