BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
TMLine Class Reference

A class to represent a track in tracking. More...

#include <TMLine.h>

Inheritance diagram for TMLine:

Public Member Functions

 TMLine ()
 Constructor.
 TMLine (const AList< TMLink > &)
 Constructor.
virtual ~TMLine ()
 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.
double a (void) const
 returns coefficient a.
double b (void) const
 returns coefficient b.
double chi2 (void) const
 returns chi2.
double reducedChi2 (void) const
 returns reduced-chi2.
double distance (const TMLink &) const
 returns distance to a position of TMLink itself. (not to a wire)
double distance (const HepPoint3D &) const
int fit2 ()
 fits itself. Error was happened if return value is not zero.
int fit2s ()
int fit2p ()
 fits itself using isolated hits. Error was happened if return value is not zero.
int fit2sp ()
void removeChits ()
 remove extremly bad points.
void refine (AList< TMLink > &list, float maxSigma)
void removeSLY (AList< TMLink > &list)
void appendSLY (AList< TMLink > &list)
void appendByszdistance (AList< TMLink > &list, unsigned isl, float maxSigma)
void property (double a, double b, double det)
 sets circle properties.
 TMLine ()
 Constructor.
 TMLine (const AList< TMLink > &)
 Constructor.
virtual ~TMLine ()
 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.
double a (void) const
 returns coefficient a.
double b (void) const
 returns coefficient b.
double chi2 (void) const
 returns chi2.
double reducedChi2 (void) const
 returns reduced-chi2.
double distance (const TMLink &) const
 returns distance to a position of TMLink itself. (not to a wire)
double distance (const HepPoint3D &) const
int fit2 ()
 fits itself. Error was happened if return value is not zero.
int fit2s ()
int fit2p ()
 fits itself using isolated hits. Error was happened if return value is not zero.
int fit2sp ()
void removeChits ()
 remove extremly bad points.
void refine (AList< TMLink > &list, float maxSigma)
void removeSLY (AList< TMLink > &list)
void appendSLY (AList< TMLink > &list)
void appendByszdistance (AList< TMLink > &list, unsigned isl, float maxSigma)
void property (double a, double b, double det)
 sets circle properties.
 TMLine ()
 Constructor.
 TMLine (const AList< TMLink > &)
 Constructor.
virtual ~TMLine ()
 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.
double a (void) const
 returns coefficient a.
double b (void) const
 returns coefficient b.
double chi2 (void) const
 returns chi2.
double reducedChi2 (void) const
 returns reduced-chi2.
double distance (const TMLink &) const
 returns distance to a position of TMLink itself. (not to a wire)
double distance (const HepPoint3D &) const
int fit2 ()
 fits itself. Error was happened if return value is not zero.
int fit2s ()
int fit2p ()
 fits itself using isolated hits. Error was happened if return value is not zero.
int fit2sp ()
void removeChits ()
 remove extremly bad points.
void refine (AList< TMLink > &list, float maxSigma)
void removeSLY (AList< TMLink > &list)
void appendSLY (AList< TMLink > &list)
void appendByszdistance (AList< TMLink > &list, unsigned isl, float maxSigma)
void property (double a, double b, double det)
 sets circle properties.
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
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)
void appendByDistance (AList< TMLink > &list, double maxDistance)
void remove (TMLink &a)
 removes a TMLink.
void remove (const AList< TMLink > &)
 removes TMLinks.
virtual void refine (AList< TMLink > &list, double maxSigma)
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 int approach (TMLink &) const
unsigned testByApproach (const TMLink &list, double sigma) const
 returns # of good hits to be appended.
unsigned testByApproach (const AList< TMLink > &list, double sigma) const
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).
 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
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)
void appendByDistance (AList< TMLink > &list, double maxDistance)
void remove (TMLink &a)
 removes a TMLink.
void remove (const AList< TMLink > &)
 removes TMLinks.
virtual void refine (AList< TMLink > &list, double maxSigma)
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 int approach (TMLink &) const
unsigned testByApproach (const TMLink &list, double sigma) const
 returns # of good hits to be appended.
unsigned testByApproach (const AList< TMLink > &list, double sigma) const
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).
 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
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)
void appendByDistance (AList< TMLink > &list, double maxDistance)
void remove (TMLink &a)
 removes a TMLink.
void remove (const AList< TMLink > &)
 removes TMLinks.
