ATLAS Offline Software
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
TruthParticleLevelAnalysisAlgorithms
Root
ParticleLevelJetsAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
7
#include "
TruthParticleLevelAnalysisAlgorithms/ParticleLevelJetsAlg.h
"
8
9
namespace
CP
{
10
11
StatusCode
ParticleLevelJetsAlg::initialize
() {
12
13
ANA_CHECK
(
m_jetsKey
.initialize());
14
ANA_CHECK
(
m_eventInfoKey
.initialize());
15
16
return
StatusCode::SUCCESS;
17
}
18
19
StatusCode
ParticleLevelJetsAlg::execute
(
const
EventContext &ctx)
const
{
20
21
SG::ReadHandle<xAOD::JetContainer>
jets(
m_jetsKey
, ctx);
22
SG::ReadHandle<xAOD::EventInfo>
eventInfo(
m_eventInfoKey
, ctx);
23
24
// accessors
25
static
const
SG::ConstAccessor<int>
acc_flav(
26
"HadronConeExclTruthLabelID"
);
27
28
// decorators
29
static
const
SG::Decorator<int>
dec_nBJets(
30
"num_truth_bjets_nocuts"
);
31
static
const
SG::Decorator<int>
dec_nCJets(
32
"num_truth_cjets_nocuts"
);
33
34
// the number of b- and c-jets without any event cuts applied
35
int
num_bjets(0), num_cjets(0);
36
37
for
(
const
auto
*
jet
: *jets) {
38
39
// check the flavour label of the jet
40
if
(acc_flav.
isAvailable
(*
jet
)) {
41
int
flavourLabel = acc_flav(*
jet
);
42
if
(flavourLabel == 5)
43
num_bjets++;
44
if
(flavourLabel == 4)
45
num_cjets++;
46
}
else
{
47
ANA_MSG_WARNING
(
48
"Truth jet is missing the decoration: HadronConeExclTruthLabelID."
);
49
num_bjets = num_cjets = -999;
50
}
51
}
52
53
// decorate the EventInfo with the number of b- and c-jets
54
dec_nBJets(*eventInfo) = num_bjets;
55
dec_nCJets(*eventInfo) = num_cjets;
56
57
return
StatusCode::SUCCESS;
58
}
59
60
}
// namespace CP
ANA_MSG_WARNING
#define ANA_MSG_WARNING(xmsg)
Macro printing warning messages.
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:292
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
ParticleLevelJetsAlg.h
CP::ParticleLevelJetsAlg::m_jetsKey
SG::ReadHandleKey< xAOD::JetContainer > m_jetsKey
Definition
ParticleLevelJetsAlg.h:27
CP::ParticleLevelJetsAlg::initialize
virtual StatusCode initialize() final
Definition
ParticleLevelJetsAlg.cxx:11
CP::ParticleLevelJetsAlg::execute
virtual StatusCode execute(const EventContext &ctx) const final
Definition
ParticleLevelJetsAlg.cxx:19
CP::ParticleLevelJetsAlg::m_eventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Definition
ParticleLevelJetsAlg.h:29
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition
ConstAccessor.h:55
SG::ConstAccessor::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition
Decorator.h:59
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
jet
Definition
JetCalibTools_PlotJESFactors.cxx:23
Generated on
for ATLAS Offline Software by
1.14.0