ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
DerivationFramework
DerivationFrameworkTop
src
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
5
#include "
BoostedTTbarSkimmingToolAlg.h
"
6
#include "
xAODTruth/TruthParticleContainer.h
"
7
#include "
xAODEventInfo/EventInfo.h
"
8
#include "TLorentzVector.h"
9
10
11
DerivationFramework::BoostedTTbarSkimmingToolAlg::
12
BoostedTTbarSkimmingToolAlg
(
const
std::string& t,
13
const
std::string& n,
14
const
IInterface* p)
15
: base_class(t, n, p)
16
{
17
}
18
19
StatusCode
DerivationFramework::BoostedTTbarSkimmingToolAlg::finalize
()
20
{
21
ATH_MSG_INFO
(
"Processed "
<<
m_ntot
<<
" events, "
<<
m_npass
<<
" events passed filter "
);
22
return
StatusCode::SUCCESS;
23
}
24
25
bool
DerivationFramework::BoostedTTbarSkimmingToolAlg::eventPassesFilter
(
const
EventContext&
/*ctx*/
)
const
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
}
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x,...)
Definition
AthMsgStreamMacros.h:47
ATH_MSG_INFO
#define ATH_MSG_INFO(x,...)
Definition
AthMsgStreamMacros.h:45
BoostedTTbarSkimmingToolAlg.h
vec
std::vector< size_t > vec
Definition
CombinationsGeneratorTest.cxx:9
TruthParticleContainer.h
DerivationFramework::BoostedTTbarSkimmingToolAlg::finalize
virtual StatusCode finalize() override
Definition
BoostedTTbarSkimmingToolAlg.cxx:19
DerivationFramework::BoostedTTbarSkimmingToolAlg::m_npass
std::atomic< unsigned int > m_npass
Definition
BoostedTTbarSkimmingToolAlg.h:35
DerivationFramework::BoostedTTbarSkimmingToolAlg::BoostedTTbarSkimmingToolAlg
BoostedTTbarSkimmingToolAlg(const std::string &t, const std::string &n, const IInterface *p)
Definition
BoostedTTbarSkimmingToolAlg.cxx:12
DerivationFramework::BoostedTTbarSkimmingToolAlg::eventPassesFilter
virtual bool eventPassesFilter(const EventContext &ctx) const override
Returns true if event passes the filter.
Definition
BoostedTTbarSkimmingToolAlg.cxx:25
DerivationFramework::BoostedTTbarSkimmingToolAlg::m_ttbarCut
Gaudi::Property< double > m_ttbarCut
Property: m_ttbar cut in MeV.
Definition
BoostedTTbarSkimmingToolAlg.h:31
DerivationFramework::BoostedTTbarSkimmingToolAlg::m_ntot
std::atomic< unsigned int > m_ntot
Definition
BoostedTTbarSkimmingToolAlg.h:34
xAOD::TruthParticle_v1::pdgId
int pdgId() const
PDG ID code.
MCTruthPartClassifier::top
@ top
Definition
TruthClasses.h:66
xAOD::TruthParticle
TruthParticle_v1 TruthParticle
Typedef to implementation.
Definition
Event/xAOD/xAODTruth/xAODTruth/TruthParticle.h:15
xAOD::TruthParticleContainer
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.
Definition
Event/xAOD/xAODTruth/xAODTruth/TruthParticleContainer.h:17
EventInfo.h
Generated on
for ATLAS Offline Software by
1.17.0