virtual void refine (AList< TMLink > &list, double maxSigma)
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 int approach (TMLink &) const
unsigned testByApproach (const TMLink &list, double sigma) const
 returns # of good hits to be appended.
unsigned testByApproach (const AList< TMLink > &list, double sigma) const
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 represent a track in tracking.

Definition at line 40 of file InstallArea/x86_64-el9-gcc13-dbg/include/TrkReco/TMLine.h.

Constructor & Destructor Documentation

◆ TMLine() [1/6]

TMLine::TMLine ( )

Constructor.

Definition at line 22 of file TMLine.cxx.

23 : TTrackBase()
24 , _a( 0. )
25 , _b( 0. )
26 , _det( 0. )
27 , _fittedUpdated( false )
28 , _chi2( 0. )
29 , _reducedChi2( 0. ) {
30
31 //...Set a defualt fitter...
32 fitter( &TMLine::_fitter );
33}
const TMFitter *const fitter(void) const
returns a pointer to a default fitter.
TTrackBase()
Constructor.

◆ TMLine() [2/6]

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

Constructor.

Definition at line 35 of file TMLine.cxx.

36 : TTrackBase( a )
37 , _a( 0. )
38 , _b( 0. )
39 , _det( 0. )
40 , _fittedUpdated( false )
41 , _chi2( 0. )
42 , _reducedChi2( 0. ) {
43
44 //...Set a defualt fitter...
45 fitter( &TMLine::_fitter );
46}
double a(void) const
returns coefficient a.

◆ ~TMLine() [1/3]

TMLine::~TMLine ( )
virtual

Destructor.

Definition at line 48 of file TMLine.cxx.

48{}

◆ TMLine() [3/6]

TMLine::TMLine ( )

Constructor.

◆ TMLine() [4/6]

TMLine::TMLine ( const AList< TMLink > & )

Constructor.

◆ ~TMLine() [2/3]

virtual TMLine::~TMLine ( )
virtual

Destructor.

◆ TMLine() [5/6]

TMLine::TMLine ( )

Constructor.

◆ TMLine() [6/6]

TMLine::TMLine ( const AList< TMLink > & )

Constructor.

◆ ~TMLine() [3/3]

virtual TMLine::~TMLine ( )
virtual

Destructor.

Member Function Documentation

◆ a() [1/3]

double TMLine::a ( void ) const
inline

returns coefficient a.

Definition at line 146 of file InstallArea/x86_64-el9-gcc13-dbg/include/TrkReco/TMLine.h.

146 {
147# ifdef TRKRECO_DEBUG
148 if ( !_fitted ) std::cout << "TMLine::a !!! fit not performed" << std::endl;
149# endif
150 return _a;
151}

Referenced by TBuilder::build(), TBuilder::buildStereo(), TBuilderCurl::buildStereo(), property(), and TMLine().

◆ a() [2/3]

double TMLine::a ( void ) const

returns coefficient a.

◆ a() [3/3]

double TMLine::a ( void ) const

returns coefficient a.

◆ appendByszdistance() [1/3]

void TMLine::appendByszdistance ( AList< TMLink > & list,
unsigned isl,
float maxSigma )

Definition at line 579 of file TMLine.cxx.

579 {
580
581 //... intialize
582 unsigned nb = _links.length();
583
584 //....Select good hit
585 unsigned n = list.length();
586 for ( unsigned i = 0; i < n; i++ )
587 {
588 TMLink& l = *list[i];
589 if ( l.hit()->wire()->superLayerId() == isl )
590 {
591 double dist = distance( l );
592 if ( dist < maxSigma ) { _links.append( l ); }
593 }
594 }
595
596 unsigned na = _links.length();
597 if ( nb != na )
598 {
599 AList<TMLink> bad;
600 //... remove duplicated hits
601 for ( unsigned i = 0; i < na; i++ )
602 {
603 TMLink& l = *_links[i];
604 if ( i < na - 1 )
605 {
606 TMLink& lnext = *_links[i + 1];
607 if ( l.hit()->wire()->layerId() == lnext.hit()->wire()->layerId() )
608 {
609 if ( l.hit()->wire()->localId() == lnext.hit()->wire()->localId() )
610 { bad.append( l ); }
611 }
612 }
613 }
614 if ( bad.length() > 0 ) _links.remove( bad );
615 _fitted = false;
616 _fittedUpdated = false;
617 }
618}
const Int_t n
const TMDCWire *const wire(void) const
returns a pointer to a TMDCWire.
unsigned localId(void) const
returns local id in a wire layer.
unsigned layerId(void) const
returns layer id.
unsigned superLayerId(void) const
returns super layer id.
double distance(const TMLink &) const
returns distance to a position of TMLink itself. (not to a wire)

