ATLAS Offline Software
Loading...
Searching...
No Matches
TrigDisappearingTrackHypoTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
4 * Trigger Hypo Tool, that is aimed at triggering disappearing track candidates
5 * author Kunihiro Nagano <kunihiro.nagano@cern.ch>
6*/
7
13#include "GaudiKernel/PhysicalConstants.h"
14
15using namespace TrigCompositeUtils;
16
17// ------------------------------------------------------------------------------------------------
18// ------------------------------------------------------------------------------------------------
19
21 const std::string& name,
22 const IInterface* parent )
23 : AthAlgTool( type, name, parent ),
24 m_decisionId( HLT::Identifier::fromToolName( name ) ) {}
25
27
28// ------------------------------------------------------------------------------------------------
29// ------------------------------------------------------------------------------------------------
30
32{
33 ATH_MSG_DEBUG( "Initialization completed successfully:" );
34 ATH_MSG_DEBUG( " cutTrackPtGeV = " << m_cutTrackPtGeV );
35 ATH_MSG_DEBUG( "Tool configured for chain/id: " << m_decisionId );
36
37 return StatusCode::SUCCESS;
38}
39
40// ------------------------------------------------------------------------------------------------
41// ------------------------------------------------------------------------------------------------
42
43StatusCode TrigDisappearingTrackHypoTool::decide( std::vector<DisTrkHypoInfo>& toolInputs ) const
44{
45 size_t numTrigger = m_cutTrackPtGeV.size();
46 size_t numDisTrks = toolInputs.size();
47
48 ATH_MSG_VERBOSE( "Number of DisTrks = " << numDisTrks );
49
50 if ( numTrigger == 1 ) {
51 ATH_MSG_VERBOSE( "Applying selection of single for " << m_decisionId );
52 return inclusiveSelection(toolInputs);
53 }
54 else {
55 ATH_MSG_VERBOSE( "Applying selection of multiplicity for " << m_decisionId );
56 return multiplicitySelection(toolInputs);
57 }
58
59 return StatusCode::SUCCESS;
60}
61
62// ------------------------------------------------------------------------------------------------
63// ------------------------------------------------------------------------------------------------
64
65StatusCode TrigDisappearingTrackHypoTool::inclusiveSelection(std::vector<DisTrkHypoInfo>& toolInputs) const
66{
67 bool isPassed = false;
68 unsigned int iDisTrk=0;
69 for ( auto& input: toolInputs ) {
70 ATH_MSG_VERBOSE( "--- iDisTrk=" << iDisTrk << " ---" );
71 if ( TrigCompositeUtils::passed( m_decisionId.numeric(), input.previousDecisionsIDs ) ) {
72 if ( decideOnSingleObject( input, 0 )==true ) {
73 ATH_MSG_VERBOSE( " Passed selection --> adding DecisionID" );
74 isPassed = true;
76 }
77 } else {
78 ATH_MSG_VERBOSE( " Not match DecisionID: " << m_decisionId );
79 }
80 ++iDisTrk;
81 }
82
83 ATH_MSG_VERBOSE( "Inclusive selection isPassed = " << isPassed );
84 return StatusCode::SUCCESS;
85}
86
87// ------------------------------------------------------------------------------------------------
88// ------------------------------------------------------------------------------------------------
89
90StatusCode TrigDisappearingTrackHypoTool::multiplicitySelection(std::vector<DisTrkHypoInfo>& toolInputs) const
91{
92 HLT::Index2DVec passingSelection( m_cutTrackPtGeV.size() );
93
94 for ( size_t cutIndex=0; cutIndex < m_cutTrackPtGeV.size(); ++cutIndex ) {
95 size_t elementIndex{ 0 };
96 for ( auto& input: toolInputs ) {
97 if ( TrigCompositeUtils::passed( m_decisionId.numeric(), input.previousDecisionsIDs ) ) {
98 if ( decideOnSingleObject( input, cutIndex ) == true ) {
99 ATH_MSG_VERBOSE( "Pass through selection " << m_decisionId << " : Event[" << elementIndex << "]" );
100 passingSelection[cutIndex].push_back( elementIndex );
101 }
102 }
103 else {
104 ATH_MSG_VERBOSE( "Not match DecisionID " << m_decisionId );
105 }
106 elementIndex++;
107 }
108 // If no object passes the selection, multipul selection should stop.
109 if ( passingSelection[cutIndex].empty() ) {
110 ATH_MSG_VERBOSE( "No object passed selection " << cutIndex << " rejecting" );
111 return StatusCode::SUCCESS;
112 }
113 }
114
115 std::set<size_t> passingIndices;
116 HLT::elementsInUniqueCombinations( passingSelection, passingIndices );
117
118 if ( passingIndices.empty() ) {
119 ATH_MSG_VERBOSE( "No track passed through selection " << m_decisionId );
120 return StatusCode::SUCCESS;
121 }
122
123 for ( auto idx: passingIndices ) {
124 ATH_MSG_VERBOSE( "track[" << idx << "] passes through Chain/ID " << m_decisionId << " with pT" );
125 TrigCompositeUtils::addDecisionID( m_decisionId.numeric(), toolInputs[idx].decision );
126 }
127
128 return StatusCode::SUCCESS;
129}
130
131// ------------------------------------------------------------------------------------------------
132// ------------------------------------------------------------------------------------------------
133
135{
136 // values
137 const std::string prefix = "disTrk";
138
139 auto distrk = input.disTrk;
140
141 int category = (int)distrk->getDetail<int16_t>(prefix+"_category");
142 float pt = distrk->getDetail<float>(prefix+"_pt");
143 float refit_pt = distrk->getDetail<float>(prefix+"_refit_pt");
144 float bdt_score = distrk->getDetail<float>(prefix+"_bdtscore");
145 pt /= Gaudi::Units::GeV;
146 refit_pt /= Gaudi::Units::GeV;
147
148 // selection
149 bool is_passed = false;
150 if( category==1 ) {
151 float bdt_threshold_pix4l_sct0 = m_cutBDTPix4Sct0[cutIndex];
152 float pt_threshold_pix4l_sct0 = m_cutTrackPtGeV[cutIndex];
153 if( pt >= pt_threshold_pix4l_sct0 && bdt_score >= bdt_threshold_pix4l_sct0 ) is_passed = true;
154 }
155 else if( category==2 ) {
156 float bdt_threshold_pix4l_sct1p = m_cutBDTPix4Sct1p[cutIndex];
157 float refit_pt_threshold_pix4l_sct1p = m_cutTrackPtGeV[cutIndex];
158 if( refit_pt >= refit_pt_threshold_pix4l_sct1p && bdt_score >= bdt_threshold_pix4l_sct1p ) is_passed = true;
159 }
160 else if( category==3 ) {
161 float bdt_threshold_pix3l_sct0 = m_cutBDTPix3Sct0[cutIndex];
162 float pt_threshold_pix3l_sct0 = m_cutTrackPtGeV[cutIndex];
163 if( pt >= pt_threshold_pix3l_sct0 && bdt_score >= bdt_threshold_pix3l_sct0 ) is_passed = true;
164 }
165 else if( category==4 ) {
166 float bdt_threshold_pix3l_sct1p = m_cutBDTPix3Sct1p[cutIndex];
167 float refit_pt_threshold_pix3l_sct1p = m_cutTrackPtGeV[cutIndex];
168 if( refit_pt >= refit_pt_threshold_pix3l_sct1p && bdt_score >= bdt_threshold_pix3l_sct1p ) is_passed = true;
169 }
170 else {
171 ATH_MSG_VERBOSE( " category is out of range = " << category );
172 }
173 ATH_MSG_VERBOSE( " isPassed = " << is_passed << ", cut index / pT / refitPt / BDT score = " << cutIndex << " / " << pt << " / " << refit_pt << " / " << bdt_score);
174
175 //
176 return is_passed;
177}
178
179// ------------------------------------------------------------------------------------------------
180// ------------------------------------------------------------------------------------------------
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
Header file to be included by clients of the Monitored infrastructure.
static const Attributes_t empty
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
StatusCode inclusiveSelection(std::vector< DisTrkHypoInfo > &) const
Gaudi::Property< std::vector< float > > m_cutBDTPix4Sct1p
Gaudi::Property< std::vector< float > > m_cutBDTPix3Sct1p
StatusCode multiplicitySelection(std::vector< DisTrkHypoInfo > &) const
Gaudi::Property< std::vector< float > > m_cutBDTPix3Sct0
TrigDisappearingTrackHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
Gaudi::Property< std::vector< float > > m_cutTrackPtGeV
Gaudi::Property< std::vector< float > > m_cutBDTPix4Sct0
StatusCode decide(std::vector< DisTrkHypoInfo > &) const
decides upon a collection of tracks
bool decideOnSingleObject(DisTrkHypoInfo &, size_t) const
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
void elementsInUniqueCombinations(const Index2DVec &indices, std::set< size_t > &participants, const std::function< bool(const Index1DVec &)> &filter)
std::vector< Index1DVec > Index2DVec
bool passed(DecisionID id, const DecisionIDContainer &idSet)
checks if required decision ID is in the set of IDs in the container
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.