ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
AnalysisCommon
IsolationSelection
src
IsoCloseByCaloDecorAlg.cxx
Go to the documentation of this file.
1
2
/*
3
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
4
*/
5
#include "
IsoCloseByCaloDecorAlg.h
"
6
7
#include <
IsolationSelection/IsolationCloseByCorrectionTool.h
>
8
#include <
StoreGate/ReadDecorHandle.h
>
9
#include <
StoreGate/ReadHandle.h
>
10
11
namespace
CP
{
12
static
const
FloatDecorator
dec_assocCaloEta
{
IsolationCloseByCorrectionTool::caloDecors
()[0]};
13
static
const
FloatDecorator
dec_assocCaloPhi
{
IsolationCloseByCorrectionTool::caloDecors
()[1]};
14
static
const
FloatDecorator
dec_assocCaloEne
{
IsolationCloseByCorrectionTool::caloDecors
()[2]};
15
static
const
CharDecorator
dec_assocCaloIsDec
{
IsolationCloseByCorrectionTool::caloDecors
()[3]};
16
17
static
const
FloatDecorator
dec_assocPflowEta
{
IsolationCloseByCorrectionTool::pflowDecors
()[0]};
18
static
const
FloatDecorator
dec_assocPflowPhi
{
IsolationCloseByCorrectionTool::pflowDecors
()[1]};
19
static
const
FloatDecorator
dec_assocPflowEne
{
IsolationCloseByCorrectionTool::pflowDecors
()[2]};
20
static
const
CharDecorator
dec_assocPflowIsDec
{
IsolationCloseByCorrectionTool::pflowDecors
()[3]};
21
22
IsoCloseByCaloDecorAlg::IsoCloseByCaloDecorAlg
(
const
std::string&
name
, ISvcLocator* svcLoc) :
AthReentrantAlgorithm
(
name
, svcLoc) {}
23
StatusCode
IsoCloseByCaloDecorAlg::initialize
() {
24
ATH_CHECK
(
m_primPartKey
.initialize());
25
ATH_CHECK
(
m_closeByCorrTool
.retrieve());
26
if
(
m_decorClust
) {
27
for
(
const
std::string& decor :
IsolationCloseByCorrectionTool::caloDecors
()) {
28
m_decorKeys
.emplace_back(
m_primPartKey
.key() +
"."
+ decor);
29
}
30
}
31
if
(
m_decorPflow
) {
32
for
(
const
std::string& decor :
IsolationCloseByCorrectionTool::pflowDecors
()) {
33
m_decorKeys
.emplace_back(
m_primPartKey
.key() +
"."
+ decor);
34
}
35
}
36
37
ATH_CHECK
(
m_decorKeys
.initialize());
38
if
(!
m_decorClust
&& !
m_decorPflow
) {
39
ATH_MSG_FATAL
(
"Nothing is done by me. It's bogous scheduling me"
);
40
return
StatusCode::FAILURE;
41
}
42
return
StatusCode::SUCCESS;
43
}
44
45
StatusCode
IsoCloseByCaloDecorAlg::execute
(
const
EventContext& ctx)
const
{
46
SG::ReadHandle<xAOD::IParticleContainer>
readHandle{
m_primPartKey
, ctx};
47
if
(!readHandle.
isValid
()) {
48
ATH_MSG_FATAL
(
"Failed to retrieve particle collection "
<<
m_primPartKey
.fullKey());
49
return
StatusCode::FAILURE;
50
}
51
52
for
(
const
xAOD::IParticle
* part : *readHandle) {
53
float
eta
{0.f},
phi
{0.f}, ene{0.f};
54
if
(
m_decorClust
) {
55
m_closeByCorrTool
->associateCluster(part,
eta
,
phi
, ene);
56
dec_assocCaloEta
(*part) =
eta
;
57
dec_assocCaloPhi
(*part) =
phi
;
58
dec_assocCaloEne
(*part) = ene;
59
dec_assocCaloIsDec
(*part) =
true
;
60
}
61
if
(!
m_decorPflow
)
continue
;
62
m_closeByCorrTool
->associateFlowElement(ctx, part,
eta
,
phi
, ene);
63
dec_assocPflowEta
(*part) =
eta
;
64
dec_assocPflowPhi
(*part) =
phi
;
65
dec_assocPflowEne
(*part) = ene;
66
dec_assocPflowIsDec
(*part) =
true
;
67
}
68
return
StatusCode::SUCCESS;
69
}
70
}
// namespace CP
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
IsoCloseByCaloDecorAlg.h
IsolationCloseByCorrectionTool.h
ReadDecorHandle.h
Handle class for reading a decoration on an object.
ReadHandle.h
Handle class for reading from StoreGate.
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
CP::IsoCloseByCaloDecorAlg::initialize
StatusCode initialize() override
Definition
IsoCloseByCaloDecorAlg.cxx:23
CP::IsoCloseByCaloDecorAlg::m_decorClust
Gaudi::Property< bool > m_decorClust
Definition
IsoCloseByCaloDecorAlg.h:44
CP::IsoCloseByCaloDecorAlg::m_decorKeys
SG::WriteDecorHandleKeyArray< xAOD::IParticleContainer > m_decorKeys
Definition
IsoCloseByCaloDecorAlg.h:47
CP::IsoCloseByCaloDecorAlg::execute
StatusCode execute(const EventContext &ctx) const override
Definition
IsoCloseByCaloDecorAlg.cxx:45
CP::IsoCloseByCaloDecorAlg::m_decorPflow
Gaudi::Property< bool > m_decorPflow
Definition
IsoCloseByCaloDecorAlg.h:45
CP::IsoCloseByCaloDecorAlg::m_primPartKey
SG::ReadHandleKey< xAOD::IParticleContainer > m_primPartKey
Input containers to retrieve from the storegate.
Definition
IsoCloseByCaloDecorAlg.h:38
CP::IsoCloseByCaloDecorAlg::IsoCloseByCaloDecorAlg
IsoCloseByCaloDecorAlg(const std::string &name, ISvcLocator *svcLoc)
Definition
IsoCloseByCaloDecorAlg.cxx:22
CP::IsoCloseByCaloDecorAlg::m_closeByCorrTool
ToolHandle< CP::IIsolationCloseByCorrectionTool > m_closeByCorrTool
These tools shall be configured to pick up the same Inner detector tracks as for the isolation buildi...
Definition
IsoCloseByCaloDecorAlg.h:41
CP::IsolationCloseByCorrectionTool::pflowDecors
static const caloDecorNames & pflowDecors()
Definition
IsolationCloseByCorrectionTool.cxx:31
CP::IsolationCloseByCorrectionTool::caloDecors
static const caloDecorNames & caloDecors()
Returns an array with the calo cluster decoration names [0]-> eta, [1]->phi, [2]->energy....
Definition
IsolationCloseByCorrectionTool.cxx:25
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition
Event/xAOD/xAODBase/xAODBase/IParticle.h:41
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
CP::dec_assocCaloEne
static const FloatDecorator dec_assocCaloEne
Definition
IsoCloseByCaloDecorAlg.cxx:14
CP::dec_assocPflowEta
static const FloatDecorator dec_assocPflowEta
Definition
IsoCloseByCaloDecorAlg.cxx:17
CP::dec_assocCaloEta
static const FloatDecorator dec_assocCaloEta
Definition
IsoCloseByCaloDecorAlg.cxx:12
CP::dec_assocCaloPhi
static const FloatDecorator dec_assocCaloPhi
Definition
IsoCloseByCaloDecorAlg.cxx:13
CP::CharDecorator
SG::AuxElement::Decorator< char > CharDecorator
Definition
PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:20
CP::dec_assocCaloIsDec
static const CharDecorator dec_assocCaloIsDec
Definition
IsoCloseByCaloDecorAlg.cxx:15
CP::dec_assocPflowPhi
static const FloatDecorator dec_assocPflowPhi
Definition
IsoCloseByCaloDecorAlg.cxx:18
CP::dec_assocPflowIsDec
static const CharDecorator dec_assocPflowIsDec
Definition
IsoCloseByCaloDecorAlg.cxx:20
CP::FloatDecorator
SG::AuxElement::Decorator< float > FloatDecorator
Definition
PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:23
CP::dec_assocPflowEne
static const FloatDecorator dec_assocPflowEne
Definition
IsoCloseByCaloDecorAlg.cxx:19
xAOD::name
name
Definition
TriggerMenuJson_v1.cxx:29
xAOD::phi
setEt phi
Definition
TrigEMCluster_v1.cxx:29
Generated on
for ATLAS Offline Software by
1.17.0