◆ appendByszdistance() [2/3]

void TMLine::appendByszdistance ( AList< TMLink > & list,
unsigned isl,
float maxSigma )

◆ appendByszdistance() [3/3]

void TMLine::appendByszdistance ( AList< TMLink > & list,
unsigned isl,
float maxSigma )

◆ appendSLY() [1/3]

void TMLine::appendSLY ( AList< TMLink > & list)

Definition at line 573 of file TMLine.cxx.

573 {
574 _links.append( list );
575 _fitted = false;
576 _fittedUpdated = false;
577}

◆ appendSLY() [2/3]

void TMLine::appendSLY ( AList< TMLink > & list)

◆ appendSLY() [3/3]

void TMLine::appendSLY ( AList< TMLink > & list)

◆ b() [1/3]

double TMLine::b ( void ) const
inline

returns coefficient b.

Definition at line 153 of file InstallArea/x86_64-el9-gcc13-dbg/include/TrkReco/TMLine.h.

153 {
154# ifdef TRKRECO_DEBUG
155 if ( !_fitted ) std::cout << "TMLine::b !!! fit not performed" << std::endl;
156# endif
157 return _b;
158}

Referenced by TBuilder::build(), TBuilder::buildStereo(), TBuilderCurl::buildStereo(), and property().

◆ b() [2/3]

double TMLine::b ( void ) const

returns coefficient b.

◆ b() [3/3]

double TMLine::b ( void ) const

returns coefficient b.

◆ chi2() [1/3]

double TMLine::chi2 ( void ) const

returns chi2.

Definition at line 111 of file TMLine.cxx.

111 {
112#ifdef TRKRECO_DEBUG
113 if ( !_fitted ) std::cout << "TMLine::chi2 !!! fit not performed" << std::endl;
114#endif
115
116 if ( _fittedUpdated ) return _chi2;
117 _chi2 = 0.;
118 unsigned n = _links.length();
119 for ( unsigned i = 0; i < n; i++ )
120 {
121 TMLink& l = *_links[i];
122
123 double x = l.position().x();
124 double y = l.position().y();
125 double c = y - _a * x - _b;
126 _chi2 += c * c;
127 }
128 _fittedUpdated = true;
129 return _chi2;
130}
Double_t x[10]

Referenced by reducedChi2().

◆ chi2() [2/3]

double TMLine::chi2 ( void ) const

returns chi2.

◆ chi2() [3/3]

double TMLine::chi2 ( void ) const

returns chi2.

◆ distance() [1/6]

double TMLine::distance ( const HepPoint3D & p) const
inline

Definition at line 169 of file InstallArea/x86_64-el9-gcc13-dbg/include/TrkReco/TMLine.h.

169 {
170# ifdef TRKRECO_DEBUG
171 if ( !_fitted ) std::cout << "TMLine::distance !!! fit not performed" << std::endl;
172# endif
173 double dy = fabs( _a * p.x() + _b - p.y() );
174 double invCos = sqrt( 1. + _a * _a );
175 return dy / invCos;
176}

◆ distance() [2/6]

double TMLine::distance ( const HepPoint3D & ) const

◆ distance() [3/6]

double TMLine::distance ( const HepPoint3D & ) const

◆ distance() [4/6]

double TMLine::distance ( const TMLink & l) const
inlinevirtual

returns distance to a position of TMLink itself. (not to a wire)

Reimplemented from TTrackBase.

Definition at line 160 of file InstallArea/x86_64-el9-gcc13-dbg/include/TrkReco/TMLine.h.

160 {
161# ifdef TRKRECO_DEBUG
162 if ( !_fitted ) std::cout << "TMLine::distance !!! fit not performed" << std::endl;
163# endif
164 double dy = fabs( _a * l.position().x() + _b - l.position().y() );
165 double invCos = sqrt( 1. + _a * _a );
166 return dy / invCos;
167}

Referenced by appendByszdistance(), TBuilder::buildStereo(), refine(), TBuilder::removeFarSegment(), TBuilder::searchLine(), and TBuilder::selectStereoSegment().

◆ distance() [5/6]

