BOSS 7.0.7
BESIII Offline Software System
Loading...
Searching...
No Matches
TCircle.cxx
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2// $Id: TCircle.cxx,v 1.10 2010/03/31 09:58:59 liucy Exp $
3//-----------------------------------------------------------------------------
4// Filename : TCircle.cc
5// Section : Tracking
6// Owner : Yoshi Iwasaki
7// Email : [email protected]
8//-----------------------------------------------------------------------------
9// Description : A class to represent a circle in tracking.
10// See http://bsunsrv1.kek.jp/~yiwasaki/tracking/
11//-----------------------------------------------------------------------------
12
13#include "TrkReco/TCircle.h"
14#include "TrkReco/TMDCWire.h"
15#include "TrkReco/TMDCWireHit.h"
17#include "TrkReco/TMLink.h"
18
19const TCircleFitter
20TCircle::_fitter = TCircleFitter("TCircle Default Circle Fitter");
21
23: TTrackBase(a), _radius(0.), _charge(0.) {
24
25 //...Set a defualt fitter...
26 fitter(& TCircle::_fitter);
27}
28
30}
31
32void
33TCircle::dump(const std::string & msg, const std::string & pre) const {
34 bool def = false;
35 if (msg == "") def = true;
36
37 if (def || msg.find("circle") != std::string::npos || msg.find("detail") != std::string::npos) {
38 std::cout << pre;
39 std::cout << "#links=" << _links.length();
40 if (_fitted) {
41 std::cout << ",charge=" << _charge;
42 std::cout << ",center=" << _center;
43 std::cout << ",radius=" << _radius;
44 std::cout << std::endl << pre;
45 std::cout << "pt=" << pt();
46 std::cout << ",impact=" << impact();
47 std::cout << std::endl;
48 }
49 else {
50 std::cout << ", not fitted yet" << std::endl;
51 }
52 }
53 if (! def) TTrackBase::dump(msg, pre);
54}
55
56// int
57// TCircle::fitx(void) {
58// #ifdef TRKRECO_DEBUG_DETAIL
59// std::cout << " TCircle::fit ..." << std::endl;
60// #endif
61// if (_fitted) return 0;
62// unsigned n = _links.length();
63// if (n < 3) return -1;
64
65// for (unsigned i = 0; i < n; i++) {
66// TMLink * l = _links[i];
67// const TMDCWireHit * h = l->hit();
68
69// //...Check next hit...
70// Point3D point;
71// if (h->state() & WireHitPatternLeft)
72// point = h->position(WireHitLeft);
73// else if (h->state() & WireHitPatternRight)
74// point = h->position(WireHitRight);
75// else
76// point = h->xyPosition();
77// // float weight = 1. / (h->distance() * h->distance());
78// // float weight = 1. / h->distance();
79
80// _circle.add_point(point.x(), point.y()); //, weight);
81// }
82
83// if(_circle.fit()<0.0 || _circle.kappa()==0.0) return -1;
84// HepVector v(_circle.center());
85// _center.setX(v(1));
86// _center.setY(v(2));
87// _radius = _circle.radius();
88
89// //...Determine charge...Better way???
90// int qSum = 0;
91// for (unsigned i = 0; i < n; i++) {
92// TMLink * l = _links[i];
93// if (l == 0) continue;
94
95// const TMDCWireHit * h = l->hit();
96// if (h == 0) continue;
97
98// float q = (_center.cross(h->xyPosition())).z();
99// if (q > 0.) qSum += 1;
100// else qSum -= 1;
101// }
102// if (qSum >= 0) _charge = +1.;
103// else _charge = -1.;
104// _radius *= _charge;
105
106// _fitted = true;
107// return 0;
108// }
109
110double
111TCircle::weight(const TMLink & l) const {
112
113 //...Axial Wires
114 int maxLink = 0;
115 int localID[6];
116 int layerID[6];
117 int LayerID = l.hit()->wire()->layerId();
118 for(int i=0;i<6;i++){
119 if(l.neighbor(i)){
120 maxLink = i;
121 localID[i] = l.neighbor(i)->hit()->wire()->localId();
122 layerID[i] = l.neighbor(i)->hit()->wire()->layerId();
123 }else{
124 break;
125 }
126 }
127 if(maxLink != 1)return 1.0;
128 if(layerID[0] == LayerID &&
129 layerID[1] == LayerID)return 0.5;
130 if(layerID[0]+layerID[1] != LayerID*2)return 1.0;
131//Liuqg if(localID[0] != localID[1])return 1.5;//1.0 or 2.0 ??
132 return 1.0;
133}
134
135int
137 unsigned n = _links.length();
138 if (n < 3) return -1;
139
140 //IP check
141 unsigned flagIP = 1;
142 unsigned layerID = _links[0]->hit()->wire()->layerId();
143 for(unsigned i = 0; i < n; i++){
144 if(layerID != _links[i]->hit()->wire()->layerId()){
145 flagIP = 0;
146 break;
147 }
148 }
149 if(ipConst != 0)flagIP = 1;
150 if(flagIP == 1){
151 _circle.add_point(0., 0., 0.5);
152 //++_nPointsForFit;
153 }
154 for (unsigned i = 0; i < n; i++) {
155 TMLink * l = _links[i];
156 if (l == 0) continue;
157
158 const TMDCWireHit * h = l->hit();
159 if (h == 0) continue;
160
161 //...Check next hit...
162 HepPoint3D point;
163 point = h->xyPosition();
164
165 double weight = 1.0;
166 weight = this->weight(* l);
167
168 _circle.add_point(point.x(), point.y(), weight);
169 //++_nPointsForFit;
170 }
171
172 //if (_nPointsForFit < 3) return -1;
173 if(_circle.fit()<0.0 || _circle.kappa()==0.0) return -1;
174 HepVector v(_circle.center());
175 _center.setX(v(1));
176 _center.setY(v(2));
177 _radius = _circle.radius();
178
179 //...Determine charge...Better way???
180 int qSum = 0;
181 for (unsigned i = 0; i < n; i++) {
182 TMLink * l = _links[i];
183 if (l == 0) continue;
184
185 const TMDCWireHit * h = l->hit();
186 if (h == 0) continue;
187
188 float q = (_center.cross(h->xyPosition())).z();
189 if (q > 0.) qSum += 1;
190 else qSum -= 1;
191 }
192 if (qSum >= 0) _charge = +1.;
193 else _charge = -1.;
194 _radius *= _charge;
195
196 _fitted = true;
197 return 0;
198}
****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_MasPhot DOUBLE PRECISION m_phsu DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_r2 DOUBLE PRECISION m_WtMass INTEGER m_nmax INTEGER m_Nevgen INTEGER m_IsFSR INTEGER m_MarTot *COMMON c_KarFin $ !Output file $ !Event serial number $ !alpha QED at Thomson limit $ !minimum energy at CMS for remooval $ !infrared dimensionless $ !dummy photon IR regulator $ !crude photon multiplicity enhancement factor *EVENT $ !MC crude volume of PhhSpace *Sfactors $ !YFS formfactor IR part only $ !YFS formfactor non IR finite part $ !mass weight
Definition: KarFin.h:34
**********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
void add_point(double x, double y, double w=1)
A class to fit a TTrackBase object to a circle.
Definition: TCircleFitter.h:32
TCircle(const AList< TMLink > &links)
Constructor.
Definition: TCircle.cxx:22
virtual ~TCircle()
Destructor.
Definition: TCircle.cxx:29
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
Definition: TCircle.cxx:33
double weight(const TMLink &l) const
returns weight of TMLink in order to fit and make a circle.
Definition: TCircle.cxx:111
double impact(void) const
returns impact parameter to the origin.
Definition: TCircle.h:136
double pt(void) const
returns Pt.
Definition: TCircle.h:126
int fitForCurl(int ipConst=0)
fits itself. Error was happened if return value is not zero.
Definition: TCircle.cxx:136
const TMDCWire *const wire(void) const
returns a pointer to a TMDCWire.
Definition: TMDCWireHit.h:218
const HepPoint3D & xyPosition(void) const
returns drift time
Definition: TMDCWireHit.h:262
unsigned localId(void) const
returns local id in a wire layer.
Definition: TMDCWire.h:213
unsigned layerId(void) const
returns layer id.
Definition: TMDCWire.h:219
A virtual class for a track class in tracking.
Definition: TTrackBase.h:46
AList< TMLink > _links
Definition: TTrackBase.h:161
virtual void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
Definition: TTrackBase.cxx:58
bool _fitted
Definition: TTrackBase.h:162
const TMFitter *const fitter(void) const
returns a pointer to a default fitter.
Definition: TTrackBase.h:255