104 #include <b2bii/modules/B2BIIMdstInput/B2BIIFixMdstModule.h>
105 #include "belle_legacy/panther/panther.h"
107 #include "belle_legacy/tables/mdst.h"
108 #include "belle_legacy/tables/belletdf.h"
110 #include "CLHEP/Vector/ThreeVector.h"
111 #include "CLHEP/Vector/LorentzVector.h"
112 #include "CLHEP/Matrix/Vector.h"
113 #include "CLHEP/Matrix/Matrix.h"
149 double Energy,
double)
156 double x = std::log10(Energy * 1000.0);
166 return_value = 0.85878 + 0.81947e-1 * x - 0.99708e-2 * x * x
167 - 0.28161e-3 * x * x * x;
178 return_value = 0.86582 + 0.63194e-1 * x - 0.59391e-2 * x * x
179 + 0.17727e-2 * x * x * x - 0.62325e-3 * x * x * x * x;
193 return_value = 0.88989 + 0.41082e-1 * x
194 - 0.21919e-2 * x * x + 0.27116e-2 * x * x * x - 0.89113e-3 * x * x * x * x;
196 return_value = 0.994441 + 4.90176e-3 * (x - 3.0);
210 return_value = 0.87434 + 0.62145e-1 * x
211 - 0.29691e-2 * x * x - 0.15843e-2 * x * x * x + 0.86858e-4 * x * x * x * x;
227 return_value = 0.83073 + 0.10137 * x
228 - 0.59946e-2 * x * x - 0.56516e-2 * x * x * x + 0.87225e-3 * x * x * x * x;
235 return_value = 0.89260 + 0.54731e-1 * x
236 - 0.25736e-2 * x * x - 0.16493e-2 * x * x * x + 0.1032e-3 * x * x * x * x;
237 }
else if (x < 3.5) {
238 return_value = 0.997459 + 0.0059039 * (x - 3.0);
246 return_value = 0.86432 + 0.87554e-1 * x
247 - 0.84182e-2 * x * x - 0.39880e-2 * x * x * x + 0.69435e-3 * x * x * x * x;
250 if (299 < Run && Run < 900) {
252 return_value = 0.92082 + 0.45896e-1 * x
253 - 0.68067e-2 * x * x + 0.94055e-3 * x * x * x - 0.27717e-3 * x * x * x * x;
258 return_value = 0.85154 + 0.97812e-1 * x
259 - 0.85774e-2 * x * x - 0.59092e-2 * x * x * x + 0.1121e-2 * x * x * x * x;
266 return_value = 0.84940 + 0.86266e-1 * x
267 - 0.82204e-2 * x * x - 0.12912e-2 * x * x * x;
273 return_value = 0.85049 + 0.85418e-1 * x
274 - 0.45747e-2 * x * x - 0.40081e-2 * x * x * x + 0.52113e-3 * x * x * x * x;
279 return_value = 0.87001 + 0.73693e-1 * x
280 - 0.80094e-2 * x * x - 0.78527e-3 * x * x * x + 0.25888e-4 * x * x * x * x;
285 return_value = 0.90051 + 0.56094e-1 * x
286 - 0.14842e-1 * x * x + 0.55555e-2 * x * x * x - 0.10378e-2 * x * x * x * x;
290 if (iflag05th == 1) {
293 return_value = 0.80295 + 0.13395 * x
294 - 0.10773e-1 * x * x - 0.85861e-2 * x * x * x + 0.15331e-2 * x * x * x * x;
298 return_value = 0.57169 + 0.32548 * x
299 - 0.41157e-1 * x * x - 0.21971e-1 * x * x * x + 0.50114e-2 * x * x * x * x;
304 if (iflag05th == 1) {
307 return_value = 0.81153 + 0.10847 * x
308 - 0.24652e-2 * x * x - 0.54738e-2 * x * x * x + 0.41243e-3 * x * x * x * x;
312 return_value = 0.59869 + 0.29276 * x
313 - 0.15849e-1 * x * x - 0.31322e-1 * x * x * x + 0.62491e-2 * x * x * x * x;
318 if (iflag05th == 1) {
321 return_value = 0.83528 + 0.10402 * x
322 - 0.62047e-2 * x * x - 0.62411e-2 * x * x * x + 0.10312e-2 * x * x * x * x;
326 return_value = 0.58155 + 0.30642 * x
327 - 0.16981e-1 * x * x - 0.32609e-1 * x * x * x + 0.64874e-2 * x * x * x * x;
332 if (iflag05th == 1) {
334 return_value = 0.83706 + 0.10726 * x
335 - 0.62423e-2 * x * x - 0.42425e-2 * x * x * x;
339 return_value = 0.58801 + 0.30569 * x
340 - 0.18832e-1 * x * x - 0.32116e-1 * x * x * x + 0.64899e-2 * x * x * x * x;
345 if (iflag05th == 1) {
348 return_value = 0.80827 + 0.095353 * x
349 - 0.14818e-2 * x * x - 0.23854e-2 * x * x * x - 0.22454e-3 * x * x * x * x;
351 return_value = 0.0112468 * (x - 2.8) + 0.997847;
356 return_value = 0.61133 + 0.27115 * x
357 - 0.12724e-1 * x * x - 0.28167e-1 * x * x * x + 0.54699e-2 * x * x * x * x;
362 if (iflag05th == 1) {
365 return_value = 0.90188 + 0.76563e-1 * x
366 - 0.16328e-1 * x * x + 0.56816e-3 * x * x * x;
371 return_value = 0.88077 + 0.71720e-1 * x
372 - 0.92197e-2 * x * x - 0.15932e-2 * x * x * x + 0.38133e-3 * x * x * x * x;
377 return_value = 0.57808 + 0.31083 * x
378 - 0.20247e-1 * x * x - 0.31658e-1 * x * x * x + 0.64087e-2 * x * x * x * x;
383 if (iflag05th == 1) {
386 return_value = 0.85592 + 0.93352e-1 * x
387 - 0.93144e-2 * x * x - 0.43681e-2 * x * x * x + 0.7971e-3 * x * x * x * x;
390 if (299 < Run && Run < 700) {
392 return_value = 0.89169 + 0.73301e-1 * x
393 - 0.13856e-1 * x * x + 0.47303e-3 * x * x * x;
398 return_value = 0.90799 + 0.69815e-1 * x
399 - 0.17490e-1 * x * x + 0.14651e-2 * x * x * x;
404 return_value = 0.58176 + 0.30245 * x - 0.16390e-1 * x * x
405 - 0.32258e-1 * x * x * x + 0.64121e-2 * x * x * x * x;
416 if (iflag05th == 1) {
418 return_value = 0.84823 + 0.10394 * x
419 - 0.92233e-2 * x * x - 0.72700e-2 * x * x * x + 0.14552e-2 * x * x * x * x;
423 return_value = 0.62797 + 0.23897 * x
424 + 0.10261e-1 * x * x - 0.35700e-1 * x * x * x + 0.63846e-2 * x * x * x * x;
429 if (iflag05th == 1) {
431 return_value = 0.86321 + 0.82987e-1 * x
432 - 0.12139e-1 * x * x - 0.12920e-3 * x * x * x;
436 return_value = 0.58061 + 0.30399 * x
437 - 0.17520e-1 * x * x - 0.31559e-1 * x * x * x + 0.62681e-2 * x * x * x * x;
442 if (iflag05th == 1) {
445 return_value = 0.85616 + 0.78041e-1 * x
446 - 0.38987e-2 * x * x - 0.31224e-2 * x * x * x + 0.33374e-3 * x * x * x * x;
448 return_value = ((1.0 - 0.99608) / (3.13 - 2.80)) * (x - 2.80) + 0.99608;
453 return_value = 0.57687 + 0.29948 * x
454 - 0.10594e-1 * x * x - 0.34561e-1 * x * x * x + 0.67064e-2 * x * x * x * x;
459 if (iflag05th == 1) {
461 return_value = 0.89063 + 0.72152e-1 * x
462 - 0.14143e-1 * x * x + 0.73116e-3 * x * x * x;
466 return_value = 0.59310 + 0.28618 * x
467 - 0.13858e-1 * x * x - 0.30230e-1 * x * x * x + 0.59173e-2 * x * x * x * x;
472 if (iflag05th == 1) {
475 return_value = 0.83425 + 0.10468 * x
476 - 0.53641e-2 * x * x - 0.60276e-2 * x * x * x + 0.77763e-3 * x * x * x * x;
481 return_value = 0.66100 + 0.25192 * x
482 - 0.16419e-1 * x * x - 0.25720e-1 * x * x * x + 0.52189e-2 * x * x * x * x;
487 if (iflag05th == 1) {
489 return_value = 0.86202 + 0.79575e-1 * x
490 - 0.66721e-2 * x * x - 0.28609e-2 * x * x * x + 0.42784e-3 * x * x * x * x;
494 return_value = 0.58789 + 0.29310 * x
495 - 0.15784e-1 * x * x - 0.30619e-1 * x * x * x + 0.60648e-2 * x * x * x * x;
502 return_value = 0.68839 + 0.18218 * x
503 - 0.23140e-2 * x * x - 0.17439e-1 * x * x * x + 0.29960e-2 * x * x * x * x;
507 if (iflag05th == 1) {
510 return_value = 0.94294 - 0.77497e-2 * x
511 - 0.43464e-3 * x * x + 0.99837e-2 * x * x * x - 0.23726e-2 * x * x * x * x;
513 return_value = 0.0162997 * (x - 2.80) + 0.991162;
518 return_value = 0.64816 + 0.22492 * x
519 - 0.91745e-2 * x * x - 0.21736e-1 * x * x * x + 0.41333e-2 * x * x * x * x;
526 return_value = 0.69302 + 0.18393 * x
527 - 0.10983e-1 * x * x - 0.14148e-1 * x * x * x + 0.27298e-2 * x * x * x * x;
532 if (iflag05th == 1) {
535 return_value = 0.94294 - 0.77497e-2 * x
536 - 0.43464e-3 * x * x + 0.99837e-2 * x * x * x - 0.23726e-2 * x * x * x * x;
538 return_value = 0.0162997 * (x - 2.80) + 0.991162;
543 return_value = 0.70987 + 0.16230 * x
544 - 0.64867e-2 * x * x - 0.12021e-1 * x * x * x + 0.20874e-2 * x * x * x * x;
549 return_value = 0.66833 + 0.20602 * x
550 - 0.14322e-1 * x * x - 0.15712e-1 * x * x * x + 0.31114e-2 * x * x * x * x;
556 return_value = 0.64196 + 0.23069 * x
557 - 0.20303e-1 * x * x - 0.15680e-1 * x * x * x + 0.31611e-2 * x * x * x * x;
564 return_value = 0.99 * (0.64196 + 0.23752 * x
565 - 0.85197e-2 * x * x - 0.24366e-1 * x * x * x
566 + 0.46397e-2 * x * x * x * x);
571 return_value = 0.66541 + 0.12579 * x
572 + 0.89999e-1 * x * x - 0.58305e-1 * x * x * x + 0.86969e-2 * x * x * x * x;
577 return_value = 0.62368 + 0.24142 * x
578 - 0.11677e-1 * x * x - 0.22477e-1 * x * x * x + 0.42765e-2 * x * x * x * x;
595 243, 244, 316, 317, 318, 412, 413, 414, 508, 509, 510, 604, 605, 606
599 1.06215 , 1.06589 , 0.953827, 1.06607 , 0.943696, 0.910855, 1.01201 ,
600 1.01704 , 0.954612, 1.02761 , 1.00716 , 1.0319 , 1.03135 , 1.05782
603 if (exp != 45)
return 1.;
605 for (
int i = 0 ; i < 14 ; i++)
620 double x = std::log10(energy * 1000.0);
623 return_value = 0.72708 + 0.22735 * x
624 - 0.20603e-1 * x * x - 0.24644e-1 * x * x * x + 0.53480e-2 * x * x * x * x;
640 const double m_pdg = 134.9766;
645 if (0.1 < Energy && Energy < 1.0) {
646 double x = log10(Energy * 1000.0);
649 = m_pdg / (135.21 + 5.3812 * x - 4.2160 * x * x + 0.74650 * x * x * x);
684 if (!strcmp(side,
"lower")) iside = 1;
685 if (!strcmp(side,
"higher")) iside = 2;
687 B2ERROR(
"Error pi0resol. Wrong input parameter=" << side);
696 const double data_thf_pl_L[] = { 9.8233, -13.3489, 18.3271, -7.6668};
697 const double derr_thf_pl_L[] = { 0.3274, 0.755, 0.8611, 0.521};
698 const double data_thf_pl_H[] = { 6.1436, -7.9668, 12.4766, -5.3201};
699 const double derr_thf_pl_H[] = { 0.2903, 0.6754, 0.7724, 0.466};
702 const double data_thf_ph_L[] = { 7.1936, -0.6378, 0.5912, -0.075};
703 const double derr_thf_ph_L[] = { 0.1975, 0.2036, 0.0793, 0.0121};
704 const double data_thf_ph_H[] = { 4.4923, 0.5532, 0.2658, -0.0343};
705 const double derr_thf_ph_H[] = { 0.1883, 0.2019, 0.0803, 0.0122};
711 const double mc_thf_pl_L[] = { 4.8093, 3.4567, -3.7898, 1.7553};
712 const double merr_thf_pl_L[] = { 0.2145, 0.527, 0.6153, 0.3712};
713 const double mc_thf_pl_H[] = { 4.6176, -2.9049, 4.2994, -1.4776};
714 const double merr_thf_pl_H[] = { 0.1969, 0.4826, 0.555, 0.3346};
717 const double mc_thf_ph_L[] = { 6.3166, -0.5993, 0.5845, -0.0695};
718 const double merr_thf_ph_L[] = { 0.1444, 0.1468, 0.0571, 0.0087};
719 const double mc_thf_ph_H[] = { 2.9719, 1.7999, -0.2418, 0.028};
720 const double merr_thf_ph_H[] = { 0.1318, 0.1362, 0.0538, 0.0082};
727 const double data_thm_pl_L[] = { 7.7573, -4.8855, 6.5561, -2.4788};
728 const double derr_thm_pl_L[] = { 0.1621, 0.4894, 0.6882, 0.4985};
729 const double data_thm_pl_H[] = { 6.9075, -10.5036, 18.5196, -9.224};
730 const double derr_thm_pl_H[] = { 0.1458, 0.4383, 0.639, 0.4726};
733 const double data_thm_ph_L[] = { 5.2347, 2.1827, -0.6563, 0.1545};
734 const double derr_thm_ph_L[] = { 0.0986, 0.1281, 0.0627, 0.0117};
735 const double data_thm_ph_H[] = { 3.2114, 3.3806, -0.8635, 0.1371};
736 const double derr_thm_ph_H[] = { 0.0927, 0.1205, 0.058, 0.0106};
743 const double mc_thm_pl_L[] = { 6.1774, -2.1831, 3.6615, -1.1813};
744 const double merr_thm_pl_L[] = { 0.11, 0.327, 0.476, 0.3655};
745 const double mc_thm_pl_H[] = { 4.0239, -0.7485, 3.6203, -1.4823};
746 const double merr_thm_pl_H[] = { 0.0991, 0.3034, 0.4223, 0.3069};
749 const double mc_thm_ph_L[] = { 4.5966, 2.261, -0.4938, 0.0984};
750 const double merr_thm_ph_L[] = { 0.0711, 0.0917, 0.0448, 0.0081};
751 const double mc_thm_ph_H[] = { 3.4609, 2.0069, -0.0498, -0.0018};
752 const double merr_thm_ph_H[] = { 0.0966, 0.1314, 0.0574, 0.0086};
759 const double data_thb_pl_L[] = {11.5829, -21.6715, 30.2368, -13.0389};
760 const double derr_thb_pl_L[] = { 0.2742, 0.7256, 0.9139, 0.6006};
761 const double data_thb_pl_H[] = { 8.0227, -14.7387, 23.1042, -10.4233};
762 const double derr_thb_pl_H[] = { 0.2466, 0.6512, 0.8239, 0.5419};
765 const double data_thb_ph_L[] = { 7.5872, -1.8994, 1.6526, -0.2755};
766 const double derr_thb_ph_L[] = { 0.1999, 0.2638, 0.1422, 0.0335};
767 const double data_thb_ph_H[] = { 6.3542, -2.5164, 2.5763, -0.4803};
768 const double derr_thb_ph_H[] = { 0.1885, 0.2527, 0.136, 0.0318};
774 const double mc_thb_pl_L[] = { 5.2707, 2.5607, -3.1377, 1.8434};
775 const double merr_thb_pl_L[] = { 0.1801, 0.5048, 0.6741, 0.4343};
777 const double mc_thb_pl_H[] = { 2.5867, 7.6982, -10.0677, 5.312};
778 const double merr_thb_pl_H[] = { 0.1658, 0.4651, 0.6063, 0.3925};
781 const double mc_thb_ph_L[] = { 6.5206, -1.5103, 1.9054, -0.3609};
782 const double merr_thb_ph_L[] = { 0.1521, 0.2048, 0.1108, 0.0255};
783 const double mc_thb_ph_H[] = { 3.4397, 2.2372, -0.1214, -0.0004};
784 const double merr_thb_ph_H[] = { 0.1324, 0.1822, 0.1065, 0.0252};
788 double para[4] = { };
789 double error[4] = { };
802 for (
int i = 0; i <= 3; i++) {
804 para[i] = data_thf_pl_L[i];
805 error[i] = derr_thf_pl_L[i];
807 para[i] = data_thf_pl_H[i];
808 error[i] = derr_thf_pl_H[i];
813 for (
int i = 0; i <= 3; i++) {
815 para[i] = mc_thf_pl_L[i];
816 error[i] = merr_thf_pl_L[i];
818 para[i] = mc_thf_pl_H[i];
819 error[i] = merr_thf_pl_H[i];
828 if (pbuf >= 5.2) {pbuf = 5.2;}
831 for (
int i = 0; i <= 3; i++) {
833 para[i] = data_thf_ph_L[i];
834 error[i] = derr_thf_ph_L[i];
836 para[i] = data_thf_ph_H[i];
837 error[i] = derr_thf_ph_H[i];
842 for (
int i = 0; i <= 3; i++) {
844 para[i] = mc_thf_ph_L[i];
845 error[i] = merr_thf_ph_L[i];
847 para[i] = mc_thf_ph_H[i];
848 error[i] = merr_thf_ph_H[i];
856 }
else if (theta > 45. && theta <= 100.) {
863 for (
int i = 0; i <= 3; i++) {
865 para[i] = data_thm_pl_L[i];
866 error[i] = derr_thm_pl_L[i];
868 para[i] = data_thm_pl_H[i];
869 error[i] = derr_thm_pl_H[i];
874 for (
int i = 0; i <= 3; i++) {
876 para[i] = mc_thm_pl_L[i];
877 error[i] = merr_thm_pl_L[i];
879 para[i] = mc_thm_pl_H[i];
880 error[i] = merr_thm_pl_H[i];
889 if (pbuf >= 5.2) {pbuf = 5.2;}
892 for (
int i = 0; i <= 3; i++) {
894 para[i] = data_thm_ph_L[i];
895 error[i] = derr_thm_ph_L[i];
897 para[i] = data_thm_ph_H[i];
898 error[i] = derr_thm_ph_H[i];
903 for (
int i = 0; i <= 3; i++) {
905 para[i] = mc_thm_ph_L[i];
906 error[i] = merr_thm_ph_L[i];
908 para[i] = mc_thm_ph_H[i];
909 error[i] = merr_thm_ph_H[i];
917 }
else if (theta > 100.) {
924 for (
int i = 0; i <= 3; i++) {
926 para[i] = data_thb_pl_L[i];
927 error[i] = derr_thb_pl_L[i];
929 para[i] = data_thb_pl_H[i];
930 error[i] = derr_thb_pl_H[i];
935 for (
int i = 0; i <= 3; i++) {
937 para[i] = mc_thb_pl_L[i];
938 error[i] = merr_thb_pl_L[i];
940 para[i] = mc_thb_pl_H[i];
941 error[i] = merr_thb_pl_H[i];
950 if (pbuf >= 3.0) {pbuf = 3.0;}
953 for (
int i = 0; i <= 3; i++) {
955 para[i] = data_thb_ph_L[i];
956 error[i] = derr_thb_ph_L[i];
958 para[i] = data_thb_ph_H[i];
959 error[i] = derr_thb_ph_H[i];
964 for (
int i = 0; i <= 3; i++) {
966 para[i] = mc_thb_ph_L[i];
967 error[i] = merr_thb_ph_L[i];
969 para[i] = mc_thb_ph_H[i];
970 error[i] = merr_thb_ph_H[i];
981 resol = para[0] + para[1] * pbuf + para[2] * pbuf * pbuf +
982 para[3] * pbuf * pbuf * pbuf;
983 resol = resol / 1000.;
988 double eresol = error[0] * error[0] + (pbuf * error[1]) * (pbuf * error[1])
989 + (pbuf * pbuf * error[2]) * (pbuf * pbuf * error[2])
990 + (pbuf * pbuf * pbuf * error[3]) * (pbuf * pbuf * pbuf * error[3]);
991 eresol = sqrt(eresol) / 1000.;
1223 int ecl_threshold(0);
1233 if (version < 1 || version > 2) {
1234 B2WARNING(
"correct_ecl :: Warning! ");
1235 B2WARNING(
"version=" << version <<
" is not supported! ");
1236 B2WARNING(
"Exit doing nothing!");
1242 Belle::Belle_event_Manager& evtmgr = Belle::Belle_event_Manager::get_manager();
1243 if (0 == evtmgr.count()) {
1249 int expmc = evtmgr[0].ExpMC();
1251 int Eno = evtmgr[0].ExpNo();
1252 int Rno = evtmgr[0].RunNo();
1257 if (option == 0 && expmc == 2) {
1264 if (ecl_threshold == 1) {
1272 Belle::Mdst_event_add_Manager& mevtmgr = Belle::Mdst_event_add_Manager::get_manager();
1274 if (mevtmgr.count() > 0) {
1281 if (mevtmgr[0].flag(3) == 1) {
1287 mevtmgr[0].flag(3, 1);
1292 if (mevtmgr[0].flag(3) >= version) {
1296 i_previous = mevtmgr[0].flag(3);
1297 if (i_previous == 0 || i_previous == 1) {
1298 mevtmgr[0].flag(3, version);
1301 B2WARNING(
"correct_ecl :: Warning! ");
1302 B2WARNING(
"Previously, uncorrect version was used. ");
1303 B2WARNING(
" Exit doing nothing");
1308 Belle::Mdst_event_add& meadd = mevtmgr.add();
1313 meadd.flag(3, version);
1323 Belle::Mdst_ecl_Manager& eclmgr = Belle::Mdst_ecl_Manager::get_manager();
1324 Belle::Mdst_gamma_Manager& gammamgr = Belle::Mdst_gamma_Manager::get_manager();
1327 Belle::Mdst_ecl_aux_Manager& eclauxmgr = Belle::Mdst_ecl_aux_Manager::get_manager();
1328 std::vector<Belle::Mdst_ecl_aux>::iterator itaux = eclauxmgr.begin();
1334 for (std::vector<Belle::Mdst_ecl>::iterator itecl = eclmgr.begin();
1335 itecl != eclmgr.end(); ++itecl) {
1336 Belle::Mdst_ecl& shower = *itecl;
1338 double shower_energy = shower.energy();
1339 double shower_theta = shower.theta();
1344 int cellID = (*itaux).cId();
1353 shower.energy(shower.energy() / factor45);
1354 double factor452 = factor45 * factor45;
1355 shower.error(0, shower.error(0) / factor452);
1356 shower.error(1, shower.error(1) / factor45);
1357 shower.error(3, shower.error(3) / factor45);
1360 for (std::vector<Belle::Mdst_gamma>::iterator itgam45 = gammamgr.begin();
1361 itgam45 != gammamgr.end(); ++itgam45) {
1362 Belle::Mdst_gamma& gamma45 = *itgam45;
1363 if (gamma45.ecl().get_ID() == shower.get_ID()) {
1364 gamma45.px(gamma45.px() / factor45);
1365 gamma45.py(gamma45.py() / factor45);
1366 gamma45.pz(gamma45.pz() / factor45);
1384 =
ecl_mcx3_corr(Eno, Rno, shower_energy, cos(shower_theta));
1393 shower_energy, cos(shower_theta));
1395 if (Eno == 15 && i_previous == 1) {
1406 shower_energy, cos(shower_theta));
1407 factor = factor / factor13;
1414 factor = 1.0 /
mpi0pdg(shower.energy());
1424 shower.energy(), cos(shower.theta()));
1426 if (Eno == 15 && i_previous == 1) {
1435 shower_energy, cos(shower_theta));
1436 factor = factor / factor13;
1440 factor = factor /
mpi0pdg(shower.energy());
1448 shower.energy(shower.energy() / factor);
1451 double factor2 = factor * factor;
1452 shower.error(0, shower.error(0) / factor2);
1453 shower.error(1, shower.error(1) / factor);
1454 shower.error(3, shower.error(3) / factor);
1461 for (std::vector<Belle::Mdst_gamma>::iterator itgam = gammamgr.begin();
1462 itgam != gammamgr.end(); ++itgam) {
1463 Belle::Mdst_gamma& gamma = *itgam;
1465 CLHEP::Hep3Vector gamma_3v(gamma.px(), gamma.py(), gamma.pz());
1466 double gamma_energy = gamma_3v.mag();
1467 double gamma_cos = gamma_3v.cosTheta();
1485 gamma_energy, gamma_cos);
1487 if (Eno == 15 && i_previous == 1) {
1498 gamma_energy, gamma_cos);
1499 factor = factor / factor13;
1506 factor = 1.0 /
mpi0pdg(gamma_3v.mag());
1516 gamma_3v.mag(), gamma_3v.cosTheta());
1518 if (Eno == 15 && i_previous == 1) {
1529 gamma_energy, gamma_cos);
1530 factor = factor / factor13;
1533 factor = factor /
mpi0pdg(gamma_3v.mag());
1541 gamma.px(gamma.px() / factor);
1542 gamma.py(gamma.py() / factor);
1543 gamma.pz(gamma.pz() / factor);
1568 Belle::Belle_event_Manager& evtmgr = Belle::Belle_event_Manager::get_manager();
1569 if (0 == evtmgr.count()) {
1575 int expmc = evtmgr[0].ExpMC();
1577 int Eno = evtmgr[0].ExpNo();
1585 const double mpi0_pdg = 0.1349739;
1590 const double low_default = 0.080;
1591 const double up_default = 0.180;
1594 const int iter_max = 5;
1599 low_limit = low_default;
1600 up_limit = up_default;
1603 if (mpi0_pdg < low_limit || up_limit < mpi0_pdg) {
1605 B2ERROR(
"Invalid mass window between ");
1606 B2ERROR(
" and " << up_limit);
1614 if (0.0 < low_limit || up_limit < 0.0) {
1615 B2ERROR(
"option=2 was selected. ");
1616 B2ERROR(
"Invalid mass window! " << low_limit);
1617 B2ERROR(
" sould be negative, or " << up_limit);
1618 B2ERROR(
" should be positive.");
1623 B2ERROR(
"Invalid option=" << option);
1628 Belle::Mdst_pi0_Manager::get_manager().remove();
1632 Belle::Mdst_gamma_Manager& gammamgr = Belle::Mdst_gamma_Manager::get_manager();
1635 Belle::Mdst_pi0_Manager& pi0mgr = Belle::Mdst_pi0_Manager::get_manager();
1638 if (gammamgr.count() < 2) {
1643 for (std::vector<Belle::Mdst_gamma>::iterator itgamma = gammamgr.begin();
1644 itgamma != gammamgr.end(); ++itgamma) {
1645 Belle::Mdst_gamma& gamma1 = *itgamma;
1646 CLHEP::Hep3Vector gamma1_3v(gamma1.px(), gamma1.py(), gamma1.pz());
1647 CLHEP::HepLorentzVector gamma1_lv(gamma1_3v, gamma1_3v.mag());
1649 Belle::Mdst_ecl& ecl1 = gamma1.ecl();
1651 for (std::vector<Belle::Mdst_gamma>::iterator jtgamma = itgamma + 1;
1652 jtgamma != gammamgr.end(); ++jtgamma) {
1653 Belle::Mdst_gamma& gamma2 = *jtgamma;
1654 CLHEP::Hep3Vector gamma2_3v(gamma2.px(), gamma2.py(), gamma2.pz());
1655 CLHEP::HepLorentzVector gamma2_lv(gamma2_3v, gamma2_3v.mag());
1657 Belle::Mdst_ecl& ecl2 = gamma2.ecl();
1660 CLHEP::HepLorentzVector gamgam_lv = gamma1_lv + gamma2_lv;
1661 const double mass_before = gamgam_lv.mag();
1665 double mass_ctrl{0};
1666 if (option == 0 || option == 1) {
1667 mass_ctrl = mass_before;
1671 if (mass_before *
mpi0pdg(mass_before) < mpi0_pdg) {
1672 mass_ctrl = (mass_before *
mpi0pdg(mass_before) - mpi0_pdg) /
1674 gamgam_lv.theta() * 180. / M_PI,
"lower",
1675 mcdata, Eno, option);
1677 mass_ctrl = (mass_before *
mpi0pdg(mass_before) - mpi0_pdg) /
1679 gamgam_lv.theta() * 180. / M_PI,
"higher",
1680 mcdata, Eno, option);
1686 if (low_limit < mass_ctrl && mass_ctrl < up_limit) {
1699 CLHEP::HepMatrix V(6, 6, 0);
1701 V[0][0] = ecl1.error(0);
1702 V[0][1] = V[1][0] = ecl1.error(1);
1703 V[1][1] = ecl1.error(2);
1704 V[0][2] = V[2][0] = ecl1.error(3);
1705 V[1][2] = V[2][1] = ecl1.error(4);
1706 V[2][2] = ecl1.error(5);
1707 V[3][3] = ecl2.error(0);
1708 V[3][4] = V[4][3] = ecl2.error(1);
1709 V[4][4] = ecl2.error(2);
1710 V[3][5] = V[5][3] = ecl2.error(3);
1711 V[4][5] = V[5][4] = ecl2.error(4);
1712 V[5][5] = ecl2.error(5);
1715 CLHEP::HepMatrix y0(6, 1);
1716 y0[0][0] = ecl1.energy();
1717 y0[1][0] = ecl1.phi();
1718 y0[2][0] = ecl1.theta();
1719 y0[3][0] = ecl2.energy();
1720 y0[4][0] = ecl2.phi();
1721 y0[5][0] = ecl2.theta();
1724 CLHEP::HepMatrix y(y0);
1726 CLHEP::HepMatrix Dy(6, 1, 0);
1729 double f_old = DBL_MAX;
1730 double chi2_old = DBL_MAX;
1731 double chi2 = DBL_MAX;
1732 bool exit_flag =
false;
1735 const double Df_limit = 0.1;
1736 const double Dchi2_limit = 0.1;
1739 const double& E1 = y[0][0];
1740 const double& E2 = y[3][0];
1741 const double sin_theta1 = std::sin(y[2][0]);
1742 const double cos_theta1 = std::cos(y[2][0]);
1743 const double sin_theta2 = std::sin(y[5][0]);
1744 const double cos_theta2 = std::cos(y[5][0]);
1745 const double Dphi = y[1][0] - y[4][0];
1746 const double cos_Dphi = std::cos(Dphi);
1747 const double sin_Dphi = std::sin(Dphi);
1748 const double open_angle = sin_theta1 * sin_theta2 * cos_Dphi
1749 + cos_theta1 * cos_theta2;
1750 const double mass2_gg = 2 * E1 * E2 * (1 - open_angle);
1754 if (exit_flag || ++iter > iter_max)
1758 CLHEP::HepMatrix f(1, 1);
1759 f[0][0] = mass2_gg - (mpi0_pdg * mpi0_pdg);
1762 CLHEP::HepMatrix B(1, 6);
1763 B[0][0] = mass2_gg / E1;
1764 B[0][1] = 2 * E1 * E2 * sin_theta1 * sin_theta2 * sin_Dphi;
1765 B[0][2] = 2 * E1 * E2 * (-cos_theta1 * sin_theta2 * cos_Dphi
1766 + sin_theta1 * cos_theta2);
1767 B[0][3] = mass2_gg / E2;
1769 B[0][5] = 2 * E1 * E2 * (-sin_theta1 * cos_theta2 * cos_Dphi
1770 + cos_theta1 * sin_theta2);
1772 const double sigma2_mass2_gg = (B * V * B.T())[0][0];
1775 Dy = V * B.T() * (B * Dy - f) / sigma2_mass2_gg;
1778 chi2 = (Dy.T() * V.inverse(ierr) * Dy)[0][0];
1779 double Dchi2 = fabs(chi2 - chi2_old);
1781 double Df = fabs(f[0][0] - f_old);
1785 if (Dchi2 < Dchi2_limit && Df < Df_limit)
1790 double pi0_E = y[0][0] + y[3][0];
1791 double pi0_px = y[0][0] * std::cos(y[1][0]) * std::sin(y[2][0])
1792 + y[3][0] * std::cos(y[4][0]) * std::sin(y[5][0]);
1793 double pi0_py = y[0][0] * std::sin(y[1][0]) * std::sin(y[2][0])
1794 + y[3][0] * std::sin(y[4][0]) * std::sin(y[5][0]);
1795 double pi0_pz = y[0][0] * std::cos(y[2][0]) + y[3][0] * std::cos(y[5][0]);
1796 double pi0_mass = mass_before;
1799 double pi0_chi2 = (chi2 > FLT_MAX) ? FLT_MAX : chi2;
1802 Belle::Mdst_pi0& pi0 = pi0mgr.add();
1803 pi0.gamma(0, gamma1);
1804 pi0.gamma(1, gamma2);
1810 pi0.chisq(pi0_chi2);
1818 const CLHEP::HepSymMatrix& epvtx_err)
1822 const double mpi0_pdg = 0.1349739;
1825 const double low_default = 0.1178;
1826 const double up_default = 0.1502;
1829 const int iter_max = 5;
1834 low_limit = low_default;
1835 up_limit = up_default;
1838 if (mpi0_pdg < low_limit || up_limit < mpi0_pdg) {
1840 dout(Debugout::ERR,
"B2BIIFixBelle::Mdst_ecl") <<
"Invalid mass window between " << low_limit;
1841 dout(Debugout::ERR,
"B2BIIFixBelle::Mdst_ecl") <<
" and " << up_limit << std::endl;
1846 dout(Debugout::ERR,
"B2BIIFixBelle::Mdst_ecl") <<
"Invalid option=" << option << std::endl;
1851 Belle::Mdst_pi0_Manager::get_manager().remove();
1855 Belle::Mdst_gamma_Manager& gammamgr = Belle::Mdst_gamma_Manager::get_manager();
1858 Belle::Mdst_pi0_Manager& pi0mgr = Belle::Mdst_pi0_Manager::get_manager();
1861 if (gammamgr.count() < 2) {
1866 for (std::vector<Belle::Mdst_gamma>::iterator itgamma = gammamgr.begin();
1867 itgamma != gammamgr.end(); ++itgamma) {
1868 Belle::Mdst_gamma& gamma1 = *itgamma;
1869 CLHEP::Hep3Vector gamma1_3v(gamma1.px(), gamma1.py(), gamma1.pz());
1870 CLHEP::HepLorentzVector gamma1_lv(gamma1_3v, gamma1_3v.mag());
1872 Belle::Mdst_ecl& ecl1 = gamma1.ecl();
1874 const double r_i = ecl1.r();
1875 const double dzr_i = std::sqrt(epvtx_err[2][2]) / r_i;
1877 const double theta_i0 = ecl1.theta();
1878 const double sin_th_i0 = std::sin(theta_i0);
1880 for (std::vector<Belle::Mdst_gamma>::iterator jtgamma = itgamma + 1;
1881 jtgamma != gammamgr.end(); ++jtgamma) {
1882 Belle::Mdst_gamma& gamma2 = *jtgamma;
1883 CLHEP::Hep3Vector gamma2_3v(gamma2.px(), gamma2.py(), gamma2.pz());
1884 CLHEP::HepLorentzVector gamma2_lv(gamma2_3v, gamma2_3v.mag());
1886 Belle::Mdst_ecl& ecl2 = gamma2.ecl();
1889 CLHEP::HepLorentzVector gamgam_lv = gamma1_lv + gamma2_lv;
1890 const double mass_before = gamgam_lv.mag();
1893 if (low_limit < mass_before && mass_before < up_limit) {
1895 CLHEP::HepMatrix V(6, 6, 0);
1897 V[0][0] = ecl1.error(0);
1898 V[0][1] = V[1][0] = ecl1.error(1);
1899 V[1][1] = ecl1.error(2);
1900 V[0][2] = V[2][0] = ecl1.error(3);
1901 V[1][2] = V[2][1] = ecl1.error(4);
1902 V[2][2] = ecl1.error(5);
1903 V[3][3] = ecl2.error(0);
1904 V[3][4] = V[4][3] = ecl2.error(1);
1905 V[4][4] = ecl2.error(2);
1906 V[3][5] = V[5][3] = ecl2.error(3);
1907 V[4][5] = V[5][4] = ecl2.error(4);
1908 V[5][5] = ecl2.error(5);
1911 const double r_j = ecl2.r();
1912 const double dzr_j = sqrt(epvtx_err[2][2]) / r_j;
1914 const double theta_j0 = ecl2.theta();
1915 const double sin_th_j0 = std::sin(theta_j0);
1917 V[2][5] = V[5][2] = dzr_i * sin_th_i0 * dzr_j * sin_th_j0;
1919 CLHEP::HepMatrix y0(6, 1);
1920 y0[0][0] = ecl1.energy();
1921 y0[1][0] = ecl1.phi();
1922 y0[2][0] = ecl1.theta();
1923 y0[3][0] = ecl2.energy();
1924 y0[4][0] = ecl2.phi();
1925 y0[5][0] = ecl2.theta();
1928 CLHEP::HepMatrix y(y0);
1930 CLHEP::HepMatrix Dy(6, 1, 0);
1933 double Df, f_old = DBL_MAX;
1934 double Dchi2, chi2_old = DBL_MAX;
1935 double mass_gg, chi2 = DBL_MAX;
1936 bool exit_flag =
false;
1939 const double Df_limit = 0.1;
1940 const double Dchi2_limit = 0.1;
1943 const double& E1 = y[0][0];
1944 const double& E2 = y[3][0];
1945 const double sin_theta1 = std::sin(y[2][0]);
1946 const double cos_theta1 = std::cos(y[2][0]);
1947 const double sin_theta2 = std::sin(y[5][0]);
1948 const double cos_theta2 = std::cos(y[5][0]);
1949 const double Dphi = y[1][0] - y[4][0];
1950 const double cos_Dphi = std::cos(Dphi);
1951 const double sin_Dphi = std::sin(Dphi);
1952 const double open_angle = sin_theta1 * sin_theta2 * cos_Dphi
1953 + cos_theta1 * cos_theta2;
1954 const double mass2_gg = 2 * E1 * E2 * (1 - open_angle);
1955 mass_gg = (mass2_gg > 0) ? std::sqrt(mass2_gg) : -std::sqrt(-mass2_gg);
1958 if (exit_flag || ++iter > iter_max)
1962 CLHEP::HepMatrix f(1, 1);
1963 f[0][0] = mass2_gg - (mpi0_pdg * mpi0_pdg);
1966 CLHEP::HepMatrix B(1, 6);
1967 B[0][0] = mass2_gg / E1;
1968 B[0][1] = 2 * E1 * E2 * sin_theta1 * sin_theta2 * sin_Dphi;
1969 B[0][2] = 2 * E1 * E2 * (-cos_theta1 * sin_theta2 * cos_Dphi
1970 + sin_theta1 * cos_theta2);
1971 B[0][3] = mass2_gg / E2;
1973 B[0][5] = 2 * E1 * E2 * (-sin_theta1 * cos_theta2 * cos_Dphi
1974 + cos_theta1 * sin_theta2);
1976 const double sigma2_mass2_gg = (B * V * B.T())[0][0];
1979 Dy = V * B.T() * (B * Dy - f) / sigma2_mass2_gg;
1982 chi2 = (Dy.T() * V.inverse(ierr) * Dy)[0][0];
1983 Dchi2 = fabs(chi2 - chi2_old);
1985 Df = fabs(f[0][0] - f_old);
1989 if (Dchi2 < Dchi2_limit && Df < Df_limit)
1994 double pi0_E = y[0][0] + y[3][0];
1995 double pi0_px = y[0][0] * std::cos(y[1][0]) * std::sin(y[2][0])
1996 + y[3][0] * std::cos(y[4][0]) * std::sin(y[5][0]);
1997 double pi0_py = y[0][0] * std::sin(y[1][0]) * std::sin(y[2][0])
1998 + y[3][0] * std::sin(y[4][0]) * std::sin(y[5][0]);
1999 double pi0_pz = y[0][0] * std::cos(y[2][0]) + y[3][0] * std::cos(y[5][0]);
2000 double pi0_mass = mass_before;
2003 double pi0_chi2 = (chi2 > FLT_MAX) ? FLT_MAX : chi2;
2006 Belle::Mdst_pi0& pi0 = pi0mgr.add();
2007 pi0.gamma(0, gamma1);
2008 pi0.gamma(1, gamma2);
2014 pi0.chisq(pi0_chi2);
2020 const double mpi0_pdg = 0.1349739;
2021 const double m2pi0_pdg = mpi0_pdg * mpi0_pdg;
2023 const double low_default = 0.1178;
2024 const double up_default = 0.1502;
2026 const int iter_max = 5;
2031 low_limit = low_default;
2032 up_limit = up_default;
2035 if (mpi0_pdg < low_limit || up_limit < mpi0_pdg) {
2037 B2ERROR(
"Invalid mass window between " << low_limit);
2038 B2ERROR(
" and " << up_limit);
2043 B2ERROR(
"Invalid option=" << option);
2046 Belle::Mdst_pi0_Manager& pi0_mgr = Belle::Mdst_pi0_Manager::get_manager();
2047 Belle::Mdst_gamma_Manager& gamma_mgr = Belle::Mdst_gamma_Manager::get_manager();
2050 Belle::Mdst_pi0_Manager::get_manager().remove();
2052 if (gamma_mgr.count() < 2) {
2056 for (std::vector<Belle::Mdst_gamma>::iterator i = gamma_mgr.begin();
2057 i != gamma_mgr.end(); ++i) {
2058 const Belle::Mdst_gamma& gamma_i = *i;
2059 if (!gamma_i.ecl()) {
2062 const Belle::Mdst_ecl& ecl_i = gamma_i.ecl();
2063 const double r_i = ecl_i.r();
2064 const double e_i0 = ecl_i.energy();
2065 const double phi_i0 = ecl_i.phi();
2066 const double theta_i0 = ecl_i.theta();
2068 const double sin_th_i0 = std::sin(theta_i0);
2069 const double cos_th_i0 = std::cos(theta_i0);
2071 CLHEP::HepSymMatrix err_i(3, 0);
2072 err_i[0][0] = ecl_i.error(0);
2073 err_i[1][0] = ecl_i.error(1); err_i[1][1] = ecl_i.error(2);
2074 err_i[2][0] = ecl_i.error(3); err_i[2][1] = ecl_i.error(4); err_i[2][2] = ecl_i.error(5);
2076 const double dzr_i = std::sqrt(epvtx_err[2][2]) / r_i;
2078 for (std::vector<Belle::Mdst_gamma>::iterator j = i + 1; j != gamma_mgr.end(); ++j) {
2079 const Belle::Mdst_gamma& gamma_j = *j;
2080 if (!gamma_j.ecl()) {
2083 const Belle::Mdst_ecl& ecl_j = gamma_j.ecl();
2084 const double r_j = ecl_j.r();
2085 const double e_j0 = ecl_j.energy();
2086 const double phi_j0 = ecl_j.phi();
2087 const double theta_j0 = ecl_j.theta();
2089 const double sin_th_j0 = std::sin(theta_j0);
2090 const double cos_th_j0 = std::cos(theta_j0);
2092 CLHEP::HepSymMatrix err_j(3, 0);
2093 err_j[0][0] = ecl_j.error(0);
2094 err_j[1][0] = ecl_j.error(1); err_j[1][1] = ecl_j.error(2);
2095 err_j[2][0] = ecl_j.error(3); err_j[2][1] = ecl_j.error(4); err_j[2][2] = ecl_j.error(5);
2097 const double dzr_j = sqrt(epvtx_err[2][2]) / r_j;
2101 double dth_i_x_dth_j = dzr_i * sin_th_i0 * dzr_j * sin_th_j0;
2103 double det = err_i[2][2] * err_j[2][2] - dth_i_x_dth_j * dth_i_x_dth_j;
2106 double e_i = e_i0, phi_i = phi_i0, theta_i = theta_i0, sin_th_i = sin_th_i0, cos_th_i = cos_th_i0;
2107 double e_j = e_j0, phi_j = phi_j0, theta_j = theta_j0, sin_th_j = sin_th_j0, cos_th_j = cos_th_j0;
2110 double dphi = phi_i - phi_j;
2111 double sin_dphi = std::sin(dphi);
2112 double cos_dphi = std::cos(dphi);
2115 double cos_th_ij = sin_th_i * sin_th_j * cos_dphi + cos_th_i * cos_th_j;
2116 double m2_ij = 2.0 * e_i * e_j * (1.0 - cos_th_ij);
2117 double mass = std::sqrt(m2_ij);
2119 if (mass < low_limit || mass > up_limit)
2122 double de_i = 0.0, dphi_i = 0.0, dtheta_i = 0.0;
2123 double de_j = 0.0, dphi_j = 0.0, dtheta_j = 0.0;
2128 double chisq = 1.0e+6;
2129 double df = 0.0, dchisq = 0.0;
2131 const double del_chisq = 0.1;
2132 const double del_f = 0.1;
2136 double dmass0 = 0.0;
2142 const double dcos_th_ij_dphi_i = -sin_th_i * sin_th_j * sin_dphi;
2143 const double dcos_th_ij_dphi_j = sin_th_i * sin_th_j * sin_dphi;
2144 const double dcos_th_ij_dth_i = cos_th_i * sin_th_j * cos_dphi - sin_th_i * cos_th_j;
2145 const double dcos_th_ij_dth_j = cos_th_j * sin_th_i * cos_dphi - sin_th_j * cos_th_i;
2147 const double dm2_de_i = m2_ij / e_i;
2148 const double dm2_de_j = m2_ij / e_j;
2150 const double dm2_dcos_th_ij = -2.0 * e_i * e_j;
2152 const double dm2_dphi_i = dm2_dcos_th_ij * dcos_th_ij_dphi_i;
2153 const double dm2_dphi_j = dm2_dcos_th_ij * dcos_th_ij_dphi_j;
2154 const double dm2_dth_i = dm2_dcos_th_ij * dcos_th_ij_dth_i;
2155 const double dm2_dth_j = dm2_dcos_th_ij * dcos_th_ij_dth_j;
2158 = dm2_de_i * dm2_de_i * err_i[0][0]
2159 + dm2_de_j * dm2_de_j * err_j[0][0]
2160 + dm2_dphi_i * dm2_dphi_i * err_i[1][0]
2161 + dm2_dphi_j * dm2_dphi_j * err_j[1][0]
2162 + dm2_dth_i * dm2_dth_i * err_i[2][0]
2163 + dm2_dth_j * dm2_dth_j * err_j[2][0]
2164 + 2.0 * dm2_dth_i * dm2_dth_j * dth_i_x_dth_j;
2171 dmass0 = std::sqrt(dm2_2);
2178 if (it >= iter_max ||
2179 mass < low_default || mass > up_default) {
2186 = (m2pi0_pdg - m2_ij
2189 + dm2_dphi_i * dphi_i
2190 + dm2_dphi_j * dphi_j
2191 + dm2_dth_i * dtheta_i
2192 + dm2_dth_j * dtheta_j) / dm2_2;
2194 de_i = del_m2 * dm2_de_i * err_i[0][0];
2195 de_j = del_m2 * dm2_de_j * err_j[0][0];
2196 dphi_i = del_m2 * dm2_dphi_i * err_i[1][1];
2197 dphi_j = del_m2 * dm2_dphi_j * err_j[1][1];
2198 dtheta_i = del_m2 * (dm2_dth_i * err_i[2][2] + dm2_dth_j * dth_i_x_dth_j);
2199 dtheta_j = del_m2 * (dm2_dth_j * err_j[2][2] + dm2_dth_i * dth_i_x_dth_j);
2204 = de_i * de_i / err_i[0][0]
2205 + de_j * de_j / err_j[0][0]
2206 + dphi_i * dphi_i / err_i[1][1]
2207 + dphi_j * dphi_j / err_j[1][1]
2208 + (dtheta_i * dtheta_i * err_i[2][2]
2209 + dtheta_j * dtheta_j * err_j[2][2]
2210 + 2.0 * dtheta_i * dtheta_j * dth_i_x_dth_j) / det;
2216 phi_i = phi_i0 + dphi_i;
2217 phi_j = phi_j0 + dphi_j;
2218 theta_i = theta_i0 + dtheta_i;
2219 theta_j = theta_j0 + dtheta_j;
2221 sin_th_i = std::sin(theta_i);
2222 cos_th_i = std::cos(theta_i);
2223 sin_th_j = std::sin(theta_j);
2224 cos_th_j = std::cos(theta_j);
2226 dth_i_x_dth_j = dzr_i * sin_th_i * dzr_j * sin_th_j;
2227 det = err_i[2][2] * err_j[2][2] - dth_i_x_dth_j * dth_i_x_dth_j;
2229 dphi = phi_i - phi_j;
2230 sin_dphi = std::sin(dphi);
2231 cos_dphi = std::cos(dphi);
2233 cos_th_ij = sin_th_i * sin_th_j * cos_dphi + cos_th_i * cos_th_j;
2234 m2_ij = 2.0 * e_i * e_j * (1.0 - cos_th_ij);
2235 mass = std::sqrt(m2_ij);
2238 f = fabs(m2pi0_pdg - m2_ij) / dmass0;
2241 }
while (std::fabs(df) > del_f || std::fabs(dchisq) > del_chisq);
2242 const double cos_phi_i = std::cos(phi_i);
2243 const double cos_phi_j = std::cos(phi_j);
2244 const double sin_phi_i = std::sin(phi_i);
2245 const double sin_phi_j = std::sin(phi_j);
2247 const CLHEP::HepLorentzVector p4_i(e_i * sin_th_i * cos_phi_i,
2248 e_i * sin_th_i * sin_phi_i, e_i * cos_th_i, e_i);
2249 const CLHEP::HepLorentzVector p4_j(e_j * sin_th_j * cos_phi_j,
2250 e_j * sin_th_j * sin_phi_j, e_j * cos_th_j, e_j);
2252 const CLHEP::HepLorentzVector p4_pi0(p4_i + p4_j);
2255 Belle::Mdst_pi0& pi0 = pi0_mgr.add();
2256 pi0.gamma(0, gamma_i);
2257 pi0.gamma(1, gamma_j);
2261 pi0.energy(p4_pi0.e());
2271 const CLHEP::HepSymMatrix& epvtx_err)
2274 Belle::Mdst_gamma_Manager& Gamma = Belle::Mdst_gamma_Manager::get_manager();
2276 for (std::vector<Belle::Mdst_gamma>::iterator
2277 it = Gamma.begin(); it != Gamma.end(); ++it) {
2278 double r(it->ecl().r());
2279 double theta(it->ecl().theta());
2280 double phi(it->ecl().phi());
2283 double st(std::sin(theta));
2284 double ct(std::cos(theta));
2285 double sp(std::sin(phi));
2286 double cp(std::cos(phi));
2287 HepPoint3D gamma_pos(r * st * cp, r * st * sp, r * ct);
2288 CLHEP::Hep3Vector gamma_vec(gamma_pos - epvtx);
2289 double hsq(gamma_vec.perp2());
2290 double rsq(gamma_vec.mag2());
2291 double stheta_sq_new = it->ecl().error(5) + epvtx_err(3, 3) * (hsq / (rsq * rsq));
2292 CLHEP::Hep3Vector gamma_dir(gamma_vec.unit());
2293 double e(it->ecl().energy());
2294 it->px(e * gamma_dir.x());
2295 it->py(e * gamma_dir.y());
2296 it->pz(e * gamma_dir.z());
2297 it->ecl().theta(gamma_dir.theta());
2298 it->ecl().r(gamma_vec.mag());
2299 it->ecl().error(5, stheta_sq_new);