#include <State.h>
Public Types | |
enum | Type { HasMomentum = 1, StraightLine = 2 } |
enumeration for the state type More... | |
enum | Location { MostUpstream = 1, FirstMeasurement = 2, AtTT = 4, AtT = 8, BegRich1 = 16, EndRich1 = 32, BegRich2 = 64, EndRich2 = 128, Calo = 256, Muon = 512 } |
enumeration for the location of the state More... | |
Public Member Functions | |
State () | |
Default constructor. State defined to be of type State::HasMomentum. | |
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. | |
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. | |
virtual void | reset () |
Clear the state before re-using it. | |
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 | setState (double x, double y, double z, double tx, double ty) |
Update the state vector (presumably of type State::StraightLine). | |
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. | |
unsigned int | flags () const |
Retrieve const the variety of state flags. | |
bool | checkType (const Type &value) const |
Check state type. | |
void | setLocation (const Location &value) |
Update state location. | |
bool | checkLocation (const Location &value) const |
Check state location. | |
const HepVector & | state () const |
Retrieve const the state vector. | |
HepVector & | state () |
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 | |
const CLID & | classID () |
Protected Types | |
enum | flagsBits { typeBits = 0, locationBits = 2 } |
Offsets of bitfield flags. More... | |
enum | flagsMasks { typeMask = 0x3L, locationMask = 0xFFCL } |
Bitmasks for bitfield flags. More... | |
Protected Member Functions | |
void | setType (const State::Type &value) |
Update the type of the state. | |
Protected Attributes | |
unsigned int | m_flags |
the variety of state flags | |
Private Attributes | |
HepVector | m_state |
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 228 of file State.h.
00228 {typeBits = 0, 00229 locationBits = 2}; |
|
Bitmasks for bitfield flags.
Definition at line 232 of file State.h.
00232 {typeMask = 0x3L, 00233 locationMask = 0xFFCL}; |
|
enumeration for the location of the state
Definition at line 55 of file State.h.
00055 { MostUpstream=1, 00056 FirstMeasurement=2, 00057 AtTT=4, 00058 AtT=8, 00059 BegRich1=16, 00060 EndRich1=32, 00061 BegRich2=64, 00062 EndRich2=128, 00063 Calo=256, 00064 Muon=512 }; |
|
enumeration for the state type
Definition at line 52 of file State.h.
00052 { HasMomentum=1, 00053 StraightLine=2 }; |
|
Default constructor. State defined to be of type State::HasMomentum.
Definition at line 16 of file State.cpp. References HasMomentum, m_covariance, m_state, m_z, and setType(). Referenced by clone().
00016 { 00017 setType( State::HasMomentum ); 00018 m_z = 0.; 00019 m_state = HepVector(5,0); 00020 m_covariance = HepSymMatrix(5,0); 00021 } |
|
Default Destructor.
Definition at line 70 of file State.h.
00070 {} |
|
Check state location.
Definition at line 279 of file State.h. References locationMask, and m_flags.
00280 { 00281 unsigned int val = (unsigned int)value; return 0 != ( m_flags & locationMask & val ); 00282 } |
|
Check state type.
Definition at line 267 of file State.h. References m_flags, and typeMask. Referenced by errMomentum(), and setState().
|
|
Definition at line 257 of file State.h. References CLID_State. Referenced by clID().
00258 { 00259 return CLID_State; 00260 } |
|
Definition at line 252 of file State.h. References classID().
00253 { 00254 return State::classID(); 00255 } |
|
Clone the state.
Definition at line 125 of file State.cpp. References State().
00126 { 00127 return new State(*this); 00128 }; |
|
Retrieve the state covariance matrix (indexes 1,...,5 for x, y, tx, ty, Q/p).
Definition at line 299 of file State.h. References m_covariance.
00300 { 00301 return m_covariance; 00302 } |
|
Retrieve const the state covariance matrix (indexes 1,...,5 for x, y, tx, ty, Q/p).
Definition at line 294 of file State.h. References m_covariance. Referenced by posMomCovariance().
00295 { 00296 return m_covariance; 00297 } |
|
Retrieve the errors on the momentum vector of the stateRetrieve the errors on the momentum vector of the state.
Definition at line 83 of file State.cpp. References checkType(), HasMomentum, and posMomCovariance(). Referenced by Track::momentum().
00084 { 00085 if ( checkType( State::HasMomentum ) ) { 00086 return posMomCovariance().sub(4,6); 00087 } 00088 else { 00089 return HepSymMatrix(3,0); 00090 } 00091 }; |
|
Retrieve the squared error on the momentum of the state.
Definition at line 74 of file State.cpp. References errQOverP2(), and m_state.
00075 { 00076 if ( m_state[4] != 0. ) return errQOverP2() / pow( m_state[4], 4. ); 00077 return 0.; 00078 }; |
|
Retrieve the errors on the 3D-position vector of the state.
Definition at line 388 of file State.h. References posMomCovariance(). Referenced by Track::position().
00389 { 00390 00391 return posMomCovariance().sub(1,3); 00392 00393 } |
|
Retrieve the squared error on the charge-over-momentum Q/P of the state.
Definition at line 66 of file State.cpp. References m_covariance. Referenced by errP2().
00067 { 00068 return m_covariance.fast(5,5); 00069 }; |
|
Retrieve the squared error on the Q/Pperp of the state.
Definition at line 96 of file State.cpp. References m_covariance, qOverP(), tx(), and ty().
00097 { 00098 double tx2 = tx() * tx(); 00099 double ty2 = ty() * ty(); 00100 double qOverP2 = qOverP() * qOverP(); 00101 double transSlope = 1. + tx2; 00102 double norm = 1 + tx2 + ty2; 00103 00104 double QOverPperpError = ( (norm/transSlope) * m_covariance[4][4] ) 00105 00106 + ( qOverP2 * tx2 * ty2*ty2 * m_covariance[2][2]/ 00107 (pow(transSlope,3.)*norm)) 00108 00109 + ( qOverP2 * ty2 * m_covariance[3][3] / (norm*transSlope) ) 00110 00111 - ( 2. * qOverP() * tx() * ty2 * m_covariance[2][4] 00112 / ( transSlope*transSlope ) ) 00113 00114 + 2. * qOverP() * ty() * m_covariance[3][4] / transSlope 00115 00116 - 2. * ( qOverP2 * tx() * ty() * ty2 * m_covariance[2][3] 00117 / ( norm* transSlope*transSlope ) ); 00118 00119 return QOverPperpError; 00120 }; |
|
Retrieve the errors on the slopes of the state.
Definition at line 409 of file State.h. References m_covariance. Referenced by Track::slopes().
00410 { 00411 00412 HepSymMatrix err = m_covariance.sub(3,5); 00413 err.fast(2,1) = 0.; 00414 err.fast(3,1) = 0.; 00415 err.fast(3,2) = 0.; 00416 err.fast(3,3) = 0.; 00417 return err; 00418 00419 } |
|
Retrieve the squared error on the x-slope Tx=dx/dz of the state.
Definition at line 421 of file State.h. References m_covariance.
00422 { 00423 00424 return m_covariance.fast(3,3); 00425 00426 } |
|
Retrieve the squared error on the y-slope Ty=dy/dz of the state.
Definition at line 428 of file State.h. References m_covariance.
00429 { 00430 00431 return m_covariance.fast(4,4); 00432 00433 } |
|
Retrieve the squared error on the x-position of the state.
Definition at line 395 of file State.h. References m_covariance.
00396 { 00397 00398 return m_covariance.fast(1,1); 00399 00400 } |
|
Retrieve the squared error on the y-position of the state.
Definition at line 402 of file State.h. References m_covariance.
00403 { 00404 00405 return m_covariance.fast(2,2); 00406 00407 } |
|
Retrieve const the variety of state flags.
Definition at line 262 of file State.h. References m_flags.
00263 { 00264 return m_flags; 00265 } |
|
Retrieve the momentum vector of the state.
Definition at line 371 of file State.h. Referenced by Track::momentum(), and positionAndMomentum().
|
|
Retrieve the number of state parameters.
Definition at line 304 of file State.h. References m_state. Referenced by setCovariance().
00305 { 00306 00307 return (unsigned int) m_state.num_row(); 00308 00309 } |
|
Retrieve the momentum of the state.
Definition at line 34 of file State.cpp. References m_state. Referenced by momentum(), and Track::p().
00035 { 00036 if ( m_state[4] != 0. ) return fabs( 1./m_state[4] ); 00037 return 0.; 00038 }; |
|
Retrieve the 3D-position vector of the state.
Definition at line 322 of file State.h. Referenced by Track::position(), and positionAndMomentum().
00323 {
00324
00325 return HepPoint3D( m_state[0], m_state[1], m_z );
00326
00327 }
|
|
Retrieve the position and momentum vectors and the corresponding 6D covariance matrix (pos:1->3,mom:4-6) of the state.
Definition at line 311 of file State.h. References momentum(), position(), and posMomCovariance(). Referenced by Track::positionAndMomentum().
00314 { 00315 00316 pos = position(); 00317 mom = momentum(); 00318 cov6D = posMomCovariance(); 00319 00320 } |
|
Retrieve the 6D covariance matrix (x,y,z,px,py,pz) of the state.
Definition at line 55 of file State.cpp. References covariance(). Referenced by errMomentum(), errPosition(), positionAndMomentum(), and Track::posMomCovariance().
00056 { 00057 HepSymMatrix cov = covariance(); 00058 // to be written ... 00059 00060 return cov; 00061 }; |
|
Retrieve the transverse momentum of the state.
Definition at line 43 of file State.cpp. References m_state. Referenced by Track::pt().
|
|
Retrieve the charge-over-momentum Q/P of the state.
Definition at line 26 of file State.cpp. References m_state. Referenced by Track::charge(), errQOverPperp2(), and qOverPperp().
00027 { 00028 return m_state[4]; 00029 }; |
|
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 380 of file State.h. References qOverP(), tx(), and ty().
|
|
Clear the state before re-using it.
Definition at line 133 of file State.cpp. References m_covariance, m_state, and m_z. Referenced by Track::reset().
00134 { 00135 m_z = 0.; 00136 m_state = HepVector(5,0); 00137 m_covariance = HepSymMatrix(5,0); 00138 }; |
|
Update the state covariance.
Definition at line 457 of file State.h. References m_covariance, and nParameters().
00458 { 00459 00460 if ( value.num_row() == (int) nParameters() ) { 00461 m_covariance = value; 00462 } 00463 else { 00464 std::cerr << "ERROR The dimension of the covariance matrix does not match that of the state!" 00465 << "ERROR Using the default covariance matrix." << std::endl; 00466 int dim = nParameters(); 00467 m_covariance = HepSymMatrix(dim,0); 00468 } 00469 00470 } |
|
Update state location.
Definition at line 272 of file State.h. References locationBits, locationMask, and m_flags.
00273 { 00274 unsigned int val = (unsigned int)value; 00275 m_flags &= ~locationMask; 00276 m_flags |= ((((unsigned int)val) << locationBits) & locationMask); 00277 } |
|
Update the Q/P value of the state.
Definition at line 165 of file State.cpp. References m_state.
00166 { 00167 m_state[4] = value; 00168 }; |
|
Update the state vector (presumably of type State::StraightLine).
Definition at line 442 of file State.h.
|
|
Update the state vector (presumably of type State::HasMomentum).
Definition at line 143 of file State.cpp. References checkType(), m_state, m_z, and StraightLine.
00146 { 00147 m_state[0] = x; 00148 m_state[1] = y; 00149 m_state[2] = tx; 00150 m_state[3] = ty; 00151 m_z = z; 00152 if ( checkType( State::StraightLine ) ) { 00153 std::cerr 00154 << "ERROR You're trying to set the Q/P value for a state of type State::StraightLine!" 00155 << "ERROR This value will be discarded." << std::endl; 00156 } 00157 else { 00158 m_state[4] = qOverP; 00159 } 00160 }; |
|
Update the state vector.
Definition at line 435 of file State.h. References m_state.
00436 { 00437 00438 m_state = state; 00439 00440 } |
|
Update the Tx slope of the state.
Definition at line 493 of file State.h. References m_state.
00494 { 00495 00496 m_state[2] = value; 00497 00498 } |
|
Update the Ty slope of the state.
Definition at line 500 of file State.h. References m_state.
00501 { 00502 00503 m_state[3] = value; 00504 00505 } |
|
Update the type of the state.
Definition at line 173 of file State.cpp. References m_flags, typeBits, and typeMask. Referenced by State().
|
|
Update the x-position of the state.
Definition at line 472 of file State.h. References m_state.
00473 { 00474 00475 m_state[0] = value; 00476 00477 } |
|
Update the y-position of the state.
Definition at line 479 of file State.h. References m_state.
00480 { 00481 00482 m_state[1] = value; 00483 00484 } |
|
Update the z-position of the state.
Definition at line 486 of file State.h. References m_z.
00487 { 00488 00489 m_z = value; 00490 00491 } |
|
Retrieve the slopes (Tx=dx/dz,Ty=dy/dz,1.) of the state.
Definition at line 350 of file State.h. References m_state. Referenced by momentum(), and Track::slopes().
00351 {
00352
00353 return HepVector3D( m_state[2], m_state[3], 1.);
00354
00355 }
|
|
Retrieve the state vector.
Definition at line 289 of file State.h. References m_state.
00290 { 00291 return m_state; 00292 } |
|
Retrieve const the state vector.
Definition at line 284 of file State.h. References m_state.
00285 { 00286 return m_state; 00287 } |
|
Retrieve the Tx=dx/dz slope of the state.
Definition at line 357 of file State.h. References m_state. Referenced by errQOverPperp2(), and qOverPperp().
00358 { 00359 00360 return m_state[2]; 00361 00362 } |
|
Retrieve the Ty=dy/dz slope of the state.
Definition at line 364 of file State.h. References m_state. Referenced by errQOverPperp2(), and qOverPperp().
00365 { 00366 00367 return m_state[3]; 00368 00369 } |
|
Retrieve the x-position of the state.
Definition at line 329 of file State.h. References m_state.
00330 { 00331 00332 return m_state[0]; 00333 00334 } |
|
Retrieve the y-position of the state.
Definition at line 336 of file State.h. References m_state.
00337 { 00338 00339 return m_state[1]; 00340 00341 } |
|
Retrieve the z-position of the state.
Definition at line 343 of file State.h. References m_z.
00344 { 00345 00346 return m_z; 00347 00348 } |
|
the state covariance matrix (indexes 1,...,5 for x, y, tx, ty, Q/p)
Definition at line 241 of file State.h. Referenced by covariance(), errQOverP2(), errQOverPperp2(), errSlopes(), errTx2(), errTy2(), errX2(), errY2(), reset(), setCovariance(), and State(). |
|
the variety of state flags
Definition at line 236 of file State.h. Referenced by checkLocation(), checkType(), flags(), setLocation(), and setType(). |
|
the state vector
Definition at line 240 of file State.h. Referenced by errP2(), nParameters(), p(), position(), pt(), qOverP(), reset(), setQOverP(), setState(), setTx(), setTy(), setX(), setY(), slopes(), state(), State(), tx(), ty(), x(), and y(). |
|
the z-position of the state
Definition at line 242 of file State.h. Referenced by position(), reset(), setState(), setZ(), State(), and z(). |