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
// accessors and decorators
12
// these are done at file-level to register types with output algorithms
13
static
const
SG::ConstAccessor<int>
acc_flav
(
14
"HadronConeExclTruthLabelID"
);
15
static
const
SG::Decorator<int>
dec_nBJets
(
16
"num_truth_bjets_nocuts"
);
17
static
const
SG::Decorator<int>
dec_nCJets
(
18
"num_truth_cjets_nocuts"
);
19
20
StatusCode
ParticleLevelJetsAlg::initialize
() {
21
22
ANA_CHECK
(
m_jetsKey
.initialize());
23
ANA_CHECK
(
m_eventInfoKey
.initialize());
24
25
return
StatusCode::SUCCESS;
26
}
27
28
StatusCode
ParticleLevelJetsAlg::execute
(
const
EventContext &ctx)
const
{
29
30
SG::ReadHandle<xAOD::JetContainer>
jets(
m_jetsKey
, ctx);
31
SG::ReadHandle<xAOD::EventInfo>
eventInfo(
m_eventInfoKey
, ctx);
32
33
// the number of b- and c-jets without any event cuts applied
34
int
num_bjets(0), num_cjets(0);
35
36
for
(
const
auto
*
jet
: *jets) {
37
38
// check the flavour label of the jet
39
if
(
acc_flav
.isAvailable(*
jet
)) {
40
int
flavourLabel =
acc_flav
(*
jet
);
41
if
(flavourLabel == 5)
42
num_bjets++;
43
if
(flavourLabel == 4)
44
num_cjets++;
45
}
else
{
46
ANA_MSG_WARNING
(
47
"Truth jet is missing the decoration: HadronConeExclTruthLabelID."
);
48
num_bjets = num_cjets = -999;
49
}
50
}
51
52
// decorate the EventInfo with the number of b- and c-jets
53
dec_nBJets
(*eventInfo) = num_bjets;
54
dec_nCJets
(*eventInfo) = num_cjets;
55
56
return
StatusCode::SUCCESS;
57
}
58
59
}
// 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:20
CP::ParticleLevelJetsAlg::execute
virtual StatusCode execute(const EventContext &ctx) const final
Definition
ParticleLevelJetsAlg.cxx:28
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::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
CP::dec_nBJets
static const SG::Decorator< int > dec_nBJets("num_truth_bjets_nocuts")
CP::acc_flav
static const SG::ConstAccessor< int > acc_flav("HadronConeExclTruthLabelID")
CP::dec_nCJets
static const SG::Decorator< int > dec_nCJets("num_truth_cjets_nocuts")
jet
Definition
JetCalibTools_PlotJESFactors.cxx:23
Generated on
for ATLAS Offline Software by
1.14.0