37#include <b2bii/modules/B2BIIMdstInput/B2BIIFixMdstModule.h>
38#include "belle_legacy/panther/panther.h"
46#include "CLHEP/Vector/ThreeVector.h"
48#include "belle_legacy/tables/mdst.h"
49#include "belle_legacy/tables/belletdf.h"
67 Belle::Belle_event_Manager& evtmgr = Belle::Belle_event_Manager::get_manager();
68 if (evtmgr.count() == 0)
return;
70 Belle::Mdst_event_add_Manager& addmgr = Belle::Mdst_event_add_Manager::get_manager();
71 if (addmgr.count() == 0)
return;
72 if (addmgr[0].flag(4) != 0)
return;
75 if (mode < 0 || mode > 2) {
76 B2ERROR(
"shift_tof: invalid mode specified;");
77 B2ERROR(
"mode must be 0, 1, 2");
81 int expmc = evtmgr[0].ExpMC();
82 int expno = evtmgr[0].ExpNo();
83 int runno = evtmgr[0].RunNo();
85 if (expmc == 2)
return;
91 Belle::Mdst_charged_Manager& ChgMgr = Belle::Mdst_charged_Manager::get_manager();
92 for (std::vector<Belle::Mdst_charged>::iterator it = ChgMgr.begin();
93 it != ChgMgr.end(); ++it) {
94 Belle::Mdst_charged& Chg = *it;
97 Belle::Mdst_tof& Tof = Chg.tof();
100 TVector3 Mom(Chg.px(), Chg.py(), Chg.pz());
101 double pmom = Mom.Mag();
102 double sgn = Chg.charge();
104 for (
int im = 0; im < 5; im++) {
107 if (fabs(shift) < .005)
continue;
108 double ot = Tof.tof_exp(im);
109 double odt = ot - Tof.tof();
110 double opid = Tof.pid(im);
112 int ndf = (int)(Tof.ndf(im) + .001);
113 if (opid > 0. && opid < 1.) {
114 double ct = ot + shift;
115 double cdt = ct - Tof.tof();
116 double err = fabs(odt) / sqrt(-2.*log(opid));
117 double cch = pow(cdt / err, 2);
118 double cpid = exp(-.5 * cch);
119 double ccl = TMath::Prob(cch, ndf);
130 const int mode,
const int im,
131 const double pmom,
const double sgn,
134 static const double m[5] = {.000511, .10566, .13957, .49368, .93827};
136 double beta = pmom / sqrt(pmom * pmom + m[im] * m[im]);
142 if (runno < 536) shift = 0.;
143 else if (runno < 1440) shift = .5054 - .5216 * std::min(beta, .955);
144 else shift = .8321 - .8648 * std::min(beta, .96);
147 if (runno < 536) shift = -.0414 * exp(-pow(beta - .538, 2) / .0569);
148 else if (runno < 1440) shift = -12.3 * exp(-pow(beta + .288, 2) / .1197);
153 shift = -.876 * exp(-pow(beta + .1818, 2) / .1947);
156 shift = .01 - .1028 * exp(-pow(beta - .4454, 2) / .00272);
157 else shift = .01 - .064 * exp(-pow(beta - .4273, 2) / .00317);
171 shift = 1.089 - 1.131 * std::min(beta, .955);
174 if (sgn > 0.) shift = -.876 * exp(-pow(beta + .1818, 2) / .1947);
175 else shift = .01 - .1028 * exp(-pow(beta - .4454, 2) / .00272);
189 if (sgn > 0.) shift = -.0183 * exp(-pow(beta - .911, 2) / .00161);
192 shift = -6.6 * exp(-beta / .1);
195 if (sgn > 0.) shift = -.736 * exp(-pow(beta + .04158, 2) / .119);
196 else shift = .02 - .1475 * exp(-pow(beta - .4267, 2) / .00249);
208 if (sgn > 0.) shift = -.3259 * exp(-pow(beta - .1042, 2) / .0817);
209 else shift = .02 - .1475 * exp(-pow(beta - .4267, 2) / .00249);
void shift_tof(const int mode)
Shift tof times to account for residuals.
void shift_tof_set(const int expno, const int runno, const int mode, const int im, const double pmom, const double sgn, double &shift)
Return time shifts for different exp.
Abstract base class for different kinds of events.