double TMLine::distance ( const TMLink & ) const
virtual

returns distance to a position of TMLink itself. (not to a wire)

Reimplemented from TTrackBase.

◆ distance() [6/6]

double TMLine::distance ( const TMLink & ) const
virtual

returns distance to a position of TMLink itself. (not to a wire)

Reimplemented from TTrackBase.

◆ dump() [1/3]

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

dumps debug information.

Reimplemented from TTrackBase.

Definition at line 50 of file TMLine.cxx.

50 {
51 bool def = false;
52 if ( msg == "" ) def = true;
53
54 if ( def || msg.find( "line" ) != std::string::npos ||
55 msg.find( "detail" ) != std::string::npos )
56 {
57 std::cout << pre;
58 std::cout << "#links=" << _links.length();
59 std::cout << ",a=" << _a;
60 std::cout << ",b=" << _b;
61 std::cout << ",det=" << _det;
62 std::cout << std::endl;
63 }
64 if ( !def ) TTrackBase::dump( msg, pre );
65}
virtual void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.

◆ dump() [2/3]

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

dumps debug information.

Reimplemented from TTrackBase.

◆ dump() [3/3]

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

dumps debug information.

Reimplemented from TTrackBase.

◆ fit2() [1/3]

int TMLine::fit2 ( )

fits itself. Error was happened if return value is not zero.

fits itself using isolated hits. Error was happened if return value is not zero.

Definition at line 174 of file TMLine.cxx.

174 {
175 std::cout << " " << __FILE__ << " " << __LINE__ << " ERROR : nsl" << std::endl;
176 // if (_fitted) return 0;
177
178 unsigned n = _links.length();
179 int mask[100] = { 0 };
180 int nsl[11] = { 64, 80, 96, 128, 144, 160, 192, 208, 240, 256, 288 };
181 int npos = 0, nneg = 0;
182 for ( unsigned i = 0; i < n - 1; i++ )
183 {
184 TMLink& l = *_links[i];
185 for ( unsigned j = i + 1; j < n; j++ )
186 {
187 TMLink& s = *_links[j];
188 if ( l.hit()->wire()->layerId() == s.hit()->wire()->layerId() )
189 {
190 //... Check 3 consective hits
191 if ( i > 0 && ( mask[i - 1] == 1 && mask[j] == 1 ) )
192 {
193 TMLink& t = *_links[i - 1];
194 if ( l.hit()->wire()->layerId() == t.hit()->wire()->layerId() ) { mask[i] = 1; }
195 }
196 int ilast = nsl[l.hit()->wire()->superLayerId()] - 1;
197 int ilocal = l.hit()->wire()->localId();
198 int jlocal = s.hit()->wire()->localId();
199 if ( ilocal > 0 && ilocal < ilast )
200 {
201 if ( abs( jlocal - ilocal ) > 1 )
202 {
203 mask[i] = 1;
204 mask[j] = 1;
205 }
206 }
207 else if ( ilocal == 0 )
208 {
209 if ( jlocal > 1 && jlocal < ilast )
210 {
211 mask[i] = 1;
212 mask[j] = 1;
213 }
214 }
215 else if ( ilocal == ilast )
216 {
217 if ( jlocal > 0 && jlocal < ilast - 1 )
218 {
219 mask[i] = 1;
220 mask[j] = 1;
221 }
222 }
223 }
224 }
225 //...
226 if ( mask[i] == 0 )
227 {
228 if ( l.position().y() >= 0 ) npos += 1;
229 if ( l.position().y() < 0 ) nneg += 1;
230 }
231 }
232
233 //....
234 double sumX = 0., sumY = 0., sumX2 = 0., sumXY = 0., sumY2 = 0.;
235 int nused = 0;
236 int lyid[2];
237 for ( unsigned i = 0; i < n; i++ )
238 {
239
240 if ( mask[i] == 1 ) continue;
241
242 TMLink& l = *_links[i];
243
244 double x = l.position().x();
245 double y = l.position().y();
246 if ( abs( npos - nneg ) > 3 )
247 {
248 if ( npos > nneg && y < 0 ) continue;
249 if ( npos < nneg && y > 0 ) continue;
250 }
251 sumX += x;
252 sumY += y;
253 sumX2 += x * x;
254 sumXY += x * y;
255 sumY2 += y * y;
256 if ( nused < 2 ) { lyid[nused] = l.hit()->wire()->layerId(); }
257 nused += 1;
258 }
259
260 if ( nused < 2 || ( nused == 2 && lyid[0] == lyid[1] ) ) { return -2; }
261 double sum = double( nused );
262 _det = sum * sumX2 - sumX * sumX;
263 if ( _det == 0. ) { return -1; }
264 _a = ( sumXY * sum - sumX * sumY ) / _det;
265 _b = ( sumX2 * sumY - sumX * sumXY ) / _det;
266
267 _fitted = true;
268 return 0;
269}
int nneg
XmlRpcServer s
int t()
Definition t.c:1

