BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
TSegment Class Reference

A class to relate TMDCWireHit and TTrack objects. More...

#include <TSegment.h>

+ Inheritance diagram for TSegment:

Public Member Functions

 TSegment ()
 Constructor.
 
 TSegment (const AList< TMLink > &)
 
virtual ~TSegment ()
 Destructor.
 
virtual unsigned objectType (void) const
 returns type.
 
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
 
unsigned superLayerId () const
 returns super layer id.
 
const HepPoint3Dposition (void) const
 returns position.
 
const HepPoint3DouterPosition (void) const
 
const HepPoint3DlineTsf (void) const
 return line of Tsf for pos and dir
 
const HepPoint3DlineTsf (const HepPoint3D &)
 
const HepVector3Ddirection (void) const
 returns direction.
 
double distance (const TSegment &) const
 calculates distance between two clusters. Smaller value indicates closer.
 
double distance (const HepPoint3D &, const HepVector3D &) const
 
Range rangeX (double min, double max) const
 returns Range of x-coordinate of TMLinks.
 
const AList< TMLink > & inners (void) const
 returns TMLinks in inner/outer-most layer.
 
const AList< TMLink > & outers (void) const
 
const TMLinkcenter (void) const
 returns a TMLink which is the closest to the center.
 
unsigned width (void) const
 returns width.
 
unsigned innerWidth (void) const
 returns inner width.
 
unsigned outerWidth (void) const
 returns outer width.
 
unsigned innerMostLayer (void) const
 returns inner most layer.
 
unsigned outerMostLayer (void) const
 returns outer most layer.
 
unsigned clusterType (void) const
 returns cluster type. 0:empty, 1:short line, 2:long line, 3:V shage(from outside), 4:A shape, 5:X shape, 6:parallel, 7:complicated.
 
AList< TSegmentsplit (void) const
 returns a list of sub TSegments in this cluster. If cluster type is 1, 2, or 7, no cluster is returned.
 
AList< TSegmentsplitTsf (AList< TMLink > &)
 
int solveDualHits (void)
 
double duality (void) const
 
void solveLR (void)
 solve LR of hit in TSF.
 
void solveThreeHits (void)
 
AList< TTrack > & tracks (void)
 
AList< TSegment > & innerLinks (void)
 
const AList< TSegment > & innerLinks (void) const
 
AList< TSegment > & outerLinks (void)
 
const AList< TSegment > & outerLinks (void) const
 
unsigned state (void) const
 
unsigned state (unsigned)
 
- Public Member Functions inherited from TTrackBase
 TTrackBase ()
 Constructor.
 
 TTrackBase (const AList< TMLink > &links)
 Constructor.
 
virtual ~TTrackBase ()
 Destructor.
 
virtual unsigned objectType (void) const
 returns object type.
 
virtual unsigned type (void) const
 returns type. Definition is depending on an object class.
 
virtual void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
 
const AList< TMLink > & links (unsigned mask=0) const
 returns a list of masked TMLinks assigned to this track. 'mask' will be applied if mask is not 0.
 
unsigned nLinks (unsigned mask=0) const
 returns # of masked TMLinks assigned to this track object.
 
const AList< TMLink > & cores (unsigned mask=0) const
 returns a list of masked TMLinks for fit. 'mask' will be applied if mask is not 0.
 
unsigned nCores (unsigned mask=0) const
 returns # of masked TMLinks for fit. 'mask' will be applied if mask is not 0.
 
void update (void) const
 update cache.
 
void append (TMLink &)
 appends a TMLink.
 
void append (const AList< TMLink > &)
 appends TMLinks.
 
void appendByApproach (AList< TMLink > &list, double maxSigma)
 appends TMLinks by approach. 'list' is an input. Unappended TMLinks will be removed from 'list' when returned.
 
void appendByDistance (AList< TMLink > &list, double maxDistance)
 appends TMLinks by distance. 'list' is an input. Unappended TMLinks will be removed from 'list' when returned.
 
void remove (TMLink &a)
 removes a TMLink.
 
void remove (const AList< TMLink > &)
 removes TMLinks.
 
virtual void refine (AList< TMLink > &list, double maxSigma)
 removes bad points by pull. The bad points are removed from the track, and are returned in 'list'.
 
