ATLAS Offline Software
Sonnenschein.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3  */
4 
6 #include "TopEvent/Event.h"
7 
10 
11 #include <iostream>
12 
13 namespace top {
15  }
16 
18  }
19 
20  bool Sonnenschein::tWb(const top::Event& event, int start, TLorentzVector& t, TLorentzVector& W, TLorentzVector& b,
21  TLorentzVector& l, TLorentzVector& nu) const {
22  bool hasT = false;
23  bool hasB = false;
24  bool hasL = false;
25  bool hasNu = false;
26 
27  for (const xAOD::TruthParticle* particle : *event.m_truth) {
28  if (particle->pdgId() == start) {
29  //std::cout << *particle << std::endl;
30  t = particle->p4();
31  hasT = true;
32 
33  if (particle->hasDecayVtx()) {
34  const xAOD::TruthVertex* vtx = particle->decayVtx();
35  for (size_t i = 0; i < vtx->nOutgoingParticles(); ++i) {
36  const xAOD::TruthParticle* tDecayProduct = vtx->outgoingParticle(i);
37  //std::cout << " " << *tDecayProduct << std::endl;
38 
39  if (abs(tDecayProduct->pdgId()) == 24 && tDecayProduct->hasDecayVtx()) {
40  W = tDecayProduct->p4();
41 
42  const xAOD::TruthVertex* wDecayVtx = tDecayProduct->decayVtx();
43  for (size_t j = 0; j < wDecayVtx->nOutgoingParticles(); ++j) {
44  const xAOD::TruthParticle* wDecayProduct = wDecayVtx->outgoingParticle(j);
45  //std::cout << " " << *wDecayProduct << std::endl;
46 
47  if (abs(wDecayProduct->pdgId()) == 11 || abs(wDecayProduct->pdgId()) == 13 ||
48  abs(wDecayProduct->pdgId()) == 15) {
49  l = wDecayProduct->p4();
50  hasL = true;
51  }
52 
53  if (abs(wDecayProduct->pdgId()) == 12 || abs(wDecayProduct->pdgId()) == 14 ||
54  abs(wDecayProduct->pdgId()) == 16) {
55  nu = wDecayProduct->p4();
56  hasNu = true;
57  }
58  }
59  } else if (abs(tDecayProduct->pdgId()) == 5) {
60  b = tDecayProduct->p4();
61  hasB = true;
62  }
63  }
64  }
65  }
66  }
67 
68  return hasT && hasB && hasL && hasNu;
69  }
70 
71  bool Sonnenschein::apply(const top::Event& event) const {
72  TLorentzVector t;
73  TLorentzVector Wp;
74  TLorentzVector b;
75  TLorentzVector lp;
76  TLorentzVector nu;
77  bool cando1 = tWb(event, 6, t, Wp, b, lp, nu);
78 
79  TLorentzVector tbar;
80  TLorentzVector Wm;
81  TLorentzVector bbar;
82  TLorentzVector lm;
83  TLorentzVector nubar;
84  bool cando2 = tWb(event, -6, tbar, Wm, bbar, lm, nubar);
85 
86  //isn't dilepton at truth level, so return
87  if (!cando1 || !cando2) return true;
88 
89  const double met_ex = nu.Px() + nubar.Px();
90  const double met_ey = nu.Py() + nubar.Py();
91 
92  //solve
93  std::vector<std::pair<TLorentzVector, TLorentzVector> > allSolutions = m_sonn.solve(lp, b, t.M(),
94  Wp.M(), lm, bbar,
95  tbar.M(), Wm.M(), met_ex,
96  met_ey);
97 
98  std::cout << "EVENT" << std::endl;
99  unsigned int counter = 0;
100  for (const auto& possible : allSolutions) {
101  std::cout << "Possible solution number " << counter << "\n";
102  std::cout << " first neutrino : " << possible.first << "\n";
103  std::cout << " second neutrino: " << possible.second << "\n";
104  ++counter;
105  }
106 
107  return true;
108  }
109 }
top::Sonnenschein::apply
virtual bool apply(const top::Event &) const override
This does stuff based on the information in an event.
Definition: Sonnenschein.cxx:71
top::Sonnenschein::Sonnenschein
Sonnenschein()
Definition: Sonnenschein.cxx:14
xAOD::TruthVertex_v1::nOutgoingParticles
size_t nOutgoingParticles() const
Get the number of outgoing particles.
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
top
TopConfig A simple configuration that is NOT a singleton.
Definition: AnalysisTrackingHelper.cxx:58
JetTiledMap::W
@ W
Definition: TiledEtaPhiMap.h:44
top::SonnenscheinEngine::solve
std::vector< std::pair< TLorentzVector, TLorentzVector > > solve(const TLorentzVector &me_t_lp, const TLorentzVector &me_t_b, double mass_t, double mass_wp, const TLorentzVector &me_tbar_lm, const TLorentzVector &me_tbar_bbar, double mass_tbar, double mass_wm, double me_mex, double me_mey) const
Does the real work.
Definition: SonnenscheinEngine.cxx:20
Sonnenschein.h
TruthParticleContainer.h
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
xAOD::TruthParticle_v1::hasDecayVtx
bool hasDecayVtx() const
Check for a decay vertex on this particle.
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
top::Sonnenschein::m_sonn
top::SonnenscheinEngine m_sonn
Definition: Sonnenschein.h:32
lumiFormat.i
int i
Definition: lumiFormat.py:92
top::Sonnenschein::~Sonnenschein
virtual ~Sonnenschein()
Definition: Sonnenschein.cxx:17
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:41
top::Sonnenschein::tWb
bool tWb(const top::Event &event, int start, TLorentzVector &t, TLorentzVector &W, TLorentzVector &b, TLorentzVector &l, TLorentzVector &nu) const
Definition: Sonnenschein.cxx:20
Event.h
TruthVertex.h
xAOD::TruthParticle_v1::decayVtx
const TruthVertex_v1 * decayVtx() const
The decay vertex of this particle.
xAOD::TruthVertex_v1
Class describing a truth vertex in the MC record.
Definition: TruthVertex_v1.h:41
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
top::Event
Very simple class to hold event data after reading from a file.
Definition: Event.h:49
xAOD::TruthParticle_v1::p4
virtual FourMom_t p4() const override final
The full 4-momentum of the particle.
Definition: TruthParticle_v1.cxx:196
xAOD::TruthParticle_v1::pdgId
int pdgId() const
PDG ID code.
test_pyathena.counter
counter
Definition: test_pyathena.py:15
xAOD::TruthVertex_v1::outgoingParticle
const TruthParticle_v1 * outgoingParticle(size_t index) const
Get one of the outgoing particles.
Definition: TruthVertex_v1.cxx:121