◆ fit2() [2/3]

int TMLine::fit2 ( )

fits itself. Error was happened if return value is not zero.

fits itself using isolated hits. Error was happened if return value is not zero.

◆ fit2() [3/3]

int TMLine::fit2 ( )

fits itself. Error was happened if return value is not zero.

fits itself using isolated hits. Error was happened if return value is not zero.

◆ fit2p() [1/3]

int TMLine::fit2p ( )

fits itself using isolated hits. Error was happened if return value is not zero.

Definition at line 411 of file TMLine.cxx.

411 {
412 // if (_fitted) return 0;
413
414 std::cout << " " << __FILE__ << " " << __LINE__ << " ERROR : nsl" << std::endl;
415 unsigned n = _links.length();
416 int mask[100] = { 0 };
417 int nsl[11] = { 64, 80, 96, 128, 144, 160, 192, 208, 240, 256, 288 };
418 double phi_ave = 0.;
419 int nphi = 0;
420 double Crad = 180. / 3.141592;
421 for ( unsigned i = 0; i < n - 1; i++ )
422 {
423 TMLink& l = *_links[i];
424 for ( unsigned j = i + 1; j < n; j++ )
425 {
426 TMLink& s = *_links[j];
427 if ( l.hit()->wire()->layerId() == s.hit()->wire()->layerId() )
428 {
429 //... Check 3 consective hits
430 if ( i > 0 && ( mask[i - 1] == 1 && mask[j] == 1 ) )
431 {
432 TMLink& t = *_links[i - 1];
433 if ( l.hit()->wire()->layerId() == t.hit()->wire()->layerId() ) { mask[i] = 1; }
434 }
435 int ilast = nsl[l.hit()->wire()->superLayerId()] - 1;
436 int ilocal = l.hit()->wire()->localId();
437 int jlocal = s.hit()->wire()->localId();
438 if ( ilocal > 0 && ilocal < ilast )
439 {
440 if ( abs( jlocal - ilocal ) > 1 )
441 {
442 mask[i] = 1;
443 mask[j] = 1;
444 }
445 }
446 else if ( ilocal == 0 )
447 {
448 if ( jlocal > 1 && jlocal < ilast )
449 {
450 mask[i] = 1;
451 mask[j] = 1;
452 }
453 }
454 else if ( ilocal == ilast )
455 {
456 if ( jlocal > 0 && jlocal < ilast - 1 )
457 {
458 mask[i] = 1;
459 mask[j] = 1;
460 }
461 }
462 }
463 }
464 //...
465 //...
466 if ( mask[i] != 1 )
467 {
468 double phi = Crad * atan2( l.position().y(), l.position().x() );
469 phi_ave += phi;
470 nphi += 1;
471 }
472 }
473
474 //...
475 if ( mask[n - 1] != 1 )
476 {
477 TMLink& l = *_links[n - 1];
478 double phi = Crad * atan2( l.position().y(), l.position().x() );
479 phi_ave += phi;
480 nphi += 1;
481 }
482 double phi_max = 0.;
483 double phi_min = 0.;
484 if ( nphi > 0 )
485 {
486 phi_max = phi_ave / n + 40;
487 phi_min = phi_ave / n - 40;
488 }
489
490 //....
491 double sumX = 0., sumY = 0., sumX2 = 0., sumXY = 0., sumY2 = 0.;
492 int nused = 0;
493 int lyid[2];
494 for ( unsigned i = 0; i < n; i++ )
495 {
496
497 if ( mask[i] == 1 ) continue;
498
499 TMLink& l = *_links[i];
500
501 double x = l.position().x();
502 double y = l.position().y();
503 double phi = Crad * atan2( l.position().y(), l.position().x() );
504 if ( phi > phi_max && phi < phi_min ) continue;
505
506 sumX += x;
507 sumY += y;
508 sumX2 += x * x;
509 sumXY += x * y;
510 sumY2 += y * y;
511 if ( nused < 2 ) { lyid[nused] = l.hit()->wire()->layerId(); }
512 nused += 1;
513 }
514
515 if ( nused < 2 || ( nused == 2 && lyid[0] == lyid[1] ) ) { return -2; }
516 double sum = double( nused );
517 _det = sum * sumX2 - sumX * sumX;
518 if ( _det == 0. ) { return -1; }
519 _a = ( sumXY * sum - sumX * sumY ) / _det;
520 _b = ( sumX2 * sumY - sumX * sumXY ) / _det;
521
522 _fitted = true;
523 return 0;
524}

