Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00037 #include "TopQuarkAnalysis/TopHitFit/interface/Top_Decaykin.h"
00038 #include "TopQuarkAnalysis/TopHitFit/interface/Lepjets_Event.h"
00039 #include "TopQuarkAnalysis/TopHitFit/interface/fourvec.h"
00040 #include <cmath>
00041 #include <algorithm>
00042 #include <ostream>
00043
00044
00045 using std::sqrt;
00046 using std::abs;
00047 using std::swap;
00048 using std::ostream;
00049
00050
00051 namespace hitfit {
00052
00053
00054 namespace {
00055
00056
00062 Fourvec leptons (const Lepjets_Event& ev)
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072 {
00073 return (ev.sum (lepton_label) +
00074 ev.sum (electron_label) +
00075 ev.sum (muon_label));
00076 }
00077
00078
00079 }
00080
00081
00082 bool Top_Decaykin::solve_nu_tmass (const Lepjets_Event& ev,
00083 double tmass,
00084 double& nuz1, double& nuz2)
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102 {
00103 bool discrim_flag = true;
00104
00105 const Fourvec& vnu = ev.met ();
00106 Fourvec cprime = leptons (ev) + ev.sum (lepb_label);
00107 double alpha1 = tmass*tmass - cprime.m2();
00108 double a = 2 * 4 * (cprime.z()*cprime.z() - cprime.e()*cprime.e());
00109 double alpha = alpha1 + 2*(cprime.x()*vnu.x() + cprime.y()*vnu.y());
00110 double b = 4 * alpha * cprime.z();
00111 double c = alpha*alpha - 4 * cprime.e()*cprime.e() * vnu.vect().perp2();
00112 double d = b*b - 2*a*c;
00113 if (d < 0) {
00114 discrim_flag = false;
00115 d = 0;
00116 }
00117
00118 double dd = sqrt (d);
00119 nuz1 = (-b + dd)/a;
00120 nuz2 = (-b - dd)/a;
00121 if (abs (nuz1) > abs (nuz2))
00122 swap (nuz1, nuz2);
00123
00124 return discrim_flag;
00125 }
00126
00127
00128 bool Top_Decaykin::solve_nu_tmass (const Lepjets_Event& ev,
00129 double tmass,
00130 double& re_nuz1,
00131 double& im_nuz1,
00132 double& re_nuz2,
00133 double& im_nuz2)
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155 {
00156 bool discrim_flag = true;
00157
00158 const Fourvec& vnu = ev.met ();
00159 Fourvec cprime = leptons (ev) + ev.sum (lepb_label);
00160 double alpha1 = tmass*tmass - cprime.m2();
00161 double a = 2 * 4 * (cprime.z()*cprime.z() - cprime.e()*cprime.e());
00162
00163
00164 double alpha = alpha1 + 2*(cprime.x()*vnu.x() + cprime.y()*vnu.y());
00165 double b = 4 * alpha * cprime.z();
00166 double c = alpha*alpha - 4 * cprime.e()*cprime.e() * vnu.vect().perp2();
00167 double d = b*b - 2*a*c;
00168 if (d < 0) {
00169 discrim_flag = false;
00170 }
00171
00172 if (discrim_flag) {
00173
00174 re_nuz1 = (-b + sqrt(d))/a ;
00175 im_nuz1 = 0 ;
00176 re_nuz2 = (-b - sqrt(d))/a ;
00177 im_nuz2 = 0 ;
00178 if (abs(re_nuz1) > abs(re_nuz2)) {
00179 swap(re_nuz1,re_nuz2);
00180 }
00181
00182 } else {
00183
00184
00185
00186
00187 re_nuz1 = -b / a;
00188 im_nuz1 = -fabs(sqrt(-d)/a );
00189 re_nuz2 = -b / a;
00190 im_nuz2 = fabs(sqrt(-d)/a );
00191
00192
00193 }
00194
00195
00196 return discrim_flag;
00197 }
00198
00199
00200 bool Top_Decaykin::solve_nu (const Lepjets_Event& ev,
00201 double wmass,
00202 double& nuz1,
00203 double& nuz2)
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221 {
00222 bool discrim_flag = true;
00223
00224 Fourvec vnu = ev.met();
00225 Fourvec vlep = leptons (ev);
00226
00227 double x = vlep.x()*vnu.x() + vlep.y()*vnu.y() + wmass*wmass/2;
00228 double a = vlep.z()*vlep.z() - vlep.e()*vlep.e();
00229 double b = 2*x*vlep.z();
00230 double c = x*x - vnu.perp2() * vlep.e()*vlep.e();
00231
00232 double d = b*b - 4*a*c;
00233 if (d < 0) {
00234 d = 0;
00235 discrim_flag = false;
00236 }
00237
00238 nuz1 = (-b + sqrt (d))/2/a;
00239 nuz2 = (-b - sqrt (d))/2/a;
00240 if (abs (nuz1) > abs (nuz2))
00241 swap (nuz1, nuz2);
00242
00243 return discrim_flag;
00244 }
00245
00246
00247 bool Top_Decaykin::solve_nu (const Lepjets_Event& ev,
00248 double wmass,
00249 double& re_nuz1,
00250 double& im_nuz1,
00251 double& re_nuz2,
00252 double& im_nuz2)
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274 {
00275 bool discrim_flag = true;
00276
00277 Fourvec vnu = ev.met();
00278 Fourvec vlep = leptons (ev);
00279
00280 double x = vlep.x()*vnu.x() + vlep.y()*vnu.y() + wmass*wmass/2;
00281 double a = vlep.z()*vlep.z() - vlep.e()*vlep.e();
00282 double b = 2*x*vlep.z();
00283 double c = x*x - vnu.perp2() * vlep.e()*vlep.e();
00284
00285 double d = b*b - 4*a*c;
00286 if (d < 0) {
00287 discrim_flag = false;
00288 }
00289
00290 if (discrim_flag) {
00291
00292 re_nuz1 = (-b + sqrt(d))/2/a ;
00293 im_nuz1 = 0.0 ;
00294 re_nuz2 = (-b - sqrt(d))/2/a ;
00295 im_nuz2 = 0.0 ;
00296 if (fabs(re_nuz1) > fabs(re_nuz2)) {
00297 swap(re_nuz1,re_nuz2);
00298 }
00299
00300 } else {
00301
00302
00303
00304
00305
00306 re_nuz1 = -b /2/a ;
00307 im_nuz1 = -fabs(sqrt(-d)/a);
00308 re_nuz2 = -b /2/a ;
00309 im_nuz2 = fabs(sqrt(-d)/a);
00310
00311 }
00312
00313 return discrim_flag;
00314 }
00315
00316
00317 Fourvec Top_Decaykin::hadw (const Lepjets_Event& ev)
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327 {
00328 return (ev.sum (hadw1_label) + ev.sum (hadw2_label));
00329 }
00330
00331
00332 Fourvec Top_Decaykin::hadw1 (const Lepjets_Event& ev)
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342 {
00343 return ev.sum (hadw1_label);
00344 }
00345
00346
00347 Fourvec Top_Decaykin::hadw2 (const Lepjets_Event& ev)
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358 {
00359 return ev.sum (hadw2_label);
00360 }
00361
00362
00363 Fourvec Top_Decaykin::lepw (const Lepjets_Event& ev)
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373 {
00374 return (leptons (ev) + ev.met ());
00375 }
00376
00377
00378 Fourvec Top_Decaykin::hadt (const Lepjets_Event& ev)
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388 {
00389 return (ev.sum (hadb_label) + hadw (ev));
00390 }
00391
00392
00393 Fourvec Top_Decaykin::lept (const Lepjets_Event& ev)
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403 {
00404 return (ev.sum (lepb_label) + lepw (ev));
00405 }
00406
00407
00408 ostream& Top_Decaykin::dump_ev (std::ostream& s, const Lepjets_Event& ev)
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419 {
00420 s << ev;
00421 Fourvec p;
00422
00423 p = lepw (ev);
00424 s << "lepw " << p << " " << p.m() << "\n";
00425 p = lept (ev);
00426 s << "lept " << p << " " << p.m() << "\n";
00427 p = hadw (ev);
00428 s << "hadw " << p << " " << p.m() << "\n";
00429 p = hadt (ev);
00430 s << "hadt " << p << " " << p.m() << "\n";
00431
00432 return s;
00433 }
00434
00435
00436 double Top_Decaykin::cos_theta_star(const Fourvec fermion,
00437 const Fourvec W,
00438 const Fourvec top)
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449 {
00450
00451 if (W.isLightlike() || W.isSpacelike()) {
00452 return 100.0;
00453 }
00454
00455 CLHEP::HepBoost BoostWCM(W.findBoostToCM());
00456
00457 CLHEP::Hep3Vector boost_v3fermion = BoostWCM(fermion).vect();
00458 CLHEP::Hep3Vector boost_v3top = BoostWCM(top).vect();
00459
00460 double costhetastar = boost_v3fermion.cosTheta(-boost_v3top);
00461
00462 return costhetastar;
00463 }
00464
00465
00466 double Top_Decaykin::cos_theta_star(const Lepjets_Event& ev)
00467
00468
00469
00470
00471
00472
00473
00474
00475 {
00476
00477 return cos_theta_star(leptons(ev),
00478 lepw(ev),
00479 lept(ev));
00480
00481 }
00482
00483
00484 double Top_Decaykin::cos_theta_star_lept(const Lepjets_Event& ev)
00485
00486
00487
00488
00489
00490
00491
00492
00493 {
00494
00495 return cos_theta_star(ev);
00496
00497 }
00498
00499
00500 double Top_Decaykin::cos_theta_star_hadt(const Lepjets_Event& ev)
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510 {
00511
00512 return fabs(cos_theta_star(hadw1(ev),
00513 hadw(ev),
00514 hadt(ev)));
00515
00516 }
00517
00518
00519 }
00520
00521