00001 #ifndef Track_h 00002 #define Track_h 1 00003 00004 #include "Node.h" 00005 #include "State.h" 00006 ` 00008 class Track { 00009 00010 public: 00011 00013 enum TrackType {}; 00014 00016 enum TrackFlag {History}; 00017 00019 enum StateLocation {BeginVelo,EndVelo}; 00020 00021 protected: 00022 00024 TrackType m_type; 00025 00027 std::map<TrackFlags,int> m_flags; 00028 00030 double m_quality; 00031 00033 size_t m_ndof; 00034 00036 // State m_state; 00037 00039 std::map<StateLocation,State> m_states; 00040 00042 // [optinal: if we agree with Nodes & Clusters ] 00043 // track owns nodes, it should delete it when reset. 00044 std::vector<Node*> m_nodes; 00045 00046 public: 00047 00049 Track() 00050 {reset();} 00051 00053 virtual ~Track() 00054 {reset();} 00055 00057 virtual Track* clone() 00058 {Track* track = new Track(*this); return track;}; 00059 00061 void setType(const TrackType& type) 00062 {m_type = type;} 00063 00065 TrackType type() const 00066 {return m_type;} 00067 00068 // set status 00069 void setFlag(const TrackFlag& flag, int value) 00070 {m_flags[flag] = value;} 00071 00073 int Flag(const TrackFlag& key) const 00074 {return m_flags.find(key)->second;} 00075 00077 std::map<TrackFlag,int>& flags() 00078 {return m_flags;} 00079 00081 const std::map<TrackFlag,int>& flags() const 00082 {return m_flags;} 00083 00085 void setQuality(double quality) 00086 {m_quality = quality;} 00087 00089 double quality() const 00090 {return m_quality;} 00091 00093 void setNdof(size_t ndof) 00094 {_ndof = ndof;} 00095 00097 const size_t ndof() const 00098 {return m_ndof;} 00099 00101 // const State& state() const 00102 // {return m_state;} 00103 00105 // State& state() 00106 // {return m_state;} 00107 00109 // [?] what happen if the key is not in the map? 00110 const State& state(const StateLocation& key) const 00111 {return m_states.find(key)->second;} 00112 00114 State& state(const StateLocation& key) 00115 {return m_states[key];} 00116 00118 std::map<StateLocation,state>& states() 00119 {return m_states;} 00120 00122 const std::map<StateLocation,state>& states() const 00123 {return m_states;} 00124 00126 void setNodes(const std::vector<Node*>& nodes) 00127 {m_nodes = nodes;} 00128 00130 // [optional: if we consider that there is Nodes and Cluster base classes] 00131 std::vector<Node*>& nodes() 00132 {return m_nodes;} 00133 00135 // [optional: if we consider that there is Nodes and Cluster base classes] 00136 const std::vector<Node*>& nodes() const 00137 {return m_nodes;} 00138 00140 virtual void clear(); 00141 00143 virtual void reset(); 00144 00145 }; 00146 00147 00148 } 00149 #endif 00150