◆ fit2p() [2/3]

int TMLine::fit2p ( )

fits itself using isolated hits. Error was happened if return value is not zero.

◆ fit2p() [3/3]

int TMLine::fit2p ( )

fits itself using isolated hits. Error was happened if return value is not zero.

◆ fit2s() [1/3]

int TMLine::fit2s ( )

fits itself using single hits in a wire-layer. Error was happened if return value is not zero.

Definition at line 271 of file TMLine.cxx.

271 {
272 // if (_fitted) return 0;
273
274 unsigned n = _links.length();
275 int mask[100] = { 0 };
276 int npos = 0, nneg = 0;
277 for ( unsigned i = 0; i < n - 1; i++ )
278 {
279 TMLink& l = *_links[i];
280 for ( unsigned j = i + 1; j < n; j++ )
281 {
282 TMLink& s = *_links[j];
283 if ( l.hit()->wire()->layerId() == s.hit()->wire()->layerId() )
284 {
285 mask[i] = 1;
286 mask[j] = 1;
287 }
288 }
289 //...
290 if ( mask[i] == 0 )
291 {
292 if ( l.position().y() >= 0 ) npos += 1;
293 if ( l.position().y() < 0 ) nneg += 1;
294 }
295 }
296
297 //....
298 double sumX = 0., sumY = 0., sumX2 = 0., sumXY = 0., sumY2 = 0.;
299 int nused = 0;
300 int lyid[2];
301 for ( unsigned i = 0; i < n; i++ )
302 {
303
304 if ( mask[i] == 1 ) continue;
305
306 TMLink& l = *_links[i];
307
308 double x = l.position().x();
309 double y = l.position().y();
310 if ( npos > nneg && y < 0 ) continue;
311 if ( npos < nneg && y > 0 ) continue;
312
313 sumX += x;
314 sumY += y;
315 sumX2 += x * x;
316 sumXY += x * y;
317 sumY2 += y * y;
318 nused += 1;
319 }
320
321 if ( nused < 4 ) { return -2; }
322 double sum = double( nused );
323 _det = sum * sumX2 - sumX * sumX;
324 if ( _det == 0. ) { return -1; }
325 _a = ( sumXY * sum - sumX * sumY ) / _det;
326 _b = ( sumX2 * sumY - sumX * sumXY ) / _det;
327
328 _fitted = true;
329 return 0;
330}

◆ fit2s() [2/3]

int TMLine::fit2s ( )

fits itself using single hits in a wire-layer. Error was happened if return value is not zero.

◆ fit2s() [3/3]

int TMLine::fit2s ( )

fits itself using single hits in a wire-layer. Error was happened if return value is not zero.

◆ fit2sp() [1/3]

int TMLine::fit2sp ( )

fits itself using single hits in a wire-layer. Error was happened if return value is not zero.

Definition at line 331 of file TMLine.cxx.

