ATLAS Offline Software
CopyNominalSelectionAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 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 {
24  CopyNominalSelectionAlg (const std::string& name,
25  ISvcLocator* pSvcLocator)
26  : AnaAlgorithm (name, pSvcLocator)
27  {}
28 
29 
30 
32  initialize ()
33  {
38 
41 
42  return StatusCode::SUCCESS;
43  }
44 
45 
46 
48  execute ()
49  {
50  static const SystematicSet emptySys;
51  const xAOD::IParticleContainer *nominal = nullptr;
52 
53  for (const auto& sys : m_systematicsList.systematicsVector())
54  {
55  if (sys.empty())
56  {
57  ANA_CHECK (m_particlesHandle.retrieve (nominal, sys));
58  } else
59  {
60  const xAOD::IParticleContainer *particles = nullptr;
62  for (std::size_t index = 0u; index != particles->size(); ++ index)
63  {
64  const xAOD::IParticle *particle = particles->at (index);
66  {
67  bool passedNominal = m_readAccessor->getBool (*nominal->at(index), &emptySys);
68  m_selectionHandle.setBool (*particle, passedNominal, sys);
69  }
70  else
71  {
73  }
74  }
75  }
76  }
77 
78  return StatusCode::SUCCESS;
79  }
80 }
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
CP::CopyNominalSelectionAlg::execute
StatusCode execute() override
Definition: CopyNominalSelectionAlg.cxx:48
CP::CopyNominalSelectionAlg::m_systematicsList
SysListHandle m_systematicsList
the systematics list we run
Definition: CopyNominalSelectionAlg.h:56
CP::CopyNominalSelectionAlg::CopyNominalSelectionAlg
CopyNominalSelectionAlg(const std::string &name, ISvcLocator *pSvcLocator)
the standard constructor
Definition: CopyNominalSelectionAlg.cxx:24
CP::SysWriteSelectionHandle::getSelection
const std::string & getSelection() const
get the actual selection string
Definition: SysWriteSelectionHandle.cxx:84
index
Definition: index.py:1
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
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:41
CP::CopyNominalSelectionAlg::initialize
StatusCode initialize() override
Definition: CopyNominalSelectionAlg.cxx:32
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
CP::CopyNominalSelectionAlg::m_readAccessor
std::unique_ptr< ISelectionReadAccessor > m_readAccessor
the accessor we use
Definition: CopyNominalSelectionAlg.h:75
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
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::CopyNominalSelectionAlg::m_selectionHandle
SysWriteSelectionHandle m_selectionHandle
the decoration for the asg selection
Definition: CopyNominalSelectionAlg.h:70
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
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
CP::makeSelectionReadAccessor
StatusCode makeSelectionReadAccessor(const std::string &expr, std::unique_ptr< ISelectionReadAccessor > &accessor, bool defaultToChar)
make the ISelectionReadAccessor for the given name
Definition: ISelectionAccessor.cxx:54
DeMoScan.index
string index
Definition: DeMoScan.py:364
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
DataVector::at
const T * at(size_type n) const
Access an element, as an rvalue.
CP::CopyNominalSelectionAlg::m_particlesHandle
SysReadHandle< xAOD::IParticleContainer > m_particlesHandle
the particle continer we run on
Definition: CopyNominalSelectionAlg.h:60
CopyNominalSelectionAlg.h
CP::CopyNominalSelectionAlg::m_preselection
SysReadSelectionHandle m_preselection
the preselection we apply to our input
Definition: CopyNominalSelectionAlg.h:65
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30
CP::SysListHandle::service
const ISystematicsSvc & service() const
the service we use
CP::SysWriteSelectionHandle::initialize
StatusCode initialize(SysListHandle &sysListHandle, const ISysHandleBase &objectHandle)
initialize the accessor
Definition: SysWriteSelectionHandle.cxx:34