virtual void refine (double maxSigma)
 removes bad points by pull. The bad points are masked not to be used in fit.
 
virtual int DropWorst ()
 
virtual void removeLinks (void)
 
virtual double distance (const TMLink &) const
 returns distance to a position of TMLink in TMLink space.
 
virtual int approach (TMLink &) const
 calculates the closest approach to a wire in real space. Results are stored in TMLink. Return value is negative if error happened.
 
unsigned testByApproach (const TMLink &list, double sigma) const
 returns # of good hits to be appended.
 
unsigned testByApproach (const AList< TMLink > &list, double sigma) const
 
virtual int fit (void)
 fits itself by a default fitter. Error was happened if return value is not zero.
 
const TMFitter *const fitter (void) const
 returns a pointer to a default fitter.
 
const TMFitter *const fitter (const TMFitter *)
 sets a default fitter.
 
void falseFit ()
 false Fit
 
TMLinkoperator[] (unsigned i) const
 
const TTrackHEP *const hep (void) const
 returns TTrackHEP.
 
unsigned nHeps (void) const
 returns # of contributed TTrackHEP tracks.
 
const TTrackMC *const mc (void) const
 returns a pointer to TTrackMC.
 
bool fitted (void) const
 returns true if fitted.
 
bool fittedWithCathode (void) const
 returns true if fitted with cathode hits(TEMPORARY).
 

Additional Inherited Members

- Protected Attributes inherited from TTrackBase
AList< TMLink_links
 
bool _fitted
 
bool _fittedWithCathode
 
TTrackMC_mc
 

Detailed Description

A class to relate TMDCWireHit and TTrack objects.

Definition at line 43 of file TSegment.h.

Constructor & Destructor Documentation

◆ TSegment() [1/2]

TSegment::TSegment ( )

Constructor.

Definition at line 30 of file TSegment.cxx.

31: TTrackBase(),
32 _innerWidth(0),
33 _outerWidth(0),
34 _nLayer(0),
35 _clusterType(0),
36 _duality(0.),
37 _nDual(0),
38 _angle(0.),
39 _state(0),
40 _lineTsf(0.,0.,0.) {
41// _times = 4.0;
42// if (_links[0]->wire()->stereo()) _times = 7.0;
43 _times[0] = 7;
44 _times[1] = 7;
45 _times[2] = 4;
46 _times[3] = 4;
47 _times[4] = 4;
48 _times[5] = 5;
49 _times[6] = 5;
50 _times[7] = 5;
51 _times[8] = 5;
52 _times[9] = 4;
53 _times[10] = 4;
54 _fitted = false;
55}
bool _fitted
Definition: TTrackBase.h:162
TTrackBase()
Constructor.
Definition: TTrackBase.cxx:40

◆ TSegment() [2/2]

TSegment::TSegment ( const AList< TMLink > &  a)

Definition at line 57 of file TSegment.cxx.

58: TTrackBase(a),
59 _innerWidth(0),
60 _outerWidth(0),
61 _nLayer(0),
62 _clusterType(0),
63 _duality(0.),
64 _nDual(0),
65 _angle(0.),
66 _state(0),
67 _lineTsf(0.,0.,0.) {
68 _links.sort(SortByWireId);
69// _times = 4.0;
70// if (_links[0]->wire()->stereo()) _times = 7.0;
71 _times[0] = 7;
72 _times[1] = 7;
73 _times[2] = 4;
74 _times[3] = 4;
75 _times[4] = 4;
76 _times[5] = 5;
77 _times[6] = 5;
78 _times[7] = 5;
79 _times[8] = 5;
80 _times[9] = 4;
81 _times[10] = 4;
82 _fitted = false;
83} //the above two innitial function are temporary for tsf!!!
AList< TMLink > _links
Definition: TTrackBase.h:161

◆ ~TSegment()

TSegment::~TSegment ( )
virtual

Destructor.

Definition at line 112 of file TSegment.cxx.

112 {
113}

Member Function Documentation

◆ center()

const TMLink & TSegment::center ( void  ) const

returns a TMLink which is the closest to the center.

Referenced by rangeX(), and solveLR().

