BOSS 7.0.3
BESIII Offline Software System
Loading...
Searching...
No Matches
TLineFitter Class Reference

A class to fit a TTrackBase object to a line. More...

#include <TLineFitter.h>

+ Inheritance diagram for TLineFitter:

Public Member Functions

 TLineFitter (const std::string &name)
 Constructor.
 
virtual ~TLineFitter ()
 Destructor.
 
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
 
double a (void) const
 
double b (void) const
 
double det (void) const
 
virtual int fit (TTrackBase &) const
 
 TLineFitter (const std::string &name)
 Constructor.
 
virtual ~TLineFitter ()
 Destructor.
 
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
 
double a (void) const
 
double b (void) const
 
double det (void) const
 
virtual int fit (TTrackBase &) const
 
- Public Member Functions inherited from TMFitter
 TMFitter (const std::string &name)
 Constructor.
 
virtual ~TMFitter ()
 Destructor.
 
const std::string & name (void) const
 returns name.
 
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 
virtual int fit (TTrackBase &) const =0
 
 TMFitter (const std::string &name)
 Constructor.
 
virtual ~TMFitter ()
 Destructor.
 
const std::string & name (void) const
 returns name.
 
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 
virtual int fit (TTrackBase &) const =0
 

Additional Inherited Members

- Protected Member Functions inherited from TMFitter
void fitDone (TTrackBase &) const
 sets the fitted flag. (Bad implementation)
 
void fitDone (TTrackBase &) const
 sets the fitted flag. (Bad implementation)
 

Detailed Description

A class to fit a TTrackBase object to a line.

Definition at line 28 of file InstallArea/include/TrkReco/TrkReco/TLineFitter.h.

Constructor & Destructor Documentation

◆ TLineFitter() [1/2]

TLineFitter::TLineFitter ( const std::string &  name)

Constructor.

Definition at line 18 of file TLineFitter.cxx.

19: TMFitter(name), _a(0.), _b(0.), _det(0.) {
20}
A class to fit a TTrackBase object.
const std::string & name(void) const
returns name.

◆ ~TLineFitter() [1/2]

TLineFitter::~TLineFitter ( )
virtual

Destructor.

Definition at line 22 of file TLineFitter.cxx.

22 {
23}

◆ TLineFitter() [2/2]

TLineFitter::TLineFitter ( const std::string &  name)

Constructor.

◆ ~TLineFitter() [2/2]

virtual TLineFitter::~TLineFitter ( )
virtual

Destructor.

Member Function Documentation

◆ a() [1/2]

double TLineFitter::a ( void  ) const
inline

Definition at line 67 of file InstallArea/include/TrkReco/TrkReco/TLineFitter.h.

67 {
68 return _a;
69}

Referenced by TRobustLineFitter::fit().

◆ a() [2/2]

double TLineFitter::a ( void  ) const

◆ b() [1/2]

double TLineFitter::b ( void  ) const
inline

Definition at line 73 of file InstallArea/include/TrkReco/TrkReco/TLineFitter.h.

73 {
74 return _b;
75}

Referenced by TRobustLineFitter::fit().

◆ b() [2/2]

double TLineFitter::b ( void  ) const

◆ det() [1/2]

double TLineFitter::det ( void  ) const
inline

Definition at line 79 of file InstallArea/include/TrkReco/TrkReco/TLineFitter.h.

79 {
80 return _det;
81}

Referenced by TRobustLineFitter::fit().

◆ det() [2/2]

double TLineFitter::det ( void  ) const

◆ dump() [1/2]

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

dumps debug information.

◆ dump() [2/2]

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

dumps debug information.

◆ fit() [1/2]

int TLineFitter::fit ( TTrackBase t) const
virtual

Implements TMFitter.

Reimplemented in TRobustLineFitter, and TRobustLineFitter.

Definition at line 26 of file TLineFitter.cxx.

26 {
27
28 //...Already fitted ?...
29 if (t.fitted()) return TFitAlreadyFitted;
30
31 //...Check # of hits...
32 if (t.links().length() < 2) return TFitErrorFewHits;
33
34 unsigned n = t.links().length();
35 if (_det == 0. && n == 2) {
36 double x0 = t.links()[0]->position().x();
37 double y0 = t.links()[0]->position().y();
38 double x1 = t.links()[1]->position().x();
39 double y1 = t.links()[1]->position().y();
40 if (x0 == x1) return TFitFailed;
41 _a = (y0 - y1) / (x0 - x1);
42 _b = - _a * x1 + y1;
43 }
44 else {
45 double sum = (double) n;
46 double sumX = 0., sumY = 0., sumX2 = 0., sumXY = 0., sumY2 = 0.;
47 for (unsigned i = 0; i < n; i++) {
48 const HepPoint3D & p = t.links()[i]->position();
49 double x = p.x();
50 double y = p.y();
51 sumX += x;
52 sumY += y;
53 sumX2 += x * x;
54 sumXY += x * y;
55 sumY2 += y * y;
56 }
57
58 _det = sum * sumX2 - sumX * sumX;
59#ifdef TRKRECO_DEBUG_DETAIL
60 cout << " TLineFitter::fit ... det=" << _det << std::endl;
61#endif
62 if (_det == 0.) {
63 return TFitFailed;
64 }
65 else {
66 _a = (sumXY * sum - sumX * sumY) / _det;
67 _b = (sumX2 * sumY - sumX * sumXY) / _det;
68 }
69 }
70
71 if (t.objectType() == Line)
72 ((TMLine &) t).property(_a, _b, _det);
73 fitDone(t);
74 return 0;
75}
const Int_t n
Double_t x[10]
void fitDone(TTrackBase &) const
sets the fitted flag. (Bad implementation)
Definition: TMFitter.cxx:24
A class to represent a track in tracking.
int t()
Definition: t.c:1

Referenced by TRobustLineFitter::fit().

◆ fit() [2/2]

virtual int TLineFitter::fit ( TTrackBase ) const
virtual

Implements TMFitter.

Reimplemented in TRobustLineFitter, and TRobustLineFitter.


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