ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigHypothesis
TrigLongLivedParticlesHypo
src
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
8
#include "
TrigCompositeUtils/TrigCompositeUtils.h
"
9
#include "
TrigCompositeUtils/HLTIdentifier.h
"
10
#include "
TrigCompositeUtils/Combinators.h
"
11
#include "
AthenaMonitoringKernel/Monitored.h
"
12
#include "
TrigDisappearingTrackHypoTool.h
"
13
#include "GaudiKernel/PhysicalConstants.h"
14
15
using namespace
TrigCompositeUtils
;
16
17
// ------------------------------------------------------------------------------------------------
18
// ------------------------------------------------------------------------------------------------
19
20
TrigDisappearingTrackHypoTool::TrigDisappearingTrackHypoTool
(
const
std::string&
type
,
21
const
std::string& name,
22
const
IInterface* parent )
23
:
AthAlgTool
(
type
, name, parent ),
24
m_decisionId
(
HLT
::
Identifier
::fromToolName( name ) ) {}
25
26
TrigDisappearingTrackHypoTool::~TrigDisappearingTrackHypoTool
() {}
27
28
// ------------------------------------------------------------------------------------------------
29
// ------------------------------------------------------------------------------------------------
30
31
StatusCode
TrigDisappearingTrackHypoTool::initialize
()
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
43
StatusCode
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
65
StatusCode
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
;
75
TrigCompositeUtils::addDecisionID
(
m_decisionId
, input.decision);
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
90
StatusCode
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
134
bool
TrigDisappearingTrackHypoTool::decideOnSingleObject
(
DisTrkHypoInfo
& input,
size_t
cutIndex )
const
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
// ------------------------------------------------------------------------------------------------
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x,...)
Definition
AthMsgStreamMacros.h:42
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
Combinators.h
HLTIdentifier.h
TrigCompositeUtils.h
TrigDisappearingTrackHypoTool.h
empty
static const Attributes_t empty
Definition
XmlStreamer.cxx:16
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
TrigDisappearingTrackHypoTool::inclusiveSelection
StatusCode inclusiveSelection(std::vector< DisTrkHypoInfo > &) const
Definition
TrigDisappearingTrackHypoTool.cxx:65
TrigDisappearingTrackHypoTool::m_cutBDTPix4Sct1p
Gaudi::Property< std::vector< float > > m_cutBDTPix4Sct1p
Definition
TrigDisappearingTrackHypoTool.h:46
TrigDisappearingTrackHypoTool::m_cutBDTPix3Sct1p
Gaudi::Property< std::vector< float > > m_cutBDTPix3Sct1p
Definition
TrigDisappearingTrackHypoTool.h:48
TrigDisappearingTrackHypoTool::~TrigDisappearingTrackHypoTool
virtual ~TrigDisappearingTrackHypoTool()
Definition
TrigDisappearingTrackHypoTool.cxx:26
TrigDisappearingTrackHypoTool::multiplicitySelection
StatusCode multiplicitySelection(std::vector< DisTrkHypoInfo > &) const
Definition
TrigDisappearingTrackHypoTool.cxx:90
TrigDisappearingTrackHypoTool::m_decisionId
HLT::Identifier m_decisionId
Definition
TrigDisappearingTrackHypoTool.h:43
TrigDisappearingTrackHypoTool::m_cutBDTPix3Sct0
Gaudi::Property< std::vector< float > > m_cutBDTPix3Sct0
Definition
TrigDisappearingTrackHypoTool.h:47
TrigDisappearingTrackHypoTool::initialize
virtual StatusCode initialize() override
Definition
TrigDisappearingTrackHypoTool.cxx:31
TrigDisappearingTrackHypoTool::TrigDisappearingTrackHypoTool
TrigDisappearingTrackHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
TrigDisappearingTrackHypoTool.cxx:20
TrigDisappearingTrackHypoTool::m_cutTrackPtGeV
Gaudi::Property< std::vector< float > > m_cutTrackPtGeV
Definition
TrigDisappearingTrackHypoTool.h:44
TrigDisappearingTrackHypoTool::m_cutBDTPix4Sct0
Gaudi::Property< std::vector< float > > m_cutBDTPix4Sct0
Definition
TrigDisappearingTrackHypoTool.h:45
TrigDisappearingTrackHypoTool::decide
StatusCode decide(std::vector< DisTrkHypoInfo > &) const
decides upon a collection of tracks
Definition
TrigDisappearingTrackHypoTool.cxx:43
TrigDisappearingTrackHypoTool::decideOnSingleObject
bool decideOnSingleObject(DisTrkHypoInfo &, size_t) const
Definition
TrigDisappearingTrackHypoTool.cxx:134
HLT
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
Definition
HLTResultReader.h:26
HLT::elementsInUniqueCombinations
void elementsInUniqueCombinations(const Index2DVec &indices, std::set< size_t > &participants, const std::function< bool(const Index1DVec &)> &filter)
Definition
Combinators.cxx:155
HLT::Index2DVec
std::vector< Index1DVec > Index2DVec
Definition
TrigCompositeUtils/TrigCompositeUtils/Combinators.h:140
Identifier
Definition
IdentifierFieldParser.cxx:14
TrigCompositeUtils
Definition
TrigComposite.h:19
TrigCompositeUtils::passed
bool passed(DecisionID id, const DecisionIDContainer &idSet)
checks if required decision ID is in the set of IDs in the container
Definition
TrigCompositeUtilsRoot.cxx:118
TrigCompositeUtils::addDecisionID
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.
Definition
TrigCompositeUtilsRoot.cxx:59
type
TrigDisappearingTrackHypoTool::DisTrkHypoInfo
Definition
TrigDisappearingTrackHypoTool.h:30
Generated on
for ATLAS Offline Software by
1.17.0