00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef TSegment0_FLAG_
00014 #define TSegment0_FLAG_
00015
00016 #ifdef TRKRECO_DEBUG_DETAIL
00017 #ifndef TRKRECO_DEBUG
00018 #define TRKRECO_DEBUG
00019 #endif
00020 #endif
00021 #ifndef CLHEP_POINT3D_H
00022 #include "CLHEP/Geometry/Point3D.h"
00023 #endif
00024 #ifndef ENABLE_BACKWARDS_COMPATIBILITY
00025 typedef HepGeom::Point3D<double> HepPoint3D;
00026 #endif
00027 #include "CLHEP/Geometry/Vector3D.h"
00028 #ifndef ENABLE_BACKWARDS_COMPATIBILITY
00029 typedef HepGeom::Vector3D<double> HepVector3D;
00030 #endif
00031
00032 #include "TrkReco/TTrackBase.h"
00033 #include "TrkReco/TMDCUtil.h"
00034 #include "TrkReco/TMLink.h"
00035
00036 class TTrack;
00037 class Range;
00038 template <class T> class CAList;
00039
00041 class TSegment0 : public TTrackBase {
00042
00043 public:
00045 TSegment0();
00046 TSegment0(const AList<TMLink> &);
00047
00049 virtual ~TSegment0();
00050
00051 public:
00053 virtual unsigned objectType(void) const;
00054
00056 void dump(const std::string & message = std::string(""),
00057 const std::string & prefix = std::string("")) const;
00058
00060 unsigned superLayerId() const;
00061
00063 const HepPoint3D & position(void) const;
00064
00066 const HepVector3D & direction(void) const;
00067
00069 double distance(const TSegment0 &) const;
00070 double distance(const HepPoint3D &, const HepVector3D &) const;
00071
00073 Range rangeX(double min, double max) const;
00074
00076 unsigned innerWidth(void) const;
00077
00079 unsigned outerWidth(void) const;
00080
00082 unsigned innerMostLayer(void) const;
00083
00085 unsigned outerMostLayer(void) const;
00086
00088 unsigned clusterType(void) const;
00089
00091 AList<TSegment0> split(void) const;
00092
00093 int solveDualHits(void);
00094 double duality(void) const;
00095
00096 public:
00097 AList<TTrack> & tracks(void);
00098
00099 public:
00100 AList<TSegment0> & innerLinks(void);
00101
00102 private:
00103 AList<TSegment0> splitAV(void) const;
00104 AList<TSegment0> splitParallel(void) const;
00105 AList<TSegment0> splitComplicated(void) const;
00106 AList<TSegment0> splitDual(void) const;
00107
00108 private:
00110 void update(void) const;
00111
00113 void updateType(void) const;
00114
00116 void updateDuality(void) const;
00117
00118 private:
00119
00120 AList<TTrack> _tracks;
00121 AList<TSegment0> _innerLinks;
00122
00123 private:
00124 mutable HepPoint3D _position;
00125 mutable HepVector3D _direction;
00126 mutable unsigned _innerWidth;
00127 mutable unsigned _outerWidth;
00128 mutable unsigned _innerMostLayer;
00129 mutable unsigned _outerMostLayer;
00130 mutable AList<TMLink> _inners;
00131 mutable AList<TMLink> _outers;
00132 mutable unsigned _nLayer;
00133 mutable unsigned _clusterType;
00134 mutable double _duality;
00135 mutable unsigned _nDual;
00136 mutable double _angle;
00137 };
00138
00139
00141 unsigned NCoreLinks(const CAList<TSegment0> & list);
00142
00144 AList<TMLink> Links(const TSegment0 &, const TTrack &);
00145
00146
00148
00149
00150
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161 #ifdef TSegment0_NO_INLINE
00162 #define inline
00163 #else
00164 #undef inline
00165 #define TSegment0_INLINE_DEFINE_HERE
00166 #endif
00167
00168 #ifdef TSegment0_INLINE_DEFINE_HERE
00169
00170 inline
00171 const HepPoint3D &
00172 TSegment0::position(void) const {
00173 if (! _fitted) update();
00174 return _position;
00175 }
00176
00177 inline
00178 const HepVector3D &
00179 TSegment0::direction(void) const {
00180 if (! _fitted) update();
00181 return _direction;
00182 }
00183
00184 inline
00185 unsigned
00186 TSegment0::innerWidth(void) const {
00187 if (! _fitted) update();
00188 return _innerWidth;
00189 }
00190
00191 inline
00192 unsigned
00193 TSegment0::outerWidth(void) const {
00194 if (! _fitted) update();
00195 return _outerWidth;
00196 }
00197
00198 inline
00199 unsigned
00200 TSegment0::innerMostLayer(void) const {
00201 if (! _fitted) update();
00202 return _innerMostLayer;
00203 }
00204
00205 inline
00206 unsigned
00207 TSegment0::outerMostLayer(void) const {
00208 if (! _fitted) update();
00209 return _outerMostLayer;
00210 }
00211
00212 inline
00213 unsigned
00214 TSegment0::clusterType(void) const {
00215 if (! nLinks()) return 0;
00216 if (_clusterType == 0) updateType();
00217 return _clusterType;
00218 }
00219
00220 inline
00221 double
00222 TSegment0::duality(void) const {
00223 return _duality;
00224 }
00225
00226 inline
00227 unsigned
00228 TSegment0::objectType(void) const {
00229 return Segment;
00230 }
00231
00232 inline
00233 unsigned
00234 TSegment0::superLayerId(void) const {
00235 unsigned id = (links())[0]->wire()->superLayerId();
00236 #ifdef TRKRECO_DEBUG
00237 {
00238 const AList<TMLink> & list = links();
00239 unsigned n = list.length();
00240 for (unsigned i = 1; i < n; i++) {
00241 if (list[i]->hit()->wire()->superLayerId() != id) {
00242 std::cout << "TSegment0::superLayerId !!! strange segment found";
00243 std::cout << std::endl;
00244 dump();
00245 break;
00246 }
00247 }
00248 }
00249 #endif
00250 return id;
00251 }
00252
00253 inline
00254 AList<TTrack> &
00255 TSegment0::tracks(void) {
00256 return _tracks;
00257 }
00258
00259 inline
00260 AList<TSegment0> &
00261 TSegment0::innerLinks(void) {
00262 return _innerLinks;
00263 }
00264
00265 #endif
00266
00267 #undef inline
00268
00269 #endif
00270