◆ clusterType()

unsigned TSegment::clusterType ( void  ) const
inline

returns cluster type. 0:empty, 1:short line, 2:long line, 3:V shage(from outside), 4:A shape, 5:X shape, 6:parallel, 7:complicated.

Definition at line 319 of file TSegment.h.

319 {
320 if (! nLinks()) return 0;
321 if (_clusterType == 0) updateType();
322 return _clusterType;
323}
unsigned nLinks(unsigned mask=0) const
returns # of masked TMLinks assigned to this track object.
Definition: TTrackBase.cxx:305

Referenced by dump(), and split().

◆ direction()

const HepVector3D & TSegment::direction ( void  ) const
inline

returns direction.

Definition at line 284 of file TSegment.h.

284 {
285 if (! _fitted) update();
286 return _direction;
287}

◆ distance() [1/2]

double TSegment::distance ( const HepPoint3D p,
const HepVector3D v 
) const

Definition at line 249 of file TSegment.cxx.

249 {
250 HepVector3D dir = _position - p;
251 if (dir.x() > M_PI) dir.setX(dir.x() - 2. * M_PI);
252 else if (dir.x() < - M_PI) dir.setX(2. * M_PI + dir.x());
253
254 float radial = fabs(v.unit().dot(dir));
255 float radial2 = radial * radial;
256
257 return (dir.mag2() - radial2) > 0.0 ? sqrt(dir.mag2() - radial2) : 0.;
258}
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition: KarLud.h:35
#define M_PI
Definition: TConstant.h:4

◆ distance() [2/2]

double TSegment::distance ( const TSegment c) const

calculates distance between two clusters. Smaller value indicates closer.

Definition at line 237 of file TSegment.cxx.

237 {
238 HepVector3D dir = c.position() - _position;
239 if (dir.x() > M_PI) dir.setX(dir.x() - 2. * M_PI);
240 else if (dir.x() < - M_PI) dir.setX(2. * M_PI + dir.x());
241
242 float radial = fabs(_direction.dot(dir));
243 float radial2 = radial * radial;
244
245 return (dir.mag2() - radial2) > 0.0 ? sqrt(dir.mag2() - radial2) : 0.;
246}
const HepPoint3D & position(void) const
returns position.
Definition: TSegment.h:277

Referenced by solveDualHits().

◆ duality()

double TSegment::duality ( void  ) const
inline

Definition at line 327 of file TSegment.h.

327 {
328 return _duality;
329}

◆ dump()

void TSegment::dump ( const std::string &  message = std::string(""),
const std::string &  prefix = std::string("") 
) const
virtual

dumps debug information.

Reimplemented from TTrackBase.

Definition at line 116 of file TSegment.cxx.

116 {
117 if (! _fitted) update();
118 bool def = false;
119 if (msg == "") def = true;
120
121 if (def || msg.find("cluster") != std::string::npos || msg.find("detail") != std::string::npos) {
122 std::cout << pre;
123 std::cout << "#links=" << _links.length();
124 std::cout << "(" << _innerWidth << "," << _outerWidth << ":";
125 std::cout << clusterType() << ")," << _nDual << "," << _duality << ",";
126 std::cout << _angle << std::endl;
127 }
128 if (def || msg.find("vector") != std::string::npos || msg.find("detail") != std::string::npos) {
129 std::cout << pre;
130 std::cout << "pos" << _position << "," << "dir" << _direction;
131 std::cout << std::endl;
132 }
133 if (def || msg.find("state") != std::string::npos || msg.find("detail") != std::string::npos) {
134 std::cout << pre;
135 std::cout << "state=" << _state << std::cout << std::endl;
136 }
137 if (def || msg.find("link") != std::string::npos || msg.find("detail") != std::string::npos) {
138 std::cout << pre;
139 std::cout << "unique links=" << NUniqueLinks(* this);
140 std::cout << ",major links=" << NMajorLinks(* this);
141 std::cout << ",branches=" << NLinkBranches(* this);
142 std::cout << std::endl;
143 }
144 if (! def) TTrackBase::dump(msg, pre);
145}
unsigned NMajorLinks(const TSegment &a)
returns # of links in the major link.
Definition: TSegment.cxx:1005
unsigned NUniqueLinks(const TSegment &a)
checks property of segments.
Definition: TSegment.cxx:978
unsigned NLinkBranches(const TSegment &a)
returns # of link branches in the major link.
Definition: TSegment.cxx:1048
unsigned clusterType(void) const
returns cluster type. 0:empty, 1:short line, 2:long line, 3:V shage(from outside),...
Definition: TSegment.h:319
virtual void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
Definition: TTrackBase.cxx:58

