ATLAS Offline Software
Loading...
Searching...
No Matches
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):
7
11
12namespace CP {
13
17
19
20 // Return the internal object.
21 return m_accept;
22 }
23
25 accept( const xAOD::IParticle* part ) const {
26
27 // Reset the decision object.
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
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
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_INFO(x,...)
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
#define ANA_MSG_ERROR(xmsg,...)
Macro printing error messages.
#define ANA_CHECK(EXP)
check whether the given expression was successful
asg::AcceptInfo m_accept
Object handling the e/gamma selection decision.
EgammaIsGoodOQSelectionTool(const std::string &name)
Declare the tool's interface to Gaudi.
virtual const asg::AcceptInfo & getAcceptInfo() const override
Get the results for the last object processed.
int m_oqCutIndex
Index of the object quality cut.
virtual asg::AcceptData accept(const xAOD::IParticle *part) const override
Get the results for a given particle.
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...
Gaudi::Property< int > m_mask
The mask to require good object quality with.
int m_deadHVCutIndex
Index of this quality cut.
virtual StatusCode initialize() override
Function initialising the tool.
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
an object that can create a AsgTool
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition AsgTool.cxx:58
bool isGoodOQ(uint32_t mask) const
Check object quality. Return True is it is Good Object Quality.
Class providing the definition of the 4-vector interface.
Select isolated Photons, Electrons and Muons.
@ Photon
The object is a photon.
Definition ObjectType.h:47
@ Electron
The object is an electron.
Definition ObjectType.h:46
Egamma_v1 Egamma
Definition of the current "egamma version".
Definition Egamma.h:17