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  // accessors
33  static const SG::AuxElement::ConstAccessor<float> acc_pt_dressed("pt_dressed");
34 
35  for (const auto &sys : m_systematicsList.systematicsVector()) {
36  // retrieve the EventInfo
37  const xAOD::EventInfo *evtInfo = nullptr;
38  ANA_CHECK(m_eventInfoHandle.retrieve(evtInfo, sys));
39 
40  // default-decorate EventInfo
41  m_decoration.setBool(*evtInfo, 0, sys);
42 
43  // check the preselection
44  if (m_preselection && !m_preselection.getBool(*evtInfo, sys))
45  continue;
46 
47  // retrieve the electron container
48  const xAOD::IParticleContainer *electrons = nullptr;
51  // retrieve the electron container
52  const xAOD::IParticleContainer *muons = nullptr;
53  if (m_muonsHandle)
54  ANA_CHECK(m_muonsHandle.retrieve(muons, sys));
55 
56  // apply the requested selection
57  int count = 0;
58  if (m_electronsHandle) {
59  for (const xAOD::IParticle *el : *electrons){
62  if (acc_pt_dressed(*el) > m_elptmin) count++;
63  } else {
64  if (el->pt() > m_elptmin) count++;
65  }
66  }
67  }
68  }
69  if (m_muonsHandle) {
70  for (const xAOD::IParticle *mu : *muons) {
73  if (acc_pt_dressed(*mu) > m_muptmin) count++;
74  } else {
75  if (mu->pt() > m_muptmin) count++;
76  }
77  }
78  }
79  }
80 
81  // calculate decision
82  bool decision = SignEnum::checkValue(m_count.value(), m_signEnum, count);
83  m_decoration.setBool(*evtInfo, decision, sys);
84  }
85  return StatusCode::SUCCESS;
86  }
87 } // 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:62
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
CP::SumNElNMuPtSelectorAlg::m_systematicsList
CP::SysListHandle m_systematicsList
the systematics list
Definition: SumNElNMuPtSelectorAlg.h:59
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
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:67
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:794
CP::SumNElNMuPtSelectorAlg::m_preselection
CP::SysReadSelectionHandle m_preselection
the preselection
Definition: SumNElNMuPtSelectorAlg.h:87
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
CP::SumNElNMuPtSelectorAlg::m_useDressedProperties
Gaudi::Property< bool > m_useDressedProperties
use dressed kinematics
Definition: SumNElNMuPtSelectorAlg.h:51
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:92
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:77
CP::SumNElNMuPtSelectorAlg::m_eventInfoHandle
CP::SysReadHandle< xAOD::EventInfo > m_eventInfoHandle
the event info handle
Definition: SumNElNMuPtSelectorAlg.h:82
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:72
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:56
CP::SysWriteSelectionHandle::initialize
StatusCode initialize(SysListHandle &sysListHandle, const ISysHandleBase &objectHandle)
initialize the accessor
Definition: SysWriteSelectionHandle.cxx:34