ATLAS Offline Software
Loading...
Searching...
No Matches
JetNGhostSelectorAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6
8
9namespace CP {
10
11 JetNGhostSelectorAlg::JetNGhostSelectorAlg(const std::string &name, ISvcLocator *pSvcLocator)
12 : EL::AnaAlgorithm(name, pSvcLocator)
13 {}
14
19
22 ANA_CHECK(m_systematicsList.initialize());
23
25
26 m_ghostAcc = std::make_unique<SG::ConstAccessor<int>> (m_ghost.value());
27 if ( !m_veto.value().empty() ) {
28 m_vetoAcc= std::make_unique<SG::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;
50 ANA_CHECK(m_jetsHandle.retrieve(jets, sys));
51
52 // apply and calculate the decision
53 int count = 0;
54 for (const xAOD::Jet *jet : *jets){
55 if (!m_jetSelection || m_jetSelection.getBool(*jet, sys)){
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
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
#define ANA_CHECK(EXP)
check whether the given expression was successful
std::unique_ptr< SG::ConstAccessor< int > > m_vetoAcc
Gaudi::Property< std::string > m_sign
the sign against which to compare pT (GT, LT, etc)
Gaudi::Property< std::string > m_ghost
the ghost decoration
Gaudi::Property< std::string > m_veto
the ghost decoration
virtual StatusCode execute() override
CP::SysWriteSelectionHandle m_decoration
the output selection decoration
CP::SysReadHandle< xAOD::JetContainer > m_jetsHandle
the jet input handle
CP::SysReadHandle< xAOD::EventInfo > m_eventInfoHandle
the event info handle
CP::SysReadSelectionHandle m_preselection
the preselection
CP::SysListHandle m_systematicsList
the systematics list
virtual StatusCode initialize() override
Gaudi::Property< float > m_ptmin
the pT threshold on which to select
JetNGhostSelectorAlg(const std::string &name, ISvcLocator *pSvcLocator)
the standard constructor
CP::SysReadSelectionHandle m_jetSelection
the jet selection handle
SignEnum::ComparisonOperator m_signEnum
the operator version of the comparison (>, <, etc)
Gaudi::Property< int > m_count
the count of events desired
std::unique_ptr< SG::ConstAccessor< int > > m_ghostAcc
the ghost and ghost-veto accessors
AnaAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146
Select isolated Photons, Electrons and Muons.
This module defines the arguments passed from the BATCH driver to the BATCH worker.
bool checkValue(T reference, ComparisonOperator sign, T test)
the comparison test given the specified sign and two test values
Definition SignEnums.h:37
static const std::map< std::string, ComparisonOperator > stringToOperator
the map between user inputs and comparison operators
Definition SignEnums.h:27
Jet_v1 Jet
Definition of the current "jet version".
EventInfo_v1 EventInfo
Definition of the latest event info version.
JetContainer_v1 JetContainer
Definition of the current "jet container version".