#include <TLine0.h>
Inheritance diagram for TLine0:
Public Member Functions | |
double | a (void) const |
returns coefficient a. | |
double | a (void) const |
returns coefficient a. | |
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. | |
void | appendByszdistance (AList< TMLink > &list, unsigned isl, float maxSigma) |
void | appendByszdistance (AList< TMLink > &list, unsigned isl, float maxSigma) |
void | appendSLY (AList< TMLink > &list) |
void | appendSLY (AList< TMLink > &list) |
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. | |
double | b (void) const |
returns coefficient b. | |
double | b (void) const |
returns coefficient b. | |
double | chi2 (void) const |
returns chi2. | |
double | chi2 (void) const |
returns chi2. | |
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. | |
double | distance (const TMLink &) const |
returns distance to a position of TMLink itself. (not to a wire) | |
double | distance (const TMLink &) const |
returns distance to a position of TMLink itself. (not to a wire) | |
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. | |
int | fit2 () |
fits itself using isolated hits. Error was happened if return value is not zero. | |
int | fit2 () |
fits itself using isolated hits. Error was happened if return value is not zero. | |
int | fit2p () |
fits itself using isolated hits. Error was happened if return value is not zero. | |
int | fit2p () |
fits itself using isolated hits. Error was happened if return value is not zero. | |
int | fit2s () |
fits itself using single hits in a wire-layer. Error was happened if return value is not zero. | |
int | fit2s () |
fits itself using single hits in a wire-layer. Error was happened if return value is not zero. | |
int | fit2sp () |
fits itself using single hits in a wire-layer. Error was happened if return value is not zero. | |
int | fit2sp () |
fits itself using single hits in a wire-layer. 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. | |
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 |
void | property (double a, double b, double det) |
sets circle properties. | |
void | property (double a, double b, double det) |
sets circle properties. | |
double | reducedChi2 (void) const |
returns reduced-chi2. | |
double | reducedChi2 (void) const |
returns reduced-chi2. | |
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 | refine (AList< TMLink > &list, float maxSigma) |
remove bad points by chi2. Bad points are returned in a 'list'. fit() should be called before calling this function. | |
void | refine (AList< TMLink > &list, float maxSigma) |
remove bad points by chi2. Bad points are returned in a 'list'. fit() should be called before calling this function. | |
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. | |
void | removeChits () |
remove extremly bad points. | |
void | removeChits () |
remove extremly bad points. | |
virtual void | removeLinks (void) |
virtual void | removeLinks (void) |
void | removeSLY (AList< TMLink > &list) |
void | removeSLY (AList< TMLink > &list) |
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. | |
TLine0 (const AList< TMLink > &) | |
Constructor. | |
TLine0 () | |
Constructor. | |
TLine0 (const AList< TMLink > &) | |
Constructor. | |
TLine0 () | |
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. | |
void | update (void) const |
update cache. | |
void | update (void) const |
update cache. | |
virtual | ~TLine0 () |
Destructor. | |
virtual | ~TLine0 () |
Destructor. | |
Protected Attributes | |
bool | _fitted |
bool | _fittedWithCathode |
AList< TMLink > | _links |
AList< TMLink > | _links |
TTrackMC * | _mc |
TTrackMC * | _mc |
Private Attributes | |
double | _a |
double | _b |
double | _chi2 |
double | _det |
bool | _fittedUpdated |
double | _reducedChi2 |
Static Private Attributes | |
const TLineFitter | _fitter = TLineFitter("TLine0 Default Line Fitter") |
|
Constructor.
00024 : TTrackBase(), 00025 _a(0.), 00026 _b(0.), 00027 _det(0.), 00028 _fittedUpdated(false), 00029 _chi2(0.), 00030 _reducedChi2(0.) { 00031 00032 //...Set a defualt fitter... 00033 fitter(& TLine0::_fitter); 00034 }
|
|
Constructor.
00037 : TTrackBase(a), 00038 _a(0.), 00039 _b(0.), 00040 _det(0.), 00041 _fittedUpdated(false), 00042 _chi2(0.), 00043 _reducedChi2(0.) { 00044 00045 //...Set a defualt fitter... 00046 fitter(& TLine0::_fitter); 00047 }
|
|
Destructor.
00049 { 00050 }
|
|
Constructor.
|
|
Constructor.
|
|
Destructor.
|
|
returns coefficient a.
|
|
returns coefficient a.
00127 { 00128 #ifdef TRKRECO_DEBUG 00129 if (! _fitted) std::cout << "TLine0::a !!! fit not performed" << std::endl; 00130 #endif 00131 return _a; 00132 }
|
|
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 }
|
|
|
|
00565 { 00566 00567 //... intialize 00568 unsigned nb = _links.length(); 00569 00570 //....Select good hit 00571 unsigned n = list.length(); 00572 for (unsigned i = 0; i < n; i++) { 00573 TMLink & l = * list[i]; 00574 if(l.hit()->wire()->superLayerId() == isl){ 00575 double dist = distance(l); 00576 if (dist < maxSigma) { 00577 _links.append(l); 00578 } 00579 } 00580 } 00581 00582 unsigned na = _links.length(); 00583 if(nb != na){ 00584 AList<TMLink> bad; 00585 //... remove duplicated hits 00586 for(unsigned i = 0; i<na ;i++){ 00587 TMLink & l = * _links[i]; 00588 if(i < na - 1) { 00589 TMLink & lnext = * _links[i+1]; 00590 if(l.hit()->wire()->layerId() == lnext.hit()->wire()->layerId() ){ 00591 if(l.hit()->wire()->localId() == lnext.hit()->wire()->localId()){ 00592 bad.append(l); 00593 } 00594 } 00595 } 00596 } 00597 if(bad.length() > 0) _links.remove(bad); 00598 _fitted = false; 00599 _fittedUpdated = false; 00600 } 00601 }
|
|
|
|
00558 { 00559 _links.append(list); 00560 _fitted = false; 00561 _fittedUpdated = false; 00562 }
|
|
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 coefficient b.
|
|
returns coefficient b.
00136 { 00137 #ifdef TRKRECO_DEBUG 00138 if (! _fitted) std::cout << "TLine0::b !!! fit not performed" << std::endl; 00139 #endif 00140 return _b; 00141 }
|
|
returns chi2.
|
|
returns chi2.
00113 { 00114 #ifdef TRKRECO_DEBUG_DETAIL 00115 if (! _fitted) std::cout << "TLine0::chi2 !!! fit not performed" << std::endl; 00116 #endif 00117 00118 if (_fittedUpdated) return _chi2; 00119 _chi2 = 0.; 00120 unsigned n = _links.length(); 00121 for (unsigned i = 0; i < n; i++) { 00122 TMLink & l = * _links[i]; 00123 00124 double x = l.position().x(); 00125 double y = l.position().y(); 00126 double c = y - _a * x - _b; 00127 _chi2 += c * c; 00128 } 00129 _fittedUpdated = true; 00130 return _chi2; 00131 }
|
|
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 distance to a position of TMLink itself. (not to a wire)
Reimplemented from TTrackBase. |
|
returns distance to a position of TMLink itself. (not to a wire)
Reimplemented from TTrackBase. 00145 { 00146 #ifdef TRKRECO_DEBUG 00147 if (! _fitted) std::cout << "TLine0::distance !!! fit not performed" << std::endl; 00148 #endif 00149 double dy = fabs(_a * l.position().x() + _b - l.position().y()); 00150 double invCos = sqrt(1. + _a * _a); 00151 return dy / invCos; 00152 }
|
|
dumps debug information.
Reimplemented from TTrackBase. |
|
dumps debug information.
Reimplemented from TTrackBase. 00053 { 00054 bool def = false; 00055 if (msg == "") def = true; 00056 00057 if (def || msg.find("line") != std::string::npos || msg.find("detail") != std::string::npos) { 00058 std::cout << pre; 00059 std::cout << "#links=" << _links.length(); 00060 std::cout << ",a=" << _a; 00061 std::cout << ",b=" << _b; 00062 std::cout << ",det=" << _det; 00063 std::cout << std::endl; 00064 } 00065 if (! def) TTrackBase::dump(msg, pre); 00066 }
|
|
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.
|
|
fits itself using isolated hits. Error was happened if return value is not zero.
|
|
fits itself using isolated hits. Error was happened if return value is not zero.
00173 { 00174 // if (_fitted) return 0; 00175 00176 unsigned n = _links.length(); 00177 int mask[100] = {0}; 00178 int nsl[11] = {64,80,96,128,144,160,176,208,240,256,288}; 00179 int npos = 0, nneg = 0; 00180 for (unsigned i = 0; i < n -1 ; i++) { 00181 TMLink & l = * _links[i]; 00182 for (unsigned j = i+1; j < n ; j++) { 00183 TMLink & s = * _links[j]; 00184 if(l.hit()->wire()->layerId() == s.hit()->wire()->layerId()){ 00185 //... Check 3 consective hits 00186 if(i > 0 && (mask[i-1] == 1 && mask[j] == 1) ){ 00187 TMLink & t = * _links[i-1]; 00188 if(l.hit()->wire()->layerId() == t.hit()->wire()->layerId()){ 00189 mask[i] = 1; 00190 } 00191 } 00192 int ilast = nsl[l.hit()->wire()->superLayerId()]-1; 00193 int ilocal = l.hit()->wire()->localId(); 00194 int jlocal = s.hit()->wire()->localId(); 00195 if(ilocal > 0 && ilocal < ilast){ 00196 if(abs(jlocal-ilocal) > 1 ) { 00197 mask[i] = 1; 00198 mask[j] = 1; 00199 } 00200 }else if(ilocal == 0){ 00201 if(jlocal > 1 && jlocal < ilast){ 00202 mask[i] = 1; 00203 mask[j] = 1; 00204 } 00205 }else if(ilocal == ilast){ 00206 if(jlocal > 0 && jlocal < ilast-1){ 00207 mask[i] = 1; 00208 mask[j] = 1; 00209 } 00210 } 00211 } 00212 } 00213 //... 00214 if(mask[i] == 0){ 00215 if(l.position().y() >= 0) npos += 1; 00216 if(l.position().y() < 0) nneg += 1; 00217 } 00218 } 00219 00220 //.... 00221 double sumX = 0., sumY = 0., sumX2 = 0., sumXY = 0., sumY2 = 0.; 00222 int nused = 0; 00223 int lyid[2]; 00224 for (unsigned i = 0; i < n; i++) { 00225 00226 if(mask[i] == 1) continue; 00227 00228 TMLink & l = * _links[i]; 00229 00230 double x = l.position().x(); 00231 double y = l.position().y(); 00232 if(abs(npos-nneg) > 3){ 00233 if(npos > nneg && y < 0 ) continue; 00234 if(npos < nneg && y > 0 ) continue; 00235 } 00236 sumX += x; 00237 sumY += y; 00238 sumX2 += x * x; 00239 sumXY += x * y; 00240 sumY2 += y * y; 00241 if(nused < 2){ 00242 lyid[nused] = l.hit()->wire()->layerId(); 00243 } 00244 nused += 1; 00245 } 00246 00247 if(nused < 2 || (nused == 2 && lyid[0]==lyid[1])) { 00248 return -2; 00249 } 00250 double sum = double(nused); 00251 _det = sum * sumX2 - sumX * sumX; 00252 if(_det == 0.) { 00253 return -1; 00254 } 00255 _a = (sumXY * sum - sumX * sumY) / _det; 00256 _b = (sumX2 * sumY - sumX * sumXY) / _det; 00257 00258 _fitted = true; 00259 return 0; 00260 }
|
|
fits itself using isolated hits. Error was happened if return value is not zero.
|
|
fits itself using isolated hits. Error was happened if return value is not zero.
00401 { 00402 // if (_fitted) return 0; 00403 00404 unsigned n = _links.length(); 00405 int mask[100] = {0}; 00406 int nsl[11] = {64,80,96,128,144,160,176,208,240,256,288}; 00407 double phi_ave = 0.; 00408 int nphi = 0; 00409 double Crad = 180./3.141592; 00410 for (unsigned i = 0; i < n -1 ; i++) { 00411 TMLink & l = * _links[i]; 00412 for (unsigned j = i+1; j < n ; j++) { 00413 TMLink & s = * _links[j]; 00414 if(l.hit()->wire()->layerId() == s.hit()->wire()->layerId()){ 00415 //... Check 3 consective hits 00416 if(i > 0 && (mask[i-1] == 1 && mask[j] == 1) ){ 00417 TMLink & t = * _links[i-1]; 00418 if(l.hit()->wire()->layerId() == t.hit()->wire()->layerId()){ 00419 mask[i] = 1; 00420 } 00421 } 00422 int ilast = nsl[l.hit()->wire()->superLayerId()]-1; 00423 int ilocal = l.hit()->wire()->localId(); 00424 int jlocal = s.hit()->wire()->localId(); 00425 if(ilocal > 0 && ilocal < ilast){ 00426 if(abs(jlocal-ilocal) > 1 ) { 00427 mask[i] = 1; 00428 mask[j] = 1; 00429 } 00430 }else if(ilocal == 0){ 00431 if(jlocal > 1 && jlocal < ilast){ 00432 mask[i] = 1; 00433 mask[j] = 1; 00434 } 00435 }else if(ilocal == ilast){ 00436 if(jlocal > 0 && jlocal < ilast-1){ 00437 mask[i] = 1; 00438 mask[j] = 1; 00439 } 00440 } 00441 } 00442 } 00443 //... 00444 //... 00445 if(mask[i] != 1){ 00446 double phi = Crad*atan2(l.position().y(), l.position().x()); 00447 phi_ave += phi; 00448 nphi += 1; 00449 } 00450 } 00451 00452 //... 00453 if(mask[n-1] != 1){ 00454 TMLink & l = * _links[n-1]; 00455 double phi = Crad*atan2(l.position().y(), l.position().x()); 00456 phi_ave += phi; 00457 nphi += 1; 00458 } 00459 double phi_max = 0.; 00460 double phi_min = 0.; 00461 if(nphi> 0){ 00462 phi_max = phi_ave/n + 40; 00463 phi_min = phi_ave/n - 40; 00464 } 00465 00466 //.... 00467 double sumX = 0., sumY = 0., sumX2 = 0., sumXY = 0., sumY2 = 0.; 00468 int nused = 0; 00469 int lyid[2]; 00470 for (unsigned i = 0; i < n; i++) { 00471 00472 if(mask[i] == 1) continue; 00473 00474 TMLink & l = * _links[i]; 00475 00476 double x = l.position().x(); 00477 double y = l.position().y(); 00478 double phi = Crad*atan2(l.position().y(), l.position().x()); 00479 if(phi > phi_max && phi<phi_min ) continue; 00480 00481 sumX += x; 00482 sumY += y; 00483 sumX2 += x * x; 00484 sumXY += x * y; 00485 sumY2 += y * y; 00486 if(nused < 2){ 00487 lyid[nused] = l.hit()->wire()->layerId(); 00488 } 00489 nused += 1; 00490 } 00491 00492 if(nused < 2 || (nused == 2 && lyid[0]==lyid[1])) { 00493 return -2; 00494 } 00495 double sum = double(nused); 00496 _det = sum * sumX2 - sumX * sumX; 00497 if(_det == 0.) { 00498 return -1; 00499 } 00500 _a = (sumXY * sum - sumX * sumY) / _det; 00501 _b = (sumX2 * sumY - sumX * sumXY) / _det; 00502 00503 _fitted = true; 00504 return 0; 00505 }
|
|
fits itself using single hits in a wire-layer. Error was happened if return value is not zero.
|
|
fits itself using single hits in a wire-layer. Error was happened if return value is not zero.
00263 { 00264 // if (_fitted) return 0; 00265 00266 unsigned n = _links.length(); 00267 int mask[100] = {0}; 00268 int npos = 0, nneg = 0; 00269 for (unsigned i = 0; i < n -1 ; i++) { 00270 TMLink & l = * _links[i]; 00271 for (unsigned j = i+1; j < n ; j++) { 00272 TMLink & s = * _links[j]; 00273 if(l.hit()->wire()->layerId() == s.hit()->wire()->layerId()){ 00274 mask[i] = 1; 00275 mask[j] = 1; 00276 } 00277 } 00278 //... 00279 if(mask[i] == 0){ 00280 if(l.position().y() >= 0) npos += 1; 00281 if(l.position().y() < 0) nneg += 1; 00282 } 00283 } 00284 00285 //.... 00286 double sumX = 0., sumY = 0., sumX2 = 0., sumXY = 0., sumY2 = 0.; 00287 int nused = 0; 00288 int lyid[2]; 00289 for (unsigned i = 0; i < n; i++) { 00290 00291 if(mask[i] == 1) continue; 00292 00293 TMLink & l = * _links[i]; 00294 00295 double x = l.position().x(); 00296 double y = l.position().y(); 00297 if(npos > nneg && y < 0 ) continue; 00298 if(npos < nneg && y > 0 ) continue; 00299 00300 sumX += x; 00301 sumY += y; 00302 sumX2 += x * x; 00303 sumXY += x * y; 00304 sumY2 += y * y; 00305 nused += 1; 00306 } 00307 00308 if(nused < 4) { 00309 return -2; 00310 } 00311 double sum = double(nused); 00312 _det = sum * sumX2 - sumX * sumX; 00313 if(_det == 0.) { 00314 return -1; 00315 } 00316 _a = (sumXY * sum - sumX * sumY) / _det; 00317 _b = (sumX2 * sumY - sumX * sumXY) / _det; 00318 00319 _fitted = true; 00320 return 0; 00321 }
|
|
fits itself using single hits in a wire-layer. Error was happened if return value is not zero.
|
|
fits itself using single hits in a wire-layer. Error was happened if return value is not zero.
00323 { 00324 // if (_fitted) return 0; 00325 00326 unsigned n = _links.length(); 00327 int mask[100] = {0}; 00328 double phi_ave = 0.; 00329 int nphi = 0; 00330 double Crad = 180./3.141592; 00331 for (unsigned i = 0; i < n -1 ; i++) { 00332 TMLink & l = * _links[i]; 00333 for (unsigned j = i+1; j < n ; j++) { 00334 TMLink & s = * _links[j]; 00335 if(l.hit()->wire()->layerId() == s.hit()->wire()->layerId()){ 00336 mask[i] = 1; 00337 mask[j] = 1; 00338 } 00339 } 00340 //... 00341 if(mask[i] != 1){ 00342 double phi = Crad*atan2(l.position().y(), l.position().x()); 00343 phi_ave += phi; 00344 nphi += 1; 00345 } 00346 } 00347 00348 //... 00349 if(mask[n-1] != 1){ 00350 TMLink & l = * _links[n-1]; 00351 double phi = Crad*atan2(l.position().y(), l.position().x()); 00352 phi_ave += phi; 00353 nphi += 1; 00354 } 00355 double phi_max = 0.; 00356 double phi_min = 0.; 00357 if(nphi> 0){ 00358 phi_max = phi_ave/n + 40; 00359 phi_min = phi_ave/n - 40; 00360 } 00361 00362 //.... 00363 double sumX = 0., sumY = 0., sumX2 = 0., sumXY = 0., sumY2 = 0.; 00364 int nused = 0; 00365 int lyid[2]; 00366 for (unsigned i = 0; i < n; i++) { 00367 00368 if(mask[i] == 1) continue; 00369 00370 TMLink & l = * _links[i]; 00371 00372 double x = l.position().x(); 00373 double y = l.position().y(); 00374 double phi = Crad*atan2(l.position().y(), l.position().x()); 00375 if(phi > phi_max && phi<phi_min ) continue; 00376 00377 sumX += x; 00378 sumY += y; 00379 sumX2 += x * x; 00380 sumXY += x * y; 00381 sumY2 += y * y; 00382 nused += 1; 00383 } 00384 00385 if(nused < 4) { 00386 return -2; 00387 } 00388 double sum = double(nused); 00389 _det = sum * sumX2 - sumX * sumX; 00390 if(_det == 0.) { 00391 return -1; 00392 } 00393 _a = (sumXY * sum - sumX * sumY) / _det; 00394 _b = (sumX2 * sumY - sumX * sumXY) / _det; 00395 00396 _fitted = true; 00397 return 0; 00398 }
|
|
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.
|
|
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 }
|
|
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. 00164 {
00165 return Line;
00166 }
|
|
|
|
00235 { 00236 return _links[i]; 00237 }
|
|
sets circle properties.
|
|
sets circle properties.
|
|
returns reduced-chi2.
|
|
returns reduced-chi2.
00604 { 00605 #ifdef TRKRECO_DEBUG_DETAIL 00606 if (! _fitted) std::cout << "TLine0::reducedChi2 !!! fit not performed" << std::endl; 00607 #endif 00608 00609 if (_fittedUpdated) return _reducedChi2; 00610 double chi2 = 0.; 00611 double scale = 20.; 00612 unsigned n = _links.length(); 00613 for (unsigned i = 0; i < n; i++) { 00614 TMLink & l = * _links[i]; 00615 00616 double x = l.position().x(); 00617 double y = l.position().y(); 00618 double c = y - _a * x - _b; 00619 double err = scale * l.hit()->dDrift(); 00620 chi2 += c * c / err / err; 00621 } 00622 00623 _reducedChi2 = chi2/(n-2); 00624 _fittedUpdated = true; 00625 return _reducedChi2; 00626 }
|
|
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 }
|
|
remove bad points by chi2. Bad points are returned in a 'list'. fit() should be called before calling this function.
|
|
remove bad points by chi2. Bad points are returned in a 'list'. fit() should be called before calling this function.
00134 { 00135 AList<TMLink> bad; 00136 unsigned n = _links.length(); 00137 for (unsigned i = 0; i < n; i++) { 00138 TMLink & l = * _links[i]; 00139 double dist = distance(l); 00140 if (dist > maxSigma) bad.append(l); 00141 } 00142 00143 #ifdef TRKRECO_DEBUG_DETAIL 00144 std::cout << " TLine0::refine ... rejected hits:max distance=" << maxSigma; 00145 std::cout << std::endl; 00146 bad.sort(SortByWireId); 00147 for (unsigned i = 0; i < bad.length(); i++) { 00148 TMLink & l = * _links[i]; 00149 std::cout << " "; 00150 std::cout << l.wire()->layerId() << "-"; 00151 std::cout << l.wire()->localId(); 00152 std::cout << "("; 00153 if (l.hit()->mc()) { 00154 if (l.hit()->mc()->hep()) std::cout << l.hit()->mc()->hep()->id(); 00155 else std::cout << "0"; 00156 } 00157 std::cout << "),"; 00158 std::cout << l.position() << "," << distance(l); 00159 if (distance(l) > maxSigma) std::cout << " X"; 00160 std::cout << std::endl; 00161 } 00162 #endif 00163 00164 if (bad.length()) { 00165 _links.remove(bad); 00166 list.append(bad); 00167 _fitted = false; 00168 _fittedUpdated = false; 00169 } 00170 }
|
|
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 }
|
|
remove extremly bad points.
|
|
remove extremly bad points.
00508 { 00509 00510 unsigned n = _links.length(); 00511 int nlyr[50] = {0}; 00512 int nneg = 0, npos = 0; 00513 for (unsigned i = 0; i < n -1 ; i++) { 00514 TMLink & l = * _links[i]; 00515 nlyr[l.hit()->wire()->layerId()] += 1; 00516 if(l.position().y() < 0.){ 00517 nneg += 1; 00518 }else { 00519 npos += 1; 00520 } 00521 } 00522 00523 //... 00524 AList<TMLink> bad; 00525 for (unsigned i = 0; i < n; i++) { 00526 00527 TMLink & l = * _links[i]; 00528 00529 //...if # of hits in a wire layer, don't use... 00530 if (nlyr[l.hit()->wire()->layerId()] > 3) { 00531 bad.append(l); 00532 continue; 00533 } 00534 //...remove extremely bad poinits 00535 if(abs(nneg - npos) > 3) { 00536 if(npos > nneg && l.position().y() < 0 ) bad.append(l); 00537 if(npos < nneg && l.position().y() > 0 ) bad.append(l); 00538 } 00539 } 00540 //... 00541 if (bad.length() > 0 && bad.length() < n) { 00542 _links.remove(bad); 00543 } 00544 00545 //... For the next fit 00546 _fitted = false; 00547 _fittedUpdated = false; 00548 }
|
|
|
|
00189 { 00190 _links.removeAll(); 00191 }
|
|
|
|
00551 { 00552 _links.remove(list); 00553 _fitted = false; 00554 _fittedUpdated = false; 00555 }
|
|
|
|
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 }
|
|
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 }
|
|
update cache.
Reimplemented in TSegment, TSegment0, TSegment, and TSegment0. |
|
update cache.
Reimplemented in TSegment, TSegment0, TSegment, and TSegment0. 00075 { 00076 _cores.removeAll(); 00077 unsigned n = _links.length(); 00078 for (unsigned i = 0; i < n; i++) { 00079 TMLink * l = _links[i]; 00080 const TMDCWireHit & h = * l->hit(); 00081 if (h.state() & WireHitInvalidForFit) continue; 00082 if (! (h.state() & WireHitFittingValid)) continue; 00083 _cores.append(l); 00084 } 00085 _updated = true; 00086 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Reimplemented from TTrackBase. |
|
|
|
|
|
|
|
|
|
|