ATLAS Offline Software
Loading...
Searching...
No Matches
TrackCountHypoTool.cxx
Go to the documentation of this file.
1
2/*
3Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
4*/
5
8
10
11using namespace TrigCompositeUtils;
12
13TrackCountHypoTool::TrackCountHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
14 : AthCheckedComponent<AthAlgTool>(type, name, parent),
15 m_decisionId(HLT::Identifier::fromToolName(name)) {}
16
17
18StatusCode TrackCountHypoTool::decide(TrkCountsInfo &trkinfo) const
19{
20 if (trkinfo.previousDecisionIDs.count(m_decisionId.numeric()) == 0)
21 {
22 ATH_MSG_DEBUG("Already rejected");
23 return StatusCode::SUCCESS;
24 }
25 if ( m_acceptAll ) {
26 addDecisionID(m_decisionId.numeric(), trkinfo.decision);
27 ATH_MSG_DEBUG("REGTEST event accepted because of acceptAll");
28 }
29
30 std::vector<int> counts;
31 trkinfo.counts->getDetail<std::vector<int>>("counts", counts);
32 if ( m_exclusive ) {
33 if ( counts[0] > m_exclusivityThreshold ) {
34 ATH_MSG_DEBUG("Lowest pt tracks count " << counts[0] << " exceeds exclusivity cut, " << m_exclusivityThreshold<<" rejecting");
35 return StatusCode::SUCCESS;
36 }
37 }
38 std::vector<float> pTcuts;
39 std::vector<float> z0cuts;
40 std::vector<float> vertexZcuts;
41 trkinfo.counts->getDetail<std::vector<float>>("pTcuts", pTcuts);
42 trkinfo.counts->getDetail<std::vector<float>>("z0cuts", z0cuts);
43 trkinfo.counts->getDetail<std::vector<float>>("vertexZcuts", vertexZcuts);
44
45
46 float countForConfiguredPtThreshold{};
47 bool found{false};
48 // find the right counter
49 for (size_t i = 0; i < counts.size(); ++i)
50 {
51 if (std::abs(pTcuts[i] - m_minPt) < 0.001
52 && std::abs(z0cuts[i] - m_maxZ0) < 0.001
53 && std::abs(vertexZcuts[i] - m_maxVertexZ) < 0.001)
54 {
55 found = true;
56 countForConfiguredPtThreshold = counts[i];
57 }
58 }
59
60 if (!found)
61 {
62 ATH_MSG_ERROR("Unable to find tracks count for requested: "
63 << " min pT " << m_minPt
64 << " nax z0 " << m_maxZ0
65 << " vertex Z " << m_maxVertexZ
66 << " need to fix hypo tool configuration or add new threshold in tracks counting");
67 for (size_t i = 0; i < counts.size(); ++i)
68 {
69 ATH_MSG_ERROR("Count of tracks of pTcuts " << pTcuts[i] << " z0Cuts " << z0cuts[i] << " vertexZcuts " << vertexZcuts[i] << " that are available");
70 }
71 return StatusCode::FAILURE;
72 }
73 else
74 {
75 ATH_MSG_DEBUG("REGTEST found " << countForConfiguredPtThreshold << " tracks for " << m_minPt);
76 }
77
78
79
80 const bool minTrkPassed = (m_minNtrks == -1) or (countForConfiguredPtThreshold >= m_minNtrks);
81 const bool maxTrkPassed = (m_maxNtrks == -1) or (countForConfiguredPtThreshold < m_maxNtrks);
82
83 if ( minTrkPassed and maxTrkPassed ) {
84 addDecisionID(m_decisionId.numeric(), trkinfo.decision);
85 ATH_MSG_DEBUG("REGTEST event accepted");
86 }
87 return StatusCode::SUCCESS;
88}
#define ATH_MSG_ERROR(x)
#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.
TrackCountHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
Gaudi::Property< float > m_minNtrks
Gaudi::Property< bool > m_acceptAll
Gaudi::Property< float > m_maxVertexZ
Gaudi::Property< float > m_maxNtrks
Gaudi::Property< float > m_maxZ0
Gaudi::Property< bool > m_exclusive
HLT::Identifier m_decisionId
Gaudi::Property< float > m_minPt
StatusCode decide(TrkCountsInfo &decisions) const
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.
const TrigCompositeUtils::DecisionIDContainer previousDecisionIDs
const xAOD::TrigComposite * counts
TrigCompositeUtils::Decision * decision