ATLAS Offline Software
NObjectPtSelectorAlg.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  NObjectPtSelectorAlg::NObjectPtSelectorAlg(const std::string &name, ISvcLocator *pSvcLocator)
12  : EL::AnaAlgorithm(name, pSvcLocator)
13  {}
14 
19 
23 
24  m_signEnum = SignEnum::stringToOperator.at( m_sign );
25 
26  return StatusCode::SUCCESS;
27  }
28 
30  // accessors
31  static const SG::AuxElement::ConstAccessor<float> acc_pt_dressed("pt_dressed");
32 
33  for (const auto &sys : m_systematicsList.systematicsVector()) {
34  // retrieve the EventInfo
35  const xAOD::EventInfo *evtInfo = nullptr;
36  ANA_CHECK(m_eventInfoHandle.retrieve(evtInfo, sys));
37 
38  // default-decorate EventInfo
39  m_decoration.setBool(*evtInfo, 0, sys);
40 
41  // check the preselection
42  if (m_preselection && !m_preselection.getBool(*evtInfo, sys))
43  continue;
44 
45  // retrieve the object container
46  const xAOD::IParticleContainer *objects = nullptr;
48 
49  // apply and calculate the decision
50  int count = 0;
51  for (const xAOD::IParticle *obj : *objects){
54  if (acc_pt_dressed(*obj) > m_ptmin) count++;
55  } else {
56  if (obj->pt() > m_ptmin) count++;
57  }
58  }
59  }
60 
61  bool decision = SignEnum::checkValue(m_count.value(), m_signEnum, count);
62  m_decoration.setBool(*evtInfo, decision, sys);
63  }
64  return StatusCode::SUCCESS;
65  }
66 } // namespace CP
LArConditions2Ntuple.objects
objects
Definition: LArConditions2Ntuple.py:59
CP::NObjectPtSelectorAlg::m_useDressedProperties
Gaudi::Property< bool > m_useDressedProperties
use dressed kinematics
Definition: NObjectPtSelectorAlg.h:51
CP::NObjectPtSelectorAlg::NObjectPtSelectorAlg
NObjectPtSelectorAlg(const std::string &name, ISvcLocator *pSvcLocator)
the standard constructor
Definition: NObjectPtSelectorAlg.cxx:11
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
CP::SysListHandle::systematicsVector
const std::vector< CP::SystematicSet > & systematicsVector() const
the list of systematics to loop over
Definition: SysListHandle.cxx:96
CP::NObjectPtSelectorAlg::m_signEnum
SignEnum::ComparisonOperator m_signEnum
the operator version of the comparison (>, <, etc)
Definition: NObjectPtSelectorAlg.h:56
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
NObjectPtSelectorAlg.h
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::NObjectPtSelectorAlg::initialize
virtual StatusCode initialize() override
Definition: NObjectPtSelectorAlg.cxx:15
CP::NObjectPtSelectorAlg::m_systematicsList
CP::SysListHandle m_systematicsList
the systematics list
Definition: NObjectPtSelectorAlg.h:59
CP::NObjectPtSelectorAlg::m_objectSelection
CP::SysReadSelectionHandle m_objectSelection
the object selection handle
Definition: NObjectPtSelectorAlg.h:67
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
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition: AlgorithmWorkerData.h:24
CP::NObjectPtSelectorAlg::m_objectsHandle
CP::SysReadHandle< xAOD::IParticleContainer > m_objectsHandle
the object input handle
Definition: NObjectPtSelectorAlg.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:794
CP::NObjectPtSelectorAlg::m_decoration
CP::SysWriteSelectionHandle m_decoration
the output selection decoration
Definition: NObjectPtSelectorAlg.h:82
CP::NObjectPtSelectorAlg::m_eventInfoHandle
CP::SysReadHandle< xAOD::EventInfo > m_eventInfoHandle
the event info handle
Definition: NObjectPtSelectorAlg.h:72
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
CP::NObjectPtSelectorAlg::m_ptmin
Gaudi::Property< float > m_ptmin
the pT threshold on which to select
Definition: NObjectPtSelectorAlg.h:42
CP::NObjectPtSelectorAlg::m_sign
Gaudi::Property< std::string > m_sign
the sign against which to compare pT (GT, LT, etc)
Definition: NObjectPtSelectorAlg.h:45
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
CP::SysReadSelectionHandle::initialize
StatusCode initialize(SysListHandle &sysListHandle, const ISysHandleBase &objectHandle)
initialize the accessor
Definition: SysReadSelectionHandle.cxx:34
CP::NObjectPtSelectorAlg::execute
virtual StatusCode execute() override
Definition: NObjectPtSelectorAlg.cxx:29
CP::NObjectPtSelectorAlg::m_preselection
CP::SysReadSelectionHandle m_preselection
the preselection
Definition: NObjectPtSelectorAlg.h:77
CP::NObjectPtSelectorAlg::m_count
Gaudi::Property< int > m_count
the count of events desired
Definition: NObjectPtSelectorAlg.h:48
python.PyAthena.obj
obj
Definition: PyAthena.py:132
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30
CP::SysWriteSelectionHandle::initialize
StatusCode initialize(SysListHandle &sysListHandle, const ISysHandleBase &objectHandle)
initialize the accessor
Definition: SysWriteSelectionHandle.cxx:34