ATLAS Offline Software
Loading...
Searching...
No Matches
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
10using namespace TrigCompositeUtils;
11SPCountHypoTool::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
18template<typename DetailType>
19bool SPCountHypoTool::applyCut(const Gaudi::Property<DetailType> &threshold, const xAOD::TrigComposite *composit, const std::string_view name) const {
20 if (threshold == -1) {
21 return m_logicAnd; // If the logic is And, it should return true and otherwise it should return false.
22 }
23 const std::string detailName = (name != "" ? std::string(name) : threshold.name());
24
25 ATH_MSG_DEBUG("count for = " << threshold.name() << "=" << (composit->getDetail<DetailType>(detailName) > threshold));
26 return (composit->getDetail<DetailType>(detailName) > threshold);
27}
28
29template<typename DetailType>
30bool SPCountHypoTool::applyInverseCut(const Gaudi::Property<DetailType> &threshold, const xAOD::TrigComposite *composit, const std::string_view name) const {
31 if (threshold == -1) {
32 return m_logicAnd; // If the logic is And, it should return true and otherwise it should return false.
33 }
34 const std::string detailName = (name != "" ? std::string(name) : threshold.name());
35
36 ATH_MSG_DEBUG("count for = " << threshold.name() << "=" << (composit->getDetail<DetailType>(detailName) < threshold));
37 return (composit->getDetail<DetailType>(detailName) < threshold); // here is the difference
38}
39
40StatusCode SPCountHypoTool::decide(SPCountsInfo &spinfo) const {
41 if (spinfo.previousDecisionIDs.count(m_decisionId.numeric()) == 0) {
42 ATH_MSG_DEBUG("Already rejected");
43 return StatusCode::SUCCESS;
44 }
45
46 // clang-format off
47 std::vector<bool> decisionCuts({
48 applyCut(m_pixCL, spinfo.counts),
49 applyInverseCut(m_pixCLMax, spinfo.counts, "pixCL"),
51 applyCut(m_pixCL_1, spinfo.counts),
52 applyCut(m_pixCL_2, spinfo.counts),
57 applyCut(m_sctSP, spinfo.counts),
58 applyInverseCut(m_sctSPMax, spinfo.counts, "sctSP"),
62 applyCut(m_pixQ2mod, spinfo.counts)}
63 );
64 // clang-format on
65
66 if (m_logicAnd && !std::all_of(decisionCuts.begin(), decisionCuts.end(), [](bool k) { return k; })) {
67 ATH_MSG_DEBUG("REGTEST " << name() << " rejected");
68 return StatusCode::SUCCESS;
69 } else if (m_logicAnd == false && !std::any_of(decisionCuts.begin(), decisionCuts.end(), [](bool k) { return k; })) {
70 ATH_MSG_DEBUG("REGTEST " << name() << " rejected");
71 return StatusCode::SUCCESS;
72 } else {
73 addDecisionID(m_decisionId.numeric(), spinfo.decision);
74 ATH_MSG_DEBUG("REGTEST " << name() << " accepted");
75 }
76
77 return StatusCode::SUCCESS;
78}
#define ATH_MSG_DEBUG(x)
Header file to be included by clients of the Monitored infrastructure.
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Mixin class to perform additional checks on a component.
Gaudi::Property< int > m_sctSPBarrel
Gaudi::Property< int > m_pixCL_1
Gaudi::Property< int > m_pixCLEndcapC
SPCountHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode initialize() override
Gaudi::Property< int > m_sctSPMax
Gaudi::Property< int > m_sctSPEndcapC
Gaudi::Property< float > m_pixQ2mod
Gaudi::Property< int > m_pixCLMax
HLT::Identifier m_decisionId
Gaudi::Property< int > m_pixCL_2
Gaudi::Property< int > m_pixCL
bool applyCut(const Gaudi::Property< DetailType > &threshold, const xAOD::TrigComposite *composit, const std::string_view name="") const
Gaudi::Property< int > m_pixCLmin3
Gaudi::Property< int > m_pixCLBarrel
StatusCode decide(SPCountsInfo &decisions) const
Gaudi::Property< bool > m_logicAnd
bool applyInverseCut(const Gaudi::Property< DetailType > &threshold, const xAOD::TrigComposite *composit, const std::string_view name="") const
Gaudi::Property< int > m_sctSP
Gaudi::Property< int > m_sctSPEndcapA
Gaudi::Property< int > m_pixCLEndcapA
Gaudi::Property< int > m_pixCLnoToT
bool getDetail(const std::string &name, TYPE &value) const
Get an TYPE detail from the object.
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.
TrigComposite_v1 TrigComposite
Declare the latest version of the class.
const xAOD::TrigComposite * counts
TrigCompositeUtils::Decision * decision
const TrigCompositeUtils::DecisionIDContainer previousDecisionIDs