#include <State.h>
Public Member Functions | |
State () | |
Default constructor. | |
virtual | ~State () |
Default Destructor. | |
virtual const CLID & | clID () const |
unsigned int | nParameters () const |
Retrieve the number of state parameters. | |
void | positionAndMomentum (HepPoint3D &pos, HepVector3D &mom, HepSymMatrix &cov6D) const |
Retrieve the position and momentum vectors and the corresponding 6D covariance matrix (pos:1->3,mom:4-6) of the state. | |
void | positionAndMomentum (HepPoint3D &pos, HepVector3D &mom) const |
Retrieve the position and momentum vectors of the state. | |
HepPoint3D | position () const |
Retrieve the 3D-position vector of the state. | |
double | x () const |
Retrieve the x-position of the state. | |
double | y () const |
Retrieve the y-position of the state. | |
double | z () const |
Retrieve the z-position of the state. | |
HepVector3D | slopes () const |
Retrieve the slopes (Tx=dx/dz,Ty=dy/dz,1.) of the state. | |
double | tx () const |
Retrieve the Tx=dx/dz slope of the state. | |
double | ty () const |
Retrieve the Ty=dy/dz slope of the state. | |
virtual double | qOverP () const |
Retrieve the charge-over-momentum Q/P of the state. | |
virtual double | p () const |
Retrieve the momentum of the state. | |
virtual double | pt () const |
Retrieve the transverse momentum of the state. | |
HepVector3D | momentum () const |
Retrieve the momentum vector of the state. | |
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. | |
virtual HepSymMatrix | posMomCovariance () const |
Retrieve the 6D covariance matrix (x,y,z,px,py,pz) of the state. | |
HepSymMatrix | errPosition () const |
Retrieve the errors on the 3D-position vector of the state. | |
double | errX2 () const |
Retrieve the squared error on the x-position of the state. | |
double | errY2 () const |
Retrieve the squared error on the y-position of the state. | |
HepSymMatrix | errSlopes () const |
Retrieve the errors on the slopes of the state. | |
double | errTx2 () const |
Retrieve the squared error on the x-slope Tx=dx/dz of the state. | |
double | errTy2 () const |
Retrieve the squared error on the y-slope Ty=dy/dz of the state. | |
virtual double | errQOverP2 () const |
Retrieve the squared error on the charge-over-momentum Q/P of the state. | |
virtual double | errP2 () const |
Retrieve the squared error on the momentum of the state. | |
virtual HepSymMatrix | errMomentum () const |
Retrieve the errors on the momentum vector of the stateRetrieve the errors on the momentum vector of the state. | |
virtual double | errQOverPperp2 () const |
Retrieve the squared error on the Q/Pperp of the state. | |
virtual State * | clone () const |
Clone the state (remember you then owe the pointer). | |
void | setState (const HepVector &state) |
Update the state vector. | |
virtual void | setState (double x, double y, double z, double tx, double ty, double qOverP) |
Update the state vector (presumably of type State::HasMomentum). | |
void | setCovariance (const HepSymMatrix &value) |
Update the state covariance. | |
void | setX (double value) |
Update the x-position of the state. | |
void | setY (double value) |
Update the y-position of the state. | |
void | setZ (double value) |
Update the z-position of the state. | |
void | setTx (double value) |
Update the Tx slope of the state. | |
void | setTy (double value) |
Update the Ty slope of the state. | |
virtual void | setQOverP (double value) |
Update the Q/P value of the state. | |
bool | checkLocation (unsigned int value) const |
check if the state is of this location | |
unsigned int | flags () const |
Retrieve const the variety of state flags. | |
void | setFlags (unsigned int value) |
Update the variety of state flags. | |
unsigned int | location () const |
Retrieve state location. | |
void | setLocation (unsigned int value) |
Update state location. | |
const HepVector & | stateVector () const |
Retrieve const the state vector. | |
HepVector & | stateVector () |
Retrieve the state vector. | |
const HepSymMatrix & | covariance () const |
Retrieve const the state covariance matrix (indexes 1,...,5 for x, y, tx, ty, Q/p). | |
HepSymMatrix & | covariance () |
Retrieve the state covariance matrix (indexes 1,...,5 for x, y, tx, ty, Q/p). | |
Static Public Member Functions | |
static const CLID & | classID () |
Protected Types | |
enum | flagsBits { locationBits = 0 } |
Offsets of bitfield flags. More... | |
enum | flagsMasks { locationMask = 0xFFFFL } |
Bitmasks for bitfield flags. More... | |
Protected Attributes | |
unsigned int | m_flags |
the variety of state flags | |
HepVector | m_stateVector |
the state vector | |
HepSymMatrix | m_covariance |
the state covariance matrix (indexes 1,...,5 for x, y, tx, ty, Q/p) | |
double | m_z |
the z-position of the state |
Definition at line 47 of file State.h.
|
Offsets of bitfield flags.
Definition at line 207 of file State.h. 00207 {locationBits = 0};
|
|
Bitmasks for bitfield flags.
Definition at line 210 of file State.h. 00210 {locationMask = 0xFFFFL};
|
|
Default constructor.
Definition at line 21 of file State.cpp. References m_covariance, m_stateVector, m_z, and setLocation(). Referenced by clone(). 00021 { 00022 setLocation( StateKeys::LocationUnknown ); 00023 m_z = 0.; 00024 m_stateVector = HepVector(5,0); 00025 m_covariance = HepSymMatrix(5,0); 00026 }
|
|
Default Destructor.
Definition at line 55 of file State.h. 00055 {}
|
|
check if the state is of this location
Definition at line 475 of file State.h. References location(). 00476 { 00477 00478 return location() == value; 00479 00480 }
|
|
Definition at line 233 of file State.h. References CLID_State. Referenced by clID(). 00234 { 00235 return CLID_State; 00236 }
|
|
Definition at line 228 of file State.h. References classID(). 00229 { 00230 return State::classID(); 00231 }
|
|
Clone the state (remember you then owe the pointer).
Definition at line 207 of file State.cpp. References setLocation(), and State(). Referenced by KalmanFilter::filter(), FitNode::setFilteredState(), FitNode::setPredictedState(), and Node::setState(). 00208 { 00209 State* state = new State(*this); 00210 state->setLocation( StateKeys::LocationUnknown ); 00211 return state; 00212 };
|
|
Retrieve the state covariance matrix (indexes 1,...,5 for x, y, tx, ty, Q/p).
Definition at line 275 of file State.h. References m_covariance. 00276 { 00277 return m_covariance; 00278 }
|
|
Retrieve const the state covariance matrix (indexes 1,...,5 for x, y, tx, ty, Q/p).
Definition at line 270 of file State.h. References m_covariance. Referenced by Track2TrFitTrackCnv::execute(), KalmanFilter::iniKalman(), posMomCovariance(), and TrackExtrapolator::updateState(). 00271 { 00272 return m_covariance; 00273 }
|
|
Retrieve the errors on the momentum vector of the stateRetrieve the errors on the momentum vector of the state.
Definition at line 164 of file State.cpp. References posMomCovariance(). Referenced by TrackExtrapolator::momentum(), and Track::momentum(). 00165 { 00166 // if ( m_stateVector[4] != 0. ) { 00167 const HepSymMatrix temp = posMomCovariance(); // CLHEP 1.9, must be const 00168 return temp.sub(4,6); 00169 // } 00170 // else { 00171 // return HepSymMatrix(3,0); 00172 // } 00173 };
|
|
Retrieve the squared error on the momentum of the state.
Definition at line 154 of file State.cpp. References errQOverP2(), and m_stateVector. 00155 {
00156 if ( m_stateVector[4] != 0. )
00157 return errQOverP2() / gsl_pow_4( m_stateVector[4] );
00158 return 0.;
00159 };
|
|
Retrieve the errors on the 3D-position vector of the state.
Definition at line 373 of file State.h. References posMomCovariance(). Referenced by TrackExtrapolator::position(), and Track::position(). 00374 { 00375 00376 const HepSymMatrix temp = posMomCovariance(); 00377 return temp.sub(1,3); 00378 00379 }
|
|
Retrieve the squared error on the charge-over-momentum Q/P of the state.
Definition at line 146 of file State.cpp. References m_covariance. Referenced by errP2(). 00147 { 00148 return m_covariance.fast(5,5); 00149 };
|
|
Retrieve the squared error on the Q/Pperp of the state.
Definition at line 178 of file State.cpp. References m_covariance, qOverP(), tx(), and ty(). 00179 { 00180 double tx2 = tx() * tx(); 00181 double ty2 = ty() * ty(); 00182 double qOverP2 = qOverP() * qOverP(); 00183 double transSlope = 1. + tx2; 00184 double norm = 1 + tx2 + ty2; 00185 00186 double QOverPperpError = ( (norm/transSlope) * m_covariance[4][4] ) 00187 00188 + ( qOverP2 * tx2 * ty2*ty2 * m_covariance[2][2]/ 00189 (gsl_pow_3(transSlope)*norm)) 00190 00191 + ( qOverP2 * ty2 * m_covariance[3][3] / (norm*transSlope) ) 00192 00193 - ( 2. * qOverP() * tx() * ty2 * m_covariance[2][4] 00194 / ( transSlope*transSlope ) ) 00195 00196 + 2. * qOverP() * ty() * m_covariance[3][4] / transSlope 00197 00198 - 2. * ( qOverP2 * tx() * ty() * ty2 * m_covariance[2][3] 00199 / ( norm* transSlope*transSlope ) ); 00200 00201 return QOverPperpError; 00202 };
|
|
Retrieve the errors on the slopes of the state.
Definition at line 395 of file State.h. References m_covariance. Referenced by TrackExtrapolator::slopes(), and Track::slopes(). 00396 { 00397 00398 const HepSymMatrix temp = m_covariance; 00399 HepSymMatrix err = temp.sub(3,5); 00400 err.fast(2,1) = 0.; 00401 err.fast(3,1) = 0.; 00402 err.fast(3,2) = 0.; 00403 err.fast(3,3) = 0.; 00404 return err; 00405 00406 }
|
|
Retrieve the squared error on the x-slope Tx=dx/dz of the state.
Definition at line 408 of file State.h. References m_covariance. 00409 { 00410 00411 return m_covariance.fast(3,3); 00412 00413 }
|
|
Retrieve the squared error on the y-slope Ty=dy/dz of the state.
Definition at line 415 of file State.h. References m_covariance. 00416 { 00417 00418 return m_covariance.fast(4,4); 00419 00420 }
|
|
Retrieve the squared error on the x-position of the state.
Definition at line 381 of file State.h. References m_covariance. 00382 { 00383 00384 return m_covariance.fast(1,1); 00385 00386 }
|
|
Retrieve the squared error on the y-position of the state.
Definition at line 388 of file State.h. References m_covariance. 00389 { 00390 00391 return m_covariance.fast(2,2); 00392 00393 }
|
|
Retrieve const the variety of state flags.
Definition at line 238 of file State.h. References m_flags. 00239 { 00240 return m_flags; 00241 }
|
|
Retrieve state location.
Definition at line 248 of file State.h. References locationBits, locationMask, and m_flags. Referenced by checkLocation(). 00249 { 00250 return (unsigned int)((m_flags & locationMask) >> locationBits); 00251 }
|
|
Retrieve the momentum vector of the state.
Definition at line 356 of file State.h. Referenced by TrackExtrapolator::momentum(), Track::momentum(), TrackExtrapolator::positionAndMomentum(), and positionAndMomentum(). 00357 { 00358 00359 HepVector3D mom = slopes(); 00360 mom *= ( p() / mom.mag() ); 00361 return mom; 00362 00363 }
|
|
Retrieve the number of state parameters.
Definition at line 280 of file State.h. References m_stateVector. Referenced by KalmanFilter::computeChiSq(), and setCovariance(). 00281 { 00282 00283 return (unsigned int) m_stateVector.num_row(); 00284 00285 }
|
|
Retrieve the momentum of the state.
Definition at line 39 of file State.cpp. References m_stateVector. Referenced by momentum(), TrackExtrapolator::p(), Track::p(), and posMomCovariance(). 00040 {
00041 if ( m_stateVector[4] != 0. ) return fabs( 1./m_stateVector[4] );
00042 return HUGE_VAL;
00043 };
|
|
Retrieve the 3D-position vector of the state.
Definition at line 307 of file State.h. References m_stateVector, and m_z. Referenced by TrackExtrapolator::position(), Track::position(), TrackExtrapolator::positionAndMomentum(), and positionAndMomentum(). 00308 {
00309
00310 return HepPoint3D( m_stateVector[0], m_stateVector[1], m_z );
00311
00312 }
|
|
Retrieve the position and momentum vectors of the state.
Definition at line 298 of file State.h. References momentum(), and position().
|
|
Retrieve the position and momentum vectors and the corresponding 6D covariance matrix (pos:1->3,mom:4-6) of the state.
Definition at line 287 of file State.h. References momentum(), position(), and posMomCovariance(). Referenced by TrackExtrapolator::positionAndMomentum(), and Track::positionAndMomentum(). 00290 { 00291 00292 pos = position(); 00293 mom = momentum(); 00294 cov6D = posMomCovariance(); 00295 00296 }
|
|
Retrieve the 6D covariance matrix (x,y,z,px,py,pz) of the state.
Definition at line 61 of file State.cpp. References covariance(), p(), qOverP(), tx(), and ty(). Referenced by errMomentum(), errPosition(), positionAndMomentum(), and Track::posMomCovariance(). 00062 { 00063 // Transformation done in 2 steps: 00064 // 1) "convert" first from (x,y,tx,ty,Q/p) to (x,y,z,tx,ty,Q/p) 00065 const HepSymMatrix cov5D = covariance(); 00066 HepSymMatrix cov6Dtmp = HepSymMatrix(6,0); 00067 00068 std::vector<int> index; 00069 index.push_back( 1 ); 00070 index.push_back( 3 ); 00071 index.push_back( 4 ); 00072 index.push_back( 5 ); 00073 00074 for ( int jj=0 ; jj<5 ; jj++ ) { 00075 for ( int i=jj ; i<5 ; i++ ) { 00076 cov6Dtmp.fast(index[i]+1,index[jj]+1) = cov5D.fast(i+1,jj+1); 00077 } 00078 } 00079 cov6Dtmp.fast(3,1) = 0.; 00080 cov6Dtmp.fast(3,2) = 0.; 00081 cov6Dtmp.fast(3,3) = 0.; 00082 cov6Dtmp.fast(4,3) = 0.; 00083 cov6Dtmp.fast(5,3) = 0.; 00084 cov6Dtmp.fast(6,3) = 0.; 00085 00086 // 2) transformation from (x,y,z,tx,ty,Q/p) to (x,y,z,px,py,pz) 00087 // jacobian J = I 0 00088 // 0 j 00089 // -> covariance matrix C = C_A C_B.T() 00090 // C_B C_D 00091 // becomes C' = C_A (j.C_B).T() after similarity transformation 00092 // j.C_B j.C_D.(j.T()) 00093 double Tx = tx(); 00094 double Ty = ty(); 00095 double QOverP = qOverP(); 00096 double Q = ( QOverP != 0. ? (fabs(QOverP)/QOverP) : 0. ); 00097 double Tx2 = Tx * Tx; 00098 double Ty2 = Ty * Ty; 00099 double Qp = Q * p(); 00100 double N = 1. / sqrt( 1 + Tx2 + Ty2 ); 00101 double N2 = N*N; 00102 00103 HepSymMatrix cov6D = HepSymMatrix(6,0); 00104 HepSymMatrix C_A = cov6Dtmp.sub(1,3); 00105 HepSymMatrix C_D = cov6Dtmp.sub(4,6); 00106 HepMatrix C_B = HepMatrix(3,3,0); 00107 HepMatrix jmat = HepMatrix(3,3,0); 00108 00109 jmat[0][0] = ( 1 + Ty2 ) * N2; 00110 jmat[0][1] = - Tx * Ty * N2; 00111 jmat[0][2] = - Qp * Tx; 00112 jmat[1][0] = - Tx * Ty * N2; 00113 jmat[1][1] = ( 1 + Tx2 ) * N2; 00114 jmat[1][2] = - Qp * Ty; 00115 jmat[2][0] = - Tx * N2; 00116 jmat[2][1] = - Ty * N2; 00117 jmat[2][2] = - Qp; 00118 00119 C_B(1,1) = cov6Dtmp.fast(4,1); 00120 C_B(2,1) = cov6Dtmp.fast(5,1); 00121 C_B(2,2) = cov6Dtmp.fast(5,2); 00122 C_B(3,1) = cov6Dtmp.fast(6,1); 00123 C_B(3,2) = cov6Dtmp.fast(6,2); 00124 C_B(3,3) = cov6Dtmp.fast(6,3); 00125 00126 C_B = jmat * C_B; 00127 00128 cov6D.sub(1,C_A); 00129 cov6D.sub(4,C_D.similarity(jmat)); 00130 cov6D.fast(4,1) = C_B(1,1); 00131 cov6D.fast(5,1) = C_B(2,1); 00132 cov6D.fast(6,1) = C_B(3,1); 00133 cov6D.fast(4,2) = C_B(1,2); 00134 cov6D.fast(5,2) = C_B(2,2); 00135 cov6D.fast(6,2) = C_B(3,2); 00136 cov6D.fast(4,3) = C_B(1,3); 00137 cov6D.fast(5,3) = C_B(2,3); 00138 cov6D.fast(6,3) = C_B(3,3); 00139 00140 return cov6D; 00141 };
|
|
Retrieve the transverse momentum of the state.
Definition at line 48 of file State.cpp. References m_stateVector. Referenced by TrackExtrapolator::pt(), and Track::pt(). 00049 { 00050 if ( m_stateVector[4] != 0. ) { 00051 double txy2 = m_stateVector[2]*m_stateVector[2] 00052 + m_stateVector[3]*m_stateVector[3]; 00053 return sqrt( txy2/(1.+txy2) ) / fabs( m_stateVector[4] ); 00054 } 00055 return HUGE_VAL; 00056 };
|
|
Retrieve the charge-over-momentum Q/P of the state.
Definition at line 31 of file State.cpp. References m_stateVector. Referenced by Track::charge(), TrueStateCreator::createState(), TrueStateCreator::createStateVertex(), errQOverPperp2(), Track2TrFitTrackCnv::execute(), TrueTracksCreator::initializeState(), posMomCovariance(), and qOverPperp(). 00032 { 00033 return m_stateVector[4]; 00034 };
|
|
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 365 of file State.h. References qOverP(), tx(), and ty(). 00366 { 00367 00368 double tx2 = tx() * tx(); 00369 return ( qOverP() * sqrt( (1.+ tx2 + ty()*ty()) / (1. + tx2 ) ) ); 00370 00371 }
|
|
Update the state covariance.
Definition at line 429 of file State.h. References m_covariance, and nParameters(). Referenced by TrFitTrack2TrackCnv::execute(). 00430 { 00431 00432 if ( value.num_row() != (int) nParameters() ) 00433 throw GaudiException( "The dimension of the covariance matrix does not match that of the State!", 00434 "State.h", 00435 StatusCode::FAILURE ); 00436 m_covariance = value; 00437 00438 }
|
|
Update the variety of state flags.
Definition at line 243 of file State.h. References m_flags. 00244 { 00245 m_flags = value; 00246 }
|
|
Update state location.
Definition at line 253 of file State.h. References locationBits, locationMask, and m_flags. Referenced by clone(), and State(). 00254 { 00255 unsigned int val = (unsigned int)value; 00256 m_flags &= ~locationMask; 00257 m_flags |= ((((unsigned int)val) << locationBits) & locationMask); 00258 }
|
|
Update the Q/P value of the state.
Definition at line 232 of file State.cpp. References m_stateVector. 00233 { 00234 m_stateVector[4] = value; 00235 };
|
|
Update the state vector (presumably of type State::HasMomentum).
Definition at line 217 of file State.cpp. References m_stateVector, and m_z. 00220 { 00221 m_stateVector[0] = x; 00222 m_stateVector[1] = y; 00223 m_stateVector[2] = tx; 00224 m_stateVector[3] = ty; 00225 m_stateVector[4] = qOverP; 00226 m_z = z; 00227 };
|
|
Update the state vector.
Definition at line 422 of file State.h. References m_stateVector. Referenced by TrueStateCreator::createState(), TrueStateCreator::createStateVertex(), and TrFitTrack2TrackCnv::execute(). 00423 { 00424 00425 m_stateVector = state; 00426 00427 }
|
|
Update the Tx slope of the state.
Definition at line 461 of file State.h. References m_stateVector. 00462 { 00463 00464 m_stateVector[2] = value; 00465 00466 }
|
|
Update the Ty slope of the state.
Definition at line 468 of file State.h. References m_stateVector. 00469 { 00470 00471 m_stateVector[3] = value; 00472 00473 }
|
|
Update the x-position of the state.
Definition at line 440 of file State.h. References m_stateVector. 00441 { 00442 00443 m_stateVector[0] = value; 00444 00445 }
|
|
Update the y-position of the state.
Definition at line 447 of file State.h. References m_stateVector. 00448 { 00449 00450 m_stateVector[1] = value; 00451 00452 }
|
|
Update the z-position of the state.
Definition at line 454 of file State.h. References m_z. Referenced by TrackExtrapolator::updateState(). 00455 { 00456 00457 m_z = value; 00458 00459 }
|
|
Retrieve the slopes (Tx=dx/dz,Ty=dy/dz,1.) of the state.
Definition at line 335 of file State.h. References m_stateVector. Referenced by momentum(), TrackExtrapolator::slopes(), and Track::slopes(). 00336 {
00337
00338 return HepVector3D( m_stateVector[2], m_stateVector[3], 1.);
00339
00340 }
|
|
Retrieve the state vector.
Definition at line 265 of file State.h. References m_stateVector. 00266 { 00267 return m_stateVector; 00268 }
|
|
Retrieve const the state vector.
Definition at line 260 of file State.h. References m_stateVector. Referenced by Track2TrFitTrackCnv::execute(), KalmanFilter::iniKalman(), and TrackExtrapolator::updateState(). 00261 { 00262 return m_stateVector; 00263 }
|
|
Retrieve the Tx=dx/dz slope of the state.
Definition at line 342 of file State.h. References m_stateVector. Referenced by errQOverPperp2(), Track2TrFitTrackCnv::execute(), posMomCovariance(), and qOverPperp(). 00343 { 00344 00345 return m_stateVector[2]; 00346 00347 }
|
|
Retrieve the Ty=dy/dz slope of the state.
Definition at line 349 of file State.h. References m_stateVector. Referenced by errQOverPperp2(), Track2TrFitTrackCnv::execute(), posMomCovariance(), and qOverPperp(). 00350 { 00351 00352 return m_stateVector[3]; 00353 00354 }
|
|
Retrieve the x-position of the state.
Definition at line 314 of file State.h. References m_stateVector. Referenced by Track2TrFitTrackCnv::execute(). 00315 { 00316 00317 return m_stateVector[0]; 00318 00319 }
|
|
Retrieve the y-position of the state.
Definition at line 321 of file State.h. References m_stateVector. Referenced by Track2TrFitTrackCnv::execute(). 00322 { 00323 00324 return m_stateVector[1]; 00325 00326 }
|
|
Retrieve the z-position of the state.
Definition at line 328 of file State.h. References m_z. Referenced by Track2TrFitTrackCnv::execute(), and KalmanFilter::filter(). 00329 { 00330 00331 return m_z; 00332 00333 }
|
|
the state covariance matrix (indexes 1,...,5 for x, y, tx, ty, Q/p)
Definition at line 215 of file State.h. Referenced by covariance(), errQOverP2(), errQOverPperp2(), errSlopes(), errTx2(), errTy2(), errX2(), errY2(), setCovariance(), and State(). |
|
the variety of state flags
Definition at line 213 of file State.h. Referenced by flags(), location(), setFlags(), and setLocation(). |
|
the state vector
Definition at line 214 of file State.h. Referenced by errP2(), nParameters(), p(), position(), pt(), qOverP(), setQOverP(), setState(), setTx(), setTy(), setX(), setY(), slopes(), State(), stateVector(), tx(), ty(), x(), and y(). |
|
the z-position of the state
Definition at line 216 of file State.h. Referenced by position(), setState(), setZ(), State(), and z(). |