00001
00002
00003
00004 #include "Event/Track.h"
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 StatusCode Track::positionAndMomentum( HepPoint3D &pos,
00018 HepVector3D &mom,
00019 HepSymMatrix &cov6D ) const
00020 {
00021 m_physicsState.positionAndMomentum( pos, mom, cov6D );
00022
00023 return StatusCode::SUCCESS;
00024 };
00025
00026
00027
00028
00029 StatusCode Track::position( HepPoint3D &pos,
00030 HepSymMatrix &errPos ) const
00031 {
00032 pos = m_physicsState.position();
00033 errPos = m_physicsState.errPosition();
00034
00035 return StatusCode::SUCCESS;
00036 };
00037
00038
00039
00040
00041 StatusCode Track::slopes( HepVector3D &slopes,
00042 HepSymMatrix &errSlopes ) const
00043 {
00044 slopes = m_physicsState.slopes();
00045 errSlopes = m_physicsState.errSlopes();
00046
00047 return StatusCode::SUCCESS;
00048 };
00049
00050
00051
00052
00053 double Track::p() const
00054 {
00055 return m_physicsState.p();
00056 };
00057
00058
00059
00060
00061 double Track::pt() const
00062 {
00063 return m_physicsState.pt();
00064 };
00065
00066
00067
00068
00069 StatusCode Track::momentum( HepVector3D &mom,
00070 HepSymMatrix &errMom ) const
00071 {
00072 mom = m_physicsState.momentum();
00073 errMom = m_physicsState.errMomentum();
00074
00075 return StatusCode::SUCCESS;
00076 };
00077
00078
00079
00080
00081
00082 StatusCode Track::posMomCovariance( HepSymMatrix &cov6D ) const
00083 {
00084 cov6D = m_physicsState.posMomCovariance();
00085
00086 return StatusCode::SUCCESS;
00087 };
00088
00089
00090
00091
00092 State* Track::closestState( double z )
00093 {
00094 double minDist = 999999999.;
00095 State* best = 0;
00096 for ( std::vector<State*>::iterator it = m_states.begin() ;
00097 m_states.end() != it; it++ ) {
00098 if ( minDist > fabs( z - (*it)->z() ) ) {
00099 minDist = fabs( z-(*it)->z() );
00100 best = *it;
00101 }
00102 }
00103 return best;
00104 };
00105
00106
00107
00108
00109 const State* Track::closestState( double z ) const
00110 {
00111 double minDist = 999999999.;
00112 State* best = 0;
00113 for ( std::vector<State*>::const_iterator it = m_states.begin() ;
00114 m_states.end() != it; it++ ) {
00115 if ( minDist > fabs( z - (*it)->z() ) ) {
00116 minDist = fabs( z-(*it)->z() );
00117 best = *it;
00118 }
00119 }
00120 return best;
00121 };
00122
00123
00124
00125
00126 State* Track::closestState( HepPlane3D &plane )
00127 {
00128 double minDist = 999999999.;
00129 double dist;
00130 State* best = 0;
00131 for ( std::vector<State*>::iterator it = m_states.begin() ;
00132 m_states.end() != it; it++ ) {
00133 dist = plane.distance( ((*it) -> position()) );
00134 if ( minDist > dist ) {
00135 minDist = dist;
00136 best = *it;
00137 }
00138 }
00139 return best;
00140 };
00141
00142
00143
00144
00145 const State* Track::closestState( HepPlane3D &plane ) const
00146 {
00147 double minDist = 999999999.;
00148 double dist;
00149 State* best = 0;
00150 for ( std::vector<State*>::const_iterator it = m_states.begin() ;
00151 m_states.end() != it; it++ ) {
00152 dist = plane.distance( ((*it) -> position()) );
00153 if ( minDist > dist ) {
00154 minDist = dist;
00155 best = *it;
00156 }
00157 }
00158 return best;
00159 };
00160
00161
00162
00163
00164 State* Track::stateAt( const State::Location& value )
00165 {
00166 for ( std::vector<State*>::iterator it = m_states.begin() ;
00167 m_states.end() != it; it++ ) {
00168 if ( (*it) -> checkLocation( value ) ) return (*it);
00169 }
00170 return NULL;
00171 };
00172
00173
00174
00175
00176 const State* Track::stateAt( const State::Location& value ) const
00177 {
00178 for ( std::vector<State*>::const_iterator it = m_states.begin() ;
00179 m_states.end() != it; it++ ) {
00180 if ( (*it) -> checkLocation( value ) ) return (*it);
00181 }
00182 return NULL;
00183 };
00184
00185
00186
00187
00188 Track* Track::clone() const
00189 {
00190 Track* tk = new Track();
00191 *tk = *this;
00192 return tk;
00193 };
00194
00195
00196
00197
00198 bool Track::producedByAlgo( const HistoryFlag& value ) const
00199 {
00200 unsigned int val = (unsigned int)value;
00201 return 0 != ( m_flags & historyMask & val );
00202 };
00203
00204
00205
00206
00207 void Track::setProducedByAlgo( const HistoryFlag& value )
00208 {
00209 unsigned int val = (unsigned int)value;
00210 m_flags &= ~historyMask;
00211 m_flags |= ((((unsigned int)val) << historyBits) & historyMask);
00212 };
00213
00214
00215