BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
Lpar Class Reference

#include <Lpar.h>

+ Inheritance diagram for 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
 
 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 &)
 
int intersect (const Lpar &, const Lpar &, HepVector &, HepVector &)
 
std::ostream & operator<< (std::ostream &o, Lpar &)
 
int intersect (const Lpar &, const Lpar &, HepVector &, HepVector &)
 

Detailed Description

Constructor & Destructor Documentation

◆ Lpar() [1/2]

Lpar::Lpar ( )
inline

Definition at line 156 of file KalFitAlg/KalFitAlg-00-07-55-p03/KalFitAlg/lpav/Lpar.h.

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

◆ ~Lpar() [1/2]

Lpar::~Lpar ( )
virtual

Definition at line 52 of file KalFitAlg/KalFitAlg-00-07-55-p03/src/lpav/Lpar.cxx.

53{
54}

◆ Lpar() [2/2]

Lpar::Lpar ( )

◆ ~Lpar() [2/2]

virtual Lpar::~Lpar ( )
virtual

Member Function Documentation

◆ center() [1/2]

HepVector Lpar::center ( ) const

Definition at line 228 of file KalFitAlg/KalFitAlg-00-07-55-p03/src/lpav/Lpar.cxx.

231{
232#else
233{
234 HepVector v(3);
235#endif
236 v(1) = xc();
237 v(2) = yc();
238 v(3) = 0;
239 return(v);
240}
**********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 TCircleFitter::fit(), TCircle::fitForCurl(), intersect(), FTTrack::r_phiFit(), KalFitWire::z(), and FTWire::z().

◆ center() [2/2]

HepVector Lpar::center ( ) const

◆ circle() [1/2]

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

Definition at line 77 of file KalFitAlg/KalFitAlg-00-07-55-p03/src/lpav/Lpar.cxx.

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

◆ circle() [2/2]

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

◆ d() [1/2]

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

Definition at line 208 of file KalFitAlg/KalFitAlg-00-07-55-p03/KalFitAlg/lpav/Lpar.h.

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

Referenced by Lpav::delta_chisq(), intersect(), operator+(), FTTrack::r_phi2Fit(), FTTrack::r_phi3Fit(), FTTrack::r_phi4Fit(), FTTrack::r_phiFit(), FTTrack::r_phiReFit(), and sd().

◆ d() [2/2]

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

◆ dr() [1/2]

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

Definition at line 215 of file KalFitAlg/KalFitAlg-00-07-55-p03/KalFitAlg/lpav/Lpar.h.

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

◆ dr() [2/2]

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

◆ Hpar() [1/2]

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

Definition at line 269 of file KalFitAlg/KalFitAlg-00-07-55-p03/KalFitAlg/lpav/Lpar.h.

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

Referenced by FTTrack::r_phi2Fit(), FTTrack::r_phi3Fit(), FTTrack::r_phi4Fit(), FTTrack::r_phiFit(), FTTrack::r_phiReFit(), and FTTrack::s_zFit().

◆ Hpar() [2/2]

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

◆ kappa() [1/2]

double Lpar::kappa ( ) const
inline

Definition at line 63 of file KalFitAlg/KalFitAlg-00-07-55-p03/KalFitAlg/lpav/Lpar.h.

63{ return m_kappa; }

Referenced by TCircleFitter::fit(), TCircle::fitForCurl(), intersect(), and s().

◆ kappa() [2/2]

double Lpar::kappa ( ) const
inline

Definition at line 73 of file TrackUtil/TrackUtil-00-00-08/TrackUtil/Lpar.h.

73{ return m_kappa; }

◆ neg() [1/2]

void Lpar::neg ( )
inline

Definition at line 197 of file KalFitAlg/KalFitAlg-00-07-55-p03/KalFitAlg/lpav/Lpar.h.

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

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

◆ neg() [2/2]

void Lpar::neg ( )
inline

◆ operator=() [1/2]

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

Definition at line 170 of file KalFitAlg/KalFitAlg-00-07-55-p03/KalFitAlg/lpav/Lpar.h.

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

Referenced by Lpav::operator=().

◆ operator=() [2/2]

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

◆ phi() [1/2]

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

Definition at line 187 of file KalFitAlg/KalFitAlg-00-07-55-p03/src/lpav/Lpar.cxx.

187 {
188 double x, y;
189 if (!xy(r,x,y, dir)) return -1;
190 double p = atan2(y,x);
191 if (p<0) p += (2*M_PI);
192 return p;
193}

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

◆ phi() [2/2]

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

◆ radius() [1/2]

double Lpar::radius ( ) const
inline

Definition at line 64 of file KalFitAlg/KalFitAlg-00-07-55-p03/KalFitAlg/lpav/Lpar.h.

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

Referenced by TCircleFitter::fit(), TCircle::fitForCurl(), KalFitWire::z(), and FTWire::z().

◆ radius() [2/2]

double Lpar::radius ( ) const
inline

Definition at line 74 of file TrackUtil/TrackUtil-00-00-08/TrackUtil/Lpar.h.

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

◆ s() [1/4]

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

Definition at line 219 of file KalFitAlg/KalFitAlg-00-07-55-p03/src/lpav/Lpar.cxx.

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

◆ s() [2/4]

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

◆ s() [3/4]

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

Definition at line 207 of file KalFitAlg/KalFitAlg-00-07-55-p03/src/lpav/Lpar.cxx.

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

Referenced by intersect(), and FTTrack::s_zFit().

◆ s() [4/4]

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

◆ sd() [1/2]

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

Definition at line 249 of file KalFitAlg/KalFitAlg-00-07-55-p03/KalFitAlg/lpav/Lpar.h.

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

Referenced by FTSegment::update3D().

◆ sd() [2/2]

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

Friends And Related Function Documentation

◆ intersect [1/2]

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

Definition at line 242 of file KalFitAlg/KalFitAlg-00-07-55-p03/src/lpav/Lpar.cxx.

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

◆ intersect [2/2]

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

Definition at line 242 of file KalFitAlg/KalFitAlg-00-07-55-p03/src/lpav/Lpar.cxx.

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

◆ Lpar::Cpar

Lpar::Cpar
friend

◆ Lpav

◆ operator<< [1/2]

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

Definition at line 318 of file KalFitAlg/KalFitAlg-00-07-55-p03/src/lpav/Lpar.cxx.

318 {
319 return o << " al=" << s.m_alpha << " be=" << s.m_beta
320 << " ka=" << s.m_kappa << " ga=" << s.m_gamma;
321}

◆ operator<< [2/2]

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

Definition at line 318 of file KalFitAlg/KalFitAlg-00-07-55-p03/src/lpav/Lpar.cxx.

318 {
319 return o << " al=" << s.m_alpha << " be=" << s.m_beta
320 << " ka=" << s.m_kappa << " ga=" << s.m_gamma;
321}

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