00001 //----------------------------------------------------------------------------- 00002 // $Id: TMDCWireHit.h,v 1.7 2010/03/31 09:58:59 liucy Exp $ 00003 //----------------------------------------------------------------------------- 00004 // Filename : TMDCWireHit.h 00005 // Section : Tracking MDC 00006 // Owner : Yoshi Iwasaki 00007 // Email : yoshihito.iwasaki@kek.jp 00008 //----------------------------------------------------------------------------- 00009 // Description : A class to represent a wire hit in MDC. 00010 // See http://bsunsrv1.kek.jp/~yiwasaki/tracking/ 00011 //----------------------------------------------------------------------------- 00012 00013 #ifndef TMDCWireHit_FLAG_ 00014 #define TMDCWireHit_FLAG_ 00015 00016 #ifdef TRKRECO_DEBUG_DETAIL 00017 #ifndef TRKRECO_DEBUG 00018 #define TRKRECO_DEBUG 00019 #endif 00020 #endif 00021 #define WireHitLeft 0 00022 #define WireHitRight 1 00023 00024 //...Masks for state()... 00025 00026 #define WireHitTimeValid 1048576 00027 #define WireHitChargeValid 2097152 00028 #define WireHitFindingValid 4194304 00029 #define WireHitFittingValid 0x40000000 00030 #define WireHitAxial 8 00031 #define WireHitStereo 48 00032 00033 #define WireHitPatternLeft 256 00034 #define WireHitPatternRight 512 00035 #define WireHitIsolated 1024 00036 #define WireHitContinuous 2048 00037 #define WireHitNeighborHit 12 00038 #define WireHitNeighborPattern 258048 00039 #define WireHitNeighborHit0 4096 00040 #define WireHitNeighborHit1 8192 00041 #define WireHitNeighborHit2 16384 00042 #define WireHitNeighborHit3 32768 00043 #define WireHitNeighborHit4 65536 00044 #define WireHitNeighborHit5 131072 00045 00046 #define WireHitLocked 128 00047 #define WireHitUsed 64 00048 #define WireHitLeftMask 1 00049 #define WireHitRightMask 2 00050 #define WireHitMultiTrack 8388608 00051 #define WireHitConformalFinder 16777216 00052 #define WireHitCurlFinder 33554432 00053 #define WireHitClustFinder 67108864 00054 #define WireHitTrackManager 134217728 00055 #define WireHitInvalidForFit 268435456 00056 #define WireHitFastFinder 536870912 00057 00058 #include <string> 00059 00060 #define HEP_SHORT_NAMES 00061 #include "CLHEP/Alist/AList.h" 00062 #ifndef CLHEP_POINT3D_H 00063 #include "CLHEP/Geometry/Point3D.h" 00064 #endif 00065 #ifndef ENABLE_BACKWARDS_COMPATIBILITY 00066 typedef HepGeom::Point3D<double> HepPoint3D; 00067 #endif 00068 00069 //zangsl 040518 change the class declaration to included files 00070 //struct reccdc_wirhit; 00071 //class MdcRec_wirhit 00072 //class TMDCWire; 00073 class TTrack; 00074 //class TMDCWireHitMC; 00075 #include "MdcTables/MdcTables.h" 00076 #include "TrkReco/TMDCWire.h" 00077 //#include "TrkReco/TTrack.h" 00078 #include "TrkReco/TMDCWireHitMC.h" 00079 00080 // A class to represent a wire hit in MDC. 00081 class TMDCWireHit { 00082 00083 public: 00085 TMDCWireHit(TMDCWire *, MdcRec_wirhit *, float fudgeFactor); 00086 00088 virtual ~TMDCWireHit(); 00089 00090 public:// Selectors 00092 void dump(const std::string & message = std::string(""), 00093 const std::string & prefix = std::string("")) const; 00094 00096 const TMDCWire * const wire(void) const; 00097 00099 struct MdcRec_wirhit * reccdc(void) const; 00100 00102 unsigned state(void) const; 00103 00105 float drift(unsigned) const; 00106 00108 float dDrift(unsigned) const; 00109 00111 float drift(void) const; 00112 00114 float dDrift(void) const; 00115 00116 00117 00119 // double DriftTime(double,double) const; 00120 00121 00122 00124 const HepPoint3D & xyPosition(void) const; 00125 00127 HepPoint3D position(unsigned) const; 00128 00130 const TTrack * const track(void) const; 00131 00133 unsigned sequence(void) const; 00134 00136 const TMDCWireHitMC * const mc(void) const; 00137 00138 public:// Modifiers 00140 unsigned state(unsigned newState); 00141 00143 unsigned state(unsigned newState) const; 00144 00146 const TTrack * const track(const TTrack *); 00147 00149 const TTrack * const track(const TTrack *) const; 00150 00152 const TMDCWireHitMC * const mc(TMDCWireHitMC *); 00153 00155 unsigned sequence(unsigned) const; 00156 00157 private: 00158 mutable unsigned _state; 00159 float _drift[2]; // 0:left, 1:right 00160 float _driftError[2]; 00161 const TMDCWire * _wire; 00162 MdcRec_wirhit * const _r; 00163 const HepPoint3D & _xyPosition; 00164 mutable const TTrack * _track; 00165 const TMDCWireHitMC * _mc; 00166 mutable unsigned _sequentialLength; 00167 00168 // _state bit definition 00169 00170 // Pre-detemined 00171 // 20 : drift time valid 00172 // 21 : charge(dE/dx) valid 00173 // 22 : valid for finding 00174 // 30 : valid for fit 00175 // 3 : axial hit 00176 // 4, 5 : stereo hit 00177 00178 // Hit pattern 00179 // 8 : hit pattern left 00180 // 9 : hit pattern right 00181 // 10 : isolated hit pattern 00182 // 11 : continuous hit pattern 00183 // 12 : neighbor hit 0 00184 // 13 : neighbor hit 1 00185 // 14 : neighbor hit 2 00186 // 15 : neighbor hit 3 00187 // 16 : neighbor hit 4 00188 // 17 : neighbor hit 5 00189 00190 // Tracking results 00191 // 7 : locked 00192 // 6 : used for tracking 00193 // 0 : left hit 00194 // 1 : right hit 00195 // 23 : shared by multi-track 00196 // 24 : found by conforaml finder 00197 // 25 : found by curl finder 00198 // 26 : found by clust finder 00199 // 27 : found by track manager 00200 // 28 : NOT valid for fitting 00201 00202 // Fitting results 00203 }; 00204 00205 //----------------------------------------------------------------------------- 00206 00207 #ifdef TMDCWireHit_NO_INLINE 00208 #define inline 00209 #else 00210 #undef inline 00211 #define TMDCWireHit_INLINE_DEFINE_HERE 00212 #endif 00213 00214 #ifdef TMDCWireHit_INLINE_DEFINE_HERE 00215 00216 inline 00217 const TMDCWire * const 00218 TMDCWireHit::wire(void) const { 00219 return _wire; 00220 } 00221 00222 inline 00223 struct MdcRec_wirhit * 00224 TMDCWireHit::reccdc(void) const { 00225 return _r; 00226 } 00227 00228 inline 00229 unsigned 00230 TMDCWireHit::state(void) const { 00231 return _state; 00232 } 00233 00234 inline 00235 float 00236 TMDCWireHit::drift(unsigned i) const { 00237 if (i) return _drift[1]; 00238 return _drift[0]; 00239 } 00240 00241 inline 00242 float 00243 TMDCWireHit::dDrift(unsigned i) const { 00244 if (i) return _driftError[1]; 00245 return _driftError[0]; 00246 } 00247 00248 inline 00249 float 00250 TMDCWireHit::drift(void) const { 00251 return (_drift[0] + _drift[1]) / 2.; 00252 } 00253 00254 inline 00255 float 00256 TMDCWireHit::dDrift(void) const { 00257 return (_driftError[0] + _driftError[1]) / 2.; 00258 } 00259 00260 inline 00261 const HepPoint3D & 00262 TMDCWireHit::xyPosition(void) const { 00263 return _xyPosition; 00264 } 00265 00266 inline 00267 unsigned 00268 TMDCWireHit::state(unsigned i) { 00269 return _state = i; 00270 } 00271 00272 inline 00273 unsigned 00274 TMDCWireHit::state(unsigned i) const { 00275 return _state = i; 00276 } 00277 00278 inline 00279 const TTrack * const 00280 TMDCWireHit::track(void) const { 00281 return _track; 00282 } 00283 00284 inline 00285 const TTrack * const 00286 TMDCWireHit::track(const TTrack * a) { 00287 return _track = a; 00288 } 00289 00290 inline 00291 const TTrack * const 00292 TMDCWireHit::track(const TTrack * a) const { 00293 return _track = a; 00294 } 00295 00296 inline 00297 const TMDCWireHitMC * const 00298 TMDCWireHit::mc(void) const { 00299 return _mc; 00300 } 00301 00302 inline 00303 const TMDCWireHitMC * const 00304 TMDCWireHit::mc(TMDCWireHitMC * a) { 00305 return _mc = a; 00306 } 00307 00308 inline 00309 unsigned 00310 TMDCWireHit::sequence(void) const { 00311 return _sequentialLength; 00312 } 00313 00314 inline 00315 unsigned 00316 TMDCWireHit::sequence(unsigned a) const { 00317 return _sequentialLength = a; 00318 } 00319 00320 #endif 00321 00322 #undef inline 00323 00324 #endif /* TMDCWireHit_FLAG_ */