ATLAS Offline Software
Loading...
Searching...
No Matches
EgammaIsGoodOQSelectionTool.cxx
Go to the documentation of this file.
1//
2// Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3//
4
5// Local include(s):
7
10
11// System include(s):
12#include <iomanip>
13
14namespace CP {
15
17
18 // Return the internal object.
19 return m_accept;
20 }
21
23 accept( const xAOD::IParticle* part ) const {
24
25 // Reset the decision object.
27
28 // Cast the particle to an e/gamma type.
29 const xAOD::Egamma* eg = nullptr;
30 if( ( part->type() != xAOD::Type::Electron ) &&
31 ( part->type() != xAOD::Type::Photon ) ) {
32 ATH_MSG_WARNING( "Non-e/gamma object received" );
33 return accept;
34 }
35 eg = static_cast< const xAOD::Egamma* >( part );
36
37 // Calculate the decision.
38 accept.setCutResult( m_oqCutIndex, eg->isGoodOQ( m_mask ) );
39
40 // Cut based on the dead HV Tool removal
41 accept.setCutResult(m_deadHVCutIndex, m_deadHVTool->accept(eg));
42
43 // Return the internal object.
44 return accept;
45 }
46
48
49 // Tell the user what is going to happen.
50 ATH_MSG_INFO( "Selecting e/gamma objects with OQ mask: 0x"
51 << std::hex << m_mask );
52
53 // Set up the TAccept object.
54 m_oqCutIndex = m_accept.addCut( "EgammaOQ", "Egamma object quality cut" );
55 m_deadHVCutIndex = m_accept.addCut("notDeadHV", "Egamma dead HV removal cut");
56
57 // Set up the dead HV Removal Tool
58 m_deadHVTool.setTypeAndName("AsgDeadHVCellRemovalTool/deadHVTool");
59 if (m_deadHVTool.retrieve().isFailure()){
60 ANA_MSG_ERROR("Failed to retrieve DeadHVTool, aborting");
61 return StatusCode::FAILURE;
62 }
63
64#ifndef XAOD_STANDALONE
65 // Declare dependency on RandomRunNumber for MC (used by deadHVTool)
66 // Not doing this in the tool itself, since it is a public tool and
67 // for public tools the dependencies don't get properly propagated
68 SG::ReadDecorHandleKey<xAOD::EventInfo> randomRunNumberKey{ "EventInfo.RandomRunNumber" };
69 addDependency(randomRunNumberKey.fullKey(), Gaudi::DataHandle::Reader);
70#endif
71
72 // Return gracefully.
73 return StatusCode::SUCCESS;
74 }
75
76} // namespace CP
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(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.
asg::AcceptInfo m_accept
Object handling the e/gamma selection decision.
virtual const asg::AcceptInfo & getAcceptInfo() const override
Get the results for the last object processed.
int m_oqCutIndex
Index of the object quality cut.
asg::AnaToolHandle< IAsgDeadHVCellRemovalTool > m_deadHVTool
The tool that selects on dead HV from the 2016 run, acc. to https://twiki.cern.ch/twiki/bin/view/Atla...
virtual asg::AcceptData accept(const xAOD::IParticle *part) const override
Get the results for a given particle.
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.
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