ATLAS Offline Software
Loading...
Searching...
No Matches
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
21namespace CP
22{
23 CopyNominalSelectionAlg ::
24 CopyNominalSelectionAlg (const std::string& name,
25 ISvcLocator* pSvcLocator)
26 : AnaAlgorithm (name, pSvcLocator)
27 {}
28
29
30
31 StatusCode CopyNominalSelectionAlg ::
32 initialize ()
33 {
37 ANA_CHECK (m_systematicsList.initialize());
38
40 ANA_CHECK (m_readAccessor->fillSystematics (m_systematicsList.service(), m_systematicsList.systematicsVector(), "^$"));
41
42 return StatusCode::SUCCESS;
43 }
44
45
46
47 StatusCode CopyNominalSelectionAlg ::
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;
61 ANA_CHECK (m_particlesHandle.retrieve (particles, sys));
62 for (std::size_t index = 0u; index != particles->size(); ++ index)
63 {
64 const xAOD::IParticle *particle = particles->at (index);
65 if (m_preselection.getBool (*particle, sys))
66 {
67 bool passedNominal = m_readAccessor->getBool (*nominal->at(index), &emptySys);
68 m_selectionHandle.setBool (*particle, passedNominal, sys);
69 }
70 else
71 {
72 m_selectionHandle.setBool (*particle, false, sys);
73 }
74 }
75 }
76 }
77
78 return StatusCode::SUCCESS;
79 }
80}
#define ANA_CHECK(EXP)
check whether the given expression was successful
SysReadSelectionHandle m_preselection
the preselection we apply to our input
SysWriteSelectionHandle m_selectionHandle
the decoration for the asg selection
SysReadHandle< xAOD::IParticleContainer > m_particlesHandle
the particle continer we run on
std::unique_ptr< ISelectionReadAccessor > m_readAccessor
the accessor we use
SysListHandle m_systematicsList
the systematics list we run
Class to wrap a set of SystematicVariations.
const T * at(size_type n) const
Access an element, as an rvalue.
AnaAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
Class providing the definition of the 4-vector interface.
Select isolated Photons, Electrons and Muons.
StatusCode makeSelectionReadAccessor(const std::string &expr, std::unique_ptr< ISelectionReadAccessor > &accessor, bool defaultToChar)
make the ISelectionReadAccessor for the given name
Definition index.py:1
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.