ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigAlgorithms
TrigEFMissingET
src
CVFPrepAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
CVFPrepAlg.h
"
6
#include "
StoreGate/DecorKeyHelpers.h
"
7
#include "
StoreGate/ReadHandle.h
"
8
#include "
StoreGate/ReadDecorHandle.h
"
9
#include "
StoreGate/WriteDecorHandle.h
"
10
#include "
TrigEFMissingET/PUClassification.h
"
11
12
namespace
HLT
13
{
14
namespace
MET
15
{
16
CVFPrepAlg::CVFPrepAlg
(
const
std::string &name, ISvcLocator *pSvcLocator)
17
:
AthReentrantAlgorithm
(name, pSvcLocator)
18
{
19
}
20
21
StatusCode
CVFPrepAlg::initialize
()
22
{
23
CHECK
(
m_inputClusterKey
.initialize());
24
25
if
(
m_inputCVFKey
.key().find(
"."
) == std::string::npos)
26
m_inputCVFKey
=
m_inputClusterKey
.key() +
"."
+
m_inputCVFKey
.key();
27
else
if
(
SG::contKeyFromKey
(
m_inputCVFKey
.key()) !=
m_inputClusterKey
.key())
28
{
29
ATH_MSG_ERROR
(
"CVF key does not match input cluster container key!"
);
30
return
StatusCode::FAILURE;
31
}
32
CHECK
(
m_inputCVFKey
.initialize());
33
34
if
(
m_outputCategoryKey
.key().find(
"."
) == std::string::npos)
35
m_outputCategoryKey
=
m_inputClusterKey
.key() +
"."
+
m_outputCategoryKey
.key();
36
else
if
(
SG::contKeyFromKey
(
m_outputCategoryKey
.key()) !=
m_inputClusterKey
.key())
37
{
38
ATH_MSG_ERROR
(
"Output category key does not match input cluster container key!"
);
39
return
StatusCode::FAILURE;
40
}
41
CHECK
(
m_outputCategoryKey
.initialize());
42
43
return
StatusCode::SUCCESS;
44
}
45
46
StatusCode
CVFPrepAlg::execute
(
const
EventContext &ctx)
const
47
{
48
auto
clusters =
SG::makeHandle
(
m_inputClusterKey
, ctx);
49
if
(!clusters.isValid())
50
{
51
ATH_MSG_ERROR
(
"Failed to retrieve "
<<
m_inputClusterKey
);
52
return
StatusCode::FAILURE;
53
}
54
auto
accCVF =
SG::makeHandle<float>
(
m_inputCVFKey
, ctx);
55
auto
decCategory =
SG::makeHandle<int>
(
m_outputCategoryKey
, ctx);
56
57
for
(
const
xAOD::CaloCluster
*iclus : *clusters)
58
{
59
float
CVF = accCVF(*iclus);
60
if
(CVF < 0)
61
decCategory(*iclus) =
PUClassification::NeutralForward
;
62
else
if
(CVF <
m_cvfThreshold
)
63
decCategory(*iclus) =
PUClassification::ChargedPU
;
64
else
65
decCategory(*iclus) =
PUClassification::ChargedHS
;
66
}
67
return
StatusCode::SUCCESS;
68
}
69
70
}
// namespace MET
71
}
// namespace HLT
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
CVFPrepAlg.h
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
PUClassification.h
DecorKeyHelpers.h
Some common helper functions used by decoration handles.
ReadDecorHandle.h
Handle class for reading a decoration on an object.
ReadHandle.h
Handle class for reading from StoreGate.
WriteDecorHandle.h
Handle class for adding a decoration to an object.
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
HLT::MET::CVFPrepAlg::m_inputClusterKey
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_inputClusterKey
The input container.
Definition
CVFPrepAlg.h:47
HLT::MET::CVFPrepAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
CVFPrepAlg.cxx:46
HLT::MET::CVFPrepAlg::CVFPrepAlg
CVFPrepAlg(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
CVFPrepAlg.cxx:16
HLT::MET::CVFPrepAlg::initialize
virtual StatusCode initialize() override
Definition
CVFPrepAlg.cxx:21
HLT::MET::CVFPrepAlg::m_outputCategoryKey
SG::WriteDecorHandleKey< xAOD::CaloClusterContainer > m_outputCategoryKey
The output classifcation.
Definition
CVFPrepAlg.h:53
HLT::MET::CVFPrepAlg::m_inputCVFKey
SG::ReadDecorHandleKey< xAOD::CaloClusterContainer > m_inputCVFKey
The input CVF key.
Definition
CVFPrepAlg.h:50
HLT::MET::CVFPrepAlg::m_cvfThreshold
Gaudi::Property< float > m_cvfThreshold
The CVF threshold.
Definition
CVFPrepAlg.h:56
HLT::MET::PUClassification::ChargedPU
@ ChargedPU
Definition
PUClassification.h:19
HLT::MET::PUClassification::NeutralForward
@ NeutralForward
Definition
PUClassification.h:18
HLT::MET::PUClassification::ChargedHS
@ ChargedHS
Definition
PUClassification.h:20
HLT::MET
Definition
METComponent.cxx:8
HLT
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
Definition
HLTResultReader.h:26
SG::contKeyFromKey
std::string contKeyFromKey(const std::string &key)
Extract the container part of key.
Definition
DecorKeyHelpers.cxx:26
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition
ReadCondHandle.h:269
xAOD::CaloCluster
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Definition
Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloCluster.h:19
Generated on
for ATLAS Offline Software by
1.17.0