ATLAS Offline Software
SumNElNMuPtSelectorAlg.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 
8 
9 namespace CP {
10 
11  SumNElNMuPtSelectorAlg::SumNElNMuPtSelectorAlg(const std::string &name, ISvcLocator *pSvcLocator)
12  : EL::AnaAlgorithm(name, pSvcLocator)
13  {}
14 
21 
25 
26  m_signEnum = SignEnum::stringToOperator.at( m_sign );
27 
28  return StatusCode::SUCCESS;
29  }
30 
32  for (const auto &sys : m_systematicsList.systematicsVector()) {
33  // retrieve the EventInfo
34  const xAOD::EventInfo *evtInfo = nullptr;
35  ANA_CHECK(m_eventInfoHandle.retrieve(evtInfo, sys));
36 
37  // default-decorate EventInfo
38  m_decoration.setBool(*evtInfo, 0, sys);
39 
40  // check the preselection
41  if (m_preselection && !m_preselection.getBool(*evtInfo, sys))
42  continue;
43 
44  // retrieve the electron container
45  const xAOD::IParticleContainer *electrons = nullptr;
48  // retrieve the electron container
49  const xAOD::IParticleContainer *muons = nullptr;
50  if (m_muonsHandle)
51  ANA_CHECK(m_muonsHandle.retrieve(muons, sys));
52 
53  // apply the requested selection
54  int count = 0;
55  if (m_electronsHandle) {
56  for (const xAOD::IParticle *el : *electrons){
58  if (el->pt() > m_elptmin){
59  count++;
60  }
61  }
62  }
63  }
64  if (m_muonsHandle) {
65  for (const xAOD::IParticle *mu : *muons) {
67  if (mu->pt() > m_muptmin){
68  count++;
69  }
70  }
71  }
72  }
73 
74  // calculate decision
75  bool decision = SignEnum::checkValue(m_count.value(), m_signEnum, count);
76  m_decoration.setBool(*evtInfo, decision, sys);
77  }
78  return StatusCode::SUCCESS;
79  }
80 } // namespace CP
CP::SumNElNMuPtSelectorAlg::m_count
Gaudi::Property< int > m_count
the count of events desired
Definition: SumNElNMuPtSelectorAlg.h:48
CP::SumNElNMuPtSelectorAlg::m_sign
Gaudi::Property< std::string > m_sign
the sign against which to compare pT (GT, LT, etc)
Definition: SumNElNMuPtSelectorAlg.h:45
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
CP::SumNElNMuPtSelectorAlg::m_electronsHandle
CP::SysReadHandle< xAOD::IParticleContainer > m_electronsHandle
the electrons handle
Definition: SumNElNMuPtSelectorAlg.h:57
CP::SumNElNMuPtSelectorAlg::m_systematicsList
CP::SysListHandle m_systematicsList
the systematics list
Definition: SumNElNMuPtSelectorAlg.h:54
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
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
CP::SysWriteSelectionHandle::setBool
void setBool(const SG::AuxElement &element, bool selection, const CP::SystematicSet &sys) const
set the selection decoration
CP::SumNElNMuPtSelectorAlg::SumNElNMuPtSelectorAlg
SumNElNMuPtSelectorAlg(const std::string &name, ISvcLocator *pSvcLocator)
the standard constructor
Definition: SumNElNMuPtSelectorAlg.cxx:11
CP::SumNElNMuPtSelectorAlg::execute
virtual StatusCode execute() override
Definition: SumNElNMuPtSelectorAlg.cxx:31
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
SumNElNMuPtSelectorAlg.h
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition: AlgorithmWorkerData.h:24
CP::SumNElNMuPtSelectorAlg::m_electronSelection
CP::SysReadSelectionHandle m_electronSelection
the electrons selection
Definition: SumNElNMuPtSelectorAlg.h:62
SignEnum::checkValue
bool checkValue(T reference, ComparisonOperator sign, T test)
the comparison test given the specified sign and two test values
Definition: SignEnums.h:35
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
CP::SumNElNMuPtSelectorAlg::m_preselection
CP::SysReadSelectionHandle m_preselection
the preselection
Definition: SumNElNMuPtSelectorAlg.h:82
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
CP::SumNElNMuPtSelectorAlg::m_elptmin
Gaudi::Property< float > m_elptmin
the pT threshold on which to select electrons
Definition: SumNElNMuPtSelectorAlg.h:39
CP::SumNElNMuPtSelectorAlg::initialize
virtual StatusCode initialize() override
Definition: SumNElNMuPtSelectorAlg.cxx:15
CP::SumNElNMuPtSelectorAlg::m_decoration
CP::SysWriteSelectionHandle m_decoration
the output selection decoration
Definition: SumNElNMuPtSelectorAlg.h:87
CP::SysReadSelectionHandle::initialize
StatusCode initialize(SysListHandle &sysListHandle, const ISysHandleBase &objectHandle)
initialize the accessor
Definition: SysReadSelectionHandle.cxx:34
CP::SumNElNMuPtSelectorAlg::m_muptmin
Gaudi::Property< float > m_muptmin
the pT threshold on which to select electrons
Definition: SumNElNMuPtSelectorAlg.h:42
CP::SumNElNMuPtSelectorAlg::m_muonSelection
CP::SysReadSelectionHandle m_muonSelection
the muons selection
Definition: SumNElNMuPtSelectorAlg.h:72
CP::SumNElNMuPtSelectorAlg::m_eventInfoHandle
CP::SysReadHandle< xAOD::EventInfo > m_eventInfoHandle
the event info handle
Definition: SumNElNMuPtSelectorAlg.h:77
CaloNoise_fillDB.mu
mu
Definition: CaloNoise_fillDB.py:53
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30
CP::SumNElNMuPtSelectorAlg::m_muonsHandle
CP::SysReadHandle< xAOD::IParticleContainer > m_muonsHandle
the muons handle
Definition: SumNElNMuPtSelectorAlg.h:67
InDetDD::electrons
@ electrons
Definition: InDetDD_Defs.h:17
CP::SumNElNMuPtSelectorAlg::m_signEnum
SignEnum::ComparisonOperator m_signEnum
the operator version of the comparison (>, <, etc)
Definition: SumNElNMuPtSelectorAlg.h:51
CP::SysWriteSelectionHandle::initialize
StatusCode initialize(SysListHandle &sysListHandle, const ISysHandleBase &objectHandle)
initialize the accessor
Definition: SysWriteSelectionHandle.cxx:34