BOSS 8.0.0
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 : yoshihito.iwasaki@kek.jp
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"
16#include "TrkReco/TMDCWireHitMC.h"
17#include "TrkReco/TMLink.h"
18
19const TCircleFitter TCircle::_fitter = TCircleFitter( "TCircle Default Circle Fitter" );
20
21TCircle::TCircle( const AList<TMLink>& a ) : TTrackBase( a ), _radius( 0. ), _charge( 0. ) {
22
23 //...Set a defualt fitter...
24 fitter( &TCircle::_fitter );
25}
26
28
29void TCircle::dump( const std::string& msg, const std::string& pre ) const {
30 bool def = false;
31 if ( msg == "" ) def = true;
32
33 if ( def || msg.find( "circle" ) != std::string::npos ||
34 msg.find( "detail" ) != std::string::npos )
35 {
36 std::cout << pre;
37 std::cout << "#links=" << _links.length();
38 if ( _fitted )
39 {
40 std::cout << ",charge=" << _charge;
41 std::cout << ",center=" << _center;
42 std::cout << ",radius=" << _radius;
43 std::cout << std::endl << pre;
44 std::cout << "pt=" << pt();
45 std::cout << ",impact=" << impact();
46 std::cout << std::endl;
47 }
48 else { std::cout << ", not fitted yet" << std::endl; }
49 }
50 if ( !def ) TTrackBase::dump( msg, pre );
51}
52
53// int
54// TCircle::fitx(void) {
55// #ifdef TRKRECO_DEBUG_DETAIL
56// std::cout << " TCircle::fit ..." << std::endl;
57// #endif
58// if (_fitted) return 0;
59// unsigned n = _links.length();
60// if (n < 3) return -1;
61
62// for (unsigned i = 0; i < n; i++) {
63// TMLink * l = _links[i];
64// const TMDCWireHit * h = l->hit();
65
66// //...Check next hit...
67// Point3D point;
68// if (h->state() & WireHitPatternLeft)
69// point = h->position(WireHitLeft);
70// else if (h->state() & WireHitPatternRight)
71// point = h->position(WireHitRight);
72// else
73// point = h->xyPosition();
74// // float weight = 1. / (h->distance() * h->distance());
75// // float weight = 1. / h->distance();
76
77// _circle.add_point(point.x(), point.y()); //, weight);
78// }
79
80// if(_circle.fit()<0.0 || _circle.kappa()==0.0) return -1;
81// HepVector v(_circle.center());
82// _center.setX(v(1));
83// _center.setY(v(2));
84// _radius = _circle.radius();
85
86// //...Determine charge...Better way???
87// int qSum = 0;
88// for (unsigned i = 0; i < n; i++) {
89// TMLink * l = _links[i];
90// if (l == 0) continue;
91
92// const TMDCWireHit * h = l->hit();
93// if (h == 0) continue;
94
95// float q = (_center.cross(h->xyPosition())).z();
96// if (q > 0.) qSum += 1;
97// else qSum -= 1;
98// }
99// if (qSum >= 0) _charge = +1.;
100// else _charge = -1.;
101// _radius *= _charge;
102
103// _fitted = true;
104// return 0;
105// }
106
107double TCircle::weight( const TMLink& l ) const {
108
109 //...Axial Wires
110 int maxLink = 0;
111 int localID[6];
112 int layerID[6];
113 int LayerID = l.hit()->wire()->layerId();
114 for ( int i = 0; i < 6; i++ )
115 {
116 if ( l.neighbor( i ) )
117 {
118 maxLink = i;
119 localID[i] = l.neighbor( i )->hit()->wire()->localId();
120 layerID[i] = l.neighbor( i )->hit()->wire()->layerId();
121 }
122 else { break; }
123 }
124 if ( maxLink != 1 ) return 1.0;
125 if ( layerID[0] == LayerID && layerID[1] == LayerID ) return 0.5;
126 if ( layerID[0] + layerID[1] != LayerID * 2 ) return 1.0;
127 // Liuqg if(localID[0] != localID[1])return 1.5;//1.0 or 2.0 ??
128 return 1.0;
129}
130
131int TCircle::fitForCurl( int ipConst ) {
132 unsigned n = _links.length();
133 if ( n < 3 ) return -1;
134
135 // IP check
136 unsigned flagIP = 1;
137 unsigned layerID = _links[0]->hit()->wire()->layerId();
138 for ( unsigned i = 0; i < n; i++ )
139 {
140 if ( layerID != _links[i]->hit()->wire()->layerId() )
141 {
142 flagIP = 0;
143 break;
144 }
145 }
146 if ( ipConst != 0 ) flagIP = 1;
147 if ( flagIP == 1 )
148 {
149 _circle.add_point( 0., 0., 0.5 );
150 //++_nPointsForFit;
151 }
152 for ( unsigned i = 0; i < n; i++ )
153 {
154 TMLink* l = _links[i];
155 if ( l == 0 ) continue;
156
157 const TMDCWireHit* h = l->hit();
158 if ( h == 0 ) continue;
159
160 //...Check next hit...
161 HepPoint3D point;
162 point = h->xyPosition();
163
164 double weight = 1.0;
165 weight = this->weight( *l );
166
167 _circle.add_point( point.x(), point.y(), weight );
168 //++_nPointsForFit;
169 }
170
171 // if (_nPointsForFit < 3) return -1;
172 if ( _circle.fit() < 0.0 || _circle.kappa() == 0.0 ) return -1;
173 HepVector v( _circle.center() );
174 _center.setX( v( 1 ) );
175 _center.setY( v( 2 ) );
176 _radius = _circle.radius();
177
178 //...Determine charge...Better way???
179 int qSum = 0;
180 for ( unsigned i = 0; i < n; i++ )
181 {
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}
const Int_t n
****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
HepGeom::Point3D< double > HepPoint3D
A class to fit a TTrackBase object to a circle.
TCircle(const AList< TMLink > &links)
Constructor.
Definition TCircle.cxx:21
virtual ~TCircle()
Destructor.
Definition TCircle.cxx:27
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
Definition TCircle.cxx:29
double weight(const TMLink &l) const
returns weight of TMLink in order to fit and make a circle.
Definition TCircle.cxx:107
double impact(void) const
returns impact parameter to the origin.
int fitForCurl(int ipConst=0)
fits itself. Error was happened if return value is not zero.
Definition TCircle.cxx:131
const TMDCWire *const wire(void) const
returns a pointer to a TMDCWire.
const HepPoint3D & xyPosition(void) const
returns drift time
unsigned localId(void) const
returns local id in a wire layer.
unsigned layerId(void) const
returns layer id.
virtual void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
const TMFitter *const fitter(void) const
returns a pointer to a default fitter.
TTrackBase()
Constructor.