111#include <b2bii/modules/B2BIIMdstInput/B2BIIFixMdstModule.h>
112#include "belle_legacy/panther/panther.h"
114#include "belle_legacy/tables/mdst.h"
115#include "belle_legacy/tables/belletdf.h"
117#include "CLHEP/Vector/ThreeVector.h"
118#include "CLHEP/Vector/LorentzVector.h"
119#include "CLHEP/Matrix/Vector.h"
120#include "CLHEP/Matrix/Matrix.h"
156 double Energy,
double)
163 double x = std::log10(Energy * 1000.0);
173 return_value = 0.85878 + 0.81947e-1 * x - 0.99708e-2 * x * x
174 - 0.28161e-3 * x * x * x;
185 return_value = 0.86582 + 0.63194e-1 * x - 0.59391e-2 * x * x
186 + 0.17727e-2 * x * x * x - 0.62325e-3 * x * x * x * x;
200 return_value = 0.88989 + 0.41082e-1 * x
201 - 0.21919e-2 * x * x + 0.27116e-2 * x * x * x - 0.89113e-3 * x * x * x * x;
203 return_value = 0.994441 + 4.90176e-3 * (x - 3.0);
217 return_value = 0.87434 + 0.62145e-1 * x
218 - 0.29691e-2 * x * x - 0.15843e-2 * x * x * x + 0.86858e-4 * x * x * x * x;
234 return_value = 0.83073 + 0.10137 * x
235 - 0.59946e-2 * x * x - 0.56516e-2 * x * x * x + 0.87225e-3 * x * x * x * x;
242 return_value = 0.89260 + 0.54731e-1 * x
243 - 0.25736e-2 * x * x - 0.16493e-2 * x * x * x + 0.1032e-3 * x * x * x * x;
244 }
else if (x < 3.5) {
245 return_value = 0.997459 + 0.0059039 * (x - 3.0);
253 return_value = 0.86432 + 0.87554e-1 * x
254 - 0.84182e-2 * x * x - 0.39880e-2 * x * x * x + 0.69435e-3 * x * x * x * x;
257 if (299 < Run && Run < 900) {
259 return_value = 0.92082 + 0.45896e-1 * x
260 - 0.68067e-2 * x * x + 0.94055e-3 * x * x * x - 0.27717e-3 * x * x * x * x;
265 return_value = 0.85154 + 0.97812e-1 * x
266 - 0.85774e-2 * x * x - 0.59092e-2 * x * x * x + 0.1121e-2 * x * x * x * x;
273 return_value = 0.84940 + 0.86266e-1 * x
274 - 0.82204e-2 * x * x - 0.12912e-2 * x * x * x;
280 return_value = 0.85049 + 0.85418e-1 * x
281 - 0.45747e-2 * x * x - 0.40081e-2 * x * x * x + 0.52113e-3 * x * x * x * x;
286 return_value = 0.87001 + 0.73693e-1 * x
287 - 0.80094e-2 * x * x - 0.78527e-3 * x * x * x + 0.25888e-4 * x * x * x * x;
292 return_value = 0.90051 + 0.56094e-1 * x
293 - 0.14842e-1 * x * x + 0.55555e-2 * x * x * x - 0.10378e-2 * x * x * x * x;
297 if (iflag05th == 1) {
300 return_value = 0.80295 + 0.13395 * x
301 - 0.10773e-1 * x * x - 0.85861e-2 * x * x * x + 0.15331e-2 * x * x * x * x;
305 return_value = 0.57169 + 0.32548 * x
306 - 0.41157e-1 * x * x - 0.21971e-1 * x * x * x + 0.50114e-2 * x * x * x * x;
311 if (iflag05th == 1) {
314 return_value = 0.81153 + 0.10847 * x
315 - 0.24652e-2 * x * x - 0.54738e-2 * x * x * x + 0.41243e-3 * x * x * x * x;
319 return_value = 0.59869 + 0.29276 * x
320 - 0.15849e-1 * x * x - 0.31322e-1 * x * x * x + 0.62491e-2 * x * x * x * x;
325 if (iflag05th == 1) {
328 return_value = 0.83528 + 0.10402 * x
329 - 0.62047e-2 * x * x - 0.62411e-2 * x * x * x + 0.10312e-2 * x * x * x * x;
333 return_value = 0.58155 + 0.30642 * x
334 - 0.16981e-1 * x * x - 0.32609e-1 * x * x * x + 0.64874e-2 * x * x * x * x;
339 if (iflag05th == 1) {
341 return_value = 0.83706 + 0.10726 * x
342 - 0.62423e-2 * x * x - 0.42425e-2 * x * x * x;
346 return_value = 0.58801 + 0.30569 * x
347 - 0.18832e-1 * x * x - 0.32116e-1 * x * x * x + 0.64899e-2 * x * x * x * x;
352 if (iflag05th == 1) {
355 return_value = 0.80827 + 0.095353 * x
356 - 0.14818e-2 * x * x - 0.23854e-2 * x * x * x - 0.22454e-3 * x * x * x * x;
358 return_value = 0.0112468 * (x - 2.8) + 0.997847;
363 return_value = 0.61133 + 0.27115 * x
364 - 0.12724e-1 * x * x - 0.28167e-1 * x * x * x + 0.54699e-2 * x * x * x * x;
369 if (iflag05th == 1) {
372 return_value = 0.90188 + 0.76563e-1 * x
373 - 0.16328e-1 * x * x + 0.56816e-3 * x * x * x;
378 return_value = 0.88077 + 0.71720e-1 * x
379 - 0.92197e-2 * x * x - 0.15932e-2 * x * x * x + 0.38133e-3 * x * x * x * x;
384 return_value = 0.57808 + 0.31083 * x
385 - 0.20247e-1 * x * x - 0.31658e-1 * x * x * x + 0.64087e-2 * x * x * x * x;
390 if (iflag05th == 1) {
393 return_value = 0.85592 + 0.93352e-1 * x
394 - 0.93144e-2 * x * x - 0.43681e-2 * x * x * x + 0.7971e-3 * x * x * x * x;
397 if (299 < Run && Run < 700) {
399 return_value = 0.89169 + 0.73301e-1 * x
400 - 0.13856e-1 * x * x + 0.47303e-3 * x * x * x;
405 return_value = 0.90799 + 0.69815e-1 * x
406 - 0.17490e-1 * x * x + 0.14651e-2 * x * x * x;
411 return_value = 0.58176 + 0.30245 * x - 0.16390e-1 * x * x
412 - 0.32258e-1 * x * x * x + 0.64121e-2 * x * x * x * x;
423 if (iflag05th == 1) {
425 return_value = 0.84823 + 0.10394 * x
426 - 0.92233e-2 * x * x - 0.72700e-2 * x * x * x + 0.14552e-2 * x * x * x * x;
430 return_value = 0.62797 + 0.23897 * x
431 + 0.10261e-1 * x * x - 0.35700e-1 * x * x * x + 0.63846e-2 * x * x * x * x;
436 if (iflag05th == 1) {
438 return_value = 0.86321 + 0.82987e-1 * x
439 - 0.12139e-1 * x * x - 0.12920e-3 * x * x * x;
443 return_value = 0.58061 + 0.30399 * x
444 - 0.17520e-1 * x * x - 0.31559e-1 * x * x * x + 0.62681e-2 * x * x * x * x;
449 if (iflag05th == 1) {
452 return_value = 0.85616 + 0.78041e-1 * x
453 - 0.38987e-2 * x * x - 0.31224e-2 * x * x * x + 0.33374e-3 * x * x * x * x;
455 return_value = ((1.0 - 0.99608) / (3.13 - 2.80)) * (x - 2.80) + 0.99608;
460 return_value = 0.57687 + 0.29948 * x
461 - 0.10594e-1 * x * x - 0.34561e-1 * x * x * x + 0.67064e-2 * x * x * x * x;
466 if (iflag05th == 1) {
468 return_value = 0.89063 + 0.72152e-1 * x
469 - 0.14143e-1 * x * x + 0.73116e-3 * x * x * x;
473 return_value = 0.59310 + 0.28618 * x
474 - 0.13858e-1 * x * x - 0.30230e-1 * x * x * x + 0.59173e-2 * x * x * x * x;
479 if (iflag05th == 1) {
482 return_value = 0.83425 + 0.10468 * x
483 - 0.53641e-2 * x * x - 0.60276e-2 * x * x * x + 0.77763e-3 * x * x * x * x;
488 return_value = 0.66100 + 0.25192 * x
489 - 0.16419e-1 * x * x - 0.25720e-1 * x * x * x + 0.52189e-2 * x * x * x * x;
494 if (iflag05th == 1) {
496 return_value = 0.86202 + 0.79575e-1 * x
497 - 0.66721e-2 * x * x - 0.28609e-2 * x * x * x + 0.42784e-3 * x * x * x * x;
501 return_value = 0.58789 + 0.29310 * x
502 - 0.15784e-1 * x * x - 0.30619e-1 * x * x * x + 0.60648e-2 * x * x * x * x;
509 return_value = 0.68839 + 0.18218 * x
510 - 0.23140e-2 * x * x - 0.17439e-1 * x * x * x + 0.29960e-2 * x * x * x * x;
514 if (iflag05th == 1) {
517 return_value = 0.94294 - 0.77497e-2 * x
518 - 0.43464e-3 * x * x + 0.99837e-2 * x * x * x - 0.23726e-2 * x * x * x * x;
520 return_value = 0.0162997 * (x - 2.80) + 0.991162;
525 return_value = 0.64816 + 0.22492 * x
526 - 0.91745e-2 * x * x - 0.21736e-1 * x * x * x + 0.41333e-2 * x * x * x * x;
533 return_value = 0.69302 + 0.18393 * x
534 - 0.10983e-1 * x * x - 0.14148e-1 * x * x * x + 0.27298e-2 * x * x * x * x;
539 if (iflag05th == 1) {
542 return_value = 0.94294 - 0.77497e-2 * x
543 - 0.43464e-3 * x * x + 0.99837e-2 * x * x * x - 0.23726e-2 * x * x * x * x;
545 return_value = 0.0162997 * (x - 2.80) + 0.991162;
550 return_value = 0.70987 + 0.16230 * x
551 - 0.64867e-2 * x * x - 0.12021e-1 * x * x * x + 0.20874e-2 * x * x * x * x;
556 return_value = 0.66833 + 0.20602 * x
557 - 0.14322e-1 * x * x - 0.15712e-1 * x * x * x + 0.31114e-2 * x * x * x * x;
563 return_value = 0.64196 + 0.23069 * x
564 - 0.20303e-1 * x * x - 0.15680e-1 * x * x * x + 0.31611e-2 * x * x * x * x;
571 return_value = 0.99 * (0.64196 + 0.23752 * x
572 - 0.85197e-2 * x * x - 0.24366e-1 * x * x * x
573 + 0.46397e-2 * x * x * x * x);
578 return_value = 0.66541 + 0.12579 * x
579 + 0.89999e-1 * x * x - 0.58305e-1 * x * x * x + 0.86969e-2 * x * x * x * x;
584 return_value = 0.62368 + 0.24142 * x
585 - 0.11677e-1 * x * x - 0.22477e-1 * x * x * x + 0.42765e-2 * x * x * x * x;
602 243, 244, 316, 317, 318, 412, 413, 414, 508, 509, 510, 604, 605, 606
605 const double bcfact[] = {
606 1.06215, 1.06589, 0.953827, 1.06607, 0.943696, 0.910855, 1.01201,
607 1.01704, 0.954612, 1.02761, 1.00716, 1.0319, 1.03135, 1.05782
610 if (exp != 45)
return 1.;
612 for (
int i = 0 ; i < 14 ; i++)
627 double x = std::log10(energy * 1000.0);
630 return_value = 0.72708 + 0.22735 * x
631 - 0.20603e-1 * x * x - 0.24644e-1 * x * x * x + 0.53480e-2 * x * x * x * x;
647 const double m_pdg = 134.9766;
652 if (0.1 < Energy && Energy < 1.0) {
653 double x = log10(Energy * 1000.0);
656 = m_pdg / (135.21 + 5.3812 * x - 4.2160 * x * x + 0.74650 * x * x * x);
691 if (!strcmp(side,
"lower")) iside = 1;
692 if (!strcmp(side,
"higher")) iside = 2;
694 B2ERROR(
"Error pi0resol. Wrong input parameter=" << side);
703 const double data_thf_pl_L[] = { 9.8233, -13.3489, 18.3271, -7.6668};
704 const double derr_thf_pl_L[] = { 0.3274, 0.755, 0.8611, 0.521};
705 const double data_thf_pl_H[] = { 6.1436, -7.9668, 12.4766, -5.3201};
706 const double derr_thf_pl_H[] = { 0.2903, 0.6754, 0.7724, 0.466};
709 const double data_thf_ph_L[] = { 7.1936, -0.6378, 0.5912, -0.075};
710 const double derr_thf_ph_L[] = { 0.1975, 0.2036, 0.0793, 0.0121};
711 const double data_thf_ph_H[] = { 4.4923, 0.5532, 0.2658, -0.0343};
712 const double derr_thf_ph_H[] = { 0.1883, 0.2019, 0.0803, 0.0122};
718 const double mc_thf_pl_L[] = { 4.8093, 3.4567, -3.7898, 1.7553};
719 const double merr_thf_pl_L[] = { 0.2145, 0.527, 0.6153, 0.3712};
720 const double mc_thf_pl_H[] = { 4.6176, -2.9049, 4.2994, -1.4776};
721 const double merr_thf_pl_H[] = { 0.1969, 0.4826, 0.555, 0.3346};
724 const double mc_thf_ph_L[] = { 6.3166, -0.5993, 0.5845, -0.0695};
725 const double merr_thf_ph_L[] = { 0.1444, 0.1468, 0.0571, 0.0087};
726 const double mc_thf_ph_H[] = { 2.9719, 1.7999, -0.2418, 0.028};
727 const double merr_thf_ph_H[] = { 0.1318, 0.1362, 0.0538, 0.0082};
734 const double data_thm_pl_L[] = { 7.7573, -4.8855, 6.5561, -2.4788};
735 const double derr_thm_pl_L[] = { 0.1621, 0.4894, 0.6882, 0.4985};
736 const double data_thm_pl_H[] = { 6.9075, -10.5036, 18.5196, -9.224};
737 const double derr_thm_pl_H[] = { 0.1458, 0.4383, 0.639, 0.4726};
740 const double data_thm_ph_L[] = { 5.2347, 2.1827, -0.6563, 0.1545};
741 const double derr_thm_ph_L[] = { 0.0986, 0.1281, 0.0627, 0.0117};
742 const double data_thm_ph_H[] = { 3.2114, 3.3806, -0.8635, 0.1371};
743 const double derr_thm_ph_H[] = { 0.0927, 0.1205, 0.058, 0.0106};
750 const double mc_thm_pl_L[] = { 6.1774, -2.1831, 3.6615, -1.1813};
751 const double merr_thm_pl_L[] = { 0.11, 0.327, 0.476, 0.3655};
752 const double mc_thm_pl_H[] = { 4.0239, -0.7485, 3.6203, -1.4823};
753 const double merr_thm_pl_H[] = { 0.0991, 0.3034, 0.4223, 0.3069};
756 const double mc_thm_ph_L[] = { 4.5966, 2.261, -0.4938, 0.0984};
757 const double merr_thm_ph_L[] = { 0.0711, 0.0917, 0.0448, 0.0081};
758 const double mc_thm_ph_H[] = { 3.4609, 2.0069, -0.0498, -0.0018};
759 const double merr_thm_ph_H[] = { 0.0966, 0.1314, 0.0574, 0.0086};
766 const double data_thb_pl_L[] = {11.5829, -21.6715, 30.2368, -13.0389};
767 const double derr_thb_pl_L[] = { 0.2742, 0.7256, 0.9139, 0.6006};
768 const double data_thb_pl_H[] = { 8.0227, -14.7387, 23.1042, -10.4233};
769 const double derr_thb_pl_H[] = { 0.2466, 0.6512, 0.8239, 0.5419};
772 const double data_thb_ph_L[] = { 7.5872, -1.8994, 1.6526, -0.2755};
773 const double derr_thb_ph_L[] = { 0.1999, 0.2638, 0.1422, 0.0335};
774 const double data_thb_ph_H[] = { 6.3542, -2.5164, 2.5763, -0.4803};
775 const double derr_thb_ph_H[] = { 0.1885, 0.2527, 0.136, 0.0318};
781 const double mc_thb_pl_L[] = { 5.2707, 2.5607, -3.1377, 1.8434};
782 const double merr_thb_pl_L[] = { 0.1801, 0.5048, 0.6741, 0.4343};
784 const double mc_thb_pl_H[] = { 2.5867, 7.6982, -10.0677, 5.312};
785 const double merr_thb_pl_H[] = { 0.1658, 0.4651, 0.6063, 0.3925};
788 const double mc_thb_ph_L[] = { 6.5206, -1.5103, 1.9054, -0.3609};
789 const double merr_thb_ph_L[] = { 0.1521, 0.2048, 0.1108, 0.0255};
790 const double mc_thb_ph_H[] = { 3.4397, 2.2372, -0.1214, -0.0004};
791 const double merr_thb_ph_H[] = { 0.1324, 0.1822, 0.1065, 0.0252};
795 double para[4] = { };
796 double error[4] = { };
809 for (
int i = 0; i <= 3; i++) {
811 para[i] = data_thf_pl_L[i];
812 error[i] = derr_thf_pl_L[i];
814 para[i] = data_thf_pl_H[i];
815 error[i] = derr_thf_pl_H[i];
820 for (
int i = 0; i <= 3; i++) {
822 para[i] = mc_thf_pl_L[i];
823 error[i] = merr_thf_pl_L[i];
825 para[i] = mc_thf_pl_H[i];
826 error[i] = merr_thf_pl_H[i];
835 if (pbuf >= 5.2) {pbuf = 5.2;}
838 for (
int i = 0; i <= 3; i++) {
840 para[i] = data_thf_ph_L[i];
841 error[i] = derr_thf_ph_L[i];
843 para[i] = data_thf_ph_H[i];
844 error[i] = derr_thf_ph_H[i];
849 for (
int i = 0; i <= 3; i++) {
851 para[i] = mc_thf_ph_L[i];
852 error[i] = merr_thf_ph_L[i];
854 para[i] = mc_thf_ph_H[i];
855 error[i] = merr_thf_ph_H[i];
863 }
else if (theta <= 100.) {
870 for (
int i = 0; i <= 3; i++) {
872 para[i] = data_thm_pl_L[i];
873 error[i] = derr_thm_pl_L[i];
875 para[i] = data_thm_pl_H[i];
876 error[i] = derr_thm_pl_H[i];
881 for (
int i = 0; i <= 3; i++) {
883 para[i] = mc_thm_pl_L[i];
884 error[i] = merr_thm_pl_L[i];
886 para[i] = mc_thm_pl_H[i];
887 error[i] = merr_thm_pl_H[i];
896 if (pbuf >= 5.2) {pbuf = 5.2;}
899 for (
int i = 0; i <= 3; i++) {
901 para[i] = data_thm_ph_L[i];
902 error[i] = derr_thm_ph_L[i];
904 para[i] = data_thm_ph_H[i];
905 error[i] = derr_thm_ph_H[i];
910 for (
int i = 0; i <= 3; i++) {
912 para[i] = mc_thm_ph_L[i];
913 error[i] = merr_thm_ph_L[i];
915 para[i] = mc_thm_ph_H[i];
916 error[i] = merr_thm_ph_H[i];
931 for (
int i = 0; i <= 3; i++) {
933 para[i] = data_thb_pl_L[i];
934 error[i] = derr_thb_pl_L[i];
936 para[i] = data_thb_pl_H[i];
937 error[i] = derr_thb_pl_H[i];
942 for (
int i = 0; i <= 3; i++) {
944 para[i] = mc_thb_pl_L[i];
945 error[i] = merr_thb_pl_L[i];
947 para[i] = mc_thb_pl_H[i];
948 error[i] = merr_thb_pl_H[i];
957 if (pbuf >= 3.0) {pbuf = 3.0;}
960 for (
int i = 0; i <= 3; i++) {
962 para[i] = data_thb_ph_L[i];
963 error[i] = derr_thb_ph_L[i];
965 para[i] = data_thb_ph_H[i];
966 error[i] = derr_thb_ph_H[i];
971 for (
int i = 0; i <= 3; i++) {
973 para[i] = mc_thb_ph_L[i];
974 error[i] = merr_thb_ph_L[i];
976 para[i] = mc_thb_ph_H[i];
977 error[i] = merr_thb_ph_H[i];
988 resol = para[0] + para[1] * pbuf + para[2] * pbuf * pbuf +
989 para[3] * pbuf * pbuf * pbuf;
990 resol = resol / 1000.;
995 double eresol = error[0] * error[0] + (pbuf * error[1]) * (pbuf * error[1])
996 + (pbuf * pbuf * error[2]) * (pbuf * pbuf * error[2])
997 + (pbuf * pbuf * pbuf * error[3]) * (pbuf * pbuf * pbuf * error[3]);
998 eresol = sqrt(eresol) / 1000.;
1000 B2DEBUG(19,
"B2BIIFixMdst_ecl" <<
LogVar(
"theta", theta) <<
LogVar(
"p", pbuf)
1229 int ecl_threshold(0);
1239 if (version < 1 || version > 2) {
1240 B2WARNING(
"correct_ecl :: Warning! ");
1241 B2WARNING(
"version=" << version <<
" is not supported! ");
1242 B2WARNING(
"Exit doing nothing!");
1248 Belle::Belle_event_Manager& evtmgr = Belle::Belle_event_Manager::get_manager();
1249 if (0 == evtmgr.count()) {
1255 int expmc = evtmgr[0].ExpMC();
1257 int Eno = evtmgr[0].ExpNo();
1258 int Rno = evtmgr[0].RunNo();
1263 if (option == 0 && expmc == 2) {
1270 if (ecl_threshold == 1) {
1278 Belle::Mdst_event_add_Manager& mevtmgr = Belle::Mdst_event_add_Manager::get_manager();
1280 if (mevtmgr.count() > 0) {
1287 if (mevtmgr[0].flag(3) == 1) {
1293 mevtmgr[0].flag(3, 1);
1298 if (mevtmgr[0].flag(3) >= version) {
1302 i_previous = mevtmgr[0].flag(3);
1303 if (i_previous == 0 || i_previous == 1) {
1304 mevtmgr[0].flag(3, version);
1307 B2WARNING(
"correct_ecl :: Warning! ");
1308 B2WARNING(
"Previously, uncorrect version was used. ");
1309 B2WARNING(
" Exit doing nothing");
1314 Belle::Mdst_event_add& meadd = mevtmgr.add();
1319 meadd.flag(3, version);
1329 Belle::Mdst_ecl_Manager& eclmgr = Belle::Mdst_ecl_Manager::get_manager();
1330 Belle::Mdst_gamma_Manager& gammamgr = Belle::Mdst_gamma_Manager::get_manager();
1333 Belle::Mdst_ecl_aux_Manager& eclauxmgr = Belle::Mdst_ecl_aux_Manager::get_manager();
1334 std::vector<Belle::Mdst_ecl_aux>::iterator itaux = eclauxmgr.begin();
1340 for (std::vector<Belle::Mdst_ecl>::iterator itecl = eclmgr.begin();
1341 itecl != eclmgr.end(); ++itecl) {
1342 Belle::Mdst_ecl& shower = *itecl;
1344 double shower_energy = shower.energy();
1345 double shower_theta = shower.theta();
1350 int cellID = (*itaux).cId();
1359 shower.energy(shower.energy() / factor45);
1360 double factor452 = factor45 * factor45;
1361 shower.error(0, shower.error(0) / factor452);
1362 shower.error(1, shower.error(1) / factor45);
1363 shower.error(3, shower.error(3) / factor45);
1366 for (std::vector<Belle::Mdst_gamma>::iterator itgam45 = gammamgr.begin();
1367 itgam45 != gammamgr.end(); ++itgam45) {
1368 Belle::Mdst_gamma& gamma45 = *itgam45;
1369 if (gamma45.ecl().get_ID() == shower.get_ID()) {
1370 gamma45.px(gamma45.px() / factor45);
1371 gamma45.py(gamma45.py() / factor45);
1372 gamma45.pz(gamma45.pz() / factor45);
1390 =
ecl_mcx3_corr(Eno, Rno, shower_energy, cos(shower_theta));
1399 shower_energy, cos(shower_theta));
1401 if (Eno == 15 && i_previous == 1) {
1412 shower_energy, cos(shower_theta));
1413 factor = factor / factor13;
1420 factor = 1.0 /
mpi0pdg(shower.energy());
1430 shower.energy(), cos(shower.theta()));
1432 if (Eno == 15 && i_previous == 1) {
1441 shower_energy, cos(shower_theta));
1442 factor = factor / factor13;
1446 factor = factor /
mpi0pdg(shower.energy());
1454 shower.energy(shower.energy() / factor);
1457 double factor2 = factor * factor;
1458 shower.error(0, shower.error(0) / factor2);
1459 shower.error(1, shower.error(1) / factor);
1460 shower.error(3, shower.error(3) / factor);
1467 for (std::vector<Belle::Mdst_gamma>::iterator itgam = gammamgr.begin();
1468 itgam != gammamgr.end(); ++itgam) {
1469 Belle::Mdst_gamma& gamma = *itgam;
1471 CLHEP::Hep3Vector gamma_3v(gamma.px(), gamma.py(), gamma.pz());
1472 double gamma_energy = gamma_3v.mag();
1473 double gamma_cos = gamma_3v.cosTheta();
1491 gamma_energy, gamma_cos);
1493 if (Eno == 15 && i_previous == 1) {
1504 gamma_energy, gamma_cos);
1505 factor = factor / factor13;
1512 factor = 1.0 /
mpi0pdg(gamma_3v.mag());
1522 gamma_3v.mag(), gamma_3v.cosTheta());
1524 if (Eno == 15 && i_previous == 1) {
1535 gamma_energy, gamma_cos);
1536 factor = factor / factor13;
1539 factor = factor /
mpi0pdg(gamma_3v.mag());
1547 gamma.px(gamma.px() / factor);
1548 gamma.py(gamma.py() / factor);
1549 gamma.pz(gamma.pz() / factor);
1574 Belle::Belle_event_Manager& evtmgr = Belle::Belle_event_Manager::get_manager();
1575 if (0 == evtmgr.count()) {
1581 int expmc = evtmgr[0].ExpMC();
1583 int Eno = evtmgr[0].ExpNo();
1591 const double mpi0_pdg = 0.1349739;
1596 const double low_default = 0.080;
1597 const double up_default = 0.180;
1600 const int iter_max = 5;
1605 low_limit = low_default;
1606 up_limit = up_default;
1609 if (mpi0_pdg < low_limit || up_limit < mpi0_pdg) {
1611 B2ERROR(
"Invalid mass window between ");
1612 B2ERROR(
" and " << up_limit);
1620 if (0.0 < low_limit || up_limit < 0.0) {
1621 B2ERROR(
"option=2 was selected. ");
1622 B2ERROR(
"Invalid mass window! " << low_limit);
1623 B2ERROR(
" should be negative, and " << up_limit);
1624 B2ERROR(
" should be positive.");
1629 B2ERROR(
"Invalid option=" << option);
1634 Belle::Mdst_pi0_Manager::get_manager().remove();
1638 Belle::Mdst_gamma_Manager& gammamgr = Belle::Mdst_gamma_Manager::get_manager();
1641 Belle::Mdst_pi0_Manager& pi0mgr = Belle::Mdst_pi0_Manager::get_manager();
1644 if (gammamgr.count() < 2) {
1649 for (std::vector<Belle::Mdst_gamma>::iterator itgamma = gammamgr.begin();
1650 itgamma != gammamgr.end(); ++itgamma) {
1651 Belle::Mdst_gamma& gamma1 = *itgamma;
1652 CLHEP::Hep3Vector gamma1_3v(gamma1.px(), gamma1.py(), gamma1.pz());
1653 CLHEP::HepLorentzVector gamma1_lv(gamma1_3v, gamma1_3v.mag());
1655 Belle::Mdst_ecl& ecl1 = gamma1.ecl();
1657 for (std::vector<Belle::Mdst_gamma>::iterator jtgamma = itgamma + 1;
1658 jtgamma != gammamgr.end(); ++jtgamma) {
1659 Belle::Mdst_gamma& gamma2 = *jtgamma;
1660 CLHEP::Hep3Vector gamma2_3v(gamma2.px(), gamma2.py(), gamma2.pz());
1661 CLHEP::HepLorentzVector gamma2_lv(gamma2_3v, gamma2_3v.mag());
1663 Belle::Mdst_ecl& ecl2 = gamma2.ecl();
1666 CLHEP::HepLorentzVector gamgam_lv = gamma1_lv + gamma2_lv;
1667 const double mass_before = gamgam_lv.mag();
1671 double mass_ctrl{0};
1672 if (option == 0 || option == 1) {
1673 mass_ctrl = mass_before;
1677 if (mass_before *
mpi0pdg(mass_before) < mpi0_pdg) {
1678 mass_ctrl = (mass_before *
mpi0pdg(mass_before) - mpi0_pdg) /
1680 gamgam_lv.theta() * 180. / M_PI,
"lower",
1681 mcdata, Eno, option);
1683 mass_ctrl = (mass_before *
mpi0pdg(mass_before) - mpi0_pdg) /
1685 gamgam_lv.theta() * 180. / M_PI,
"higher",
1686 mcdata, Eno, option);
1692 if (low_limit < mass_ctrl && mass_ctrl < up_limit) {
1705 CLHEP::HepMatrix V(6, 6, 0);
1707 V[0][0] = ecl1.error(0);
1708 V[0][1] = V[1][0] = ecl1.error(1);
1709 V[1][1] = ecl1.error(2);
1710 V[0][2] = V[2][0] = ecl1.error(3);
1711 V[1][2] = V[2][1] = ecl1.error(4);
1712 V[2][2] = ecl1.error(5);
1713 V[3][3] = ecl2.error(0);
1714 V[3][4] = V[4][3] = ecl2.error(1);
1715 V[4][4] = ecl2.error(2);
1716 V[3][5] = V[5][3] = ecl2.error(3);
1717 V[4][5] = V[5][4] = ecl2.error(4);
1718 V[5][5] = ecl2.error(5);
1721 CLHEP::HepMatrix y0(6, 1);
1722 y0[0][0] = ecl1.energy();
1723 y0[1][0] = ecl1.phi();
1724 y0[2][0] = ecl1.theta();
1725 y0[3][0] = ecl2.energy();
1726 y0[4][0] = ecl2.phi();
1727 y0[5][0] = ecl2.theta();
1730 CLHEP::HepMatrix y(y0);
1732 CLHEP::HepMatrix Dy(6, 1, 0);
1735 double f_old = DBL_MAX;
1736 double chi2_old = DBL_MAX;
1737 double chi2 = DBL_MAX;
1738 bool exit_flag =
false;
1741 const double Df_limit = 0.1;
1742 const double Dchi2_limit = 0.1;
1745 const double& E1 = y[0][0];
1746 const double& E2 = y[3][0];
1747 const double sin_theta1 = std::sin(y[2][0]);
1748 const double cos_theta1 = std::cos(y[2][0]);
1749 const double sin_theta2 = std::sin(y[5][0]);
1750 const double cos_theta2 = std::cos(y[5][0]);
1751 const double Dphi = y[1][0] - y[4][0];
1752 const double cos_Dphi = std::cos(Dphi);
1753 const double sin_Dphi = std::sin(Dphi);
1754 const double open_angle = sin_theta1 * sin_theta2 * cos_Dphi
1755 + cos_theta1 * cos_theta2;
1756 const double mass2_gg = 2 * E1 * E2 * (1 - open_angle);
1760 if (exit_flag || ++iter > iter_max)
1764 CLHEP::HepMatrix f(1, 1);
1765 f[0][0] = mass2_gg - (mpi0_pdg * mpi0_pdg);
1768 CLHEP::HepMatrix B(1, 6);
1769 B[0][0] = mass2_gg / E1;
1770 B[0][1] = 2 * E1 * E2 * sin_theta1 * sin_theta2 * sin_Dphi;
1771 B[0][2] = 2 * E1 * E2 * (-cos_theta1 * sin_theta2 * cos_Dphi
1772 + sin_theta1 * cos_theta2);
1773 B[0][3] = mass2_gg / E2;
1775 B[0][5] = 2 * E1 * E2 * (-sin_theta1 * cos_theta2 * cos_Dphi
1776 + cos_theta1 * sin_theta2);
1778 const double sigma2_mass2_gg = (B * V * B.T())[0][0];
1781 Dy = V * B.T() * (B * Dy - f) / sigma2_mass2_gg;
1784 chi2 = (Dy.T() * V.inverse(ierr) * Dy)[0][0];
1785 double Dchi2 = fabs(chi2 - chi2_old);
1787 double Df = fabs(f[0][0] - f_old);
1791 if (Dchi2 < Dchi2_limit && Df < Df_limit)
1796 double pi0_E = y[0][0] + y[3][0];
1797 double pi0_px = y[0][0] * std::cos(y[1][0]) * std::sin(y[2][0])
1798 + y[3][0] * std::cos(y[4][0]) * std::sin(y[5][0]);
1799 double pi0_py = y[0][0] * std::sin(y[1][0]) * std::sin(y[2][0])
1800 + y[3][0] * std::sin(y[4][0]) * std::sin(y[5][0]);
1801 double pi0_pz = y[0][0] * std::cos(y[2][0]) + y[3][0] * std::cos(y[5][0]);
1802 double pi0_mass = mass_before;
1805 double pi0_chi2 = (chi2 > FLT_MAX) ? FLT_MAX : chi2;
1808 Belle::Mdst_pi0& pi0 = pi0mgr.add();
1809 pi0.gamma(0, gamma1);
1810 pi0.gamma(1, gamma2);
1816 pi0.chisq(pi0_chi2);
1824 const CLHEP::HepSymMatrix& epvtx_err)
1828 const double mpi0_pdg = 0.1349739;
1831 const double low_default = 0.1178;
1832 const double up_default = 0.1502;
1835 const int iter_max = 5;
1840 low_limit = low_default;
1841 up_limit = up_default;
1844 if (mpi0_pdg < low_limit || up_limit < mpi0_pdg) {
1846 dout(Debugout::ERR,
"B2BIIFixBelle::Mdst_ecl") <<
"Invalid mass window between " << low_limit;
1847 dout(Debugout::ERR,
"B2BIIFixBelle::Mdst_ecl") <<
" and " << up_limit << std::endl;
1852 dout(Debugout::ERR,
"B2BIIFixBelle::Mdst_ecl") <<
"Invalid option=" << option << std::endl;
1857 Belle::Mdst_pi0_Manager::get_manager().remove();
1861 Belle::Mdst_gamma_Manager& gammamgr = Belle::Mdst_gamma_Manager::get_manager();
1864 Belle::Mdst_pi0_Manager& pi0mgr = Belle::Mdst_pi0_Manager::get_manager();
1867 if (gammamgr.count() < 2) {
1872 for (std::vector<Belle::Mdst_gamma>::iterator itgamma = gammamgr.begin();
1873 itgamma != gammamgr.end(); ++itgamma) {
1874 Belle::Mdst_gamma& gamma1 = *itgamma;
1875 CLHEP::Hep3Vector gamma1_3v(gamma1.px(), gamma1.py(), gamma1.pz());
1876 CLHEP::HepLorentzVector gamma1_lv(gamma1_3v, gamma1_3v.mag());
1878 Belle::Mdst_ecl& ecl1 = gamma1.ecl();
1880 const double r_i = ecl1.r();
1881 const double dzr_i = std::sqrt(epvtx_err[2][2]) / r_i;
1883 const double theta_i0 = ecl1.theta();
1884 const double sin_th_i0 = std::sin(theta_i0);
1886 for (std::vector<Belle::Mdst_gamma>::iterator jtgamma = itgamma + 1;
1887 jtgamma != gammamgr.end(); ++jtgamma) {
1888 Belle::Mdst_gamma& gamma2 = *jtgamma;
1889 CLHEP::Hep3Vector gamma2_3v(gamma2.px(), gamma2.py(), gamma2.pz());
1890 CLHEP::HepLorentzVector gamma2_lv(gamma2_3v, gamma2_3v.mag());
1892 Belle::Mdst_ecl& ecl2 = gamma2.ecl();
1895 CLHEP::HepLorentzVector gamgam_lv = gamma1_lv + gamma2_lv;
1896 const double mass_before = gamgam_lv.mag();
1899 if (low_limit < mass_before && mass_before < up_limit) {
1901 CLHEP::HepMatrix V(6, 6, 0);
1903 V[0][0] = ecl1.error(0);
1904 V[0][1] = V[1][0] = ecl1.error(1);
1905 V[1][1] = ecl1.error(2);
1906 V[0][2] = V[2][0] = ecl1.error(3);
1907 V[1][2] = V[2][1] = ecl1.error(4);
1908 V[2][2] = ecl1.error(5);
1909 V[3][3] = ecl2.error(0);
1910 V[3][4] = V[4][3] = ecl2.error(1);
1911 V[4][4] = ecl2.error(2);
1912 V[3][5] = V[5][3] = ecl2.error(3);
1913 V[4][5] = V[5][4] = ecl2.error(4);
1914 V[5][5] = ecl2.error(5);
1917 const double r_j = ecl2.r();
1918 const double dzr_j = sqrt(epvtx_err[2][2]) / r_j;
1920 const double theta_j0 = ecl2.theta();
1921 const double sin_th_j0 = std::sin(theta_j0);
1923 V[2][5] = V[5][2] = dzr_i * sin_th_i0 * dzr_j * sin_th_j0;
1925 CLHEP::HepMatrix y0(6, 1);
1926 y0[0][0] = ecl1.energy();
1927 y0[1][0] = ecl1.phi();
1928 y0[2][0] = ecl1.theta();
1929 y0[3][0] = ecl2.energy();
1930 y0[4][0] = ecl2.phi();
1931 y0[5][0] = ecl2.theta();
1934 CLHEP::HepMatrix y(y0);
1936 CLHEP::HepMatrix Dy(6, 1, 0);
1939 double Df, f_old = DBL_MAX;
1940 double Dchi2, chi2_old = DBL_MAX;
1941 double mass_gg, chi2 = DBL_MAX;
1942 bool exit_flag =
false;
1945 const double Df_limit = 0.1;
1946 const double Dchi2_limit = 0.1;
1949 const double& E1 = y[0][0];
1950 const double& E2 = y[3][0];
1951 const double sin_theta1 = std::sin(y[2][0]);
1952 const double cos_theta1 = std::cos(y[2][0]);
1953 const double sin_theta2 = std::sin(y[5][0]);
1954 const double cos_theta2 = std::cos(y[5][0]);
1955 const double Dphi = y[1][0] - y[4][0];
1956 const double cos_Dphi = std::cos(Dphi);
1957 const double sin_Dphi = std::sin(Dphi);
1958 const double open_angle = sin_theta1 * sin_theta2 * cos_Dphi
1959 + cos_theta1 * cos_theta2;
1960 const double mass2_gg = 2 * E1 * E2 * (1 - open_angle);
1961 mass_gg = (mass2_gg > 0) ? std::sqrt(mass2_gg) : -std::sqrt(-mass2_gg);
1964 if (exit_flag || ++iter > iter_max)
1968 CLHEP::HepMatrix f(1, 1);
1969 f[0][0] = mass2_gg - (mpi0_pdg * mpi0_pdg);
1972 CLHEP::HepMatrix B(1, 6);
1973 B[0][0] = mass2_gg / E1;
1974 B[0][1] = 2 * E1 * E2 * sin_theta1 * sin_theta2 * sin_Dphi;
1975 B[0][2] = 2 * E1 * E2 * (-cos_theta1 * sin_theta2 * cos_Dphi
1976 + sin_theta1 * cos_theta2);
1977 B[0][3] = mass2_gg / E2;
1979 B[0][5] = 2 * E1 * E2 * (-sin_theta1 * cos_theta2 * cos_Dphi
1980 + cos_theta1 * sin_theta2);
1982 const double sigma2_mass2_gg = (B * V * B.T())[0][0];
1985 Dy = V * B.T() * (B * Dy - f) / sigma2_mass2_gg;
1988 chi2 = (Dy.T() * V.inverse(ierr) * Dy)[0][0];
1989 Dchi2 = fabs(chi2 - chi2_old);
1991 Df = fabs(f[0][0] - f_old);
1995 if (Dchi2 < Dchi2_limit && Df < Df_limit)
2000 double pi0_E = y[0][0] + y[3][0];
2001 double pi0_px = y[0][0] * std::cos(y[1][0]) * std::sin(y[2][0])
2002 + y[3][0] * std::cos(y[4][0]) * std::sin(y[5][0]);
2003 double pi0_py = y[0][0] * std::sin(y[1][0]) * std::sin(y[2][0])
2004 + y[3][0] * std::sin(y[4][0]) * std::sin(y[5][0]);
2005 double pi0_pz = y[0][0] * std::cos(y[2][0]) + y[3][0] * std::cos(y[5][0]);
2006 double pi0_mass = mass_before;
2009 double pi0_chi2 = (chi2 > FLT_MAX) ? FLT_MAX : chi2;
2012 Belle::Mdst_pi0& pi0 = pi0mgr.add();
2013 pi0.gamma(0, gamma1);
2014 pi0.gamma(1, gamma2);
2020 pi0.chisq(pi0_chi2);
2026 const double mpi0_pdg = 0.1349739;
2027 const double m2pi0_pdg = mpi0_pdg * mpi0_pdg;
2029 const double low_default = 0.1178;
2030 const double up_default = 0.1502;
2032 const int iter_max = 5;
2037 low_limit = low_default;
2038 up_limit = up_default;
2041 if (mpi0_pdg < low_limit || up_limit < mpi0_pdg) {
2043 B2ERROR(
"Invalid mass window between " << low_limit);
2044 B2ERROR(
" and " << up_limit);
2049 B2ERROR(
"Invalid option=" << option);
2052 Belle::Mdst_pi0_Manager& pi0_mgr = Belle::Mdst_pi0_Manager::get_manager();
2053 Belle::Mdst_gamma_Manager& gamma_mgr = Belle::Mdst_gamma_Manager::get_manager();
2056 Belle::Mdst_pi0_Manager::get_manager().remove();
2058 if (gamma_mgr.count() < 2) {
2062 for (std::vector<Belle::Mdst_gamma>::iterator i = gamma_mgr.begin();
2063 i != gamma_mgr.end(); ++i) {
2064 const Belle::Mdst_gamma& gamma_i = *i;
2065 if (!gamma_i.ecl()) {
2068 const Belle::Mdst_ecl& ecl_i = gamma_i.ecl();
2069 const double r_i = ecl_i.r();
2070 const double e_i0 = ecl_i.energy();
2071 const double phi_i0 = ecl_i.phi();
2072 const double theta_i0 = ecl_i.theta();
2074 const double sin_th_i0 = std::sin(theta_i0);
2075 const double cos_th_i0 = std::cos(theta_i0);
2077 CLHEP::HepSymMatrix err_i(3, 0);
2078 err_i[0][0] = ecl_i.error(0);
2079 err_i[1][0] = ecl_i.error(1); err_i[1][1] = ecl_i.error(2);
2080 err_i[2][0] = ecl_i.error(3); err_i[2][1] = ecl_i.error(4); err_i[2][2] = ecl_i.error(5);
2082 const double dzr_i = std::sqrt(epvtx_err[2][2]) / r_i;
2084 for (std::vector<Belle::Mdst_gamma>::iterator j = i + 1; j != gamma_mgr.end(); ++j) {
2085 const Belle::Mdst_gamma& gamma_j = *j;
2086 if (!gamma_j.ecl()) {
2089 const Belle::Mdst_ecl& ecl_j = gamma_j.ecl();
2090 const double r_j = ecl_j.r();
2091 const double e_j0 = ecl_j.energy();
2092 const double phi_j0 = ecl_j.phi();
2093 const double theta_j0 = ecl_j.theta();
2095 const double sin_th_j0 = std::sin(theta_j0);
2096 const double cos_th_j0 = std::cos(theta_j0);
2098 CLHEP::HepSymMatrix err_j(3, 0);
2099 err_j[0][0] = ecl_j.error(0);
2100 err_j[1][0] = ecl_j.error(1); err_j[1][1] = ecl_j.error(2);
2101 err_j[2][0] = ecl_j.error(3); err_j[2][1] = ecl_j.error(4); err_j[2][2] = ecl_j.error(5);
2103 const double dzr_j = sqrt(epvtx_err[2][2]) / r_j;
2107 double dth_i_x_dth_j = dzr_i * sin_th_i0 * dzr_j * sin_th_j0;
2109 double det = err_i[2][2] * err_j[2][2] - dth_i_x_dth_j * dth_i_x_dth_j;
2112 double e_i = e_i0, phi_i = phi_i0, sin_th_i = sin_th_i0, cos_th_i = cos_th_i0;
2113 double e_j = e_j0, phi_j = phi_j0, sin_th_j = sin_th_j0, cos_th_j = cos_th_j0;
2116 double dphi = phi_i - phi_j;
2117 double sin_dphi = std::sin(dphi);
2118 double cos_dphi = std::cos(dphi);
2121 double cos_th_ij = sin_th_i * sin_th_j * cos_dphi + cos_th_i * cos_th_j;
2122 double m2_ij = 2.0 * e_i * e_j * (1.0 - cos_th_ij);
2123 double mass = std::sqrt(m2_ij);
2125 if (mass < low_limit || mass > up_limit)
2128 double de_i = 0.0, dphi_i = 0.0, dtheta_i = 0.0;
2129 double de_j = 0.0, dphi_j = 0.0, dtheta_j = 0.0;
2134 double chisq = 1.0e+6;
2135 double df = 0.0, dchisq = 0.0;
2137 const double del_chisq = 0.1;
2138 const double del_f = 0.1;
2142 double dmass0 = 0.0;
2148 const double dcos_th_ij_dphi_i = -sin_th_i * sin_th_j * sin_dphi;
2149 const double dcos_th_ij_dphi_j = sin_th_i * sin_th_j * sin_dphi;
2150 const double dcos_th_ij_dth_i = cos_th_i * sin_th_j * cos_dphi - sin_th_i * cos_th_j;
2151 const double dcos_th_ij_dth_j = cos_th_j * sin_th_i * cos_dphi - sin_th_j * cos_th_i;
2153 const double dm2_de_i = m2_ij / e_i;
2154 const double dm2_de_j = m2_ij / e_j;
2156 const double dm2_dcos_th_ij = -2.0 * e_i * e_j;
2158 const double dm2_dphi_i = dm2_dcos_th_ij * dcos_th_ij_dphi_i;
2159 const double dm2_dphi_j = dm2_dcos_th_ij * dcos_th_ij_dphi_j;
2160 const double dm2_dth_i = dm2_dcos_th_ij * dcos_th_ij_dth_i;
2161 const double dm2_dth_j = dm2_dcos_th_ij * dcos_th_ij_dth_j;
2164 = dm2_de_i * dm2_de_i * err_i[0][0]
2165 + dm2_de_j * dm2_de_j * err_j[0][0]
2166 + dm2_dphi_i * dm2_dphi_i * err_i[1][0]
2167 + dm2_dphi_j * dm2_dphi_j * err_j[1][0]
2168 + dm2_dth_i * dm2_dth_i * err_i[2][0]
2169 + dm2_dth_j * dm2_dth_j * err_j[2][0]
2170 + 2.0 * dm2_dth_i * dm2_dth_j * dth_i_x_dth_j;
2177 dmass0 = std::sqrt(dm2_2);
2184 if (it >= iter_max ||
2185 mass < low_default || mass > up_default) {
2191 = (m2pi0_pdg - m2_ij
2194 + dm2_dphi_i * dphi_i
2195 + dm2_dphi_j * dphi_j
2196 + dm2_dth_i * dtheta_i
2197 + dm2_dth_j * dtheta_j) / dm2_2;
2199 de_i = del_m2 * dm2_de_i * err_i[0][0];
2200 de_j = del_m2 * dm2_de_j * err_j[0][0];
2201 dphi_i = del_m2 * dm2_dphi_i * err_i[1][1];
2202 dphi_j = del_m2 * dm2_dphi_j * err_j[1][1];
2203 dtheta_i = del_m2 * (dm2_dth_i * err_i[2][2] + dm2_dth_j * dth_i_x_dth_j);
2204 dtheta_j = del_m2 * (dm2_dth_j * err_j[2][2] + dm2_dth_i * dth_i_x_dth_j);
2209 = de_i * de_i / err_i[0][0]
2210 + de_j * de_j / err_j[0][0]
2211 + dphi_i * dphi_i / err_i[1][1]
2212 + dphi_j * dphi_j / err_j[1][1]
2213 + (dtheta_i * dtheta_i * err_i[2][2]
2214 + dtheta_j * dtheta_j * err_j[2][2]
2215 + 2.0 * dtheta_i * dtheta_j * dth_i_x_dth_j) / det;
2221 phi_i = phi_i0 + dphi_i;
2222 phi_j = phi_j0 + dphi_j;
2223 double theta_i = theta_i0 + dtheta_i;
2224 double theta_j = theta_j0 + dtheta_j;
2226 sin_th_i = std::sin(theta_i);
2227 cos_th_i = std::cos(theta_i);
2228 sin_th_j = std::sin(theta_j);
2229 cos_th_j = std::cos(theta_j);
2231 dth_i_x_dth_j = dzr_i * sin_th_i * dzr_j * sin_th_j;
2232 det = err_i[2][2] * err_j[2][2] - dth_i_x_dth_j * dth_i_x_dth_j;
2234 dphi = phi_i - phi_j;
2235 sin_dphi = std::sin(dphi);
2236 cos_dphi = std::cos(dphi);
2238 cos_th_ij = sin_th_i * sin_th_j * cos_dphi + cos_th_i * cos_th_j;
2239 m2_ij = 2.0 * e_i * e_j * (1.0 - cos_th_ij);
2240 mass = std::sqrt(m2_ij);
2243 f = fabs(m2pi0_pdg - m2_ij) / dmass0;
2246 }
while (std::fabs(df) > del_f || std::fabs(dchisq) > del_chisq);
2247 const double cos_phi_i = std::cos(phi_i);
2248 const double cos_phi_j = std::cos(phi_j);
2249 const double sin_phi_i = std::sin(phi_i);
2250 const double sin_phi_j = std::sin(phi_j);
2252 const CLHEP::HepLorentzVector p4_i(e_i * sin_th_i * cos_phi_i,
2253 e_i * sin_th_i * sin_phi_i, e_i * cos_th_i, e_i);
2254 const CLHEP::HepLorentzVector p4_j(e_j * sin_th_j * cos_phi_j,
2255 e_j * sin_th_j * sin_phi_j, e_j * cos_th_j, e_j);
2257 const CLHEP::HepLorentzVector p4_pi0(p4_i + p4_j);
2260 Belle::Mdst_pi0& pi0 = pi0_mgr.add();
2261 pi0.gamma(0, gamma_i);
2262 pi0.gamma(1, gamma_j);
2266 pi0.energy(p4_pi0.e());
2276 const CLHEP::HepSymMatrix& epvtx_err)
2279 Belle::Mdst_gamma_Manager& Gamma = Belle::Mdst_gamma_Manager::get_manager();
2281 for (std::vector<Belle::Mdst_gamma>::iterator
2282 it = Gamma.begin(); it != Gamma.end(); ++it) {
2283 double r(it->ecl().r());
2284 double theta(it->ecl().theta());
2285 double phi(it->ecl().phi());
2288 double st(std::sin(theta));
2289 double ct(std::cos(theta));
2290 double sp(std::sin(phi));
2291 double cp(std::cos(phi));
2292 HepPoint3D gamma_pos(r * st * cp, r * st * sp, r * ct);
2293 CLHEP::Hep3Vector gamma_vec(gamma_pos - epvtx);
2294 double hsq(gamma_vec.perp2());
2295 double rsq(gamma_vec.mag2());
2296 double stheta_sq_new = it->ecl().error(5) + epvtx_err(3, 3) * (hsq / (rsq * rsq));
2297 CLHEP::Hep3Vector gamma_dir(gamma_vec.unit());
2298 double e(it->ecl().energy());
2299 it->px(e * gamma_dir.x());
2300 it->py(e * gamma_dir.y());
2301 it->pz(e * gamma_dir.z());
2302 it->ecl().theta(gamma_dir.theta());
2303 it->ecl().r(gamma_vec.mag());
2304 it->ecl().error(5, stheta_sq_new);
int m_reprocess_version
Reprocess version (=0:old; =1:new)
Class to store variables with their name which were sent to the logging service.
static double ecl_adhoc_corr(int Exp, int Run, int iflag05th, double Energy, double)
The function giving correction factor.
void make_pi0(int, double, double)
Create Mdst_pi0 from Mdst_gamma and Mdst_ecl to let people get mass-constraint fitted momentum of pi0...
void make_pi0_primary_vertex(int, double, double, const HepPoint3D &, const CLHEP::HepSymMatrix &)
Fill Mdst_pi0 based on the fit result.
void correct_ecl_primary_vertex(const HepPoint3D &, const CLHEP::HepSymMatrix &)
Correct ecl using primary vertex.
static double ecl_adhoc_corr_45(int exp, int, int cid)
The function giving correction factor in Exp.45.
void correct_ecl(int, int)
Correct photon's momenta and error matrix.
static double ecl_mcx3_corr(int, int, double energy, double)
Correct energy scale (MC) to make pi0 peak nominal.
static double mpi0pdg(double Energy)
Make MC mass peak to PDG value.
static double pi0resol(double, double, const char *, bool, int, int)
Treat pi0 mass width as a func.
Abstract base class for different kinds of events.