Referenced by THistogram::segments(), solveDualHits(), and superLayerId().

◆ innerLinks() [1/2]

AList< TSegment > & TSegment::innerLinks ( void  )
inline

Definition at line 366 of file TSegment.h.

366 {
367 return _innerLinks;
368}

◆ innerLinks() [2/2]

const AList< TSegment > & TSegment::innerLinks ( void  ) const
inline

Definition at line 372 of file TSegment.h.

372 {
373 return _innerLinks;
374}

◆ innerMostLayer()

unsigned TSegment::innerMostLayer ( void  ) const
inline

returns inner most layer.

Definition at line 305 of file TSegment.h.

305 {
306 if (! _fitted) update();
307 return _innerMostLayer;
308}

Referenced by width().

◆ inners()

const AList< TMLink > & TSegment::inners ( void  ) const
inline

returns TMLinks in inner/outer-most layer.

Definition at line 263 of file TSegment.h.

263 {
264 if (! _fitted) update();
265 return _inners;
266}

◆ innerWidth()

unsigned TSegment::innerWidth ( void  ) const
inline

returns inner width.

Definition at line 291 of file TSegment.h.

291 {
292 if (! _fitted) update();
293 return _innerWidth;
294}

◆ lineTsf() [1/2]

const HepPoint3D & TSegment::lineTsf ( const HepPoint3D a)
inline

Definition at line 409 of file TSegment.h.

409 {
410 return _lineTsf = a;
411}

◆ lineTsf() [2/2]

const HepPoint3D & TSegment::lineTsf ( void  ) const
inline

return line of Tsf for pos and dir

Definition at line 403 of file TSegment.h.

403 {
404 return _lineTsf;
405}

◆ objectType()

unsigned TSegment::objectType ( void  ) const
inlinevirtual

returns type.

Reimplemented from TTrackBase.

Definition at line 333 of file TSegment.h.

333 {
334 return Segment;
335}
#define Segment
Definition: TTrackBase.h:31

◆ outerLinks() [1/2]

AList< TSegment > & TSegment::outerLinks ( void  )
inline

Definition at line 378 of file TSegment.h.

378 {
379 return _outerLinks;
380}

Referenced by OuterMostUniqueLink().

◆ outerLinks() [2/2]

const AList< TSegment > & TSegment::outerLinks ( void  ) const
inline

Definition at line 384 of file TSegment.h.

384 {
385 return _outerLinks;
386}

◆ outerMostLayer()

unsigned TSegment::outerMostLayer ( void  ) const
inline

returns outer most layer.

Definition at line 312 of file TSegment.h.

312 {
313 if (! _fitted) update();
314 return _outerMostLayer;
315}

Referenced by width().

◆ outerPosition()

const HepPoint3D & TSegment::outerPosition ( void  ) const

◆ outers()

const AList< TMLink > & TSegment::outers ( void  ) const
inline

Definition at line 270 of file TSegment.h.

270 {
271 if (! _fitted) update();
272 return _outers;
273}

Referenced by solveDualHits().

◆ outerWidth()

unsigned TSegment::outerWidth ( void  ) const
inline

returns outer width.

Definition at line 298 of file TSegment.h.

298 {
299 if (! _fitted) update();
300 return _outerWidth;
301}

◆ position()

const HepPoint3D & TSegment::position ( void  ) const
inline

returns position.

Definition at line 277 of file TSegment.h.

277 {
278 if (! _fitted) update();
279 return _position;
280}

Referenced by distance().

◆ rangeX()

Range TSegment::rangeX ( double  min,
double  max 
) const

returns Range of x-coordinate of TMLinks.

Definition at line 261 of file TSegment.cxx.

