CGEM BOSS 6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
KalFitAlg/KalFitAlg-00-15-20/src/lpav/Lpav.cxx
Go to the documentation of this file.
1// -*- C++ -*-
2//
3// Package: <package>
4// Module: Lpav
5//
6// Description: <one line class summary>
7//
8// Implimentation:
9// <Notes on implimentation>
10//
11// Author: KATAYAMA Nobuhiko
12// Created: Fri Feb 6 10:21:46 JST 1998
13
14// system include files
15
16#include <cmath>
17#include <iostream>
18
19// user include files
20#include "KalFitAlg/lpav/Lpav.h"
21using CLHEP::HepVector;
22using CLHEP::Hep3Vector;
23using CLHEP::HepMatrix;
24using CLHEP::HepSymMatrix;
25//
26// constants, enums and typedefs
27//
28
29extern "C" {
30 float prob_ (float *, int*);
31}
32
33namespace KalmanFit{
34
35static double err_dis_inv(double x, double y, double w, double a, double b) {
36 if (a==0 && b==0) {
37 return w;
38 } else {
39 double f = x * b - y * a;
40 double rsq = x*x+y*y;
41 f *= f;
42 return w*rsq/f;
43 }
44}
45
46//
47// static data member definitions
48//
49
50//
51// constructors and destructor
52//
54{
55 clear();
56}
57
58// Lpav::Lpav( const Lpav& )
59// {
60// }
61
63{
64}
65
66//
67// assignment operators
68//
69// const Lpav& Lpav::operator=( const Lpav& )
70// {
71// }
72
73//
74// comparison operators
75//
76// bool Lpav::operator==( const Lpav& ) const
77// {
78// }
79
80// bool Lpav::operator!=( const Lpav& ) const
81// {
82// }
83
84//
85// member functions
86//
87void Lpav::calculate_average(double xi, double yi, double wi) {
88 if(m_wsum<=0) return;
89 m_wsum_temp = m_wsum + wi;
90 double rri(xi * xi + yi * yi);
91 double wrri(wi * rri);
92 double wsum_inv(1/m_wsum_temp);
93 m_xav = (m_xsum + wi * xi) * wsum_inv;
94 m_yav = (m_ysum + wi * yi) * wsum_inv;
95
96 double xxav((m_xxsum + wi * xi * xi) * wsum_inv);
97 double yyav((m_yysum + wi * yi * yi) * wsum_inv);
98 double xyav((m_xysum + wi * xi * yi) * wsum_inv);
99 double xrrav((m_xrrsum + xi * wrri) * wsum_inv);
100 double yrrav((m_yrrsum + yi * wrri) * wsum_inv);
101 double rrrrav((m_rrrrsum + wrri * rri) * wsum_inv);
102
103 calculate_average_n(xxav, yyav, xyav, xrrav, yrrav, rrrrav);
104
105}
106
108 if(m_wsum<=0) return;
109 m_wsum_temp = m_wsum;
110 double wsum_inv(1/m_wsum_temp);
111 m_xav = m_xsum * wsum_inv;
112 m_yav = m_ysum * wsum_inv;
113
114 double xxav(m_xxsum * wsum_inv);
115 double yyav(m_yysum * wsum_inv);
116 double xyav(m_xysum * wsum_inv);
117 double xrrav(m_xrrsum * wsum_inv);
118 double yrrav(m_yrrsum * wsum_inv);
119 double rrrrav(m_rrrrsum * wsum_inv);
120
121 calculate_average_n(xxav, yyav, xyav, xrrav, yrrav, rrrrav);
122}
123
124void Lpav::calculate_average_n(double xxav, double yyav, double xyav,
125 double xrrav, double yrrav, double rrrrav) {
126 double xxav_p = xxav - m_xav * m_xav;
127 double yyav_p = yyav - m_yav * m_yav;
128 double xyav_p = xyav - m_xav * m_yav;
129 double rrav_p = xxav_p + yyav_p;
130
131 double a = std::fabs(xxav_p - yyav_p);
132 double b = 4 * xyav_p * xyav_p;
133 double asqpb = a * a + b;
134 double rasqpb = std::sqrt(asqpb);
135 double splus = 1 + a / rasqpb;
136 double sminus = b / (asqpb*splus);
137 splus = std::sqrt(0.5*splus);
138 sminus = std::sqrt(0.5*sminus);
139//C
140//C== First require : SIGN(C**2 - S**2) = SIGN(XXAV - YYAV)
141//C
142 if ( xxav_p <= yyav_p ) {
143 m_cosrot = sminus;
144 m_sinrot = splus;
145 } else {
146 m_cosrot = splus;
147 m_sinrot = sminus;
148 }
149//C
150//C== Require : SIGN(S) = SIGN(XYAV)*SIGN(C) (Assuming SIGN(C) > 0)
151//C
152 if (xyav_p < 0) m_sinrot = - m_sinrot;
153//*
154//* We now have the smallest angle that guarantees <X**2> > <Y**2>
155//*
156//* To get the SIGN of the charge right, the new X-AXIS must point
157//* outward from the orgin. We are free to change signs of both
158//* COSROT and SINROT simultaneously to accomplish this.
159//*
160//* Choose SIGN of C wisely to be able to get the sign of the charge
161//*
162 if ( m_cosrot*m_xav + m_sinrot*m_yav <= 0 ) {
163 m_cosrot = - m_cosrot;
164 m_sinrot = - m_sinrot;
165 }
166 m_rscale = std::sqrt(rrav_p);
167 double cos2 = m_cosrot * m_cosrot;
168 double sin2 = m_sinrot * m_sinrot;
169 double cs2 = 2 * m_sinrot * m_cosrot;
170 double rrav_p_inv(1/rrav_p);
171 m_xxavp = (cos2 * xxav_p + cs2 * xyav_p + sin2 * yyav_p) * rrav_p_inv;
172 m_yyavp = (cos2 * yyav_p - cs2 * xyav_p + sin2 * xxav_p) * rrav_p_inv;
173
174 double xav2 = m_xav * m_xav;
175 double yav2 = m_yav * m_yav;
176 double xrrav_p = (xrrav - 2 * xxav * m_xav + xav2 * m_xav -
177 2 * xyav * m_yav + m_xav * yav2) - m_xav * rrav_p;
178 double yrrav_p = (yrrav - 2 * yyav * m_yav + yav2 * m_yav -
179 2 * xyav * m_xav + m_yav * xav2) - m_yav * rrav_p;
180 m_xrravp = ( m_cosrot * xrrav_p + m_sinrot * yrrav_p) * rrav_p_inv/m_rscale;
181 m_yrravp = (- m_sinrot * xrrav_p + m_cosrot * yrrav_p) * rrav_p_inv/m_rscale;
182
183 double rrav = xxav + yyav;
184 double rrrrav_p = rrrrav
185 - 2 * m_yav * yrrav - 2 * m_xav * xrrav
186 + rrav * (xav2 + yav2)
187 - 2 * m_xav * xrrav_p - xav2 * rrav_p
188 - 2 * m_yav * yrrav_p - yav2 * rrav_p;
189 m_rrrravp = rrrrav_p * rrav_p_inv * rrav_p_inv;
190 m_xyavp = 0;
191}
192
193void Lpav::calculate_average3(double xi, double yi, double wi) {
194 if(m_wsum<=0) return;
195 m_wsum_temp = m_wsum + wi;
196 double wsum_inv(1/m_wsum_temp);
197 double rri(xi * xi + yi * yi);
198 m_xav = (m_xsum + wi * xi) * wsum_inv;
199 m_yav = (m_ysum + wi * yi) * wsum_inv;
200
201 m_rscale = 1;
202 m_cosrot = 1;
203 m_sinrot = 0;
204 m_xxavp = (m_xxsum + wi * xi * xi) * wsum_inv;
205 m_xyavp = (m_xysum + wi * xi * yi) * wsum_inv;
206 m_yyavp = (m_yysum + wi * yi * yi) * wsum_inv;
207 double wrri(wi * rri);
208 m_xrravp = (m_xrrsum + xi * wrri) * wsum_inv;
209 m_yrravp = (m_yrrsum + yi * wrri) * wsum_inv;
210 m_rrrravp = (m_rrrrsum + rri * wrri) * wsum_inv;
211}
212
214 if(m_wsum<=0) return;
215 m_wsum_temp = m_wsum;
216 double wsum_inv(1/m_wsum_temp);
217 m_xav = m_xsum * wsum_inv;
218 m_yav = m_ysum * wsum_inv;
219
220 m_rscale = 1;
221 m_cosrot = 1;
222 m_sinrot = 0;
223 m_xxavp = m_xxsum * wsum_inv;
224 m_xyavp = m_xysum * wsum_inv;
225 m_yyavp = m_yysum * wsum_inv;
226 m_xrravp = m_xrrsum * wsum_inv;
227 m_yrravp = m_yrrsum * wsum_inv;
228 m_rrrravp = m_rrrrsum * wsum_inv;
229}
230
231
232//
233// const member functions
234//
235
236//
237// static member functions
238//
239
240
241std::ostream &operator<<(std::ostream &o, const Lpav &a) {
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}
256
257double Lpav::solve_lambda(void) {
258 if (m_rscale<=0) return -1;
259 double xrrxrr = m_xrravp * m_xrravp;
260 double yrryrr = m_yrravp * m_yrravp;
261 double rrrrm1 = m_rrrravp - 1;
262 double xxyy = m_xxavp * m_yyavp;
263
264 double c0 = rrrrm1 * xxyy - xrrxrr * m_yyavp - yrryrr * m_xxavp;
265 double c1 = - rrrrm1 + xrrxrr + yrryrr - 4 * xxyy;
266 double c2 = 4 + rrrrm1 - 4 * xxyy;
267 double c4 = - 4;
268//
269//C COEFFICIENTS OF THE DERIVATIVE - USED IN NEWTON-RAPHSON ITERATIONS
270//
271 double c2d = 2 * c2;
272 double c4d = 4 * c4;
273//
274 double lambda = 0;
275
276 double chiscl = m_wsum_temp * m_rscale * m_rscale;
277 double dlamax = 0.001 / chiscl;
278 const int ntry = 5;
279 int itry = 0;
280 double dlambda = dlamax;
281 while ( itry<ntry && std::fabs(dlambda) >= dlamax) {
282 double cpoly = c0 + lambda * ( c1 + lambda *
283 ( c2 + lambda * lambda * c4));
284 double dcpoly = c1 + lambda * ( c2d + lambda * lambda * c4d);
285 dlambda = - cpoly / dcpoly;
286 lambda += dlambda;
287 itry ++;
288 }
289 lambda = lambda<0 ? 0 : lambda;
290 return lambda;
291}
292
293double Lpav::solve_lambda3(void) {
294 if (m_rscale<=0) return -1;
295 double xrrxrr = m_xrravp * m_xrravp;
296 double yrryrr = m_yrravp * m_yrravp;
297 double rrrrm1 = m_rrrravp - 1;
298 double xxyy = m_xxavp * m_yyavp;
299
300 double a = m_rrrravp;
301 double b = xrrxrr + yrryrr - m_rrrravp * (m_xxavp + m_yyavp);
302 double c = m_rrrravp * m_xxavp * m_yyavp
303 - m_yyavp * xrrxrr - m_xxavp * yrryrr
304 + 2 * m_xyavp * m_xrravp * m_yrravp - m_rrrravp * m_xyavp * m_xyavp;
305 if (c>=0 && b<=0) {
306 return (-b-std::sqrt(b*b-4*a*c))/2/a;
307 } else if (c>=0 && b>0) {
308 std::cerr << " returning " <<-1<<std::endl;
309 return -1;
310 } else if (c<0) {
311 return (-b+std::sqrt(b*b-4*a*c))/2/a;
312 }
313 return -1;
314}
315
317 double lambda = solve_lambda();
318// changed on Oct-13-93
319// if (lambda<=0) return -1;
320 if (lambda<0) return -1;
321 double h11 = m_xxavp - lambda;
322 double h22 = m_yyavp - lambda;
323 if (h11==0.0) return -1;
324 double h14 = m_xrravp;
325 double h24 = m_yrravp;
326 double h34 = 1 + 2 * lambda;
327 double rootsq = (h14*h14/h11/h11) + 4 * h34;
328 if ( std::fabs(h22) > std::fabs(h24) ) {
329 if(h22==0.0) return -1;
330 double ratio = h24/h22;
331 rootsq += ratio * ratio ;
332 m_kappa = 1/std::sqrt(rootsq);
333 m_beta = - ratio * m_kappa;
334 } else {
335 if(h24==0.0) return -1;
336 double ratio = h22 / h24;
337 rootsq = 1 + ratio * ratio * rootsq;
338 m_beta = 1 / std::sqrt(rootsq);
339 m_beta = h24>0 ? -m_beta : m_beta;
340 m_kappa = -ratio * m_beta;
341 }
342 m_alpha = - (h14/h11)*m_kappa;
343 m_gamma = - h34 * m_kappa;
344// if (lambda<0.0001) {
345// cout << " lambda=" << lambda << " h34=" << h34
346// << " rootsq=" << rootsq << " h22=" << h22
347// << " h11=" << h11 << " h14=" << h14 << " h24=" << h24 <<
348// " " << *this << endl;
349// }
350//
351//C TRANSFORM THESE INTO THE LAB COORDINATE SYSTEM
352//
353//C FIRST GET KAPPA AND GAMMA BACK TO REAL DIMENSIONS
354//
355 scale(m_rscale);
356//
357//C NEXT ROTATE ALPHA AND BETA
358//
359 rotate(m_cosrot, -m_sinrot);
360//
361//C THEN TRANSLATE BY (XAV,YAV)
362//
363 move(-m_xav, -m_yav);
364 if (m_yrravp < 0) neg();
365 if (lambda>=0) m_chisq = lambda * m_wsum_temp * m_rscale * m_rscale;
366 return lambda;
367}
368
370 double lambda = solve_lambda3();
371// changed on Oct-13-93
372// if (lambda<=0) return -1;
373 if (lambda<0) return -1;
374 double h11 = m_xxavp - lambda;
375 double h22 = m_yyavp - lambda;
376 double h14 = m_xrravp;
377 double h24 = m_yrravp;
378 m_gamma = 0;
379 double h12 = m_xyavp;
380 double det = h11*h22-h12*h12;
381 if (det!=0) {
382 double r1 = (h14*h22-h24*h12)/(det);
383 double r2 = (h24*h11-h14*h12)/(det);
384 double kinvsq = r1*r1 + r2*r2;
385 m_kappa = std::sqrt(1/kinvsq);
386 if(h11!=0) m_alpha = -m_kappa * r1;
387 else m_alpha = 1;
388 if(h22!=0) m_beta = -m_kappa * r2;
389 else m_beta = 1;
390 } else {
391 m_kappa = 0;
392 if (h11!=0 && h22!=0) {
393 m_beta = 1/std::sqrt(1+h12*h12/h11/h11);
394 m_alpha = std::sqrt(1-m_beta*m_beta);
395 } else if (h11!=0) {
396 m_beta = 1;
397 m_alpha = 0;
398 } else {
399 m_beta = 0;
400 m_alpha = 1;
401 }
402 }
403 if((m_alpha*m_xav + m_beta*m_yav) *
404 (m_beta*m_xav - m_alpha*m_yav)<0) neg();
405// if (std::fabs(m_alpha)<0.01 && std::fabs(m_beta)<0.01) {
406// cout << " lambda=" << lambda << " " << *this << endl;
407// }
408 if (lambda>=0) m_chisq = lambda * m_wsum_temp * m_rscale * m_rscale;
409 return lambda;
410}
411
412double Lpav::fit(double x, double y, double w) {
413 if (m_nc<=3) return -1;
414 m_chisq = -1;
415 double q;
416 if (m_nc<4) {
418 double q = calculate_lpar3();
419 if (q>0) m_chisq = q * m_wsum_temp * m_rscale * m_rscale;
420 } else {
421 calculate_average(x,y,w);
422 q = calculate_lpar();
423 if (q>0) m_chisq = q * m_wsum_temp * m_rscale * m_rscale;
424 }
425 return m_chisq;
426}
427
428double Lpav::fit(void) {
429 if (m_nc<=3) return -1;
430 m_chisq = -1;
431 double q;
432 if (m_nc<4) {
434 q = calculate_lpar3();
435 if (q>0) m_chisq = q * m_wsum_temp * m_rscale * m_rscale;
436 } else {
438 q = calculate_lpar();
439 if (q>0) m_chisq = q * m_wsum_temp * m_rscale * m_rscale;
440 }
441 return m_chisq;
442}
443
444HepSymMatrix Lpav::cov(int inv) const
445#ifdef BELLE_OPTIMIZED_RETURN
446return vret(4);
447{
448#else
449{
450 HepSymMatrix vret(4);
451#endif
452 vret(1,1) = m_xxsum;
453 vret(2,1) = m_xysum;
454 vret(2,2) = m_yysum;
455 vret(3,1) = m_xsum;
456 vret(3,2) = m_ysum;
457 vret(3,3) = m_wsum;
458 vret(4,1) = m_xrrsum;
459 vret(4,2) = m_yrrsum;
460 vret(4,3) = m_xxsum + m_yysum;
461 vret(4,4) = m_rrrrsum;
462 if(inv==0) {
463// int i=vret.Inv();
464 int i;
465 vret.invert(i);
466 if (i!=0) {
467 std::cerr << "Lpav::cov:could not invert nc=" << m_nc << vret;
468#ifdef HAVE_EXCEPTION
469 THROW(Lpav::cov,Singular);
470#endif
471 }
472 }
473 return vret;
474}
475
476HepSymMatrix Lpav::cov_c(int inv) const
477#ifdef BELLE_OPTIMIZED_RETURN
478return vret(3);
479{
480#else
481{
482 HepSymMatrix vret(3);
483#endif
484#ifdef HAVE_EXCEPTION
485 try {
486#endif
487 vret = cov(1).similarity(dldc());
488#ifdef HAVE_EXCEPTION
489 }
490 catch (Lpav::Singular) {
491 THROW(Lpav::cov_c1,Singular_c);
492 }
493#endif
494 if(inv==0) {
495// int i = vret.Inv();
496 int i;
497 vret.invert(i);
498 if (i!=0) {
499 std::cerr << "Lpav::cov_c:could not invert " << vret;
500#ifdef HAVE_EXCEPTION
501 THROW(Lpav::cov_c2,Singular_c);
502#endif
503 }
504 }
505 return vret;
506}
507
508int Lpav::extrapolate(double r, double&phi, double &dphi) const {
509 double x, y;
510 if (m_chisq<0) return -1;
511 if (xy(r, x, y)!=0) return -1;
512 phi = std::atan2(y,x);
513 if (phi<0) phi += (2*M_PI);
514 HepVector v(4);
515 v(1) = x;
516 v(2) = y;
517 v(3) = 1;
518 v(4) = r * r;
519// HepSymMatrix l = cov().similarityT(v);
520#ifdef HAVE_EXCEPTION
521 try {
522#endif
523// HepSymMatrix l = cov().similarity(v.T());
524// // cout << "delta d^2=" << l(1,1);
525// if (l(1,1)>0) {
526 double l = cov().similarity(v);
527 if(l>0) {
528 double ls = std::sqrt(l);
529 dphi = ls / r;
530 // cout << " delta d=" << ls << " dphi=" << dphi;
531 }
532#ifdef HAVE_EXCEPTION
533 }
534 catch (Lpav::Singular) {
535 return -1;
536 }
537#endif
538// cout << endl;
539 return 0;
540}
541
542double Lpav::similarity(double x, double y) const {
543 if (m_nc<=3) return -1;
544 HepVector v(4);
545 v(1) = x;
546 v(2) = y;
547 v(3) = 1;
548 v(4) = x * x + y * y;
549 double l;
550#ifdef HAVE_EXCEPTION
551 try {
552#endif
553 l = cov().similarity(v);
554#ifdef HAVE_EXCEPTION
555 }
556 catch (Lpav::Singular) {
557 return -1;
558 }
559#endif
560 return l;
561}
562
563void Lpav::add(double xi, double yi, double w, double a, double b) {
564 register double wi = err_dis_inv(xi, yi, w, a, b);
565 add(xi, yi, wi);
566}
567
568void Lpav::add_point(register double xi, register double yi,
569 register double wi) {
570 m_wsum += wi;
571 m_xsum += wi * xi;
572 m_ysum += wi * yi;
573 m_xxsum += wi * xi * xi;
574 m_yysum += wi * yi * yi;
575 m_xysum += wi * xi * yi;
576 register double rri = ( xi * xi + yi * yi );
577 register double wrri = wi * rri;
578 m_xrrsum += wrri * xi;
579 m_yrrsum += wrri * yi;
580 m_rrrrsum += wrri * rri;
581 m_nc += 1;
582}
583
584void Lpav::add_point_frac(double xi, double yi, double w, double a) {
585 register double wi = w * a;
586 m_wsum += wi;
587 m_xsum += wi * xi;
588 m_ysum += wi * yi;
589 m_xxsum += wi * xi * xi;
590 m_yysum += wi * yi * yi;
591 m_xysum += wi * xi * yi;
592 register double rri = ( xi * xi + yi * yi );
593 register double wrri = wi * rri;
594 m_xrrsum += wrri * xi;
595 m_yrrsum += wrri * yi;
596 m_rrrrsum += wrri * rri;
597 m_nc += a;
598}
599
600void Lpav::sub(double xi, double yi, double w, double a, double b) {
601 register double wi = err_dis_inv(xi, yi, w, a, b);
602 m_wsum -= wi;
603 m_xsum -= wi * xi;
604 m_ysum -= wi * yi;
605 m_xxsum -= wi * xi * xi;
606 m_yysum -= wi * yi * yi;
607 m_xysum -= wi * xi * yi;
608 register double rri = ( xi * xi + yi * yi );
609 register double wrri = wi * rri;
610 m_xrrsum -= wrri * xi;
611 m_yrrsum -= wrri * yi;
612 m_rrrrsum -= wrri * rri;
613 m_nc -= 1;
614}
615
616const Lpav & Lpav::operator+=(const Lpav &la1) {
617 m_wsum += la1.m_wsum;
618 m_xsum += la1.m_xsum;
619 m_ysum += la1.m_ysum;
620 m_xxsum += la1.m_xxsum;
621 m_yysum += la1.m_yysum;
622 m_xysum += la1.m_xysum;
623 m_xrrsum += la1.m_xrrsum;
624 m_yrrsum += la1.m_yrrsum;
625 m_rrrrsum += la1.m_rrrrsum;
626 m_nc += la1.m_nc;
627 return *this;
628}
629
630Lpav operator+(const Lpav &la1, const Lpav &la2)
631#ifdef BELLE_OPTIMIZED_RETURN
632return la;
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}
650
651double Lpav::prob() const {
652 if (m_nc<=3) return 0;
653 if (m_chisq<0) return 0;
654 float c = m_chisq;
655 int nci = (int)m_nc - 3;
656 double p = (double) prob_(&c, &nci);
657 return p;
658}
659
660double Lpav::chi_deg() const {
661 if (m_nc<=3) return -1;
662 else return m_chisq/(m_nc-3);
663}
664
665double Lpav::delta_chisq(double x, double y, double w) const {
666 double sim = similarity(x,y);
667 if(sim<0) return -1;
668 double d = d0(x,y);
669 double delta = std::sqrt(d) * w / (1 + sim * w);
670 return delta;
671}
672
673}
TCanvas * c1
Double_t x[10]
float prob_(float *, int *)
****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
float prob_(float *, int *)
**********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
#define M_PI
Definition TConstant.h:4
double phi(double r, int dir=0) const
void add_point_frac(double x, double y, double w, double f)
void add_point(double x, double y, double w=1)
double delta_chisq(double x, double y, double w=1) const
int extrapolate(double, double &, double &) const
Lpav operator+(const Lpav &la1, const Lpav &la2)
std::ostream & operator<<(std::ostream &o, Lpar &s)