#include <TBuilder.h>
Public Member Functions | |
TTrack * | build (TTrack &t, const TMLine &l) const |
TTrack * | build (TTrack &t, const TMLine &l) const |
TTrack * | buildRphi (const AList< TSegment > &) const |
TTrack * | buildRphi (const AList< TMLink > &) const |
builds a r/phi track from TMLinks or from Segments. | |
TTrack * | buildRphi (const AList< TSegment > &) const |
TTrack * | buildRphi (const AList< TMLink > &) const |
builds a r/phi track from TMLinks or from Segments. | |
TTrack * | buildStereo (TTrack &t, TMLine &l, const AList< TMLink > &links) const |
TTrack * | buildStereo (const TTrack &t, AList< TSegment > &) const |
TTrack * | buildStereo (TTrack &t, TMLine &l, const AList< TMLink > &links) const |
TTrack * | buildStereo (const TTrack &t, AList< TSegment > &) const |
TTrack * | buildStereoNew (const TTrack &t, AList< TSegment > &goodSegments, AList< TSegment > &badSegments) const |
TTrack * | buildStereoNew (const TTrack &t, AList< TSegment > &goodSegments, AList< TSegment > &badSegments) const |
TTrack * | buildStereoOld (TTrack &t, const AList< TMLink > &allLinks, const AList< TMLink > &isolatedLinks) const |
TTrack * | buildStereoOld (TTrack &t, const AList< TMLink > &allLinks, const AList< TMLink > &isolatedLinks) 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. | |
TMLine * | initialLine (const TTrack &, AList< TSegment > &) const |
makes a line. | |
TMLine * | initialLine (const TTrack &, AList< TSegment > &) const |
makes a line. | |
TMLine * | initialLine1 (const TTrack &, const AList< TSegment > &, const AList< TMLink > &) const |
TMLine * | initialLine1 (const TTrack &, const AList< TSegment > &, const AList< TMLink > &) const |
TMLine * | initialLine2 (const TTrack &, const AList< TMLink > &) const |
TMLine * | initialLine2 (const TTrack &, const AList< TMLink > &) const |
TMLine * | initialLineOld (const TTrack &, AList< TSegment > &) const |
TMLine * | initialLineOld (const TTrack &, AList< TSegment > &) const |
const std::string & | name (void) const |
returns name. | |
const std::string & | name (void) const |
returns name. | |
void | removeFarSegment (const TMLine &, AList< TSegment > &, AList< TMLink > &) const |
void | removeFarSegment (const TMLine &, AList< TSegment > &, AList< TMLink > &) const |
void | salvage (TTrack &t, AList< TSegment > &segments) const |
void | salvage (TTrack &t, AList< TMLink > &hits) const |
salvages hits. | |
void | salvage (TTrack &t, AList< TSegment > &segments) const |
void | salvage (TTrack &t, AList< TMLink > &hits) const |
salvages hits. | |
AList< TMLine > | searchInitialLines (unsigned nSuperLayers) const |
AList< TMLine > | searchInitialLines (unsigned nSuperLayers) const |
TMLine | searchLine (const TMLine &initialLine) const |
TMLine | searchLine (const TMLine &initialLine) const |
AList< TMLine > | searchLines1 (void) const |
AList< TMLine > | searchLines1 (void) const |
AList< TMLine > | searchLines2 (void) const |
AList< TMLine > | searchLines2 (void) const |
AList< TMLine > | searchLines3 (void) const |
AList< TMLine > | searchLines3 (void) const |
AList< TMLine > | searchLines4 (void) const |
AList< TMLine > | searchLines4 (void) const |
AList< TMLine > | searchLines5 (void) const |
AList< TMLine > | searchLines5 (void) const |
AList< TMLine > | searchLines6 (void) const |
AList< TMLine > | searchLines6 (void) const |
AList< TSegment > | selectStereoSegment (const TMLine &line, const AList< TSegment > &list, const AList< TMLink > &szList) const |
AList< TSegment > | selectStereoSegment (const TMLine &line, const AList< TSegment > &list, const AList< TMLink > &szList) const |
TBuilder (const std::string &name, float maxSigma, float maxSigmaStereo, float salvageLevel, float szSegmentDistance, float szLinkDistance, unsigned fittingFlag) | |
Constructor with salvage level. | |
TBuilder (const std::string &name, float maxSigma, float maxSigmaStereo, float salvageLevel, float szSegmentDistance, float szLinkDistance, unsigned fittingFlag) | |
Constructor with salvage level. | |
virtual | ~TBuilder () |
Destructor. | |
virtual | ~TBuilder () |
Destructor. | |
Private Member Functions | |
bool | initializeForStereo (const TTrack &, const AList< TSegment > &, const AList< TSegment > &) const |
initializes internal variables for stereo reconstruction. This should be called with new stereo codes. | |
bool | initializeForStereo (const TTrack &, const AList< TSegment > &, const AList< TSegment > &) const |
initializes internal variables for stereo reconstruction. This should be called with new stereo codes. | |
unsigned | stereoQuality (const AList< TMLink > &links) const |
checks stereo quality of a track. | |
unsigned | stereoQuality (const AList< TMLink > &links) const |
checks stereo quality of a track. | |
Private Attributes | |
AList< TMLink > | _allLinks |
AList< TMLink > | _allLinks |
THelixFitter | _fitter |
AList< TMLink > | _forLine |
AList< TMLink > | _forLine |
AList< TMLink > | _links [6] |
AList< TMLink > | _links [6] |
const float | _maxSigma |
const float | _maxSigmaStereo |
unsigned | _minNCores |
unsigned | _minNLinksForCircle |
std::string | _name |
unsigned | _nHits [5] |
unsigned | _nSuperLayers |
const float | _salvageLevel |
const float | _szLinkDistance |
const float | _szSegmentDistance |
|
Constructor with salvage level.
00043 : _name(a), 00044 _fitter("TBuilder Fitter"), 00045 _maxSigma(maxSigma), 00046 _maxSigmaStereo(maxSigmaStereo), 00047 _salvageLevel(sqrt(salvageLevel)), 00048 // _minNCores(3), //20060307 00049 _minNCores(2), //liuqg20070312 00050 _szSegmentDistance(szSegmentDistance), 00051 _szLinkDistance(szLinkDistance) { 00052 if (fittingFlag & 1) _fitter.sag(true); 00053 if (fittingFlag & 2) _fitter.propagation(true); 00054 if (fittingFlag & 4) _fitter.tof(true); 00055 if (fittingFlag & 8) _fitter.freeT0(true); 00056 }
|
|
Destructor.
00058 { 00059 }
|
|
Constructor with salvage level.
|
|
Destructor.
|
|
|
|
01254 { 01255 AList<TMLink> links = l.links(); 01256 AList<TMLink> toRemove; 01257 unsigned n = links.length(); 01258 for (unsigned i = 1; i < n; i++) { 01259 if (links[i - 1]->link() == links[i]->link()) { 01260 toRemove.append(links[i]); 01261 continue; 01262 } 01263 if (i < 2) 01264 continue; 01265 if (links[i - 2]->link() == links[i]->link()) 01266 toRemove.append(links[i]); 01267 } 01268 links.remove(toRemove); 01269 01270 //...Pick up links... 01271 n = links.length(); 01272 for (unsigned i = 0; i < n; i++) 01273 t.append(* links[i]->link()); 01274 01275 Vector a(5); 01276 a = t.helix().a(); 01277 a[3] = l.b(); 01278 a[4] = t.charge() * l.a(); 01279 t._helix->a(a); 01280 01281 //#ifdef TRKRECO_WINDOW 01282 // TTrack * td = new TTrack(t); 01283 // sz.append(* td, leda_green); 01284 //#endif 01285 #ifdef TRKRECO_DEBUG_DETAIL 01286 static unsigned nTrk = 0; 01287 ++nTrk; 01288 // for (unsigned i = 0; i < t.nCores(); i++) 01289 // if (t.cores()[i]->wire()->name() == "43=220") { 01290 // std::cout << "43=220 removed" << std::endl; 01291 // t.remove(* t.cores()[i]); 01292 // } 01293 HepVector3D pp; 01294 if (links[0]->hit()->mc()) 01295 pp = links[0]->hit()->mc()->hep()->p().vect(); 01296 const HepVector3D p0 = pp; 01297 // if (nTrk == 1) { 01298 // Helix tmph(Point3D(0, 0, 0), p0, +1); 01299 // * t._helix = tmph; 01300 // } 01301 t.dump("detail", "before fit"); 01302 std::cout << "Pdif mag=" << (t.p() - p0).mag() << std::endl; 01303 // t.links().removeAll(); 01304 // for (unsigned i = 0; i < BsCouTab(RECMDC_WIRHIT 01305 // } 01306 #endif 01307 01308 //...Refine... 01309 AList<TMLink> bad; 01310 int err = _fitter.fit(t); 01311 01312 #ifdef TRKRECO_DEBUG_DETAIL 01313 t.dump("detail", "after fit"); 01314 std::cout << "Pdif mag=" << (t.p() - p0).mag() << std::endl; 01315 #endif 01316 01317 t.refine(bad, _maxSigmaStereo * 100.); 01318 err = _fitter.fit(t); 01319 t.refine(bad, _maxSigmaStereo * 10.); 01320 err = _fitter.fit(t); 01321 t.refine(bad, _maxSigmaStereo); 01322 #ifdef TRKRECO_DEBUG_DETAIL 01323 // if (nTrk == 2) { 01324 // Helix tmph(Point3D(0, 0, 0), p0, +1); 01325 // * t._helix = tmph; 01326 // std::cout << "initial mom" << p0 << " is set" << std::endl; 01327 // } 01328 #endif 01329 err = _fitter.fit(t); 01330 01331 #ifdef TRKRECO_DEBUG_DETAIL 01332 t.dump("detail"," "); 01333 std::cout << "Pdif mag=" << (t.p() - p0).mag() << std::endl; 01334 #endif 01335 01336 //...Termination... 01337 return & t; 01338 }
|
|
|
|
builds a r/phi track from TMLinks or from Segments.
|
|
00066 { 00067 00068 #ifdef TRKRECO_DEBUG 00069 std::cout << "... building rphi by segments : # of segments = "; 00070 std::cout << list.length() << std::endl; 00071 for (unsigned i = 0; i < list.length(); i++) 00072 list[i]->dump("hits sort flag", " "); 00073 #endif 00074 //yuany 00075 // for (unsigned i = 0; i < list.length(); i++) 00076 // list[i]->dump("", " "); 00077 00078 //...Pick up links... 00079 AList<TMLink> links = Links(list); 00080 //yuany 00081 // for(unsigned i=0;i<links.length();i++){ 00082 // cout<<"wire name "<<links[i]->wire()->name()<<endl; 00083 // } 00084 00085 //...Main funtion... 00086 TTrack * t = buildRphi(links); 00087 00088 //...Check used segments... 00089 if (t) { 00090 const AList<TMLink> & usedLinks = t->links(); 00091 unsigned n = list.length(); 00092 for (unsigned i = 0; i < n; i++) { 00093 TSegment & segment = * list[i]; 00094 AList<TMLink> used = Links(segment, * t); 00095 if (used.length()) { 00096 t->segments().append(segment); 00097 segment.tracks().append(t); 00098 } 00099 } 00100 } 00101 00102 return t; 00103 00104 }
|
|
builds a r/phi track from TMLinks or from Segments.
00107 { 00108 #ifdef TRKRECO_DEBUG 00109 std::cout << "... building rphi by links : # of links = "; 00110 std::cout << list.length() << std::endl; 00111 #endif 00112 00113 //...Classify TMLink's... 00114 AList<TMLink> cores; 00115 AList<TMLink> nonCores; 00116 SeparateCores(list, cores, nonCores); 00117 00118 /* cout<<" ... cores..."<<endl; 00119 for(int ii = 0; ii < cores.length(); ++ii) { 00120 cout<<"layer: "<<cores[ii]->wire()->layerId() 00121 <<" local: "<<cores[ii]->wire()->localId()<<endl; 00122 } 00123 cout<<" ...noncores..."<<endl; 00124 for(int ii = 0; ii < nonCores.length(); ++ii) { 00125 cout<<"layer: "<<nonCores[ii]->wire()->layerId() 00126 <<" local: "<<nonCores[ii]->wire()->localId()<<endl; 00127 } 00128 */ 00129 //...Check # of links... 00130 unsigned nCores = cores.length(); 00131 if (nCores < _minNCores) { 00132 #ifdef TRKRECO_DEBUG 00133 std::cout << "... building rphi failure : # of cores(=" << nCores; 00134 std::cout << ") is less then " << _minNCores << std::endl; 00135 #endif 00136 00137 return NULL; 00138 } 00139 00140 //...Make a circle... 00141 #ifdef TRKRECO_DEBUG 00142 std::cout <<"links in list = "<<list.length()<<std::endl; 00143 std::cout << "... making a circle : # cores =" << cores.length() << std::endl; 00144 #endif 00145 TCircle c(cores); 00146 int err = c.fit(); 00147 if (err < 0) { 00148 #ifdef TRKRECO_DEBUG 00149 std::cout << "... building rphi failure : circle fit error = "; 00150 std::cout << err << std::endl; 00151 #endif 00152 return NULL; 00153 } 00154 // cout<<"radius "<<c.radius()<<" charge "<<c.charge()<<" center "<<c.center()<<endl; 00155 //...Make a track... 00156 TTrack * t = new TTrack(c); 00157 // t->dump("hits sort flag", " "); 00158 AList<TMLink> bad; 00159 err = _fitter.fit(* t); 00160 //cout<<"fit 1 done err: "<<err<<endl; 00161 // t->dump("hits sort flag", " "); 00162 if (err < 0) goto discard; 00163 t->refine(bad, _maxSigma * 100.); 00164 //cout<<"refine 1 done"<<endl; 00165 //t->dump("hits sort flag", " "); 00166 err = _fitter.fit(* t); 00167 //cout<<"fit 2 done err: "<<err<<endl; 00168 //t->dump("hits sort flag", " "); 00169 t->refine(bad, _maxSigma * 10.); 00170 //cout<<"refine 2 done"<<endl; 00171 //t->dump("hits sort flag", " "); 00172 err = _fitter.fit(* t); 00173 //cout<<"fit 3 done err: "<<err<<endl; 00174 //t->dump("hits sort flag", " "); 00175 t->refine(bad, _maxSigma); 00176 //cout<<"refine 3 done"<<endl; 00177 //t->dump("hits sort flag", " "); 00178 err = _fitter.fit(* t); 00179 //cout<<"fit 4 done err: "<<err<<endl; 00180 00181 if (err < 0) goto discard; 00182 #ifdef TRKRECO_DEBUG_DETAIL 00183 c.dump("detail", " ccl> "); 00184 t->dump("detail", " 1st> "); 00185 #endif 00186 00187 //...Try to append non-core hits... 00188 #ifdef TRKRECO_DEBUG 00189 std::cout << "... appending non-core hits : # = " << nonCores.length(); 00190 std::cout << std::endl; 00191 #endif 00192 t->appendByApproach(nonCores, _salvageLevel); 00193 #ifdef TRKRECO_DEBUG 00194 t->dump("hits sort flag", " "); 00195 #endif 00196 // t->dump("hits sort flag", " "); 00197 return t; 00198 00199 //...Something happened... 00200 discard: 00201 #ifdef TRKRECO_DEBUG 00202 std::cout << "... building rphi failure : helix fit error = "; 00203 std::cout << err << std::endl; 00204 #endif 00205 delete t; 00206 return NULL; 00207 }
|
|
|
|
|
|
00526 { 00527 #ifdef TRKRECO_DEBUG 00528 std::cout << "... building stereo by links : # of links = "; 00529 std::cout << list.length() << std::endl; 00530 #endif 00531 00532 //...Classify TMLink's... 00533 AList<TMLink> cores; 00534 AList<TMLink> nonCores; 00535 SeparateCores(list, cores, nonCores); 00536 //...Check # of links... 00537 unsigned nCores = cores.length(); 00538 if (nCores < _minNCores) { 00539 #ifdef TRKRECO_DEBUG 00540 std::cout << "... stereo building failure : # of cores(=" << nCores; 00541 std::cout << ") is less then " << _minNCores << std::endl; 00542 #endif 00543 return NULL; 00544 } 00545 #ifdef TRKRECO_WINDOW 00546 sz.appendSz(track, cores, leda_brown); 00547 #endif 00548 00549 //...Cal. left and right position... 00550 AList<TMLink> forNewLine; 00551 for (unsigned i = 0; i < nCores; i++) { 00552 TMLink & t = * cores[i]; 00553 for (unsigned i = 0; i < 2; i++) { 00554 TMLink & tt = * new TMLink(t); 00555 tt.leftRight(i); 00556 int err = track.szPosition(tt); 00557 if (err) { 00558 delete & tt; 00559 } 00560 else { 00561 if (line.distance(tt) < _szLinkDistance) { 00562 tt.link(& t); 00563 forNewLine.append(tt); 00564 } 00565 else { 00566 delete & tt; 00567 } 00568 } 00569 } 00570 } 00571 00572 //...Create new line... 00573 #ifdef TRKRECO_DEBUG 00574 std::cout << " ... creating a new line" << std::endl; 00575 #endif 00576 unsigned nNewLine = forNewLine.length(); 00577 TMLine newLine(forNewLine); 00578 static TRobustLineFitter fitter("abc"); 00579 int err = fitter.fit(newLine); 00580 // int err = newLine.fit(); 00581 if (err < 0) { 00582 HepAListDeleteAll(forNewLine); 00583 #ifdef TRKRECO_DEBUG_DETAIL 00584 std::cout << " ... 2nd linear fit failure. nLinks("; 00585 std::cout << forNewLine.length() << ")" << std::endl; 00586 #endif 00587 return NULL; 00588 } 00589 00590 #ifdef TRKRECO_WINDOW 00591 sz.append(newLine, leda_green); 00592 sz.wait(); 00593 #endif 00594 00595 #ifdef TRKRECO_DEBUG_DETAIL 00596 Dump(forNewLine, "sort hits stereo", " "); 00597 #endif 00598 00599 //...Decide left/right... 00600 AList<TMLink> toRemove; 00601 TMLink * last = NULL; 00602 for (unsigned i = 0; i < nNewLine; i++) { 00603 if (last == NULL) last = forNewLine[i]->link(); 00604 else { 00605 if (last == forNewLine[i]->link()) { 00606 if (newLine.distance(* forNewLine[i - 1]) > 00607 newLine.distance(* forNewLine[i])) 00608 toRemove.append(forNewLine[i - 1]); 00609 else 00610 toRemove.append(forNewLine[i]); 00611 last = NULL; 00612 } 00613 else { 00614 last = forNewLine[i]->link(); 00615 } 00616 } 00617 } 00618 forNewLine.remove(toRemove); 00619 nNewLine = forNewLine.length(); 00620 00621 #ifdef TRKRECO_DEBUG_DETAIL 00622 Dump(toRemove, "sort hits stereo", " x "); 00623 Dump(forNewLine, "sort hits stereo", " "); 00624 #endif 00625 00626 //...3D fit... 00627 for (unsigned i = 0; i < nNewLine; i++) 00628 track.append(* forNewLine[i]->link()); 00629 Vector a(5); 00630 a = track.helix().a(); 00631 a[3] = newLine.b(); 00632 a[4] = track.charge() * newLine.a(); 00633 track._helix->a(a); 00634 00635 //...Refine... 00636 AList<TMLink> bad; 00637 err = _fitter.fit(track); 00638 track.refine(bad, _maxSigmaStereo * 100.); 00639 err = _fitter.fit(track); 00640 track.refine(bad, _maxSigmaStereo * 10.); 00641 err = _fitter.fit(track); 00642 track.refine(bad, _maxSigmaStereo); 00643 err = _fitter.fit(track); 00644 00645 #ifdef TRKRECO_WINDOW 00646 sz.text("stereo finished"); 00647 sz.oneShot(track, leda_blue); 00648 #endif 00649 00650 //...Termination... 00651 HepAListDeleteAll(toRemove); 00652 HepAListDeleteAll(forNewLine); 00653 return & track; 00654 }
|
|
00657 { 00658 00659 TTrack & t = * new TTrack(t0); 00660 00661 #ifdef TRKRECO_DEBUG 00662 std::cout << "... building stereo by segments : # of segments = "; 00663 std::cout << segments.length() << std::endl; 00664 for (unsigned i = 0; i < segments.length(); i++) 00665 segments[i]->dump("hits sort flag", " "); 00666 #endif 00667 #ifdef TRKRECO_WINDOW 00668 sz.clear(); 00669 sz.skip(false); 00670 sz.mode(2); 00671 sz.appendSz(t, segments, leda_black); 00672 AList<TSegment> tmps = segments; 00673 std::string s = "# of segments = " + itostring(int(segments.length())); 00674 #endif 00675 00676 //...Find initial line... 00677 TMLine * line = initialLineOld(t, segments); 00678 if (! line) { 00679 #ifdef TRKRECO_DEBUG 00680 std::cout << "... building stereo failure : no initial line found" << std::endl; 00681 #endif 00682 #ifdef TRKRECO_WINDOW 00683 s = "no initial line found : " + s; 00684 sz.text(s); 00685 sz.wait(); 00686 #endif 00687 return NULL; 00688 } 00689 #ifdef TRKRECO_WINDOW 00690 sz.append(* line, leda_red); 00691 sz.text(s); 00692 sz.wait(); 00693 #endif 00694 00695 //...Pick up links... 00696 AList<TMLink> links; 00697 unsigned n = segments.length(); 00698 for (unsigned i = 0; i < n; i++) 00699 links.append(segments[i]->links()); 00700 00701 //...Main funtion... 00702 TTrack * ts = buildStereo(t, * line, links); 00703 00704 //...Check used segments... 00705 if (ts) { 00706 AList<TMLink> usedLinks = StereoHits(t.links()); 00707 for (unsigned i = 0; i < n; i++) { 00708 TSegment & segment = * segments[i]; 00709 AList<TMLink> used = Links(segment, t); 00710 if (used.length()) { 00711 t.segments().append(segment); 00712 segment.tracks().append(t); 00713 } 00714 } 00715 } 00716 00717 HepAListDeleteAll((AList<TMLink> &) line->links()); 00718 delete line; 00719 return ts; 00720 }
|
|
|
|
01525 { 01526 01527 #ifdef TRKRECO_DEBUG 01528 std::cout << "... building stereo by segments(new) : # of segments = "; 01529 std::cout << segments.length() << std::endl; 01530 for (unsigned i = 0; i < segments.length(); i++) 01531 segments[i]->dump("hits sort flag", " "); 01532 #endif 01533 #ifdef TRKRECO_WINDOW 01534 sz.clear(); 01535 #endif 01536 TTrack * bestCandidate = NULL; 01537 AList< AList<TMLink> > poorSeeds; 01538 bool ok = initializeForStereo(t, segments, badSegments); 01539 unsigned nSuperLayers = _nSuperLayers + 1; 01540 // std::cout<<"nSuperLayers in buildStereoNew:"<<_nSuperLayers<<endl; 01541 // cout<<"ok of initializeForStereo: "<<ok<<endl; 01542 01543 if (! ok) goto endOfBuilding; 01544 //...Main loop... 01545 while (--nSuperLayers) { 01546 01547 //...Initial line search... 01548 AList<TMLine> initialLines = searchInitialLines(nSuperLayers); 01549 #ifdef TRKRECO_WINDOW 01550 sz.clear(); 01551 sz.skip(false); 01552 sz.mode(2); 01553 sz.appendSz(t, segments, leda_black); 01554 AList<TSegment> tmps = segments; 01555 std::string s = "# of segments = " + itostring(int(segments.length())); 01556 sz.appendSz(t, _allLinks, leda_black); 01557 sz.append(_forLine, leda_brown); 01558 s = "nSprLyr=" + itostring(int(nSuperLayers)) + 01559 ", # of initial lines = " + itostring(int(initialLines.length())); 01560 for (unsigned i = 0; i < initialLines.length(); i++) 01561 sz.append(* initialLines[i], leda_red); 01562 sz.text(s); 01563 sz.wait(); 01564 #endif 01565 // cout<<"length of initialLines = "<<initialLines.length()<<endl; 01566 if (initialLines.length() == 0) continue; 01567 //...Line loop... 01568 bool found = false; 01569 unsigned nInitialLines = initialLines.length(); 01570 // cout<<"nInitialLines:"<<nInitialLines<<endl; 01571 01572 for (unsigned i = 0; i < nInitialLines; i++) { 01573 01574 //...Linear fit... 01575 const TMLine & line = * initialLines[i]; 01576 TMLine newLine = searchLine(line); 01577 01578 //...Skip if this is a seed of the poor result... 01579 if (poorSeeds.length()) { 01580 bool poorCase = false; 01581 for (unsigned j = 0; j < poorSeeds.length(); j++) { 01582 if (poorSeeds[j]->length() == newLine.links().length()) { 01583 AList<TMLink> tmp = * poorSeeds[j]; 01584 tmp.remove(newLine.links()); 01585 if (tmp.length() == 0) { 01586 #ifdef TRKRECO_DEBUG_DETAIL 01587 std::cout << " ... This is a poor seed :" 01588 << " skipped" 01589 << " : # of poor seeds = " 01590 << poorSeeds.length() << std::endl; 01591 #endif 01592 poorCase = true; 01593 break; 01594 } 01595 } 01596 } 01597 if (poorCase) continue; 01598 } 01599 01600 //...Is this a good line... 01601 if (! stereoQuality(newLine.links())) 01602 continue; 01603 01604 //...3D fit... 01605 TTrack * t3d = new TTrack(t); 01606 t3d = build(* t3d, newLine); 01607 if (t3d == NULL) continue; 01608 01609 //...Check quality... 01610 unsigned quality = stereoQuality(t3d->links()); 01611 // cout<<"point3, quality:"<<quality<<endl; 01612 01613 //...Best case... 01614 if (quality == 2) { 01615 #ifdef TRKRECO_WINDOW 01616 sz.text("stereo finished"); 01617 sz.oneShot(* t3d, leda_blue); 01618 #endif 01619 if (bestCandidate) delete bestCandidate; 01620 bestCandidate = t3d; 01621 found = true; 01622 break; 01623 } 01624 01625 //...Poor case... 01626 AList<TMLink> * tmpL = new AList<TMLink>(); 01627 tmpL->append(newLine.links()); 01628 poorSeeds.append(tmpL); 01629 if (quality == 0) { 01630 #ifdef TRKRECO_WINDOW 01631 sz.text("this candidate discarded"); 01632 sz.oneShot(* t3d, leda_black); 01633 #endif 01634 delete t3d; 01635 continue; 01636 } 01637 01638 //...Not enough... 01639 if (bestCandidate) { 01640 if (bestCandidate->cores().length() < 01641 t3d->cores().length()) { 01642 #ifdef TRKRECO_WINDOW 01643 sz.text("new candidate"); 01644 sz.append(* bestCandidate, leda_brown); 01645 sz.oneShot(* t3d, leda_green); 01646 sz.remove(* bestCandidate); 01647 #endif 01648 delete bestCandidate; 01649 bestCandidate = t3d; 01650 } 01651 else { 01652 #ifdef TRKRECO_WINDOW 01653 sz.text("this candidate discarded"); 01654 sz.oneShot(* t3d, leda_black); 01655 #endif 01656 delete t3d; 01657 } 01658 } 01659 else { 01660 bestCandidate = t3d; 01661 #ifdef TRKRECO_WINDOW 01662 sz.text("new candidate"); 01663 sz.oneShot(* bestCandidate, leda_green); 01664 sz.remove(* t3d); 01665 #endif 01666 } 01667 } 01668 01669 //...Termination of a loop... 01670 HepAListDeleteAll(initialLines); 01671 if (found) break; 01672 } 01673 01674 endOfBuilding: 01675 _allLinks.removeAll(); 01676 for (unsigned i = 0; i < 6; i++) 01677 HepAListDeleteAll(_links[i]); 01678 HepAListDeleteAll(_forLine); 01679 01680 #ifdef TRKRECO_DEBUG_DETAIL 01681 std::cout << " ... # of poor seeds = " << poorSeeds.length() << std::endl; 01682 #endif 01683 #ifdef TRKRECO_WINDOW 01684 if (bestCandidate == NULL) { 01685 sz.text("3D failed"); 01686 sz.wait(); 01687 } 01688 #endif 01689 01690 //...Check used segments... 01691 if (bestCandidate) { 01692 AList<TMLink> usedLinks = StereoHits(bestCandidate->links()); 01693 for (unsigned i = 0; i < segments.length(); i++) { 01694 TSegment & segment = * segments[i]; 01695 AList<TMLink> used = Links(segment, * bestCandidate); 01696 if (used.length()) { 01697 bestCandidate->segments().append(segment); 01698 segment.tracks().append(bestCandidate); 01699 } 01700 } 01701 } 01702 01703 if (poorSeeds.length()) 01704 HepAListDeleteAll(poorSeeds); 01705 01706 #ifdef TRASA_DEBUG_DETAIL 01707 if (bestCandidate == NULL) 01708 std::cout << "... building stereo(new) failed" << std::endl; 01709 else 01710 std::cout << "... building stereo(new) ok" << std::endl; 01711 #endif 01712 return bestCandidate; 01713 }
|
|
|
|
|
|
dumps debug information.
|
|
dumps debug information.
00062 { 00063 }
|
|
initializes internal variables for stereo reconstruction. This should be called with new stereo codes.
|
|
initializes internal variables for stereo reconstruction. This should be called with new stereo codes.
01343 { 01344 _nSuperLayers = 0; 01345 for (unsigned i = 0; i < 5; i++) 01346 _nHits[i] = 0; 01347 //...sz position of segments... 01348 unsigned nSegments = segments.length(); 01349 // cout<<" used Segments in stereo = "<<nSegments<<endl; 01350 for (unsigned i = 0; i < nSegments; i++) { 01351 TMLink & l = * new TMLink(); 01352 int err = t.szPosition(* segments[i], l); 01353 //...Remove if sz can not be calculcated... 01354 if (err) { 01355 delete & l; 01356 continue; 01357 } 01358 // _links[l.wire()->superLayerId() / 2].append(l); 01359 if (!_links[l.wire()->axialStereoLayerId()/4].hasMember(l)) 01360 _links[l.wire()->axialStereoLayerId()/4].append(l); 01361 //? _allLinks.append(segments[i]->links()); 01362 // _allLinks.append(segments[i]->cores()); 01363 for (unsigned j = 0; j < segments[i]->cores().length(); ++j) { 01364 TMLink & cL = * segments[i]->cores()[j]; 01365 if(!_allLinks.hasMember(cL)) _allLinks.append(cL); 01366 } 01367 } 01368 01369 //...Count a number of super layers... 01370 for (unsigned i = 0; i < 6; i++) { 01371 if (_links[i].length() > 0) { 01372 ++_nSuperLayers; 01373 } 01374 // else { 01375 // _allLinks.append(badSegments[i]->links()); 01376 // #ifdef TRKRECO_DEBUG_DETAIL 01377 // std::cout << " ... stereo super layer " << i * 2 + 1 01378 // << " has no link," 01379 // << badSegments[i]->links().length() << " (bad) links added" 01380 // << std::endl; 01381 // badSegments[i]->dump("hits sort flag", " "); 01382 // #endif 01383 // } 01384 } 01385 01386 //...Append bad links also... 01387 if (badSegments.length()) { 01388 for (unsigned i = 0; i < 6; i++) { 01389 if (badSegments[i]->links().length()) { 01390 _allLinks.append(badSegments[i]->links()); 01391 #ifdef TRKRECO_DEBUG_DETAIL 01392 std::cout << " ... bad links added for stereo super layer " 01393 << i * 2 + 1 << std::endl; 01394 badSegments[i]->dump("hits sort flag", " "); 01395 #endif 01396 } 01397 } 01398 } 01399 01400 //...sz position of links... 01401 unsigned nCores = _allLinks.length(); 01402 if (nCores < _minNCores) { 01403 #ifdef TRKRECO_DEBUG_DETAIL 01404 std::cout << " ... initializeForStereo : # of cores(=" << nCores 01405 << ") is less then " << _minNCores << std::endl; 01406 #endif 01407 return false; 01408 } 01409 for (unsigned j = 0; j < nCores; j++) { 01410 TMLink & link = * _allLinks[j]; 01411 for (unsigned i = 0; i < 2; i++) { 01412 TMLink & tt = * new TMLink(link); 01413 unsigned stateR=(link.hit()->state())&WireHitPatternRight; 01414 unsigned stateL=(link.hit()->state())&WireHitPatternLeft; 01415 bool boolR=(stateR==WireHitPatternRight); 01416 bool boolL=(stateL==WireHitPatternLeft); 01417 // std::cout<<"zsl TBuilder::initializeForStereo::boolR:"<<boolR<<", boolL:"<<boolL<<endl; 01418 01419 tt.leftRight(i); 01420 int err = t.szPosition(tt); 01421 // std::cout<<"zsl TBuilder::initializeForStereo::err:"<<err<<endl; 01422 // std::cout<<"----------------------"<<endl; 01423 01424 if (err) { 01425 delete & tt; 01426 continue; 01427 } 01428 tt.link(& link); 01429 _forLine.append(tt); 01430 } 01431 } 01432 01433 //...Count # of axial hits... 01434 unsigned nA = t.cores().length(); 01435 for (unsigned i = 0; i < nA; i++) 01436 // ++_nHits[t.cores()[i]->wire()->superLayerId() / 2]; 01437 ++_nHits[t.cores()[i]->wire()->axialStereoLayerId()/4]; 01438 01439 #ifdef TRKRECO_DEBUG 01440 std::cout << " ... initializeForStereo : axial super layer usage = "; 01441 for (unsigned i = 0; i < 5; i++) 01442 std::cout << _nHits[i] << ","; 01443 std::cout << std::endl 01444 << " : # of stereo super layers=" 01445 << _nSuperLayers << std::endl; 01446 #endif 01447 01448 return true; 01449 }
|
|
makes a line.
|
|
makes a line.
00314 { 00315 00316 //...Select good segments in acceptance... 00317 AList<TSegment> bad; 00318 AList<TMLink> lList; 00319 unsigned n = list.length(); 00320 for (unsigned i = 0; i < n; i++) { 00321 TMLink & l = * new TMLink(); 00322 int err = t.szPosition(* list[i], l); 00323 if (err) { 00324 bad.append(list[i]); 00325 delete & l; 00326 continue; 00327 } 00328 00329 const HepPoint3D & p = l.position(); 00330 if (p.y() > l.wire()->forwardPosition().z() || 00331 p.y() < l.wire()->backwardPosition().z()) { 00332 bad.append(list[i]); 00333 delete & l; 00334 continue; 00335 } 00336 lList.append(l); 00337 } 00338 list.remove(bad); 00339 n = list.length(); 00340 00341 //...Cal. expected # of super layers... 00342 unsigned nAMaxSL = 0; 00343 unsigned nAMinSL = 10; 00344 const AList<TSegment> & segments = t.segments(); 00345 unsigned nA = segments.length(); 00346 for (unsigned i = 0; i < nA; i++) { 00347 unsigned sl = segments[i]->superLayerId(); 00348 if (sl > nAMaxSL) nAMaxSL = sl; 00349 if (sl < nAMinSL) nAMinSL = sl; 00350 } 00351 unsigned nExpected = (nAMaxSL - nAMinSL) / 2; 00352 #ifdef TRKRECO_DEBUG 00353 std::cout << " ... initialLine : axial super layer usage = " << nAMinSL; 00354 std::cout << " ~ " << nAMaxSL << std::endl; 00355 std::cout << " : expected stereo super layers = "; 00356 std::cout << nExpected << std::endl; 00357 #endif 00358 00359 TMLine * line = NULL; 00360 AList<TSegment> list0 = list; 00361 AList<TMLink> lList0 = lList; 00362 while (1) { 00363 bool last = (NSuperLayers(lList) <= nExpected); 00364 00365 TMLine * line = initialLine2(t, lList); 00366 if (line) { 00367 AList<TSegment> tmp = selectStereoSegment(* line, list0, lList0); 00368 #ifdef TRKRECO_DEBUG 00369 std::cout << " ... initialLine2 : # of selected segments = "; 00370 std::cout << tmp.length() << std::endl; 00371 #endif 00372 if ((tmp.length() >= nExpected) || 00373 (tmp.length() >= 4) || 00374 last) { 00375 list = tmp; 00376 return line; 00377 } 00378 delete line; 00379 } 00380 00381 line = initialLine1(t, list, lList); 00382 if (line) { 00383 AList<TSegment> tmp = selectStereoSegment(* line, list0, lList0); 00384 bool ok = (tmp.length() >= nExpected); 00385 #ifdef TRKRECO_DEBUG 00386 std::cout << " ... initialLine2 : # of selected segments = "; 00387 std::cout << tmp.length() << " : ok, last = "; 00388 std::cout << ok << ", " << last << std::endl; 00389 #endif 00390 if (ok) { 00391 list = tmp; 00392 return line; 00393 } 00394 removeFarSegment(* line, list, lList); 00395 delete line; 00396 } 00397 else { 00398 return NULL; 00399 } 00400 } 00401 }
|
|
|
|
00248 { 00249 00250 //...Check input... 00251 if (list.length() < 2) return NULL; 00252 00253 //...Check super layer pattern... 00254 AList<TSegment> sl[5]; 00255 AList<TMLink> tl[5]; 00256 unsigned n = list.length(); 00257 for (unsigned i = 0; i < n; i ++) { 00258 unsigned j = list[i]->superLayerId() / 2; 00259 sl[j].append(list[i]); 00260 tl[j].append(lList[i]); 00261 } 00262 #ifdef TRKRECO_DEBUG 00263 std::cout << " ... initialLine1 : super layer ptn = "; 00264 for (unsigned i = 0; i < 5; i++) std::cout << sl[i].length(); 00265 std::cout << std::endl; 00266 #endif 00267 00268 //...Count single segment layer... 00269 unsigned nSingle = 0; 00270 for (unsigned i = 0; i < 5; i++) 00271 if (sl[i].length() == 1) ++nSingle; 00272 #ifdef TRKRECO_DEBUG 00273 std::cout << " ... # of single segment layer = " << nSingle << std::endl; 00274 #endif 00275 if (nSingle < 2) return NULL; 00276 00277 //...Happy case... 00278 AList<TSegment> bestCombination; 00279 AList<TMLink> forLine; 00280 for (unsigned i = 0; i < 5; i++) { 00281 if (sl[i].length() != 1) continue; 00282 bestCombination.append(sl[i]); 00283 forLine.append(tl[i]); 00284 } 00285 TMLine & line = * new TMLine(forLine); 00286 int err = line.fit(); 00287 if (err) { 00288 delete & line; 00289 return NULL; 00290 } 00291 return & line; 00292 }
|
|
|
|
00296 { 00297 #ifdef TRKRECO_DEBUG 00298 std::cout << " ... initlialLine2 : # of links = " << lList.length(); 00299 std::cout << std::endl; 00300 #endif 00301 00302 //...Static object... 00303 static TRobustLineFitter fitter("can you work?"); 00304 TMLine * line = new TMLine(lList); 00305 int err = fitter.fit(* line); 00306 if (err) { 00307 delete line; 00308 return NULL; 00309 } 00310 return line; 00311 }
|
|
|
|
00404 { 00405 00406 //...Select good segments in acceptance... 00407 AList<TSegment> bad; 00408 AList<TMLink> lList; 00409 unsigned n = list.length(); 00410 for (unsigned i = 0; i < n; i++) { 00411 TMLink & l = * new TMLink(); 00412 int err = t.szPosition(* list[i], l); 00413 if (err) { 00414 bad.append(list[i]); 00415 delete & l; 00416 continue; 00417 } 00418 00419 const HepPoint3D & p = l.position(); 00420 if (p.y() > l.wire()->forwardPosition().z() || 00421 p.y() < l.wire()->backwardPosition().z()) { 00422 bad.append(list[i]); 00423 delete & l; 00424 continue; 00425 } 00426 lList.append(l); 00427 } 00428 list.remove(bad); 00429 n = list.length(); 00430 00431 //...Cal. expected # of super layers... 00432 unsigned nAMaxSL = 0; 00433 unsigned nAMinSL = 10; 00434 const AList<TSegment> & segments = t.segments(); 00435 unsigned nA = segments.length(); 00436 for (unsigned i = 0; i < nA; i++) { 00437 unsigned sl = segments[i]->superLayerId(); 00438 if (sl > nAMaxSL) nAMaxSL = sl; 00439 if (sl < nAMinSL) nAMinSL = sl; 00440 } 00441 unsigned nExpected = (nAMaxSL - nAMinSL) / 2; 00442 #ifdef TRKRECO_DEBUG 00443 std::cout << " ... initialLine : axial super layer usage = " << nAMinSL; 00444 std::cout << " ~ " << nAMaxSL << std::endl; 00445 std::cout << " : expected stereo super layers = "; 00446 std::cout << nExpected << std::endl; 00447 #endif 00448 00449 TMLine * line = NULL; 00450 AList<TSegment> list0 = list; 00451 AList<TMLink> lList0 = lList; 00452 while (1) { 00453 TMLine * line = initialLine1(t, list, lList); 00454 if (line) { 00455 AList<TSegment> tmp = selectStereoSegment(* line, list0, lList0); 00456 #ifdef TRKRECO_DEBUG 00457 std::cout << " ... initialLine1 : # of selected segments = "; 00458 std::cout << tmp.length() << std::endl; 00459 #endif 00460 if (tmp.length() >= nExpected) { 00461 lList0.remove(line->links()); 00462 HepAListDeleteAll(lList0); 00463 list = tmp; 00464 return line; 00465 } 00466 delete line; 00467 } 00468 00469 line = initialLine2(t, lList); 00470 if (line) { 00471 AList<TSegment> tmp = selectStereoSegment(* line, list0, lList0); 00472 bool ok = (tmp.length() >= nExpected); 00473 bool last = (NSuperLayers(lList) <= nExpected); 00474 #ifdef TRKRECO_DEBUG 00475 std::cout << " ... initialLine2 : # of selected segments = "; 00476 std::cout << tmp.length() << " : ok, last = "; 00477 std::cout << ok << ", " << last << std::endl; 00478 #endif 00479 if (ok || last) { 00480 lList0.remove(line->links()); 00481 HepAListDeleteAll(lList0); 00482 list = tmp; 00483 return line; 00484 } 00485 removeFarSegment(* line, list, lList); 00486 delete line; 00487 } 00488 else { 00489 HepAListDeleteAll(lList0); 00490 return NULL; 00491 } 00492 } 00493 }
|
|
returns name.
|
|
returns name.
00146 {
00147 return _name;
00148 }
|
|
|
|
00511 { 00512 unsigned n = list.length(); 00513 float maxDistance = 0.; 00514 unsigned maxId = 0; 00515 for (unsigned i = 0; i < n; i++) { 00516 float distance = line.distance(* szList[i]); 00517 if (distance > maxDistance) maxId = i; 00518 } 00519 list.remove(maxId); 00520 szList.remove(maxId); 00521 }
|
|
|
|
salvages hits.
|
|
00227 { 00228 00229 #ifdef TRKRECO_DEBUG 00230 std::cout << "... salvaging by segments : # of segments = "; 00231 std::cout << list.length() << std::endl; 00232 for (unsigned i = 0; i < list.length(); i++) 00233 list[i]->dump("hits sort flag", " "); 00234 #endif 00235 00236 //...Pick up links... 00237 AList<TMLink> links; 00238 unsigned n = list.length(); 00239 for (unsigned i = 0; i < n; i++) 00240 links.append(list[i]->links()); 00241 00242 salvage(t, links); 00243 }
|
|
salvages hits.
00210 { 00211 00212 #ifdef TRKRECO_DEBUG 00213 std::cout << "... salvaging(TBuilder) : # of given hits=" << hits.length(); 00214 std::cout << ", salvage level=" << _salvageLevel << std::endl; 00215 Dump(hits, "hits sort flag"); 00216 #endif 00217 00218 unsigned nHits = hits.length(); 00219 if (nHits == 0) return; 00220 00221 //...Try to append this hit... 00222 t.appendByApproach(hits, _salvageLevel); 00223 _fitter.fit(t); 00224 }
|
|
|
|
00723 { 00724 #ifdef TRKRECO_DEBUG 00725 std::cout << " ... searchInitialLines : # of segments in sl : "; 00726 for (unsigned i = 0; i < 5; i++) 00727 std::cout << _links[i].length() << ","; 00728 std::cout << std::endl 00729 << " : max # of super layers=" 00730 << nSuperLayerMax << std::endl; 00731 #endif 00732 00733 AList<TMLine> lines; 00734 if (nSuperLayerMax > 5) 00735 lines.append(searchLines6()); 00736 else if (nSuperLayerMax > 4) 00737 lines.append(searchLines5()); 00738 else if (nSuperLayerMax > 3) 00739 lines.append(searchLines4()); 00740 else if (nSuperLayerMax > 2) 00741 lines.append(searchLines3()); 00742 else if (nSuperLayerMax > 1) 00743 lines.append(searchLines2()); 00744 // else 00745 // lines.append(searchLines1()); 00746 00747 lines.sort(SortByB); 00748 return lines; 00749 }
|
|
|
|
01175 { 01176 #ifdef TRKRECO_WINDOW 01177 std::string old = sz.text(); 01178 #endif 01179 01180 static float _szLinkMaxDistance = 5; 01181 01182 unsigned nLinks = _forLine.length(); 01183 TMLine line0 = initialLine; 01184 line0.remove(initialLine.links()); 01185 #ifdef TRKRECO_DEBUG 01186 line0.fitted(true); 01187 #endif 01188 unsigned nGoodLinks0 = 0; 01189 AList<TMLink> targets; 01190 unsigned nLoops = 0; 01191 while (1) { 01192 ++nLoops; 01193 01194 unsigned nGoodLinks = 0; 01195 for (unsigned i = 0; i < nLinks; i++) { 01196 float distance = line0.distance(* _forLine[i]); 01197 if (distance < _szLinkDistance) 01198 targets.append(_forLine[i]); 01199 if (distance < _szLinkMaxDistance) { 01200 ++nGoodLinks; 01201 } 01202 } 01203 01204 #ifdef TRKRECO_DEBUG 01205 std::cout << " ... searchLine : # of close hits(last) = " << nGoodLinks0 01206 << ", # of close hits = " << nGoodLinks << std::endl; 01207 #endif 01208 01209 //...Check condition... 01210 if (nGoodLinks0 == nGoodLinks) break; 01211 01212 //...Do fit... 01213 TMLine newLine(targets); 01214 static TRobustLineFitter fitter("robust fitter"); 01215 int err = fitter.fit(newLine); 01216 if (err) { 01217 #ifdef TRKRECO_WINDOW 01218 std::cout << " ... searchLine : failed to fit" << std::endl; 01219 std::string s = "line search failed"; 01220 sz.text(s); 01221 sz.wait(); 01222 #endif 01223 break; 01224 } 01225 01226 //...To protect infinite loop... 01227 if (nLoops > 10) { 01228 #ifdef TRKRECO_DEBUG_DETAIL 01229 std::cout << " reached to max # of loops(10) : break"; 01230 #endif 01231 break; 01232 } 01233 01234 #ifdef TRKRECO_WINDOW 01235 std::string ss = ", # of close hits(last) = " + itostring(int(nGoodLinks0)) 01236 + ", # of close hits = " + itostring(int(nGoodLinks)); 01237 sz.append(line0, leda_brown); 01238 sz.append(newLine, leda_green); 01239 sz.text(old + ", nLoops = " + itostring(int(nLoops)) + ss); 01240 sz.wait(); 01241 sz.remove(line0); 01242 sz.remove(newLine); 01243 #endif 01244 01245 line0 = newLine; 01246 nGoodLinks0 = nGoodLinks; 01247 targets.removeAll(); 01248 } 01249 01250 return line0; 01251 }
|
|
|
|
01154 { 01155 AList<TMLine> lines; 01156 01157 TMLine & line = * new TMLine(_forLine); 01158 int err = line.fit(); 01159 if (err) { 01160 delete & line; 01161 } 01162 else { 01163 lines.append(line); 01164 } 01165 01166 #ifdef TRKRECO_DEBUG 01167 std::cout << " ... searchLines1 : # of lines found = " 01168 << lines.length() << std::endl; 01169 #endif 01170 01171 return lines; 01172 }
|
|
|
|
01068 { 01069 AList<TMLine> lines; 01070 01071 const AList<TMLink> * l[2]; 01072 for (unsigned skip = 0; skip < 15; skip++) { 01073 if (skip == 0) { 01074 l[0] = & _links[0]; 01075 l[1] = & _links[1]; 01076 } 01077 else if (skip == 1) { 01078 l[1] = & _links[2]; 01079 } 01080 else if (skip == 2) { 01081 l[1] = & _links[3]; 01082 } 01083 else if (skip == 3) { 01084 l[1] = & _links[4]; 01085 } 01086 else if (skip == 4) { 01087 l[1] = & _links[5]; 01088 } 01089 else if (skip == 5) { 01090 l[0] = & _links[1]; 01091 l[1] = & _links[2]; 01092 } 01093 else if (skip == 6) { 01094 l[1] = & _links[3]; 01095 } 01096 else if (skip == 7) { 01097 l[1] = & _links[4]; 01098 } 01099 else if (skip == 8) { 01100 l[1] = & _links[5]; 01101 } 01102 else if (skip == 9) { 01103 l[0] = & _links[2]; 01104 l[1] = & _links[3]; 01105 } 01106 else if (skip == 10) { 01107 l[1] = & _links[4]; 01108 } 01109 else if (skip == 11) { 01110 l[1] = & _links[5]; 01111 } 01112 else if (skip == 12) { 01113 l[0] = & _links[3]; 01114 l[1] = & _links[4]; 01115 } 01116 else if (skip == 13) { 01117 l[1] = & _links[5]; 01118 } 01119 else if (skip == 14) { 01120 l[0] = & _links[4]; 01121 } 01122 01123 unsigned n[2]; 01124 for (unsigned i = 0; i < 2; i++) 01125 n[i] = l[i]->length(); 01126 01127 for (unsigned i0 = 0; i0 < n[0]; i0++) { 01128 for (unsigned i1 = 0; i1 < n[1]; i1++) { 01129 AList<TMLink> forLine; 01130 forLine.append((* l[0])[i0]); 01131 forLine.append((* l[1])[i1]); 01132 01133 TMLine & line = * new TMLine(forLine); 01134 int err = line.fit(); 01135 if (err) { 01136 delete & line; 01137 continue; 01138 } 01139 01140 lines.append(line); 01141 } 01142 } 01143 } 01144 01145 #ifdef TRKRECO_DEBUG 01146 std::cout << " ... searchLines2 : # of lines found = " 01147 << lines.length() << std::endl; 01148 #endif 01149 01150 return lines; 01151 }
|
|
|
|
00963 { 00964 AList<TMLine> lines; 00965 00966 const AList<TMLink> * l[3]; 00967 for (unsigned skip = 0; skip < 20; skip++) { 00968 if (skip == 0) { 00969 l[0] = & _links[0]; 00970 l[1] = & _links[1]; 00971 l[2] = & _links[2]; 00972 } 00973 else if (skip == 1) { 00974 l[2] = & _links[3]; 00975 } 00976 else if (skip == 2) { 00977 l[2] = & _links[4]; 00978 } 00979 else if (skip == 3) { 00980 l[2] = & _links[5]; 00981 } 00982 else if (skip == 4) { 00983 l[1] = & _links[2]; 00984 } 00985 else if (skip == 5) { 00986 l[2] = & _links[4]; 00987 } 00988 else if (skip == 6) { 00989 l[2] = & _links[3]; 00990 } 00991 else if (skip == 7) { 00992 l[1] = & _links[3]; 00993 l[2] = & _links[4]; 00994 } 00995 else if (skip == 8) { 00996 l[2] = & _links[5]; 00997 } 00998 else if (skip == 9) { 00999 l[1] = & _links[4]; 01000 } 01001 else if (skip == 10) { 01002 l[0] = & _links[1]; 01003 } 01004 else if (skip == 11) { 01005 l[1] = & _links[3]; 01006 } 01007 else if (skip == 12) { 01008 l[2] = & _links[4]; 01009 } 01010 else if (skip == 13) { 01011 l[1] = & _links[2]; 01012 } 01013 else if (skip == 14) { 01014 l[2] = & _links[3]; 01015 } 01016 else if (skip == 15) { 01017 l[2] = & _links[5]; 01018 } 01019 else if (skip == 16) { 01020 l[0] = & _links[2]; 01021 l[1] = & _links[3]; 01022 } 01023 else if (skip == 17) { 01024 l[2] = & _links[3]; 01025 } 01026 else if (skip == 18) { 01027 l[1] = & _links[4]; 01028 l[2] = & _links[5]; 01029 } 01030 else if (skip == 19) { 01031 l[0] = & _links[3]; 01032 } 01033 01034 unsigned n[3]; 01035 for (unsigned i = 0; i < 3; i++) 01036 n[i] = l[i]->length(); 01037 01038 for (unsigned i0 = 0; i0 < n[0]; i0++) { 01039 for (unsigned i1 = 0; i1 < n[1]; i1++) { 01040 for (unsigned i2 = 0; i2 < n[2]; i2++) { 01041 AList<TMLink> forLine; 01042 forLine.append((* l[0])[i0]); 01043 forLine.append((* l[1])[i1]); 01044 forLine.append((* l[2])[i2]); 01045 01046 TMLine & line = * new TMLine(forLine); 01047 int err = line.fit(); 01048 if (err) { 01049 delete & line; 01050 continue; 01051 } 01052 01053 lines.append(line); 01054 } 01055 } 01056 } 01057 } 01058 01059 #ifdef TRKRECO_DEBUG 01060 std::cout << " ... searchLines3 : # of lines found = " 01061 << lines.length() << std::endl; 01062 #endif 01063 01064 return lines; 01065 }
|
|
|
|
00866 { 00867 AList<TMLine> lines; 00868 00869 const AList<TMLink> * l[4]; 00870 for (unsigned skip = 0; skip < 15; skip++) { 00871 if (skip == 0) { 00872 l[0] = & _links[0]; 00873 l[1] = & _links[1]; 00874 l[2] = & _links[2]; 00875 l[3] = & _links[3]; 00876 } 00877 else if (skip == 1) { 00878 l[3] = & _links[4]; 00879 } 00880 else if (skip == 2) { 00881 l[3] = & _links[5]; 00882 } 00883 else if (skip == 3) { 00884 l[2] = & _links[3]; 00885 l[3] = & _links[4]; 00886 } 00887 else if (skip == 4) { 00888 l[3] = & _links[5]; 00889 } 00890 else if (skip == 5) { 00891 l[2] = & _links[4]; 00892 } 00893 else if (skip == 6) { 00894 l[1] = & _links[2]; 00895 l[2] = & _links[3]; 00896 l[3] = & _links[4]; 00897 } 00898 else if (skip == 7) { 00899 l[3] = & _links[5]; 00900 } 00901 else if (skip == 8) { 00902 l[2] = & _links[4]; 00903 } 00904 else if (skip == 9) { 00905 l[1] = & _links[3]; 00906 } 00907 else if (skip == 10) { 00908 l[0] = & _links[1]; 00909 l[1] = & _links[2]; 00910 l[2] = & _links[3]; 00911 l[3] = & _links[4]; 00912 } 00913 else if (skip == 11) { 00914 l[3] = & _links[5]; 00915 } 00916 else if (skip == 12) { 00917 l[2] = & _links[4]; 00918 } 00919 else if (skip == 13) { 00920 l[1] = & _links[3]; 00921 } 00922 else if (skip == 14) { 00923 l[0] = & _links[2]; 00924 } 00925 00926 unsigned n[4]; 00927 for (unsigned i = 0; i < 4; i++) 00928 n[i] = l[i]->length(); 00929 00930 for (unsigned i0 = 0; i0 < n[0]; i0++) { 00931 for (unsigned i1 = 0; i1 < n[1]; i1++) { 00932 for (unsigned i2 = 0; i2 < n[2]; i2++) { 00933 for (unsigned i3 = 0; i3 < n[3]; i3++) { 00934 AList<TMLink> forLine; 00935 forLine.append((* l[0])[i0]); 00936 forLine.append((* l[1])[i1]); 00937 forLine.append((* l[2])[i2]); 00938 forLine.append((* l[3])[i3]); 00939 00940 TMLine & line = * new TMLine(forLine); 00941 int err = line.fit(); 00942 if (err) { 00943 delete & line; 00944 continue; 00945 } 00946 00947 lines.append(line); 00948 } 00949 } 00950 } 00951 } 00952 } 00953 00954 #ifdef TRKRECO_DEBUG 00955 std::cout << " ... searchLines4 : # of lines found = " 00956 << lines.length() << std::endl; 00957 #endif 00958 00959 return lines; 00960 }
|
|
|
|
00797 { 00798 AList<TMLine> lines; 00799 00800 const AList<TMLink> * l[5]; 00801 for (unsigned skip = 0; skip < 6; skip++) { 00802 if (skip == 0) { 00803 l[0] = & _links[1]; 00804 l[1] = & _links[2]; 00805 l[2] = & _links[3]; 00806 l[3] = & _links[4]; 00807 l[4] = & _links[5]; 00808 } 00809 else if (skip == 1) { 00810 l[0] = & _links[0]; 00811 } 00812 else if (skip == 2) { 00813 l[1] = & _links[1]; 00814 } 00815 else if (skip == 3) { 00816 l[2] = & _links[2]; 00817 } 00818 else if (skip == 4) { 00819 l[3] = & _links[3]; 00820 } 00821 else if (skip == 5) { 00822 l[4] = & _links[4]; 00823 } 00824 00825 unsigned n[5]; 00826 for (unsigned i = 0; i < 5; i++) 00827 n[i] = l[i]->length(); 00828 00829 for (unsigned i0 = 0; i0 < n[0]; i0++) { 00830 for (unsigned i1 = 0; i1 < n[1]; i1++) { 00831 for (unsigned i2 = 0; i2 < n[2]; i2++) { 00832 for (unsigned i3 = 0; i3 < n[3]; i3++) { 00833 for (unsigned i4 = 0; i4 < n[4]; i4++) { 00834 00835 AList<TMLink> forLine; 00836 forLine.append((* l[0])[i0]); 00837 forLine.append((* l[1])[i1]); 00838 forLine.append((* l[2])[i2]); 00839 forLine.append((* l[3])[i3]); 00840 forLine.append((* l[4])[i4]); 00841 00842 TMLine & line = * new TMLine(forLine); 00843 int err = line.fit(); 00844 if (err) { 00845 delete & line; 00846 continue; 00847 } 00848 00849 lines.append(line); 00850 } 00851 } 00852 } 00853 } 00854 } 00855 } 00856 00857 #ifdef TRKRECO_DEBUG 00858 std::cout << " ... searchLines5 : # of lines found = " 00859 << lines.length() << std::endl; 00860 #endif 00861 00862 return lines; 00863 }
|
|
|
|
00752 { 00753 unsigned n[6]; 00754 for (unsigned i = 0; i < 6; i++) 00755 n[i] = _links[i].length(); 00756 00757 AList<TMLine> lines; 00758 for (unsigned i0 = 0; i0 < n[0]; i0++) { 00759 for (unsigned i1 = 0; i1 < n[1]; i1++) { 00760 for (unsigned i2 = 0; i2 < n[2]; i2++) { 00761 for (unsigned i3 = 0; i3 < n[3]; i3++) { 00762 for (unsigned i4 = 0; i4 < n[4]; i4++) { 00763 for (unsigned i5 = 0; i5 < n[5]; i5++) { 00764 00765 AList<TMLink> forLine; 00766 forLine.append(_links[0][i0]); 00767 forLine.append(_links[1][i1]); 00768 forLine.append(_links[2][i2]); 00769 forLine.append(_links[3][i3]); 00770 forLine.append(_links[4][i4]); 00771 forLine.append(_links[5][i5]); 00772 00773 TMLine & line = * new TMLine(forLine); 00774 int err = line.fit(); 00775 if (err) { 00776 delete & line; 00777 continue; 00778 } 00779 00780 lines.append(line); 00781 } 00782 } 00783 } 00784 } 00785 } 00786 } 00787 00788 #ifdef TRKRECO_DEBUG 00789 std::cout << " ... searchLines5 : # of lines found = " 00790 << lines.length() << std::endl; 00791 #endif 00792 00793 return lines; 00794 }
|
|
|
|
00498 { 00499 AList<TSegment> outList; 00500 unsigned n = list.length(); 00501 for (unsigned i = 0; i < n; i++) { 00502 float distance = line.distance(* szList[i]); 00503 if (distance < _szSegmentDistance) outList.append(list[i]); 00504 } 00505 return outList; 00506 }
|
|
checks stereo quality of a track.
|
|
checks stereo quality of a track.
01452 { 01453 unsigned n[6] = {0, 0, 0, 0, 0, 0}; 01454 01455 //...Check superlayers... 01456 unsigned nLinks = links.length(); 01457 for (unsigned i = 0; i < nLinks; i++) { 01458 const TMLink & l = * links[i]; 01459 if (l.wire()->axial()) continue; 01460 // ++n[l.wire()->superLayerId() / 2]; 01461 // cout<<l.wire()->axialStereoLayerId()<<endl; 01462 ++n[l.wire()->axialStereoLayerId()/4]; 01463 } 01464 01465 unsigned nTotal = 0; 01466 unsigned nMissing = 0; 01467 unsigned innermostStereo = 5; 01468 unsigned outermostStereo = 0; 01469 unsigned innermostAxial = 4; 01470 unsigned outermostAxial = 0; 01471 unsigned innerSL = 6; 01472 unsigned outerSL = 0; 01473 for (unsigned i = 0; i < 6; i++) { 01474 if (_links[i].length() > 1) { 01475 if(i > outermostStereo) outermostStereo = i; 01476 if(i < innermostStereo) innermostStereo = i; 01477 } 01478 if (n[i] > 1) ++nTotal; 01479 } 01480 for (unsigned i = 0; i < 5; i++) { 01481 if (_nHits[i] > 1) { 01482 if (i > outermostAxial) outermostAxial = i; 01483 if (i < innermostAxial) innermostAxial = i; 01484 } 01485 } 01486 01487 if(innermostStereo > 1 && innermostAxial < 3) innerSL = 2; 01488 else innerSL = innermostStereo; 01489 if(outermostStereo > 1 && outermostAxial > 2) outerSL = 5; 01490 else outerSL = outermostStereo; 01491 01492 for (unsigned i = 0; i < 6; i++) { 01493 if (_links[i].length() > 0) { 01494 //zsl 051014 if ((_nHits[i] > 1) && (_nHits[i + 1] > 1)) 01495 if (i <= outerSL && i >= innerSL) 01496 if (n[i] < 2) 01497 ++nMissing; 01498 } 01499 if (n[i] > 1) ++nTotal; 01500 } 01501 unsigned toBeReturn = 0; 01502 if (nMissing <= 1) toBeReturn = 2; 01503 else if (nMissing == 2) toBeReturn = 1; 01504 if (nTotal < 2) toBeReturn = 0; 01505 01506 #ifdef TRKRECO_DEBUG 01507 std::cout << " ... stereoQuality : axial "; 01508 for (unsigned i = 0; i < 6; i++) 01509 std::cout << _nHits[i] << ","; 01510 std::cout << std::endl 01511 << " : stereo "; 01512 for (unsigned i = 0; i < 5; i++) 01513 std::cout << n[i] << ","; 01514 std::cout << " : total " << nTotal << " super layers, " 01515 << " : quality=" << toBeReturn << std::endl; 01516 #endif 01517 01518 return toBeReturn; 01519 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|