261 {
262#ifdef TRKRECO_DEBUG_DETAIL
263 if (min > max) {
264 std::cout << "TSegment::range !!! bad arguments:min,max=";
265 std::cout << min << "," << max << std::endl;
266 }
267#endif
268
269 unsigned n = _links.length();
270 if (n == 0) return Range(0., 0.);
271
272 //...Search for a center...
273 bool found = false;
274 double center;
275 for (unsigned i = 0; i < n; i++) {
276 double x = _links[i]->position().x();
277 if (x < min || x > max) continue;
278 center = x;
279 found = true;
280 break;
281 }
282 if (! found) return Range(0., 0.);
283
284#ifdef TRKRECO_DEBUG_DETAIL
285// std::cout << " center=" << center << std::endl;
286#endif
287
288 double distanceR = 0.;
289 double distanceL = 0.;
290 double distanceMax = max - min;
291 for (unsigned i = 0; i < n; i++) {
292 double x = _links[i]->position().x();
293 if (x < min || x > max) continue;
294
295 double distance0, distance1;
296 if (x > center) {
297 distance0 = x - center;
298 distance1 = distanceMax - distance0;
299 }
300 else {
301 distance1 = center - x;
302 distance0 = distanceMax - distance1;
303 }
304
305 if (distance0 < distance1) {
306 if (distance0 > distanceR) distanceR = distance0;
307 }
308 else {
309 if (distance1 > distanceL) distanceL = distance1;
310 }
311
312#ifdef TRKRECO_DEBUG_DETAIL
313// std::cout << " ";
314// std::cout << _links[i]->wire()->layerId() << "-";
315// std::cout << _links[i]->wire()->localId() << ",";
316// std::cout << _links[i]->position().x();
317// std::cout << ",0,1=" << distance0 << "," << distance1;
318// std::cout << ",l,r=" << distanceL << "," << distanceR;
319// std::cout << std::endl;
320#endif
321 }
322
323 double right = center + distanceR;
324 double left = center - distanceL;
325
326 return Range(left, right);
327}
const Int_t n
Double_t x[10]
to specify 1-dim region or range by two floats
Definition: Range.h:19
const TMLink & center(void) const
returns a TMLink which is the closest to the center.

◆ solveDualHits()

int TSegment::solveDualHits ( void  )

Definition at line 736 of file TSegment.cxx.

736 {
737 updateType();
738 if (_clusterType == 0) return 0;
739 if (_nDual == 0) return 0;
740 update();
741 return 0;
742
743 updateType();
744 if (_clusterType == 0) return 0;
745 if (_nDual == 0) return 0;
746
747 AList<TMLink> seeds;
748 AList<TMLink> duals;
749 for (unsigned i = _innerMostLayer; i <= _outerMostLayer; i++) {
750 AList<TMLink> list = SameLayer(_links, i);
751
752 if (list.length() == 1) {
753 seeds.append(list[0]);
754 }
755 else if (list.length() == 2) {
756 if (Width(list) > 1) {
757 const TMDCWireHit * h0 = list[0]->hit();
758 const TMDCWireHit * h1 = list[1]->hit();
759 double distance = (h0->xyPosition() - h1->xyPosition()).mag();
760 distance = fabs(distance -
761 list[0]->drift() -
762 list[1]->drift());
763 if (distance > 0.5) duals.append(list);
764#ifdef TRKRECO_DEBUG_DETAIL
765 h0->dump("", " ");
766 h1->dump("", " ");
767 std::cout << " lyr=" << i;
768 std::cout << ", duality distance = " << distance << std::endl;
769#endif
770 }
771 }
772 else if (list.length() == 0) {
773 continue;
774 }
775#ifdef TRKRECO_DEBUG_DETAIL
776 else {
777 std::cout << "TSegment::solveDualHits !!! this is not expected 2";
778 std::cout << std::endl;
779 this->dump("cluster hits mc", " ");
780 }
781#endif
782 }
783
784 //...Solve them...
785 if (seeds.length() < 2) return -1;
786 AList<TMLink> outers = InOut(seeds);
787 const HepPoint3D & p = outers[0]->xyPosition();
788 HepVector3D v = (outers[1]->xyPosition() - p).unit();
789 unsigned n = duals.length() / 2;
790 for (unsigned i = 0; i < n; i++) {
791 TMLink * t0 = duals[i * 2 + 0];
792 TMLink * t1 = duals[i * 2 + 1];
793 HepVector3D x0 = t0->xyPosition() - p;
794 HepVector3D x1 = t1->xyPosition() - p;
795 double d0 = (x0 - (x0.dot(v) * v)).mag();
796 double d1 = (x1 - (x1.dot(v) * v)).mag();
797 if (d0 < d1) _links.remove(t1);
798 else _links.remove(t0);
799 }
800 update();
801 return n;
802}
*******INTEGER m_nBinMax INTEGER m_NdiMax !No of bins in histogram for cell exploration division $ !Last vertex $ !Last active cell $ !Last cell in buffer $ !No of sampling when dividing cell $ !No of function total $ !Flag for random ceel for $ !Flag for type of for WtMax $ !Flag which decides whether vertices are included in the sampling $ entire domain is hyp !Maximum effective eevents per saves r n generator level $ !Flag for chat level in !Latex Output unit
Definition: FoamA.h:90
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
Definition: TMDCWireHit.cxx:64
const HepPoint3D & xyPosition(void) const
returns drift time
Definition: TMDCWireHit.h:262
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
Definition: TSegment.cxx:116
const AList< TMLink > & outers(void) const
Definition: TSegment.h:270
double distance(const TSegment &) const
calculates distance between two clusters. Smaller value indicates closer.
Definition: TSegment.cxx:237

