CGEM BOSS 6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
KalmanFit Namespace Reference

Classes

class  Helix
 Helix parameter class. More...
 
class  Lpar
 
class  Lpav
 

Functions

int intersect (const Lpar &lp1, const Lpar &lp2, HepVector &v1, HepVector &v2)
 
std::ostream & operator<< (std::ostream &o, Lpar &s)
 
std::ostream & operator<< (std::ostream &o, const Lpav &a)
 
Lpav operator+ (const Lpav &la1, const Lpav &la2)
 

Function Documentation

◆ intersect()

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

Definition at line 246 of file KalFitAlg/KalFitAlg-00-15-20/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
TCanvas * c1
Double_t phi2
Double_t phi1
int dc[18]
Definition EvtPycont.cc:42

◆ operator+()

Lpav KalmanFit::operator+ ( const Lpav & la1,
const Lpav & la2 )

Definition at line 630 of file KalFitAlg/KalFitAlg-00-15-20/src/lpav/Lpav.cxx.

633{
634#else
635{
636 Lpav la;
637#endif
638 la.m_wsum = la1.m_wsum + la2.m_wsum;
639 la.m_xsum = la1.m_xsum + la2.m_xsum;
640 la.m_ysum = la1.m_ysum + la2.m_ysum;
641 la.m_xxsum = la1.m_xxsum + la2.m_xxsum;
642 la.m_yysum = la1.m_yysum + la2.m_yysum;
643 la.m_xysum = la1.m_xysum + la2.m_xysum;
644 la.m_xrrsum = la1.m_xrrsum + la2.m_xrrsum;
645 la.m_yrrsum = la1.m_yrrsum + la2.m_yrrsum;
646 la.m_rrrrsum = la1.m_rrrrsum + la2.m_rrrrsum;
647 la.m_nc = la1.m_nc + la2.m_nc;
648 return la;
649}

◆ operator<<() [1/2]

std::ostream & KalmanFit::operator<< ( std::ostream & o,
const Lpav & a )

Definition at line 241 of file KalFitAlg/KalFitAlg-00-15-20/src/lpav/Lpav.cxx.

241 {
242// o << "wsum=" << a.m_wsum << " xsum=" << a.m_xsum << " ysum=" << a.m_ysum
243// << " xxsum=" << a.m_xxsum << " xysum=" << a.m_xysum
244// << " yysum=" << a.m_yysum
245// << " xrrsum=" << a.m_xrrsum << " yrrsum=" << a.m_yrrsum
246// << " rrrrsum=" << a.m_rrrrsum;
247// o << " rscale=" << a.m_rscale
248// << " xxavp=" << a.m_xxavp << " yyavp=" << a.m_yyavp
249// << " xrravp=" << a.m_xrravp << " yrravp=" << a.m_yrravp
250// << " rrrravp=" << a.m_rrrravp << " cosrot=" << a.m_cosrot
251// << " sinrot=" << a.m_sinrot
252// << endl;
253 o << " nc=" << a.m_nc << " chisq=" << a.m_chisq << " " << (Lpar&) a;
254 return o;
255}

◆ operator<<() [2/2]

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

Definition at line 322 of file KalFitAlg/KalFitAlg-00-15-20/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}
XmlRpcServer s