ATLAS Offline Software
AsgSelectionAlg.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 //
10 // includes
11 //
12 
14 
16 
17 //
18 // method implementations
19 //
20 
21 namespace CP
22 {
23 
25  initialize ()
26  {
27  if (!m_selectionTool.empty())
28  {
29  ANA_CHECK (m_selectionTool.retrieve());
33  }
34 
39 
40  if (!m_selectionTool.empty())
41  {
42  asg::AcceptData blankAccept (&m_selectionTool->getAcceptInfo());
43  // Just in case this isn't initially set up as a failure clear it this one
44  // time. This only calls reset on the bitset
45  blankAccept.clear();
46  m_setOnFail = selectionFromAccept(blankAccept);
47 
48  if (!m_nameSvc.empty())
49  {
50  ANA_CHECK (m_nameSvc.retrieve());
51  ANA_CHECK (m_nameSvc->addAcceptInfo (m_particlesHandle.getNamePattern(), m_selectionHandle.getLabel(),
52  m_selectionTool->getAcceptInfo()));
53  }
54  }
55 
56  return StatusCode::SUCCESS;
57  }
58 
59 
60 
62  execute ()
63  {
64  for (const auto& sys : m_systematicsList.systematicsVector())
65  {
68 
69  const xAOD::IParticleContainer *particles = nullptr;
71  for (const xAOD::IParticle *particle : *particles)
72  {
74  {
75  if (!m_selectionTool.empty())
76  {
79  }
80  else
81  {
83  }
84  }
85  else
86  {
87  if (!m_selectionTool.empty())
88  {
90  }
91  else
92  {
94  }
95  }
96  }
97  }
98 
99  return StatusCode::SUCCESS;
100  }
101 }
CP::SysWriteSelectionHandle::setBits
void setBits(const SG::AuxElement &element, SelectionType selection, const CP::SystematicSet &sys) const
set the selection decoration
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
CP::AsgSelectionAlg::initialize
StatusCode initialize() override
Definition: AsgSelectionAlg.cxx:25
CP::selectionFromAccept
SelectionType selectionFromAccept(const asg::AcceptData &accept)
the selection decoration made from the given AcceptData object
Definition: SelectionHelpers.cxx:32
CP::SysListHandle::addSystematics
StatusCode addSystematics(const CP::SystematicSet &recommended, const CP::SystematicSet &affecting)
register a set of affecting variables for the current algorithm (usually obtained from an CP::ISystem...
Definition: SysListHandle.cxx:48
CP::AsgSelectionAlg::m_systematicsList
SysListHandle m_systematicsList
the systematics list we run
Definition: AsgSelectionAlg.h:68
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::SysWriteSelectionHandle::setBool
void setBool(const SG::AuxElement &element, bool selection, const CP::SystematicSet &sys) const
set the selection decoration
ISystematicsTool.h
CP::SysWriteSelectionHandle::getLabel
std::string getLabel() const
get the name/label of the decoration
Definition: SysWriteSelectionHandle.cxx:76
CP::AsgSelectionAlg::m_systematicsTool
ISystematicsTool * m_systematicsTool
the smearing tool cast to an ISystematicsTool
Definition: AsgSelectionAlg.h:64
CP::AsgSelectionAlg::m_nameSvc
ServiceHandle< ISelectionNameSvc > m_nameSvc
the ISelectionNameSvc
Definition: AsgSelectionAlg.h:87
CP::AsgSelectionAlg::m_particlesHandle
SysReadHandle< xAOD::IParticleContainer > m_particlesHandle
the particle continer we run on
Definition: AsgSelectionAlg.h:72
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
CP::AsgSelectionAlg::execute
StatusCode execute() override
Definition: AsgSelectionAlg.cxx:62
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
CP::AsgSelectionAlg::m_setOnFail
SelectionType m_setOnFail
the bits to set for an object failing the preselection
Definition: AsgSelectionAlg.h:91
CP::AsgSelectionAlg::m_preselection
SysReadSelectionHandle m_preselection
the preselection we apply to our input
Definition: AsgSelectionAlg.h:77
CP::AsgSelectionAlg::m_selectionHandle
SysWriteSelectionHandle m_selectionHandle
the decoration for the asg selection
Definition: AsgSelectionAlg.h:82
CP::ISystematicsTool
Interface for all CP tools supporting systematic variations.
Definition: ISystematicsTool.h:32
asg::AcceptData::clear
void clear()
Clear all bits.
Definition: AcceptData.h:54
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::AsgSelectionAlg::m_selectionTool
ToolHandle< IAsgSelectionTool > m_selectionTool
the smearing tool
Definition: AsgSelectionAlg.h:56
asg::AcceptData
Definition: AcceptData.h:30
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30
CP::ISystematicsTool::applySystematicVariation
virtual StatusCode applySystematicVariation(const SystematicSet &systConfig)=0
effects: configure this tool for the given list of systematic variations.
AsgSelectionAlg.h
CP::SysWriteSelectionHandle::initialize
StatusCode initialize(SysListHandle &sysListHandle, const ISysHandleBase &objectHandle)
initialize the accessor
Definition: SysWriteSelectionHandle.cxx:34