ATLAS Offline Software
FastTrackFinderLRTHypoTool.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 
6 
9 
11 
12 using namespace TrigCompositeUtils;
13 
14 FastTrackFinderLRTHypoTool::FastTrackFinderLRTHypoTool( const std::string& type,const std::string& name,const IInterface* parent )
15 : AthAlgTool( type, name, parent ),
16 m_decisionId( HLT::Identifier::fromToolName( name ) ) {}
17 
19  return StatusCode::SUCCESS;
20 }
21 
23  if ( trkinfo.previousDecisionIDs.count( m_decisionId.numeric() ) == 0 ) {
24  ATH_MSG_DEBUG("Already rejected");
25  return StatusCode::SUCCESS;
26  }
27 
28  std::vector<int> counts;
29 
30  std::vector<float> pTcuts;
31  std::vector<float> d0mincuts;
32  std::vector<float> d0maxcuts;
33  std::vector<float> xi2maxcuts;
34  trkinfo.counts->getDetail<std::vector<int>>("counts", counts);
35  trkinfo.counts->getDetail<std::vector<float>>("pTcuts", pTcuts);
36  trkinfo.counts->getDetail<std::vector<float>>("d0mincuts", d0mincuts);
37  trkinfo.counts->getDetail<std::vector<float>>("d0maxcuts", d0maxcuts);
38  trkinfo.counts->getDetail<std::vector<float>>("xi2cuts", xi2maxcuts);
39 
40  float countForConfiguredPtThreshold{};
41  bool found{false};
42  ATH_MSG_DEBUG("nCounts: "<<counts.size());
43  ATH_MSG_DEBUG("this tool is configured for pT"<< m_min_pt<<" have nPt:"<<pTcuts.size()<<" nd0min: "<<d0mincuts.size()<<" nd0max: "<<d0maxcuts.size()<<" xi2cuts "<<xi2maxcuts.size());
44 
45  for ( size_t i = 0; i < counts.size(); ++i ) {
46  if ( std::abs( pTcuts[i] - m_min_pt ) < 0.001 && std::abs( d0mincuts[i] - m_min_d0 ) < 0.001 && std::abs( d0maxcuts[i] - m_max_d0 ) < 0.001 && std::abs( xi2maxcuts[i] - m_max_xi2 ) < 0.001 ) {
47  found = true;
48  countForConfiguredPtThreshold = counts[i];
49  }
50  }
51  if (!found ) {
52  ATH_MSG_ERROR ("Unable to find tracks count for requested pT threshold " << m_min_pt << " need to fix hypo tool configuratio or add new threshold in tracks counting");
53  for ( float pt : pTcuts ) {
54  ATH_MSG_ERROR( "Count of tracks of pT above " << pt << " is available");
55  }
56  return StatusCode::FAILURE;
57  }
58  else{
59  ATH_MSG_DEBUG ("REGTEST found "<<countForConfiguredPtThreshold <<" tracks for "<<m_min_pt);
60  }
61  std::vector<bool> decisionCuts({
62  (m_required_ntrks != -1 ? m_required_ntrks <= countForConfiguredPtThreshold : (bool)m_logicAnd),
63  (m_max_required_ntrks != -1 ? m_max_required_ntrks > countForConfiguredPtThreshold : (bool)m_logicAnd)
64  });
65 
66  if(m_logicAnd && !std::all_of(decisionCuts.begin(),decisionCuts.end(),[](bool k ){return k; }) ){
67 
68  return StatusCode::SUCCESS;
69  }else if(m_logicAnd==false && !std::any_of(decisionCuts.begin(),decisionCuts.end(),[](bool k ){return k; }) ){
70  return StatusCode::SUCCESS;
71  }else{
73  ATH_MSG_DEBUG ("REGTEST event accepted");
74  }
75  return StatusCode::SUCCESS;
76 }
FastTrackFinderLRTHypoTool::TrkCountsInfo::decision
TrigCompositeUtils::Decision * decision
Definition: FastTrackFinderLRTHypoTool.h:24
FastTrackFinderLRTHypoTool::m_max_d0
Gaudi::Property< float > m_max_d0
Definition: FastTrackFinderLRTHypoTool.h:36
HLT::Identifier::numeric
TrigCompositeUtils::DecisionID numeric() const
numeric ID
Definition: TrigCompositeUtils/TrigCompositeUtils/HLTIdentifier.h:47
TrigCompositeUtils::addDecisionID
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.
Definition: TrigCompositeUtilsRoot.cxx:61
test_pyathena.pt
pt
Definition: test_pyathena.py:11
FastTrackFinderLRTHypoTool::m_min_d0
Gaudi::Property< float > m_min_d0
Definition: FastTrackFinderLRTHypoTool.h:35
FastTrackFinderLRTHypoTool::m_min_pt
Gaudi::Property< float > m_min_pt
Definition: FastTrackFinderLRTHypoTool.h:34
FastTrackFinderLRTHypoTool::m_required_ntrks
Gaudi::Property< float > m_required_ntrks
Definition: FastTrackFinderLRTHypoTool.h:38
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
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
FastTrackFinderLRTHypoTool::m_logicAnd
Gaudi::Property< bool > m_logicAnd
Definition: FastTrackFinderLRTHypoTool.h:42
test_pyathena.parent
parent
Definition: test_pyathena.py:15
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
FastTrackFinderLRTHypoTool::initialize
virtual StatusCode initialize() override
Definition: FastTrackFinderLRTHypoTool.cxx:18
FastTrackFinderLRTHypoTool::m_max_xi2
Gaudi::Property< float > m_max_xi2
Definition: FastTrackFinderLRTHypoTool.h:37
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
FastTrackFinderLRTHypoTool::TrkCountsInfo::previousDecisionIDs
const TrigCompositeUtils::DecisionIDContainer previousDecisionIDs
Definition: FastTrackFinderLRTHypoTool.h:26
FastTrackFinderLRTHypoTool::TrkCountsInfo::counts
const xAOD::TrigComposite * counts
Definition: FastTrackFinderLRTHypoTool.h:25
FastTrackFinderLRTHypoTool::m_decisionId
HLT::Identifier m_decisionId
Definition: FastTrackFinderLRTHypoTool.h:33
FastTrackFinderLRTHypoTool::decide
StatusCode decide(TrkCountsInfo &decisions) const
Definition: FastTrackFinderLRTHypoTool.cxx:22
CondAlgsOpts.found
int found
Definition: CondAlgsOpts.py:101
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
FastTrackFinderLRTHypoTool::TrkCountsInfo
Definition: FastTrackFinderLRTHypoTool.h:23
HLTIdentifier.h
FastTrackFinderLRTHypoTool::m_max_required_ntrks
Gaudi::Property< float > m_max_required_ntrks
Definition: FastTrackFinderLRTHypoTool.h:39
TrigCompositeUtils
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:19
FastTrackFinderLRTHypoTool.h
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.
xAOD::bool
setBGCode setTAP setLVL2ErrorBits bool
Definition: TrigDecision_v1.cxx:60
fitman.k
k
Definition: fitman.py:528
FastTrackFinderLRTHypoTool::FastTrackFinderLRTHypoTool
FastTrackFinderLRTHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: FastTrackFinderLRTHypoTool.cxx:14