7 #include "CLHEP/Units/defs.h"
8 #include "CLHEP/Units/PhysicalConstants.h"
20 genparticleCollection_(iPSet.getParameter<
edm::
InputTag>(
"genparticleCollection")),
35 i.setCurrentFolder(
"Generator/Tau");
37 nTaus =
dqm.book1dHisto(
"nTaus",
"n analyzed Taus", 1, 0., 1.,
"bin",
"Number of #tau's found");
39 dqm.book1dHisto(
"nPrimeTaus",
"n analyzed prime Taus", 1, 0., 1.,
"bin",
"Number of #tau's from Gauge Bosons");
42 TauPt =
dqm.book1dHisto(
"TauPt",
"Tau pT", 100, 0, 100,
"P_{T}^{#tau}",
"Number of #tau's from Gauge Bosons");
43 TauEta =
dqm.book1dHisto(
"TauEta",
"Tau eta", 100, -2.5, 2.5,
"#eta^{#tau}",
"Number of #tau's from Gauge Bosons");
44 TauPhi =
dqm.book1dHisto(
"TauPhi",
"Tau phi", 100, -3.14, 3.14,
"#phi^{#tau}",
"Number of #tau's from Gauge Bosons");
45 TauProngs =
dqm.book1dHisto(
"TauProngs",
"Tau n prongs", 7, 0, 7,
"N_{prongs}",
"Number of #tau's from Gauge Bosons");
47 "TauDecayChannels",
"Tau decay channels", 13, 0, 13,
"Tau POG Decay Mode",
"Number of #tau's from Gauge Bosons");
62 TauMothers =
dqm.book1dHisto(
"TauMothers",
"Tau mother particles", 10, 0, 10,
"Mother of #tau",
"Number of #tau's");
76 "DecayLength",
"#tau Decay Length", 100, -20, 20,
"L_{#tau} (cm)",
"Number of #tau's from Gauge Bosons");
78 "LifeTime",
"#tau LifeTime ", 500, 0, 10000E-15,
"#tau_{#tau} (s)",
"Number of #tau's from Gauge Bosons");
81 "TauSpinEffectsWX",
"X for pion", 50, 0, 1,
"X",
"Number of #tau#rightarrow#pi#nu from W^{#pm} Bosons");
83 "TauSpinEffectsHpmX",
"X for pion", 50, 0, 1,
"X",
"Number of #tau#rightarrow#pi#nu from H^{#pm} Bosons");
86 "TauSpinEffectsWeX",
"X for e", 50, 0, 1,
"X",
"Number of #tau#rightarrowe#nu#nu from W^{#pm} Bosons");
88 "TauSpinEffectsHpmeX",
"X for e", 50, 0, 1,
"X",
"Number of #tau#rightarrowe#nu#nu from H^{#pm} Bosons");
91 "TauSpinEffectsWmuX",
"X for mu", 50, 0, 1,
"X",
"Number of #tau#rightarrow#mu#nu#nu from W^{#pm} Bosons");
93 "TauSpinEffectsHpmmuX",
"X for mue", 50, 0, 1,
"X",
"Number of #tau#rightarrow#mu#nu#nu from H^{#pm} Bosons");
101 "Number of #tau#rightarrow#rho#nu from Gauge Bosons");
108 "Number of #tau#rightarrow#rho#nu from Gauge Bosons");
116 "Number of #tau#rightarrow#pi#pi#pi#nu from Gauge Bosons");
123 "Number of #tau#rightarrow#pi#pi#pi#nu from Gauge Bosons");
126 dqm.book1dHisto(
"TauSpinEffectsH_pipiAcoplanarity",
127 "H Acoplanarity for #pi^{-}#pi^{+}",
132 "Number of H#rightarrow#tau^{-}(#rightarrow#pi^{-}#nu)#tau^{+}(#rightarrow#pi^{+}#nu) Events");
135 dqm.book1dHisto(
"TauSpinEffectsH_pipiAcollinearity",
136 "H Acollinearity for #pi^{-}#pi^{+}",
141 "Number of H#rightarrow#tau^{-}(#rightarrow#pi^{-}#nu)#tau^{+}(#rightarrow#pi^{+}#nu) Events");
143 dqm.book1dHisto(
"TauSpinEffectsH_pipiAcollinearityzoom",
144 "H Acollinearity for #pi^{-}#pi^{+}",
149 "Number of H#rightarrow#tau^{-}(#rightarrow#pi^{-}#nu)#tau^{+}(#rightarrow#pi^{+}#nu) Events");
152 dqm.book1dHisto(
"TauSpinEffectsZMVis",
157 "M_{#pi^{+}#pi^{-}} (GeV)",
158 "Number of Z#rightarrow#tau^{-}(#rightarrow#pi^{-}#nu)#tau^{+}(#rightarrow#pi^{+}#nu) Events");
160 dqm.book1dHisto(
"TauSpinEffectsHMVis",
165 "M_{#pi^{+}#pi^{-}} (GeV)",
166 "Number of H#rightarrow#tau^{-}(#rightarrow#pi^{-}#nu)#tau^{+}(#rightarrow#pi^{+}#nu) Events");
169 dqm.book1dHisto(
"TauSpinEffectsZZs",
175 "Number of Z#rightarrow#tau^{-}(#rightarrow#pi^{-}#nu)#tau^{+}(#rightarrow#pi^{+}#nu Events");
177 dqm.book1dHisto(
"TauSpinEffectsHZs",
183 "Number of H#rightarrow#tau^{-}(#rightarrow#pi^{-}#nu)#tau^{+}(#rightarrow#pi^{+}#nu Events");
186 "TauSpinEffectsZX",
"X for pion of #tau^{-}", 25, 0, 1.0,
"X",
"Number of #tau#rightarrow#pi#nu from Z Bosons");
188 "X for pion of #tau^{-} (50GeV-75GeV)",
193 "Number of #tau#rightarrow#pi#nu from Z(50GeV<M<75GeV) Bosons");
195 "X for pion of #tau^{-} (75GeV-88GeV)",
200 "Number of #tau#rightarrow#pi#nu from Z(75GeV<M<88GeV) Bosons");
202 "X for pion of #tau^{-} (88GeV-100GeV)",
207 "Number of #tau#rightarrow#pi#nu from Z(88GeV<M<100GeV) Bosons");
209 "X for pion of #tau^{-} (100GeV-120GeV)",
214 "Number of #tau#rightarrow#pi#nu from Z(100GeV<M<120GeV) Bosons");
216 "X for pion of #tau^{-} (>120GeV)",
221 "Number of #tau#rightarrow#pi#nu from Z(120GeV<MGeV) Bosons");
224 "TauSpinEffectsH_X",
"X for pion of #tau^{-}", 25, 0, 1.0,
"X",
"Number of #tau#rightarrow#pi#nu from H Bosons");
227 "X for pion of forward emitted #tau^{-}",
232 "Number of #tau#rightarrow#pi#nu from Z Bosons");
234 "X for pion of forward emitted #tau^{-}",
239 "Number of #tau#rightarrow#pi#nu from H Bosons");
242 "X for pion of backward emitted #tau^{-}",
247 "Number of #tau#rightarrow#pi#nu from Z Bosons");
249 "X for pion of backward emitted #tau^{-}",
254 "Number of #tau#rightarrow#pi#nu from H Bosons");
257 "TauSpinEffectsZeX",
"X for e", 50, 0, 1,
"X",
"Number of #tau#rightarrowe#nu#nu from Gauge Bosons");
259 "TauSpinEffectsHeX",
"X for e", 50, 0, 1,
"X",
"Number of #tau#rightarrowe#nu#nu from Gauge Bosons");
262 "TauSpinEffectsZmuX",
"X for mu", 50, 0, 1,
"X",
"Number of #tau#rightarrow#mu#nu#nu from Gauge Bosons");
264 "TauSpinEffectsHmuX",
"X for mu", 50, 0, 1,
"X",
"Number of #tau#rightarrow#mu#nu#nu from Gauge Bosons");
267 dqm.book1dHisto(
"TauSpinEffectsH_rhorhoAcoplanarityminus",
268 "#phi^{*-} (acoplanarity) for Higgs #rightarrow #rho-#rho (y_{1}*y_{2}<0)",
272 "#phi^{*-} (Acoplanarity)",
273 "Number of H#rightarrow#tau^{-}(#rightarrow#rho^{-}#nu)#tau^{+}(#rightarrow#rho^{+}#nu) Events");
275 dqm.book1dHisto(
"TauSpinEffectsH_rhorhoAcoplanarityplus",
276 "#phi^{*+} (acoplanarity) for Higgs #rightarrow #rho-#rho (y_{1}*y_{2}>0)",
280 "#phi^{*+} (Acoplanarity)",
281 "Number of H#rightarrow#tau^{-}(#rightarrow#rho^{-}#nu)#tau^{+}(#rightarrow#rho^{+}#nu) Events");
284 "FSR Photons radiating from/with tau (Gauge Boson)",
288 "N^{FSR Photons radiating from/with #tau}",
289 "Number of #tau's from Gauge Bosons");
291 "Pt of FSR Photons radiating from/with tau (Gauge Boson)",
295 "P_{t}^{FSR Photons radiating from/with #tau [per #tau]} (GeV)",
296 "Number of #tau's from Gauge Bosons");
298 "Pt of FSR Photons radiating from/with tau (Gauge Boson)",
302 "P_{t}^{FSR Photons radiating from/with #tau [per #tau]} (GeV)",
303 "Number of #tau's from Gauge Bosons");
306 "Brem. Photons radiating in tau decay",
310 "N FSR Photons radiating from/with tau",
311 "Number of #tau's from Gauge Bosons");
317 "P_{t}^{Brem. Photons radiating in tau decay} (GeV)",
318 "Number of #tau's from Gauge Bosons");
324 "Sum P_{t}^{Brem. Photons radiating in tau decay} (GeV)",
325 "Number of #tau's from Gauge Bosons");
328 for (
unsigned int j = 0;
j <
NMODEID + 1;
j++) {
329 MODEInvMass.push_back(std::vector<MonitorElement *>());
331 tmp += std::to_string(
j);
338 "Number of #tau's from Gauge Bosons"));
348 "Number of #tau's from Gauge Bosons"));
355 "Number of #tau's from Gauge Bosons"));
362 "Number of #tau's from Gauge Bosons"));
376 for (reco::GenParticleCollection::const_iterator iter =
genParticles->begin(); iter !=
genParticles->end(); ++iter) {
380 if (
abs(iter->pdgId()) == 15) {
393 unsigned int jak_id, TauBitMask;
394 if (TD.
AnalyzeTau(&(*iter), jak_id, TauBitMask,
false,
false)) {
399 int tcharge = iter->pdgId() /
abs(iter->pdgId());
402 TLorentzVector LVQ(0, 0, 0, 0);
403 TLorentzVector LVS12(0, 0, 0, 0);
404 TLorentzVector LVS13(0, 0, 0, 0);
405 TLorentzVector LVS23(0, 0, 0, 0);
406 bool haspart1 =
false;
409 for (
unsigned int i = 0;
i <
part.size();
i++) {
413 TLorentzVector tlv(iter->px(), iter->py(), iter->pz(), iter->energy());
414 PV = TVector3(iter->vx(), iter->vy(), iter->vz());
416 TVector3 DL =
SV -
PV;
418 double c(2.99792458E8), Ltau(DL.Mag() / 100) ,
beta(iter->p() / iter->mass());
428 if ((tcharge ==
part.at(
i)->pdgId() /
abs(
part.at(
i)->pdgId()) && TD.
nProng(TauBitMask) == 3) ||
466 for (
unsigned int i = 0;
i <
tau->numberOfMothers();
i++) {
468 if (mother->
pdgId() ==
tau->pdgId())
476 std::vector<const reco::GenParticle *> mothers;
481 mothers.push_back(mother);
489 for (
unsigned int i = 0;
i <
tau->numberOfDaughters();
i++) {
490 if (
tau->daughter(
i)->pdgId() ==
tau->pdgId())
497 TauList.insert(TauList.begin(),
tau);
498 for (
unsigned int i = 0;
i <
tau->numberOfMothers();
i++) {
500 if (mother->
pdgId() ==
tau->pdgId()) {
508 std::vector<const reco::GenParticle *> &ListofFSR,
509 std::vector<const reco::GenParticle *> &ListofBrem) {
511 if (
abs(
p->pdgId()) == 15) {
519 for (
unsigned int i = 0;
i <
p->numberOfDaughters();
i++) {
521 if (
abs((dau)->
pdgId()) ==
abs(photo_ID) && !doBrem) {
522 ListofFSR.push_back(dau);
524 if (
abs((dau)->
pdgId()) ==
abs(photo_ID) && doBrem) {
525 ListofBrem.push_back(dau);
534 std::vector<const reco::GenParticle *> &ListofFSR,
535 double &BosonScale) {
538 int mother_pid =
m->pdgId();
539 if (
m->pdgId() !=
p->pdgId()) {
540 for (
unsigned int i = 0;
i <
m->numberOfDaughters();
i++) {
543 ListofFSR.push_back(dau);
547 if (
abs(mother_pid) == 24)
549 if (
abs(mother_pid) == 23)
551 if (
abs(mother_pid) == 22)
553 if (
abs(mother_pid) == 25)
555 if (
abs(mother_pid) == 35)
557 if (
abs(mother_pid) == 36)
559 if (
abs(mother_pid) == 37)
564 if (
abs(
tau->pdgId()) != 15)
567 if (mother_pid == -2)
570 if (
abs(mother_pid) == 24)
572 if (
abs(mother_pid) == 23)
574 if (
abs(mother_pid) == 22)
576 if (
abs(mother_pid) == 25)
578 if (
abs(mother_pid) == 35)
580 if (
abs(mother_pid) == 36)
582 if (
abs(mother_pid) == 37)
584 int mother_shortpid = (
abs(mother_pid) % 10000);
585 if (mother_shortpid > 500 && mother_shortpid < 600)
587 if (mother_shortpid > 400 && mother_shortpid < 500)
597 if (
tau->status() == 1)
599 int allCount = 0, eCount = 0, muCount = 0, pi0Count = 0, piCount = 0, rhoCount = 0, a1Count = 0, KCount = 0,
602 countParticles(
tau, allCount, eCount, muCount, pi0Count, piCount, rhoCount, a1Count, KCount, KstarCount);
617 if (piCount == 1 && pi0Count == 0)
619 if (piCount == 1 && pi0Count == 1)
621 if (piCount == 1 && pi0Count > 1)
623 if (piCount == 3 && pi0Count == 0)
625 if (piCount == 3 && pi0Count > 0)
646 for (
unsigned int i = 0;
i <
p->numberOfDaughters();
i++) {
648 int pid = dau->
pdgId();
652 else if (
abs(pid) == 13)
654 else if (
abs(pid) == 111)
656 else if (
abs(pid) == 211)
658 else if (
abs(pid) == 213)
660 else if (
abs(pid) == 20213)
662 else if (
abs(pid) == 321)
664 else if (
abs(pid) == 323)
666 countParticles(dau, allCount, eCount, muCount, pi0Count, piCount, rhoCount, a1Count, KCount, KstarCount);
676 pionP4.Boost(-1 * momP4.BoostVector());
677 double energy = pionP4.E() / (momP4.M() / 2);
679 if (
abs(mother) == 24)
681 else if (
abs(mother) == 37)
684 if (
abs(mother) == 24)
686 else if (
abs(mother) == 37)
689 if (
abs(mother) == 24)
691 else if (
abs(mother) == 37)
695 TLorentzVector
rho(0, 0, 0, 0),
pi(0, 0, 0, 0);
696 for (
unsigned int i = 0;
i <
part.size();
i++) {
705 if (
abs(mother) == 24)
707 else if (
abs(mother) == 37)
710 TLorentzVector
a1(0, 0, 0, 0), pi_p(0, 0, 0, 0), pi_m(0, 0, 0, 0);
711 int nplus(0), nminus(0);
712 for (
unsigned int i = 0;
i <
part.size();
i++) {
725 if (nplus + nminus == 3 && nplus == 1)
726 gamma = 2 * pi_p.P() /
a1.P() - 1;
727 else if (nplus + nminus == 3 && nminus == 1)
728 gamma = 2 * pi_m.P() /
a1.P() - 1;
731 gamma = 2 * pi_p.P() /
a1.P() - 1;
733 if (
abs(mother) == 24)
735 else if (
abs(mother) == 37)
744 if (ntau == 1 && dau->
pdgId() == 15)
752 TLorentzVector tautau(0, 0, 0, 0);
753 TLorentzVector pipi(0, 0, 0, 0);
754 TLorentzVector taum(0, 0, 0, 0);
755 TLorentzVector taup(0, 0, 0, 0);
756 TLorentzVector rho_plus, rho_minus, pi_rhominus, pi0_rhominus, pi_rhoplus, pi0_rhoplus, pi_plus, pi_minus;
757 bool hasrho_minus(
false), hasrho_plus(
false), haspi_minus(
false), haspi_plus(
false);
758 int nSinglePionDecays(0), nSingleMuonDecays(0), nSingleElectronDecays(0);
760 TLorentzVector Zboson(boson->
px(), boson->
py(), boson->
pz(), boson->
energy());
763 int pid = dau->
pdgId();
766 unsigned int jak_id, TauBitMask;
767 if (TD.
AnalyzeTau(dau, jak_id, TauBitMask,
false,
false)) {
775 nSingleElectronDecays++;
776 TLorentzVector LVtau(dau->
px(), dau->
py(), dau->
pz(), dau->
energy());
782 LVtau.Boost(-1 * Zboson.BoostVector());
783 LVpi.Boost(-1 * Zboson.BoostVector());
801 if (50.0 < Zboson.M() && Zboson.M() < 75.0)
803 if (75.0 < Zboson.M() && Zboson.M() < 88.0)
805 if (88.0 < Zboson.M() && Zboson.M() < 100.0)
807 if (100.0 < Zboson.M() && Zboson.M() < 120.0)
809 if (120.0 < Zboson.M())
816 x1 = LVpi.P() / LVtau.E();
819 x2 = LVpi.P() / LVtau.E();
822 TLorentzVector LVtau(dau->
px(), dau->
py(), dau->
pz(), dau->
energy());
828 for (
unsigned int i = 0;
i <
part.size();
i++) {
829 int pid_d =
part.at(
i)->pdgId();
830 if (
abs(pid_d) == 211 ||
abs(pid_d) == 111) {
837 if (
abs(pid_d) == 111) {
846 if (
abs(pid_d) == 111) {
854 for (
unsigned int i = 0;
i <
part.size();
i++) {
855 int pid_d =
part.at(
i)->pdgId();
856 if (
abs(pid_d) == 211) {
876 if (hasrho_minus && hasrho_plus) {
878 rho_minus = pi_rhominus;
879 rho_minus += pi0_rhominus;
880 rho_plus = pi_rhoplus;
881 rho_plus += pi0_rhoplus;
882 TLorentzVector rhorho = rho_minus;
886 TLorentzVector pi_rhoplusb = pi_rhoplus;
887 pi_rhoplusb.Boost(-1 * rhorho.BoostVector());
888 TLorentzVector pi0_rhoplusb = pi0_rhoplus;
889 pi0_rhoplusb.Boost(-1 * rhorho.BoostVector());
890 TLorentzVector pi_rhominusb = pi_rhominus;
891 pi_rhominusb.Boost(-1 * rhorho.BoostVector());
892 TLorentzVector pi0_rhominusb = pi0_rhominus;
893 pi0_rhominusb.Boost(-1 * rhorho.BoostVector());
896 TVector3 n_plus = pi_rhoplusb.Vect().Cross(pi0_rhoplusb.Vect());
897 TVector3 n_minus = pi_rhominusb.Vect().Cross(pi0_rhominusb.Vect());
900 double Acoplanarity = acos(n_plus.Dot(n_minus) / (n_plus.Mag() * n_minus.Mag()));
901 if (pi_rhominusb.Vect().Dot(n_plus) > 0) {
907 pi_rhoplus.Boost(-1 * taup.BoostVector());
908 pi0_rhoplus.Boost(-1 * taup.BoostVector());
909 pi_rhominus.Boost(-1 * taum.BoostVector());
910 pi0_rhominus.Boost(-1 * taum.BoostVector());
913 double y1 = (pi_rhoplus.E() - pi0_rhoplus.E()) / (pi_rhoplus.E() + pi0_rhoplus.E());
914 double y2 = (pi_rhominus.E() - pi0_rhominus.E()) / (pi_rhominus.E() + pi0_rhominus.E());
922 if (haspi_minus && haspi_plus) {
923 TLorentzVector tauporig = taup;
924 TLorentzVector taumorig = taum;
927 pi_plus.Boost(-1 * Zboson.BoostVector());
928 pi_minus.Boost(-1 * Zboson.BoostVector());
930 taup.Boost(-1 * Zboson.BoostVector());
931 taum.Boost(-1 * Zboson.BoostVector());
935 acos(pi_plus.Vect().Dot(pi_minus.Vect()) / (pi_plus.P() * pi_minus.P())));
937 acos(pi_plus.Vect().Dot(pi_minus.Vect()) / (pi_plus.P() * pi_minus.P())));
940 double proj_m = taum.Vect().Dot(pi_minus.Vect()) / (taum.P() * taum.P());
941 double proj_p = taup.Vect().Dot(pi_plus.Vect()) / (taup.P() * taup.P());
942 TVector3 Tau_m = taum.Vect();
943 TVector3 Tau_p = taup.Vect();
946 TVector3 Pit_m = pi_minus.Vect() - Tau_m;
947 TVector3 Pit_p = pi_plus.Vect() - Tau_p;
949 double Acoplanarity = acos(Pit_m.Dot(Pit_p) / (Pit_p.Mag() * Pit_m.Mag()));
950 TVector3
n = Pit_p.Cross(Pit_m);
951 if (
n.Dot(Tau_m) / Tau_m.Mag() > 0) {
961 if (nSinglePionDecays == 2 && tautau.M() != 0) {
965 double aup =
Zstoa(zsup), alow =
Zstoa(zslow);
966 if (
x2 -
x1 > alow &&
x2 -
x1 < aup) {
967 double zs = (zsup + zslow) / 2;
981 const std::vector<const reco::GenParticle *>
m =
GetMothers(boson);
983 TLorentzVector
Z(0, 0, 0, 0);
984 for (
unsigned int i = 0;
i <
m.size();
i++) {
992 if (
q == 1 && qbar == 1) {
993 if (taum.Vect().Dot(Zboson.Vect()) / (Zboson.P() * taum.P()) > 0) {
1011 double a = 1 -
sqrt(fabs(1.0 - 2 * fabs(zs)));
1023 TLorentzVector
p4(0, 0, 0, 0);
1024 for (
unsigned int i = 0;
i <
tau->numberOfDaughters();
i++) {
1026 int pid = dau->
pdgId();
1029 if (!(
abs(pid) == 211 ||
abs(pid) == 13 ||
abs(pid) == 11))
1031 if (dau->
p() >
p4.P())
1032 p4 = TLorentzVector(dau->
px(), dau->
py(), dau->
pz(), dau->
energy());
1039 return TLorentzVector(
m->px(),
m->py(),
m->pz(),
m->energy());
1043 TLorentzVector
p4(
tau->px(),
tau->py(),
tau->pz(),
tau->energy());
1044 for (
unsigned int i = 0;
i <
tau->numberOfDaughters();
i++) {
1046 int pid = dau->
pdgId();
1049 if (
abs(pid) == 12 ||
abs(pid) == 14 ||
abs(pid) == 16) {
1050 p4 -= TLorentzVector(dau->
px(), dau->
py(), dau->
pz(), dau->
energy());
1058 std::vector<const reco::GenParticle *> TauList;
1062 bool passedW =
false;
1063 std::vector<const reco::GenParticle *> ListofFSR;
1065 std::vector<const reco::GenParticle *> ListofBrem;
1067 std::vector<const reco::GenParticle *> FSR_photos;
1069 double BosonScale(1);
1070 if (!TauList.empty()) {
1076 double photonPtSum = 0;
1077 for (
unsigned int i = 0;
i < ListofBrem.size();
i++) {
1078 photonPtSum += ListofBrem.at(
i)->pt();
1084 if (BosonScale != 0) {
1087 for (
unsigned int i = 0;
i < ListofFSR.size();
i++) {
1088 photonPtSum += ListofFSR.at(
i)->pt();
1091 double FSR_photosSum(0);
1092 for (
unsigned int i = 0;
i < FSR_photos.size();
i++) {
1093 FSR_photosSum += FSR_photos.at(
i)->pt();