ATLAS Offline Software
OverlapRemovalAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
8 //
9 // includes
10 //
11 
13 
14 //
15 // method implementations
16 //
17 
18 namespace CP
19 {
20 
22  initialize ()
23  {
24  if (m_overlapRemovalDecoration.empty())
25  {
26  ANA_MSG_ERROR ("no overlap removal decoration name set");
27  return StatusCode::FAILURE;
28  }
29 
30  m_overlapRemovalAccessor = std::make_unique<SG::AuxElement::Accessor<char> > (m_overlapRemovalDecoration);
31 
32  ANA_CHECK (m_overlapTool.retrieve());
46  return StatusCode::SUCCESS;
47  }
48 
49 
50 
52  execute ()
53  {
54  for (const auto& sys : m_systematicsList.systematicsVector())
55  {
56  std::unordered_map<const xAOD::IParticleContainer *, const SysWriteSelectionHandle *> decorationsMap;
57 
58  const xAOD::ElectronContainer *electrons {nullptr};
60  {
63  decorationsMap.emplace(electrons, &m_electronsSelectionHandle);
64  }
65  const xAOD::MuonContainer *muons {nullptr};
66  if (m_muonsHandle)
67  {
68  ANA_CHECK (m_muonsHandle.getCopy (muons, sys));
70  decorationsMap.emplace(muons, &m_muonsSelectionHandle);
71  }
72  const xAOD::JetContainer *jets {nullptr};
73  if (m_jetsHandle)
74  {
75  ANA_CHECK (m_jetsHandle.getCopy (jets, sys));
77  decorationsMap.emplace(jets, &m_jetsSelectionHandle);
78  }
79  const xAOD::TauJetContainer *taus {nullptr};
80  if (m_tausHandle)
81  {
82  ANA_CHECK (m_tausHandle.getCopy (taus, sys));
84  decorationsMap.emplace(taus, &m_tausSelectionHandle);
85  }
86  const xAOD::PhotonContainer *photons {nullptr};
87  if (m_photonsHandle)
88  {
89  ANA_CHECK (m_photonsHandle.getCopy (photons, sys));
91  decorationsMap.emplace(photons, &m_photonsSelectionHandle);
92  }
93  const xAOD::JetContainer *fatJets {nullptr};
94  if (m_fatJetsHandle)
95  {
96  ANA_CHECK (m_fatJetsHandle.getCopy (fatJets, sys));
98  decorationsMap.emplace(fatJets, &m_fatJetsSelectionHandle);
99  }
100 
101  ATH_CHECK (m_overlapTool->removeOverlaps (electrons, muons, jets, taus,
102  photons, fatJets));
103 
104  // Re-decorate if needed
105  for (const auto &pair : decorationsMap)
106  {
107  for (const xAOD::IParticle *particle : *(pair.first))
108  {
109  (*(pair.second)).setBool
110  (*particle, (*m_overlapRemovalAccessor) (*particle), sys);
111  }
112  }
113  }
114 
115  return StatusCode::SUCCESS;
116  }
117 }
CP::OverlapRemovalAlg::m_muonsSelectionHandle
SysWriteSelectionHandle m_muonsSelectionHandle
Definition: OverlapRemovalAlg.h:59
CP::OverlapRemovalAlg::m_overlapTool
ToolHandle< ORUtils::IOverlapRemovalTool > m_overlapTool
The OR toolbox.
Definition: OverlapRemovalAlg.h:35
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
CP::OverlapRemovalAlg::m_systematicsList
SysListHandle m_systematicsList
the systematics list we run
Definition: OverlapRemovalAlg.h:39
CP::OverlapRemovalAlg::m_tausSelectionHandle
SysWriteSelectionHandle m_tausSelectionHandle
Definition: OverlapRemovalAlg.h:63
CP::OverlapRemovalAlg::m_fatJetsHandle
SysCopyHandle< const xAOD::JetContainer > m_fatJetsHandle
Definition: OverlapRemovalAlg.h:52
CP::OverlapRemovalAlg::execute
StatusCode execute() override
Definition: OverlapRemovalAlg.cxx:52
CP::OverlapRemovalAlg::m_overlapRemovalAccessor
std::unique_ptr< const SG::AuxElement::Accessor< char > > m_overlapRemovalAccessor
the accessor for m_overlapRemovalDecoration
Definition: OverlapRemovalAlg.h:76
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:294
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
CP::SysListHandle::systematicsVector
const std::vector< CP::SystematicSet > & systematicsVector() const
the list of systematics to loop over
Definition: SysListHandle.cxx:96
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
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
CP::OverlapRemovalAlg::m_fatJetsSelectionHandle
SysWriteSelectionHandle m_fatJetsSelectionHandle
Definition: OverlapRemovalAlg.h:67
CP::OverlapRemovalAlg::initialize
StatusCode initialize() override
Definition: OverlapRemovalAlg.cxx:22
CP::OverlapRemovalAlg::m_photonsHandle
SysCopyHandle< const xAOD::PhotonContainer > m_photonsHandle
Definition: OverlapRemovalAlg.h:50
CP::SysListHandle::initialize
::StatusCode initialize()
intialize this property
Definition: SysListHandle.cxx:69
OverlapRemovalAlg.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CP::OverlapRemovalAlg::m_photonsSelectionHandle
SysWriteSelectionHandle m_photonsSelectionHandle
Definition: OverlapRemovalAlg.h:65
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
CP::OverlapRemovalAlg::m_jetsSelectionHandle
SysWriteSelectionHandle m_jetsSelectionHandle
Definition: OverlapRemovalAlg.h:61
CP::OverlapRemovalAlg::m_electronsHandle
SysCopyHandle< const xAOD::ElectronContainer > m_electronsHandle
Definition: OverlapRemovalAlg.h:42
CP::OverlapRemovalAlg::m_electronsSelectionHandle
SysWriteSelectionHandle m_electronsSelectionHandle
the decoration for the overlap removal status
Definition: OverlapRemovalAlg.h:57
CP::OverlapRemovalAlg::m_overlapRemovalDecoration
Gaudi::Property< std::string > m_overlapRemovalDecoration
the tool output decoration for the overlap removal status
Definition: OverlapRemovalAlg.h:72
CP::OverlapRemovalAlg::m_tausHandle
SysCopyHandle< const xAOD::TauJetContainer > m_tausHandle
Definition: OverlapRemovalAlg.h:48
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
CP::OverlapRemovalAlg::m_muonsHandle
SysCopyHandle< const xAOD::MuonContainer > m_muonsHandle
Definition: OverlapRemovalAlg.h:44
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30
CP::OverlapRemovalAlg::m_jetsHandle
SysCopyHandle< const xAOD::JetContainer > m_jetsHandle
Definition: OverlapRemovalAlg.h:46
InDetDD::electrons
@ electrons
Definition: InDetDD_Defs.h:17
CP::SysWriteSelectionHandle::initialize
StatusCode initialize(SysListHandle &sysListHandle, const ISysHandleBase &objectHandle)
initialize the accessor
Definition: SysWriteSelectionHandle.cxx:34