ATLAS Offline Software
PhysicsAnalysis
Algorithms
TruthParticleLevelAnalysisAlgorithms
Root
ParticleLevelJetsAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 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
() {
20
21
SG::ReadHandle<xAOD::JetContainer>
jets
(
m_jetsKey
);
22
SG::ReadHandle<xAOD::EventInfo>
eventInfo(
m_eventInfoKey
);
23
24
// accessors
25
static
const
SG::AuxElement::ConstAccessor<int>
acc_flav(
26
"HadronConeExclTruthLabelID"
);
27
28
// decorators
29
static
const
SG::AuxElement::Decorator<int>
dec_nBJets(
30
"num_truth_bjets_nocuts"
);
31
static
const
SG::AuxElement::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
CP::ParticleLevelJetsAlg::execute
virtual StatusCode execute() final
Definition:
ParticleLevelJetsAlg.cxx:19
SG::ReadHandle
Definition:
StoreGate/StoreGate/ReadHandle.h:70
ParticleLevelJetsAlg.h
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition:
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition:
ConstAccessor.h:55
CP
Select isolated Photons, Electrons and Muons.
Definition:
Control/xAODRootAccess/xAODRootAccess/TEvent.h:49
CP::ParticleLevelJetsAlg::initialize
virtual StatusCode initialize() final
Definition:
ParticleLevelJetsAlg.cxx:11
jet
Definition:
JetCalibTools_PlotJESFactors.cxx:23
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition:
Decorator.h:59
CP::ParticleLevelJetsAlg::m_eventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Definition:
ParticleLevelJetsAlg.h:29
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ANA_MSG_WARNING
#define ANA_MSG_WARNING(xmsg)
Macro printing warning messages.
Definition:
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:292
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition:
AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
SG::ConstAccessor::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
defineDB.jets
list jets
Definition:
JetTagCalibration/share/defineDB.py:24
CP::ParticleLevelJetsAlg::m_jetsKey
SG::ReadHandleKey< xAOD::JetContainer > m_jetsKey
Definition:
ParticleLevelJetsAlg.h:27
Generated on Fri Jan 10 2025 21:15:42 for ATLAS Offline Software by
1.8.18