44 mt2w::mt2w(
double upper_bound,
double error_value,
double scan_step)
49 upper_bound_ = upper_bound;
50 error_value_ = error_value;
51 scan_step_ = scan_step;
54 double mt2w::get_mt2w()
58 cout <<
" Please set momenta first!" << endl;
66 void mt2w::set_momenta(
double *pl,
double *pb1,
double *pb2,
double* pmiss)
70 set_momenta(pl[0], pl[1], pl[2], pl[3],
71 pb1[0], pb1[1], pb1[2], pb1[3],
72 pb2[0], pb2[1], pb2[2], pb2[3],
76 void mt2w::set_momenta(
double El,
double plx,
double ply,
double plz,
77 double Eb1,
double pb1x,
double pb1y,
double pb1z,
78 double Eb2,
double pb2x,
double pb2y,
double pb2z,
79 double pmissx,
double pmissy)
95 msqtemp = El*El-plx*plx-ply*ply-plz*plz;
96 if (msqtemp > 0.0) {mlsq_ = msqtemp;}
109 msqtemp = Eb1*Eb1-pb1x*pb1x-pb1y*pb1y-pb1z*pb1z;
110 if (msqtemp > 0.0) {mb1sq_ = msqtemp;}
123 msqtemp = Eb2*Eb2-pb2x*pb2x-pb2y*pb2y-pb2z*pb2z;
124 if (msqtemp > 0.0) {mb2sq_ = msqtemp;}
146 void mt2w::mt2w_bisect()
154 double mtop_high = upper_bound_;
157 if (mb1_ >= mb2_) {mtop_low = mw_ + mb1_;}
158 else {mtop_low = mw_ + mb2_;}
165 if (teco(mtop_high)==0) {mtop_high = mtop_low;}
169 while (teco(mtop_high)==0 && mtop_high < upper_bound_ + 2.*scan_step_) {
172 mtop_high = mtop_high + scan_step_;
176 if (mtop_high > upper_bound_) {
177 mt2w_b_ = error_value_;
182 while(mtop_high - mtop_low > precision_)
184 double mtop_mid,teco_mid;
186 mtop_mid = (mtop_high+mtop_low)/2.;
187 teco_mid = teco(mtop_mid);
189 if(teco_mid == 0) {mtop_low = mtop_mid;}
190 else {mtop_high = mtop_mid;}
199 int mt2w::teco(
double mtop)
204 if (mtop < mb1_+mw_ || mtop < mb2_+mw_) {
return 0;}
208 double ETb2sq = Eb2sq_ - pb2z_*pb2z_;
209 double delta = (mtop*mtop-mw_*mw_-mb2sq_)/(2.*ETb2sq);
214 double del1 = mw_*mw_ - mv_*mv_ - mlsq_;
215 double del2 = mtop*mtop - mw_*mw_ - mb1sq_ - 2*(El_*Eb1_-plx_*pb1x_-ply_*pb1y_-plz_*pb1z_);
219 double aa = (El_*pb1x_-Eb1_*plx_)/(Eb1_*plz_-El_*pb1z_);
220 double bb = (El_*pb1y_-Eb1_*ply_)/(Eb1_*plz_-El_*pb1z_);
221 double cc = (El_*del2-Eb1_*del1)/(2.*Eb1_*plz_-2.*El_*pb1z_);
232 a1_ = Eb1sq_*(1.+aa*aa)-(pb1x_+pb1z_*aa)*(pb1x_+pb1z_*aa);
233 b1_ = Eb1sq_*aa*bb - (pb1x_+pb1z_*aa)*(pb1y_+pb1z_*bb);
234 c1_ = Eb1sq_*(1.+bb*bb)-(pb1y_+pb1z_*bb)*(pb1y_+pb1z_*bb);
235 d1_ = Eb1sq_*aa*cc - (pb1x_+pb1z_*aa)*(pb1z_*cc+del2/2.0);
236 e1_ = Eb1sq_*bb*cc - (pb1y_+pb1z_*bb)*(pb1z_*cc+del2/2.0);
237 f1_ = Eb1sq_*(mv_*mv_+cc*cc) - (pb1z_*cc+del2/2.0)*(pb1z_*cc+del2/2.0);
241 double det1 = (a1_*(c1_*f1_ - e1_*e1_) - b1_*(b1_*f1_ - d1_*e1_) + d1_*(b1_*e1_-c1_*d1_))/(a1_+c1_);
243 if (det1 > 0.0) {
return 0;}
247 a2_ = 1-pb2x_*pb2x_/(ETb2sq);
248 b2_ = -pb2x_*pb2y_/(ETb2sq);
249 c2_ = 1-pb2y_*pb2y_/(ETb2sq);
255 f2o_ = mw_*mw_ - delta*delta*ETb2sq;
257 d2_ = -d2o_ -a2_*pmissx_ -b2_*pmissy_;
258 e2_ = -e2o_ -c2_*pmissy_ -b2_*pmissx_;
259 f2_ = a2_*pmissx_*pmissx_ + 2*b2_*pmissx_*pmissy_ + c2_*pmissy_*pmissy_ + 2*d2o_*pmissx_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1_*b2_*b2_*f1_ + 2*a2_*a2_*c1_*f1_ - 2*a1_*a2_*c2_*f1_ +
293 4*a2_*b1_*b1_*f2_ - 4*a1_*b1_*b2_*f2_ - 2*a1_*a2_*c1_*f2_ + 2*a1_*a1_*c2_*f2_)/Eb1sq_;
296 (-8*a2_*d1_*d2_*e1_ + 8*a1_*d2_*d2_*e1_ + 8*a2_*d1_*d1_*e2_ - 8*a1_*d1_*d2_*e2_ -
297 4*a2_*b2_*d1_*f1_ - 4*a2_*b1_*d2_*f1_ + 8*a1_*b2_*d2_*f1_ + 4*a2_*a2_*e1_*f1_ -
298 4*a1_*a2_*e2_*f1_ + 8*a2_*b1_*d1_*f2_ - 4*a1_*b2_*d1_*f2_ - 4*a1_*b1_*d2_*f2_ -
299 4*a1_*a2_*e1_*f2_ + 4*a1_*a1_*e2_*f2_)/(Eb1sq_*Eb1_);
302 (-4*a2_*d1_*d2_*f1_ + 4*a1_*d2_*d2_*f1_ + a2_*a2_*f1_*f1_ +
303 4*a2_*d1_*d1_*f2_ - 4*a1_*d1_*d2_*f2_ - 2*a1_*a2_*f1_*f2_ +
304 a1_*a1_*f2_*f2_)/(Eb1sq_*Eb1sq_);
312 long double A3sq = A3*A3;
314 long double B3, B2, B1, B0;
320 long double C2, C1, C0;
321 C2 = -(A2/2 - 3*A3sq/(16*A4));
322 C1 = -(3*A1/4. -A2*A3/(8*A4));
323 C0 = -A0 + A1*A3/(16*A4);
326 D1 = -B1 - (B3*C1*C1/C2 - B3*C0 -B2*C1)/C2;
327 D0 = -B0 - B3 *C0 *C1/(C2*C2)+ B2*C0/C2;
330 E0 = -C0 - C2*D0*D0/(D1*D1) + C1*D0/D1;
332 long double t1,t2,t3,t4,t5;
343 nsol = signchange_n(t1,t2,t3,t4,t5) - signchange_p(t1,t2,t3,t4,t5);
346 if (nsol < 0) nsol = 0;
349 if (nsol == 0) {out = 0;}
356 inline int mt2w::signchange_n(
long double t1,
long double t2,
long double t3,
long double t4,
long double t5)
366 inline int mt2w::signchange_p(
long double t1,
long double t2,
long double t3,
long double t4,
long double t5)
#define ABSOLUTE_PRECISION
#define RELATIVE_PRECISION