CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
KalmanFit::Lpar Class Reference

#include <Lpar.h>

+ Inheritance diagram for KalmanFit::Lpar:

Public Member Functions

 Lpar ()
 
virtual ~Lpar ()
 
const Lparoperator= (const Lpar &)
 
void neg ()
 
void circle (double x1, double y1, double x2, double y2, double x3, double y3)
 
double kappa () const
 
double radius () const
 
HepVector center () const
 
double s (double x, double y) const
 
double d (double x, double y) const
 
double dr (double x, double y) const
 
double s (double r, int dir=0) const
 
double phi (double r, int dir=0) const
 
int sd (double r, double x, double y, double limit, double &s, double &d) const
 
HepVector Hpar (const HepPoint3D &pivot) const
 

Friends

class Lpav
 
class Lpar::Cpar
 
std::ostream & operator<< (std::ostream &o, Lpar &s)
 
int intersect (const Lpar &lp1, const Lpar &lp2, HepVector &v1, HepVector &v2)
 

Detailed Description

Constructor & Destructor Documentation

◆ Lpar()

Lpar::Lpar ( )
inline

Definition at line 155 of file KalFitAlg/KalFitAlg-00-15-18/KalFitAlg/lpav/Lpar.h.

155 {
156 m_alpha = 0;
157 m_beta = 1;
158 m_gamma = 0;
159 m_kappa = 0;
160}

◆ ~Lpar()

Lpar::~Lpar ( )
virtual

Definition at line 56 of file KalFitAlg/KalFitAlg-00-15-18/src/lpav/Lpar.cxx.

57{
58}

Member Function Documentation

◆ center()

HepVector Lpar::center ( ) const

Definition at line 232 of file KalFitAlg/KalFitAlg-00-15-18/src/lpav/Lpar.cxx.

