ATLAS Offline Software
JetNGhostSelectorAlg.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  JetNGhostSelectorAlg::JetNGhostSelectorAlg(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  m_ghostAcc = std::make_unique<SG::AuxElement::ConstAccessor<int>> (m_ghost.value());
27  if ( !m_veto.value().empty() ) {
28  m_vetoAcc= std::make_unique<SG::AuxElement::ConstAccessor<int>> (m_veto.value());
29  m_doVeto = true;
30  }
31 
32  return StatusCode::SUCCESS;
33  }
34 
36  for (const auto &sys : m_systematicsList.systematicsVector()) {
37  // retrieve the EventInfo
38  const xAOD::EventInfo *evtInfo = nullptr;
39  ANA_CHECK(m_eventInfoHandle.retrieve(evtInfo, sys));
40 
41  // default-decorate EventInfo
42  m_decoration.setBool(*evtInfo, 0, sys);
43 
44  // check the preselection
45  if (m_preselection && !m_preselection.getBool(*evtInfo, sys))
46  continue;
47 
48  // retrieve the jet container
49  const xAOD::JetContainer *jets = nullptr;
51 
52  // apply and calculate the decision
53  int count = 0;
54  for (const xAOD::Jet *jet : *jets){
56  if (jet->pt() > m_ptmin){
57  if (!m_ghostAcc->isAvailable(*jet)) {
58  ANA_MSG_ERROR ("Ghost decoration " << m_ghost.value() << " is not available on this jet!");
59  return StatusCode::FAILURE;
60  }
61  if (m_doVeto) {
62  if (!m_vetoAcc->isAvailable(*jet)) {
63  ANA_MSG_ERROR ("Ghost decoration " << m_veto.value() << " is not available on this jet!");
64  return StatusCode::FAILURE;
65  }
66  if ( (*m_vetoAcc)(*jet) > 0 ) continue;
67  }
68  if ( (*m_ghostAcc)(*jet) > 0 ) count++;
69  }
70  }
71  }
72 
73  bool decision = SignEnum::checkValue(m_count.value(), m_signEnum, count);
74  m_decoration.setBool(*evtInfo, decision, sys);
75  }
76  return StatusCode::SUCCESS;
77  }
78 } // namespace CP
CP::JetNGhostSelectorAlg::m_ptmin
Gaudi::Property< float > m_ptmin
the pT threshold on which to select
Definition: JetNGhostSelectorAlg.h:41
CP::JetNGhostSelectorAlg::m_signEnum
SignEnum::ComparisonOperator m_signEnum
the operator version of the comparison (>, <, etc)
Definition: JetNGhostSelectorAlg.h:60
CP::JetNGhostSelectorAlg::m_sign
Gaudi::Property< std::string > m_sign
the sign against which to compare pT (GT, LT, etc)
Definition: JetNGhostSelectorAlg.h:44
CP::JetNGhostSelectorAlg::JetNGhostSelectorAlg
JetNGhostSelectorAlg(const std::string &name, ISvcLocator *pSvcLocator)
the standard constructor
Definition: JetNGhostSelectorAlg.cxx:11
CP::JetNGhostSelectorAlg::m_jetSelection
CP::SysReadSelectionHandle m_jetSelection
the jet selection handle
Definition: JetNGhostSelectorAlg.h:71
CP::JetNGhostSelectorAlg::m_doVeto
bool m_doVeto
Definition: JetNGhostSelectorAlg.h:93
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:294
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
CP::SysReadHandle::retrieve
::StatusCode retrieve(const T *&object, const CP::SystematicSet &sys) const
retrieve the object for the given name
CP::SysListHandle::systematicsVector
const std::vector< CP::SystematicSet > & systematicsVector() const
the list of systematics to loop over
Definition: SysListHandle.cxx:96
CP::JetNGhostSelectorAlg::m_count
Gaudi::Property< int > m_count
the count of events desired
Definition: JetNGhostSelectorAlg.h:47
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::JetNGhostSelectorAlg::m_jetsHandle
CP::SysReadHandle< xAOD::JetContainer > m_jetsHandle
the jet input handle
Definition: JetNGhostSelectorAlg.h:66
CP::JetNGhostSelectorAlg::m_preselection
CP::SysReadSelectionHandle m_preselection
the preselection
Definition: JetNGhostSelectorAlg.h:81
CP::SysReadHandle::initialize
StatusCode initialize(SysListHandle &sysListHandle)
initialize this handle
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
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
CP::JetNGhostSelectorAlg::m_decoration
CP::SysWriteSelectionHandle m_decoration
the output selection decoration
Definition: JetNGhostSelectorAlg.h:86
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
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::JetNGhostSelectorAlg::m_ghostAcc
std::unique_ptr< SG::AuxElement::ConstAccessor< int > > m_ghostAcc
the ghost and ghost-veto accessors
Definition: JetNGhostSelectorAlg.h:91
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
CP::JetNGhostSelectorAlg::m_eventInfoHandle
CP::SysReadHandle< xAOD::EventInfo > m_eventInfoHandle
the event info handle
Definition: JetNGhostSelectorAlg.h:76
CP::JetNGhostSelectorAlg::initialize
virtual StatusCode initialize() override
Definition: JetNGhostSelectorAlg.cxx:15
CP::SysReadSelectionHandle::initialize
StatusCode initialize(SysListHandle &sysListHandle, const ISysHandleBase &objectHandle)
initialize the accessor
Definition: SysReadSelectionHandle.cxx:34
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
CP::JetNGhostSelectorAlg::m_veto
Gaudi::Property< std::string > m_veto
the ghost decoration
Definition: JetNGhostSelectorAlg.h:55
CP::JetNGhostSelectorAlg::m_systematicsList
CP::SysListHandle m_systematicsList
the systematics list
Definition: JetNGhostSelectorAlg.h:63
CP::JetNGhostSelectorAlg::execute
virtual StatusCode execute() override
Definition: JetNGhostSelectorAlg.cxx:35
CP::JetNGhostSelectorAlg::m_ghost
Gaudi::Property< std::string > m_ghost
the ghost decoration
Definition: JetNGhostSelectorAlg.h:50
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30
CP::JetNGhostSelectorAlg::m_vetoAcc
std::unique_ptr< SG::AuxElement::ConstAccessor< int > > m_vetoAcc
Definition: JetNGhostSelectorAlg.h:92
CP::SysWriteSelectionHandle::initialize
StatusCode initialize(SysListHandle &sysListHandle, const ISysHandleBase &objectHandle)
initialize the accessor
Definition: SysWriteSelectionHandle.cxx:34
JetNGhostSelectorAlg.h