#include <TSegment0.h>
Inheritance diagram for TSegment0:
Public Member Functions | |
void | append (const AList< TMLink > &) |
appends TMLinks. | |
void | append (TMLink &) |
appends a TMLink. | |
void | append (const AList< TMLink > &) |
appends TMLinks. | |
void | append (TMLink &) |
appends a TMLink. | |
void | appendByApproach (AList< TMLink > &list, double maxSigma) |
appends TMLinks by approach. 'list' is an input. Unappended TMLinks will be removed from 'list' when returned. | |
void | appendByApproach (AList< TMLink > &list, double maxSigma) |
appends TMLinks by approach. 'list' is an input. Unappended TMLinks will be removed from 'list' when returned. | |
void | appendByDistance (AList< TMLink > &list, double maxDistance) |
appends TMLinks by distance. 'list' is an input. Unappended TMLinks will be removed from 'list' when returned. | |
void | appendByDistance (AList< TMLink > &list, double maxDistance) |
appends TMLinks by distance. 'list' is an input. Unappended TMLinks will be removed from 'list' when returned. | |
virtual int | approach (TMLink &) const |
calculates the closest approach to a wire in real space. Results are stored in TMLink. Return value is negative if error happened. | |
virtual int | approach (TMLink &) const |
calculates the closest approach to a wire in real space. Results are stored in TMLink. Return value is negative if error happened. | |
unsigned | clusterType (void) const |
returns cluster type. 0:empty, 1:short line, 2:long line, 3:V shage(from outside), 4:A shape, 5:X shape, 6:parallel, 7:complicated. | |
unsigned | clusterType (void) const |
returns cluster type. 0:empty, 1:short line, 2:long line, 3:V shage(from outside), 4:A shape, 5:X shape, 6:parallel, 7:complicated. | |
const AList< TMLink > & | cores (unsigned mask=0) const |
returns a list of masked TMLinks for fit. 'mask' will be applied if mask is not 0. | |
const AList< TMLink > & | cores (unsigned mask=0) const |
returns a list of masked TMLinks for fit. 'mask' will be applied if mask is not 0. | |
const HepVector3D & | direction (void) const |
returns direction. | |
const HepVector3D & | direction (void) const |
returns direction. | |
virtual double | distance (const TMLink &) const |
returns distance to a position of TMLink in TMLink space. | |
double | distance (const HepPoint3D &, const HepVector3D &) const |
double | distance (const TSegment0 &) const |
calculates distance between two clusters. Smaller value indicates closer. | |
double | distance (const HepPoint3D &, const HepVector3D &) const |
double | distance (const TSegment0 &) const |
calculates distance between two clusters. Smaller value indicates closer. | |
double | duality (void) const |
double | duality (void) const |
void | dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const |
dumps debug information. | |
void | dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const |
dumps debug information. | |
void | falseFit () |
false Fit | |
void | falseFit () |
false Fit | |
virtual int | fit (void) |
fits itself by a default fitter. Error was happened if return value is not zero. | |
virtual int | fit (void) |
fits itself by a default fitter. Error was happened if return value is not zero. | |
bool | fitted (void) const |
returns true if fitted. | |
bool | fitted (void) const |
returns true if fitted. | |
bool | fittedWithCathode (void) const |
returns true if fitted with cathode hits(TEMPORARY). | |
bool | fittedWithCathode (void) const |
returns true if fitted with cathode hits(TEMPORARY). | |
const TMFitter *const | fitter (const TMFitter *) |
sets a default fitter. | |
const TMFitter *const | fitter (void) const |
returns a pointer to a default fitter. | |
const TMFitter *const | fitter (const TMFitter *) |
sets a default fitter. | |
const TMFitter *const | fitter (void) const |
returns a pointer to a default fitter. | |
const TTrackHEP *const | hep (void) const |
returns TTrackHEP. | |
const TTrackHEP *const | hep (void) const |
returns TTrackHEP. | |
AList< TSegment0 > & | innerLinks (void) |
AList< TSegment0 > & | innerLinks (void) |
unsigned | innerMostLayer (void) const |
returns inner most layer. | |
unsigned | innerMostLayer (void) const |
returns inner most layer. | |
unsigned | innerWidth (void) const |
returns inner width. | |
unsigned | innerWidth (void) const |
returns inner width. | |
const AList< TMLink > & | links (unsigned mask=0) const |
returns a list of masked TMLinks assigned to this track. 'mask' will be applied if mask is not 0. | |
const AList< TMLink > & | links (unsigned mask=0) const |
returns a list of masked TMLinks assigned to this track. 'mask' will be applied if mask is not 0. | |
const TTrackMC *const | mc (void) const |
returns a pointer to TTrackMC. | |
const TTrackMC *const | mc (void) const |
returns a pointer to TTrackMC. | |
unsigned | nCores (unsigned mask=0) const |
returns # of masked TMLinks for fit. 'mask' will be applied if mask is not 0. | |
unsigned | nCores (unsigned mask=0) const |
returns # of masked TMLinks for fit. 'mask' will be applied if mask is not 0. | |
unsigned | nHeps (void) const |
returns # of contributed TTrackHEP tracks. | |
unsigned | nHeps (void) const |
returns # of contributed TTrackHEP tracks. | |
unsigned | nLinks (unsigned mask=0) const |
returns # of masked TMLinks assigned to this track object. | |
unsigned | nLinks (unsigned mask=0) const |
returns # of masked TMLinks assigned to this track object. | |
virtual unsigned | objectType (void) const |
returns type. | |
virtual unsigned | objectType (void) const |
returns type. | |
TMLink * | operator[] (unsigned i) const |
TMLink * | operator[] (unsigned i) const |
unsigned | outerMostLayer (void) const |
returns outer most layer. | |
unsigned | outerMostLayer (void) const |
returns outer most layer. | |
unsigned | outerWidth (void) const |
returns outer width. | |
unsigned | outerWidth (void) const |
returns outer width. | |
const HepPoint3D & | position (void) const |
returns position. | |
const HepPoint3D & | position (void) const |
returns position. | |
Range | rangeX (double min, double max) const |
returns Range of x-coordinate of TMLinks. | |
Range | rangeX (double min, double max) const |
returns Range of x-coordinate of TMLinks. | |
virtual void | refine (double maxSigma) |
removes bad points by pull. The bad points are masked not to be used in fit. | |
virtual void | refine (AList< TMLink > &list, double maxSigma) |
removes bad points by pull. The bad points are removed from the track, and are returned in 'list'. | |
virtual void | refine (double maxSigma) |
removes bad points by pull. The bad points are masked not to be used in fit. | |
virtual void | refine (AList< TMLink > &list, double maxSigma) |
removes bad points by pull. The bad points are removed from the track, and are returned in 'list'. | |
void | remove (const AList< TMLink > &) |
removes TMLinks. | |
void | remove (TMLink &a) |
removes a TMLink. | |
void | remove (const AList< TMLink > &) |
removes TMLinks. | |
void | remove (TMLink &a) |
removes a TMLink. | |
virtual void | removeLinks (void) |
virtual void | removeLinks (void) |
int | solveDualHits (void) |
int | solveDualHits (void) |
AList< TSegment0 > | split (void) const |
returns a list of sub TSegments in this cluster. If cluster type is 1, 2, or 7, no cluster is returned. | |
AList< TSegment0 > | split (void) const |
returns a list of sub TSegments in this cluster. If cluster type is 1, 2, or 7, no cluster is returned. | |
unsigned | superLayerId () const |
returns super layer id. | |
unsigned | superLayerId () const |
returns super layer id. | |
unsigned | testByApproach (const AList< TMLink > &list, double sigma) const |
unsigned | testByApproach (const TMLink &list, double sigma) const |
returns # of good hits to be appended. | |
unsigned | testByApproach (const AList< TMLink > &list, double sigma) const |
unsigned | testByApproach (const TMLink &list, double sigma) const |
returns # of good hits to be appended. | |
AList< TTrack > & | tracks (void) |
AList< TTrack > & | tracks (void) |
TSegment0 (const AList< TMLink > &) | |
TSegment0 () | |
Constructor. | |
TSegment0 (const AList< TMLink > &) | |
TSegment0 () | |
Constructor. | |
virtual unsigned | type (void) const |
returns type. Definition is depending on an object class. | |
virtual unsigned | type (void) const |
returns type. Definition is depending on an object class. | |
virtual | ~TSegment0 () |
Destructor. | |
virtual | ~TSegment0 () |
Destructor. | |
Protected Attributes | |
bool | _fitted |
bool | _fittedWithCathode |
AList< TMLink > | _links |
AList< TMLink > | _links |
TTrackMC * | _mc |
TTrackMC * | _mc |
Private Member Functions | |
AList< TSegment0 > | splitAV (void) const |
AList< TSegment0 > | splitAV (void) const |
AList< TSegment0 > | splitComplicated (void) const |
AList< TSegment0 > | splitComplicated (void) const |
AList< TSegment0 > | splitDual (void) const |
AList< TSegment0 > | splitDual (void) const |
AList< TSegment0 > | splitParallel (void) const |
AList< TSegment0 > | splitParallel (void) const |
void | update (void) const |
updates cache. | |
void | update (void) const |
updates cache. | |
void | updateDuality (void) const |
updates duality. | |
void | updateDuality (void) const |
updates duality. | |
void | updateType (void) const |
updates type. | |
void | updateType (void) const |
updates type. | |
Private Attributes | |
double | _angle |
unsigned | _clusterType |
HepVector3D | _direction |
double | _duality |
AList< TSegment0 > | _innerLinks |
AList< TSegment0 > | _innerLinks |
unsigned | _innerMostLayer |
AList< TMLink > | _inners |
AList< TMLink > | _inners |
unsigned | _innerWidth |
unsigned | _nDual |
unsigned | _nLayer |
unsigned | _outerMostLayer |
AList< TMLink > | _outers |
AList< TMLink > | _outers |
unsigned | _outerWidth |
HepPoint3D | _position |
AList< TTrack > | _tracks |
AList< TTrack > | _tracks |
|
Constructor.
00023 : TTrackBase(), 00024 _innerWidth(0), 00025 _outerWidth(0), 00026 _nLayer(0), 00027 _clusterType(0), 00028 _duality(0.), 00029 _nDual(0), 00030 _angle(0.) { 00031 _fitted = false; 00032 }
|
|
00035 : TTrackBase(a), 00036 _innerWidth(0), 00037 _outerWidth(0), 00038 _nLayer(0), 00039 _clusterType(0), 00040 _duality(0.), 00041 _nDual(0), 00042 _angle(0.) { 00043 _links.sort(SortByWireId); 00044 _fitted = false; 00045 }
|
|
Destructor.
00047 { 00048 }
|
|
Constructor.
|
|
|
|
Destructor.
|
|
appends TMLinks.
|
|
appends a TMLink.
|
|
appends TMLinks.
00357 { 00358 AList<TMLink> tmp; 00359 for (unsigned i = 0; i < a.length(); i++) { 00360 if ((_links.hasMember(a[i])) || (a[i]->hit()->state() & WireHitUsed)) { 00361 #ifdef TRKRECO_DEBUG_DETAIL 00362 std::cout << " TTrackBase::append(list) !!! "; 00363 std::cout << a[i]->wire()->name(); 00364 std::cout << " Hey!, this is already used! Don't mess with me."; 00365 std::cout << std::endl; 00366 #endif 00367 continue; 00368 } 00369 else { 00370 tmp.append(a[i]); 00371 } 00372 } 00373 _links.append(tmp); 00374 _updated = false; 00375 _fitted = false; 00376 _fittedWithCathode = false; // added by matsu ( 1999/05/24 ) 00377 }
|
|
appends a TMLink.
00335 { 00336 if ((a.hit()->state() & WireHitUsed)) { 00337 #ifdef TRKRECO_DEBUG_DETAIL 00338 std::cout << "TTrackBase::append !!! " << a.wire()->name() 00339 << " this is already used by another track!" << std::endl; 00340 #endif 00341 return; 00342 } 00343 if (_links.hasMember(a)) { 00344 #ifdef TRKRECO_DEBUG_DETAIL 00345 std::cout << "TTrackBase::append !!! " << a.wire()->name() 00346 << " this is already included in this track!" << std::endl; 00347 #endif 00348 return; 00349 } 00350 _links.append(a); 00351 _updated = false; 00352 _fitted = false; 00353 _fittedWithCathode = false; // added by matsu ( 1999/05/24 ) 00354 }
|
|
appends TMLinks by approach. 'list' is an input. Unappended TMLinks will be removed from 'list' when returned.
|
|
appends TMLinks by approach. 'list' is an input. Unappended TMLinks will be removed from 'list' when returned.
00101 { 00102 #ifdef TRKRECO_DEBUG_DETAIL 00103 std::cout << " TTrackBase::appendByApproach ... sigma=" << maxSigma << std::endl; 00104 #endif 00105 00106 AList<TMLink> unused; 00107 unsigned n = list.length(); 00108 for (unsigned i = 0; i < n; i++) { 00109 TMLink & l = * list[i]; 00110 00111 if ((_links.hasMember(l)) || (l.hit()->state() & WireHitUsed)) 00112 continue; 00113 00114 //...Calculate closest approach... 00115 int err = approach(l); 00116 if (err < 0) { 00117 unused.append(l); 00118 continue; 00119 } 00120 00121 //...Calculate sigma... 00122 float distance = (l.positionOnWire() - l.positionOnTrack()).mag(); 00123 float diff = fabs(distance - l.drift()); 00124 float sigma = diff / l.dDrift(); 00125 00126 //...For debug... 00127 #ifdef TRKRECO_DEBUG_DETAIL 00128 std::cout << " sigma=" << sigma; 00129 std::cout << ",dist=" << distance; 00130 std::cout << ",diff=" << diff; 00131 std::cout << ",err=" << l.hit()->dDrift() << ","; 00132 if (sigma < maxSigma) std::cout << "ok,"; 00133 else std::cout << "X,"; 00134 l.dump("mc"); 00135 #endif 00136 00137 //...Make sigma cut... 00138 if (sigma > maxSigma) { 00139 unused.append(l); 00140 continue; 00141 } 00142 00143 //...OK... 00144 _links.append(l); 00145 _updated = false; 00146 _fitted = false; 00147 } 00148 list.remove(unused); 00149 }
|
|
appends TMLinks by distance. 'list' is an input. Unappended TMLinks will be removed from 'list' when returned.
|
|
appends TMLinks by distance. 'list' is an input. Unappended TMLinks will be removed from 'list' when returned.
00152 {
00153 std::cout << "TTrackBase::appendByDistance !!! not implemented" << std::endl;
00154 list.removeAll();
00155 }
|
|
calculates the closest approach to a wire in real space. Results are stored in TMLink. Return value is negative if error happened.
|
|
calculates the closest approach to a wire in real space. Results are stored in TMLink. Return value is negative if error happened.
Reimplemented in TTrack, and TTrack. 00095 { 00096 std::cout << "TTrackBase::approach !!! not implemented" << std::endl; 00097 return -1; 00098 }
|
|
returns cluster type. 0:empty, 1:short line, 2:long line, 3:V shage(from outside), 4:A shape, 5:X shape, 6:parallel, 7:complicated.
|
|
returns cluster type. 0:empty, 1:short line, 2:long line, 3:V shage(from outside), 4:A shape, 5:X shape, 6:parallel, 7:complicated.
00214 { 00215 if (! nLinks()) return 0; 00216 if (_clusterType == 0) updateType(); 00217 return _clusterType; 00218 }
|
|
returns a list of masked TMLinks for fit. 'mask' will be applied if mask is not 0.
|
|
returns a list of masked TMLinks for fit. 'mask' will be applied if mask is not 0.
00290 { 00291 if (mask) 00292 std::cout << "TTrackBase::cores !!! mask is not supported" << std::endl; 00293 if (! _updated) update(); 00294 return _cores; 00295 }
|
|
returns direction.
|
|
returns direction.
00179 { 00180 if (! _fitted) update(); 00181 return _direction; 00182 }
|
|
returns distance to a position of TMLink in TMLink space.
Reimplemented in TLine0, TMLine, TLine0, and TMLine. 00089 { 00090 std::cout << "TTrackBase::distance !!! not implemented" << std::endl; 00091 return 0.; 00092 }
|
|
|
|
calculates distance between two clusters. Smaller value indicates closer.
|
|
00143 { 00144 HepVector3D dir = _position - p; 00145 if (dir.x() > M_PI) dir.setX(dir.x() - 2. * M_PI); 00146 else if (dir.x() < - M_PI) dir.setX(2. * M_PI + dir.x()); 00147 00148 float radial = fabs(v.unit().dot(dir)); 00149 float radial2 = radial * radial; 00150 00151 return (dir.mag2() - radial2) > 0.0 ? sqrt(dir.mag2() - radial2) : 0.; 00152 }
|
|
calculates distance between two clusters. Smaller value indicates closer.
00131 { 00132 HepVector3D dir = c.position() - _position; 00133 if (dir.x() > M_PI) dir.setX(dir.x() - 2. * M_PI); 00134 else if (dir.x() < - M_PI) dir.setX(2. * M_PI + dir.x()); 00135 00136 float radial = fabs(_direction.dot(dir)); 00137 float radial2 = radial * radial; 00138 00139 return (dir.mag2() - radial2) > 0.0 ? sqrt(dir.mag2() - radial2) : 0.; 00140 }
|
|
|
|
00222 {
00223 return _duality;
00224 }
|
|
dumps debug information.
Reimplemented from TTrackBase. |
|
dumps debug information.
Reimplemented from TTrackBase. 00051 { 00052 if (! _fitted) update(); 00053 bool def = false; 00054 if (msg == "") def = true; 00055 00056 if (def || msg.find("cluster") != std::string::npos || msg.find("detail") != std::string::npos) { 00057 std::cout << pre; 00058 std::cout << "#links=" << _links.length(); 00059 std::cout << "(" << _innerWidth << "," << _outerWidth << ":"; 00060 std::cout << clusterType() << ")," << _nDual << "," << _duality << ","; 00061 std::cout << _angle << std::endl; 00062 } 00063 if (def || msg.find("vector") != std::string::npos || msg.find("detail") != std::string::npos) { 00064 std::cout << pre; 00065 std::cout << "pos" << _position << "," << "dir" << _direction; 00066 std::cout << std::endl; 00067 } 00068 if (! def) TTrackBase::dump(msg, pre); 00069 }
|
|
false Fit
|
|
false Fit
00227 { 00228 _fitted = false; 00229 _fittedWithCathode = false; 00230 }
|
|
fits itself by a default fitter. Error was happened if return value is not zero.
|
|
fits itself by a default fitter. Error was happened if return value is not zero.
00330 { 00331 return _fitter->fit(* this); 00332 }
|
|
returns true if fitted.
|
|
returns true if fitted.
00220 {
00221 return _fitted;
00222 }
|
|
returns true if fitted with cathode hits(TEMPORARY).
|
|
returns true if fitted with cathode hits(TEMPORARY).
00241 {
00242 return _fittedWithCathode;
00243 }
|
|
sets a default fitter.
|
|
returns a pointer to a default fitter.
|
|
sets a default fitter.
00259 { 00260 _fitted = false; 00261 return _fitter = a; 00262 }
|
|
returns a pointer to a default fitter.
00253 {
00254 return _fitter;
00255 }
|
|
returns TTrackHEP.
|
|
returns TTrackHEP.
00380 { 00381 unsigned n = _links.length(); 00382 CAList<TTrackHEP> hepList; 00383 CList<unsigned> hepCounter; 00384 for (unsigned i = 0; i < n; i++) { 00385 const TTrackHEP * hep = _links[i]->hit()->mc()->hep(); 00386 unsigned nH = hepList.length(); 00387 bool found = false; 00388 for (unsigned j = 0; j < nH; j++) { 00389 if (hepList[j] == hep) { 00390 found = true; 00391 ++(* hepCounter[j]); 00392 } 00393 } 00394 00395 if (! found) { 00396 hepList.append(hep); 00397 unsigned c = 0; 00398 hepCounter.append(c); 00399 } 00400 } 00401 00402 _nHeps = hepList.length(); 00403 _hep = 0; 00404 unsigned max = 0; 00405 for (unsigned i = 0; i < _nHeps; i++) { 00406 if ((* hepCounter[i]) > max) { 00407 max = (* hepCounter[i]); 00408 _hep = hepList[i]; 00409 } 00410 } 00411 00412 return _hep; 00413 }
|
|
|
|
00261 {
00262 return _innerLinks;
00263 }
|
|
returns inner most layer.
|
|
returns inner most layer.
00200 { 00201 if (! _fitted) update(); 00202 return _innerMostLayer; 00203 }
|
|
returns inner width.
|
|
returns inner width.
00186 { 00187 if (! _fitted) update(); 00188 return _innerWidth; 00189 }
|
|
returns a list of masked TMLinks assigned to this track. 'mask' will be applied if mask is not 0.
|
|
returns a list of masked TMLinks assigned to this track. 'mask' will be applied if mask is not 0.
00270 { 00271 if (mask == 0) return _links; 00272 00273 std::cout << "TTrackBase::links !!! mask is not supportted yet" << std::endl; 00274 return _links; 00275 }
|
|
returns a pointer to TTrackMC.
|
|
returns a pointer to TTrackMC.
00247 {
00248 return _mc;
00249 }
|
|
returns # of masked TMLinks for fit. 'mask' will be applied if mask is not 0.
|
|
returns # of masked TMLinks for fit. 'mask' will be applied if mask is not 0.
00298 { 00299 if (mask) 00300 std::cout << "TTrackBase::nCores !!! mask is not supported" << std::endl; 00301 if (! _updated) update(); 00302 return _cores.length(); 00303 }
|
|
returns # of contributed TTrackHEP tracks.
|
|
returns # of contributed TTrackHEP tracks.
00416 { 00417 hep(); 00418 return _nHeps; 00419 }
|
|
returns # of masked TMLinks assigned to this track object.
|
|
returns # of masked TMLinks assigned to this track object.
00278 { 00279 unsigned n = _links.length(); 00280 if (mask == 0) return n; 00281 unsigned nn = 0; 00282 for (unsigned i = 0; i < n; i++) { 00283 const TMDCWireHit & h = * _links[i]->hit(); 00284 if (h.state() & mask) ++nn; 00285 } 00286 return nn; 00287 }
|
|
returns type.
Reimplemented from TTrackBase. |
|
returns type.
Reimplemented from TTrackBase. 00228 {
00229 return Segment;
00230 }
|
|
|
|
00235 { 00236 return _links[i]; 00237 }
|
|
returns outer most layer.
|
|
returns outer most layer.
00207 { 00208 if (! _fitted) update(); 00209 return _outerMostLayer; 00210 }
|
|
returns outer width.
|
|
returns outer width.
00193 { 00194 if (! _fitted) update(); 00195 return _outerWidth; 00196 }
|
|
returns position.
|
|
returns position.
00172 { 00173 if (! _fitted) update(); 00174 return _position; 00175 }
|
|
returns Range of x-coordinate of TMLinks.
|
|
returns Range of x-coordinate of TMLinks.
00155 { 00156 #ifdef TRKRECO_DEBUG_DETAIL 00157 if (min > max) { 00158 std::cout << "TSegment0::range !!! bad arguments:min,max="; 00159 std::cout << min << "," << max << std::endl; 00160 } 00161 #endif 00162 00163 unsigned n = _links.length(); 00164 if (n == 0) return Range(0., 0.); 00165 00166 //...Search for a center... 00167 bool found = false; 00168 double center; 00169 for (unsigned i = 0; i < n; i++) { 00170 double x = _links[i]->position().x(); 00171 if (x < min || x > max) continue; 00172 center = x; 00173 found = true; 00174 break; 00175 } 00176 if (! found) return Range(0., 0.); 00177 00178 #ifdef TRKRECO_DEBUG_DETAIL 00179 // std::cout << " center=" << center << std::endl; 00180 #endif 00181 00182 double distanceR = 0.; 00183 double distanceL = 0.; 00184 double distanceMax = max - min; 00185 for (unsigned i = 0; i < n; i++) { 00186 double x = _links[i]->position().x(); 00187 if (x < min || x > max) continue; 00188 00189 double distance0, distance1; 00190 if (x > center) { 00191 distance0 = x - center; 00192 distance1 = distanceMax - distance0; 00193 } 00194 else { 00195 distance1 = center - x; 00196 distance0 = distanceMax - distance1; 00197 } 00198 00199 if (distance0 < distance1) { 00200 if (distance0 > distanceR) distanceR = distance0; 00201 } 00202 else { 00203 if (distance1 > distanceL) distanceL = distance1; 00204 } 00205 00206 #ifdef TRKRECO_DEBUG_DETAIL 00207 // std::cout << " "; 00208 // std::cout << _links[i]->wire()->layerId() << "-"; 00209 // std::cout << _links[i]->wire()->localId() << ","; 00210 // std::cout << _links[i]->position().x(); 00211 // std::cout << ",0,1=" << distance0 << "," << distance1; 00212 // std::cout << ",l,r=" << distanceL << "," << distanceR; 00213 // std::cout << std::endl; 00214 #endif 00215 } 00216 00217 double right = center + distanceR; 00218 double left = center - distanceL; 00219 00220 return Range(left, right); 00221 }
|
|
removes bad points by pull. The bad points are masked not to be used in fit.
|
|
removes bad points by pull. The bad points are removed from the track, and are returned in 'list'.
|
|
removes bad points by pull. The bad points are masked not to be used in fit.
00194 { 00195 AList<TMLink> bad = refineMain(sigma); 00196 // for (unsigned i = 0; i < bad.length(); i++) { 00197 // const TMDCWireHit * hit = bad[i]->hit(); 00198 // hit->state(hit->state() | WireHitInvalidForFit); 00199 // } 00200 00201 #ifdef TRKRECO_DEBUG_DETAIL 00202 std::cout << " refine ... sigma=" << sigma << std::endl; 00203 Dump(bad, "detail sort", " "); 00204 #endif 00205 00206 if (bad.length()) { 00207 _fitted = false; 00208 _updated = false; 00209 } 00210 }
|
|
removes bad points by pull. The bad points are removed from the track, and are returned in 'list'.
00170 { 00171 AList<TMLink> bad = refineMain(sigma); 00172 #ifdef TRKRECO_DEBUG 00173 std::cout << " refine ... sigma=" << sigma << ", # of rejected hits="; 00174 std::cout << bad.length() << std::endl; 00175 #endif 00176 #ifdef TRKRECO_DEBUG 00177 Dump(bad, "sort pull mc", " "); 00178 #endif 00179 00180 if (bad.length()) { 00181 _links.remove(bad); 00182 list.append(bad); 00183 _fitted = false; 00184 _updated = false; 00185 } 00186 }
|
|
removes TMLinks.
|
|
removes a TMLink.
|
|
removes TMLinks.
00211 { 00212 _links.remove(a); 00213 _updated = false; 00214 _fitted = false; 00215 _fittedWithCathode = false; // mod. by matsu ( 1999/05/24 ) 00216 }
|
|
removes a TMLink.
00202 { 00203 _links.remove(a); 00204 _updated = false; 00205 _fitted = false; 00206 _fittedWithCathode = false; // mod. by matsu ( 1999/05/24 ) 00207 }
|
|
|
|
00189 { 00190 _links.removeAll(); 00191 }
|
|
|
|
00624 { 00625 updateType(); 00626 if (_clusterType == 0) return 0; 00627 if (_nDual == 0) return 0; 00628 00629 AList<TMLink> seeds; 00630 AList<TMLink> duals; 00631 for (unsigned i = _innerMostLayer; i <= _outerMostLayer; i++) { 00632 AList<TMLink> list = SameLayer(_links, i); 00633 00634 if (list.length() == 1) { 00635 seeds.append(list[0]); 00636 } 00637 else if (list.length() == 2) { 00638 if (Width(list) > 1) { 00639 const TMDCWireHit * h0 = list[0]->hit(); 00640 const TMDCWireHit * h1 = list[1]->hit(); 00641 double distance = (h0->xyPosition() - h1->xyPosition()).mag(); 00642 distance = fabs(distance - h0->drift() - h1->drift()); 00643 if (distance > 0.5) duals.append(list); 00644 #ifdef TRKRECO_DEBUG_DETAIL 00645 // h0->dump(); 00646 // h1->dump(); 00647 // std::cout << "duality distance = " << distance << std::endl; 00648 // std::cout << "i = " << i << std::endl; 00649 #endif 00650 } 00651 } 00652 else if (list.length() == 0) { 00653 continue; 00654 } 00655 #ifdef TRKRECO_DEBUG_DETAIL 00656 else { 00657 std::cout << "TSegment0::solveDualHits !!! this is not expected 2"; 00658 std::cout << std::endl; 00659 this->dump("cluster hits mc", " "); 00660 } 00661 #endif 00662 } 00663 00664 //...Solve them... 00665 if (seeds.length() < 2) return -1; 00666 AList<TMLink> outers = InOut(seeds); 00667 const HepPoint3D & p = outers[0]->xyPosition(); 00668 HepVector3D v = (outers[1]->xyPosition() - p).unit(); 00669 unsigned n = duals.length() / 2; 00670 for (unsigned i = 0; i < n; i++) { 00671 TMLink * t0 = duals[i * 2 + 0]; 00672 TMLink * t1 = duals[i * 2 + 1]; 00673 HepVector3D x0 = t0->xyPosition() - p; 00674 HepVector3D x1 = t1->xyPosition() - p; 00675 double d0 = (x0 - (x0.dot(v) * v)).mag(); 00676 double d1 = (x1 - (x1.dot(v) * v)).mag(); 00677 if (d0 < d1) _links.remove(t1); 00678 else _links.remove(t0); 00679 } 00680 return n; 00681 }
|
|
returns a list of sub TSegments in this cluster. If cluster type is 1, 2, or 7, no cluster is returned.
|
|
returns a list of sub TSegments in this cluster. If cluster type is 1, 2, or 7, no cluster is returned.
00281 { 00282 AList<TSegment0> list; 00283 00284 //...Do not split if cluster type is 1, 2, or 7... 00285 unsigned t = clusterType(); 00286 #ifdef TRKRECO_DEBUG_DETAIL 00287 std::cout << " ... splitting : type=" << t << std::endl; 00288 #endif 00289 if (t == 0) return list; 00290 else if (t == 2) { 00291 // beta 5 if (_nDual > 2 && _duality > 0.7 && _angle > 0.7) 00292 // return splitDual(); 00293 if (_nDual > 2 && _duality > 0.7) return splitDual(); 00294 return list; 00295 } 00296 else if (t == 1) return list; 00297 else if (t == 7) return list; 00298 00299 //...Parallel... 00300 else if (t == 6) return splitParallel(); 00301 00302 //...Avoid splitting of X or parallel...(future implementation)... 00303 else if (t > 4) return splitComplicated(); 00304 00305 //...A or V... 00306 return splitAV(); 00307 }
|
|
|
|
00310 { 00311 unsigned t = clusterType(); 00312 AList<TMLink> seeds[2]; 00313 00314 //...Calculate corner of V or A... 00315 const AList<TMLink> * corners; 00316 if (t == 3) corners = & _outers; 00317 else corners = & _inners; 00318 HepPoint3D corner; 00319 for (unsigned i = 0; i < corners->length(); i++) 00320 corner += (* corners)[i]->wire()->xyPosition(); 00321 corner *= 1. / (float) corners->length(); 00322 seeds[0].append(* corners); 00323 seeds[1].append(* corners); 00324 00325 //...Calculdate edges... 00326 const AList<TMLink> * links; 00327 if (t == 3) links = & _inners; 00328 else links = & _outers; 00329 AList<TMLink> edge = Edges(* links); 00330 HepPoint3D edgePos[2]; 00331 HepVector3D v[2]; 00332 for (unsigned i = 0; i < 2; i++) { 00333 edgePos[i] = edge[i]->wire()->xyPosition(); 00334 v[i] = (edgePos[i] - corner).unit(); 00335 } 00336 seeds[0].append(edge[0]); 00337 seeds[1].append(edge[1]); 00338 00339 #ifdef TRKRECO_DEBUG_DETAIL 00340 std::cout << " corner:" << corner << std::endl; 00341 std::cout << " edge:" << edgePos[0] << "("; 00342 std::cout << edge[0]->wire()->layerId() << "-"; 00343 std::cout << edge[0]->wire()->localId() << ")"; 00344 std::cout << v[0] << std::endl; 00345 std::cout << " "; 00346 std::cout << edgePos[1] << "("; 00347 std::cout << edge[1]->wire()->layerId() << "-"; 00348 std::cout << edge[1]->wire()->localId() << ")"; 00349 std::cout << v[1] << std::endl; 00350 #endif 00351 00352 //...Examine each hits... 00353 unsigned n = _links.length(); 00354 for (unsigned i = 0; i < n; i++) { 00355 TMLink * l = _links[i]; 00356 if (edge.member(l)) continue; 00357 if (corners->member(l)) continue; 00358 00359 HepVector3D p = l->wire()->xyPosition() - corner; 00360 double p2 = p.mag2(); 00361 00362 double dist[2]; 00363 for (unsigned j = 0; j < 2; j++) { 00364 dist[j] = v[j].dot(p); 00365 double d2 = dist[j] * dist[j]; 00366 dist[j] = (p2 - d2) > 0. ? sqrt(p2 - d2) : 0.; 00367 } 00368 if (dist[0] < dist[1]) seeds[0].append(l); 00369 else seeds[1].append(l); 00370 00371 #ifdef TRKRECO_DEBUG_DETAIL 00372 std::cout << " p:" << p << std::endl; 00373 std::cout << " " << l->wire()->layerId() << "-"; 00374 std::cout << l->wire()->localId() << ":" << dist[0]; 00375 std::cout << "," << dist[1] << std::endl; 00376 #endif 00377 } 00378 00379 AList<TSegment0> list; 00380 for (unsigned i = 0; i < 2; i++) { 00381 if (seeds[i].length()) { 00382 TSegment0 * nc = new TSegment0(seeds[i]); 00383 AList<TSegment0> ncx = nc->split(); 00384 if (ncx.length() == 0) { 00385 nc->solveDualHits(); 00386 list.append(nc); 00387 } 00388 else { 00389 list.append(ncx); 00390 delete nc; 00391 } 00392 } 00393 } 00394 return list; 00395 }
|
|
|
|
00398 { 00399 00400 //...Select best hits... 00401 AList<TSegment0> newClusters; 00402 AList<TMLink> goodHits; 00403 unsigned n = _links.length(); 00404 for (unsigned i = 0; i < n; i++) { 00405 const TMDCWireHit * h = _links[i]->hit(); 00406 unsigned state = h->state(); 00407 if (! (state & WireHitContinuous)) continue; 00408 if (! (state & WireHitIsolated)) continue; 00409 if ((! (state & WireHitPatternLeft)) && 00410 (! (state & WireHitPatternRight))) continue; 00411 goodHits.append(_links[i]); 00412 } 00413 if (goodHits.length() == 0) return newClusters; 00414 00415 //...Main loop... 00416 goodHits.sort(SortByWireId); 00417 AList<TMLink> original(_links); 00418 while (goodHits.length()) { 00419 00420 //...Select an edge hit... 00421 TMLink * seed = goodHits.last(); 00422 const TMDCWire * wire = seed->wire(); 00423 unsigned localId = wire->localId(); 00424 AList<TMLink> used; 00425 unsigned nn = _links.length(); 00426 for (unsigned i = 0; i < nn; i++) { 00427 TMLink * t = _links[i]; 00428 const TMDCWire * w = t->wire(); 00429 00430 //...Straight?... 00431 if (abs((int) w->localId() - (int) localId) < 2) used.append(t); 00432 } 00433 00434 #ifdef TRKRECO_DEBUG_DETAIL 00435 std::cout << " seed is " << seed->wire()->name() << std::endl; 00436 std::cout << " "; 00437 for (unsigned i = 0; i < used.length(); i++) { 00438 std::cout << used[i]->wire()->name() << ","; 00439 } 00440 std::cout << std::endl; 00441 #endif 00442 00443 //...Create new cluster... 00444 if (used.length() == 0) continue; 00445 if (used.length() == nLinks()) return newClusters; 00446 TSegment0 * c = new TSegment0(used); 00447 AList<TSegment0> cx = c->split(); 00448 if (cx.length() == 0) { 00449 c->solveDualHits(); 00450 newClusters.append(c); 00451 } 00452 else { 00453 newClusters.append(cx); 00454 delete c; 00455 } 00456 goodHits.remove(used); 00457 original.remove(used); 00458 } 00459 00460 //...Remainings... 00461 if ((original.length()) && (original.length() < nLinks())) { 00462 TSegment0 * c = new TSegment0(original); 00463 AList<TSegment0> cx = c->split(); 00464 if (cx.length() == 0) { 00465 c->solveDualHits(); 00466 newClusters.append(c); 00467 } 00468 else { 00469 newClusters.append(cx); 00470 delete c; 00471 } 00472 } 00473 00474 return newClusters; 00475 }
|
|
|
|
00574 { 00575 #ifdef TRKRECO_DEBUG_DETAIL 00576 std::cout << " TSegment0::splitDual called" << std::endl; 00577 #endif 00578 AList<TMLink> seeds[2]; 00579 AList<TMLink> unknown; 00580 for (unsigned i = _innerMostLayer; i <= _outerMostLayer; i++) { 00581 AList<TMLink> list = SameLayer(_links, i); 00582 00583 if (list.length() == 2) { 00584 if (Width(list) == 2) { 00585 seeds[0].append(list[0]); 00586 seeds[1].append(list[1]); 00587 continue; 00588 } 00589 } 00590 unknown.append(list); 00591 } 00592 00593 if (unknown.length() > 0) { 00594 #ifdef TRKRECO_DEBUG_DETAIL 00595 if (seeds[0].length() == 0) 00596 std::cout << "TSegment0::splitDual !!! no TMLink for seed 0" << std::endl; 00597 if (seeds[1].length() == 0) 00598 std::cout << "TSegment0::splitDual !!! no TMLink for seed 1" << std::endl; 00599 #endif 00600 const HepPoint3D & p0 = seeds[0][0]->xyPosition(); 00601 const HepPoint3D & p1 = seeds[1][0]->xyPosition(); 00602 HepVector3D v0 = (seeds[0].last()->xyPosition() - p0).unit(); 00603 HepVector3D v1 = (seeds[1].last()->xyPosition() - p1).unit(); 00604 00605 for (unsigned i = 0; i < unknown.length(); i++) { 00606 TMLink * t = unknown[i]; 00607 HepVector3D x0 = t->xyPosition() - p0; 00608 double d0 = (x0 - (x0.dot(v0) * v0)).mag(); 00609 HepVector3D x1 = t->xyPosition() - p1; 00610 double d1 = (x1 - (x1.dot(v0) * v0)).mag(); 00611 00612 if (d0 < d1) seeds[0].append(t); 00613 else seeds[1].append(t); 00614 } 00615 } 00616 00617 AList<TSegment0> newClusters; 00618 newClusters.append(new TSegment0(seeds[0])); 00619 newClusters.append(new TSegment0(seeds[1])); 00620 return newClusters; 00621 }
|
|
|
|
00478 { 00479 AList<TMLink> seeds[2]; 00480 AList<TSegment0> newClusters; 00481 for (unsigned i = _innerMostLayer; i <= _outerMostLayer; i++) { 00482 AList<TMLink> list = SameLayer(_links, i); 00483 AList<TMLink> outerList = Edges(list); 00484 00485 #ifdef TRKRECO_DEBUG_DETAIL 00486 if (outerList.length() != 2) { 00487 std::cout << "TSegment0::splitParallel !!! "; 00488 std::cout << "This is not a parallel cluster" << std::endl; 00489 } 00490 #endif 00491 00492 seeds[0].append(outerList[0]); 00493 seeds[1].append(outerList[1]); 00494 if (list.length() == 2) continue; 00495 00496 const TMDCWire & wire0 = * outerList[0]->wire(); 00497 const TMDCWire & wire1 = * outerList[1]->wire(); 00498 for (unsigned k = 0; k < list.length(); k++) { 00499 TMLink * t = list[k]; 00500 if (t == outerList[0]) continue; 00501 if (t == outerList[1]) continue; 00502 00503 if (abs(wire0.localIdDifference(* t->wire())) < 00504 abs(wire1.localIdDifference(* t->wire()))) 00505 seeds[0].append(t); 00506 else 00507 seeds[1].append(t); 00508 } 00509 } 00510 00511 if ((seeds[0].length()) && (seeds[0].length() < nLinks())) { 00512 TSegment0 * c0 = new TSegment0(seeds[0]); 00513 AList<TSegment0> c0x = c0->split(); 00514 if (c0x.length()) { 00515 newClusters.append(c0x); 00516 delete c0; 00517 } 00518 else { 00519 c0->solveDualHits(); 00520 newClusters.append(c0); 00521 } 00522 } 00523 00524 if ((seeds[1].length()) && (seeds[1].length() < nLinks())) { 00525 TSegment0 * c1 = new TSegment0(seeds[1]); 00526 AList<TSegment0> c1x = c1->split(); 00527 if (c1x.length()) { 00528 newClusters.append(c1x); 00529 delete c1; 00530 } 00531 else { 00532 c1->solveDualHits(); 00533 newClusters.append(c1); 00534 } 00535 } 00536 00537 return newClusters; 00538 }
|
|
returns super layer id.
|
|
returns super layer id.
00234 { 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 }
|
|
|
|
returns # of good hits to be appended.
|
|
00213 { 00214 #ifdef TRKRECO_DEBUG_DETAIL 00215 std::cout << " TTrackBase::testByApproach ... sigma=" << maxSigma << std::endl; 00216 #endif 00217 00218 unsigned nOK = 0; 00219 unsigned n = list.length(); 00220 for (unsigned i = 0; i < n; i++) { 00221 TMLink & l = * list[i]; 00222 nOK += testByApproach(l, maxSigma); 00223 } 00224 return nOK; 00225 }
|
|
returns # of good hits to be appended.
00228 { 00229 #ifdef TRKRECO_DEBUG_DETAIL 00230 std::cout << " TTrackBase::testByApproach ... sigma=" << maxSigma << std::endl; 00231 #endif 00232 TMLink l = link; 00233 00234 //...Calculate closest approach... 00235 int err = approach(l); 00236 if (err < 0) return 0; 00237 //...Calculate sigma... 00238 float distance = l.distance(); 00239 float diff = fabs(distance - l.hit()->drift()); 00240 float sigma = diff / l.hit()->dDrift(); 00241 l.pull(sigma * sigma); 00242 00243 //...For debug... 00244 #ifdef TRKRECO_DEBUG_DETAIL 00245 std::cout << " sigma=" << sigma; 00246 std::cout << ",dist=" << distance; 00247 std::cout << ",diff=" << diff << ","; 00248 if (sigma < maxSigma) std::cout << "ok,"; 00249 else std::cout << "X,"; 00250 l.dump("mc"); 00251 #endif 00252 00253 //...Make sigma cut... 00254 if (sigma < maxSigma) return 1; 00255 00256 return 0; 00257 }
|
|
|
|
00255 {
00256 return _tracks;
00257 }
|
|
returns type. Definition is depending on an object class.
|
|
returns type. Definition is depending on an object class.
Reimplemented in TTrack, and TTrack. 00272 {
00273 return 0;
00274 }
|
|
updates cache.
Reimplemented from TTrackBase. |
|
updates cache.
Reimplemented from TTrackBase. 00072 { 00073 _clusterType = 0; 00074 _position = ORIGIN; 00075 _direction = ORIGIN; 00076 _inners.removeAll(); 00077 _outers.removeAll(); 00078 00079 if (_links.length() == 0) return; 00080 00081 _innerMostLayer = _links[0]->wire()->layerId(); 00082 _outerMostLayer = _innerMostLayer; 00083 for (unsigned i = 1; i < _links.length(); i++) { 00084 unsigned id = _links[i]->wire()->layerId(); 00085 if (id < _innerMostLayer) _innerMostLayer = id; 00086 else if (id > _outerMostLayer) _outerMostLayer = id; 00087 } 00088 _nLayer = _outerMostLayer - _innerMostLayer + 1; 00089 00090 double centerX = _links[0]->position().x(); 00091 HepPoint3D inner = ORIGIN; 00092 HepPoint3D outer = ORIGIN; 00093 unsigned nInner = 0; 00094 unsigned nOuter = 0; 00095 for (unsigned i = 0; i < _links.length(); i++) { 00096 HepPoint3D tmp = _links[i]->position(); 00097 double diff = tmp.x() - centerX; 00098 if (diff > M_PI) { 00099 tmp.setX(centerX - 2. * M_PI + diff); 00100 } 00101 else if (diff < - M_PI) { 00102 tmp.setX(centerX + 2. * M_PI + diff); 00103 } 00104 00105 _links[i]->conf(tmp); 00106 _position += tmp; 00107 unsigned id = _links[i]->wire()->layerId(); 00108 if (id == _innerMostLayer) { 00109 inner += tmp; 00110 ++nInner; 00111 _inners.append(_links[i]); 00112 } 00113 if (id == _outerMostLayer) { 00114 outer += tmp; 00115 ++nOuter; 00116 _outers.append(_links[i]); 00117 } 00118 } 00119 _innerWidth = Width(_inners); 00120 _outerWidth = Width(_outers); 00121 _position *= (1. / (float) _links.length()); 00122 00123 inner *= (1. / (float) nInner); 00124 outer *= (1. / (float) nOuter); 00125 _direction = (inner - outer).unit(); 00126 00127 _fitted = true; 00128 }
|
|
updates duality.
|
|
updates duality.
00541 { 00542 _duality = 0.; 00543 _nDual = 0; 00544 HepPoint3D x[2]; 00545 for (unsigned i = _innerMostLayer; i <= _outerMostLayer; i++) { 00546 AList<TMLink> list = SameLayer(_links, i); 00547 if (i == _innerMostLayer) { 00548 for (unsigned j = 0; j < list.length(); j++) 00549 x[0] += list[j]->hit()->xyPosition(); 00550 x[0] *= 1. / double(list.length()); 00551 } 00552 else if (i == _outerMostLayer) { 00553 for (unsigned j = 0; j < list.length(); j++) 00554 x[1] += list[j]->hit()->xyPosition(); 00555 x[1] *= 1. / double(list.length()); 00556 } 00557 00558 if (list.length() == 2) { 00559 if (Width(list) != 2) continue; 00560 const TMDCWireHit * h0 = list[0]->hit(); 00561 const TMDCWireHit * h1 = list[1]->hit(); 00562 00563 double distance = (h0->xyPosition() - h1->xyPosition()).mag(); 00564 distance = fabs(distance - h0->drift() - h1->drift()); 00565 _duality += distance; 00566 ++_nDual; 00567 } 00568 } 00569 if (_nDual > 0) _duality /= float(_nDual); 00570 _angle = (x[1] - x[0]).unit().dot(x[0].unit()); 00571 }
|
|
updates type.
|
|
updates type.
00224 { 00225 if (! nLinks()) return; 00226 if (! _fitted) update(); 00227 00228 //...Parameter... 00229 unsigned fat = 3; 00230 unsigned tall = 3; 00231 00232 //...Calculate 00233 updateDuality(); 00234 00235 //...Long or short... 00236 if ((_innerWidth < fat) && (_outerWidth < fat)) { 00237 _clusterType = 1; 00238 00239 //...Check length across a super layer... 00240 if (_nLayer > tall) _clusterType = 2; 00241 return; 00242 } 00243 00244 //...A... 00245 else if (_outerWidth < fat) { 00246 _clusterType = 3; 00247 return; 00248 } 00249 00250 //...V... 00251 else if (_innerWidth < fat) { 00252 _clusterType = 4; 00253 return; 00254 } 00255 00256 //...X or parallel... 00257 else { 00258 bool space = true; 00259 for (unsigned i = _innerMostLayer; i <= _outerMostLayer; i++) { 00260 unsigned n = 0; 00261 AList<TMLink> tmp; 00262 for (unsigned j = 0; j < _links.length(); j++) 00263 if (_links[j]->wire()->layerId() == i) { 00264 ++n; 00265 tmp.append(_links[j]); 00266 } 00267 00268 if (n == Width(tmp)) { 00269 space = false; 00270 break; 00271 } 00272 } 00273 00274 _clusterType = 5; 00275 if (space) _clusterType = 6; 00276 return; 00277 } 00278 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|