ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
TruthParticleLevelAnalysisAlgorithms
Root
ParticleLevelJetsAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
7
#include "
TruthParticleLevelAnalysisAlgorithms/ParticleLevelJetsAlg.h
"
8
9
#include <
AsgDataHandles/ReadDecorHandle.h
>
10
#include <
AsgDataHandles/ReadHandle.h
>
11
#include <
AsgDataHandles/WriteDecorHandle.h
>
12
13
namespace
CP
{
14
15
StatusCode
ParticleLevelJetsAlg::initialize
() {
16
17
ANA_CHECK
(
m_jetsKey
.initialize());
18
ANA_CHECK
(
m_eventInfoKey
.initialize());
19
ANA_CHECK
(
m_truthLabelKey
.initialize());
20
ANA_CHECK
(
m_decNumTruthBJetsKey
.initialize());
21
ANA_CHECK
(
m_decNumTruthCJetsKey
.initialize());
22
23
return
StatusCode::SUCCESS;
24
}
25
26
StatusCode
ParticleLevelJetsAlg::execute
(
const
EventContext &ctx)
const
{
27
28
SG::ReadHandle<xAOD::JetContainer>
jets(
m_jetsKey
, ctx);
29
SG::ReadHandle<xAOD::EventInfo>
eventInfo(
m_eventInfoKey
, ctx);
30
31
// accessors and decorators
32
SG::ReadDecorHandle<xAOD::JetContainer, int>
acc_flav(
m_truthLabelKey
, ctx);
33
SG::WriteDecorHandle<xAOD::EventInfo, int>
dec_nBJets(
34
m_decNumTruthBJetsKey
, ctx);
35
SG::WriteDecorHandle<xAOD::EventInfo, int>
dec_nCJets(
36
m_decNumTruthCJetsKey
, ctx);
37
38
// decoration availability is a property of the whole container
39
const
bool
hasFlav = acc_flav.
isAvailable
();
40
41
// the number of b- and c-jets without any event cuts applied
42
int
num_bjets(0), num_cjets(0);
43
44
for
(
const
auto
*
jet
: *jets) {
45
46
// check the flavour label of the jet
47
if
(hasFlav) {
48
int
flavourLabel = acc_flav(*
jet
);
49
if
(flavourLabel == 5)
50
num_bjets++;
51
if
(flavourLabel == 4)
52
num_cjets++;
53
}
else
{
54
if
(!
m_warnedMissingLabel
.exchange(
true
))
55
ANA_MSG_WARNING
(
56
"Truth jet is missing the decoration: HadronConeExclTruthLabelID."
);
57
num_bjets = num_cjets = -999;
58
break
;
59
}
60
}
61
62
// decorate the EventInfo with the number of b- and c-jets
63
dec_nBJets(*eventInfo) = num_bjets;
64
dec_nCJets(*eventInfo) = num_cjets;
65
66
return
StatusCode::SUCCESS;
67
}
68
69
}
// namespace CP
ReadDecorHandle.h
Handle class for reading a decoration on an object.
ReadHandle.h
Handle class for reading from StoreGate.
WriteDecorHandle.h
Handle class for adding a decoration to an object.
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:325
ANA_MSG_WARNING
#define ANA_MSG_WARNING(xmsg,...)
Macro printing warning messages.
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:293
ParticleLevelJetsAlg.h
CP::ParticleLevelJetsAlg::m_truthLabelKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_truthLabelKey
Definition
ParticleLevelJetsAlg.h:34
CP::ParticleLevelJetsAlg::m_decNumTruthCJetsKey
SG::WriteDecorHandleKey< xAOD::EventInfo > m_decNumTruthCJetsKey
Definition
ParticleLevelJetsAlg.h:41
CP::ParticleLevelJetsAlg::m_decNumTruthBJetsKey
SG::WriteDecorHandleKey< xAOD::EventInfo > m_decNumTruthBJetsKey
Definition
ParticleLevelJetsAlg.h:37
CP::ParticleLevelJetsAlg::m_jetsKey
SG::ReadHandleKey< xAOD::JetContainer > m_jetsKey
Definition
ParticleLevelJetsAlg.h:30
CP::ParticleLevelJetsAlg::m_warnedMissingLabel
std::atomic< bool > m_warnedMissingLabel
Definition
ParticleLevelJetsAlg.h:45
CP::ParticleLevelJetsAlg::initialize
virtual StatusCode initialize() final
Definition
ParticleLevelJetsAlg.cxx:15
CP::ParticleLevelJetsAlg::execute
virtual StatusCode execute(const EventContext &ctx) const final
Definition
ParticleLevelJetsAlg.cxx:26
CP::ParticleLevelJetsAlg::m_eventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Definition
ParticleLevelJetsAlg.h:32
SG::ReadDecorHandle
Handle class for reading a decoration on an object.
Definition
StoreGate/StoreGate/ReadDecorHandle.h:94
SG::ReadDecorHandle::isAvailable
bool isAvailable()
Test to see if this variable exists in the store, for the referenced object.
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:66
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition
StoreGate/StoreGate/WriteDecorHandle.h:100
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.17.0