12 const char *BtagAlgo =
"trackCountingJetTags";
18 std::cout <<
"---------- Start calculating the LR observables ----------" << std::endl;
20 std::vector<pat::Jet> TopJets;
23 for (
unsigned int i = 0;
i < SelectedTopJets.size();
i++) {
24 TopJets.push_back(SelectedTopJets[
i]);
30 TLorentzVector *Hadp =
new TLorentzVector();
31 Hadp->SetPxPyPzE(TopJets[3].
px(), TopJets[3].
py(), TopJets[3].pz(), TopJets[3].
energy());
33 TLorentzVector *Hadq =
new TLorentzVector();
34 Hadq->SetPxPyPzE(TopJets[2].
px(), TopJets[2].
py(), TopJets[2].pz(), TopJets[2].
energy());
36 TLorentzVector *Hadb =
new TLorentzVector();
37 Hadb->SetPxPyPzE(TopJets[1].
px(), TopJets[1].
py(), TopJets[1].pz(), TopJets[1].
energy());
39 TLorentzVector *Lepb =
new TLorentzVector();
40 Lepb->SetPxPyPzE(TopJets[0].
px(), TopJets[0].
py(), TopJets[0].pz(), TopJets[0].
energy());
42 TLorentzVector *Lept =
new TLorentzVector();
45 else if (TS.
getDecay() ==
"electron")
48 TLorentzVector *Lepn =
new TLorentzVector();
64 double Obs1 = Lept->Pt();
67 std::cout <<
"------ LR observable 1 " << Obs1 <<
" calculated ------" << std::endl;
74 std::cout <<
"------ LR observable 2 " << Obs2 <<
" calculated ------" << std::endl;
79 for (
unsigned int i = 0;
i < 4;
i++) {
80 HT += TopJets[
i].et();
86 std::cout <<
"------ LR observable 3 " << Obs3 <<
" calculated ------" << std::endl;
90 double EtSum = TopJets[2].et() + TopJets[3].et();
94 std::cout <<
"------ LR observable 4 " << Obs4 <<
" calculated ------" << std::endl;
98 double Obs5 = EtSum /
HT;
101 std::cout <<
"------ LR observable 5 " << Obs5 <<
" calculated ------" << std::endl;
105 double Obs6 = (
HT - EtSum) /
HT;
108 std::cout <<
"------ LR observable 6 " << Obs6 <<
" calculated ------" << std::endl;
112 TLorentzVector TtbarSystem = (*Hadp) + (*Hadq) + (*Hadb) + (*Lepb) + (*Lept) + (*Lepn);
113 double MT = TtbarSystem.Mt();
117 std::cout <<
"------ LR observable 7 " << Obs7 <<
" calculated ------" << std::endl;
130 double BGap = TopJets[1].bDiscriminator(BtagAlgo) - TopJets[2].bDiscriminator(BtagAlgo);
133 double BjetsBdiscSum = TopJets[0].bDiscriminator(BtagAlgo) + TopJets[1].bDiscriminator(BtagAlgo);
134 double LjetsBdiscSum = TopJets[2].bDiscriminator(BtagAlgo) + TopJets[3].bDiscriminator(BtagAlgo);
136 Obs8 = (TopJets[2].bDiscriminator(BtagAlgo) > -10 ?
log(BGap) : -5);
138 std::cout <<
"------ LR observable 8 " << Obs8 <<
" calculated ------" << std::endl;
139 Obs9 = (BjetsBdiscSum * BGap);
141 std::cout <<
"------ LR observable 9 " << Obs9 <<
" calculated ------" << std::endl;
142 Obs10 = (BjetsBdiscSum / LjetsBdiscSum);
144 std::cout <<
"------ LR observable 10 " << Obs10 <<
" calculated ------" << std::endl;
146 Obs11 = 0.707 * ((BjetsBdiscSum + LjetsBdiscSum) / 2 + 10);
148 std::cout <<
"------ LR observable 11 " << Obs11 <<
" calculated ------" << std::endl;
160 double N = 0,
D = 0, C_tmp = 0,
C = 10000;
161 double N_NoNu = 0, D_NoNu = 0, C_NoNu_tmp = 0, C_NoNu = 10000;
166 for (
unsigned int i = 0;
i < 4;
i++) {
167 D += fabs(TopJets[
i].
pt());
170 D += fabs(Lept->Pt());
172 D += fabs(Lepn->Pt());
176 for (
unsigned int i = 0;
i < 720;
i++) {
177 nx =
cos((2 *
PI / 720) *
i);
178 ny =
sin((2 *
PI / 720) *
i);
182 for (
unsigned int i = 0;
i < 4;
i++) {
183 N += fabs(TopJets[
i].
px() * nx + TopJets[
i].
py() * ny + TopJets[
i].pz() * nz);
186 N += fabs(Lept->Px() * nx + Lept->Py() * ny + Lept->Pz() * nz);
188 N += fabs(Lepn->Px() * nx + Lepn->Py() * ny + Lepn->Pz() * nz);
193 C_NoNu_tmp = 2 * N_NoNu / D_NoNu;
199 if (C_NoNu_tmp < C_NoNu)
204 double Obs12 = (
C != 10000 ?
C : 0);
207 std::cout <<
"------ LR observable 12 " << Obs12 <<
" calculated ------" << std::endl;
211 double Obs13 = (C_NoNu != 10000 ? C_NoNu : 0);
214 std::cout <<
"------ LR observable 13 " << Obs13 <<
" calculated ------" << std::endl;
219 for (
unsigned int i = 0;
i < 4;
i++) {
220 H += TopJets[
i].energy();
223 double Obs14 =
HT /
H;
226 std::cout <<
"------ LR observable 14 " << Obs14 <<
" calculated ------" << std::endl;
239 double P2 = PX2 + PY2 + PZ2;
241 double PXY = Hadp->Px() * Hadp->Py() + Hadq->Px() * Hadq->Py() + Hadb->Px() * Hadb->Py() + Lepb->Px() * Lepb->Py() +
242 Lept->Px() * Lept->Py() + Lepn->Px() * Lepn->Py();
243 double PXZ = Hadp->Px() * Hadp->Pz() + Hadq->Px() * Hadq->Pz() + Hadb->Px() * Hadb->Pz() + Lepb->Px() * Lepb->Pz() +
244 Lept->Px() * Lept->Pz() + Lepn->Px() * Lepn->Pz();
245 double PYZ = Hadp->Py() * Hadp->Pz() + Hadq->Py() * Hadq->Pz() + Hadb->Py() * Hadb->Pz() + Lepb->Py() * Lepb->Pz() +
246 Lept->Py() * Lept->Pz() + Lepn->Py() * Lepn->Pz();
258 TMatrixDSymEigen pTensor(
Matrix);
260 std::vector<double> EigValues;
262 for (
int i = 0;
i < 3;
i++) {
263 EigValues.push_back(pTensor.GetEigenValues()[
i]);
268 double Sphericity = 1.5 * (EigValues[1] + EigValues[2]);
269 double Aplanarity = 1.5 * EigValues[2];
274 std::cout <<
"------ LR observable 15 " << Obs15 <<
" calculated ------" << std::endl;
279 std::cout <<
"------ LR observable 16 " << Obs16 <<
" calculated ------" << std::endl;
283 TVector3 BoostBackToCM = -(TtbarSystem.BoostVector());
284 Hadp->Boost(BoostBackToCM);
285 Hadq->Boost(BoostBackToCM);
286 Hadb->Boost(BoostBackToCM);
287 Lepb->Boost(BoostBackToCM);
288 Lept->Boost(BoostBackToCM);
289 Lepn->Boost(BoostBackToCM);
298 double BOOST_P2 = BOOST_PX2 + BOOST_PY2 + BOOST_PZ2;
300 double BOOST_PXY = Hadp->Px() * Hadp->Py() + Hadq->Px() * Hadq->Py() + Hadb->Px() * Hadb->Py() +
301 Lepb->Px() * Lepb->Py() + Lept->Px() * Lept->Py() + Lepn->Px() * Lepn->Py();
302 double BOOST_PXZ = Hadp->Px() * Hadp->Pz() + Hadq->Px() * Hadq->Pz() + Hadb->Px() * Hadb->Pz() +
303 Lepb->Px() * Lepb->Pz() + Lept->Px() * Lept->Pz() + Lepn->Px() * Lepn->Pz();
304 double BOOST_PYZ = Hadp->Py() * Hadp->Pz() + Hadq->Py() * Hadq->Pz() + Hadb->Py() * Hadb->Pz() +
305 Lepb->Py() * Lepb->Pz() + Lept->Py() * Lept->Pz() + Lepn->Py() * Lepn->Pz();
307 TMatrixDSym BOOST_Matrix(3);
309 BOOST_Matrix(0, 0) = BOOST_PX2 / BOOST_P2;
310 BOOST_Matrix(0, 1) = BOOST_PXY / BOOST_P2;
311 BOOST_Matrix(0, 2) = BOOST_PXZ / BOOST_P2;
312 BOOST_Matrix(1, 0) = BOOST_PXY / BOOST_P2;
313 BOOST_Matrix(1, 1) = BOOST_PY2 / BOOST_P2;
314 BOOST_Matrix(1, 2) = BOOST_PYZ / BOOST_P2;
315 BOOST_Matrix(2, 0) = BOOST_PXZ / BOOST_P2;
316 BOOST_Matrix(2, 1) = BOOST_PYZ / BOOST_P2;
317 BOOST_Matrix(2, 2) = BOOST_PZ2 / BOOST_P2;
319 TMatrixDSymEigen BOOST_pTensor(BOOST_Matrix);
321 std::vector<double> BOOST_EigValues;
322 BOOST_EigValues.clear();
323 for (
int i = 0;
i < 3;
i++) {
324 BOOST_EigValues.push_back(BOOST_pTensor.GetEigenValues()[
i]);
329 double BOOST_Sphericity = 1.5 * (BOOST_EigValues[1] + BOOST_EigValues[2]);
330 double BOOST_Aplanarity = 1.5 * BOOST_EigValues[2];
335 std::cout <<
"------ LR observable 17 " << Obs17 <<
" calculated ------" << std::endl;
340 std::cout <<
"------ LR observable 18 " << Obs18 <<
" calculated ------" << std::endl;
344 double Obs19 = (TopJets.size() > 4) ? TopJets[4].
et() /
HT : 1.0;
347 std::cout <<
"------ LR observable 19 " << Obs19 <<
" calculated ------" << std::endl;
351 double HT_alljets = 0;
352 double H_alljets = 0;
353 for (
unsigned int i = 0;
i < TopJets.size();
i++) {
354 HT_alljets += TopJets[
i].et();
355 H_alljets += TopJets[
i].energy();
357 double Obs20 = HT_alljets;
360 std::cout <<
"------ LR observable 20 " << Obs20 <<
" calculated ------" << std::endl;
364 double HT3_alljets = 0;
365 for (
unsigned int i = 2;
i < TopJets.size();
i++) {
366 HT3_alljets += TopJets[
i].et();
368 double Obs21 = HT3_alljets;
371 std::cout <<
"------ LR observable 21 " << Obs21 <<
" calculated ------" << std::endl;
375 double ET0 = TopJets[0].et() / HT_alljets;
379 std::cout <<
"------ LR observable 22 " << Obs22 <<
" calculated ------" << std::endl;
383 double Obs23 = ((H_alljets > 0) ? HT_alljets / H_alljets : 0);
386 std::cout <<
"------ LR observable 23 " << Obs23 <<
" calculated ------" << std::endl;
390 double FW_momentum_0 = 0, FW_momentum_1 = 0, FW_momentum_2 = 0, FW_momentum_3 = 0, FW_momentum_4 = 0,
391 FW_momentum_5 = 0, FW_momentum_6 = 0;
393 for (
unsigned int i = 0;
i < TopJets.size();
i++) {
394 for (
unsigned int j = 0;
j < TopJets.size();
j++) {
395 double ET_ij_over_ETSum2 = TopJets[
i].et() * TopJets[
j].et() / (
std::pow(HT_alljets, 2));
397 (TopJets[
i].px() * TopJets[
j].px() + TopJets[
i].py() * TopJets[
j].py() + TopJets[
i].pz() * TopJets[
j].pz()) /
398 (TopJets[
i].
p4().R() * TopJets[
j].p4().R());
399 FW_momentum_0 += ET_ij_over_ETSum2;
400 FW_momentum_1 += ET_ij_over_ETSum2 * cosTheta_ij;
401 FW_momentum_2 += ET_ij_over_ETSum2 * 0.5 * (3 *
std::pow(cosTheta_ij, 2) - 1);
402 FW_momentum_3 += ET_ij_over_ETSum2 * 0.5 * (5 *
std::pow(cosTheta_ij, 3) - 3 * cosTheta_ij);
403 FW_momentum_4 += ET_ij_over_ETSum2 * 0.125 * (35 *
std::pow(cosTheta_ij, 4) - 30 *
std::pow(cosTheta_ij, 2) + 3);
404 FW_momentum_5 += ET_ij_over_ETSum2 * 0.125 *
405 (63 *
std::pow(cosTheta_ij, 5) - 70 *
std::pow(cosTheta_ij, 3) + 15 * cosTheta_ij);
407 ET_ij_over_ETSum2 * 0.0625 *
412 double Obs24 = FW_momentum_0;
415 std::cout <<
"------ LR observable 24 " << Obs24 <<
" calculated ------" << std::endl;
416 double Obs25 = FW_momentum_1;
419 std::cout <<
"------ LR observable 25 " << Obs25 <<
" calculated ------" << std::endl;
420 double Obs26 = FW_momentum_2;
423 std::cout <<
"------ LR observable 26 " << Obs26 <<
" calculated ------" << std::endl;
424 double Obs27 = FW_momentum_3;
427 std::cout <<
"------ LR observable 27 " << Obs27 <<
" calculated ------" << std::endl;
428 double Obs28 = FW_momentum_4;
431 std::cout <<
"------ LR observable 28 " << Obs28 <<
" calculated ------" << std::endl;
432 double Obs29 = FW_momentum_5;
435 std::cout <<
"------ LR observable 29 " << Obs29 <<
" calculated ------" << std::endl;
436 double Obs30 = FW_momentum_6;
439 std::cout <<
"------ LR observable 30 " << Obs30 <<
" calculated ------" << std::endl;
443 TVector3
n(0, 0, 0), n_tmp(0, 0, 0);
445 double Thrust_D = 0, Thrust_N = 0;
446 double Thrust = -1, Thrust_tmp = 0;
447 double Thrust_Major = -1, Thrust_Major_tmp = 0;
448 double Thrust_Minor = -1;
450 for (
unsigned int i = 0;
i < TopJets.size();
i++) {
451 Thrust_D += TopJets[
i].p();
454 Thrust_D += Lept->P();
458 for (
unsigned int i = 0;
i < 720;
i++) {
459 for (
unsigned int j = 0;
j < 360;
j++) {
460 n_tmp.SetX(
cos((2 *
PI / 720) *
i) *
sin((
PI / 360) *
j));
461 n_tmp.SetY(
sin((2 *
PI / 720) *
i) *
sin((
PI / 360) *
j));
462 n_tmp.SetZ(
cos((
PI / 360) *
j));
464 for (
unsigned int k = 0;
k < TopJets.size();
k++) {
466 fabs(TopJets[
k].
px() * (n_tmp.x()) + TopJets[
k].
py() * (n_tmp.y()) + TopJets[
k].pz() * (n_tmp.z()));
468 Thrust_N += fabs(Lept->Px() * (n_tmp.x()) + Lept->Py() * (n_tmp.y()) + Lept->Pz() * (n_tmp.z()));
470 Thrust_tmp = Thrust_N / Thrust_D;
473 if (Thrust_tmp >
Thrust) {
475 n.SetXYZ(n_tmp.x(), n_tmp.y(), n_tmp.z());
481 TVector3 nT =
n.Orthogonal();
483 for (
unsigned int i = 0;
i < 720;
i++) {
484 nT.Rotate((2 *
PI / 720) *
i,
n);
485 for (
unsigned int j = 0;
j < TopJets.size();
j++) {
486 Thrust_N += fabs(TopJets[
j].
px() * (nT.x()) + TopJets[
j].
py() * (nT.y()) + TopJets[
j].pz() * (nT.z()));
488 Thrust_N += fabs(Lept->Px() * nT.x() + Lept->Py() * (nT.y()) + Lept->Pz() * (nT.z()));
490 Thrust_Major_tmp = Thrust_N / Thrust_D;
493 if (Thrust_Major_tmp > Thrust_Major) {
494 Thrust_Major = Thrust_Major_tmp;
500 TVector3 nMinor = nT.Cross(
n);
501 nMinor = nMinor.Unit();
503 for (
unsigned int i = 0;
i < TopJets.size();
i++) {
505 fabs(TopJets[
i].
px() * (nMinor.x()) + TopJets[
i].
py() * (nMinor.y()) + TopJets[
i].pz() * (nMinor.z()));
507 Thrust_N += fabs(Lept->Px() * nMinor.x() + Lept->Py() * (nMinor.y()) + Lept->Pz() * (nMinor.z()));
509 Thrust_Minor = Thrust_N / Thrust_D;
515 std::cout <<
"------ LR observable 31 " << Obs31 <<
" calculated ------" << std::endl;
516 double Obs32 = Thrust_Major;
519 std::cout <<
"------ LR observable 32 " << Obs32 <<
" calculated ------" << std::endl;
520 double Obs33 = Thrust_Minor;
523 std::cout <<
"------ LR observable 33 " << Obs33 <<
" calculated ------" << std::endl;
527 double Obs34 = Thrust_Major - Thrust_Minor;
530 std::cout <<
"------ LR observable 34 " << Obs34 <<
" calculated ------" << std::endl;
534 TMatrixDSym Matrix_NoNu(3);
543 double P2_NoNu = PX2_NoNu + PY2_NoNu + PZ2_NoNu;
545 double PXY_NoNu = Hadp->Px() * Hadp->Py() + Hadq->Px() * Hadq->Py() + Hadb->Px() * Hadb->Py() +
546 Lepb->Px() * Lepb->Py() + Lept->Px() * Lept->Py();
547 double PXZ_NoNu = Hadp->Px() * Hadp->Pz() + Hadq->Px() * Hadq->Pz() + Hadb->Px() * Hadb->Pz() +
548 Lepb->Px() * Lepb->Pz() + Lept->Px() * Lept->Pz();
549 double PYZ_NoNu = Hadp->Py() * Hadp->Pz() + Hadq->Py() * Hadq->Pz() + Hadb->Py() * Hadb->Pz() +
550 Lepb->Py() * Lepb->Pz() + Lept->Py() * Lept->Pz();
552 Matrix_NoNu(0, 0) = PX2_NoNu / P2_NoNu;
553 Matrix_NoNu(0, 1) = PXY_NoNu / P2_NoNu;
554 Matrix_NoNu(0, 2) = PXZ_NoNu / P2_NoNu;
555 Matrix_NoNu(1, 0) = PXY_NoNu / P2_NoNu;
556 Matrix_NoNu(1, 1) = PY2_NoNu / P2_NoNu;
557 Matrix_NoNu(1, 2) = PYZ_NoNu / P2_NoNu;
558 Matrix_NoNu(2, 0) = PXZ_NoNu / P2_NoNu;
559 Matrix_NoNu(2, 1) = PYZ_NoNu / P2_NoNu;
560 Matrix_NoNu(2, 2) = PZ2_NoNu / P2_NoNu;
562 TMatrixDSymEigen pTensor_NoNu(Matrix_NoNu);
564 std::vector<double> EigValues_NoNu;
565 EigValues_NoNu.clear();
566 for (
int i = 0;
i < 3;
i++) {
567 EigValues_NoNu.push_back(pTensor_NoNu.GetEigenValues()[
i]);
572 double Sphericity_NoNu = 1.5 * (EigValues_NoNu[1] + EigValues_NoNu[2]);
573 double Aplanarity_NoNu = 1.5 * EigValues_NoNu[2];
578 std::cout <<
"------ LR observable 35 " << Obs35 <<
" calculated ------" << std::endl;
583 std::cout <<
"------ LR observable 36 " << Obs36 <<
" calculated ------" << std::endl;
587 TMatrixDSym Matrix_NoNuNoLep(3);
589 double PX2_NoNuNoLep =
591 double PY2_NoNuNoLep =
593 double PZ2_NoNuNoLep =
596 double P2_NoNuNoLep = PX2_NoNuNoLep + PY2_NoNuNoLep + PZ2_NoNuNoLep;
598 double PXY_NoNuNoLep =
599 Hadp->Px() * Hadp->Py() + Hadq->Px() * Hadq->Py() + Hadb->Px() * Hadb->Py() + Lepb->Px() * Lepb->Py();
600 double PXZ_NoNuNoLep =
601 Hadp->Px() * Hadp->Pz() + Hadq->Px() * Hadq->Pz() + Hadb->Px() * Hadb->Pz() + Lepb->Px() * Lepb->Pz();
602 double PYZ_NoNuNoLep =
603 Hadp->Py() * Hadp->Pz() + Hadq->Py() * Hadq->Pz() + Hadb->Py() * Hadb->Pz() + Lepb->Py() * Lepb->Pz();
605 Matrix_NoNuNoLep(0, 0) = PX2_NoNuNoLep / P2_NoNuNoLep;
606 Matrix_NoNuNoLep(0, 1) = PXY_NoNuNoLep / P2_NoNuNoLep;
607 Matrix_NoNuNoLep(0, 2) = PXZ_NoNuNoLep / P2_NoNuNoLep;
608 Matrix_NoNuNoLep(1, 0) = PXY_NoNuNoLep / P2_NoNuNoLep;
609 Matrix_NoNuNoLep(1, 1) = PY2_NoNuNoLep / P2_NoNuNoLep;
610 Matrix_NoNuNoLep(1, 2) = PYZ_NoNuNoLep / P2_NoNuNoLep;
611 Matrix_NoNuNoLep(2, 0) = PXZ_NoNuNoLep / P2_NoNuNoLep;
612 Matrix_NoNuNoLep(2, 1) = PYZ_NoNuNoLep / P2_NoNuNoLep;
613 Matrix_NoNuNoLep(2, 2) = PZ2_NoNuNoLep / P2_NoNuNoLep;
615 TMatrixDSymEigen pTensor_NoNuNoLep(Matrix_NoNuNoLep);
617 std::vector<double> EigValues_NoNuNoLep;
618 EigValues_NoNuNoLep.clear();
619 for (
int i = 0;
i < 3;
i++) {
620 EigValues_NoNuNoLep.push_back(pTensor_NoNuNoLep.GetEigenValues()[
i]);
625 double Sphericity_NoNuNoLep = 1.5 * (EigValues_NoNuNoLep[1] + EigValues_NoNuNoLep[2]);
626 double Aplanarity_NoNuNoLep = 1.5 * EigValues_NoNuNoLep[2];
628 double Obs37 = (
edm::isNotFinite(Sphericity_NoNuNoLep) ? 0 : Sphericity_NoNuNoLep);
631 std::cout <<
"------ LR observable 37 " << Obs37 <<
" calculated ------" << std::endl;
633 double Obs38 = (
edm::isNotFinite(Aplanarity_NoNuNoLep) ? 0 : Aplanarity_NoNuNoLep);
636 std::cout <<
"------ LR observable 38 " << Obs38 <<
" calculated ------" << std::endl;
641 std::cout <<
"------ Observable values stored in the event ------" << std::endl;
645 std::cout <<
"------ Pointer to Hadp deleted ------" << std::endl;
648 std::cout <<
"------ Pointer to Hadq deleted ------" << std::endl;
651 std::cout <<
"------ Pointer to Hadb deleted ------" << std::endl;
654 std::cout <<
"------ Pointer to Lepb deleted ------" << std::endl;
657 std::cout <<
"------ Pointer to Lepn deleted ------" << std::endl;
660 std::cout <<
"------ Pointer to Mez deleted ------" << std::endl;
664 std::cout <<
"------------ LR observables calculated -----------" << std::endl;