00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef TrackEvent_Node_H
00016 #define TrackEvent_Node_H 1
00017
00018
00019 #include "Event/State.h"
00020 #include "Event/Measurement.h"
00021 #include "CLHEP/Matrix/Matrix.h"
00022
00023
00024
00025
00035 class Node
00036 {
00037 public:
00038
00040 enum Type{ Muon,
00041 OT,
00042 ST,
00043 TT,
00044 VeloR,
00045 VeloPhi };
00046
00048 Node() : m_flags(0),
00049 m_measurement(),
00050 m_state(),
00051 m_residual(0.0),
00052 m_errResidual(0.0),
00053 m_projectionMatrix() {}
00054
00056 ~Node();
00057
00059 double chi2() const;
00060
00062 Measurement & measurement();
00063
00065 Measurement & measurement() const;
00066
00068 State & state();
00069
00071 State & state() const;
00072
00074 virtual Node* clone() const;
00075
00077 void setMeasurement(const Measurement& meas);
00078
00080 void setState(const State& state);
00081
00083 void setType(const Type& value);
00084
00086 bool checkType(const Type& value) const;
00087
00089 double residual() const;
00090
00092 void setResidual(double value);
00093
00095 double errResidual() const;
00096
00098 void setErrResidual(double value);
00099
00101 const HepMatrix& projectionMatrix() const;
00102
00104 HepMatrix& projectionMatrix();
00105
00107 void setProjectionMatrix(const HepMatrix& value);
00108
00109 protected:
00110
00112 enum flagsBits{typeBits = 0};
00113
00115 enum flagsMasks{typeMask = 0x3FL};
00116
00117
00118 unsigned int m_flags;
00119
00120 private:
00121
00122 Measurement* m_measurement;
00123 State* m_state;
00124 double m_residual;
00125 double m_errResidual;
00126 HepMatrix m_projectionMatrix;
00127
00128 };
00129
00130
00131
00132
00133
00134
00135
00136 inline Node::~Node()
00137 {
00138
00139 delete m_measurement;
00140 delete m_state;
00141
00142 }
00143
00144 inline void Node::setType(const Type& value)
00145 {
00146 unsigned int val = (unsigned int)value;
00147 m_flags &= ~typeMask;
00148 m_flags |= ((((unsigned int)val) << typeBits) & typeMask);
00149 }
00150
00151 inline bool Node::checkType(const Type& value) const
00152 {
00153 unsigned int val = (unsigned int)value;
00154 return 0 != ( m_flags & typeMask & ( val << typeBits ));
00155 }
00156
00157 inline double Node::residual() const
00158 {
00159 return m_residual;
00160 }
00161
00162 inline void Node::setResidual(double value)
00163 {
00164 m_residual = value;
00165 }
00166
00167 inline double Node::errResidual() const
00168 {
00169 return m_errResidual;
00170 }
00171
00172 inline void Node::setErrResidual(double value)
00173 {
00174 m_errResidual = value;
00175 }
00176
00177 inline const HepMatrix& Node::projectionMatrix() const
00178 {
00179 return m_projectionMatrix;
00180 }
00181
00182 inline HepMatrix& Node::projectionMatrix()
00183 {
00184 return m_projectionMatrix;
00185 }
00186
00187 inline void Node::setProjectionMatrix(const HepMatrix& value)
00188 {
00189 m_projectionMatrix = value;
00190 }
00191
00192 inline double Node::chi2() const
00193 {
00194
00195 return (m_errResidual >0 ? m_residual/m_errResidual: 0);
00196
00197 }
00198
00199 inline Measurement & Node::measurement()
00200 {
00201
00202 return *m_measurement;
00203
00204 }
00205
00206 inline Measurement & Node::measurement() const
00207 {
00208
00209 return *m_measurement;
00210
00211 }
00212
00213 inline State & Node::state()
00214 {
00215
00216 return *m_state;
00217
00218 }
00219
00220 inline State & Node::state() const
00221 {
00222
00223 return *m_state;
00224
00225 }
00226
00227 inline Node* Node::clone() const
00228 {
00229
00230 Node* me = new Node(); *me = *this; return me;
00231
00232 }
00233
00234 inline void Node::setMeasurement(const Measurement& meas)
00235 {
00236
00237 m_measurement = meas.clone();
00238
00239 }
00240
00241 inline void Node::setState(const State& state)
00242 {
00243
00244 m_state = state.clone();
00245
00246 }
00247
00248
00249 #endif