#include <TrState.h>
Public Types | |
enum | Type { HasMomentum, StraightLine } |
enum | Location { MostUpstream, FirstMeasurement, AtTT, AtT, BegRich1, EndRich1, BegRich2, EndRich2, Calo, Muon } |
Public Methods | |
TrState () | |
Default constructor. State defined to be of type TrState::HasMomentum. More... | |
virtual | ~TrState () |
Destructor. More... | |
virtual const CLID & | clID () const |
Retrieve pointer to class definition structure. More... | |
unsigned int | nParameters () const |
Retrieve the number of state parameters. More... | |
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. More... | |
HepPoint3D | position () const |
Retrieve the 3D-position vector of the state. More... | |
double | x () const |
Retrieve the x-position of the state. More... | |
double | y () const |
Retrieve the y-position of the state. More... | |
double | z () const |
Retrieve the z-position of the state. More... | |
HepVector3D | slopes () const |
Retrieve the slopes (Tx=dx/dz,Ty=dy/dz,1.) of the state. More... | |
double | tx () const |
Retrieve the Tx=dx/dz slope of the state. More... | |
double | ty () const |
Retrieve the Ty=dy/dz slope of the state. More... | |
virtual double | qOverP () const |
Retrieve the charge-over-momentum Q/P of the state. More... | |
virtual double | p () const |
Retrieve the momentum of the state. More... | |
virtual double | pt () const |
Retrieve the transverse momentum of the state. More... | |
HepVector3D | momentum () const |
Retrieve the momentum vector of the state. More... | |
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. More... | |
virtual HepSymMatrix | posMomCovariance () const |
Retrieve the 6D covariance matrix (x,y,z,px,py,pz) of the state. More... | |
HepSymMatrix | errPosition () const |
Retrieve the errors on the 3D-position vector of the state. More... | |
double | errX2 () const |
Retrieve the squared error on the x-position of the state. More... | |
double | errY2 () const |
Retrieve the squared error on the y-position of the state. More... | |
HepSymMatrix | errSlopes () const |
Retrieve the errors on the slopes of the state. More... | |
double | errTx2 () const |
Retrieve the squared error on the x-slope Tx=dx/dz of the state. More... | |
double | errTy2 () const |
Retrieve the squared error on the y-slope Ty=dy/dz of the state. More... | |
virtual double | errQOverP2 () const |
Retrieve the squared error on the charge-over-momentum Q/P of the state. More... | |
virtual double | errP2 () const |
Retrieve the squared error on the momentum of the state. More... | |
virtual HepSymMatrix | errMomentum () const |
Retrieve the errors on the momentum vector of the stateRetrieve the errors on the momentum vector of the state. More... | |
virtual double | errQOverPperp2 () const |
Retrieve the squared error on the Q/Pperp of the state. More... | |
virtual TrState * | clone () const |
Clone the state. More... | |
virtual void | reset () |
Clear the state before re-using it. More... | |
bool | type (unsigned value) const |
Check the type of the state. More... | |
bool | location (unsigned value) const |
Check the location of the state. More... | |
void | setState (const HepVector &state) |
Update the state vector. More... | |
virtual void | setState (double x, double y, double z, double tx, double ty, double qOverP) |
Update the state vector (presumably of type TrState::HasMomentum). More... | |
void | setState (double x, double y, double z, double tx, double ty) |
Update the state vector (presumably of type TrState::StraightLine). More... | |
void | setCovariance (const HepSymMatrix &value) |
Update the state covariance. More... | |
void | setX (double value) |
Update the x-position of the state. More... | |
void | setY (double value) |
Update the y-position of the state. More... | |
void | setTx (double value) |
Update the Tx slope of the state. More... | |
void | setTy (double value) |
Update the Ty slope of the state. More... | |
virtual void | setQOverP (double value) |
Update the Q/P value of the state. More... | |
void | setLocation (unsigned value) |
Update the location of the state. More... | |
unsigned | flags () const |
Retrieve Variety of state flags. More... | |
const HepVector & | state () const |
Retrieve the state vector. More... | |
HepVector & | state () |
Retrieve the state vector (non-const). More... | |
const HepSymMatrix & | covariance () const |
Retrieve the state covariance matrix (indexes 1,...,5 for x, y, tx, ty, Q/p). More... | |
HepSymMatrix & | covariance () |
Retrieve the state covariance matrix (indexes 1,...,5 for x, y, tx, ty, Q/p) (non-const). More... | |
virtual StreamBuffer & | serialize (StreamBuffer &s) const |
Serialize the object for writing. More... | |
virtual StreamBuffer & | serialize (StreamBuffer &s) |
Serialize the object for reading. More... | |
virtual std::ostream & | fillStream (std::ostream &s) const |
Fill the ASCII output stream. More... | |
Static Public Methods | |
const CLID & | classID () |
Protected Methods | |
bool | isFlagSet (unsigned bits, unsigned mask) |
void | setType (unsigned value) |
Update the type of the state. More... | |
void | setFlag (bool value, unsigned bits, unsigned mask) |
Private Types | |
enum | flagsBits { LocationMostUpstreamBits = 0, LocationFirstMeasurementBits = 1, LocationAtTTBits = 2, LocationAtTBits = 3, LocationBegRich1Bits = 4, LocationEndRich1Bits = 5, LocationBegRich2Bits = 6, LocationEndRich2Bits = 7, LocationCaloBits = 8, LocationMuonBits = 9, TypeHasMomentumBits = 10, TypeStraightLineBits = 11 } |
enum | flagsMasks { LocationMostUpstreamMask = 0x00000001, LocationFirstMeasurementMask = 0x00000002, LocationAtTTMask = 0x00000004, LocationAtTMask = 0x00000008, LocationBegRich1Mask = 0x00000010, LocationEndRich1Mask = 0x00000020, LocationBegRich2Mask = 0x00000040, LocationEndRich2Mask = 0x00000080, LocationCaloMask = 0x00000100, LocationMuonMask = 0x00000200, TypeHasMomentumMask = 0x00000400, TypeStraightLineMask = 0x00000800 } |
Private Attributes | |
unsigned | m_flags |
Variety of state flags. More... | |
HepVector | m_state |
the state vector. More... | |
HepSymMatrix | m_covariance |
the state covariance matrix (indexes 1,...,5 for x, y, tx, ty, Q/p). More... | |
double | m_z |
the z-position of the state. More... |
Definition at line 50 of file TrState.h.
|
Definition at line 222 of file TrState.h.
00222 {LocationMostUpstreamBits = 0, LocationFirstMeasurementBits = 1, LocationAtTTBits = 2, LocationAtTBits = 3, LocationBegRich1Bits = 4, LocationEndRich1Bits = 5, LocationBegRich2Bits = 6, LocationEndRich2Bits = 7, LocationCaloBits = 8, LocationMuonBits = 9, TypeHasMomentumBits = 10, TypeStraightLineBits = 11}; |
|
Definition at line 223 of file TrState.h.
00223 {LocationMostUpstreamMask = 0x00000001, LocationFirstMeasurementMask = 0x00000002, LocationAtTTMask = 0x00000004, LocationAtTMask = 0x00000008, LocationBegRich1Mask = 0x00000010, LocationEndRich1Mask = 0x00000020, LocationBegRich2Mask = 0x00000040, LocationEndRich2Mask = 0x00000080, LocationCaloMask = 0x00000100, LocationMuonMask = 0x00000200, TypeHasMomentumMask = 0x00000400, TypeStraightLineMask = 0x00000800}; |
|
Definition at line 56 of file TrState.h.
|
|
Definition at line 55 of file TrState.h.
00055 {HasMomentum,StraightLine}; |
|
Default constructor. State defined to be of type TrState::HasMomentum.
Definition at line 16 of file TrState.cpp. References HasMomentum, m_covariance, m_state, m_z, and setType. Referenced by clone.
00016 { 00017 setType( TrState::HasMomentum ); 00018 m_z = 0.; 00019 m_state = HepVector(5,0); 00020 m_covariance = HepSymMatrix(5,0); 00021 } |
|
Destructor.
Definition at line 62 of file TrState.h.
00062 {} |
|
Definition at line 242 of file TrState.h. References CLID_TrState. Referenced by clID.
00243 { 00244 return CLID_TrState; 00245 } |
|
Retrieve pointer to class definition structure.
Definition at line 237 of file TrState.h. References classID.
00238 { 00239 return TrState::classID(); 00240 } |
|
Clone the state.
Definition at line 153 of file TrState.cpp. References TrState. Referenced by propagate.
00154 { 00155 return new TrState(*this); 00156 }; |
|
Retrieve the state covariance matrix (indexes 1,...,5 for x, y, tx, ty, Q/p) (non-const).
Definition at line 457 of file TrState.h. References m_covariance.
00458 { 00459 return m_covariance; 00460 } |
|
Retrieve the state covariance matrix (indexes 1,...,5 for x, y, tx, ty, Q/p).
Definition at line 452 of file TrState.h. References m_covariance. Referenced by posMomCovariance.
00453 { 00454 return m_covariance; 00455 } |
|
Retrieve the errors on the momentum vector of the stateRetrieve the errors on the momentum vector of the state.
Definition at line 110 of file TrState.cpp. References isFlagSet, posMomCovariance, TypeHasMomentumBits, and TypeHasMomentumMask.
00111 { 00112 if ( isFlagSet(TypeHasMomentumBits,TypeHasMomentumMask) ) { 00113 return posMomCovariance().sub(4,6); 00114 } 00115 else { 00116 //print out an error message ... 00117 return HepSymMatrix(3,0); 00118 } 00119 }; |
|
Retrieve the squared error on the momentum of the state.
Definition at line 101 of file TrState.cpp. References errQOverP2, and m_state.
00102 { 00103 if ( m_state[4] != 0. ) return errQOverP2() / pow( m_state[4], 4. ); 00104 return 0.; 00105 }; |
|
Retrieve the errors on the 3D-position vector of the state.
Definition at line 329 of file TrState.h. References posMomCovariance.
00330 { 00331 00332 return posMomCovariance().sub(1,3); 00333 00334 } |
|
Retrieve the squared error on the charge-over-momentum Q/P of the state.
Definition at line 93 of file TrState.cpp. References m_covariance. Referenced by errP2.
00094 { 00095 return m_covariance.fast(5,5); 00096 }; |
|
Retrieve the squared error on the Q/Pperp of the state.
Definition at line 124 of file TrState.cpp. References m_covariance, qOverP, tx, and ty.
00125 { 00126 double tx2 = tx() * tx(); 00127 double ty2 = ty() * ty(); 00128 double qOverP2 = qOverP() * qOverP(); 00129 double transSlope = 1. + tx2; 00130 double norm = 1 + tx2 + ty2; 00131 00132 double QOverPperpError = ( (norm/transSlope) * m_covariance[4][4] ) 00133 00134 + ( qOverP2 * tx2 * ty2*ty2 * m_covariance[2][2]/ 00135 (pow(transSlope,3.)*norm)) 00136 00137 + ( qOverP2 * ty2 * m_covariance[3][3] / (norm*transSlope) ) 00138 00139 - ( 2. * qOverP() * tx() * ty2 * m_covariance[2][4] 00140 / ( transSlope*transSlope ) ) 00141 00142 + 2. * qOverP() * ty() * m_covariance[3][4] / transSlope 00143 00144 - 2. * ( qOverP2 * tx() * ty() * ty2 * m_covariance[2][3] 00145 / ( norm* transSlope*transSlope ) ); 00146 00147 return QOverPperpError; 00148 }; |
|
Retrieve the errors on the slopes of the state.
Definition at line 350 of file TrState.h. References m_covariance.
00351 { 00352 00353 HepSymMatrix err = m_covariance.sub(3,5); 00354 err.fast(2,1) = 0.; 00355 err.fast(3,1) = 0.; 00356 err.fast(3,2) = 0.; 00357 err.fast(3,3) = 0.; 00358 return err; 00359 00360 } |
|
Retrieve the squared error on the x-slope Tx=dx/dz of the state.
Definition at line 362 of file TrState.h. References m_covariance.
00363 { 00364 00365 return m_covariance.fast(3,3); 00366 00367 } |
|
Retrieve the squared error on the y-slope Ty=dy/dz of the state.
Definition at line 369 of file TrState.h. References m_covariance.
00370 { 00371 00372 return m_covariance.fast(4,4); 00373 00374 } |
|
Retrieve the squared error on the x-position of the state.
Definition at line 336 of file TrState.h. References m_covariance.
00337 { 00338 00339 return m_covariance.fast(1,1); 00340 00341 } |
|
Retrieve the squared error on the y-position of the state.
Definition at line 343 of file TrState.h. References m_covariance.
00344 { 00345 00346 return m_covariance.fast(2,2); 00347 00348 } |
|
Fill the ASCII output stream.
Definition at line 482 of file TrState.h. References m_covariance, m_flags, m_state, and m_z.
00483 { 00484 s << "{ " 00485 << " flags:\t" << m_flags << std::endl 00486 << " state:\t" << m_state << std::endl 00487 << " covariance:\t" << m_covariance << std::endl 00488 << " z:\t" << (float)m_z << " } "; 00489 return s; 00490 } |
|
Retrieve Variety of state flags.
Definition at line 437 of file TrState.h. References m_flags.
00438 { 00439 return m_flags; 00440 } |
|
Definition at line 213 of file TrState.cpp. References m_flags. Referenced by errMomentum, location, setState, and type.
00214 { 00215 return (bool)((m_flags & mask) >> bits); 00216 }; |
|
|
Retrieve the momentum vector of the state.
Definition at line 312 of file TrState.h. Referenced by positionAndMomentum.
|
|
Retrieve the number of state parameters.
Definition at line 247 of file TrState.h. References m_state. Referenced by setCovariance.
00248 { 00249 00250 return (unsigned int) m_state.num_row(); 00251 00252 } |
|
Retrieve the momentum of the state.
Definition at line 60 of file TrState.cpp. References m_state. Referenced by momentum.
|
|
Retrieve the 3D-position vector of the state.
Definition at line 263 of file TrState.h. Referenced by positionAndMomentum.
|
|
Retrieve the position and momentum vectors and the corresponding 6D covariance matrix (pos:1->3,mom:4-6) of the state.
Definition at line 254 of file TrState.h. References momentum, position, and posMomCovariance.
00255 { 00256 00257 pos = position(); 00258 mom = momentum(); 00259 cov6D = posMomCovariance(); 00260 00261 } |
|
Retrieve the 6D covariance matrix (x,y,z,px,py,pz) of the state.
Definition at line 82 of file TrState.cpp. References covariance. Referenced by errMomentum, errPosition, and positionAndMomentum.
00083 { 00084 HepSymMatrix cov = covariance(); 00085 // to be written ... 00086 00087 return cov; 00088 }; |
|
Retrieve the transverse momentum of the state.
Definition at line 69 of file TrState.cpp. References m_state.
|
|
Retrieve the charge-over-momentum Q/P of the state.
Definition at line 52 of file TrState.cpp. References m_state. Referenced by errQOverPperp2, qOverPperp, and setState.
00053 { 00054 return m_state[4]; 00055 }; |
|
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 321 of file TrState.h. References qOverP, tx, and ty.
|
|
Clear the state before re-using it.
Definition at line 161 of file TrState.cpp. References m_covariance, m_state, and m_z.
00162 { 00163 m_z = 0.; 00164 m_state = HepVector(5,0); 00165 m_covariance = HepSymMatrix(5,0); 00166 }; |
|
Serialize the object for reading.
Definition at line 471 of file TrState.h. References m_covariance, m_flags, m_state, and m_z.
00472 { 00473 float l_z; 00474 s >> m_flags 00475 >> m_state 00476 >> m_covariance 00477 >> l_z; 00478 m_z = l_z; 00479 return s; 00480 } |
|
Serialize the object for writing.
Definition at line 462 of file TrState.h. References m_covariance, m_flags, m_state, and m_z.
00463 { 00464 s << m_flags 00465 << m_state 00466 << m_covariance 00467 << (float)m_z; 00468 return s; 00469 } |
|
Update the state covariance.
Definition at line 394 of file TrState.h. References m_covariance, and nParameters.
00395 { 00396 00397 if ( value.num_row() == (int) nParameters() ) { 00398 m_covariance = value; 00399 } 00400 else { 00401 std::cerr << "ERROR The dimension of the covariance matrix does not match that of the state!" 00402 << "ERROR Using the default covariance matrix." << std::endl; 00403 int dim = nParameters(); 00404 m_covariance = HepSymMatrix(dim,0); 00405 } 00406 00407 } |
|
Definition at line 304 of file TrState.cpp. References m_flags. Referenced by setLocation, and setType.
|
|
|
Update the Q/P value of the state.
Definition at line 243 of file TrState.cpp. References m_state.
00244 { 00245 m_state[4] = value; 00246 }; |
|
Update the state vector (presumably of type TrState::StraightLine).
Definition at line 383 of file TrState.h. References m_state, m_z, tx, ty, x, y, and z.
|
|
Update the state vector (presumably of type TrState::HasMomentum).
Definition at line 221 of file TrState.cpp. References isFlagSet, m_state, m_z, qOverP, tx, ty, TypeStraightLineBits, TypeStraightLineMask, x, y, and z.
00224 { 00225 m_state[0] = x; 00226 m_state[1] = y; 00227 m_state[2] = tx; 00228 m_state[3] = ty; 00229 m_z = z; 00230 if ( isFlagSet(TypeStraightLineBits,TypeStraightLineMask) ) { 00231 std::cerr 00232 << "ERROR You're trying to set the Q/P value for a state of type TrState::StraightLine!" 00233 << "ERROR This value will be discarded." << std::endl; 00234 } 00235 else { 00236 m_state[4] = qOverP; 00237 } 00238 }; |
|
Update the state vector.
Definition at line 376 of file TrState.h. References m_state, and state.
|
|
Update the Tx slope of the state.
Definition at line 423 of file TrState.h. References m_state.
00424 { 00425 00426 m_state[2] = value; 00427 00428 } |
|
Update the Ty slope of the state.
Definition at line 430 of file TrState.h. References m_state.
00431 { 00432 00433 m_state[3] = value; 00434 00435 } |
|
Update the type of the state.
Definition at line 251 of file TrState.cpp. References HasMomentum, setFlag, StraightLine, TypeHasMomentumBits, TypeHasMomentumMask, TypeStraightLineBits, and TypeStraightLineMask. Referenced by TrState.
00252 { 00253 if ( value == TrState::HasMomentum ) 00254 setFlag( true, TypeHasMomentumBits, TypeHasMomentumMask ); 00255 else if ( value == TrState::StraightLine) 00256 setFlag( true, TypeStraightLineBits, TypeStraightLineMask ); 00257 }; |
|
Update the x-position of the state.
Definition at line 409 of file TrState.h. References m_state.
00410 { 00411 00412 m_state[0] = value; 00413 00414 } |
|
Update the y-position of the state.
Definition at line 416 of file TrState.h. References m_state.
00417 { 00418 00419 m_state[1] = value; 00420 00421 } |
|
Retrieve the slopes (Tx=dx/dz,Ty=dy/dz,1.) of the state.
Definition at line 291 of file TrState.h. References m_state. Referenced by momentum.
|
|
Retrieve the state vector (non-const).
Definition at line 447 of file TrState.h. References m_state.
00448 { 00449 return m_state; 00450 } |
|
Retrieve the state vector.
Definition at line 442 of file TrState.h. References m_state. Referenced by setState.
00443 { 00444 return m_state; 00445 } |
|
Retrieve the Tx=dx/dz slope of the state.
Definition at line 298 of file TrState.h. References m_state. Referenced by errQOverPperp2, qOverPperp, and setState.
00299 { 00300 00301 return m_state[2]; 00302 00303 } |
|
Retrieve the Ty=dy/dz slope of the state.
Definition at line 305 of file TrState.h. References m_state. Referenced by errQOverPperp2, qOverPperp, and setState.
00306 { 00307 00308 return m_state[3]; 00309 00310 } |
|
Check the type of the state.
Definition at line 171 of file TrState.cpp. References HasMomentum, isFlagSet, StraightLine, TypeHasMomentumBits, TypeHasMomentumMask, TypeStraightLineBits, and TypeStraightLineMask.
00172 { 00173 if ( value == TrState::HasMomentum) 00174 return isFlagSet( TypeHasMomentumBits, TypeHasMomentumMask ); 00175 else if ( value == TrState::StraightLine) 00176 return isFlagSet( TypeStraightLineBits, TypeStraightLineMask ); 00177 00178 return false; 00179 }; |
|
Retrieve the x-position of the state.
Definition at line 270 of file TrState.h. References m_state. Referenced by setState.
00271 { 00272 00273 return m_state[0]; 00274 00275 } |
|
Retrieve the y-position of the state.
Definition at line 277 of file TrState.h. References m_state. Referenced by setState.
00278 { 00279 00280 return m_state[1]; 00281 00282 } |
|
Retrieve the z-position of the state.
Definition at line 284 of file TrState.h. References m_z. Referenced by setState.
00285 { 00286 00287 return m_z; 00288 00289 } |
|
the state covariance matrix (indexes 1,...,5 for x, y, tx, ty, Q/p).
Definition at line 227 of file TrState.h. Referenced by covariance, errQOverP2, errQOverPperp2, errSlopes, errTx2, errTy2, errX2, errY2, fillStream, reset, serialize, setCovariance, and TrState. |
|
Variety of state flags.
Definition at line 225 of file TrState.h. Referenced by fillStream, flags, isFlagSet, serialize, and setFlag. |
|
the state vector.
Definition at line 226 of file TrState.h. Referenced by errP2, fillStream, nParameters, p, position, pt, qOverP, reset, serialize, setQOverP, setState, setTx, setTy, setX, setY, slopes, state, TrState, tx, ty, x, and y. |
|
the z-position of the state.
Definition at line 228 of file TrState.h. Referenced by fillStream, position, reset, serialize, setState, TrState, and z. |