#include <State.h>
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. | |
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 (you own the pointer). | |
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. | |
bool | checkType (unsigned int value) const |
check if the state is of this type | |
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 | type () const |
Retrieve state type. | |
void | setType (unsigned int value) |
Update state type. | |
unsigned int | location () const |
Retrieve state location. | |
void | setLocation (unsigned int value) |
Update 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 | |
static const CLID & | classID () |
Protected Types | |
enum | flagsBits { typeBits = 0, locationBits = 3 } |
Offsets of bitfield flags. More... | |
enum | flagsMasks { typeMask = 0x7L, locationMask = 0x1FF8L } |
Bitmasks for bitfield flags. More... | |
Protected Attributes | |
unsigned int | m_flags |
the variety of state flags | |
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 46 of file State.h.
|
Offsets of bitfield flags.
Definition at line 225 of file State.h. 00225 {typeBits = 0, 00226 locationBits = 3};
|
|
Bitmasks for bitfield flags.
Definition at line 229 of file State.h. 00229 {typeMask = 0x7L, 00230 locationMask = 0x1FF8L};
|
|
Default constructor. State defined to be of type State::HasMomentum.
Definition at line 20 of file State.cpp. References m_covariance, m_state, m_z, setLocation(), and setType(). Referenced by clone(). 00020 { 00021 setType( StateKeys::HasMomentum ); 00022 setLocation( StateKeys::LocationUnknown ); 00023 m_z = 0.; 00024 m_state = HepVector(5,0); 00025 m_covariance = HepSymMatrix(5,0); 00026 }
|
|
Default Destructor.
Definition at line 54 of file State.h. 00054 {}
|
|
check if the state is of this location
Definition at line 533 of file State.h. References location(). 00534 { 00535 00536 return location() == value; 00537 00538 }
|
|
check if the state is of this type
Definition at line 526 of file State.h. References type(). Referenced by errMomentum(), and setState(). 00527 { 00528 00529 return type() == value; 00530 00531 }
|
|
Definition at line 253 of file State.h. References CLID_State. Referenced by clID(). 00254 { 00255 return CLID_State; 00256 }
|
|
Definition at line 248 of file State.h. References classID(). 00249 { 00250 return State::classID(); 00251 }
|
|
Clone the state (you own the pointer).
Definition at line 205 of file State.cpp. References State(). Referenced by Node::setState(). 00206 { 00207 return new State(*this); 00208 };
|
|
Retrieve the state covariance matrix (indexes 1,...,5 for x, y, tx, ty, Q/p).
Definition at line 307 of file State.h. References m_covariance. 00308 { 00309 return m_covariance; 00310 }
|
|
Retrieve const the state covariance matrix (indexes 1,...,5 for x, y, tx, ty, Q/p).
Definition at line 302 of file State.h. References m_covariance. Referenced by posMomCovariance(). 00303 { 00304 return m_covariance; 00305 }
|
|
Retrieve the errors on the momentum vector of the stateRetrieve the errors on the momentum vector of the state.
Definition at line 162 of file State.cpp. References checkType(), and posMomCovariance(). Referenced by Track::momentum(). 00163 { 00164 if ( checkType( StateKeys::HasMomentum ) ) { 00165 const HepSymMatrix temp = posMomCovariance(); // CLHEP 1.9, must be const 00166 return temp.sub(4,6); 00167 } 00168 else { 00169 return HepSymMatrix(3,0); 00170 } 00171 };
|
|
Retrieve the squared error on the momentum of the state.
Definition at line 153 of file State.cpp. References errQOverP2(), and m_state. 00154 {
00155 if ( m_state[4] != 0. ) return errQOverP2() / pow( m_state[4], 4. );
00156 return 0.;
00157 };
|
|
Retrieve the errors on the 3D-position vector of the state.
Definition at line 405 of file State.h. References posMomCovariance(). Referenced by Track::position(). 00406 { 00407 00408 const HepSymMatrix temp = posMomCovariance(); 00409 return temp.sub(1,3); 00410 00411 }
|
|
Retrieve the squared error on the charge-over-momentum Q/P of the state.
Definition at line 145 of file State.cpp. References m_covariance. Referenced by errP2(). 00146 { 00147 return m_covariance.fast(5,5); 00148 };
|
|
Retrieve the squared error on the Q/Pperp of the state.
Definition at line 176 of file State.cpp. References m_covariance, qOverP(), tx(), and ty(). 00177 { 00178 double tx2 = tx() * tx(); 00179 double ty2 = ty() * ty(); 00180 double qOverP2 = qOverP() * qOverP(); 00181 double transSlope = 1. + tx2; 00182 double norm = 1 + tx2 + ty2; 00183 00184 double QOverPperpError = ( (norm/transSlope) * m_covariance[4][4] ) 00185 00186 + ( qOverP2 * tx2 * ty2*ty2 * m_covariance[2][2]/ 00187 (pow(transSlope,3.)*norm)) 00188 00189 + ( qOverP2 * ty2 * m_covariance[3][3] / (norm*transSlope) ) 00190 00191 - ( 2. * qOverP() * tx() * ty2 * m_covariance[2][4] 00192 / ( transSlope*transSlope ) ) 00193 00194 + 2. * qOverP() * ty() * m_covariance[3][4] / transSlope 00195 00196 - 2. * ( qOverP2 * tx() * ty() * ty2 * m_covariance[2][3] 00197 / ( norm* transSlope*transSlope ) ); 00198 00199 return QOverPperpError; 00200 };
|
|
Retrieve the errors on the slopes of the state.
Definition at line 427 of file State.h. References m_covariance. Referenced by Track::slopes(). 00428 { 00429 00430 const HepSymMatrix temp = m_covariance; 00431 HepSymMatrix err = temp.sub(3,5); 00432 err.fast(2,1) = 0.; 00433 err.fast(3,1) = 0.; 00434 err.fast(3,2) = 0.; 00435 err.fast(3,3) = 0.; 00436 return err; 00437 00438 }
|
|
Retrieve the squared error on the x-slope Tx=dx/dz of the state.
Definition at line 440 of file State.h. References m_covariance. 00441 { 00442 00443 return m_covariance.fast(3,3); 00444 00445 }
|
|
Retrieve the squared error on the y-slope Ty=dy/dz of the state.
Definition at line 447 of file State.h. References m_covariance. 00448 { 00449 00450 return m_covariance.fast(4,4); 00451 00452 }
|
|
Retrieve the squared error on the x-position of the state.
Definition at line 413 of file State.h. References m_covariance. 00414 { 00415 00416 return m_covariance.fast(1,1); 00417 00418 }
|
|
Retrieve the squared error on the y-position of the state.
Definition at line 420 of file State.h. References m_covariance. 00421 { 00422 00423 return m_covariance.fast(2,2); 00424 00425 }
|
|
Retrieve const the variety of state flags.
Definition at line 258 of file State.h. References m_flags. 00259 { 00260 return m_flags; 00261 }
|
|
Retrieve state location.
Definition at line 280 of file State.h. References locationBits, locationMask, and m_flags. Referenced by checkLocation(). 00281 { 00282 return (unsigned int)((m_flags & locationMask) >> locationBits); 00283 }
|
|
Retrieve the momentum vector of the state.
Definition at line 388 of file State.h. Referenced by Track::momentum(), and positionAndMomentum(). 00389 { 00390 00391 HepVector3D mom = slopes(); 00392 mom *= ( p() / mom.mag() ); 00393 return mom; 00394 00395 }
|
|
Retrieve the number of state parameters.
Definition at line 312 of file State.h. References m_state. Referenced by setCovariance(). 00313 { 00314 00315 return (unsigned int) m_state.num_row(); 00316 00317 }
|
|
Retrieve the momentum of the state.
Definition at line 39 of file State.cpp. References m_state. Referenced by momentum(), Track::p(), and posMomCovariance(). 00040 {
00041 if ( m_state[4] != 0. ) return fabs( 1./m_state[4] );
00042 return HUGE_VAL;
00043 };
|
|
Retrieve the 3D-position vector of the state.
Definition at line 339 of file State.h. Referenced by Track::position(), and positionAndMomentum(). 00340 {
00341
00342 return HepPoint3D( m_state[0], m_state[1], m_z );
00343
00344 }
|
|
Retrieve the position and momentum vectors of the state.
Definition at line 330 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 319 of file State.h. References momentum(), position(), and posMomCovariance(). Referenced by Track::positionAndMomentum(). 00322 { 00323 00324 pos = position(); 00325 mom = momentum(); 00326 cov6D = posMomCovariance(); 00327 00328 }
|
|
Retrieve the 6D covariance matrix (x,y,z,px,py,pz) of the state.
Definition at line 60 of file State.cpp. References covariance(), p(), qOverP(), tx(), and ty(). Referenced by errMomentum(), errPosition(), positionAndMomentum(), and Track::posMomCovariance(). 00061 { 00062 // Transformation done in 2 steps: 00063 // 1) "convert" first from (x,y,tx,ty,Q/p) to (x,y,z,tx,ty,Q/p) 00064 const HepSymMatrix cov5D = covariance(); 00065 HepSymMatrix cov6Dtmp = HepSymMatrix(6,0); 00066 00067 std::vector<int> index; 00068 index.push_back( 1 ); 00069 index.push_back( 3 ); 00070 index.push_back( 4 ); 00071 index.push_back( 5 ); 00072 00073 for ( int jj=0 ; jj<5 ; jj++ ) { 00074 for ( int i=jj ; i<5 ; i++ ) { 00075 cov6Dtmp.fast(index[i]+1,index[jj]+1) = cov5D.fast(i+1,jj+1); 00076 } 00077 } 00078 cov6Dtmp.fast(3,1) = 0.; 00079 cov6Dtmp.fast(3,2) = 0.; 00080 cov6Dtmp.fast(3,3) = 0.; 00081 cov6Dtmp.fast(4,3) = 0.; 00082 cov6Dtmp.fast(5,3) = 0.; 00083 cov6Dtmp.fast(6,3) = 0.; 00084 00085 // 2) transformation from (x,y,z,tx,ty,Q/p) to (x,y,z,px,py,pz) 00086 // jacobian J = I 0 00087 // 0 j 00088 // -> covariance matrix C = C_A C_B.T() 00089 // C_B C_D 00090 // becomes C' = C_A (j.C_B).T() after similarity transformation 00091 // j.C_B j.C_D.(j.T()) 00092 double Tx = tx(); 00093 double Ty = ty(); 00094 double QOverP = qOverP(); 00095 double Q = ( QOverP != 0. ? (fabs(QOverP)/QOverP) : 0. ); 00096 double Tx2 = Tx * Tx; 00097 double Ty2 = Ty * Ty; 00098 double Qp = Q * p(); 00099 double N = 1. / sqrt( 1 + Tx2 + Ty2 ); 00100 double N2 = N*N; 00101 00102 HepSymMatrix cov6D = HepSymMatrix(6,0); 00103 HepSymMatrix C_A = cov6Dtmp.sub(1,3); 00104 HepSymMatrix C_D = cov6Dtmp.sub(4,6); 00105 HepMatrix C_B = HepMatrix(3,3,0); 00106 HepMatrix jmat = HepMatrix(3,3,0); 00107 00108 jmat[0][0] = ( 1 + Ty2 ) * N2; 00109 jmat[0][1] = - Tx * Ty * N2; 00110 jmat[0][2] = - Qp * Tx; 00111 jmat[1][0] = - Tx * Ty * N2; 00112 jmat[1][1] = ( 1 + Tx2 ) * N2; 00113 jmat[1][2] = - Qp * Ty; 00114 jmat[2][0] = - Tx * N2; 00115 jmat[2][1] = - Ty * N2; 00116 jmat[2][2] = - Qp; 00117 00118 C_B(1,1) = cov6Dtmp.fast(4,1); 00119 C_B(2,1) = cov6Dtmp.fast(5,1); 00120 C_B(2,2) = cov6Dtmp.fast(5,2); 00121 C_B(3,1) = cov6Dtmp.fast(6,1); 00122 C_B(3,2) = cov6Dtmp.fast(6,2); 00123 C_B(3,3) = cov6Dtmp.fast(6,3); 00124 00125 C_B = jmat * C_B; 00126 00127 cov6D.sub(1,C_A); 00128 cov6D.sub(4,C_D.similarity(jmat)); 00129 cov6D.fast(4,1) = C_B(1,1); 00130 cov6D.fast(5,1) = C_B(2,1); 00131 cov6D.fast(6,1) = C_B(3,1); 00132 cov6D.fast(4,2) = C_B(1,2); 00133 cov6D.fast(5,2) = C_B(2,2); 00134 cov6D.fast(6,2) = C_B(3,2); 00135 cov6D.fast(4,3) = C_B(1,3); 00136 cov6D.fast(5,3) = C_B(2,3); 00137 cov6D.fast(6,3) = C_B(3,3); 00138 00139 return cov6D; 00140 };
|
|
Retrieve the transverse momentum of the state.
Definition at line 48 of file State.cpp. References m_state. Referenced by Track::pt(). 00049 { 00050 if ( m_state[4] != 0. ) { 00051 double txy2 = m_state[2]*m_state[2] + m_state[3]*m_state[3]; 00052 return sqrt( txy2/(1.+txy2) ) / fabs( m_state[4] ); 00053 } 00054 return HUGE_VAL; 00055 };
|
|
Retrieve the charge-over-momentum Q/P of the state.
Definition at line 31 of file State.cpp. References m_state. Referenced by Track::charge(), errQOverPperp2(), posMomCovariance(), and qOverPperp(). 00032 { 00033 return m_state[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 397 of file State.h. References qOverP(), tx(), and ty(). 00398 { 00399 00400 double tx2 = tx() * tx(); 00401 return ( qOverP() * sqrt( (1.+ tx2 + ty()*ty()) / (1. + tx2 ) ) ); 00402 00403 }
|
|
Clear the state before re-using it.
Definition at line 213 of file State.cpp. References m_covariance, m_state, and m_z. 00214 { 00215 m_z = 0.; 00216 m_state = HepVector(5,0); 00217 m_covariance = HepSymMatrix(5,0); 00218 };
|
|
Update the state covariance.
Definition at line 476 of file State.h. References m_covariance, and nParameters(). 00477 { 00478 00479 if ( value.num_row() == (int) nParameters() ) { 00480 m_covariance = value; 00481 } 00482 else { 00483 std::cerr << "ERROR The dimension of the covariance matrix does not match that of the state!" 00484 << "ERROR Using the default covariance matrix." << std::endl; 00485 int dim = nParameters(); 00486 m_covariance = HepSymMatrix(dim,0); 00487 } 00488 00489 }
|
|
Update the variety of state flags.
Definition at line 263 of file State.h. References m_flags. 00264 { 00265 m_flags = value; 00266 }
|
|
Update state location.
Definition at line 285 of file State.h. References locationBits, locationMask, and m_flags. Referenced by State(). 00286 { 00287 unsigned int val = (unsigned int)value; 00288 m_flags &= ~locationMask; 00289 m_flags |= ((((unsigned int)val) << locationBits) & locationMask); 00290 }
|
|
Update the Q/P value of the state.
Definition at line 245 of file State.cpp. References m_state. 00246 { 00247 m_state[4] = value; 00248 };
|
|
Update the state vector (presumably of type State::StraightLine).
Definition at line 461 of file State.h. 00466 { 00467 00468 m_state[0] = x; 00469 m_state[1] = y; 00470 m_state[2] = tx; 00471 m_state[3] = ty; 00472 m_z = z; 00473 00474 }
|
|
Update the state vector (presumably of type State::HasMomentum).
Definition at line 223 of file State.cpp. References checkType(), m_state, and m_z. 00226 { 00227 m_state[0] = x; 00228 m_state[1] = y; 00229 m_state[2] = tx; 00230 m_state[3] = ty; 00231 m_z = z; 00232 if ( checkType( StateKeys::StraightLine ) ) { 00233 std::cerr 00234 << "ERROR You're trying to set the Q/P value for a state of type State::StraightLine!" 00235 << "ERROR This value will be discarded." << std::endl; 00236 } 00237 else { 00238 m_state[4] = qOverP; 00239 } 00240 };
|
|
Update the state vector.
Definition at line 454 of file State.h. References m_state, and state().
|
|
Update the Tx slope of the state.
Definition at line 512 of file State.h. References m_state. 00513 { 00514 00515 m_state[2] = value; 00516 00517 }
|
|
Update the Ty slope of the state.
Definition at line 519 of file State.h. References m_state. 00520 { 00521 00522 m_state[3] = value; 00523 00524 }
|
|
Update state type.
Definition at line 273 of file State.h. References m_flags, typeBits, and typeMask. Referenced by State(). 00274 { 00275 unsigned int val = (unsigned int)value; 00276 m_flags &= ~typeMask; 00277 m_flags |= ((((unsigned int)val) << typeBits) & typeMask); 00278 }
|
|
Update the x-position of the state.
Definition at line 491 of file State.h. References m_state. 00492 { 00493 00494 m_state[0] = value; 00495 00496 }
|
|
Update the y-position of the state.
Definition at line 498 of file State.h. References m_state. 00499 { 00500 00501 m_state[1] = value; 00502 00503 }
|
|
Update the z-position of the state.
Definition at line 505 of file State.h. References m_z. 00506 { 00507 00508 m_z = value; 00509 00510 }
|
|
Retrieve the slopes (Tx=dx/dz,Ty=dy/dz,1.) of the state.
Definition at line 367 of file State.h. References m_state. Referenced by momentum(), and Track::slopes(). 00368 {
00369
00370 return HepVector3D( m_state[2], m_state[3], 1.);
00371
00372 }
|
|
Retrieve the state vector.
Definition at line 297 of file State.h. References m_state. 00298 { 00299 return m_state; 00300 }
|
|
Retrieve const the state vector.
Definition at line 292 of file State.h. References m_state. Referenced by setState(). 00293 { 00294 return m_state; 00295 }
|
|
Retrieve the Tx=dx/dz slope of the state.
Definition at line 374 of file State.h. References m_state. Referenced by errQOverPperp2(), posMomCovariance(), and qOverPperp(). 00375 { 00376 00377 return m_state[2]; 00378 00379 }
|
|
Retrieve the Ty=dy/dz slope of the state.
Definition at line 381 of file State.h. References m_state. Referenced by errQOverPperp2(), posMomCovariance(), and qOverPperp(). 00382 { 00383 00384 return m_state[3]; 00385 00386 }
|
|
Retrieve state type.
Definition at line 268 of file State.h. References m_flags, typeBits, and typeMask. Referenced by checkType().
|
|
Retrieve the x-position of the state.
Definition at line 346 of file State.h. References m_state. 00347 { 00348 00349 return m_state[0]; 00350 00351 }
|
|
Retrieve the y-position of the state.
Definition at line 353 of file State.h. References m_state. 00354 { 00355 00356 return m_state[1]; 00357 00358 }
|
|
Retrieve the z-position of the state.
Definition at line 360 of file State.h. References m_z. 00361 { 00362 00363 return m_z; 00364 00365 }
|
|
the state covariance matrix (indexes 1,...,5 for x, y, tx, ty, Q/p)
Definition at line 235 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 233 of file State.h. Referenced by flags(), location(), setFlags(), setLocation(), setType(), and type(). |
|
the state vector
Definition at line 234 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 236 of file State.h. Referenced by position(), reset(), setState(), setZ(), State(), and z(). |