Referenced by THistogram::segments().

◆ solveLR()

void TSegment::solveLR ( void  )

solve LR of hit in TSF.

Definition at line 1604 of file TSegment.cxx.

1604 {
1605 unsigned n = _links.length();
1606 //initial...
1607 if (n <= 3) {
1609 return;
1610 }
1611 for (int i = 0; i < n; ++i) {
1612 TMLink *l = _links[i];
1613 if (l->hit()->state() & WireHitPatternRight){
1614 unsigned newState = l->hit()->state()&(~WireHitPatternRight);
1615 l->hit()->state(newState);
1616 }
1617 if (l->hit()->state() & WireHitPatternLeft){
1618 unsigned newState = l->hit()->state()&(~WireHitPatternLeft);
1619 l->hit()->state(newState);
1620 }
1621 }
1622
1623 HepPoint3D originCon(0., 0., 0.);
1624 HepPoint3D dirZ(0., 0., 1.);
1625 HepPoint3D center = closestPoint(originCon, _lineTsf);
1626 HepPoint3D v1 = (center - originCon).unit();
1627 HepPoint3D v2 = dirZ.cross(v1);
1628 for (int i = 0; i < n; ++i) {
1629// cout<<"layerId: "<<_links[i]->wire()->layerId()<<" localId: "<<_links[i]->wire()->localId()<<endl;
1630 const HepPoint3D & p = _links[i]->positionD();
1631 unsigned state = _links[i]->hit()->state();
1632
1633 double cosA = (p - center).unit().dot(v1.unit());
1634 double cosB = (p - center).unit().dot(v2.unit());
1635 if (cosA*cosB < 0) state |= WireHitPatternLeft;
1636 else state |= WireHitPatternRight;
1637
1638 _links[i]->hit()->state(state);
1639 }
1640}
#define WireHitPatternLeft
Definition: TMDCWireHit.h:33
#define WireHitPatternRight
Definition: TMDCWireHit.h:34
unsigned state(void) const
returns state.
Definition: TMDCWireHit.h:230
void solveThreeHits(void)
Definition: TSegment.cxx:1658
unsigned state(void) const
Definition: TSegment.h:390

◆ solveThreeHits()

void TSegment::solveThreeHits ( void  )

Definition at line 1658 of file TSegment.cxx.

