ATLAS Offline Software
NObjectMassSelectorAlg.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 
8 
9 namespace CP {
10 
11  NObjectMassSelectorAlg::NObjectMassSelectorAlg(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  for (const auto &sys : m_systematicsList.systematicsVector()) {
31  // retrieve the EventInfo
32  const xAOD::EventInfo *evtInfo = nullptr;
33  ANA_CHECK(m_eventInfoHandle.retrieve(evtInfo, sys));
34 
35  // default-decorate EventInfo
36  m_decoration.setBool(*evtInfo, 0, sys);
37 
38  // check the preselection
39  if (m_preselection && !m_preselection.getBool(*evtInfo, sys))
40  continue;
41 
42  // retrieve the object container
43  const xAOD::IParticleContainer *objects = nullptr;
45 
46  // apply and calculate the decision
47  int count = 0;
48  for (const xAOD::IParticle *obj : *objects){
50  if (obj->m() > m_minmass){
51  count++;
52  }
53  }
54  }
55 
56  bool decision = SignEnum::checkValue(m_count.value(), m_signEnum, count);
57  m_decoration.setBool(*evtInfo, decision, sys);
58  }
59  return StatusCode::SUCCESS;
60  }
61 } // namespace CP
CP::NObjectMassSelectorAlg::m_preselection
CP::SysReadSelectionHandle m_preselection
the preselection
Definition: NObjectMassSelectorAlg.h:72
LArConditions2Ntuple.objects
objects
Definition: LArConditions2Ntuple.py:56
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
CP::NObjectMassSelectorAlg::execute
virtual StatusCode execute() override
Definition: NObjectMassSelectorAlg.cxx:29
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::NObjectMassSelectorAlg::m_systematicsList
CP::SysListHandle m_systematicsList
the systematics list
Definition: NObjectMassSelectorAlg.h:54
CP::NObjectMassSelectorAlg::m_objectsHandle
CP::SysReadHandle< xAOD::IParticleContainer > m_objectsHandle
the object input handle
Definition: NObjectMassSelectorAlg.h:57
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
CP::NObjectMassSelectorAlg::NObjectMassSelectorAlg
NObjectMassSelectorAlg(const std::string &name, ISvcLocator *pSvcLocator)
the standard constructor
Definition: NObjectMassSelectorAlg.cxx:11
CP::NObjectMassSelectorAlg::m_sign
Gaudi::Property< std::string > m_sign
the sign against which to compare pT (GT, LT, etc)
Definition: NObjectMassSelectorAlg.h:45
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition: AlgorithmWorkerData.h:24
CP::NObjectMassSelectorAlg::m_count
Gaudi::Property< int > m_count
the count of events desired
Definition: NObjectMassSelectorAlg.h:48
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::NObjectMassSelectorAlg::initialize
virtual StatusCode initialize() override
Definition: NObjectMassSelectorAlg.cxx:15
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
CP::NObjectMassSelectorAlg::m_decoration
CP::SysWriteSelectionHandle m_decoration
the output selection decoration
Definition: NObjectMassSelectorAlg.h:77
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
CP::NObjectMassSelectorAlg::m_signEnum
SignEnum::ComparisonOperator m_signEnum
the operator version of the comparison (>, <, etc)
Definition: NObjectMassSelectorAlg.h:51
CP::NObjectMassSelectorAlg::m_objectSelection
CP::SysReadSelectionHandle m_objectSelection
the object selection handle
Definition: NObjectMassSelectorAlg.h:62
NObjectMassSelectorAlg.h
CP::SysReadSelectionHandle::initialize
StatusCode initialize(SysListHandle &sysListHandle, const ISysHandleBase &objectHandle)
initialize the accessor
Definition: SysReadSelectionHandle.cxx:34
python.PyAthena.obj
obj
Definition: PyAthena.py:135
CP::NObjectMassSelectorAlg::m_eventInfoHandle
CP::SysReadHandle< xAOD::EventInfo > m_eventInfoHandle
the event info handle
Definition: NObjectMassSelectorAlg.h:67
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
CP::NObjectMassSelectorAlg::m_minmass
Gaudi::Property< float > m_minmass
the pT threshold on which to select
Definition: NObjectMassSelectorAlg.h:42