BOSS 7.0.7
BESIII Offline Software System
Loading...
Searching...
No Matches
TCircleFitter Class Reference

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

#include <TCircleFitter.h>

+ Inheritance diagram for TCircleFitter:

Public Member Functions

 TCircleFitter (const std::string &name)
 Constructor.
 
virtual ~TCircleFitter ()
 Destructor.
 
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
 dumps debug information.
 
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
 

Additional Inherited Members

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

Detailed Description

A class to fit a TTrackBase object to a circle.

Definition at line 32 of file TCircleFitter.h.

Constructor & Destructor Documentation

◆ TCircleFitter()

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

Constructor.

Definition at line 21 of file TCircleFitter.cxx.

22: TMFitter(name), _charge(0.), _radius(0.), _center(HepPoint3D(0., 0., 0.)) {
23}
HepGeom::Point3D< double > HepPoint3D
Definition: Gam4pikp.cxx:37
A class to fit a TTrackBase object.
Definition: TMFitter.h:34
const std::string & name(void) const
returns name.
Definition: TMFitter.h:73

◆ ~TCircleFitter()

TCircleFitter::~TCircleFitter ( )
virtual

Destructor.

Definition at line 25 of file TCircleFitter.cxx.

25 {
26}

Member Function Documentation

◆ dump()

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

dumps debug information.

◆ fit()

int TCircleFitter::fit ( TTrackBase t) const
virtual

Implements TMFitter.

Definition at line 29 of file TCircleFitter.cxx.

29 {
30
31#ifdef TRKRECO_DEBUG_DETAIL
32 std::cout << " TCircleFitter::fit ..." << std::endl;
33#endif
34
35 //...Already fitted ?...
36 if (t.fitted()) return TFitAlreadyFitted;
37
38 //...Check # of hits...
39 if (t.links().length() < 3) return TFitErrorFewHits;
40
41 //...Hit loop...
42 Lpav circle;
43/*
44 circle.add_point(-173.011, 94.3169);
45 circle.add_point(-187.6, 101.528);
46 circle.add_point(-202.018, 108.601);
47 circle.add_point(-216.639, 115.691);
48 circle.add_point(-231.152, 122.49);
49 circle.add_point(-246.207, 129.496);
50 circle.add_point(-261.179, 136.407);
51 circle.add_point(-275.198, 142.764);
52 circle.add_point(-290.519, 149.572);
53 circle.add_point(-304.42, 155.7);
54 circle.add_point(-319.947, 162.285);
55 circle.add_point(-335.495, 168.731);
56 circle.add_point(-608.394, 264.577);
57 circle.add_point(-612.842, 265.869);
58 circle.add_point(-627.175, 270.011);
59 circle.add_point(-643.654, 274.719);
60 circle.add_point(-657.809, 278.683);
61 circle.add_point(-674.464, 283.209);
62 circle.add_point(-690.7, 287.541);
63 circle.add_point(-704.925, 291.091);
64 */
65 unsigned n = t.links().length();
66
67 for (unsigned i = 0; i < n; i++) {
68 TMLink * l = t.links()[i];
69 const TMDCWireHit * h = l->hit();
70
71 //...Check next hit...
72 HepPoint3D point;
73 if (h->state() & WireHitPatternLeft)
74 point = h->position(WireHitLeft);
75 else if (h->state() & WireHitPatternRight)
76 point = h->position(WireHitRight);
77 else
78 point = h->xyPosition();
79 // float weight = 1. / (h->distance() * h->distance());
80 // float weight = 1. / h->distance();
81
82// if (h->state() & WireHitPatternLeft) cout<<"h: "<<h->wire()->layerId()<<" local: "
83// <<h->wire()->localId()<<" TCirclefitter: L"<<endl;
84// else cout<<"h: "<<h->wire()->layerId()<<" local: "
85// <<h->wire()->localId()<<" TCirclefitter: R"<<endl;
86
87 circle.add_point(point.x(), point.y()); //, weight);
88 //yuany
89
90// cout<<"TCirclefitter("<<sqrt(point.x()*point.x()+point.y()*point.y())<<","
91// <<point.y()/point.x()<<") dis:"
92// <<(h->drift(0))*10000/40<<" point "<<point<<" L "<<(h->state()&WireHitPatternLeft)
93// <<" R "<<(h->state()&WireHitPatternRight)<<endl;
94
95// cout<<"TCirclefitter "<<point.x()<<" "<<point.y()<<" L "<<(h->state()&WireHitPatternLeft)<<" R "<<(h->state()&WireHitPatternRight)<<endl;
96 }
97
98 if (circle.fit() < 0.0 || circle.kappa() == 0.0) return TFitFailed;
99 //yuany
100// cout<<"circle chi2:"<<circle.fit()<<" kappa:"<<circle.kappa()<<" center:"<<circle.center()<<" radius:"<<circle.radius()<<endl;
101
102 HepVector v(circle.center());
103 _center.setX(v(1));
104 _center.setY(v(2));
105 _radius = circle.radius();
106
107 //...Determine charge...Better way???
108 int qSum = 0;
109 for (unsigned i = 0; i < n; i++) {
110 TMLink * l = t.links()[i];
111 if (l == 0) continue;
112
113 const TMDCWireHit * h = l->hit();
114 if (h == 0) continue;
115
116 float q = (_center.cross(h->xyPosition())).z();
117 if (q > 0.) qSum += 1;
118 else qSum -= 1;
119 }
120 if (qSum >= 0) _charge = +1.;
121 else _charge = -1.;
122 _radius *= _charge;
123
124 if (t.objectType() == Circle)
125 ((TCircle &) t).property(_charge, _radius, _center);
126 fitDone(t);
127 return 0;
128}
****INTEGER imax DOUBLE PRECISION m_pi *DOUBLE PRECISION m_amfin DOUBLE PRECISION m_Chfin DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_sinw2 DOUBLE PRECISION m_GFermi DOUBLE PRECISION m_MfinMin DOUBLE PRECISION m_ta2 INTEGER m_out INTEGER m_KeyFSR INTEGER m_KeyQCD *COMMON c_Semalib $ !copy of input $ !CMS energy $ !beam mass $ !final mass $ !beam charge $ !final charge $ !smallest final mass $ !Z mass $ !Z width $ !EW mixing angle $ !Gmu Fermi $ alphaQED at q
Definition: KKsem.h:33
**********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 WireHitLeft
Definition: TMDCWireHit.h:21
#define WireHitRight
Definition: TMDCWireHit.h:22
#define WireHitPatternLeft
Definition: TMDCWireHit.h:33
#define WireHitPatternRight
Definition: TMDCWireHit.h:34
#define TFitAlreadyFitted
Definition: TMFitter.h:28
#define TFitFailed
Definition: TMFitter.h:30
#define TFitErrorFewHits
Definition: TMFitter.h:29
#define Circle
Definition: TTrackBase.h:28
TTree * t
Definition: binning.cxx:23
void add_point(double x, double y, double w=1)
A class to represent a circle in tracking.
Definition: TCircle.h:42
HepPoint3D position(unsigned) const
returns left position. z is always zero.
Definition: TMDCWireHit.cxx:93
unsigned state(void) const
returns state.
Definition: TMDCWireHit.h:230
const HepPoint3D & xyPosition(void) const
returns drift time
Definition: TMDCWireHit.h:262
void fitDone(TTrackBase &) const
sets the fitted flag. (Bad implementation)
Definition: TMFitter.cxx:24

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