1658 {
1659 unsigned n = _links.length();
1660
1661 for (unsigned i = 0; i < n; i++) {
1662 const TMDCWireHit * h = _links[i]->hit();
1663 const TMDCWire * w = h->wire();
1664 unsigned state = h->state();
1665
1666 //...Cache pointers to a neighbor...
1667 const TMDCWire * neighbor[6];
1668 for (unsigned j = 0; j < 6; j++) neighbor[j] = w->neighbor(j);
1669
1670 //...Decide hit pattern...
1671 unsigned pattern = 0;
1672 for (unsigned j = 0; j < 6; j++) {
1673 if (neighbor[j])
1674 if (neighbor[j]->hit())
1675 pattern += (1 << j);
1676 }
1677 state |= (pattern << WireHitNeighborHit);
1678
1679 //...Solve LR locally...
1680 if ((pattern == 34) || (pattern == 42) ||
1681 (pattern == 40) || (pattern == 10) ||
1682 (pattern == 35) || (pattern == 50))
1684 else if ((pattern == 17) || (pattern == 21) ||
1685 (pattern == 20) || (pattern == 5) ||
1686 (pattern == 19) || (pattern == 49))
1688
1689 //...Store it...
1690 h->state(state);
1691 }
1692}
#define WireHitNeighborHit
Definition: TMDCWireHit.h:37
const TMDCWire *const wire(void) const
returns a pointer to a TMDCWire.
Definition: TMDCWireHit.h:218
A class to represent a wire in MDC.
Definition: TMDCWire.h:55

Referenced by solveLR().

◆ split()

AList< TSegment > TSegment::split ( void  ) const

returns a list of sub TSegments in this cluster. If cluster type is 1, 2, or 7, no cluster is returned.

Definition at line 388 of file TSegment.cxx.

388 {
389 AList<TSegment> list;
390
391 //...Do not split if cluster type is 1, 2, or 7...
392 unsigned t = clusterType();
393#ifdef TRKRECO_DEBUG_DETAIL
394 std::cout << " ... splitting : type=" << t << std::endl;
395#endif
396 if (t == 0) return list;
397 else if (t == 2) {
398 // beta 5
399 //if (_nDual > 2 && _duality > 0.7 && _angle > 0.7) return splitDual();
400
401 // 1.67g
402 // if (_nDual > 2 && _duality > 0.7) return splitDual();
403
404 if (_nDual > 2 && _duality > 0.7 && _angle > 0.7) return splitDual();
405 return list;
406 }
407 else if (t == 1) return list;
408 else if (t == 7) return list;
409
410 //...Parallel...
411 else if (t == 6) return splitParallel();
412 // else if (t == 6) return list;
413
414 //...Avoid splitting of X or parallel...(future implementation)...
415 else if (t > 4) return splitComplicated();
416
417 //...A or V...
418 return splitAV();
419}
TTree * t
Definition: binning.cxx:23

Referenced by THistogram::segments().

◆ splitTsf()

AList< TSegment > TSegment::splitTsf ( AList< TMLink > &  seedNeighbors)

Definition at line 1134 of file TSegment.cxx.

