ATLAS Offline Software
AsgUnionPreselectionAlg.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 // includes
9 //
10 
12 
13 #include <xAODBase/IParticle.h>
14 
15 //
16 // method implementations
17 //
18 
19 namespace CP
20 {
21 
23  initialize ()
24  {
25  if (m_selectionDecoration.empty())
26  {
27  ANA_MSG_ERROR("Selection decoration can not be empty.");
28  return StatusCode::FAILURE;
29  }
30  if (m_preselection.empty())
31  {
32  ANA_MSG_ERROR("Preselection can not be empty.");
33  return StatusCode::FAILURE;
34  }
35 
39 
41 
42  return StatusCode::SUCCESS;
43  }
44 
45 
46 
48  execute ()
49  {
50  // first loop through systematics and set the default selection
51  for (const auto& sys : m_systematicsList.systematicsVector())
52  {
53  const xAOD::IParticleContainer *particles = nullptr;
55  for (auto *particle : *particles)
56  {
57  (*m_decorator) (*particle) = false;
58  }
59  }
60 
61  // second loop through systematics, and set the selection to true if
62  // particle passes the selection
63  for (const auto& sys : m_systematicsList.systematicsVector())
64  {
65  const xAOD::IParticleContainer *particles = nullptr;
67  for (auto *particle : *particles)
68  {
70  (*m_decorator) (*particle) = true;
71  }
72  }
73 
74  return StatusCode::SUCCESS;
75  }
76 
77 } // namespace CP
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
IParticle.h
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:294
AsgUnionPreselectionAlg.h
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
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
CP::AsgUnionPreselectionAlg::m_selectionDecoration
Gaudi::Property< std::string > m_selectionDecoration
the decoration of the selection
Definition: AsgUnionPreselectionAlg.h:67
CP::SysListHandle::initialize
::StatusCode initialize()
intialize this property
Definition: SysListHandle.cxx:69
CP::SysReadSelectionHandle::getBool
bool getBool(const SG::AuxElement &element, const CP::SystematicSet &sys) const
get the selection as a bool
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CP::AsgUnionPreselectionAlg::m_particlesHandle
SysReadHandle< xAOD::IParticleContainer > m_particlesHandle
the particle continer we run on
Definition: AsgUnionPreselectionAlg.h:57
CP::AsgUnionPreselectionAlg::initialize
virtual StatusCode initialize() override
Definition: AsgUnionPreselectionAlg.cxx:23
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
CP::SysReadSelectionHandle::empty
virtual bool empty() const noexcept override
Definition: SysReadSelectionHandle.cxx:68
CP::SysReadSelectionHandle::initialize
StatusCode initialize(SysListHandle &sysListHandle, const ISysHandleBase &objectHandle)
initialize the accessor
Definition: SysReadSelectionHandle.cxx:34
LArG4FSStartPointFilter.particles
list particles
Definition: LArG4FSStartPointFilter.py:84
CP::AsgUnionPreselectionAlg::m_decorator
std::optional< SG::AuxElement::Decorator< char > > m_decorator
the accessor for m_selectionDecoration
Definition: AsgUnionPreselectionAlg.h:71
CP::AsgUnionPreselectionAlg::m_preselection
SysReadSelectionHandle m_preselection
the preselection we apply to our input
Definition: AsgUnionPreselectionAlg.h:62
CP::AsgUnionPreselectionAlg::execute
virtual StatusCode execute() override
Definition: AsgUnionPreselectionAlg.cxx:48
CP::AsgUnionPreselectionAlg::m_systematicsList
SysListHandle m_systematicsList
the systematics list we run and have containers
Definition: AsgUnionPreselectionAlg.h:53