ATLAS Offline Software
Loading...
Searching...
No Matches
FastTrackFinderLRTHypoTool.cxx
Go to the documentation of this file.
1
2/*
3Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
4*/
5
6
9
11
12using namespace TrigCompositeUtils;
13
14FastTrackFinderLRTHypoTool::FastTrackFinderLRTHypoTool( const std::string& type,const std::string& name,const IInterface* parent )
15: AthAlgTool( type, name, parent ),
16m_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{
72 addDecisionID( m_decisionId.numeric(), trkinfo.decision );
73 ATH_MSG_DEBUG ("REGTEST event accepted");
74 }
75 return StatusCode::SUCCESS;
76}
#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:
Gaudi::Property< float > m_required_ntrks
Gaudi::Property< float > m_max_required_ntrks
virtual StatusCode initialize() override
FastTrackFinderLRTHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
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