ATLAS Offline Software
Loading...
Searching...
No Matches
PhysicsAnalysis
DerivationFramework
DerivationFrameworkMCTruth
src
TruthD2Decorator.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// Author: Robert Les (robert.les@cern.ch)
6
7
#include "
DerivationFrameworkMCTruth/TruthD2Decorator.h
"
8
#include "
StoreGate/WriteDecorHandle.h
"
9
#include <vector>
10
#include <string>
11
12
namespace
DerivationFramework
{
13
14
StatusCode
TruthD2Decorator::initialize
()
15
{
16
ATH_CHECK
(
m_jetContainerKey
.initialize());
17
ATH_CHECK
(
m_decorationName
.initialize());
18
19
return
StatusCode::SUCCESS;
20
}
21
22
23
StatusCode
TruthD2Decorator::addBranches
(
const
EventContext& ctx)
const
24
{
25
// Event context
26
27
// Set up the decorators
28
SG::WriteDecorHandle< xAOD::JetContainer, float >
decoratorD2(
m_decorationName
, ctx);
29
30
// Get the Large-R jet Container
31
SG::ReadHandle<xAOD::JetContainer>
largeRjets(
m_jetContainerKey
, ctx);
32
33
if
(!largeRjets.
isValid
()) {
34
ATH_MSG_ERROR
(
"Couldn't retrieve JetContainer with key "
<<
m_jetContainerKey
.key());
35
return
StatusCode::FAILURE;
36
}
37
38
// loop over jet collection
39
for
(
const
auto
*
jet
: *largeRjets){
40
//get ECF
41
float
ecf1 =
jet
->getAttribute<
float
>(
"ECF1"
);
42
float
ecf2 =
jet
->getAttribute<
float
>(
"ECF2"
);
43
float
ecf3 =
jet
->getAttribute<
float
>(
"ECF3"
);
44
45
//calculate D2 and decorate
46
float
D2=-999;
47
if
(std::abs(ecf2)>1e-8)
48
D2=ecf3 * std::pow(ecf1, 3.0) / std::pow(ecf2, 3.0);
49
decoratorD2(*
jet
) = D2;
50
}
51
52
return
StatusCode::SUCCESS;
53
}
54
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
WriteDecorHandle.h
Handle class for adding a decoration to an object.
TruthD2Decorator.h
DerivationFramework::TruthD2Decorator::m_jetContainerKey
SG::ReadHandleKey< xAOD::JetContainer > m_jetContainerKey
Definition
TruthD2Decorator.h:28
DerivationFramework::TruthD2Decorator::initialize
virtual StatusCode initialize() override final
Definition
TruthD2Decorator.cxx:14
DerivationFramework::TruthD2Decorator::addBranches
virtual StatusCode addBranches(const EventContext &ctx) const override final
Definition
TruthD2Decorator.cxx:23
DerivationFramework::TruthD2Decorator::m_decorationName
SG::WriteDecorHandleKey< xAOD::JetContainer > m_decorationName
Definition
TruthD2Decorator.h:30
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::WriteDecorHandle< xAOD::JetContainer, float >
DerivationFramework
THE reconstruction tool.
Definition
ParticleSortingAlg.h:24
jet
Definition
JetCalibTools_PlotJESFactors.cxx:23
Generated on
for ATLAS Offline Software by
1.14.0