331 {
332 // if (_fitted) return 0;
333
334 unsigned n = _links.length();
335 int mask[100] = { 0 };
336 double phi_ave = 0.;
337 int nphi = 0;
338 double Crad = 180. / 3.141592;
339 for ( unsigned i = 0; i < n - 1; i++ )
340 {
341 TMLink& l = *_links[i];
342 for ( unsigned j = i + 1; j < n; j++ )
343 {
344 TMLink& s = *_links[j];
345 if ( l.hit()->wire()->layerId() == s.hit()->wire()->layerId() )
346 {
347 mask[i] = 1;
348 mask[j] = 1;
349 }
350 }
351 //...
352 if ( mask[i] != 1 )
353 {
354 double phi = Crad * atan2( l.position().y(), l.position().x() );
355 phi_ave += phi;
356 nphi += 1;
357 }
358 }
359
360 //...
361 if ( mask[n - 1] != 1 )
362 {
363 TMLink& l = *_links[n - 1];
364 double phi = Crad * atan2( l.position().y(), l.position().x() );
365 phi_ave += phi;
366 nphi += 1;
367 }
368 double phi_max = 0.;
369 double phi_min = 0.;
370 if ( nphi > 0 )
371 {
372 phi_max = phi_ave / n + 40;
373 phi_min = phi_ave / n - 40;
374 }
375
376 //....
377 double sumX = 0., sumY = 0., sumX2 = 0., sumXY = 0., sumY2 = 0.;
378 int nused = 0;
379 int lyid[2];
380 for ( unsigned i = 0; i < n; i++ )
381 {
382
383 if ( mask[i] == 1 ) continue;
384
385 TMLink& l = *_links[i];
386
387 double x = l.position().x();
388 double y = l.position().y();
389 double phi = Crad * atan2( l.position().y(), l.position().x() );
390 if ( phi > phi_max && phi < phi_min ) continue;
391
392 sumX += x;
393 sumY += y;
394 sumX2 += x * x;
395 sumXY += x * y;
396 sumY2 += y * y;
397 nused += 1;
398 }
399
400 if ( nused < 4 ) { return -2; }
401 double sum = double( nused );
402 _det = sum * sumX2 - sumX * sumX;
403 if ( _det == 0. ) { return -1; }
404 _a = ( sumXY * sum - sumX * sumY ) / _det;
405 _b = ( sumX2 * sumY - sumX * sumXY ) / _det;
406
407 _fitted = true;
408 return 0;
409}

◆ fit2sp() [2/3]

int TMLine::fit2sp ( )

fits itself using single hits in a wire-layer. Error was happened if return value is not zero.

◆ fit2sp() [3/3]

int TMLine::fit2sp ( )

fits itself using single hits in a wire-layer. Error was happened if return value is not zero.

◆ objectType() [1/3]

unsigned TMLine::objectType ( void ) const
inlinevirtual

returns type.

Reimplemented from TTrackBase.

Definition at line 184 of file InstallArea/x86_64-el9-gcc13-dbg/include/TrkReco/TMLine.h.

◆ objectType() [2/3]

virtual unsigned TMLine::objectType ( void ) const
virtual

returns type.

Reimplemented from TTrackBase.

◆ objectType() [3/3]

virtual unsigned TMLine::objectType ( void ) const
virtual

returns type.

Reimplemented from TTrackBase.

◆ property() [1/3]

void TMLine::property ( double a,
double b,
double det )
inline

sets circle properties.

Definition at line 178 of file InstallArea/x86_64-el9-gcc13-dbg/include/TrkReco/TMLine.h.

178 {
179 _a = a;
180 _b = b;
181 _det = det;
182}
double b(void) const
returns coefficient b.

◆ property() [2/3]

void TMLine::property ( double a,
double b,
double det )

sets circle properties.

◆ property() [3/3]

void TMLine::property ( double a,
double b,
double det )

sets circle properties.

◆ reducedChi2() [1/3]

double TMLine::reducedChi2 ( void ) const

returns reduced-chi2.

Definition at line 620 of file TMLine.cxx.

620 {
621#ifdef TRKRECO_DEBUG
622 if ( !_fitted ) std::cout << "TMLine::reducedChi2 !!! fit not performed" << std::endl;
623#endif
624
625 if ( _fittedUpdated ) return _reducedChi2;
626 double chi2 = 0.;
627 double scale = 20.;
628 unsigned n = _links.length();
629 for ( unsigned i = 0; i < n; i++ )
630 {
631 TMLink& l = *_links[i];
632
633 double x = l.position().x();
634 double y = l.position().y();
635 double c = y - _a * x - _b;
636 double err = 1.;
637 if ( l.hit() ) err = scale * l.hit()->dDrift();
638 chi2 += c * c / err / err;
639 }
640
641 _reducedChi2 = chi2 / ( n - 2 );
642 _fittedUpdated = true;
643 return _reducedChi2;
644}
float dDrift(unsigned) const
returns drift distance error.
double chi2(void) const
returns chi2.
Definition TMLine.cxx:111

◆ reducedChi2() [2/3]

double TMLine::reducedChi2 ( void ) const

returns reduced-chi2.

◆ reducedChi2() [3/3]

