ATLAS Offline Software
SPCountHypoTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "SPCountHypoTool.h"
6 
9 
10 using namespace TrigCompositeUtils;
11 SPCountHypoTool::SPCountHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
12  : AthCheckedComponent<AthAlgTool>(type, name, parent), m_decisionId(HLT::Identifier::fromToolName(name)) {}
13 
15  return StatusCode::SUCCESS;
16 }
17 
18 bool SPCountHypoTool::applyCut(const Gaudi::Property<int> &threshold, const xAOD::TrigComposite *composit, const std::string_view name) const {
19  if (threshold == -1) {
20  return m_logicAnd; // If the logic is And, it should return true and otherwise it should return false.
21  }
22  const std::string detailName = (name != "" ? std::string(name) : threshold.name());
23 
24  ATH_MSG_DEBUG("count for = " << threshold.name() << "=" << (composit->getDetail<int>(detailName) > threshold));
25  return (composit->getDetail<int>(detailName) > threshold);
26 }
27 
28 bool SPCountHypoTool::applyInverseCut(const Gaudi::Property<int> &threshold, const xAOD::TrigComposite *composit, const std::string_view name) const {
29  if (threshold == -1) {
30  return m_logicAnd; // If the logic is And, it should return true and otherwise it should return false.
31  }
32  const std::string detailName = (name != "" ? std::string(name) : threshold.name());
33 
34  ATH_MSG_DEBUG("count for = " << threshold.name() << "=" << (composit->getDetail<int>(detailName) < threshold));
35  return (composit->getDetail<int>(detailName) < threshold); // here is the difference
36 }
37 
39  if (spinfo.previousDecisionIDs.count(m_decisionId.numeric()) == 0) {
40  ATH_MSG_DEBUG("Already rejected");
41  return StatusCode::SUCCESS;
42  }
43 
44  // clang-format off
45  std::vector<bool> decisionCuts({
46  applyCut(m_pixCL, spinfo.counts),
47  applyInverseCut(m_pixCLMax, spinfo.counts, "pixCL"),
48  applyCut(m_pixCLnoToT, spinfo.counts),
49  applyCut(m_pixCL_1, spinfo.counts),
50  applyCut(m_pixCL_2, spinfo.counts),
51  applyCut(m_pixCLmin3, spinfo.counts),
52  applyCut(m_pixCLBarrel, spinfo.counts),
55  applyCut(m_sctSP, spinfo.counts),
56  applyInverseCut(m_sctSPMax, spinfo.counts, "sctSP"),
57  applyCut(m_sctSPBarrel, spinfo.counts),
60  );
61  // clang-format on
62 
63  if (m_logicAnd && !std::all_of(decisionCuts.begin(), decisionCuts.end(), [](bool k) { return k; })) {
64  ATH_MSG_DEBUG("REGTEST " << name() << " rejected");
65  return StatusCode::SUCCESS;
66  } else if (m_logicAnd == false && !std::any_of(decisionCuts.begin(), decisionCuts.end(), [](bool k) { return k; })) {
67  ATH_MSG_DEBUG("REGTEST " << name() << " rejected");
68  return StatusCode::SUCCESS;
69  } else {
71  ATH_MSG_DEBUG("REGTEST " << name() << " accepted");
72  }
73 
74  return StatusCode::SUCCESS;
75 }
SPCountHypoTool::m_sctSPEndcapC
Gaudi::Property< int > m_sctSPEndcapC
Definition: SPCountHypoTool.h:46
SPCountHypoTool::m_pixCLEndcapA
Gaudi::Property< int > m_pixCLEndcapA
Definition: SPCountHypoTool.h:40
SPCountHypoTool::m_pixCLnoToT
Gaudi::Property< int > m_pixCLnoToT
Definition: SPCountHypoTool.h:35
SPCountHypoTool::applyCut
bool applyCut(const Gaudi::Property< int > &threshold, const xAOD::TrigComposite *composit, const std::string_view name="") const
Definition: SPCountHypoTool.cxx:18
SPCountHypoTool::m_pixCLMax
Gaudi::Property< int > m_pixCLMax
Definition: SPCountHypoTool.h:34
SPCountHypoTool::SPCountsInfo::decision
TrigCompositeUtils::Decision * decision
Definition: SPCountHypoTool.h:20
SPCountHypoTool::m_pixCL_1
Gaudi::Property< int > m_pixCL_1
Definition: SPCountHypoTool.h:36
HLT::Identifier::numeric
TrigCompositeUtils::DecisionID numeric() const
numeric ID
Definition: TrigCompositeUtils/TrigCompositeUtils/HLTIdentifier.h:47
SPCountHypoTool::SPCountsInfo::previousDecisionIDs
const TrigCompositeUtils::DecisionIDContainer previousDecisionIDs
Definition: SPCountHypoTool.h:22
TrigCompositeUtils::addDecisionID
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.
Definition: TrigCompositeUtilsRoot.cxx:61
SPCountHypoTool::SPCountsInfo
Definition: SPCountHypoTool.h:19
SPCountHypoTool::m_decisionId
HLT::Identifier m_decisionId
Definition: SPCountHypoTool.h:31
SPCountHypoTool::m_pixCLmin3
Gaudi::Property< int > m_pixCLmin3
Definition: SPCountHypoTool.h:38
SPCountHypoTool::m_logicAnd
Gaudi::Property< bool > m_logicAnd
Definition: SPCountHypoTool.h:47
SPCountHypoTool::m_pixCLEndcapC
Gaudi::Property< int > m_pixCLEndcapC
Definition: SPCountHypoTool.h:41
SPCountHypoTool.h
SPCountHypoTool::SPCountsInfo::counts
const xAOD::TrigComposite * counts
Definition: SPCountHypoTool.h:21
SPCountHypoTool::m_sctSPMax
Gaudi::Property< int > m_sctSPMax
Definition: SPCountHypoTool.h:43
SPCountHypoTool::m_sctSP
Gaudi::Property< int > m_sctSP
Definition: SPCountHypoTool.h:42
SPCountHypoTool::m_sctSPBarrel
Gaudi::Property< int > m_sctSPBarrel
Definition: SPCountHypoTool.h:44
AthCheckedComponent
Mixin class to perform additional checks on a component.
Definition: AthCheckedComponent.h:25
HLT
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
Definition: HLTResultReader.h:26
SPCountHypoTool::SPCountHypoTool
SPCountHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: SPCountHypoTool.cxx:11
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
xAOD::TrigComposite_v1
Class used to describe composite objects in the HLT.
Definition: TrigComposite_v1.h:52
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
SPCountHypoTool::m_sctSPEndcapA
Gaudi::Property< int > m_sctSPEndcapA
Definition: SPCountHypoTool.h:45
SPCountHypoTool::m_pixCL
Gaudi::Property< int > m_pixCL
Definition: SPCountHypoTool.h:33
threshold
Definition: chainparser.cxx:74
SPCountHypoTool::initialize
virtual StatusCode initialize() override
Definition: SPCountHypoTool.cxx:14
SPCountHypoTool::m_pixCL_2
Gaudi::Property< int > m_pixCL_2
Definition: SPCountHypoTool.h:37
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
SPCountHypoTool::applyInverseCut
bool applyInverseCut(const Gaudi::Property< int > &threshold, const xAOD::TrigComposite *composit, const std::string_view name="") const
Definition: SPCountHypoTool.cxx:28
SPCountHypoTool::decide
StatusCode decide(SPCountsInfo &decisions) const
Definition: SPCountHypoTool.cxx:38
HLTIdentifier.h
TrigCompositeUtils
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:19
AthAlgTool
Definition: AthAlgTool.h:26
xAOD::TrigComposite_v1::getDetail
bool getDetail(const std::string &name, TYPE &value) const
Get an TYPE detail from the object.
SPCountHypoTool::m_pixCLBarrel
Gaudi::Property< int > m_pixCLBarrel
Definition: SPCountHypoTool.h:39
fitman.k
k
Definition: fitman.py:528