ATLAS Offline Software
TrackCountHypoTool.cxx
Go to the documentation of this file.
1 
2 /*
3 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
4 */
5 
8 
9 #include "TrackCountHypoTool.h"
10 
11 using namespace TrigCompositeUtils;
12 
13 TrackCountHypoTool::TrackCountHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
15  m_decisionId(HLT::Identifier::fromToolName(name)) {}
16 
17 
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 ) {
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 ) {
85  ATH_MSG_DEBUG("REGTEST event accepted");
86  }
87  return StatusCode::SUCCESS;
88 }
TrackCountHypoTool::m_decisionId
HLT::Identifier m_decisionId
Definition: TrackCountHypoTool.h:31
TrackCountHypoTool::m_maxNtrks
Gaudi::Property< float > m_maxNtrks
Definition: TrackCountHypoTool.h:36
HLT::Identifier::numeric
TrigCompositeUtils::DecisionID numeric() const
numeric ID
Definition: TrigCompositeUtils/TrigCompositeUtils/HLTIdentifier.h:47
TrackCountHypoTool::m_maxVertexZ
Gaudi::Property< float > m_maxVertexZ
Definition: TrackCountHypoTool.h:34
TrackCountHypoTool::decide
StatusCode decide(TrkCountsInfo &decisions) const
Definition: TrackCountHypoTool.cxx:18
TrackCountHypoTool::TrackCountHypoTool
TrackCountHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: TrackCountHypoTool.cxx:13
TrigCompositeUtils::addDecisionID
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.
Definition: TrigCompositeUtilsRoot.cxx:61
TrackCountHypoTool::m_minPt
Gaudi::Property< float > m_minPt
Definition: TrackCountHypoTool.h:32
TrackCountHypoTool::TrkCountsInfo::previousDecisionIDs
const TrigCompositeUtils::DecisionIDContainer previousDecisionIDs
Definition: TrackCountHypoTool.h:24
TrackCountHypoTool::m_exclusive
Gaudi::Property< bool > m_exclusive
Definition: TrackCountHypoTool.h:38
TrackCountHypoTool.h
TrackCountHypoTool::TrkCountsInfo::decision
TrigCompositeUtils::Decision * decision
Definition: TrackCountHypoTool.h:22
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
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
lumiFormat.i
int i
Definition: lumiFormat.py:92
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
TrackCountHypoTool::m_acceptAll
Gaudi::Property< bool > m_acceptAll
Definition: TrackCountHypoTool.h:39
TrackCountHypoTool::m_maxZ0
Gaudi::Property< float > m_maxZ0
Definition: TrackCountHypoTool.h:33
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
TrackCountHypoTool::TrkCountsInfo::counts
const xAOD::TrigComposite * counts
Definition: TrackCountHypoTool.h:23
CondAlgsOpts.found
int found
Definition: CondAlgsOpts.py:101
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
HLTIdentifier.h
TrackCountHypoTool::m_minNtrks
Gaudi::Property< float > m_minNtrks
Definition: TrackCountHypoTool.h:35
TrigCompositeUtils
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:19
TrackCountHypoTool::m_exclusivityThreshold
const int m_exclusivityThreshold
Definition: TrackCountHypoTool.h:37
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.
TrackCountHypoTool::TrkCountsInfo
Definition: TrackCountHypoTool.h:21