ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
EgammaAnalysisAlgorithms
Root
EgammaIsGoodOQSelectionTool.cxx
Go to the documentation of this file.
1
//
2
// Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
//
4
5
// Local include(s):
6
#include "
EgammaAnalysisAlgorithms/EgammaIsGoodOQSelectionTool.h
"
7
8
#include "
AsgTools/AsgToolConfig.h
"
9
#include <
xAODEventInfo/EventInfo.h
>
10
#include <
AsgDataHandles/ReadDecorHandleKey.h
>
11
12
namespace
CP
{
13
14
EgammaIsGoodOQSelectionTool::EgammaIsGoodOQSelectionTool
(
const
std::string&
name
)
15
:
asg
::
AsgTool
(
name
) {
16
}
17
18
const
asg::AcceptInfo
&
EgammaIsGoodOQSelectionTool::getAcceptInfo
()
const
{
19
20
// Return the internal object.
21
return
m_accept
;
22
}
23
24
asg::AcceptData
EgammaIsGoodOQSelectionTool::
25
accept
(
const
xAOD::IParticle
* part )
const
{
26
27
// Reset the decision object.
28
asg::AcceptData
accept
{&
m_accept
};
29
30
// Cast the particle to an e/gamma type.
31
const
xAOD::Egamma
* eg =
nullptr
;
32
if
( ( part->type() !=
xAOD::Type::Electron
) &&
33
( part->type() !=
xAOD::Type::Photon
) ) {
34
ATH_MSG_WARNING
(
"Non-e/gamma object received"
);
35
return
accept
;
36
}
37
eg =
static_cast<
const
xAOD::Egamma
*
>
( part );
38
39
// Calculate the decision.
40
accept
.setCutResult(
m_oqCutIndex
, eg->
isGoodOQ
(
m_mask
) );
41
42
// Cut based on the dead HV Tool removal
43
accept
.setCutResult(
m_deadHVCutIndex
,
m_deadHVTool
->accept(eg));
44
45
// Return the internal object.
46
return
accept
;
47
}
48
49
StatusCode
EgammaIsGoodOQSelectionTool::initialize
() {
50
51
// Tell the user what is going to happen.
52
ATH_MSG_INFO
(
"Selecting e/gamma objects with OQ mask: 0x"
53
<< std::hex <<
m_mask
<< std::dec );
54
55
// Set up the TAccept object.
56
m_oqCutIndex
=
m_accept
.addCut(
"EgammaOQ"
,
"Egamma object quality cut"
);
57
m_deadHVCutIndex
=
m_accept
.addCut(
"notDeadHV"
,
"Egamma dead HV removal cut"
);
58
59
// Set up the dead HV Removal Tool
60
if
(
m_deadHVTool
.empty())
61
{
62
asg::AsgToolConfig
config(
"AsgDeadHVCellRemovalTool/deadHVTool"
);
63
ANA_CHECK
(config.makePrivateTool(
m_deadHVTool
));
64
}
65
if
(
m_deadHVTool
.retrieve().isFailure()){
66
ANA_MSG_ERROR
(
"Failed to retrieve DeadHVTool, aborting"
);
67
return
StatusCode::FAILURE;
68
}
69
70
#ifndef XAOD_STANDALONE
71
// Declare dependency on RandomRunNumber for MC (used by deadHVTool)
72
// Not doing this in the tool itself, since it is a public tool and
73
// for public tools the dependencies don't get properly propagated
74
SG::ReadDecorHandleKey<xAOD::EventInfo>
randomRunNumberKey{
"EventInfo.RandomRunNumber"
};
75
addDependency(randomRunNumberKey.fullKey(), Gaudi::DataHandle::Reader);
76
#endif
77
78
// Return gracefully.
79
return
StatusCode::SUCCESS;
80
}
81
82
}
// namespace CP
AsgToolConfig.h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x,...)
Definition
AthMsgStreamMacros.h:46
ATH_MSG_INFO
#define ATH_MSG_INFO(x,...)
Definition
AthMsgStreamMacros.h:45
ReadDecorHandleKey.h
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg,...)
Macro printing error messages.
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:295
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:325
EgammaIsGoodOQSelectionTool.h
CP::EgammaIsGoodOQSelectionTool::m_accept
asg::AcceptInfo m_accept
Object handling the e/gamma selection decision.
Definition
EgammaIsGoodOQSelectionTool.h:70
CP::EgammaIsGoodOQSelectionTool::EgammaIsGoodOQSelectionTool
EgammaIsGoodOQSelectionTool(const std::string &name)
Declare the tool's interface to Gaudi.
Definition
EgammaIsGoodOQSelectionTool.cxx:14
CP::EgammaIsGoodOQSelectionTool::getAcceptInfo
virtual const asg::AcceptInfo & getAcceptInfo() const override
Get the results for the last object processed.
Definition
EgammaIsGoodOQSelectionTool.cxx:18
CP::EgammaIsGoodOQSelectionTool::m_oqCutIndex
int m_oqCutIndex
Index of the object quality cut.
Definition
EgammaIsGoodOQSelectionTool.h:72
CP::EgammaIsGoodOQSelectionTool::accept
virtual asg::AcceptData accept(const xAOD::IParticle *part) const override
Get the results for a given particle.
Definition
EgammaIsGoodOQSelectionTool.cxx:25
CP::EgammaIsGoodOQSelectionTool::m_deadHVTool
ToolHandle< IAsgDeadHVCellRemovalTool > m_deadHVTool
The tool that selects on dead HV from the 2016 run, acc. to https://twiki.cern.ch/twiki/bin/view/Atla...
Definition
EgammaIsGoodOQSelectionTool.h:76
CP::EgammaIsGoodOQSelectionTool::m_mask
Gaudi::Property< int > m_mask
The mask to require good object quality with.
Definition
EgammaIsGoodOQSelectionTool.h:65
CP::EgammaIsGoodOQSelectionTool::m_deadHVCutIndex
int m_deadHVCutIndex
Index of this quality cut.
Definition
EgammaIsGoodOQSelectionTool.h:80
CP::EgammaIsGoodOQSelectionTool::initialize
virtual StatusCode initialize() override
Function initialising the tool.
Definition
EgammaIsGoodOQSelectionTool.cxx:49
SG::ReadDecorHandleKey
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Definition
StoreGate/StoreGate/ReadDecorHandleKey.h:86
asg::AcceptData
Definition
AcceptData.h:31
asg::AcceptInfo
Definition
AcceptInfo.h:28
asg::AsgToolConfig
an object that can create a AsgTool
Definition
AsgToolConfig.h:22
asg::AsgTool::AsgTool
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition
AsgTool.cxx:58
xAOD::Egamma_v1::isGoodOQ
bool isGoodOQ(uint32_t mask) const
Check object quality. Return True is it is Good Object Quality.
Definition
Egamma_v1.cxx:225
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
asg
Definition
DataHandleTestTool.h:28
xAODType::Photon
@ Photon
The object is a photon.
Definition
ObjectType.h:47
xAODType::Electron
@ Electron
The object is an electron.
Definition
ObjectType.h:46
xAOD::name
name
Definition
TriggerMenuJson_v1.cxx:29
xAOD::Egamma
Egamma_v1 Egamma
Definition of the current "egamma version".
Definition
Egamma.h:17
EventInfo.h
Generated on
for ATLAS Offline Software by
1.17.0