#include <TConformalFinder.h>
Inheritance diagram for TConformalFinder:
Public Member Functions | |
void | clear (void) |
clear internal information. | |
void | clear (void) |
clear internal information. | |
virtual int | debugLevel (int) |
sets debug level. | |
virtual int | debugLevel (void) const |
returns debug level. | |
virtual int | debugLevel (int) |
sets debug level. | |
virtual int | debugLevel (void) const |
returns debug level. | |
int | doit (const AList< TMDCWireHit > &axialHits, const AList< TMDCWireHit > &stereoHits, AList< TTrack > &tracks, AList< TTrack > &tracks2D) |
finds tracks. | |
int | doit (const AList< TMDCWireHit > &axialHits, const AList< TMDCWireHit > &stereoHits, AList< TTrack > &tracks, AList< TTrack > &tracks2D) |
finds tracks. | |
virtual bool | doSalvage (bool) |
sets flag to salvage hits. | |
virtual bool | doSalvage (bool) |
sets flag to salvage hits. | |
virtual bool | doStereo (bool) |
sets flag to reconstruct 3D. | |
virtual bool | doStereo (bool) |
sets flag to reconstruct 3D. | |
bool | doT0Reset (bool) |
sets a flag to do T0 reset in the fast 2D finding. | |
bool | doT0Reset (bool) |
sets a flag to do T0 reset in the fast 2D finding. | |
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. | |
std::string | name (void) const |
returns name. | |
std::string | name (void) const |
returns name. | |
bool | T0ResetDone (void) const |
returns T0 reset is done. | |
bool | T0ResetDone (void) const |
returns T0 reset is done. | |
TConformalFinder (unsigned fastFinder, unsigned slowFinder, unsigned perfectSegmentFinding, float maxSigma, float maxSigmaStereo, float salvageLevel, unsigned minNLinksForSegment, unsigned minNCoreLinks, unsigned minNSegments, unsigned salvageLoadWidth, unsigned stereoMode, unsigned stereoLoadWidth, float szSegmentDistance, float szLinkDistance, unsigned fittingFlag) | |
Constructor. | |
TConformalFinder (unsigned fastFinder, unsigned slowFinder, unsigned perfectSegmentFinding, float maxSigma, float maxSigmaStereo, float salvageLevel, unsigned minNLinksForSegment, unsigned minNCoreLinks, unsigned minNSegments, unsigned salvageLoadWidth, unsigned stereoMode, unsigned stereoLoadWidth, float szSegmentDistance, float szLinkDistance, unsigned fittingFlag) | |
Constructor. | |
std::string | version (void) const |
returns version. | |
std::string | version (void) const |
returns version. | |
virtual | ~TConformalFinder () |
Destructor. | |
virtual | ~TConformalFinder () |
Destructor. | |
Static Public Member Functions | |
const TMDCWire * | conformal2Wire (const HepPoint3D &conformalPoint) |
const TMDCWire * | conformal2Wire (const HepPoint3D &conformalPoint) |
Private Member Functions | |
int | crossPoints (const TTrack &, TPoint2D points[12]) const |
Utility functions. | |
int | crossPoints (const TTrack &, TPoint2D points[12]) const |
Utility functions. | |
int | crossPointsInConformal (const AList< TSegment > &, HepPoint3D points[12]) const |
int | crossPointsInConformal (const AList< TSegment > &, HepPoint3D points[12]) const |
void | deleteTrack (TTrack &) const |
deletes a track. | |
void | deleteTrack (TTrack &) const |
deletes a track. | |
HepVector3D | direction (const TSegment &) const |
HepVector3D | direction (const TSegment &) const |
TTrack * | expand (TTrack &) const |
TTrack * | expand (AList< TSegment > &) const |
TTrack * | expand (TTrack &) const |
TTrack * | expand (AList< TSegment > &) const |
void | fastFinding2D (unsigned level) |
fast findings. level:0/1:selection of segments to be used | |
void | fastFinding2D (unsigned level) |
fast findings. level:0/1:selection of segments to be used | |
void | fastFinding3D (unsigned level) |
void | fastFinding3D (unsigned level) |
void | findSegments (void) |
finds segments from _goodHits. | |
void | findSegments (void) |
finds segments from _goodHits. | |
void | findSegmentsPerfect (void) |
void | findSegmentsPerfect (void) |
void | findSegmentsTsf (void) |
finds segments from all hits. | |
void | findSegmentsTsf (void) |
finds segments from all hits. | |
TSegment * | link (const TSegment &seed, const HepPoint3D &p, const HepVector3D &v, const AList< TSegment > &candidates, AList< TSegment > &alternatives, unsigned level) const |
TSegment * | link (const TSegment &seed, const HepPoint3D &p, const HepVector3D &v, const AList< TSegment > &candidates, AList< TSegment > &alternatives, unsigned level) const |
void | linkSegments (unsigned level) |
links segments. | |
void | linkSegments (unsigned level) |
links segments. | |
void | linkSegmentsTsf (void) |
void | linkSegmentsTsf (void) |
AList< TMLink > | pickUpLinks (const TPoint2D p[12], float loadWidth, unsigned axialStereo) const |
AList< TMLink > | pickUpLinks (const TPoint2D p[12], float loadWidth, unsigned axialStereo) const |
AList< TMLink > | pickUpLinksInConformal (float phi[12], float loadWidth, unsigned axialStereo) const |
AList< TMLink > | pickUpLinksInConformal (float phi[12], float loadWidth, unsigned axialStereo) const |
AList< TSegment > | pickUpSegments (const TPoint2D p[12], float loadWidth, unsigned axialStereo) const |
AList< TSegment > | pickUpSegments (const TPoint2D p[12], float loadWidth, unsigned axialStereo) const |
AList< TSegment > | pickUpSegmentsInConformal (float phi[12], float loadWidth, unsigned axialStereo) const |
AList< TSegment > | pickUpSegmentsInConformal (float phi[12], float loadWidth, unsigned axialStereo) const |
bool | quality2D (TTrack &t, unsigned level) const |
bool | quality2D (TTrack &t, unsigned level) const |
void | refineLinks (TTrack &, unsigned minNHits) const |
void | refineLinks (TTrack &, unsigned minNHits) const |
AList< TSegment > | refineSegments (const TTrack &) const |
AList< TSegment > | refineSegments (const TTrack &) const |
AList< TSegment > | removeBadSegments (TTrack &) const |
removes bad segments. | |
AList< TSegment > | removeBadSegments (TTrack &) const |
removes bad segments. | |
void | removeUsedSegments (const AList< TTrack > &tracks) |
remove used segments. | |
void | removeUsedSegments (const AList< TTrack > &tracks) |
remove used segments. | |
void | resolveHits (AList< TTrack > &tracks) const |
void | resolveHits (AList< TTrack > &tracks) const |
void | resolveSegments (AList< TTrack > &tracks) const |
resolves multi-assignment of segments/hits. | |
void | resolveSegments (AList< TTrack > &tracks) const |
resolves multi-assignment of segments/hits. | |
void | salvage (TTrack &track, unsigned axialStereoSwitch, const AList< TSegment > &bads) const |
salvages segments. | |
void | salvage (TTrack &track, unsigned axialStereoSwitch, const AList< TSegment > &bads) const |
salvages segments. | |
void | selectGoodHits (void) |
selects good hits. | |
void | selectGoodHits (void) |
selects good hits. | |
void | slowFinding2D (unsigned level) |
slow findings. level:0/1:selection of segments to be used | |
void | slowFinding2D (unsigned level) |
slow findings. level:0/1:selection of segments to be used | |
AList< TSegment > | stereoSegments (const TTrack &t) const |
finds setereo segments. | |
AList< TSegment > | stereoSegments (const TTrack &t) const |
finds setereo segments. | |
AList< TSegment > | stereoSegmentsFromBadHits (const TTrack &t) const |
AList< TSegment > | stereoSegmentsFromBadHits (const TTrack &t) const |
AList< TMLink > | targetLinks (const TTrack &, unsigned sl) const |
AList< TMLink > | targetLinks (const TTrack &, unsigned sl) const |
AList< TSegment > | targetSegments (const TTrack &, unsigned sl) const |
AList< TSegment > | targetSegments (const TTrack &, unsigned sl) const |
void | targetSuperLayer (unsigned ptn, unsigned &in, unsigned &out) const |
void | targetSuperLayer (unsigned ptn, unsigned &in, unsigned &out) const |
bool | trackQuality (const TTrack &) const |
bool | trackQuality (const TTrack &) const |
AList< TSegment > | trackSide (const TTrack &, const AList< TSegment > &) const |
AList< TMLink > | trackSide (const TTrack &, const AList< TMLink > &) const |
AList< TSegment > | trackSide (const TTrack &, const AList< TSegment > &) const |
AList< TMLink > | trackSide (const TTrack &, const AList< TMLink > &) const |
void | updateTLinks (AList< TTrack > &tracks) |
re-calculate TMLinks. | |
void | updateTLinks (AList< TTrack > &tracks) |
re-calculate TMLinks. | |
Private Attributes | |
AList< TTrack > | _2DTracks |
AList< TTrack > | _2DTracks |
AList< TTrack > | _3DTracks |
AList< TTrack > | _3DTracks |
AList< TMLink > | _allHits [3] |
AList< TMLink > | _allHits [3] |
AList< TSegment > | _allSegments [2][6] |
AList< TSegment > | _allSegments [2][6] |
AList< TSegment > | _allUnused [2][6] |
AList< TSegment > | _allUnused [2][6] |
const unsigned | _appendLoad |
const TBuilder | _builder |
bool | _doT0Reset |
const bool | _fastFinder |
AList< TMLink > | _hits [3] |
AList< TMLink > | _hits [3] |
float | _linkMaxDistance [3] |
float | _linkMinDirAngle [3] |
const unsigned | _maxNLinksForSegment |
const float | _maxSigma2 |
const unsigned | _maxWidthForSegment |
const unsigned | _minNCoreLinks |
const unsigned | _minNLinksForSegment |
const unsigned | _minNLinksForSegmentInRefine |
const unsigned | _minNSegments |
const float | _minUsedFractionSlow2D |
const unsigned | _perfectSegmentFinding |
summary * | _s |
summary * | _s |
const unsigned | _salvageLoadWidth |
const unsigned | _segmentSeparation |
const bool | _slowFinder |
AList< TSegment > | _stereoBadSegments |
AList< TSegment > | _stereoBadSegments |
const unsigned | _stereoLoadWidth |
const unsigned | _stereoMode |
bool | _T0ResetDone |
AList< TMLink > | _unused [3] |
AList< TMLink > | _unused [3] |
|
Constructor.
00074 : _fastFinder(fastFinder), 00075 _slowFinder(slowFinder), 00076 _doT0Reset(false), 00077 _perfectSegmentFinding(perfectSegmentFinding), 00078 _segmentSeparation(4), 00079 _minNLinksForSegment(minNLinksForSegment), 00080 _minNLinksForSegmentInRefine(2), //3, 20060307 00081 _maxNLinksForSegment(8), 00082 _maxWidthForSegment(4), 00083 _minNCoreLinks(minNCoreLinks), 00084 _minNSegments(minNSegments), 00085 _minUsedFractionSlow2D(0.5), 00086 _salvageLoadWidth(salvageLoadWidth), 00087 _stereoMode(stereoMode), 00088 _stereoLoadWidth(stereoLoadWidth), 00089 _appendLoad(2), 00090 _maxSigma2(maxSigma), 00091 _T0ResetDone(false), 00092 _builder("conformal builder", 00093 maxSigma, 00094 maxSigmaStereo, 00095 salvageLevel, 00096 szSegmentDistance, 00097 szLinkDistance, 00098 fittingFlag), 00099 _s(0) 00100 #ifdef TRKRECO_WINDOW 00101 , _rphiWindow("rphi window") 00102 #endif 00103 { 00104 _linkMaxDistance[0] = 0.02; 00105 _linkMaxDistance[1] = 0.025; 00106 _linkMaxDistance[2] = 0.025; 00107 _linkMinDirAngle[0] = 0.97; //0.98 00108 _linkMinDirAngle[1] = 0.95; //0.97 00109 _linkMinDirAngle[2] = 0.95; //0.97 00110 // BASF_Sharedmem->allocate("TrkConfSum", sizeof(struct summary)); 00111 }
|
|
Destructor.
00113 { 00114 }
|
|
Constructor.
|
|
Destructor.
|
|
clear internal information.
Implements TFinderBase. |
|
clear internal information.
Implements TFinderBase. 00167 { 00168 for (unsigned i = 0; i < 3; i++) { 00169 if (i == 2) 00170 HepAListDeleteAll(_allHits[i]); 00171 else 00172 _allHits[i].removeAll(); 00173 _hits[i].removeAll(); 00174 _unused[i].removeAll(); 00175 } 00176 for (unsigned i = 0; i < 2; i++) { 00177 for (unsigned j = 0; j < 6; j++) { 00178 // cout<<"_allSegments length = "<<_allSegments[i][j].length()<<" _allUnused length = "<<_allUnused[i][j].length()<<endl; 00179 HepAListDeleteAll(_allSegments[i][j]); 00180 _allUnused[i][j].removeAll(); 00181 } 00182 } 00183 _2DTracks.removeAll(); 00184 _3DTracks.removeAll(); 00185 }
|
|
|
|
01521 { 01522 static const TMDC & cdc = * TMDC::getTMDC(); 01523 01524 std::cout << "p = " << p << std::endl; 01525 float r = sqrt(4. / p.mag2()); 01526 float phi = p.phi(); 01527 return cdc.wire(r, phi); 01528 }
|
|
Utility functions.
|
|
Utility functions.
02023 { 02024 02025 #ifdef TRKRECO_DEBUG_DETAIL 02026 std::cout << " cross points are :" << std::endl; 02027 #endif 02028 02029 /* 02030 //...Parameters... 02031 static const float R[] = { 8.3, 02032 16.9, 02033 21.7, 02034 31.3, 02035 36.1, 02036 44.1, 02037 50.5, 02038 58.5, 02039 64.9, 02040 72.9, 02041 79.3, 02042 87.4}; 02043 static const float R2[] = { 8.3 * 8.3, 02044 16.9 * 16.9, 02045 21.7 * 21.7, 02046 31.3 * 31.3, 02047 36.1 * 36.1, 02048 44.1 * 44.1, 02049 50.5 * 50.5, 02050 58.5 * 58.5, 02051 64.9 * 64.9, 02052 72.9 * 72.9, 02053 79.3 * 79.3, 02054 87.4 * 87.4}; 02055 */ 02056 static const float R[] = { 7.3, 02057 12.21, 02058 18.9, 02059 25.375, 02060 31.86, 02061 39.16, 02062 45.685, 02063 52.215, 02064 58.665, 02065 65.91, 02066 72.37, 02067 80.}; 02068 static const float R2[] = { R[0]*R[0], 02069 R[1]*R[1], 02070 R[2]*R[2], 02071 R[3]*R[3], 02072 R[4]*R[4], 02073 R[5]*R[5], 02074 R[6]*R[6], 02075 R[7]*R[7], 02076 R[8]*R[8], 02077 R[9]*R[9], 02078 R[10]*R[10], 02079 R[11]*R[11]}; 02080 02081 02082 static const TPoint2D o(0., 0.); 02083 TPoint2D c = track.center(); 02084 TPoint2D co = - c; 02085 double r = fabs(track.radius()); 02086 double r2 = r * r; 02087 double d2 = c.mag2(); 02088 double d = sqrt(d2); 02089 double sl = - c.x() / c.y(); 02090 //...Calculate points... 02091 unsigned nOk = 0; 02092 for (unsigned i = 0; i < 12; i++) { 02093 double minR = r < R[i] ? r : R[i]; 02094 double maxR = r < R[i] ? R[i] : r; 02095 02096 // std::cout << " r,R ... " << minR << ", " << maxR << ", " << d << std::endl; 02097 02098 if ((r + R[i] < d) || (minR + d < maxR)) { //no intersection of two circles 02099 points[i] = o; 02100 continue; 02101 } 02102 ++nOk; 02103 double a = R2[i] + d2 - r2; 02104 double s = sqrt(4. * R2[i] * d2 - a * a); 02105 double q = 0.5 * a / c.y(); 02106 points[i].x(0.5 * (c.x() * a + c.y() * s) / d2); 02107 points[i].y(q + sl * points[i].x()); 02108 if (co.cross(points[i] - c) * track.charge() > 0.) { 02109 points[i].x(0.5 * (c.x() * a - c.y() * s) / d2); 02110 points[i].y(q + sl * points[i].x()); 02111 } 02112 #ifdef TRKRECO_DEBUG_DETAIL 02113 std::cout << " " << i << " : " << points[i] << std::endl; 02114 // std::cout << " chg=" << track.charge(); 02115 // std::cout << ", c=" << c << ", co=" << co; 02116 // std::cout << ", " << co.cross(points[i] - c) * track.charge() << std::endl; 02117 // std::cout << " " << 0.5 * (c.x() * a + c.y() * s) / d2; 02118 // std::cout << ", " << q + sl * (0.5 * (c.x() * a + c.y() * s) / d2); 02119 // std::cout << " " << 0.5 * (c.x() * a - c.y() * s) / d2; 02120 // std::cout << ", " << q + sl * (0.5 * (c.x() * a - c.y() * s) / d2); 02121 // std::cout << std::endl; 02122 #endif 02123 02124 } 02125 if (nOk) return 0; 02126 else return -1; 02127 }
|
|
|
|
01630 { 01631 //...Parameters... 01632 static const float confRadius2[] = {4. / ( 8.3 * 8.3), 01633 4. / (16.9 * 16.9), 01634 4. / (21.7 * 21.7), 01635 4. / (31.3 * 31.3), 01636 4. / (36.1 * 36.1), 01637 4. / (44.1 * 44.1), 01638 4. / (50.5 * 50.5), 01639 4. / (58.5 * 58.5), 01640 4. / (64.9 * 64.9), 01641 4. / (72.9 * 72.9), 01642 4. / (79.3 * 79.3), 01643 4. / (87.4 * 87.4)}; 01644 01645 //...Get conformal points from segments as seeds... 01646 AList<TMLink> forLine; 01647 HepPoint3D center; 01648 unsigned n = inList.length(); 01649 for (unsigned i = 0; i < n; i++) { 01650 const HepPoint3D & p = inList[i]->position(); 01651 forLine.append(new TMLink(NULL, NULL, p)); 01652 center += p; 01653 } 01654 center *= 1. / float(n); 01655 01656 //...Make a line in the conformal plane... 01657 TMLine line(forLine); 01658 int err = line.fit(); 01659 if (err) { 01660 #ifdef TRKRECO_DEBUG 01661 std::cout << "crossPoints ... failed due to line fit failure" << std::endl; 01662 #endif 01663 HepAListDeleteAll(forLine); 01664 return -1; 01665 } 01666 01667 //...Calculate points... 01668 for (unsigned i = 0; i < 12; i++) { 01669 HepPoint3D p[2]; 01670 float c = - line.a() * line.b(); 01671 float d = 1. + line.a() * line.a(); 01672 float e = sqrt(confRadius2[i] * d - line.b() * line.b()); 01673 p[0].setX((c + e) / d); 01674 p[0].setY(line.a() * p[0].x() + line.b()); 01675 p[1].setX((c - e) / d); 01676 p[1].setY(line.a() * p[1].x() + line.b()); 01677 01678 float mag0 = (center - p[0]).mag(); 01679 float mag1 = (center - p[1]).mag(); 01680 01681 if (mag0 < mag1) points[i] = p[0]; 01682 else points[i] = p[1]; 01683 #ifdef TRKRECO_DEBUG_DETAIL 01684 std::cout << "0,1 = " << p[0] << ", " << p[1] << std::endl; 01685 #endif 01686 } 01687 01688 #ifdef TRKRECO_DEBUG_DETAIL 01689 std::cout << "... center is : " << center << std::endl; 01690 std::cout << "... cross points are : " << std::endl; 01691 for (unsigned i = 0; i < 12; i++) { 01692 std::cout << " " << i << " : " << points[i] << std::endl; 01693 } 01694 #endif 01695 #ifdef TRKRECO_WINDOW 01696 displayStatus("Conf::crossPoints ... line to salvage for conf plane"); 01697 _rphiWindow.append(inList, leda_green); 01698 _rphiWindow.oneShot(line, leda_blue); 01699 #endif 01700 01701 HepAListDeleteAll(forLine); 01702 return 0; 01703 }
|
|
sets debug level.
|
|
returns debug level.
|
|
sets debug level.
00096 {
00097 return _debugLevel = a;
00098 }
|
|
returns debug level.
00090 {
00091 return _debugLevel;
00092 }
|
|
deletes a track.
|
|
deletes a track.
00684 { 00685 const AList<TSegment> & segments = t.segments(); 00686 unsigned n = segments.length(); 00687 for (unsigned i = 0; i < n; i++) { 00688 TSegment & s = * segments[i]; 00689 s.tracks().remove(t); 00690 } 00691 00692 delete & t; 00693 }
|
|
|
|
01910 { 01911 AList<TMLink> forLine; 01912 const TSegment * s = & segment; 01913 while (1) { 01914 if (s->outerLinks().length() != 1) break; 01915 const TSegment * o = s->outerLinks()[0]; 01916 const HepPoint3D & p = o->position(); 01917 forLine.append(new TMLink(NULL, NULL, p)); 01918 s = o; 01919 } 01920 01921 if (forLine.length() == 0) 01922 return segment.direction(); 01923 else if (forLine.length() < 2) { 01924 HepAListDeleteAll(forLine); 01925 return segment.direction(); 01926 } 01927 01928 //...Make a line in the conformal plane... 01929 TMLine line(forLine); 01930 int err = line.fit(); 01931 if (err) { 01932 #ifdef TRKRECO_DEBUG 01933 std::cout << "direction ... failed due to line fit failure" << std::endl; 01934 #endif 01935 HepAListDeleteAll(forLine); 01936 return segment.direction(); 01937 } 01938 01939 HepAListDeleteAll(forLine); 01940 Vector3 tmp(-1., -(line.a() + line.b())); 01941 tmp.unit(); 01942 return HepVector3D(tmp); 01943 }
|
|
finds tracks.
Implements TFinderBase. |
|
finds tracks.
Implements TFinderBase. 00801 { 00802 #ifdef TRKRECO_DEBUG 00803 _stage = ConformalInitialization; 00804 #endif 00805 00806 static bool first = true; 00807 if (first) { 00808 first = false; 00809 int size; 00810 // _s = (struct summary *) 00811 // BASF_Sharedmem->get_pointer(BASF_Sharedmem->get_id(), 00812 // "TrkConfSum", 00813 // & size); 00814 } 00815 00816 //...For debug... 00817 if (debugLevel()) { 00818 std::cout << name() << " ... processing" 00819 << " axial=" << axial.length() 00820 << ",stereo=" << stereo.length() 00821 << ",tracks=" << tracks.length() 00822 << std::endl; 00823 } 00824 00825 //...Create TMLinks with conformal position... 00826 // TConformalFinder0::conformalTransformation(ORIGIN, axial, _allHits[0]); 00827 // TConformalFinder0::conformalTransformation(ORIGIN, stereo, _allHits[1]); 00828 // for Tsf 00829 TConformalFinder0::conformalTransformationDriftCircle(ORIGIN, axial, _allHits[0]); 00830 TConformalFinder0::conformalTransformationDriftCircle(ORIGIN, stereo, _allHits[1]); 00831 _allHits[2].append(_allHits[0]); 00832 _allHits[2].append(_allHits[1]); 00833 00834 //...Select good hits... 00835 selectGoodHits(); 00836 #ifdef TRKRECO_DEBUG 00837 cout<<"axial Hits:"<<_allHits[0].length()<<" good axial hits:"<<_hits[0].length() 00838 <<endl<<"stereo Hits:"<<_allHits[1].length()<<" good setero hits:"<<_hits[1].length() 00839 <<endl; 00840 #endif 00841 00842 //...Segment finding... 00843 if (_perfectSegmentFinding) 00844 findSegmentsPerfect(); 00845 else 00846 // findSegments(); 00847 findSegmentsTsf(); 00848 00849 #ifdef TRKRECO_DEBUG 00850 cout<<"axial Seg: "<<_allSegments[0][0].length()<<", "<<_allSegments[0][1].length() 00851 <<", "<<_allSegments[0][2].length()<<", "<<_allSegments[0][3].length() 00852 <<", "<<_allSegments[0][4].length()<<", "<<_allSegments[0][5].length() 00853 <<" stereo Seg: "<<_allSegments[1][0].length()<<", "<<_allSegments[1][1].length() 00854 <<", "<<_allSegments[1][2].length()<<", "<<_allSegments[1][3].length() 00855 <<", "<<_allSegments[1][4].length()<<", "<<_allSegments[1][5].length()<<endl; 00856 00857 for(int i=0; i<2; ++i) { 00858 if (i == 0) cout<<"Axial......"<<endl; 00859 else cout<<"Stereo......"<<endl; 00860 for(int j=0; j<6; ++j) { 00861 for(int k=0; k<_allSegments[i][j].length(); ++k){ 00862 cout<<"SL(a/s): "<<j<<" seeds in Seg"<<k<<": "<<_allSegments[i][j][k]->links().length()<<endl; 00863 for(int kk=0; kk<_allSegments[i][j][k]->links().length(); ++kk) 00864 cout<<" layerId: "<<_allSegments[i][j][k]->links()[kk]->hit()->wire()->layerId() 00865 <<" localId: "<<_allSegments[i][j][k]->links()[kk]->hit()->wire()->localId()<<endl; 00866 } 00867 } 00868 } 00869 #endif 00870 00871 //...Fast finding... 00872 unsigned level = 0; 00873 _T0ResetDone = false; 00874 if (_fastFinder) { 00875 linkSegments(level); 00876 fastFinding2D(level); 00877 updateTLinks(_2DTracks); 00878 00879 //...T0 reset here... 00880 if (_doT0Reset) { 00881 std::cout << "TConformalFinder ... T0 reset is done" << std::endl; 00882 _T0ResetDone = true; 00883 return 0; 00884 } 00885 00886 #ifdef TRKRECO_WINDOW 00887 _rphiWindow.skip(false); 00888 #endif 00889 fastFinding3D(level); 00890 updateTLinks(_2DTracks); 00891 updateTLinks(_3DTracks); 00892 00893 #ifdef TRKRECO_WINDOW 00894 _rphiWindow.skip(false); 00895 displayTracks(_2DTracks, _allUnused, "all 2D after fast level 0"); 00896 displayTracks(_3DTracks, _allUnused, "all 3D after fast level 0"); 00897 #endif // TRKRECO_WINDOW 00898 00899 00900 //...Fast finding again... 00901 level = 1; 00902 linkSegments(level); 00903 fastFinding2D(level); 00904 updateTLinks(_2DTracks); 00905 00906 #ifdef TRKRECO_WINDOW 00907 _rphiWindow.skip(false); 00908 #endif 00909 fastFinding3D(level); 00910 updateTLinks(_2DTracks); 00911 updateTLinks(_3DTracks); 00912 00913 #ifdef TRKRECO_WINDOW 00914 _rphiWindow.skip(false); 00915 displayTracks(_2DTracks, _allUnused, "all 2D after fast level 1"); 00916 displayTracks(_3DTracks, _allUnused, "all 3D after fast level 1"); 00917 #endif //TRKRECO_WINDOW 00918 } 00919 00920 //...Slow finding... 00921 if (_slowFinder) { 00922 level = 2; 00923 linkSegments(level); 00924 slowFinding2D(level); 00925 updateTLinks(_2DTracks); 00926 #ifdef TRKRECO_WINDOW 00927 _rphiWindow.skip(false); 00928 // _rphiWindow.skipAllWindow(false); 00929 #endif 00930 fastFinding3D(level); 00931 updateTLinks(_2DTracks); 00932 updateTLinks(_3DTracks); 00933 00934 #ifdef TRKRECO_WINDOW 00935 _rphiWindow.skip(false); 00936 // _rphiWindow.skipAllWindow(false); 00937 displayTracks(_2DTracks, _allUnused, "all 2D after slow level 2"); 00938 displayTracks(_3DTracks, _allUnused, "all 3D after slow level 2"); 00939 #endif //TRKRECO_WINDOW 00940 } 00941 00942 #ifdef TRKRECO_DEBUG 00943 int zsltrk = _2DTracks.length(); 00944 std::cout << name() << " ... # 3D tracks = " << _3DTracks.length() 00945 << ", # 2D tracks = " << _2DTracks.length() << std::endl; 00946 for (unsigned i = 0; i < zsltrk; i++){ 00947 // _2DTracks[i]->dump(); 00948 cout<<"pt:"<<_2DTracks[i]->pt()<<" impact:"<<_2DTracks[i]->impact()<<endl; 00949 // nTrack->fill(0., 1.0); 00950 } 00951 #endif 00952 00953 //...Mask hits with bad chisq... 00954 TTrackManager::maskBadHits(_3DTracks, _maxSigma2); 00955 00956 tracks2D = _2DTracks; 00957 tracks = _3DTracks; 00958 for(int i=0;i<_3DTracks.length();i++){ 00959 _3DTracks[i]->finder(TrackOldConformalFinder); 00960 } 00961 #ifdef TRKRECO_DEBUG 00962 // if (_3DTracks.length() == 0) { 00963 // cout<<"3D failed: 2D length = "<<_2DTracks.length()<<endl; 00964 for(int nn = 0; nn < tracks2D.length(); ++nn){ 00965 cout<<"2D: "<<nn<<" radius: "<<tracks2D[nn]->radius()<<endl; 00966 for (int mm = 0; mm < tracks2D[nn]->links().length(); ++mm) 00967 cout<<"layer: "<<tracks2D[nn]->links()[mm]->wire()->layerId() 00968 <<" local: "<<tracks2D[nn]->links()[mm]->wire()->localId()<<endl; 00969 } 00970 00971 cout<<"unused axial Seg: "<<_allUnused[0][0].length()<<", "<<_allUnused[0][1].length() 00972 <<", "<<_allUnused[0][2].length()<<", "<<_allUnused[0][3].length() 00973 <<", "<<_allUnused[0][4].length()<<", "<<_allUnused[0][5].length() 00974 <<" unused stereo Seg: "<<_allUnused[1][0].length()<<", "<<_allUnused[1][1].length() 00975 <<", "<<_allUnused[1][2].length()<<", "<<_allUnused[1][3].length() 00976 <<", "<<_allUnused[1][4].length()<<", "<<_allUnused[1][5].length() 00977 <<endl; 00978 00979 for(int i=0; i<2; ++i) { 00980 if (i == 0) cout<<"unused axial hits: "<<endl; 00981 else cout<<"unused stereo hits: "<<endl; 00982 for(int k = 0; k < _allHits[i].length(); ++k) { 00983 if (_allHits[i][k]->hit()->state() & WireHitUsed) continue; 00984 else cout<<" layerId: "<<_allHits[i][k]->hit()->wire()->layerId() 00985 <<" localId: "<<_allHits[i][k]->hit()->wire()->localId()<<endl; 00986 } 00987 if (i == 0) cout<<"unused axial link in segs: "<<endl; 00988 else cout<<"unused stereo link in segs: "<<endl; 00989 for(int j=0; j<6; ++j) { 00990 for(int k=0; k<_allUnused[i][j].length(); ++k){ 00991 cout<<"sl: "<<i<<" "<<j<<" length of seg "<<k<<": "<<_allUnused[i][j][k]->links().length()<<endl; 00992 for(int kk=0; kk<_allUnused[i][j][k]->links().length(); ++kk) 00993 cout<<" layerId: "<<_allUnused[i][j][k]->links()[kk]->hit()->wire()->layerId() 00994 <<" localId: "<<_allUnused[i][j][k]->links()[kk]->hit()->wire()->localId()<<endl; 00995 } 00996 } 00997 } 00998 // } 00999 #endif 01000 01001 //...Termination... 01002 /* tracks = _3DTracks; 01003 tracks2D = _2DTracks; 01004 ++_s->_nEvents; 01005 unsigned n3 = _3DTracks.length(); 01006 for (unsigned i = 0; i < n3; i++) 01007 if (_3DTracks[i]->finder() & TrackFastFinder) 01008 ++_s->_nTracksFast3D; 01009 else if (_3DTracks[i]->finder() & TrackSlowFinder) 01010 ++_s->_nTracksSlow3D; 01011 unsigned n2 = _2DTracks.length(); 01012 for (unsigned i = 0; i < n2; i++) 01013 if (_2DTracks[i]->finder() & TrackFastFinder) 01014 ++_s->_nTracksFast2D; 01015 else if (_2DTracks[i]->finder() & TrackSlowFinder) 01016 ++_s->_nTracksSlow2D; 01017 01018 if (debugLevel()) { 01019 std::cout << name() << " ... # 3D tracks = " << _3DTracks.length() 01020 << ", # 2D tracks = " << _2DTracks.length() << std::endl; 01021 } 01022 01023 #ifdef TRKRECO_DEBUG 01024 _stage = ConformalOutside; 01025 #endif 01026 */ 01027 return 0; 01028 }
|
|
sets flag to salvage hits.
Reimplemented in TConformalFinder0, and TConformalFinder0. |
|
sets flag to salvage hits.
Reimplemented in TConformalFinder0, and TConformalFinder0. 00108 {
00109 return a;
00110 }
|
|
sets flag to reconstruct 3D.
Reimplemented in TConformalFinder0, and TConformalFinder0. |
|
sets flag to reconstruct 3D.
Reimplemented in TConformalFinder0, and TConformalFinder0. 00102 {
00103 return a;
00104 }
|
|
sets a flag to do T0 reset in the fast 2D finding.
|
|
sets a flag to do T0 reset in the fast 2D finding.
00267 { 00268 return _doT0Reset = a; 00269 }
|
|
dumps debug information.
Reimplemented from TFinderBase. |
|
dumps debug information.
Reimplemented from TFinderBase. 00117 { 00118 if (msg.find("state") != std::string::npos) { 00119 std::cout << pre; 00120 TFinderBase::dump(msg); 00121 std::cout << pre; 00122 std::cout << "#axial=" << _hits[0].length(); 00123 std::cout << ",#stereo=" << _hits[1].length(); 00124 } 00125 if (msg.find("summary") != std::string::npos || msg.find("detail") != std::string::npos) { 00126 /* struct summary s; 00127 // bzero((char *) & s, sizeof(struct summary)); 00128 memset((char *) & s, 0, sizeof(struct summary)); 00129 for (int i = 0; i < BASF_Sharedmem->nprocess(); i++) { 00130 int size; 00131 struct summary & r = * (struct summary *) 00132 BASF_Sharedmem->get_pointer(i, "TrkConfSum", & size); 00133 s._nEvents += r._nEvents; 00134 s._nTracksFast3D += r._nTracksFast3D; 00135 s._nTracksSlow3D += r._nTracksSlow3D; 00136 s._nTracksFast2D += r._nTracksFast2D; 00137 s._nTracksSlow2D += r._nTracksSlow2D; 00138 s._nTracksFast2DBadQuality += r._nTracksFast2DBadQuality; 00139 s._nTracksSlow2DBadQuality += r._nTracksSlow2DBadQuality; 00140 } 00141 00142 std::cout << pre 00143 << "all events : " << s._nEvents << std::endl; 00144 std::cout << pre 00145 << "fast 3D tracks : " 00146 << s._nTracksFast3D << std::endl; 00147 std::cout << pre 00148 << "fast 2D tracks(line failed) : " 00149 << s._nTracksFast2D << std::endl; 00150 std::cout << pre 00151 << "fast 2D tracks(3D failed) : " 00152 << s._nTracksFast2DBadQuality << std::endl; 00153 std::cout << pre 00154 << "slow 3D tracks : " 00155 << s._nTracksSlow3D << std::endl; 00156 std::cout << pre 00157 << "slow 2D tracks(line failed) : " 00158 << s._nTracksSlow2D << std::endl; 00159 std::cout << pre 00160 << "slow 2D tracks(3D failed) : " 00161 << s._nTracksSlow2DBadQuality << std::endl; 00162 */ 00163 } 00164 }
|
|
|
|
|
|
02388 { 02389 #ifdef TRKRECO_WINDOW 02390 displayStatus("Conf::expand ... seed track"); 02391 _rphiWindow.oneShot(ti, leda_green); 02392 #endif 02393 #ifdef TRKRECO_DEBUG 02394 std::cout << "... expand : by a track" << std::endl; 02395 #endif 02396 02397 TTrack * t = & ti; 02398 AList<TSegment> seeds = t->segments(); 02399 unsigned nSegments = seeds.length(); 02400 unsigned nCores = t->nCores(); 02401 unsigned nTrial = 0; 02402 while (1) { 02403 02404 //...Target superlayer... 02405 unsigned sl = SuperLayer(t->cores()); 02406 unsigned inner; 02407 unsigned outer; 02408 targetSuperLayer(sl, inner, outer); 02409 //cout<<"sl: "<<sl<<" inner: "<<inner<<" outer: "<<outer<<endl; 02410 unsigned target = inner; 02411 if (target == 11) 02412 target = outer; 02413 if (target == 11) 02414 break; 02415 02416 //...Get target segments... 02417 AList<TSegment> segments = targetSegments(* t, target); 02418 if (segments.length() == 0) { 02419 unsigned fl[5] = {2, 3, 4, 9, 10}; 02420 unsigned inner2 = 0; 02421 unsigned outer2 = 5; 02422 for (int i = 0; i < 5; i++) { 02423 if (fl[i] == inner) inner2 = i; 02424 if (fl[i] == outer) outer2 = i; 02425 } 02426 if (inner > 2) target = fl[inner2 - 1]; 02427 if (target == 9) { 02428 target = fl[outer2 + 1]; 02429 } 02430 if (target == 13) break; 02431 segments = targetSegments(* t, target); 02432 } 02433 #ifdef TRKRECO_DEBUG 02434 std::cout << "... expand : segments to be checked = "; 02435 std::cout << segments.length() << std::endl; 02436 #endif 02437 #ifdef TRKRECO_WINDOW 02438 displayStatus("Conf::expand ... candidate segments"); 02439 _rphiWindow.append(segments, leda_blue); 02440 _rphiWindow.oneShot(* t, leda_green); 02441 #endif 02442 02443 //...Create candidate tracks... 02444 unsigned n = segments.length(); 02445 AList<TTrack> tracks; 02446 for (unsigned i = 0; i < n; i++) { 02447 segments[i]->solveLR(); 02448 AList<TSegment> seed0 = seeds; 02449 seed0.append(segments[i]); 02450 TTrack * t0 = _builder.buildRphi(seed0); 02451 if (! t0) continue; 02452 if ((t0->segments().length() <= nSegments) || 02453 (t0->nCores() <= nCores) || 02454 (SuperLayer(t0->cores()) <= sl)) { 02455 deleteTrack(* t0); 02456 continue; 02457 #ifdef TRKRECO_DEBUG 02458 std::cout << "... expand : candidate deleted" << std::endl; 02459 #endif 02460 } 02461 tracks.append(t0); 02462 } 02463 02464 #ifdef TRKRECO_DEBUG 02465 std::cout << "... expand : target superlayer = " << target; 02466 std::cout << ", # of track candidates = " << tracks.length() 02467 << std::endl; 02468 #endif 02469 02470 //...Expand by links... 02471 if (tracks.length() == 0) { 02472 AList<TMLink> links = targetLinks(* t, target); 02473 _builder.salvage(* t, links); 02474 unsigned newSl = SuperLayer(t->cores()); 02475 if (newSl & (1 << (target))) { 02476 #ifdef TRKRECO_DEBUG 02477 std::cout << "... expand : links to be appended = "; 02478 std::cout << links.length() << std::endl; 02479 #endif 02480 #ifdef TRKRECO_WINDOW 02481 displayStatus("Conf::expand ... candidate links"); 02482 _rphiWindow.append(links, leda_blue); 02483 _rphiWindow.oneShot(* t, leda_green); 02484 #endif 02485 TTrack * t0 = new TTrack(* t); 02486 if (! t0) break; 02487 if ((t0->nCores() <= nCores) || 02488 (SuperLayer(t0->cores()) <= sl)) { 02489 deleteTrack(* t0); 02490 break; 02491 #ifdef TRKRECO_DEBUG 02492 std::cout << "... expand : candidate deleted" << std::endl; 02493 #endif 02494 } 02495 tracks.append(t0); 02496 } 02497 else 02498 break; 02499 } 02500 02501 #ifdef TRKRECO_DEBUG 02502 std::cout << "... expand : # of track candidates = " << tracks.length() 02503 << std::endl; 02504 #endif 02505 02506 //...Select best... 02507 unsigned nTracks = tracks.length(); 02508 if (nTracks == 0) break; 02509 TTrack * tNew = tracks[0]; 02510 unsigned nBestCores = tNew->nCores(); 02511 for (unsigned i = 1; i < nTracks; i++) { 02512 if (tracks[i]->nCores() > nBestCores) { 02513 deleteTrack(* tNew); 02514 tNew = tracks[i]; 02515 nBestCores = tNew->nCores(); 02516 } 02517 else { 02518 deleteTrack(* tracks[i]); 02519 } 02520 } 02521 nSegments = tNew->segments().length(); 02522 nCores = nBestCores; 02523 seeds = tNew->segments(); 02524 02525 //...Quality check... 02526 if (! trackQuality(* tNew)) { 02527 deleteTrack(* tNew); 02528 break; 02529 } 02530 deleteTrack(* t); 02531 t = tNew; 02532 } 02533 02534 #ifdef TRKRECO_DEBUG 02535 if (t == & ti) std::cout << "... expand : failed" << std::endl; 02536 else std::cout << "... expand : track expanded" << std::endl; 02537 #endif 02538 #ifdef TRKRECO_WINDOW 02539 displayStatus("Conf::expand ... finished"); 02540 _rphiWindow.oneShot(* t, leda_green); 02541 #endif 02542 02543 return t; 02544 }
|
|
02358 { 02359 #ifdef TRKRECO_WINDOW 02360 displayStatus("Conf::expand ... seeds"); 02361 _rphiWindow.oneShot(seeds, leda_green); 02362 #endif 02363 #ifdef TRKRECO_DEBUG 02364 std::cout << "... expand : # of seeds = " << seeds.length() << std::endl; 02365 #endif 02366 TTrack * t = NULL; 02367 if (seeds.length() > 2) { 02368 TTrack * t = _builder.buildRphi(seeds); 02369 if (t) { 02370 if (! trackQuality(* t)) { 02371 deleteTrack(* t); 02372 t = NULL; 02373 } 02374 } 02375 } 02376 if (t == NULL) { 02377 AList<TMLink> links = Links(seeds); 02378 TCircle c(links); 02379 c.fit(); 02380 t = new TTrack(c); 02381 t->fit(); 02382 t->segments().append(seeds); 02383 } 02384 return expand(* t); 02385 }
|
|
fast findings. level:0/1:selection of segments to be used
|
|
fast findings. level:0/1:selection of segments to be used
01337 { 01338 01339 #ifdef TRKRECO_DEBUG_DETAIL 01340 std::cout << "... fast finding (2D) : level = " << level << std::endl; 01341 #endif 01342 #ifdef TRKRECO_DEBUG 01343 _stage = ConformalFast2DLevel0; 01344 if (level == 1) 01345 _stage = ConformalFast2DLevel1; 01346 #endif 01347 01348 AList<TSegment> * segments = & _allUnused[0][0]; 01349 01350 unsigned idBase = _2DTracks.length() + _3DTracks.length(); 01351 unsigned nTrial = 0; 01352 unsigned seedLayer = 5; 01353 //yuany 01354 /* cout<<"before loop "<<endl; 01355 for (unsigned i = 0; i < 5; i++) { 01356 for(unsigned j=0;j<_allUnused[0][i].length();j++){ 01357 (_allUnused[0][i])[j]->dump("hits"); 01358 (_allUnused[0][i])[j]->dump("link"); 01359 } 01360 }*/ 01361 01362 // while ((seedLayer--) > 2) { 2006/04/27 01363 while ((seedLayer--) > 1) { 01364 01365 //...Seed loop... 01366 AList<TTrack> trackCandidates; 01367 unsigned n = segments[seedLayer].length(); 01368 01369 for (unsigned i = 0; i < n; i++) { 01370 TSegment & seed = * segments[seedLayer][i]; 01371 std::string name = "f" + itostring(nTrial + idBase); 01372 //yuany 01373 //seed.dump("hits"); 01374 //seed.dump("link"); 01375 #ifdef TRKRECO_DEBUG 01376 std::cout << ">>> fast 2D : super layer " << seedLayer << ", "; 01377 std::cout << i << " : "; 01378 seed.dump("link"); 01379 #endif 01380 01381 //...Check uniqueness... 01382 AList<TSegment> seeds; 01383 //cout<<"NUiqueLinks:"<<NUniqueLinks(seed)<<"; NMajorLinks:"<<NMajorLinks(seed)<<endl; 01384 //cout<<"innerLinks size:"<<seed.innerLinks().length()<<endl; 01385 if (NUniqueLinks(seed) > 0) { 01386 seeds = UniqueLinks(seed); 01387 } 01388 else if (NMajorLinks(seed) > 0) { 01389 seeds = MajorLinks(seed); 01390 } 01391 else { 01392 continue; 01393 } 01394 seeds.append(seed); 01395 01396 #ifdef TRKRECO_DEBUG 01397 cout<<"seeds in fastFinding2D: "<<seeds.length()<<endl; 01398 for (int kk = 0; kk < seeds.length(); ++kk) 01399 cout<<"LayerId: "<<seeds[kk]->links()[0]->wire()->layerId() 01400 <<" LocalId: "<<seeds[kk]->links()[0]->wire()->localId()<<endl; 01401 #endif 01402 01403 //...Refine... 01404 refine: 01405 01406 //solve LR of seeds; 01407 for (int k = 0; k < seeds.length(); ++k) //tsf 01408 seeds[k]->solveLR(); 01409 01410 #ifdef TRKRECO_WINDOW 01411 displayStatus("Conf::fast2D ... seed segments"); 01412 _rphiWindow.oneShot(seeds, leda_green); 01413 #endif 01414 01415 //...Try to build a track... 01416 #ifdef TRKRECO_DEBUG 01417 std::cout << "==> fast building 2D : seed layer = " << seedLayer; 01418 std::cout << ", " << name << std::endl; 01419 #endif 01420 01421 TTrack * t = _builder.buildRphi(seeds); 01422 ++nTrial; 01423 //cout<<"buildRphi done."<<endl; 01424 01425 //...Track check... 01426 if (! t) continue; 01427 t->name(name); 01428 bool ok = quality2D(* t, 0); 01429 //cout<<"track quality " <<ok<<endl; 01430 if (! ok) { 01431 deleteTrack(* t); 01432 continue; 01433 } 01434 //cout<<"length of seg in 2d build = "<<t->segments().length()<<" cores in 2d = "<<t->nCores()<<endl; 01435 01436 //...Bad segment rejection... 01437 AList<TSegment> bads = removeBadSegments(* t); 01438 //cout<<"test point no0; bad segment length: "<<bads.length()<<endl; 01439 01440 // This was taken out because the goto loop continues forever for some noise events. 2005/10/14 01441 if (bads.length()) { 01442 ok = quality2D(* t, 1); 01443 if (! ok) { 01444 seeds = refineSegments(* t); 01445 if (seeds.length() >= _minNSegments) { 01446 deleteTrack(* t); 01447 goto refine; 01448 } 01449 deleteTrack(* t); 01450 continue; 01451 } 01452 } 01453 01454 //...Salvage by segments... 01455 salvage(* t, 1, bads); 01456 //cout <<"test point no1"<<endl; 01457 //refineLinks(* t, 3); //change the MinN from 3 to 2, zangshilei 20060307 01458 refineLinks(* t, 2); 01459 //cout<<"test point no1.5"<<endl; 01460 01461 //change the level from 2 to 0, 20060428; because the program stops(MCv5.1.0/run10237.dat) 01462 //release by Liuqg 01463 ok = quality2D(* t, 2); 01464 if (! ok) { 01465 deleteTrack(* t); 01466 continue; 01467 } 01468 //cout<<"test point no2"<<endl; 01469 01470 //...Append segments... 01471 if (NSuperLayers(t->links()) < 5) { 01472 t = expand(* t); 01473 } 01474 //cout<<"test point no3"<<endl; 01475 01476 //t->dump("detail", " "); 01477 #ifdef TRKRECO_DEBUG 01478 std::cout << "... 2D finished : " << t->name() << std::endl; 01479 t->dump("hits sort flag pull", " "); 01480 #endif 01481 #ifdef TRKRECO_WINDOW 01482 displayStatus("Conf::fast2D ... finished"); 01483 _rphiWindow.oneShot(* t, leda_green); 01484 #endif 01485 t->finder(TrackFastFinder); 01486 t->quality(TrackQuality2D); 01487 t->fitting(TrackFitGlobal); 01488 trackCandidates.append(t); 01489 } 01490 01491 //...Resolve multi-track candidates... 01492 resolveSegments(trackCandidates); 01493 01494 //...Remove used segments... 01495 //yuany 01496 /* cout<<"before remove "<<endl; 01497 for (unsigned i = 0; i < 5; i++) { 01498 for(unsigned j=0;j<_allUnused[0][i].length();j++){ 01499 (_allUnused[0][i])[j]->dump("hits"); 01500 (_allUnused[0][i])[j]->dump("link"); 01501 } 01502 } 01503 */ 01504 removeUsedSegments(trackCandidates); 01505 //yuany 01506 // cout<<"after remove "<<endl; 01507 /* for (unsigned i = 0; i < 5; i++) { 01508 for(unsigned j=0;j<_allUnused[0][i].length();j++){ 01509 (_allUnused[0][i])[j]->dump("hits"); 01510 (_allUnused[0][i])[j]->dump("link"); 01511 } 01512 } 01513 */ 01514 _2DTracks.append(trackCandidates); 01515 } 01516 01517 resolveHits(_2DTracks); 01518 }
|
|
|
|
01031 { 01032 01033 #ifdef TRKRECO_DEBUG_DETAIL 01034 std::cout << "... fast finding (3D) : level = " << level << std::endl; 01035 #endif 01036 #ifdef TRKRECO_DEBUG 01037 if (_stage == ConformalSlow2D) { 01038 _stage = ConformalSlow3D; 01039 } 01040 else { 01041 _stage = ConformalFast3DLevel0; 01042 if (level == 1) 01043 _stage = ConformalFast3DLevel1; 01044 } 01045 #endif 01046 01047 AList<TTrack> tracks3D; 01048 AList<TTrack> touched; 01049 AList<TSegment> bads; 01050 unsigned n = _2DTracks.length(); 01051 for (unsigned i = 0; i < n; i++) { 01052 01053 const TTrack & t = * _2DTracks[i]; 01054 01055 #ifdef TRKRECO_DEBUG 01056 cout<<"links in 2Dtracks: "<<t.links().length()<<endl; 01057 for (int ii = 0; ii < t.links().length(); ++ii) { 01058 cout<<"layerId: "<<t.links()[ii]->wire()->layerId() 01059 <<" localId: "<<t.links()[ii]->wire()->localId()<<endl; 01060 } 01061 cout<<"center: "<<t.center()<<" radius = "<<t.radius()<<endl; 01062 #endif 01063 01064 #ifdef TRKRECO_DEBUG_DETAIL 01065 std::cout << "==> fast 3D building : " << t.name() << std::endl; 01066 t.dump("hits sort flag", " 2D track hits="); 01067 #endif 01068 AList<TSegment> segments = stereoSegments(t); 01069 //jialk 01070 unsigned NS = segments.length(); 01071 if ( NS >= 30 ) continue; 01072 01073 //yuany 01074 //cout<<"stereo segments:"<<segments.length()<<endl; 01075 //unsigned n = segments.length(); 01076 //for (unsigned i = 0; i < n; i++) { 01077 //segments[i]->dump("hits"); 01078 //} 01079 01080 AList<TSegment> badSegments; 01081 if (_stereoMode == 2) 01082 badSegments = stereoSegmentsFromBadHits(t); 01083 //yuany 01084 //cout<<"bad stereo segments:"<<endl; 01085 //n = badSegments.length(); 01086 //for (unsigned i = 0; i < n; i++) { 01087 //badSegments[i]->dump("hits"); 01088 //} 01089 01090 #ifdef TRKRECO_WINDOW 01091 displayStatus("Conf::fast3D ... seed"); 01092 _rphiWindow.append(segments, leda_blue); 01093 _rphiWindow.append(badSegments, leda_red); 01094 _rphiWindow.oneShot(t, leda_green); 01095 #endif 01096 01097 //cout<<"stereo mode: "<<_stereoMode<<endl; 01098 01099 //...Save a 2D track... 01100 TTrack * s = NULL; 01101 if (_stereoMode) 01102 s = _builder.buildStereoNew(t, segments, badSegments); 01103 else 01104 s = _builder.buildStereo(t, segments); 01105 HepAListDeleteAll(badSegments); 01106 //cout<<"after 3D build..."<<endl; 01107 if (! s) { 01108 #ifdef TRKRECO_DEBUG_DETAIL 01109 std::cout << "... 3D failure" << std::endl; 01110 #endif 01111 #ifdef TRKRECO_WINDOW 01112 displayStatus("Conf::fastd3D ... 3D failed"); 01113 _rphiWindow.append(segments, leda_blue); 01114 _rphiWindow.oneShot(t, leda_red); 01115 #endif 01116 continue; 01117 } 01118 //...Quality check... 01119 if (! TTrackManager::goodTrack(* s)) { 01120 #ifdef TRKRECO_DEBUG_DETAIL 01121 std::cout << "... 3D failure (bad quality)" << std::endl; 01122 #endif 01123 #ifdef TRKRECO_WINDOW 01124 displayStatus("Conf::fastd3D ... 3D failed (bad quality)"); 01125 _rphiWindow.append(segments, leda_blue); 01126 _rphiWindow.oneShot(* s, leda_red); 01127 #endif 01128 // Remove following sentences because _s is NULL now 01129 // and it's wrong to use the pointer for some noise events... 05/10/15 zangsl 01130 // 01131 // if (s->finder() & TrackFastFinder) 01132 // ++_s->_nTracksFast2DBadQuality; 01133 // else if (s->finder() & TrackSlowFinder) 01134 // ++_s->_nTracksSlow2DBadQuality; 01135 01136 deleteTrack(* s); 01137 continue; 01138 } 01139 01140 //...New name... 01141 s->name(t.name() + "-3D"); 01142 01143 #ifdef TRKRECO_WINDOW 01144 displayStatus("Conf::fastd3D ... 3D ok"); 01145 _rphiWindow.append(segments, leda_blue); 01146 _rphiWindow.oneShot(* s, leda_green); 01147 #endif 01148 01149 //...Salvage by segments... 01150 salvage(* s, 3, bads); 01151 //cout<<"3D finder done!"<<endl; 01152 tracks3D.append(s); 01153 touched.append(_2DTracks[i]); 01154 01155 s->assign(WireHitConformalFinder); 01156 s->quality(0); 01157 01158 //...Segment... 01159 static AList<TTrack> tmp; 01160 tmp.removeAll(); 01161 tmp.append(s); 01162 removeUsedSegments(tmp); 01163 // liucy :add constraint of number of tracks 01164 if(tracks3D.length()>20)break; 01165 #ifdef TRKRECO_DEBUG_DETAIL 01166 std::cout << "... 3D finished : " << s->name() << std::endl; 01167 s->dump("detail", " "); 01168 #endif 01169 #ifdef TRKRECO_WINDOW 01170 displayStatus("Conf::fastd3D ... finished"); 01171 _rphiWindow.oneShot(* s, leda_green); 01172 #endif 01173 } 01174 01175 // resolveSegments(tracks3D); 01176 _3DTracks.append(tracks3D); 01177 _2DTracks.remove(tracks3D); 01178 _2DTracks.remove(touched); 01179 for (unsigned i = 0; i < touched.length(); i++) { 01180 deleteTrack(* touched[i]); 01181 // saved[i]->fit(); 01182 } 01183 }
|
|
finds segments from _goodHits.
|
|
finds segments from _goodHits.
00218 { 00219 00220 //...Create lists of links for each super layer... 00221 AList<TMLink> links[11]; 00222 unsigned n = _hits[2].length(); 00223 for (unsigned i = 0; i < n; i++) { 00224 TMLink & l = * _hits[2][i]; 00225 links[l.wire()->superLayerId()].append(l); 00226 } 00227 00228 //...Create phi hists... 00229 THistogram * hist[11]; 00230 /* hist[0] = new THistogram(64); 00231 hist[1] = new THistogram(80); 00232 hist[2] = new THistogram(96); 00233 hist[3] = new THistogram(128); 00234 hist[4] = new THistogram(144); 00235 hist[5] = new THistogram(160); 00236 hist[6] = new THistogram(176); 00237 hist[7] = new THistogram(208); 00238 hist[8] = new THistogram(240); 00239 hist[9] = new THistogram(256); 00240 hist[10] = new THistogram(288); 00241 */ 00242 hist[0] = new THistogram(56); 00243 hist[1] = new THistogram(80); 00244 hist[2] = new THistogram(88); 00245 hist[3] = new THistogram(112); 00246 hist[4] = new THistogram(140); 00247 hist[5] = new THistogram(160); 00248 hist[6] = new THistogram(176); 00249 hist[7] = new THistogram(208); 00250 hist[8] = new THistogram(240); 00251 hist[9] = new THistogram(256); 00252 hist[10] = new THistogram(288); 00253 00254 for (unsigned i = 0; i < 11; i++) { 00255 // unsigned superLayerId = i / 2; 00256 // unsigned id = i % 2; 00257 unsigned superLayerId; 00258 unsigned id; 00259 switch(i){ 00260 case 0: superLayerId = 0; id = 1; break; 00261 case 1: superLayerId = 1; id = 1; break; 00262 case 2: superLayerId = 0; id = 0; break; 00263 case 3: superLayerId = 1; id = 0; break; 00264 case 4: superLayerId = 2; id = 0; break; 00265 case 5: superLayerId = 2; id = 1; break; 00266 case 6: superLayerId = 3; id = 1; break; 00267 case 7: superLayerId = 4; id = 1; break; 00268 case 8: superLayerId = 5; id = 1; break; 00269 case 9: superLayerId = 3; id = 0; break; 00270 case 10: superLayerId = 4; id = 0; break; 00271 default: break; 00272 } 00273 // hist[i]->fillX(links[i]); 00274 hist[i]->fillPhi(links[i]); 00275 00276 //...Segment finding... 00277 AList<TSegment> tmp = hist[i]->segments(); 00278 00279 //...Remove bad segments... 00280 unsigned n = tmp.length(); 00281 if (id == 0) { 00282 AList<TSegment> bad; 00283 for (unsigned j = 0; j < n; j++) { 00284 TSegment * s = tmp[j]; 00285 if (s->links().length() < _minNLinksForSegment) 00286 bad.append(s); 00287 else if (s->links().length() > _maxNLinksForSegment) 00288 bad.append(s); 00289 // else if (Width(s->links()) > _maxWidthForSegment) 00290 // bad.append(s); 00291 } 00292 tmp.remove(bad); 00293 for (unsigned j = 0; j < bad.length(); j++) { 00294 _unused[id].append(bad[j]->links()); 00295 _unused[2].append(bad[j]->links()); 00296 } 00297 HepAListDeleteAll(bad); 00298 n = tmp.length(); 00299 } 00300 00301 //...Classify segments... 00302 // if (n > 1) { 00303 // for (unsigned k = 0; k < (n - 1); k++) { 00304 // TSegment & s0 = * tmp[k]; 00305 // bool ok = true; 00306 // for (unsigned l = k + 1; l < n; l++) { 00307 // TSegment & s1 = * tmp[l]; 00308 // int distance = 00309 // abs(InnerMost(s0.links())->wire()->localIdDifference( 00310 // * InnerMost(s1.links())->wire())); 00311 // if (distance < _segmentSeparation) { 00312 // s0.state(s0.state() | TSegmentCrowd); 00313 // s1.state(s1.state() | TSegmentCrowd); 00314 // } 00315 // } 00316 // } 00317 // } 00318 00319 //...Store them... 00320 _allSegments[id][superLayerId].append(tmp); 00321 _allUnused[id][superLayerId] = _allSegments[id][superLayerId]; 00322 delete hist[i]; 00323 } 00324 00325 #ifdef TRKRECO_DEBUG_DETAIL 00326 std::cout << "... segment finding finished" << std::endl; 00327 #endif 00328 }
|
|
|
|
02859 { 02860 02861 //...Create lists of links for each super layer... 02862 AList<TMLink> links[11]; 02863 unsigned nHits = _hits[2].length(); 02864 for (unsigned i = 0; i < nHits; i++) { 02865 TMLink & l = * _hits[2][i]; 02866 links[l.wire()->superLayerId()].append(l); 02867 } 02868 02869 //...MC tracks... 02870 const unsigned nHep = TTrackHEP::list().length(); 02871 02872 //...Loop over each super layer... 02873 for (unsigned i = 0; i < 11; i++) { 02874 unsigned superLayerId = i / 2; 02875 unsigned id = i % 2; 02876 02877 //...Counters... 02878 AList<TMLink> ** seeds = 02879 (AList<TMLink> **) malloc(nHep * sizeof(AList<TMLink> *)); 02880 for (unsigned j = 0; j < nHep; j++) 02881 seeds[j] = NULL; 02882 02883 //...Hit loop... 02884 unsigned n = links[i].length(); 02885 for (unsigned j = 0; j < n; j++) { 02886 TMLink & l = * links[i][j]; 02887 const TMDCWireHitMC * mc = l.hit()->mc(); 02888 if (! l.hit()->mc()) { 02889 std::cout << "TConformalFinder::findSegmentsPerfect !!! " 02890 << "no MC info. found ... aborted" << std::endl; 02891 return; 02892 } 02893 const unsigned id = mc->hep()->id(); 02894 02895 if (! seeds[id]) 02896 seeds[id] = new AList<TMLink>(); 02897 seeds[id]->append(l); 02898 } 02899 02900 //...Create segments... 02901 AList<TSegment> segments; 02902 for (unsigned j = 0; j < nHep; j++) { 02903 if (! seeds[j]) continue; 02904 02905 const unsigned length = seeds[j]->length(); 02906 if (length < _minNLinksForSegment) continue; 02907 if (length > _maxNLinksForSegment) continue; 02908 if (Width(* seeds[j]) > _maxWidthForSegment) continue; 02909 02910 TSegment & s = * new TSegment(); 02911 s.append(* seeds[j]); 02912 segments.append(s); 02913 } 02914 _allSegments[id][superLayerId].append(segments); 02915 _allUnused[id][superLayerId] = _allSegments[id][superLayerId]; 02916 02917 //...Clear... 02918 for (unsigned j = 0; j < nHep; j++) { 02919 if (seeds[j]) 02920 delete seeds[j]; 02921 } 02922 free(seeds); 02923 } 02924 02925 #ifdef TRKRECO_DEBUG_DETAIL 02926 std::cout << "... segment finding(perfect) finished" << std::endl; 02927 #endif 02928 }
|
|
finds segments from all hits.
|
|
finds segments from all hits.
02931 { 02932 //...Create lists of links for each super layer... 02933 AList<TMLink> links[11]; 02934 unsigned n = _hits[2].length(); 02935 for (unsigned i = 0; i < n; i++) { 02936 TMLink & l = * _hits[2][i]; 02937 links[l.wire()->superLayerId()].append(l); 02938 } 02939 02940 //find Segments by tsf 02941 TMDCTsf * tsf[11]; 02942 02943 //initial 02944 for (unsigned i = 0; i < 11; ++i) 02945 tsf[i] = new TMDCTsf(i); 02946 02947 for (unsigned i = 0; i < 11; i++) { 02948 unsigned superLayerId; 02949 unsigned id; 02950 switch(i){ 02951 case 0: superLayerId = 0; id = 1; break; 02952 case 1: superLayerId = 1; id = 1; break; 02953 case 2: superLayerId = 0; id = 0; break; 02954 case 3: superLayerId = 1; id = 0; break; 02955 case 4: superLayerId = 2; id = 0; break; 02956 case 5: superLayerId = 2; id = 1; break; 02957 case 6: superLayerId = 3; id = 1; break; 02958 case 7: superLayerId = 4; id = 1; break; 02959 case 8: superLayerId = 5; id = 1; break; 02960 case 9: superLayerId = 3; id = 0; break; 02961 case 10: superLayerId = 4; id = 0; break; 02962 default: break; 02963 } 02964 //find segments 02965 AList<TSegment> tmp = tsf[i]->segments(links[i]); 02966 02967 //...Store them... 02968 _allSegments[id][superLayerId].append(tmp); 02969 _allUnused[id][superLayerId] = _allSegments[id][superLayerId]; 02970 delete tsf[i]; 02971 02972 //...remove used in seg... 02973 // for (int j = 0; j < _allUnused[id][superLayerId].length(); ++j){ 02974 // AList<TMLink> used = _allUnused[id][superLayerId][j]->links(); 02975 // _unused[id].remove(used); 02976 // _unused[2].remove(used); 02977 // } 02978 } 02979 }
|
|
|
|
00617 { 00618 00619 #ifdef TRKRECO_DEBUG 00620 std::cout << " link : base = " << std::endl; 00621 base.dump("vector hits mc sort", "-> "); 00622 std::cout << " p=" << p << ", v=" << v.unit() << std::endl; 00623 #endif 00624 00625 //...Parameters... 00626 //static const float maxDistance = 0.02; 00627 //static const float minDirAngle = 0.97; 00628 00629 //...Candidate loop... 00630 unsigned n = candidates.length(); 00631 float maxAngle = -999.; 00632 float minDistance = _linkMaxDistance[level]; 00633 float maxDirAngle = _linkMinDirAngle[level]; 00634 00635 TSegment * best = NULL; 00636 for (unsigned j = 0; j < n; j++) { 00637 TSegment & current = * candidates[j]; 00638 00639 #ifdef TRKRECO_DEBUG_DETAIL 00640 current.dump("vector hits mc sort", " "); 00641 std::cout << " dist,dirAngle,angle=" << current.distance(p, v); 00642 std::cout << "," << ((current.position() - p).unit()).dot(v.unit()); 00643 std::cout << "," << v.dot(current.direction()) << std::endl; 00644 #endif 00645 float distance = current.distance(p, v); 00646 //cout<<"current, Layer: "<<current.links()[0]->hit()->wire()->layerId() 00647 // <<" local: "<<current.links()[0]->hit()->wire()->localId()<<endl; 00648 //cout<<" distance of segs = "<<distance<<" limit = "<<_linkMaxDistance[level]<<endl; 00649 if (distance > _linkMaxDistance[level]) continue; 00650 00651 HepVector3D dir = (current.position() - p); 00652 if (dir.x() > M_PI) dir.setX(dir.x() - PI2); 00653 else if (dir.x() < - M_PI) dir.setX(PI2 + dir.x()); 00654 00655 float dirAngle = dir.unit().dot(v.unit()); 00656 //cout<<" dirAngle of segs = "<<dirAngle<<" limit = "<<_linkMinDirAngle[level]<<endl; 00657 if (dirAngle < _linkMinDirAngle[level]) continue; //tmp for tsf 00658 00659 // if (distance < minDistance) { 00660 // minDistance = distance; 00661 // best = & current; 00662 // } 00663 if (dirAngle > maxDirAngle) { 00664 maxDirAngle = dirAngle; 00665 best = & current; 00666 } 00667 alternatives.append(current); 00668 } 00669 00670 #ifdef TRKRECO_DEBUG 00671 std::cout << " # of best + alternatives = " << alternatives.length() << std::endl; 00672 if (best) { 00673 std::cout << " Best is "; 00674 best->dump("hits"); 00675 } 00676 #endif 00677 00678 alternatives.remove(best); 00679 if (best) return best; 00680 return NULL; 00681 }
|
|
links segments.
|
|
links segments.
00331 { 00332 //...Clear old links... 00333 unsigned superLayer = 5; 00334 while (--superLayer) { 00335 AList<TSegment> & segments = _allUnused[0][superLayer]; 00336 unsigned n = segments.length(); 00337 //cout<<"SL: "<<superLayer<<"; segments.length:"<<n<<endl; 00338 for (unsigned i = 0; i < n; i++) { 00339 TSegment & base = * segments[i]; 00340 #ifdef TRKRECO_DEBUG 00341 if (base.tracks().length()) { 00342 std::cout << "TConformalFinder::linkSegments !!! segment has "; 00343 std::cout << "an assignment to track(s)" << std::endl; 00344 } 00345 #endif 00346 base.innerLinks().removeAll(); 00347 base.outerLinks().removeAll(); 00348 } 00349 } 00350 00351 //...Super layer loop... 00352 superLayer = 5; 00353 while (--superLayer) { 00354 AList<TSegment> & segments = _allUnused[0][superLayer]; 00355 AList<TSegment> & targets = _allUnused[0][superLayer - 1]; 00356 AList<TSegment> & targets2 = _allUnused[0][superLayer - 2]; 00357 unsigned n = segments.length(); 00358 for (unsigned i = 0; i < n; i++) { 00359 TSegment & base = * segments[i]; 00360 #ifdef TRKRECO_DEBUG 00361 if (base.tracks().length()) { 00362 std::cout << "TConformalFinder::linkSegments !!! segment has "; 00363 std::cout << "an assignment to track(s)" << std::endl; 00364 } 00365 #endif 00366 00367 const HepPoint3D & p = base.position(); 00368 HepVector3D v = base.direction(); 00369 // std::cout<<"superlayer "<<superLayer<<" link length "<<base.outerLinks().length()<<std::endl; 00370 if (base.outerLinks().length() == 1) 00371 v = p - OuterMostUniqueLink(base)->position(); 00372 // if (base.outerLinks().length() == 1) 00373 // v = p - base.outerLinks()[0]->position(); 00374 // if (base.outerLinks().length() == 1) 00375 // v = direction(base); 00376 00377 AList<TSegment> & candidates = base.innerLinks(); 00378 TSegment * best = link(base, p, v, targets, candidates, level); 00379 if ((best == NULL) && (level > 0) && (superLayer > 1)) { 00380 best = link(base, p, v, targets2, candidates, level); 00381 } 00382 if (best) candidates.insert(best); 00383 // base.dump("hits"); 00384 // if(best)best->dump("hits"); 00385 00386 unsigned m = candidates.length(); 00387 for (unsigned j = 0; j < m; j++) 00388 candidates[j]->outerLinks().append(base); 00389 } 00390 } 00391 00392 //check innerLinks. Liuqg 00393 /* superLayer = 5; 00394 while(--superLayer){ 00395 //cout<<"SuperLayer: "<<superLayer<<endl; 00396 AList<TSegment> & segments = _allUnused[0][superLayer]; 00397 unsigned n = segments.length(); 00398 for (unsigned k = 0; k < n; k++) { 00399 TSegment & base = * segments[k]; 00400 int inners = base.innerLinks().length(); 00401 if (inners<2) continue; 00402 AList<TSegment> badList; 00403 for(int i = 0; i < inners; ++i){ 00404 for(int j = i+1; j < inners; ++j){ 00405 AList<TMLink> links = base.innerLinks()[j]->links(); 00406 AList<TMLink> multiLinks; 00407 for (int k = 0; k < links.length(); ++k){ 00408 TMLink & l = * links[k]; 00409 if (base.innerLinks()[i]->links().hasMember(l)) multiLinks.append(l); 00410 } 00411 if (multiLinks.length() < 2) continue; 00412 int nHits[4]; 00413 int multiLayers = 0; 00414 for (int k = 0; k < multiLinks.length(); ++k) 00415 ++nHits[multiLinks[k]->hit()->wire()->localLayerId()]; 00416 for (int k = 0; k < 4; ++k) 00417 if (nHits[k] > 0) ++multiLayers; 00418 if(multiLayers >= 2 && (links.length() > base.innerLinks()[i]->links().length())) 00419 badList.append(base.innerLinks()[i]); 00420 else if (multiLayers >= 2) badList.append( base.innerLinks()[j]); 00421 else continue; 00422 } 00423 } 00424 base.innerLinks().remove(badList); 00425 } 00426 }*/ 00427 00428 #ifdef TRKRECO_DEBUG 00429 superLayer = 5; 00430 while(--superLayer){ 00431 cout<<"SuperLayer: "<<superLayer<<endl; 00432 AList<TSegment> & segments = _allUnused[0][superLayer]; 00433 unsigned n = segments.length(); 00434 for (unsigned i = 0; i < n; i++) { 00435 TSegment & base = * segments[i]; 00436 cout<<"Layer: "<<base.links()[0]->hit()->wire()->layerId() 00437 <<" Local: "<<base.links()[0]->hit()->wire()->localId() 00438 <<" innerSeg: "<<base.innerLinks().length()<<endl; 00439 } 00440 } 00441 #endif 00442 00443 #ifdef TRKRECO_WINDOW 00444 // _rphiWindow.skipAllWindow(false); 00445 displayStatus("Conf::linkSegments ... results"); 00446 _rphiWindow.wait(); 00447 #endif 00448 }
|
|
|
|
|
|
returns name.
Implements TFinderBase. |
|
returns name.
Implements TFinderBase. 00261 { 00262 return "Conformal Finder"; 00263 }
|
|
|
|
02242 { 02243 02244 static const TPoint2D O(0., 0.); 02245 AList<TMLink> outList; 02246 02247 unsigned nBad = _unused[2].length(); 02248 for (unsigned i = 0; i < nBad; i++) { 02249 unsigned sl = _unused[2][i]->wire()->superLayerId(); 02250 unsigned as = 1; 02251 if (_unused[2][i]->wire()->axial()) as = 0; 02252 if (as == 0) { 02253 if (! (axialStereoSwitch & 1)) continue; 02254 } 02255 else { 02256 if (! (axialStereoSwitch & 2)) continue; 02257 } 02258 02259 float a = WIDTH[sl] * loadWidth; 02260 float phi0 = x[sl].phi(); 02261 float phi1 = x[sl + 1].phi(); 02262 float phi = _unused[2][i]->position().phi(); 02263 if (phi < 0.) phi += PI2; 02264 if (phi1 < phi0) { 02265 phi1 = phi0; 02266 phi0 = x[sl + 1].phi(); 02267 } 02268 float dPhi = phi1 - phi0; 02269 if (dPhi < M_PI) { 02270 phi0 -= a; 02271 phi1 += a; 02272 if (phi > phi0 && phi < phi1) outList.append(_unused[2][i]); 02273 } 02274 else { 02275 phi0 += a; 02276 phi1 -= a; 02277 if (phi < phi0 || phi > phi1) outList.append(_unused[2][i]); 02278 } 02279 } 02280 return outList; 02281 }
|
|
|
|
01593 { 01594 HepPoint3D center(1., 1., 0.); 01595 center.setPhi(phi[0]); 01596 01597 AList<TMLink> outList; 01598 unsigned nBad = _unused[2].length(); 01599 for (unsigned i = 0; i < nBad; i++) { 01600 unsigned sl = _unused[2][i]->wire()->superLayerId(); 01601 unsigned as = sl % 2; 01602 if (as == 0) { 01603 if (! (axialStereoSwitch & 1)) continue; 01604 } 01605 else { 01606 if (! (axialStereoSwitch & 2)) continue; 01607 } 01608 01609 const HepPoint3D & p = _unused[2][i]->position(); 01610 if (center.dot(p) < 0.) continue; 01611 01612 float dPhi = phi[sl] - _unused[2][i]->position().phi(); 01613 dPhi = fabs(fmod(dPhi, PI2)); 01614 if (dPhi > (PI2 - dPhi)) dPhi = PI2 - dPhi; 01615 if (dPhi < WIDTH[sl] * loadWidth) { 01616 outList.append(_unused[2][i]); 01617 continue; 01618 } 01619 dPhi = phi[sl + 1] - _unused[2][i]->position().phi(); 01620 dPhi = fabs(fmod(dPhi, PI2)); 01621 if (dPhi > (PI2 - dPhi)) dPhi = PI2 - dPhi; 01622 if (dPhi < WIDTH[sl] * loadWidth) 01623 outList.append(_unused[2][i]); 01624 } 01625 return outList; 01626 }
|
|
|
|
02132 { 02133 static const TPoint2D O(0., 0.); 02134 AList<TSegment> outList; 02135 02136 //yuany 02137 //...Search for segments... 02138 for (unsigned sl = 0; sl < 2; sl++) { 02139 unsigned nMax = 5; 02140 if (sl == 0) { 02141 if (! (axialStereoSwitch & 1)) continue; 02142 } 02143 else { 02144 nMax = 6; 02145 if (! (axialStereoSwitch & 2)) continue; 02146 } 02147 for (unsigned i = 0; i < nMax; i++) { 02148 02149 unsigned layerId; 02150 switch(sl){ 02151 case 0: 02152 switch(i){ 02153 case 0:layerId = 2;break; 02154 case 1:layerId = 3;break; 02155 case 2:layerId = 4;break; 02156 case 3:layerId = 9;break; 02157 case 4:layerId = 10;break; 02158 } 02159 case 1: 02160 switch(i){ 02161 case 0:layerId = 0;break; 02162 case 1:layerId = 1;break; 02163 case 2:layerId = 5;break; 02164 case 3:layerId = 6;break; 02165 case 4:layerId = 7;break; 02166 case 5:layerId = 8;break; 02167 } 02168 } 02169 // cout<<"sl "<<sl<<" i "<<i<<" layerId "<<layerId<<endl; 02170 02171 if (x[layerId] == O) continue; 02172 float a = WIDTH[layerId] * loadWidth; 02173 float phi0 = x[layerId].phi(); 02174 float phi1 = x[layerId+1].phi();//Liuqg 02175 float phiC = (phi0 + phi1) / 2.; 02176 float phiD = fabs(phi0 - phiC); 02177 if (phiD > M_PI_2) { 02178 phiC += M_PI; 02179 phiD = M_PI - phiD; 02180 } 02181 phiD += a; 02182 #ifdef TRKRECO_DEBUG_DETAIL 02183 std::cout << " pickUpSegments ... phi0,1,C,D=" << phi0 << ","; 02184 std::cout << phi1 << "," << phiC << "," << phiD << std::endl; 02185 #endif 02186 02187 const AList<TSegment> & list = _allUnused[sl][i]; 02188 unsigned n = list.length(); 02189 for (unsigned j = 0; j < n; j++) { 02190 TSegment & s = * list[j]; 02191 02192 #ifdef TRKRECO_DEBUG_DETAIL 02193 s.dump("hits sort", " "); 02194 #endif 02195 02196 bool found = false; 02197 const AList<TMLink> & inners = s.inners(); 02198 unsigned m = inners.length(); 02199 for (unsigned k = 0; k < m; k++) { 02200 float phi = inners[k]->position().phi(); 02201 if (phi < 0.) phi += PI2; 02202 float dPhi = fabs(phi - phiC); 02203 if (dPhi > M_PI) dPhi = PI2 - dPhi; 02204 #ifdef TRKRECO_DEBUG_DETAIL 02205 std::cout << " " << inners[k]->wire()->name(); 02206 std::cout << ", phi,dPhi=" << phi << "," << dPhi << std::endl; 02207 #endif 02208 if (dPhi < phiD) { 02209 outList.append(s); 02210 found = true; 02211 break; 02212 } 02213 } 02214 02215 if (found) continue; 02216 const AList<TMLink> & outers = s.outers(); 02217 m = outers.length(); 02218 for (unsigned k = 0; k < m; k++) { 02219 float phi = outers[k]->position().phi(); 02220 if (phi < 0.) phi += PI2; 02221 float dPhi = fabs(phi - phiC); 02222 if (dPhi > M_PI) dPhi = PI2 - dPhi; 02223 #ifdef TRKRECO_DEBUG_DETAIL 02224 std::cout << " " << outers[k]->wire()->name(); 02225 std::cout << ", phi,dPhi=" << phi << "," << dPhi << std::endl; 02226 #endif 02227 if (dPhi < phiD) { 02228 outList.append(s); 02229 found = true; 02230 break; 02231 } 02232 } 02233 } 02234 } 02235 } 02236 return outList; 02237 }
|
|
|
|
01533 { 01534 AList<TSegment> outList; 01535 HepPoint3D center(1., 1., 0.); 01536 center.setPhi(phi[0]); 01537 01538 //...Search for segments... 01539 for (unsigned sl = 0; sl < 2; sl++) { 01540 if (sl == 0) { 01541 if (! (axialStereoSwitch & 1)) continue; 01542 } 01543 else { 01544 if (! (axialStereoSwitch & 2)) continue; 01545 } 01546 for (unsigned i = 0; i < 6; i++) { 01547 const AList<TSegment> & list = _allUnused[sl][i]; 01548 unsigned n = list.length(); 01549 for (unsigned j = 0; j < n; j++) { 01550 TSegment & s = * list[j]; 01551 01552 const HepPoint3D & p = s.position(); 01553 if (center.dot(p) < 0.) continue; 01554 01555 bool found = false; 01556 const AList<TMLink> & inners = s.inners(); 01557 unsigned m = inners.length(); 01558 for (unsigned k = 0; k < m; k++) { 01559 float dPhi = phi[i * 2 + sl] - 01560 inners[k]->position().phi(); 01561 dPhi = fabs(fmod(dPhi, PI2)); 01562 if (dPhi > (PI2 - dPhi)) dPhi = PI2 - dPhi; 01563 if (dPhi < WIDTH[i * 2 + sl] * loadWidth) { 01564 outList.append(s); 01565 found = true; 01566 break; 01567 } 01568 } 01569 01570 if (found) continue; 01571 const AList<TMLink> & outers = s.outers(); 01572 m = outers.length(); 01573 for (unsigned k = 0; k < m; k++) { 01574 float dPhi = phi[i * 2 + sl + 1] - 01575 outers[k]->position().phi(); 01576 dPhi = fabs(fmod(dPhi, PI2)); 01577 if (dPhi > (PI2 - dPhi)) dPhi = PI2 - dPhi; 01578 if (dPhi < WIDTH[i * 2 + sl] * loadWidth) { 01579 outList.append(s); 01580 break; 01581 } 01582 } 01583 } 01584 } 01585 } 01586 01587 return outList; 01588 }
|
|
|
|
01223 { 01224 #ifdef TRKRECO_WINDOW 01225 std::string s = "Conf::quality2D ... level " + itostring(level); 01226 #endif 01227 //jialk caution origin is 15. 01228 //...Check # radius...Liuqg 01229 if(fabs(t.radius()) < 15.) return false; //corresponding to pt = 300*1T*0.50/2(m). 01230 01231 //...Check # of segments(superlayers)... 01232 // unsigned nSuperLayers = NSuperLayers(t.links(), 2); 01233 unsigned nSuperLayers = NSuperLayers(t.links()); 01234 if (nSuperLayers < _minNSegments) { 01235 #ifdef TRKRECO_DEBUG 01236 std::cout << "... quality check : level=" << level << " : bad" << std::endl; 01237 std::cout << " reason : # segments(superlayer) =" << nSuperLayers; 01238 std::cout << " < " << _minNSegments << std::endl; 01239 #endif 01240 #ifdef TRKRECO_WINDOW 01241 s += " rejected because of few segments(superlayers)"; 01242 displayStatus(s); 01243 _rphiWindow.oneShot(t, leda_red); 01244 #endif 01245 return false; 01246 } 01247 if (level == 0) { 01248 #ifdef TRKRECO_WINDOW 01249 s += " ok : # of used segments(superlayers) = "; 01250 s += itostring(nSuperLayers); 01251 s += " > " + itostring(_minNSegments); 01252 displayStatus(s); 01253 _rphiWindow.oneShot(t, leda_green); 01254 #endif 01255 01256 return true; 01257 } 01258 01259 //...Check superlayer usage... 01260 unsigned n3 = NSuperLayers(t.links(), 3); 01261 01262 //...Check super layer usage... 01263 if (n3 != nSuperLayers) { 01264 unsigned sl = SuperLayer(t.links(), 2); 01265 // unsigned sl = SuperLayer(t.links(), 3); 01266 if (sl == 0) { 01267 #ifdef TRKRECO_DEBUG 01268 std::cout << "... quality check : level = " << level << " : bad"; 01269 std::cout << std::endl; 01270 std::cout << " reason : super layer pattern(n2) = 0 " << std::endl; 01271 #endif 01272 #ifdef TRKRECO_WINDOW 01273 s += " rejected because of bad super-layer pattern(n2=0)"; 01274 displayStatus(s); 01275 _rphiWindow.oneShot(t, leda_red); 01276 #endif 01277 return false; 01278 } 01279 //unsigned fl = 0; //belle, liuqg 01280 //while ((sl & (1 << (fl * 2))) == 0) ++fl; 01281 //bool empty = false; 01282 01283 /*unsigned fl[5] = {2, 3, 4, 9, 10}; //tmp....liuqg 01284 unsigned nfl = 0; 01285 for (unsigned i = 0; i < 5; i++) { 01286 if ((sl & (1 << fl[i])) == 1) { 01287 nfl = i; 01288 break; 01289 } 01290 } 01291 bool empty = false; 01292 for (unsigned i = nfl + 1; i < 5; i++) { 01293 bool thisLayer = (sl & (1 << fl[i])); 01294 if (thisLayer && empty) { 01295 01296 //#ifdef TRKRECO_DEBUG 01297 std::cout << "... quality check : level = " << level; 01298 std::cout << " : bad" << std::endl; 01299 std::cout << " reason : super layer pattern = "; 01300 // for (unsigned j = 0; j < 6; j++) std::cout << (sl >> (j * 2)) % 2; 01301 std::cout << std::endl; 01302 //#endif 01303 #ifdef TRKRECO_WINDOW 01304 s += " rejected because of bad super-layer pattern"; 01305 displayStatus(s); 01306 _rphiWindow.oneShot(t, leda_red); 01307 #endif 01308 return false; 01309 } 01310 if (! thisLayer) empty = true; 01311 }*/ 01312 } 01313 01314 #ifdef TRKRECO_DEBUG 01315 std::cout << "... quality check : level = " << level; 01316 std::cout << " : ok, super layer pattern = " << std::endl; 01317 std::string ptn; 01318 unsigned sl = SuperLayer(t.links(), 2); 01319 for (unsigned j = 0; j < 6; j++) { 01320 unsigned k = (sl >> (j * 2)) % 2; 01321 std::cout << k; 01322 if (k) ptn += "1"; 01323 else ptn += "0"; 01324 } 01325 std::cout << std::endl; 01326 #endif 01327 #ifdef TRKRECO_WINDOW 01328 s += " ok : super layer ptn = " + ptn; 01329 displayStatus(s); 01330 _rphiWindow.oneShot(t, leda_green); 01331 #endif 01332 01333 return true; 01334 }
|
|
|
|
02695 { 02696 const AList<TMLink> & links = t.links(); 02697 AList<TMLink> sl[11]; 02698 unsigned n = links.length(); 02699 for (unsigned i = 0; i < n; i++) 02700 sl[links[i]->wire()->superLayerId()].append(links[i]); 02701 AList<TMLink> toBeRemoved; 02702 for (unsigned i = 0; i < 11; i++) 02703 if (sl[i].length() < minN) 02704 toBeRemoved.append(sl[i]); 02705 t.remove(toBeRemoved); 02706 #ifdef TRKRECO_DEBUG 02707 std::cout << "... refining links : removed links = " << toBeRemoved.length(); 02708 std::cout << std::endl; 02709 #endif 02710 }
|
|
|
|
02618 { 02619 const AList<TSegment> & original = t.segments(); 02620 AList<TSegment> outList; 02621 unsigned n = original.length(); 02622 for (unsigned i = 0; i < n; i++) { 02623 AList<TMLink> tmp = Links(* original[i], t); 02624 if (tmp.length() >= _minNLinksForSegmentInRefine) 02625 outList.append(original[i]); 02626 } 02627 unsigned sl = SuperLayer(outList); 02628 unsigned nCMax = 0; 02629 unsigned nStart = 0; 02630 unsigned nC = 0; 02631 unsigned nS = 0; 02632 unsigned fl[5] = {2, 3, 4, 9, 10}; 02633 for (unsigned i = 0; i < 5; i++) { 02634 if (sl & (1 << fl[i])) { 02635 ++nC; 02636 if (nC == 1) nS = i; 02637 if (nC > nCMax) { 02638 nCMax = nC; 02639 nStart = nS; 02640 } 02641 } 02642 else { 02643 nC = 0; 02644 } 02645 } 02646 // nStart *= 2; 02647 // nCMax *= 2; 02648 02649 outList.removeAll(); 02650 if (nCMax >= _minNSegments) { 02651 for (unsigned i = 0; i < n; i++) { 02652 unsigned id = original[i]->superLayerId(); 02653 if ((id >= fl[nStart]) && (id < fl[nStart + nCMax])) 02654 outList.append(original[i]); 02655 } 02656 } 02657 02658 #ifdef TRKRECO_DEBUG 02659 std::cout << "... refine segments : orignal sl = "; 02660 bitDisplay(sl, 11, 0); 02661 std::cout << ", output sl = "; 02662 bitDisplay(SuperLayer(outList), 11, 0); 02663 std::cout << std::endl; 02664 #endif 02665 02666 return outList; 02667 }
|
|
removes bad segments.
|
|
removes bad segments.
00536 { 00537 #ifdef TRKRECO_DEBUG 00538 std::cout << "... removing bad segments : # used seg = "; 00539 std::cout << t.segments().length() << std::endl; 00540 #endif 00541 #ifdef TRKRECO_DEBUG_DETAIL 00542 for (unsigned i = 0; i < t.segments().length(); i++) 00543 t.segments()[i]->dump("hits sort flag", " "); 00544 #endif 00545 00546 const AList<TSegment> & segments = t.segments(); 00547 AList<TSegment> bads; 00548 unsigned used = 0; 00549 TSegment * innerMost; 00550 unsigned n = segments.length(); 00551 for (unsigned i = 0; i < n; i++) { 00552 TSegment & s = * segments[i]; 00553 AList<TMLink> links = Links(s, t); 00554 unsigned nLinks = links.length(); 00555 00556 unsigned nCores = Cores(links).length(); 00557 unsigned nCoresSegment = s.nCores(); 00558 // if (nCores < _minNCoreLinks) { 00559 // if (nCores < (nCoresSegment / 2)) { 00560 if ((nCores < _minNCoreLinks) && (nCores < ((nCoresSegment + 1) / 2))){ 00561 bads.append(s); 00562 continue; 00563 } 00564 00565 unsigned id = segments[i]->superLayerId(); 00566 used |= (1 << id); 00567 if (! id) innerMost = & s; 00568 } 00569 00570 // //...Check used super layers... 00571 // n = segments.length(); 00572 // for (unsigned i = 0; i < n; i++) 00573 // if ((used & 0x155) == 0x101) 00574 // bads.append(innerMost); 00575 00576 if (! bads.length()) return bads; 00577 00578 #ifdef TRKRECO_DEBUG 00579 std::cout << " bad segments : # = " << bads.length() << std::endl; 00580 #endif 00581 00582 n = bads.length(); 00583 for (unsigned i = 0; i < n; i++) { 00584 TSegment & s = * bads[i]; 00585 00586 #ifdef TRKRECO_DEBUG 00587 AList<TMLink> links = Links(s, t); 00588 unsigned nLinks = links.length(); 00589 unsigned nCores = Cores(links).length(); 00590 std::cout << " # used links = " << nLinks; 00591 std::cout << ", # used cores = " << nCores << std::endl; 00592 s.dump("hits sort flag", " "); 00593 #endif 00594 00595 s.tracks().remove(t); 00596 t.segments().remove(s); 00597 t.remove(s.links()); 00598 } 00599 00600 //...Refit... 00601 t.fit(); 00602 00603 #ifdef TRKRECO_DEBUG 00604 std::cout << "... refitting" << std::endl; 00605 t.dump("detail", "2nd> "); 00606 #endif 00607 00608 return bads; 00609 }
|
|
remove used segments.
|
|
remove used segments.
00696 { 00697 unsigned n = tracks.length(); 00698 for (unsigned i = 0; i < n; i++) { 00699 TTrack & t = * tracks[i]; 00700 AList<TSegment> & segments = t.segments(); 00701 AList<TSegment> toBeRemoved; 00702 unsigned nS = segments.length(); 00703 for (unsigned j = 0; j < nS; j++) { 00704 TSegment & s = * segments[j]; 00705 unsigned sId = s.superLayerId(); 00706 // unsigned as = sId % 2; 00707 // unsigned id = sId / 2; 00708 unsigned as; 00709 unsigned id; 00710 switch (sId) { 00711 case 0: as = 1; id = 0;break; 00712 case 1: as = 1; id = 1;break; 00713 case 2: as = 0; id = 0;break; 00714 case 3: as = 0; id = 1;break; 00715 case 4: as = 0; id = 2;break; 00716 case 5: as = 1; id = 2;break; 00717 case 6: as = 1; id = 3;break; 00718 case 7: as = 1; id = 4;break; 00719 case 8: as = 1; id = 5;break; 00720 case 9: as = 0; id = 3;break; 00721 case 10: as = 0; id = 4;break; 00722 default: break; 00723 } 00724 00725 //...Check used links... 00726 AList<TMLink> links = Links(s, t); 00727 if (links.length() == 0) { 00728 s.tracks().remove(t); 00729 toBeRemoved.append(s); 00730 #ifdef TRKRECO_DEBUG 00731 std::cout << "!!! why this happends???" << std::endl; 00732 std::cout << " no used link" << std::endl; 00733 #endif 00734 continue; 00735 } 00736 00737 //...Remove from lists... 00738 _allUnused[as][id].remove(s); 00739 00740 //...Remove incoming links... 00741 const AList<TSegment> & outers = s.outerLinks(); 00742 unsigned nO = outers.length(); 00743 // std::cout << " >>> removing outer links" << std::endl; 00744 // s.dump("hits", " To "); 00745 for (unsigned i = 0; i < nO; i++) { 00746 outers[i]->innerLinks().remove(s); 00747 // outers[i]->dump("hits", " From "); 00748 } 00749 00750 //...Remaining hits... 00751 AList<TMLink> unused = s.links(); 00752 unused.remove(links); 00753 s.remove(unused); 00754 unsigned nUnused = unused.length(); 00755 00756 //...Create new segment if too many remaining links... 00757 /* if (nUnused < _minNLinksForSegment) { 00758 for (unsigned k = 0; k < nUnused; k++) { 00759 _unused[as].append(unused[k]); 00760 _unused[2].append(unused[k]); 00761 } 00762 } 00763 else { 00764 TSegment * ss = new TSegment(unused); 00765 AList<TSegment> newSegments = ss->split(); //tmp for tsf 00766 if (newSegments.length() == 0) { 00767 ss->solveDualHits(); 00768 newSegments.append(ss); 00769 for (unsigned k = 0; k < nO; k++) 00770 outers[k]->innerLinks().append(ss); 00771 } 00772 else { 00773 delete ss; 00774 } 00775 _allUnused[as][id].append(newSegments); 00776 _allSegments[as][id].append(newSegments); 00777 } 00778 */ 00779 } 00780 segments.remove(toBeRemoved); 00781 } 00782 }
|
|
|
|
02755 { 02756 unsigned nTracks = tracks.length(); 02757 if (nTracks < 2) return; 02758 02759 for (unsigned i = 0; i < nTracks - 1; i++) { 02760 TTrack & t0 = * tracks[i]; 02761 const AList<TMLink> & links0 = t0.links(); 02762 unsigned n0 = links0.length(); 02763 AList<TMLink> remove0; 02764 for (unsigned j = i + 1; j < nTracks; j++) { 02765 TTrack & t1 = * tracks[j]; 02766 const AList<TMLink> & links1 = t1.links(); 02767 unsigned n1 = links1.length(); 02768 AList<TMLink> remove1; 02769 02770 //...Check overlap... 02771 for (unsigned k = 0; k < n0; k++) { 02772 TMLink & l = * links0[k]; 02773 02774 //...Decide which is better... 02775 if (links1.hasMember(l)) { 02776 TMLink l0(NULL, l.hit()); 02777 TMLink l1(NULL, l.hit()); 02778 t0.approach(l0); 02779 t1.approach(l1); 02780 if (l0.pull() > l1.pull()) 02781 remove0.append(l); 02782 else 02783 remove1.append(l); 02784 } 02785 } 02786 02787 if (remove1.length()) { 02788 t1.remove(remove1); 02789 t1.fit(); 02790 } 02791 } 02792 02793 if (remove0.length()) { 02794 t0.remove(remove0); 02795 t0.fit(); 02796 } 02797 } 02798 }
|
|
resolves multi-assignment of segments/hits.
|
|
resolves multi-assignment of segments/hits.
00451 { 00452 #ifdef TRKRECO_DEBUG 00453 std::cout << "... resolving assignments" << std::endl; 00454 #endif 00455 00456 //...Pick up segments which has multiple assignments... 00457 AList<TSegment> multi; 00458 unsigned n = trackCandidates.length(); 00459 for (unsigned i = 0; i < n; i++) { 00460 TTrack & t = * trackCandidates[i]; 00461 AList<TSegment> & segments = t.segments(); 00462 unsigned nS = segments.length(); 00463 for (unsigned j = 0; j < nS; j++) { 00464 if (segments[j]->tracks().length() > 1) 00465 multi.append(segments[j]); 00466 } 00467 } 00468 multi.purge(); 00469 00470 //...Resolve assignments... 00471 n = multi.length(); 00472 for (unsigned i = 0; i < n; i++) { 00473 TSegment & s = * multi[i]; 00474 const AList<TTrack> & tracks = s.tracks(); 00475 unsigned nT = tracks.length(); 00476 00477 //...Check TMLink overlap... 00478 AList<TMLink> multiLinks; 00479 const AList<TMLink> & links = s.links(); 00480 unsigned nL = links.length(); 00481 for (unsigned j = 0; j < nL; j++) { 00482 TMLink & l = * links[i]; 00483 bool overlap = false; 00484 for (unsigned k = 0; k < nT; k++) { 00485 TTrack & t = * tracks[k]; 00486 if (t.links().hasMember(l)) 00487 overlap = true; 00488 } 00489 multiLinks.append(l); 00490 } 00491 multiLinks.purge(); 00492 00493 #ifdef TRKRECO_DEBUG 00494 std::cout << " segment : "; 00495 s.dump("hits sort flag"); 00496 std::cout << " # of assigned tracks = " << nT << std::endl; 00497 std::cout << " # of overlap TMLinks = " << multiLinks.length(); 00498 std::cout << std::endl; 00499 #endif 00500 //...Select the closest... 00501 nL = multiLinks.length(); 00502 for (unsigned j = 0; j < nL; j++) { 00503 TMLink & l = * multiLinks[j]; 00504 00505 float bestDiff = 999999999.; 00506 TTrack * best = NULL; 00507 for (unsigned k = 0; k < nT; k++) { 00508 TTrack & t = * tracks[k]; 00509 t.approach(l); 00510 float distance = (l.positionOnWire() - l.positionOnTrack()) 00511 .mag(); 00512 float diff = fabs(distance - l.hit()->drift()); 00513 if (diff < bestDiff) { 00514 bestDiff = diff; 00515 best = & t; 00516 } 00517 } 00518 00519 for (unsigned k = 0; k < nT; k++) { 00520 TTrack & t = * tracks[k]; 00521 if (& t == best) continue; 00522 t.remove(l); 00523 } 00524 00525 #ifdef TRKRECO_DEBUG 00526 { 00527 std::cout << " " << l.wire()->name() << " -> "; 00528 std::cout << best->name() << std::endl; 00529 } 00530 #endif 00531 } 00532 } 00533 }
|
|
salvages segments.
|
|
salvages segments.
01949 { 01950 #ifdef TRKRECO_DEBUG_DETAIL 01951 std::cout << "... salvaging in real plane" << std::endl; 01952 #endif 01953 01954 //...Calculate cross points... 01955 TPoint2D points[12]; 01956 int err = crossPoints(track, points); 01957 if (err) { 01958 #ifdef TRKRECO_DEBUG_DETAIL 01959 std::cout << "... salvaging failed in calculation of intersection" 01960 << std::endl; 01961 #endif 01962 return; 01963 } 01964 01965 //...Pick up segments... 01966 AList<TSegment> toBeChecked = pickUpSegments(points, 01967 float(_salvageLoadWidth), 01968 asSwitch); 01969 toBeChecked.remove(bads); 01970 toBeChecked.remove(track.segments()); 01971 toBeChecked = trackSide(track, toBeChecked); 01972 01973 //...Pick up links... 01974 AList<TMLink> links; 01975 unsigned nB = toBeChecked.length(); 01976 for (unsigned i = 0; i < nB; i++) { 01977 const AList<TMLink> & tmp = toBeChecked[i]->links(); 01978 unsigned nL = tmp.length(); 01979 for (unsigned j = 0; j < nL; j++) { 01980 if (tmp[j]->hit()->track()) continue; 01981 links.append(tmp[j]); 01982 } 01983 } 01984 01985 //...Search in bad hits... 01986 AList<TMLink> all = pickUpLinks(points, float(_salvageLoadWidth), asSwitch); 01987 all = trackSide(track, all); 01988 all.remove(track.links()); 01989 links.append(all); 01990 01991 #ifdef TRKRECO_WINDOW 01992 AList<TMLink> tmp = links; 01993 #endif 01994 01995 //...Ask builder... 01996 _builder.salvage(track, links); 01997 01998 //...Check used segments... 01999 const AList<TMLink> & usedLinks = track.links(); 02000 for (unsigned i = 0; i < nB; i++) { 02001 TSegment & segment = * toBeChecked[i]; 02002 AList<TMLink> used = Links(segment, track); 02003 if (used.length() == 0) continue; 02004 02005 track.segments().append(segment); 02006 segment.tracks().append(track); 02007 } 02008 02009 #ifdef TRKRECO_WINDOW 02010 displayStatus("Conf::salvage ... results"); 02011 TTrackBase y(tmp); 02012 _rphiWindow.append(y, leda_red); 02013 _rphiWindow.append(toBeChecked, leda_red); 02014 _rphiWindow.oneShot(track, leda_green); 02015 #endif 02016 02017 //...Termination... 02018 return; 02019 }
|
|
selects good hits.
|
|
selects good hits.
00188 { 00189 for (unsigned i = 0; i < 2; i++) { 00190 unsigned n = _allHits[i].length(); 00191 for (unsigned j = 0; j < n; j++) { 00192 unsigned state = _allHits[i][j]->hit()->state(); 00193 // if (_allHits[i][j]->hit()->reccdc()->tdc>800) continue; 00194 // if ((state & WireHitIsolated) && (state & WireHitContinuous)) //tmp... 00195 // if ((state & WireHitIsolated)) 00196 _hits[i].append(_allHits[i][j]); 00197 // else 00198 _unused[i].append(_allHits[i][j]); 00199 } 00200 } 00201 _hits[2].append(_hits[0]); 00202 _hits[2].append(_hits[1]); 00203 _unused[2].append(_unused[0]); 00204 _unused[2].append(_unused[1]); 00205 00206 #ifdef TRKRECO_WINDOW 00207 _rphiWindow.clear(); 00208 _rphiWindow.skip(false); 00209 _rphiWindow.skipAllWindow(false); 00210 _rphiWindow.append(_allHits[2]); 00211 _rphiWindow.append(_hits[2], leda_pink); 00212 // _rphiWindow.skip(true); 00213 // _rphiWindow.skipAllWindow(true); 00214 #endif 00215 }
|
|
slow findings. level:0/1:selection of segments to be used
|
|
slow findings. level:0/1:selection of segments to be used
02284 { 02285 02286 #ifdef TRKRECO_DEBUG_DETAIL 02287 std::cout << "... slow finding (2D) : level = " << level << std::endl; 02288 #endif 02289 #ifdef TRKRECO_DEBUG 02290 _stage = ConformalSlow2D; 02291 #endif 02292 02293 AList<TSegment> * segments = & _allUnused[0][0]; 02294 02295 unsigned id = _2DTracks.length() + _3DTracks.length(); 02296 unsigned seedLayer = 5; 02297 while (seedLayer--) { 02298 02299 //...Seed loop... 02300 AList<TSegment> tmp = segments[seedLayer]; 02301 unsigned n = tmp.length(); 02302 for (unsigned i = 0; i < n; i++) { 02303 AList<TTrack> trackCandidates; 02304 TSegment & current = * tmp[i]; 02305 if (current.links().length() < 3) continue; 02306 if (current.innerLinks().length() != 1) continue; 02307 if (current.innerLinks()[0]->links().length() < 3) continue; 02308 AList<TSegment> seeds; 02309 seeds.append(current); 02310 seeds.append(current.innerLinks()[0]); 02311 02312 std::string name = "s" + itostring(id); 02313 02314 #ifdef TRKRECO_DEBUG 02315 std::cout << "==> slow building : " << name << std::endl; 02316 #endif 02317 02318 //...Try to build a track... 02319 for (int k = 0; k < seeds.length(); ++k) //tsf 02320 seeds[k]->solveLR(); 02321 02322 TTrack * t = expand(seeds); 02323 if (t) { 02324 AList<TSegment> bads; 02325 t->name(name); 02326 salvage(* t, 1, bads); 02327 if (! trackQuality(* t)) { 02328 deleteTrack(* t); 02329 continue; 02330 } 02331 t->finder(TrackSlowFinder); 02332 t->quality(TrackQuality2D); 02333 t->fitting(TrackFitGlobal); 02334 trackCandidates.append(t); 02335 02336 #ifdef TRKRECO_DEBUG 02337 std::cout << "... 2D finished : " << t->name() << std::endl; 02338 t->dump("hits sort flag pull", " "); 02339 #endif 02340 #ifdef TRKRECO_WINDOW 02341 displayStatus("Conf::expand ... finished"); 02342 _rphiWindow.oneShot(* t, leda_green); 02343 #endif 02344 removeUsedSegments(trackCandidates); 02345 _2DTracks.append(trackCandidates); 02346 id = _2DTracks.length() + _3DTracks.length(); 02347 } 02348 } 02349 02350 //...Resolve multi-track candidates... 02351 // resolveSegments(trackCandidates); 02352 02353 //...Remove used segments... 02354 } 02355 }
|
|
finds setereo segments.
|
|
finds setereo segments.
01706 { 01707 #ifdef TRKRECO_DEBUG 01708 std::cout << "... finding stereo segments" << std::endl; 01709 #endif 01710 01711 const AList<TSegment> & bases = (const AList<TSegment> &) t.segments(); 01712 AList<TSegment> seeds; 01713 unsigned n = bases.length(); 01714 if (n == 0) return seeds; 01715 01716 //...Calculate cross points in the conformal plane... 01717 TPoint2D points[12]; 01718 int err = crossPoints(t, points); 01719 //yuany 01720 // for(unsigned i=0;i<12;i++) 01721 // cout<<points[i]<<endl; 01722 if (err) { 01723 #ifdef TRKRECO_DEBUG 01724 std::cout << "... stereo segment finding failed" << std::endl; 01725 #endif 01726 return seeds; 01727 } 01728 01729 //...Pick up segments... 01730 // return pickUpSegments(points, float(_stereoLoadWidth), 2); 01731 AList<TSegment> list = pickUpSegments(points, float(_stereoLoadWidth), 2); 01732 //yuany 01733 //cout<<"list length "<<list.length()<<endl; 01734 01735 //...Save direction of a segment of axial layers... 01736 TPoint2D dir[5]; 01737 for (unsigned i = 0; i < n; i++) { 01738 const TSegment & s = * bases[i]; 01739 AList<TMLink> ll = s.links(); 01740 unsigned sl = ll[0]->wire()->axialStereoLayerId()/4; 01741 dir[sl] = TPoint2D(s.direction()); 01742 // cout<<"in sl = "<<sl<<" dir = "<<dir[sl]<<endl; 01743 } 01744 01745 //...Cal. direction if empty... 01746 for (unsigned i = 0; i < 5; i++) { 01747 if (dir[i].mag() < .5) { 01748 unsigned j = i; 01749 while ((j < 5) && (dir[j].mag() < .5)) 01750 ++j; 01751 if (j > 4) j = 4; 01752 if (dir[j].mag() < .5) { 01753 j = i; 01754 while ((j > 0) && (dir[j].mag() < .5)) 01755 --j; 01756 } 01757 dir[i] = dir[j]; 01758 } 01759 } 01760 //...Remove bad segments... 01761 #ifdef TRKRECO_DEBUG_DETAIL 01762 std::cout << " ... direction :" << std::endl; 01763 for (unsigned i = 0; i < 6; i++) 01764 std::cout << " " << i << " : " << dir[i] << std::endl; 01765 std::cout << " ... direction cos :" << std::endl; 01766 #endif 01767 AList<TSegment> badList; 01768 AList<TSegment> toBeChecked[6]; 01769 unsigned nL = list.length(); 01770 for (unsigned i = 0; i < 6; ++i) 01771 toBeChecked[i].removeAll(); 01772 01773 for (unsigned j = 0; j < nL; ++j) { 01774 TSegment & s = * list[j]; 01775 AList<TMLink> ll = s.links(); 01776 unsigned sl = ll[0]->wire()->axialStereoLayerId()/4; 01777 toBeChecked[sl].append(s); 01778 } 01779 01780 for (unsigned i = 0; i < 6; ++i) { 01781 unsigned nToBeChecked = toBeChecked[i].length(); 01782 if (nToBeChecked < 4) continue; 01783 unsigned nBadList = badList.length(); 01784 for (unsigned j = 0; j < nToBeChecked; ++j) { 01785 if((badList.length() - nBadList) >= nToBeChecked - 4) break; 01786 TSegment & s = * toBeChecked[i][j]; 01787 TPoint2D sDir = s.direction(); 01788 unsigned sl = i; 01789 unsigned aSl; 01790 01791 if (sl < 2) aSl = 0; 01792 else if (sl < 4) aSl = 2; 01793 else aSl = 3; 01794 if (dir[aSl].dot(sDir) < 0.7) badList.append(s); 01795 if (sl == 2 || sl == 3 || sl == 4) { 01796 if (dir[aSl - 1].dot(sDir) < 0.6) badList.append(s); 01797 } 01798 else { 01799 if (dir[aSl + 1].dot(sDir) < 0.6) badList.append(s); 01800 } 01801 } 01802 toBeChecked[i].remove(badList); 01803 if (toBeChecked[i].length() > 4) { 01804 AList<TSegment> tmp; //with >= 4 links 01805 unsigned nSegs = toBeChecked[i].length(); 01806 for (unsigned j = 0; j < nSegs; ++j) { 01807 TSegment & s = * toBeChecked[i][j]; 01808 if (s.links().length() > 3) tmp.append(s); 01809 } 01810 toBeChecked[i].remove(tmp); 01811 for (unsigned j = 0; j < tmp.length(); ++j) { 01812 AList<TMLink> tmpLinks = tmp[j]->links(); 01813 for (unsigned k = 0; k < toBeChecked[i].length(); ++k) { 01814 TSegment & ss = * toBeChecked[i][k]; 01815 AList<TMLink> threeLinks = ss.links(); 01816 for (unsigned kk = 0; kk < threeLinks.length(); ++kk) { 01817 TMLink & ll = * threeLinks[kk]; 01818 if (tmpLinks.hasMember(ll)) { 01819 badList.append(ss); 01820 break; 01821 } 01822 } 01823 } 01824 }//j 01825 } 01826 //jialk 01827 toBeChecked[i].remove(badList); 01828 if (toBeChecked[i].length() > 4) {//still with > 4 segs after above filter 01829 AList<TSegment> temp; 01830 unsigned nSegs = toBeChecked[i].length(); 01831 for(unsigned k=0; k < nSegs; ++k){ 01832 TSegment &s = *toBeChecked[i][k]; 01833 temp.append(s); 01834 } 01835 //use bubble to get a sequence 01836 for(unsigned y=0; y<nSegs; y++){ 01837 for(unsigned x=1; x<nSegs-y; x++){ 01838 TSegment &s1 = *temp[x]; 01839 TSegment &s2 = *temp[x-1]; 01840 if(s1.links().length() < s2.links().length()){ 01841 TSegment & s0 = *temp[x-1]; 01842 *temp[x-1] = *temp[x]; 01843 *temp[x] = s0; 01844 } 01845 } 01846 } 01847 for(unsigned j=4; j<nSegs; ++j){ 01848 TSegment &s4 = *temp[j]; 01849 badList.append(s4); 01850 } 01851 } 01852 01853 01854 01855 toBeChecked[i].remove(badList); 01856 01857 // cout<<"**********the num of stereo segs after filter*********** "<<toBeChecked[i].length()<<endl; 01858 for(unsigned j = 0; j < toBeChecked[i].length(); ++j){ 01859 TSegment &s5 = *toBeChecked[i][j]; 01860 // cout<<"num of hits"<<s5.links().length()<<endl; 01861 } 01862 01863 } 01864 01865 /* for (unsigned i = 0; i < nL; i++) { 01866 TSegment & s = * list[i]; 01867 AList<TMLink> ll = s.links(); 01868 unsigned sl = ll[0]->wire()->axialStereoLayerId()/4; 01869 TPoint2D sDir = s.direction(); 01870 unsigned aSl; 01871 01872 if (sl < 2) aSl = 0; 01873 else if (sl < 4) aSl = 2; 01874 else aSl = 3; 01875 if (dir[aSl].dot(sDir) < 0.7) badList.append(s); 01876 if (sl == 2 || sl == 3 || sl == 4) { 01877 if (dir[aSl - 1].dot(sDir) < 0.6) badList.append(s); 01878 } 01879 else { 01880 if (dir[aSl + 1].dot(sDir) < 0.6) badList.append(s); 01881 } 01882 #ifdef TRKRECO_DEBUG_DETAIL 01883 std::cout << " " << dir[sl].dot(sDir) << ", "; 01884 std::cout << dir[sl + 1].dot(sDir) << " : "; 01885 s.dump("hits sort"); 01886 #endif 01887 } 01888 */ 01889 //...Width cut... 01890 // for (unsigned i = 0; i < nL; i++) { 01891 // TSegment & s = * list[i]; 01892 // unsigned width = s.width(); 01893 // if (width > 2) badList.append(s); 01894 // } 01895 01896 // cout<<"stereoSegment: "<<list.length()<<" badList: "<<badList.length()<<endl; 01897 list.remove(badList); 01898 // cout<<"after remove bads: "<<list.length()<<endl; 01899 01900 #ifdef TRKRECO_DEBUG 01901 std::cout << " ... bad segments :" << std::endl; 01902 for (unsigned i = 0; i < badList.length(); i++) 01903 badList[i]->dump("hits sort", " "); 01904 #endif 01905 01906 return list; 01907 }
|
|
|
|
02801 { 02802 02803 AList<TSegment> output; 02804 for (unsigned i = 0; i < 6; i++) 02805 output.append(new TSegment()); 02806 02807 //...Calculate cross points... 02808 TPoint2D points[12]; 02809 int err = crossPoints(t, points); 02810 if (err) { 02811 #ifdef TRKRECO_DEBUG_DETAIL 02812 std::cout << "... conf::stereoSegBadHits : " 02813 << "error in calculation of intersection" << std::endl; 02814 #endif 02815 return output; 02816 } 02817 02818 static const TPoint2D O(0., 0.); 02819 unsigned nBad = _unused[2].length(); 02820 for (unsigned i = 0; i < nBad; i++) { 02821 unsigned sl = _unused[2][i]->wire()->superLayerId(); 02822 unsigned asl = _unused[2][i]->wire()->axialStereoLayerId()/4; 02823 unsigned as; 02824 if (_unused[2][i]->wire()->axial()) 02825 as = 0; 02826 else as = 1; 02827 // unsigned as = sl % 2; 02828 if (as == 0) continue; 02829 02830 float a = WIDTH[sl] * _salvageLoadWidth; 02831 float phi0 = points[sl].phi(); 02832 float phi1 = points[sl + 1].phi(); 02833 float phi = _unused[2][i]->position().phi(); 02834 if (phi < 0.) phi += PI2; 02835 if (phi1 < phi0) { 02836 phi1 = phi0; 02837 phi0 = points[sl + 1].phi(); 02838 } 02839 float dPhi = phi1 - phi0; 02840 if (dPhi < M_PI) { 02841 phi0 -= a; 02842 phi1 += a; 02843 if (phi > phi0 && phi < phi1) 02844 // output[sl / 2]->append(* _unused[2][i]); 02845 output[asl / 4]->append(* _unused[2][i]); 02846 } 02847 else { 02848 phi0 += a; 02849 phi1 -= a; 02850 if (phi < phi0 || phi > phi1) 02851 output[asl / 4]->append(* _unused[2][i]); 02852 } 02853 } 02854 02855 return output; 02856 }
|
|
returns T0 reset is done.
|
|
returns T0 reset is done.
00273 {
00274 return _T0ResetDone;
00275 }
|
|
|
|
02593 { 02594 AList<TMLink> targets; 02595 02596 //...Calculate cross points... 02597 TPoint2D points[12]; 02598 int err = crossPoints(t, points); 02599 if (err) { 02600 #ifdef TRKRECO_DEBUG 02601 std::cout << " ... no target found" << std::endl; 02602 #endif 02603 return targets; 02604 } 02605 02606 //...Pick up segments... 02607 AList<TMLink> toBeChecked = pickUpLinks(points, 3, 1); 02608 unsigned n = toBeChecked.length(); 02609 for (unsigned i = 0; i < n; i++) { 02610 if (toBeChecked[i]->wire()->superLayerId() == sl) 02611 targets.append(toBeChecked[i]); 02612 } 02613 02614 return targets; 02615 }
|
|
|
|
02568 { 02569 AList<TSegment> targets; 02570 02571 //...Calculate cross points... 02572 TPoint2D points[12]; 02573 int err = crossPoints(t, points); 02574 if (err) { 02575 #ifdef TRKRECO_DEBUG 02576 std::cout << " ... no target found" << std::endl; 02577 #endif 02578 return targets; 02579 } 02580 02581 //...Pick up segments... 02582 AList<TSegment> toBeChecked = pickUpSegments(points, 3, 1); 02583 unsigned n = toBeChecked.length(); 02584 for (unsigned i = 0; i < n; i++) { 02585 if (toBeChecked[i]->superLayerId() == sl) 02586 targets.append(toBeChecked[i]); 02587 } 02588 02589 return targets; 02590 }
|
|
|
|
02549 { 02550 inner = 11; 02551 outer = 11; 02552 bool innerFound = false; 02553 bool outerFound = false; 02554 for (unsigned i = 0; i < 5; i++) { //changed to BESIII,Liuqg 02555 unsigned fl[5] ={2, 3, 4, 9, 10}; 02556 if (! innerFound) { 02557 if (sl & (1 << (fl[i]))) innerFound = true; 02558 else inner = fl[i]; 02559 } 02560 if (! outerFound) { 02561 if (sl & (1 << (fl[4 - i]))) outerFound = true; 02562 else outer = fl[4 - i]; 02563 } 02564 } 02565 }
|
|
|
|
02670 { 02671 unsigned n1 = NSuperLayers(t.links()); 02672 unsigned n3 = NSuperLayers(t.links(), 2); 02673 02674 //...check # radius...Liuqg 02675 if(fabs(t.radius())<15.) return false; 02676 02677 #ifdef TRKRECO_WINDOW 02678 std::cout << "... trackQuality : n1,n3,nMissing=" << n1 << "," << n3; 02679 std::cout << "," << NMissingAxialSuperLayers(t.links()) << std::endl; 02680 #endif 02681 #ifdef TRKRECO_WINDOW 02682 displayStatus("trackQuality"); 02683 if ((n3 < 2) || (NMissingAxialSuperLayers(t.links()) > 1)) 02684 _rphiWindow.oneShot(t, leda_red); 02685 else 02686 _rphiWindow.oneShot(t, leda_green); 02687 #endif 02688 if (n3 < 2) return false; 02689 // if (NMissingAxialSuperLayers(t.links()) > 1) return false; 02690 02691 return true; 02692 }
|
|
|
|
|
|
02730 { 02731 static const TPoint2D o(0., 0.); 02732 TPoint2D c = t.center(); 02733 TPoint2D co = - c; 02734 02735 AList<TSegment> tmp; 02736 unsigned n = a.length(); 02737 for (unsigned i = 0; i < n; i++) { 02738 const AList<TMLink> & b = a[i]->links(); 02739 bool bad = false; 02740 unsigned nB = b.length(); 02741 for (unsigned j = 0; j < nB; j++) { 02742 TPoint2D x = b[j]->wire()->xyPosition(); 02743 if (co.cross(x - c) * t.charge() > 0.) { 02744 bad = true; 02745 break; 02746 } 02747 } 02748 if (bad) continue; 02749 tmp.append(a[i]); 02750 } 02751 return tmp; 02752 }
|
|
02713 { 02714 static const TPoint2D o(0., 0.); 02715 TPoint2D c = t.center(); 02716 TPoint2D co = - c; 02717 02718 AList<TMLink> tmp; 02719 unsigned n = a.length(); 02720 for (unsigned i = 0; i < n; i++) { 02721 TPoint2D x = a[i]->wire()->xyPosition(); 02722 if (co.cross(x - c) * t.charge() < 0.) 02723 tmp.append(a[i]); 02724 } 02725 return tmp; 02726 }
|
|
re-calculate TMLinks.
|
|
re-calculate TMLinks.
00785 { 00786 unsigned n = tracks.length(); 00787 for (unsigned i = 0; i < n; i++) { 00788 const AList<TMLink> & links = tracks[i]->links(); 00789 unsigned nL = links.length(); 00790 for (unsigned j = 0; j < nL; j++) { 00791 TMLink & l = * links[j]; 00792 tracks[i]->approach(l); 00793 } 00794 } 00795 }
|
|
returns version.
Implements TFinderBase. |
|
returns version.
Implements TFinderBase. 00055 { 00056 return "3.03"; 00057 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|