ATLAS Offline Software
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
LArG4FSStartPointFilter.part
part
Definition:
LArG4FSStartPointFilter.py:21
IsoCloseByCaloDecorAlg.h
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition:
AthMsgStreamMacros.h:34
SG::ReadHandle
Definition:
StoreGate/StoreGate/ReadHandle.h:70
CP::IsoCloseByCaloDecorAlg::IsoCloseByCaloDecorAlg
IsoCloseByCaloDecorAlg(const std::string &name, ISvcLocator *svcLoc)
Definition:
IsoCloseByCaloDecorAlg.cxx:22
CP::IsolationCloseByCorrectionTool::pflowDecors
static caloDecorNames pflowDecors()
Definition:
IsolationCloseByCorrectionTool.cxx:28
CP::CharDecorator
SG::AuxElement::Decorator< char > CharDecorator
Definition:
PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:19
CP::IsoCloseByCaloDecorAlg::m_decorClust
Gaudi::Property< bool > m_decorClust
Definition:
IsoCloseByCaloDecorAlg.h:44
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:48
CP::FloatDecorator
SG::AuxElement::Decorator< float > FloatDecorator
Definition:
PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:22
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition:
AthReentrantAlgorithm.h:83
CP::IsoCloseByCaloDecorAlg::execute
StatusCode execute(const EventContext &ctx) const override
Definition:
IsoCloseByCaloDecorAlg.cxx:45
xAOD::phi
setEt phi
Definition:
TrigEMCluster_v1.cxx:29
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
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CP::IsoCloseByCaloDecorAlg::m_decorKeys
SG::WriteDecorHandleKeyArray< xAOD::IParticleContainer > m_decorKeys
Definition:
IsoCloseByCaloDecorAlg.h:47
ATH_CHECK
#define ATH_CHECK
Definition:
AthCheckMacros.h:40
CP::IsoCloseByCaloDecorAlg::m_primPartKey
SG::ReadHandleKey< xAOD::IParticleContainer > m_primPartKey
Input containers to retrieve from the storegate.
Definition:
IsoCloseByCaloDecorAlg.h:38
name
std::string name
Definition:
Control/AthContainers/Root/debug.cxx:228
CP::IsolationCloseByCorrectionTool::caloDecors
static caloDecorNames caloDecors()
Returns an array with the calo cluster decoration ames [0]-> eta, [1]->phi, [2]->energy....
Definition:
IsolationCloseByCorrectionTool.cxx:24
CP::IsoCloseByCaloDecorAlg::initialize
StatusCode initialize() override
Definition:
IsoCloseByCaloDecorAlg.cxx:23
IsolationCloseByCorrectionTool.h
CP::IsoCloseByCaloDecorAlg::m_decorPflow
Gaudi::Property< bool > m_decorPflow
Definition:
IsoCloseByCaloDecorAlg.h:45
ReadDecorHandle.h
Handle class for reading a decoration on an object.
ReadHandle.h
Handle class for reading from StoreGate.
Generated on Sun Dec 22 2024 21:12:00 for ATLAS Offline Software by
1.8.18