00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef TackEvent_TrackVertex_H
00016 #define TackEvent_TrackVertex_H 1
00017
00018
00019 #include "Event/Track.h"
00020 #include "CLHEP/Units/SystemOfUnits.h"
00021 #include "GaudiKernel/KeyedObject.h"
00022 #include "GaudiKernel/KeyedContainer.h"
00023 #include "CLHEP/Geometry/Point3D.h"
00024 #include "CLHEP/Matrix/SymMatrix.h"
00025 #include "GaudiKernel/SmartRefVector.h"
00026 #include <ostream>
00027
00028
00029
00030
00031
00032 static const CLID& CLID_TrackVertex = 10020;
00033
00034
00035 namespace TrackVertexLocation {
00036 static const std::string& Velo2D = "Rec/Trig/Vertex2D";
00037 static const std::string& Velo3D = "Rec/Trig/Vertex3D";
00038 }
00039
00040
00050 class TrackVertex: public KeyedObject<int>
00051 {
00052 public:
00053
00055 TrackVertex(int key) : KeyedObject<int>( key ),
00056 m_position(0.0,
00057 0.0,
00058 -1*km),
00059 m_positionErr(3,
00060 0) {}
00061
00063 TrackVertex() : m_position(0.0, 0.0, -1*km),
00064 m_positionErr(3, 0),
00065 m_chi2(0.0),
00066 m_nDoF(0) {}
00067
00069 virtual ~TrackVertex() {}
00070
00071
00072 virtual const CLID& clID() const;
00073 static const CLID& classID();
00074
00076 friend std::ostream& operator<< (std::ostream& str,
00077 const TrackVertex& obj);
00078
00080 virtual std::ostream& fillStream(std::ostream& s) const;
00081
00083 const HepPoint3D& position() const;
00084
00086 HepPoint3D& position();
00087
00089 void setPosition(const HepPoint3D& value);
00090
00092 const HepSymMatrix& positionErr() const;
00093
00095 HepSymMatrix& positionErr();
00096
00098 void setPositionErr(const HepSymMatrix& value);
00099
00101 double chi2() const;
00102
00104 void setChi2(double value);
00105
00107 int nDoF() const;
00108
00110 void setNDoF(int value);
00111
00113 const SmartRefVector<Track>& tracks() const;
00114
00116 SmartRefVector<Track>& tracks();
00117
00119 void setTracks(const SmartRefVector<Track>& value);
00120
00122 void addToTracks(const SmartRef<Track>& value);
00123
00125 void addToTracks(const Track* value);
00126
00128 void removeFromTracks(const SmartRef<Track>& value);
00129
00131 void clearTracks();
00132
00133 protected:
00134
00135 private:
00136
00137 HepPoint3D m_position;
00138 HepSymMatrix m_positionErr;
00139 double m_chi2;
00140 int m_nDoF;
00141 SmartRefVector<Track> m_tracks;
00142
00143 };
00144
00145
00146
00147
00148
00149
00150
00151 inline const CLID& TrackVertex::clID() const
00152 {
00153 return TrackVertex::classID();
00154 }
00155
00156 inline const CLID& TrackVertex::classID()
00157 {
00158 return CLID_TrackVertex;
00159 }
00160
00161 inline std::ostream& operator<< (std::ostream& str,
00162 const TrackVertex& obj)
00163 {
00164 return obj.fillStream(str);
00165 }
00166
00167 inline std::ostream& TrackVertex::fillStream(std::ostream& s) const
00168 {
00169 s << "{ " << "position : " << m_position << std::endl
00170 << "positionErr : " << m_positionErr << std::endl
00171 << "chi2 : " << (float)m_chi2 << std::endl
00172 << "nDoF : " << m_nDoF << std::endl << " }";
00173 return s;
00174 }
00175
00176
00177 inline const HepPoint3D& TrackVertex::position() const
00178 {
00179 return m_position;
00180 }
00181
00182 inline HepPoint3D& TrackVertex::position()
00183 {
00184 return m_position;
00185 }
00186
00187 inline void TrackVertex::setPosition(const HepPoint3D& value)
00188 {
00189 m_position = value;
00190 }
00191
00192 inline const HepSymMatrix& TrackVertex::positionErr() const
00193 {
00194 return m_positionErr;
00195 }
00196
00197 inline HepSymMatrix& TrackVertex::positionErr()
00198 {
00199 return m_positionErr;
00200 }
00201
00202 inline void TrackVertex::setPositionErr(const HepSymMatrix& value)
00203 {
00204 m_positionErr = value;
00205 }
00206
00207 inline double TrackVertex::chi2() const
00208 {
00209 return m_chi2;
00210 }
00211
00212 inline void TrackVertex::setChi2(double value)
00213 {
00214 m_chi2 = value;
00215 }
00216
00217 inline int TrackVertex::nDoF() const
00218 {
00219 return m_nDoF;
00220 }
00221
00222 inline void TrackVertex::setNDoF(int value)
00223 {
00224 m_nDoF = value;
00225 }
00226
00227 inline const SmartRefVector<Track>& TrackVertex::tracks() const
00228 {
00229 return m_tracks;
00230 }
00231
00232 inline SmartRefVector<Track>& TrackVertex::tracks()
00233 {
00234 return m_tracks;
00235 }
00236
00237 inline void TrackVertex::setTracks(const SmartRefVector<Track>& value)
00238 {
00239 m_tracks = value;
00240 }
00241
00242 inline void TrackVertex::addToTracks(const SmartRef<Track>& value)
00243 {
00244 m_tracks.push_back(value);
00245 }
00246
00247 inline void TrackVertex::addToTracks(const Track* value)
00248 {
00249 m_tracks.push_back(value);
00250 }
00251
00252 inline void TrackVertex::removeFromTracks(const SmartRef<Track>& value)
00253 {
00254 SmartRefVector<Track>::iterator iter =
00255 std::remove(m_tracks.begin(), m_tracks.end(), value);
00256 m_tracks.erase(iter, m_tracks.end());
00257 }
00258
00259 inline void TrackVertex::clearTracks()
00260 {
00261 m_tracks.clear();
00262 }
00263
00264
00265 typedef KeyedContainer<TrackVertex, Containers::HashMap> TrackVertices;
00266
00267
00268
00269 #endif