double TMLine::reducedChi2 ( void ) const

returns reduced-chi2.

◆ refine() [1/3]

void TMLine::refine ( AList< TMLink > & list,
float maxSigma )

remove bad points by chi2. Bad points are returned in a 'list'. fit() should be called before calling this function.

Definition at line 132 of file TMLine.cxx.

132 {
133 AList<TMLink> bad;
134 unsigned n = _links.length();
135 for ( unsigned i = 0; i < n; i++ )
136 {
137 TMLink& l = *_links[i];
138 double dist = distance( l );
139 if ( dist > maxSigma ) bad.append( l );
140 }
141
142#ifdef TRKRECO_DEBUG_DETAIL
143 std::cout << " TMLine::refine ... rejected hits:max distance=" << maxSigma;
144 std::cout << std::endl;
145 bad.sort( SortByWireId );
146 for ( unsigned i = 0; i < bad.length(); i++ )
147 {
148 TMLink& l = *_links[i];
149 std::cout << " ";
150 std::cout << l.wire()->layerId() << "-";
151 std::cout << l.wire()->localId();
152 std::cout << "(";
153 if ( l.hit()->mc() )
154 {
155 if ( l.hit()->mc()->hep() ) std::cout << l.hit()->mc()->hep()->id();
156 else std::cout << "0";
157 }
158 std::cout << "),";
159 std::cout << l.position() << "," << distance( l );
160 if ( distance( l ) > maxSigma ) std::cout << " X";
161 std::cout << std::endl;
162 }
163#endif
164
165 if ( bad.length() )
166 {
167 _links.remove( bad );
168 list.append( bad );
169 _fitted = false;
170 _fittedUpdated = false;
171 }
172}
const TTrackHEP *const hep(void) const
returns a pointer to a GEN_HEPEVT.
const TMDCWireHitMC *const mc(void) const
returns a pointer to TMDCWireHitMC.
unsigned id(void) const
returns an id started from 0.

◆ refine() [2/3]

void TMLine::refine ( AList< TMLink > & list,
float maxSigma )

remove bad points by chi2. Bad points are returned in a 'list'. fit() should be called before calling this function.

◆ refine() [3/3]

void TMLine::refine ( AList< TMLink > & list,
float maxSigma )

remove bad points by chi2. Bad points are returned in a 'list'. fit() should be called before calling this function.

◆ removeChits() [1/3]

void TMLine::removeChits ( )

remove extremly bad points.

Definition at line 526 of file TMLine.cxx.

526 {
527
528 unsigned n = _links.length();
529 int nlyr[50] = { 0 };
530 int nneg = 0, npos = 0;
531 for ( unsigned i = 0; i < n - 1; i++ )
532 {
533 TMLink& l = *_links[i];
534 nlyr[l.hit()->wire()->layerId()] += 1;
535 if ( l.position().y() < 0. ) { nneg += 1; }
536 else { npos += 1; }
537 }
538
539 //...
540 AList<TMLink> bad;
541 for ( unsigned i = 0; i < n; i++ )
542 {
543
544 TMLink& l = *_links[i];
545
546 //...if # of hits in a wire layer, don't use...
547 if ( nlyr[l.hit()->wire()->layerId()] > 3 )
548 {
549 bad.append( l );
550 continue;
551 }
552 //...remove extremely bad poinits
553 if ( abs( nneg - npos ) > 3 )
554 {
555 if ( npos > nneg && l.position().y() < 0 ) bad.append( l );
556 if ( npos < nneg && l.position().y() > 0 ) bad.append( l );
557 }
558 }
559 //...
560 if ( bad.length() > 0 && bad.length() < n ) { _links.remove( bad ); }
561
562 //... For the next fit
563 _fitted = false;
564 _fittedUpdated = false;
565}

◆ removeChits() [2/3]

void TMLine::removeChits ( )

remove extremly bad points.

◆ removeChits() [3/3]

void TMLine::removeChits ( )

remove extremly bad points.

◆ removeSLY() [1/3]

void TMLine::removeSLY ( AList< TMLink > & list)

Definition at line 567 of file TMLine.cxx.

567 {
568 _links.remove( list );
569 _fitted = false;
570 _fittedUpdated = false;
571}

◆ removeSLY() [2/3]

void TMLine::removeSLY ( AList< TMLink > & list)

◆ removeSLY() [3/3]

void TMLine::removeSLY ( AList< TMLink > & list)

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