ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
JetMissingEtID
JetSelectorTools
src
EventCleaningTestAlg.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
// EDM includes
6
7
// Local includes
8
#include "
EventCleaningTestAlg.h
"
9
#include "
StoreGate/WriteDecorHandle.h
"
10
11
12
//-----------------------------------------------------------------------------
13
// Constructor
14
//-----------------------------------------------------------------------------
15
EventCleaningTestAlg::EventCleaningTestAlg
(
const
std::string& name,
16
ISvcLocator* svcLoc)
17
:
AthAlgorithm
(name, svcLoc) {}
18
19
//-----------------------------------------------------------------------------
20
// Initialize
21
//-----------------------------------------------------------------------------
22
StatusCode
EventCleaningTestAlg::initialize
()
23
{
24
ATH_MSG_INFO
(
"Initialize"
);
25
26
// Try to retrieve the tool
27
ATH_CHECK
(
m_ecTool
.retrieve() );
28
ATH_CHECK
(
m_jetKey
.initialize());
29
ATH_CHECK
(
m_evtKey
.initialize() );
30
// Create the decorator
31
// Use an if statement to leave a legacy
32
std::string labelString =
m_cleaningLevel
;
33
if
(
m_jetKey
.key() ==
"AntiKt4EMTopoJets"
) {
34
labelString =
m_cleaningLevel
+
"_EMTopo"
;
35
}
36
else
{}
37
38
m_evtInfoDecor
=
m_evtKey
.key() +
"."
+
m_prefix
+
"eventClean_"
+labelString;
39
ATH_CHECK
(
m_evtInfoDecor
.initialize(
m_doEvent
));
40
return
StatusCode::SUCCESS;
41
}
42
43
//-----------------------------------------------------------------------------
44
// Execute
45
//-----------------------------------------------------------------------------
46
StatusCode
EventCleaningTestAlg::execute
(
const
EventContext& ctx)
47
{
48
// Jets
49
SG::ReadHandle<xAOD::JetContainer>
jets{
m_jetKey
, ctx};
50
if
(!jets.isValid()) {
51
ATH_MSG_FATAL
(
"Failed to retrieve jet collection "
<<
m_jetKey
.fullKey());
52
return
StatusCode::FAILURE;
53
}
54
// Apply the event cleaning
55
bool
result =
m_ecTool
->acceptEvent(jets.cptr());
56
57
//Decorate event
58
if
(
m_doEvent
){
59
SG::WriteDecorHandle<xAOD::EventInfo, char>
eventInfo{
m_evtInfoDecor
, ctx};
60
if
(!eventInfo.isValid()){
61
ATH_MSG_FATAL
(
"Failed to retrieve the event info "
<<
m_evtKey
.fullKey());
62
return
StatusCode::FAILURE;
63
}
64
eventInfo(*eventInfo) = result;
65
}
66
67
return
StatusCode::SUCCESS;
68
}
69
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
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
EventCleaningTestAlg.h
WriteDecorHandle.h
Handle class for adding a decoration to an object.
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
EventCleaningTestAlg::m_cleaningLevel
Gaudi::Property< std::string > m_cleaningLevel
Definition
EventCleaningTestAlg.h:50
EventCleaningTestAlg::execute
virtual StatusCode execute(const EventContext &ctx) override
Execute the algorithm.
Definition
EventCleaningTestAlg.cxx:46
EventCleaningTestAlg::m_evtInfoDecor
SG::WriteDecorHandleKey< xAOD::EventInfo > m_evtInfoDecor
Definition
EventCleaningTestAlg.h:54
EventCleaningTestAlg::m_prefix
Gaudi::Property< std::string > m_prefix
Configuration.
Definition
EventCleaningTestAlg.h:48
EventCleaningTestAlg::m_doEvent
Gaudi::Property< bool > m_doEvent
Definition
EventCleaningTestAlg.h:52
EventCleaningTestAlg::EventCleaningTestAlg
EventCleaningTestAlg(const std::string &name, ISvcLocator *svcLoc)
Standard algorithm constructor.
Definition
EventCleaningTestAlg.cxx:15
EventCleaningTestAlg::m_ecTool
ToolHandle< ECUtils::IEventCleaningTool > m_ecTool
Definition
EventCleaningTestAlg.h:41
EventCleaningTestAlg::m_jetKey
SG::ReadHandleKey< xAOD::JetContainer > m_jetKey
Definition
EventCleaningTestAlg.h:43
EventCleaningTestAlg::initialize
virtual StatusCode initialize() override
Initialize the algorithm.
Definition
EventCleaningTestAlg.cxx:22
EventCleaningTestAlg::m_evtKey
SG::ReadHandleKey< xAOD::EventInfo > m_evtKey
Definition
EventCleaningTestAlg.h:45
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition
StoreGate/StoreGate/WriteDecorHandle.h:100
Generated on
for ATLAS Offline Software by
1.17.0