11#include "CLHEP/Vector/Sqr.h"
12#include "trg/cdc/Lpar.h"
80 double delta = (x1 - x2) * (y1 - y3) - (y1 - y2) * (x1 - x3);
86 double r12sq = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
88 double r12 =
sqrt(r12sq);
93 double r13sq = (x1 - x3) * (x1 - x3) + (y1 - y3) * (y1 - y3);
95 double r13 =
sqrt(r13sq);
100 double r23sq = (x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3);
102 double r23 =
sqrt(r23sq);
103 m_beta = -(x2 - x3) / r23;
114 double r1sq = x1 * x1 + y1 * y1;
115 double r2sq = x2 * x2 + y2 * y2;
116 double r3sq = x3 * x3 + y3 * y3;
117 double a = 0.5 * ((y1 - y3) * (r1sq - r2sq) - (y1 - y2) * (r1sq - r3sq)) / delta;
118 double b = 0.5 * (- (x1 - x3) * (r1sq - r2sq) + (x1 - x2) * (r1sq - r3sq)) / delta;
119 double csq = (x1 - a) * (x1 - a) + (y1 - b) * (y1 - b);
120 double c =
sqrt(csq);
131#ifdef BELLE_OPTIMIZED_RETURN
136 CLHEP::HepMatrix vret(3, 4);
142 vret(1, 1) = 2 * cp.da() *
s;
143 vret(1, 2) = -2 * cp.da() * c;
144 vret(1, 3) = cp.da() * cp.da();
150 vret(3, 1) = 2 * cp.cu() *
s;
151 vret(3, 2) = -2 * cp.cu() * c;
159 double t_kr2g =
kr2g(r);
160 double t_xi2 =
xi2();
161 double ro = r * r * t_xi2 - t_kr2g * t_kr2g;
162 if (ro < 0)
return false;
163 double rs =
sqrt(ro);
191 if (!
xy(r,
x,
y, dir))
return -1;
192 double p = atan2(
y,
x);
193 if (p < 0) p += (2 * M_PI);
199 double ddm =
dr(
x,
y);
205 double kdp1 = 1 + 2 *
kappa() * ddm;
212 double xh, yh, xx, yy;
214 double fk = fabs(
kappa());
215 if (fk == 0)
return 0;
216 yy = 2 * fk * (
alpha() * yh -
beta() * xh);
218 double sp = atan2(yy, xx);
219 if (sp < 0) sp += (2 * M_PI);
226 if (fabs(r) < fabs(
d0))
return -1;
228 if (fabs(b) > 1)
return -1;
229 if (dir == 0)
return asin(b) / fabs(
kappa());
230 return (M_PI - asin(b)) / fabs(
kappa());
234#ifdef BELLE_OPTIMIZED_RETURN
239 CLHEP::HepVector v(3);
251 CLHEP::HepVector cen1(lp1.
center());
252 CLHEP::HepVector cen2(lp2.
center());
253 double dx = cen1(1) - cen2(1);
254 double dy = cen1(2) - cen2(2);
255 double dc =
sqrt(dx * dx + dy * dy);
256 if (dc < fabs(0.5 / lp1.
kappa()) + fabs(0.5 / lp2.
kappa())) {
257 double a1 = sqr(lp1.
alpha()) + sqr(lp1.
beta());
258 double a2 = sqr(lp2.
alpha()) + sqr(lp2.
beta());
261 if (fabs(det) > 1e-12) {
262 double c1 = a2 * sqr(lp1.
kappa()) + a1 * sqr(lp2.
kappa()) -
265 double cinv = 1.0 / c1;
266 double c2 = sqr(a3) - 0.5 * (a1 + a2) - 2.0 * a3 *
268 double c3 = a2 * sqr(lp1.
gamma()) + a1 * sqr(lp2.
gamma()) -
270 double root = sqr(c2) - 4.0 * c1 * c3;
274 rad2[0] = 0.5 * cinv * (-c2 - root);
275 rad2[1] = 0.5 * cinv * (-c2 + root);
280 double dinv = 1.0 / det;
281 v1(1) = dinv * (ab1 + ac1 * rad2[0]);
282 v1(2) = dinv * (ab2 + ac2 * rad2[0]);
284 v2(1) = dinv * (ab1 + ac1 * rad2[1]);
285 v2(2) = dinv * (ab2 + ac2 * rad2[1]);
329 return o <<
" al=" <<
s.m_alpha <<
" be=" <<
s.m_beta
330 <<
" ka=" <<
s.m_kappa <<
" ga=" <<
s.m_gamma;
double m_cfi
parameter of Cpar class
double m_fi
parameter of Cpar class
double m_sfi
parameter of Cpar class
double m_cu
parameter of Cpar class
double m_da
parameter of Cpar class
double m_beta
data members
double m_kappa
data members
double xc() const
private const member functions
friend std::ostream & operator<<(std::ostream &o, const TRGCDCLpar &)
ostream operator
double m_gamma
data members
double kappa() const
const member functions
double gamma() const
private const member functions
double da() const
private const member functions
double kr2g(double r) const
private const member functions
double beta() const
private const member functions
friend int intersect(const TRGCDCLpar &, const TRGCDCLpar &, CLHEP::HepVector &, CLHEP::HepVector &)
intersection
double m_alpha
data members
double yc() const
private const member functions
double alpha() const
private const member functions
double xi2() const
private const member functions
double sqrt(double a)
sqrt for double
double d0(double x, double y) const
private const member functions
void circle(double x1, double y1, double x2, double y2, double x3, double y3)
circle
double s(double x, double y) const
const member functions
CLHEP::HepMatrix dldc() const
private const member functions
bool xy(double, double &, double &, int dir=0) const
private const member functions
double x(double r) const
private const member functions
Cpar(const TRGCDCLpar &)
constructor of Cpar class
void xhyh(double x, double y, double &xh, double &yh) const
private const member functions
static const double BELLE_ALPHA
belle alpha
virtual ~TRGCDCLpar()
Destructor.
double y(double r) const
private const member functions
CLHEP::HepVector center() const
const member functions
double phi(double r, int dir=0) const
const member functions
double dr(double x, double y) const
const member functions
Abstract base class for different kinds of events.