00001 //----------------------------------------------------------------------------- 00002 // $Id: TTrackBase.h,v 1.14 2011/10/08 01:56:15 maoh Exp $ 00003 //----------------------------------------------------------------------------- 00004 // Filename : TTrackBase.h 00005 // Section : Tracking 00006 // Owner : Yoshi Iwasaki 00007 // Email : yoshihito.iwasaki@kek.jp 00008 //----------------------------------------------------------------------------- 00009 // Description : A virtual class for a track class in tracking. 00010 // See http://bsunsrv1.kek.jp/~yiwasaki/tracking/ 00011 //----------------------------------------------------------------------------- 00012 00013 #ifndef TTrackBase_FLAG_ 00014 #define TTrackBase_FLAG_ 00015 00016 #ifdef TRKRECO_DEBUG_DETAIL 00017 #ifndef TRKRECO_DEBUG 00018 #define TRKRECO_DEBUG 00019 #endif 00020 #endif 00021 00022 #define TrackAxialLayer 0 00023 #define TrackStereoLayer 1 00024 #define TrackBothLayer 2 00025 00026 //...Definition of objectType... 00027 #define TrackBase 1 00028 #define Circle 2 00029 #define Line 4 00030 #define Track 8 00031 #define Segment 16 00032 00033 #include <string> 00034 00035 #define HEP_SHORT_NAMES 00036 #include "CLHEP/Alist/AList.h" 00037 00038 #include "TrkReco/TMDCUtil.h" 00039 00040 class TMLink; 00041 class TTrackMC; 00042 class TMFitter; 00043 class TTrackHEP; 00044 00046 class TTrackBase { 00047 00048 public: 00050 TTrackBase(); 00051 00053 TTrackBase(const AList<TMLink> & links); 00054 00056 virtual ~TTrackBase(); 00057 00058 public:// General information 00060 virtual unsigned objectType(void) const; 00061 00063 virtual unsigned type(void) const; 00064 00066 virtual void dump(const std::string & message = std::string(""), 00067 const std::string & prefix = std::string("")) const; 00068 00069 public:// Hit information 00071 const AList<TMLink> & links(unsigned mask = 0) const; 00072 00074 unsigned nLinks(unsigned mask = 0) const; 00075 00077 const AList<TMLink> & cores(unsigned mask = 0) const; 00078 00080 unsigned nCores(unsigned mask = 0) const; 00081 00082 public:// Hit manipulation 00084 void update(void) const; 00085 00087 void append(TMLink &); 00088 00090 void append(const AList<TMLink> &); 00091 00093 void appendByApproach(AList<TMLink> & list, double maxSigma); 00094 00096 void appendByDistance(AList<TMLink> & list, double maxDistance); 00097 00099 void remove(TMLink & a); 00100 00102 void remove(const AList<TMLink> &); 00103 00105 virtual void refine(AList<TMLink> & list, double maxSigma); 00106 00108 virtual void refine(double maxSigma); 00109 00110 virtual int DropWorst(); 00111 00112 virtual void removeLinks(void); 00113 00115 virtual double distance(const TMLink &) const; 00116 00118 virtual int approach(TMLink &) const; 00119 00121 unsigned testByApproach(const TMLink & list, double sigma) const; 00122 unsigned testByApproach(const AList<TMLink> & list, double sigma) const; 00123 00125 virtual int fit(void); 00126 00128 const TMFitter * const fitter(void) const; 00129 00131 const TMFitter * const fitter(const TMFitter *); 00132 00134 void falseFit(); // added by matsu ( 1999/05/24 ) 00135 00136 public:// Operators 00137 TMLink * operator[](unsigned i) const; 00138 00139 public:// MC information 00141 const TTrackHEP * const hep(void) const; 00142 00144 unsigned nHeps(void) const; 00145 00147 const TTrackMC * const mc(void) const; 00148 00149 public:// Obsolete functions. Followings should be removed in TrkReco 2. 00151 bool fitted(void) const; 00152 00154 bool fittedWithCathode(void) const; 00155 00156 private: 00158 AList<TMLink> refineMain(double maxSigma); 00159 00160 protected:// Always updated 00161 AList<TMLink> _links; 00162 mutable bool _fitted; 00163 mutable bool _fittedWithCathode; 00164 // unsigned _state; 00165 TTrackMC * _mc; 00166 00167 private:// Always updated 00168 mutable bool _updated; 00169 00170 private:// Updated when accessed 00171 mutable AList<TMLink> _cores; 00172 00173 private:// Always updated when accessed 00174 mutable const TTrackHEP * _hep; 00175 mutable unsigned _nHeps; 00176 00177 private: 00178 const TMFitter * _fitter; 00179 float _time; 00180 00181 friend class TMFitter; 00182 friend class THelixFitter; 00183 friend class TCosmicFitter; 00184 00185 #ifdef TRKRECO_DEBUG 00186 public: 00187 bool fitted(bool) const; 00188 #endif 00189 }; 00190 00191 //----------------------------------------------------------------------------- 00192 00193 #ifdef TTrackBase_NO_INLINE 00194 #define inline 00195 #else 00196 #undef inline 00197 #define TTrackBase_INLINE_DEFINE_HERE 00198 #endif 00199 00200 #ifdef TTrackBase_INLINE_DEFINE_HERE 00201 00202 inline 00203 void 00204 TTrackBase::remove(TMLink & a) { 00205 _links.remove(a); 00206 _updated = false; 00207 _fitted = false; 00208 _fittedWithCathode = false; // mod. by matsu ( 1999/05/24 ) 00209 } 00210 00211 inline 00212 void 00213 TTrackBase::remove(const AList<TMLink> & a) { 00214 _links.remove(a); 00215 _updated = false; 00216 _fitted = false; 00217 _fittedWithCathode = false; // mod. by matsu ( 1999/05/24 ) 00218 } 00219 00220 inline 00221 bool 00222 TTrackBase::fitted(void) const { 00223 return _fitted; 00224 } 00225 00226 // added by matsu ( 1999/05/24 ) 00227 inline 00228 void 00229 TTrackBase::falseFit(){ 00230 _fitted = false; 00231 _fittedWithCathode = false; 00232 } 00233 // end of addition 00234 00235 inline 00236 TMLink * 00237 TTrackBase::operator[](unsigned i) const { 00238 return _links[i]; 00239 } 00240 00241 inline 00242 bool 00243 TTrackBase::fittedWithCathode(void) const { 00244 return _fittedWithCathode; 00245 } 00246 00247 inline 00248 const TTrackMC * const 00249 TTrackBase::mc(void) const { 00250 return _mc; 00251 } 00252 00253 inline 00254 const TMFitter * const 00255 TTrackBase::fitter(void) const { 00256 return _fitter; 00257 } 00258 00259 inline 00260 const TMFitter * const 00261 TTrackBase::fitter(const TMFitter * a) { 00262 _fitted = false; 00263 return _fitter = a; 00264 } 00265 00266 inline 00267 unsigned 00268 TTrackBase::objectType(void) const { 00269 return TrackBase; 00270 } 00271 00272 inline 00273 unsigned 00274 TTrackBase::type(void) const { 00275 return 0; 00276 } 00277 00278 #ifdef TRKRECO_DEBUG 00279 inline 00280 bool 00281 TTrackBase::fitted(bool a) const { 00282 return _fitted = a; 00283 } 00284 #endif 00285 00286 #endif 00287 00288 #undef inline 00289 00290 #endif /* TTrackBase_FLAG_ */