ATLAS Offline Software
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 
8 
9 // System include(s):
10 #include <iomanip>
11 
12 namespace CP {
13 
15 
16  // Return the internal object.
17  return m_accept;
18  }
19 
21  accept( const xAOD::IParticle* part ) const {
22 
23  // Reset the decision object.
25 
26  // Cast the particle to an e/gamma type.
27  const xAOD::Egamma* eg = nullptr;
28  if( ( part->type() != xAOD::Type::Electron ) &&
29  ( part->type() != xAOD::Type::Photon ) ) {
30  ATH_MSG_WARNING( "Non-e/gamma object received" );
31  return accept;
32  }
33  eg = static_cast< const xAOD::Egamma* >( part );
34 
35  // Calculate the decision.
36  accept.setCutResult( m_oqCutIndex, eg->isGoodOQ( m_mask ) );
37 
38  // Cut based on the dead HV Tool removal
40 
41  // Return the internal object.
42  return accept;
43  }
44 
46 
47  // Tell the user what is going to happen.
48  ATH_MSG_INFO( "Selecting e/gamma objects with OQ mask: 0x"
49  << std::hex << m_mask );
50 
51  // Set up the TAccept object.
52  m_oqCutIndex = m_accept.addCut( "EgammaOQ", "Egamma object quality cut" );
53  m_deadHVCutIndex = m_accept.addCut("notDeadHV", "Egamma dead HV removal cut");
54 
55  // Set up the dead HV Removal Tool
56  m_deadHVTool.setTypeAndName("AsgDeadHVCellRemovalTool/deadHVTool");
57  if (m_deadHVTool.retrieve().isFailure()){
58  ANA_MSG_ERROR("Failed to retrieve DeadHVTool, aborting");
59  return StatusCode::FAILURE;
60  }
61 
62 
63  // Return gracefully.
64  return StatusCode::SUCCESS;
65  }
66 
67 } // namespace CP
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
CP::EgammaIsGoodOQSelectionTool::m_deadHVCutIndex
int m_deadHVCutIndex
Index of this quality cut.
Definition: EgammaIsGoodOQSelectionTool.h:80
xAOD::Electron
Electron_v1 Electron
Definition of the current "egamma version".
Definition: Event/xAOD/xAODEgamma/xAODEgamma/Electron.h:17
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
ParticleTest.eg
eg
Definition: ParticleTest.py:29
IAsgDeadHVCellRemovalTool::accept
virtual bool accept(const xAOD::Egamma *part) const =0
asg::AnaToolHandle::retrieve
StatusCode retrieve()
initialize the tool
asg::AnaToolHandle::setTypeAndName
void setTypeAndName(const std::string &val_typeAndName)
set the value of type and name
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:294
xAOD::Egamma_v1
Definition: Egamma_v1.h:56
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:40
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
CP::EgammaIsGoodOQSelectionTool::initialize
virtual StatusCode initialize() override
Function initialising the tool.
Definition: EgammaIsGoodOQSelectionTool.cxx:45
CP::EgammaIsGoodOQSelectionTool::m_oqCutIndex
int m_oqCutIndex
Index of the object quality cut.
Definition: EgammaIsGoodOQSelectionTool.h:72
asg::AcceptInfo
Definition: AcceptInfo.h:28
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::Photon
Photon_v1 Photon
Definition of the current "egamma version".
Definition: Event/xAOD/xAODEgamma/xAODEgamma/Photon.h:17
asg::AcceptData::setCutResult
void setCutResult(const std::string &cutName, bool cutResult)
Set the result of a cut, based on the cut name (safer)
Definition: AcceptData.h:134
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
CP::EgammaIsGoodOQSelectionTool::m_mask
Gaudi::Property< int > m_mask
The mask to require good object quality with.
Definition: EgammaIsGoodOQSelectionTool.h:65
CP::EgammaIsGoodOQSelectionTool::m_deadHVTool
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...
Definition: EgammaIsGoodOQSelectionTool.h:76
CP::EgammaIsGoodOQSelectionTool::accept
virtual asg::AcceptData accept(const xAOD::IParticle *part) const override
Get the results for a given particle.
Definition: EgammaIsGoodOQSelectionTool.cxx:21
EgammaIsGoodOQSelectionTool.h
CP::EgammaIsGoodOQSelectionTool::m_accept
asg::AcceptInfo m_accept
Object handling the e/gamma selection decision.
Definition: EgammaIsGoodOQSelectionTool.h:70
asg::AcceptData
Definition: AcceptData.h:30
CP::EgammaIsGoodOQSelectionTool::getAcceptInfo
virtual const asg::AcceptInfo & getAcceptInfo() const override
Get the results for the last object processed.
Definition: EgammaIsGoodOQSelectionTool.cxx:14
asg::AcceptInfo::addCut
int addCut(const std::string &cutName, const std::string &cutDescription)
Add a cut; returning the cut position.
Definition: AcceptInfo.h:53