ATLAS Offline Software
Loading...
Searching...
No Matches
BoostedTTbarSkimmingToolAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
8#include "TLorentzVector.h"
9
10
12BoostedTTbarSkimmingToolAlg(const std::string& t,
13 const std::string& n,
14 const IInterface* p)
15 : base_class(t, n, p)
16{
17}
18
20{
21 ATH_MSG_INFO("Processed "<< m_ntot <<" events, "<< m_npass<<" events passed filter ");
22 return StatusCode::SUCCESS;
23}
24
26{
27 ++m_ntot;
28
29
30 const xAOD::TruthParticleContainer* truth = nullptr;
31 if (evtStore()->retrieve(truth, "TruthParticles").isFailure()) {
32 ATH_MSG_ERROR("Failed to retrieve TruthParticles");
33 return false;
34 }
35
36 TLorentzVector top, antitop;
37
38 for (const auto* p : *truth) {
39 if (std::abs(p->pdgId()) != 6) continue;
40
41 bool hasW = false;
42 bool hasB = false;
43 for (unsigned int ic = 0; ic < p->nChildren(); ++ic) {
44 const xAOD::TruthParticle* child = p->child(ic);
45 if (!child) continue;
46 if (std::abs(child->pdgId()) == 24) hasW = true;
47 if (std::abs(child->pdgId()) == 5) hasB = true;
48 }
49 if (!hasW || !hasB) continue;
50
51 TLorentzVector vec;
52 vec.SetPtEtaPhiM(p->pt(), p->eta(), p->phi(), p->m());
53 if (p->pdgId() > 0) top = vec;
54 else antitop = vec;
55 }
56
57 double mass_ttbar = -1.;
58 if (top.Pt() > 0 && antitop.Pt() > 0) mass_ttbar = (top + antitop).M();
59
60 if (mass_ttbar <= m_ttbarCut) return false;
61
62 ++m_npass;
63 return true;
64}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
std::vector< size_t > vec
BoostedTTbarSkimmingToolAlg(const std::string &t, const std::string &n, const IInterface *p)
virtual bool eventPassesFilter(const EventContext &ctx) const override
Returns true if event passes the filter.
Gaudi::Property< double > m_ttbarCut
Property: m_ttbar cut in MeV.
int pdgId() const
PDG ID code.
TruthParticle_v1 TruthParticle
Typedef to implementation.
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.