235{
236#else
237{
238 HepVector v(3);
239#endif
240 v(1) = xc();
241 v(2) = yc();
242 v(3) = 0;
243 return(v);
244}
**********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

Referenced by KalFitWire::z().

◆ circle()

void Lpar::circle ( double x1,
double y1,
double x2,
double y2,
double x3,
double y3 )

Definition at line 81 of file KalFitAlg/KalFitAlg-00-15-18/src/lpav/Lpar.cxx.

82 {
83 double a;
84 double b;
85 double c;
86 double delta = (x1-x2)*(y1-y3) - (y1-y2)*(x1-x3);
87 if(delta==0) {
88 //
89 // three points are on a line.
90 //
91 m_kappa = 0;
92 double r12sq = (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2);
93 if (r12sq>0) {
94 double r12 = sqrt(r12sq);
95 m_beta = -(x1-x2)/r12;
96 m_alpha = (y1-y2)/r12;
97 m_gamma = - (m_alpha*x1+m_beta*y1);
98 } else {
99 double r13sq = (x1-x3)*(x1-x3) + (y1-y3)*(y1-y3);
100 if (r13sq>0) {
101 double r13 = sqrt(r13sq);
102 m_beta = -(x1-x3)/r13;
103 m_alpha = (y1-y3)/r13;
104 m_gamma = - (m_alpha*x3+m_beta*y3);
105 } else {
106 double r23sq = (x2-x3)*(x2-x3) + (y2-y3)*(y2-y3);
107 if (r23sq>0) {
108 double r23 = sqrt(r23sq);
109 m_beta = -(x2-x3)/r23;
110 m_alpha = (y2-y3)/r23;
111 m_gamma = - (m_alpha*x3+m_beta*y3);
112 } else {
113 m_alpha = 1;
114 m_beta = 0;
115 m_gamma = 0;
116 }
117 }
118 }
119 } else {
120 double r1sq = x1 * x1 + y1 * y1;
121 double r2sq = x2 * x2 + y2 * y2;
122 double r3sq = x3 * x3 + y3 * y3;
123 a = 0.5 * ( (y1-y3)*(r1sq-r2sq) - (y1-y2)*(r1sq-r3sq)) / delta;
124 b = 0.5 * (- (x1-x3)*(r1sq-r2sq) + (x1-x2)*(r1sq-r3sq)) / delta;
125 double csq = (x1-a)*(x1-a) + (y1-b)*(y1-b);
126 c = sqrt(csq);
127 double csq2 = (x2-a)*(x2-a) + (y2-b)*(y2-b);
128 double csq3 = (x3-a)*(x3-a) + (y3-b)*(y3-b);
129 m_kappa = 1 / (2 * c);
130 m_alpha = - 2 * a * m_kappa;
131 m_beta = - 2 * b * m_kappa;
132 m_gamma = (a*a + b*b - c*c) * m_kappa;
133 }
134}

◆ d()

double Lpar::d ( double x,
double y ) const
inline

Definition at line 207 of file KalFitAlg/KalFitAlg-00-15-18/KalFitAlg/lpav/Lpar.h.

207 {
208 double dd = d0(x,y);
209 const double approx_limit = 0.2;
210 if(std::fabs(m_kappa*dd)>approx_limit) return -1;
211 return dd * ( 1 - m_kappa * dd );
212}

Referenced by KalmanFit::Lpav::delta_chisq(), and sd().

◆ dr()

double Lpar::dr ( double x,
double y ) const
inline

Definition at line 214 of file KalFitAlg/KalFitAlg-00-15-18/KalFitAlg/lpav/Lpar.h.

214 {
215 double dx = xc() - x;
216 double dy = yc() - y;
217 double r = 0.5/std::fabs(m_kappa);
218 return std::fabs(std::sqrt(dx * dx + dy * dy) - r);
219}

◆ Hpar()

HepVector Lpar::Hpar ( const HepPoint3D & pivot) const
inline

Definition at line 268 of file KalFitAlg/KalFitAlg-00-15-18/KalFitAlg/lpav/Lpar.h.

268 {
269 HepVector a(5);
270 double dd = d0(pivot.x(),pivot.y());
271 a(1) = dd * ( m_kappa * dd - 1 );
272 a(2) = (m_kappa>0) ? std::atan2(yc() - pivot.y(), xc() - pivot.x()) + M_PI
273 : std::atan2(pivot.y() - yc(), pivot.x() - xc()) - M_PI;
274 a(3) = -2.0*BELLE_ALPHA*m_kappa;
275 a(4) = 0;
276 a(5) = 0;
277 return a;
278}
#define M_PI
Definition TConstant.h:4

◆ kappa()

double KalmanFit::Lpar::kappa ( ) const
inline

Definition at line 63 of file KalFitAlg/KalFitAlg-00-15-18/KalFitAlg/lpav/Lpar.h.

63{ return m_kappa; }

Referenced by s(), and s().

◆ neg()

void Lpar::neg ( )
inline

Definition at line 196 of file KalFitAlg/KalFitAlg-00-15-18/KalFitAlg/lpav/Lpar.h.

196 {
197 m_alpha = -m_alpha;
198 m_beta = -m_beta;
199 m_gamma = -m_gamma;
200 m_kappa = -m_kappa;
201}

Referenced by KalmanFit::Lpav::calculate_lpar(), and KalmanFit::Lpav::calculate_lpar3().

◆ operator=()

const Lpar & Lpar::operator= ( const Lpar & l)
inline

Definition at line 169 of file KalFitAlg/KalFitAlg-00-15-18/KalFitAlg/lpav/Lpar.h.

169 {
170 if (this != &l) {
171 m_alpha = l.m_alpha;
172 m_beta = l.m_beta;
173 m_gamma = l.m_gamma;
174 m_kappa = l.m_kappa;
175 }
176 return *this;
177}

Referenced by KalmanFit::Lpav::operator=().

◆ phi()

double Lpar::phi ( double r,
int dir = 0 ) const

Definition at line 191 of file KalFitAlg/KalFitAlg-00-15-18/src/lpav/Lpar.cxx.

191 {
192 double x, y;
193 if (!xy(r,x,y, dir)) return -1;
194 double p = atan2(y,x);
195 if (p<0) p += (2*M_PI);
196 return p;
197}

Referenced by KalmanFit::Lpav::extrapolate(), and sd().

◆ radius()

double KalmanFit::Lpar::radius ( ) const
inline

Definition at line 64 of file KalFitAlg/KalFitAlg-00-15-18/KalFitAlg/lpav/Lpar.h.

64{ return 0.5/std::fabs(m_kappa);}

Referenced by KalFitWire::z().

◆ s() [1/2]

double Lpar::s ( double r,
int dir = 0 ) const

Definition at line 223 of file KalFitAlg/KalFitAlg-00-15-18/src/lpav/Lpar.cxx.

223 {
224 double d0 = da();
225 if (fabs(r)<fabs(d0)) return -1;
226 double b = fabs(kappa()) * sqrt((r*r-d0*d0)/(1 + 2 * kappa() * d0));
227 if (fabs(b)>1) return -1;
228 if(dir==0)return asin(b)/fabs(kappa());
229 return (M_PI-asin(b))/fabs(kappa());
230}

◆ s() [2/2]

double Lpar::s ( double x,
double y ) const

Definition at line 211 of file KalFitAlg/KalFitAlg-00-15-18/src/lpav/Lpar.cxx.

211 {
212 double xh, yh, xx, yy;
213 xhyh(x, y, xh, yh);
214 double fk = fabs(kappa());
215 if (fk==0) return 0;
216 yy = 2 * fk * ( alpha() * yh - beta() * xh);
217 xx = 2 * kappa() * ( alpha() * xh + beta() * yh ) + xi2();
218 double sp = atan2(yy, xx);
219 if (sp<0) sp += (2*M_PI);
220 return sp / 2 / fk;
221}

◆ sd()

int Lpar::sd ( double r,
double x,
double y,
double limit,
double & s,
double & d ) const
inline

Definition at line 248 of file KalFitAlg/KalFitAlg-00-15-18/KalFitAlg/lpav/Lpar.h.

249 {
250 if ((x*yc()-y*xc())*m_kappa<0) return 0;
251 double dd = d0(x,y);
252 d = dd * ( 1 - m_kappa * dd );
253 double d_cross_limit = d*limit;
254 if (d_cross_limit < 0 || d_cross_limit > limit*limit) return 0;
255
256 double rc = std::sqrt(m_alpha*m_alpha+m_beta*m_beta)/(2*m_kappa);
257 double rho = 1./(-2*m_kappa);
258 double cosPhi = (rc*rc + rho*rho - r*r)/(-2*rc*rho);
259 double phi = std::acos(cosPhi);
260 s = std::fabs(rho)*phi;
261 d *= r/(std::fabs(rc)*std::sin(phi));
262 if (abs(d) > abs(limit)) return 0;
263 d_cross_limit = d*limit;
264 if (d_cross_limit > limit*limit) return 0;
265 return 1;
266}
double abs(const EvtComplex &c)
XmlRpcServer s
double phi(double r, int dir=0) const

Friends And Related Symbol Documentation

◆ intersect

int intersect ( const Lpar & lp1,
const Lpar & lp2,
HepVector & v1,
HepVector & v2 )
friend

Definition at line 246 of file KalFitAlg/KalFitAlg-00-15-18/src/lpav/Lpar.cxx.

246 {
247 HepVector cen1(lp1.center());
248 HepVector cen2(lp2.center());
249 double dx = cen1(1)-cen2(1);
250 double dy = cen1(2)-cen2(2);
251 double dc = sqrt(dx*dx+dy*dy);
252 if(dc<fabs(0.5/lp1.kappa())+fabs(0.5/lp2.kappa())) {
253 double a1 = std::sqrt(lp1.alpha()) + std::sqrt(lp1.beta());
254 double a2 = std::sqrt(lp2.alpha()) + std::sqrt(lp2.beta());
255 double a3 = lp1.alpha()*lp2.alpha() + lp1.beta()*lp2.beta();
256 double det = lp1.alpha()*lp2.beta() - lp1.beta()*lp2.alpha();
257 if(fabs(det)>1e-12) {
258 double c1 = a2 * std::sqrt(lp1.kappa()) + a1 * std::sqrt(lp2.kappa()) -
259 2.0 * a3 * lp1.kappa() * lp2.kappa();
260 if(c1!=0) {
261 double cinv = 1.0 / c1;
262 double c2 = std::sqrt(a3) - 0.5 * (a1 + a2) - 2.0 * a3 *
263 (lp1.gamma() * lp2.kappa() + lp2.gamma() * lp1.kappa());
264 double c3 = a2 * std::sqrt(lp1.gamma()) + a1 * std::sqrt(lp2.gamma()) -
265 2.0 * a3 * lp1.gamma() * lp2.gamma();
266 double root = std::sqrt(c2) - 4.0 * c1 * c3;
267 if (root>=0) {
268 root = sqrt(root);
269 double rad2[2];
270 rad2[0] = 0.5 * cinv * (-c2 - root);
271 rad2[1] = 0.5 * cinv * (-c2 + root);
272 double ab1 = -(lp2.beta() * lp1.gamma() - lp1.beta() * lp2.gamma());
273 double ab2 = (lp2.alpha() * lp1.gamma() - lp1.alpha() * lp2.gamma());
274 double ac1 = -(lp2.beta() * lp1.kappa() - lp1.beta() * lp2.kappa());
275 double ac2 = (lp2.alpha() * lp1.kappa() - lp1.alpha() * lp2.kappa());
276 double dinv = 1.0 / det;
277 v1(1) = dinv * (ab1 + ac1 * rad2[0]);
278 v1(2) = dinv * (ab2 + ac2 * rad2[0]);
279 v1(3) = 0;
280 v2(1) = dinv * (ab1 + ac1 * rad2[1]);
281 v2(2) = dinv * (ab2 + ac2 * rad2[1]);
282 v2(3) = 0;
283 double d1 = lp1.d(v1(1),v1(2));
284 double d2 = lp2.d(v1(1),v1(2));
285 double d3 = lp1.d(v2(1),v2(2));
286 double d4 = lp2.d(v2(1),v2(2));
287 double r = sqrt(rad2[0]);
288 Lpar::Cpar cp1(lp1);
289 Lpar::Cpar cp2(lp2);
290 for(int j=0;j<2;j++) {
291 double s1,s2;
292 if(j==0) {
293 s1 = lp1.s(v1(1),v1(2));
294 s2 = lp2.s(v1(1),v1(2));
295 } else {
296 s1 = lp1.s(v2(1),v2(2));
297 s2 = lp2.s(v2(1),v2(2));
298 }
299 double phi1 = cp1.fi() + 2 * cp1.cu() * s1;
300 double phi2 = cp2.fi() + 2 * cp2.cu() * s2;
301 double f = (1 + 2 * cp1.cu() * cp1.da()) *
302 (1 + 2 * cp2.cu() * cp2.da()) * cos(cp1.fi()-cp2.fi());
303 f -= 2 * (lp1.gamma() * lp2.kappa() + lp2.gamma() * lp1.kappa());
304 double cosphi12 = f;
305 }
306 return 2;
307 }
308 }
309 }
310 }
311 return 0;
312}
double cos(const BesAngle a)
Definition BesAngle.h:213
std::string root
Double_t phi2
Double_t phi1
int dc[18]
Definition EvtPycont.cc:42
double d(double x, double y) const
double s(double x, double y) const
TCanvas * c1
Definition tau_mode.c:75

◆ Lpar::Cpar

friend class Lpar::Cpar
friend

◆ Lpav

friend class Lpav
friend

◆ operator<<

std::ostream & operator<< ( std::ostream & o,
Lpar & s )
friend

Definition at line 322 of file KalFitAlg/KalFitAlg-00-15-18/src/lpav/Lpar.cxx.

322 {
323 return o << " al=" << s.m_alpha << " be=" << s.m_beta
324 << " ka=" << s.m_kappa << " ga=" << s.m_gamma;
325}

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