1134 {
1135 //get links in each layer.
1136 AList<TSegment> list;
1137 AList<TMLink> links[4]; //links in each local layer.
1138 AList<TMLink> seeds2; //links in the outer layer.
1139 AList<TMLink> exTsf; //links in other local layers.
1140 TMLink *seed; //link in the mostinner layer.
1141
1142 for (unsigned i = 0; i < _links.length(); ++i) {
1143 TMLink * l = _links[i];
1144 links[l->wire()->localLayerId()].append(l);
1145 }
1146
1147 //prepare for segment finding.
1148 if (links[0].length() == 0) { //find in 234.
1149 if (links[3].length() == 0) return list;
1150 if (links[1].length() != 1) {
1151 cout<<"wrong in tsf, TSegment::splitTsf ...1"<<endl;
1152 return list;
1153 }
1154 seed = links[1][0];
1155 seeds2.append(links[3]);
1156 exTsf.append(links[2]);
1157 }
1158 else if (links[0].length() == 1) { //find in 1234, 124, 134, 123.
1159 seed = links[0][0];
1160 if (links[3].length() > 0) { //1..4
1161 seeds2.append(links[3]);
1162 exTsf.append(links[1]);
1163 exTsf.append(links[2]);
1164 }
1165 else if (links[2].length() > 0) { //1..3
1166 seeds2.append(links[2]);
1167 exTsf.append(links[1]);
1168 }
1169 else return list;
1170 }
1171 else cout<<"wrong in tsf, TSegment::splitTsf ...2"<<endl;
1172 exTsf.append(seeds2); //add the outer layer...
1173
1174 //find segments
1175 for (unsigned i = 0; i < seeds2.length(); ++i) {
1176 if (seed->tsfTag() > 0 && seeds2[i]->tsfTag() > 0) continue;
1177 AList<TSegment> segments;
1178 HepPoint3D line[4];
1179 fitLine(seed, seeds2[i], line);
1180 segments = appendByLine(seed, seeds2[i], seedNeighbors, exTsf, line);
1181 list.append(segments);
1182 segments.removeAll();
1183 }
1184 if (seed->wire()->localLayerId() == 0) { //for 123
1185 exTsf.removeAll();
1186 seeds2.removeAll();
1187 exTsf.append(links[1]);
1188 exTsf.append(links[2]); //add the outer layer...
1189 for (int k = 0; k < links[2].length(); ++k){
1190 if (links[2][k]->tsfTag() == 0) seeds2.append(links[2][k]);
1191 }
1192 for (unsigned i = 0; i < seeds2.length(); ++i) {
1193 if (seed->tsfTag() > 0 && seeds2[i]->tsfTag() > 0) continue;
1194 AList<TSegment> segments2;
1195 HepPoint3D line2[4];
1196 fitLine(seed, seeds2[i], line2);
1197 segments2 = appendByLine(seed, seeds2[i], seedNeighbors, exTsf, line2);
1198 list.append(segments2);
1199 segments2.removeAll();
1200 }
1201 }
1202
1203 return list;
1204}
unsigned localLayerId(void) const
returns local layer id in a super layer.
Definition: TMDCWire.h:231
const AList< TMLink > & links(unsigned mask=0) const
returns a list of masked TMLinks assigned to this track. 'mask' will be applied if mask is not 0.
Definition: TTrackBase.cxx:297

Referenced by TMDCTsf::segments().

◆ state() [1/2]

unsigned TSegment::state ( unsigned  a)
inline

Definition at line 396 of file TSegment.h.

396 {
397 return _state = a;
398}

◆ state() [2/2]

unsigned TSegment::state ( void  ) const
inline

Definition at line 390 of file TSegment.h.

390 {
391 return _state;
392}

Referenced by solveLR(), and solveThreeHits().

◆ superLayerId()

unsigned TSegment::superLayerId ( void  ) const
inline

returns super layer id.

Definition at line 339 of file TSegment.h.

339 {
340 unsigned id = (links())[0]->wire()->superLayerId();
341#ifdef TRKRECO_DEBUG
342 {
343 const AList<TMLink> & list = links();
344 unsigned n = list.length();
345 for (unsigned i = 1; i < n; i++) {
346 if (list[i]->hit()->wire()->superLayerId() != id) {
347 std::cout << "TSegment::superLayerId !!! strange segment found";
348 std::cout << std::endl;
349 dump();
350 break;
351 }
352 }
353 }
354#endif
355 return id;
356}
unsigned superLayerId() const
returns super layer id.
Definition: TSegment.h:339

Referenced by superLayerId().

◆ tracks()

AList< TTrack > & TSegment::tracks ( void  )
inline

Definition at line 360 of file TSegment.h.

360 {
361 return _tracks;
362}

Referenced by TBuilder::buildRphi(), TBuilder::buildStereo(), and TBuilder::buildStereoNew().

◆ width()

unsigned TSegment::width ( void  ) const

returns width.

Definition at line 1101 of file TSegment.cxx.

1101 {
1102 unsigned maxWidth = 0;
1103 for (unsigned i = innerMostLayer(); i <= outerMostLayer(); i++) {
1104 AList<TMLink> tmp = SameLayer(links(), i);
1105 unsigned w = Width(tmp);
1106 if (w > maxWidth) maxWidth = w;
1107 }
1108 return maxWidth;
1109}
unsigned innerMostLayer(void) const
returns inner most layer.
Definition: TSegment.h:305
unsigned outerMostLayer(void) const
returns outer most layer.
Definition: TSegment.h:312

The documentation for this class was generated from the following files: