BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
TSegment0 Class Reference

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

#include <TSegment0.h>

+ Inheritance diagram for TSegment0:

Public Member Functions

 TSegment0 ()
 Constructor.
 
 TSegment0 (const AList< TMLink > &)
 
virtual ~TSegment0 ()
 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 HepVector3Ddirection (void) const
 returns direction.
 
double distance (const TSegment0 &) 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.
 
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< TSegment0split (void) const
 returns a list of sub TSegments in this cluster. If cluster type is 1, 2, or 7, no cluster is returned.
 
int solveDualHits (void)
 
double duality (void) const
 
AList< TTrack > & tracks (void)
 
AList< TSegment0 > & innerLinks (void)
 
- Public Member Functions inherited from TTrackBase
 TTrackBase ()
 Constructor.
 
 TTrackBase (const AList< TMLink > &links)
 Constructor.
 
virtual ~TTrackBase ()
 Destructor.
 
virtual unsigned type (void) const
 returns type. Definition is depending on an object class.
 
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 41 of file TSegment0.h.

Constructor & Destructor Documentation

◆ TSegment0() [1/2]

TSegment0::TSegment0 ( )

Constructor.

Definition at line 22 of file TSegment0.cxx.

23: TTrackBase(),
24 _innerWidth(0),
25 _outerWidth(0),
26 _nLayer(0),
27 _clusterType(0),
28 _duality(0.),
29 _nDual(0),
30 _angle(0.) {
31 _fitted = false;
32}
TTrackBase()
Constructor.

◆ TSegment0() [2/2]

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

Definition at line 34 of file TSegment0.cxx.

35: TTrackBase(a),
36 _innerWidth(0),
37 _outerWidth(0),
38 _nLayer(0),
39 _clusterType(0),
40 _duality(0.),
41 _nDual(0),
42 _angle(0.) {
43 _links.sort(SortByWireId);
44 _fitted = false;
45}
AList< TMLink > _links
Definition TTrackBase.h:161

◆ ~TSegment0()

TSegment0::~TSegment0 ( )
virtual

Destructor.

Definition at line 47 of file TSegment0.cxx.

47 {
48}

Member Function Documentation

◆ clusterType()

unsigned TSegment0::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 214 of file TSegment0.h.

214 {
215 if (! nLinks()) return 0;
216 if (_clusterType == 0) updateType();
217 return _clusterType;
218}
unsigned nLinks(unsigned mask=0) const
returns # of masked TMLinks assigned to this track object.

Referenced by dump(), TConformalFinder0::findClusters2(), and split().

◆ direction()

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

returns direction.

Definition at line 179 of file TSegment0.h.

179 {
180 if (! _fitted) update();
181 return _direction;
182}

◆ distance() [1/2]

double TSegment0::distance ( const HepPoint3D & p,
const HepVector3D & v ) const

Definition at line 143 of file TSegment0.cxx.

143 {
144 HepVector3D dir = _position - p;
145 if (dir.x() > M_PI) dir.setX(dir.x() - 2. * M_PI);
146 else if (dir.x() < - M_PI) dir.setX(2. * M_PI + dir.x());
147
148 float radial = fabs(v.unit().dot(dir));
149 float radial2 = radial * radial;
150
151 return (dir.mag2() - radial2) > 0.0 ? sqrt(dir.mag2() - radial2) : 0.;
152}
**********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 TSegment0::distance ( const TSegment0 & c) const

calculates distance between two clusters. Smaller value indicates closer.

Definition at line 131 of file TSegment0.cxx.

131 {
132 HepVector3D dir = c.position() - _position;
133 if (dir.x() > M_PI) dir.setX(dir.x() - 2. * M_PI);
134 else if (dir.x() < - M_PI) dir.setX(2. * M_PI + dir.x());
135
136 float radial = fabs(_direction.dot(dir));
137 float radial2 = radial * radial;
138
139 return (dir.mag2() - radial2) > 0.0 ? sqrt(dir.mag2() - radial2) : 0.;
140}
const HepPoint3D & position(void) const
returns position.
Definition TSegment0.h:172

Referenced by solveDualHits().

◆ duality()

double TSegment0::duality ( void ) const
inline

Definition at line 222 of file TSegment0.h.

222 {
223 return _duality;
224}

◆ dump()

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

dumps debug information.

Reimplemented from TTrackBase.

Definition at line 51 of file TSegment0.cxx.

51 {
52 if (! _fitted) update();
53 bool def = false;
54 if (msg == "") def = true;
55
56 if (def || msg.find("cluster") != std::string::npos || msg.find("detail") != std::string::npos) {
57 std::cout << pre;
58 std::cout << "#links=" << _links.length();
59 std::cout << "(" << _innerWidth << "," << _outerWidth << ":";
60 std::cout << clusterType() << ")," << _nDual << "," << _duality << ",";
61 std::cout << _angle << std::endl;
62 }
63 if (def || msg.find("vector") != std::string::npos || msg.find("detail") != std::string::npos) {
64 std::cout << pre;
65 std::cout << "pos" << _position << "," << "dir" << _direction;
66 std::cout << std::endl;
67 }
68 if (! def) TTrackBase::dump(msg, pre);
69}
unsigned clusterType(void) const
returns cluster type. 0:empty, 1:short line, 2:long line, 3:V shage(from outside),...
Definition TSegment0.h:214
virtual void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.

Referenced by TConformalFinder0::findClusters(), TConformalFinder0::findClusters2(), THistogram::segments0(), solveDualHits(), and superLayerId().

◆ innerLinks()

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

Definition at line 261 of file TSegment0.h.

261 {
262 return _innerLinks;
263}

◆ innerMostLayer()

unsigned TSegment0::innerMostLayer ( void ) const
inline

returns inner most layer.

Definition at line 200 of file TSegment0.h.

200 {
201 if (! _fitted) update();
202 return _innerMostLayer;
203}

◆ innerWidth()

unsigned TSegment0::innerWidth ( void ) const
inline

returns inner width.

Definition at line 186 of file TSegment0.h.

186 {
187 if (! _fitted) update();
188 return _innerWidth;
189}

◆ objectType()

unsigned TSegment0::objectType ( void ) const
inlinevirtual

returns type.

Reimplemented from TTrackBase.

Definition at line 228 of file TSegment0.h.

228 {
229 return Segment;
230}
#define Segment
Definition TTrackBase.h:31

◆ outerMostLayer()

unsigned TSegment0::outerMostLayer ( void ) const
inline

returns outer most layer.

Definition at line 207 of file TSegment0.h.

207 {
208 if (! _fitted) update();
209 return _outerMostLayer;
210}

◆ outerWidth()

unsigned TSegment0::outerWidth ( void ) const
inline

returns outer width.

Definition at line 193 of file TSegment0.h.

193 {
194 if (! _fitted) update();
195 return _outerWidth;
196}

◆ position()

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

returns position.

Definition at line 172 of file TSegment0.h.

172 {
173 if (! _fitted) update();
174 return _position;
175}

Referenced by distance().

◆ rangeX()

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

returns Range of x-coordinate of TMLinks.

Definition at line 155 of file TSegment0.cxx.

155 {
156#ifdef TRKRECO_DEBUG_DETAIL
157 if (min > max) {
158 std::cout << "TSegment0::range !!! bad arguments:min,max=";
159 std::cout << min << "," << max << std::endl;
160 }
161#endif
162
163 unsigned n = _links.length();
164 if (n == 0) return Range(0., 0.);
165
166 //...Search for a center...
167 bool found = false;
168 double center;
169 for (unsigned i = 0; i < n; i++) {
170 double x = _links[i]->position().x();
171 if (x < min || x > max) continue;
172 center = x;
173 found = true;
174 break;
175 }
176 if (! found) return Range(0., 0.);
177
178#ifdef TRKRECO_DEBUG_DETAIL
179// std::cout << " center=" << center << std::endl;
180#endif
181
182 double distanceR = 0.;
183 double distanceL = 0.;
184 double distanceMax = max - min;
185 for (unsigned i = 0; i < n; i++) {
186 double x = _links[i]->position().x();
187 if (x < min || x > max) continue;
188
189 double distance0, distance1;
190 if (x > center) {
191 distance0 = x - center;
192 distance1 = distanceMax - distance0;
193 }
194 else {
195 distance1 = center - x;
196 distance0 = distanceMax - distance1;
197 }
198
199 if (distance0 < distance1) {
200 if (distance0 > distanceR) distanceR = distance0;
201 }
202 else {
203 if (distance1 > distanceL) distanceL = distance1;
204 }
205
206#ifdef TRKRECO_DEBUG_DETAIL
207// std::cout << " ";
208// std::cout << _links[i]->wire()->layerId() << "-";
209// std::cout << _links[i]->wire()->localId() << ",";
210// std::cout << _links[i]->position().x();
211// std::cout << ",0,1=" << distance0 << "," << distance1;
212// std::cout << ",l,r=" << distanceL << "," << distanceR;
213// std::cout << std::endl;
214#endif
215 }
216
217 double right = center + distanceR;
218 double left = center - distanceL;
219
220 return Range(left, right);
221}
const Int_t n
Double_t x[10]
to specify 1-dim region or range by two floats
Definition Range.h:19

◆ solveDualHits()

int TSegment0::solveDualHits ( void )

Definition at line 624 of file TSegment0.cxx.

624 {
625 updateType();
626 if (_clusterType == 0) return 0;
627 if (_nDual == 0) return 0;
628
629 AList<TMLink> seeds;
630 AList<TMLink> duals;
631 for (unsigned i = _innerMostLayer; i <= _outerMostLayer; i++) {
632 AList<TMLink> list = SameLayer(_links, i);
633
634 if (list.length() == 1) {
635 seeds.append(list[0]);
636 }
637 else if (list.length() == 2) {
638 if (Width(list) > 1) {
639 const TMDCWireHit * h0 = list[0]->hit();
640 const TMDCWireHit * h1 = list[1]->hit();
641 double distance = (h0->xyPosition() - h1->xyPosition()).mag();
642 distance = fabs(distance - h0->drift() - h1->drift());
643 if (distance > 0.5) duals.append(list);
644#ifdef TRKRECO_DEBUG_DETAIL
645// h0->dump();
646// h1->dump();
647// std::cout << "duality distance = " << distance << std::endl;
648// std::cout << "i = " << i << std::endl;
649#endif
650 }
651 }
652 else if (list.length() == 0) {
653 continue;
654 }
655#ifdef TRKRECO_DEBUG_DETAIL
656 else {
657 std::cout << "TSegment0::solveDualHits !!! this is not expected 2";
658 std::cout << std::endl;
659 this->dump("cluster hits mc", " ");
660 }
661#endif
662 }
663
664 //...Solve them...
665 if (seeds.length() < 2) return -1;
666 AList<TMLink> outers = InOut(seeds);
667 const HepPoint3D & p = outers[0]->xyPosition();
668 HepVector3D v = (outers[1]->xyPosition() - p).unit();
669 unsigned n = duals.length() / 2;
670 for (unsigned i = 0; i < n; i++) {
671 TMLink * t0 = duals[i * 2 + 0];
672 TMLink * t1 = duals[i * 2 + 1];
673 HepVector3D x0 = t0->xyPosition() - p;
674 HepVector3D x1 = t1->xyPosition() - p;
675 double d0 = (x0 - (x0.dot(v) * v)).mag();
676 double d1 = (x1 - (x1.dot(v) * v)).mag();
677 if (d0 < d1) _links.remove(t1);
678 else _links.remove(t0);
679 }
680 return n;
681}
float drift(unsigned) const
returns drift distance.
const HepPoint3D & xyPosition(void) const
returns drift time
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
Definition TSegment0.cxx:51
double distance(const TSegment0 &) const
calculates distance between two clusters. Smaller value indicates closer.

Referenced by TConformalFinder0::findClusters(), TConformalFinder0::findClusters2(), and THistogram::segments0().

◆ split()

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

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

Definition at line 281 of file TSegment0.cxx.

281 {
282 AList<TSegment0> list;
283
284 //...Do not split if cluster type is 1, 2, or 7...
285 unsigned t = clusterType();
286#ifdef TRKRECO_DEBUG_DETAIL
287 std::cout << " ... splitting : type=" << t << std::endl;
288#endif
289 if (t == 0) return list;
290 else if (t == 2) {
291 // beta 5 if (_nDual > 2 && _duality > 0.7 && _angle > 0.7)
292 // return splitDual();
293 if (_nDual > 2 && _duality > 0.7) return splitDual();
294 return list;
295 }
296 else if (t == 1) return list;
297 else if (t == 7) return list;
298
299 //...Parallel...
300 else if (t == 6) return splitParallel();
301
302 //...Avoid splitting of X or parallel...(future implementation)...
303 else if (t > 4) return splitComplicated();
304
305 //...A or V...
306 return splitAV();
307}
TTree * t
Definition binning.cxx:23

Referenced by TConformalFinder0::findClusters(), and THistogram::segments0().

◆ superLayerId()

unsigned TSegment0::superLayerId ( void ) const
inline

returns super layer id.

Definition at line 234 of file TSegment0.h.

234 {
235 unsigned id = (links())[0]->wire()->superLayerId();
236#ifdef TRKRECO_DEBUG
237 {
238 const AList<TMLink> & list = links();
239 unsigned n = list.length();
240 for (unsigned i = 1; i < n; i++) {
241 if (list[i]->hit()->wire()->superLayerId() != id) {
242 std::cout << "TSegment0::superLayerId !!! strange segment found";
243 std::cout << std::endl;
244 dump();
245 break;
246 }
247 }
248 }
249#endif
250 return id;
251}
unsigned superLayerId() const
returns super layer id.
Definition TSegment0.h:234
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.

Referenced by superLayerId().

◆ tracks()

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

Definition at line 255 of file TSegment0.h.

255 {
256 return _tracks;
257}

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