ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigHypothesis
TrigTrackingHypo
src
IDCalibHypoTool.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 for IDCalib stream trigger
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 "
IDCalibHypoTool.h
"
13
#include "GaudiKernel/PhysicalConstants.h"
14
15
using namespace
TrigCompositeUtils
;
16
17
// ------------------------------------------------------------------------------------------------
18
// ------------------------------------------------------------------------------------------------
19
20
IDCalibHypoTool::IDCalibHypoTool
(
const
std::string&
type
,
const
std::string& name,
const
IInterface* parent )
21
:
AthAlgTool
(
type
, name, parent ),
22
m_decisionId
(
HLT
::
Identifier
::fromToolName( name ) ) {}
23
24
// ------------------------------------------------------------------------------------------------
25
// ------------------------------------------------------------------------------------------------
26
27
StatusCode
IDCalibHypoTool::initialize
()
28
{
29
ATH_MSG_INFO
(
"Initialization completed successfully:"
);
30
ATH_MSG_INFO
(
" cutTrackPtGeV = "
<<
m_cutTrackPtGeV
);
31
ATH_MSG_INFO
(
"Tool configured for chain/id: "
<<
m_decisionId
);
32
33
return
StatusCode::SUCCESS;
34
}
35
36
// ------------------------------------------------------------------------------------------------
37
// ------------------------------------------------------------------------------------------------
38
39
StatusCode
IDCalibHypoTool::decide
( std::vector<IDCalibHypoInfo>& toolInputs )
const
40
{
41
size_t
numTrigger =
m_cutTrackPtGeV
.size();
42
size_t
numTrks = toolInputs.size();
43
44
ATH_MSG_DEBUG
(
"Number of Tracks = "
<< numTrks );
45
46
if
( numTrigger == 1 ) {
47
ATH_MSG_DEBUG
(
"Applying selection of single for "
<<
m_decisionId
);
48
return
inclusiveSelection
(toolInputs);
49
}
50
else
{
51
ATH_MSG_DEBUG
(
"Applying selection of multiplicity for "
<<
m_decisionId
);
52
return
multiplicitySelection
(toolInputs);
53
}
54
55
return
StatusCode::SUCCESS;
56
}
57
58
// ------------------------------------------------------------------------------------------------
59
// ------------------------------------------------------------------------------------------------
60
61
StatusCode
IDCalibHypoTool::inclusiveSelection
(std::vector<IDCalibHypoInfo>& toolInputs)
const
62
{
63
bool
isPassed =
false
;
64
unsigned
int
iTrk=0;
65
for
(
auto
& input: toolInputs ) {
66
ATH_MSG_DEBUG
(
"--- iTrk="
<< iTrk <<
" ---"
);
67
if
(
TrigCompositeUtils::passed
(
m_decisionId
.numeric(), input.previousDecisionsIDs ) ) {
68
if
(
decideOnSingleObject
( input, 0 )==
true
) {
69
ATH_MSG_DEBUG
(
" Passed selection --> adding DecisionID"
);
70
isPassed =
true
;
71
TrigCompositeUtils::addDecisionID
(
m_decisionId
, input.decision);
72
}
73
}
else
{
74
ATH_MSG_DEBUG
(
" Not match DecisionID: "
<<
m_decisionId
);
75
}
76
++iTrk;
77
}
78
79
ATH_MSG_DEBUG
(
"Inclusive selection isPassed = "
<< isPassed );
80
return
StatusCode::SUCCESS;
81
}
82
83
// ------------------------------------------------------------------------------------------------
84
// ------------------------------------------------------------------------------------------------
85
86
StatusCode
IDCalibHypoTool::multiplicitySelection
(std::vector<IDCalibHypoInfo>& toolInputs)
const
87
{
88
HLT::Index2DVec
passingSelection(
m_cutTrackPtGeV
.size() );
89
90
for
(
size_t
cutIndex=0; cutIndex <
m_cutTrackPtGeV
.size(); ++cutIndex ) {
91
size_t
elementIndex{ 0 };
92
for
(
auto
& input: toolInputs ) {
93
if
(
TrigCompositeUtils::passed
(
m_decisionId
.numeric(), input.previousDecisionsIDs ) ) {
94
if
(
decideOnSingleObject
( input, cutIndex ) ==
true
) {
95
ATH_MSG_DEBUG
(
"Pass through selection "
<<
m_decisionId
<<
" : Event["
<< elementIndex <<
"]"
);
96
passingSelection[cutIndex].push_back( elementIndex );
97
}
98
}
99
else
{
100
ATH_MSG_DEBUG
(
"Not match DecisionID "
<<
m_decisionId
);
101
}
102
elementIndex++;
103
}
104
// If no object passes the selection, multipul selection should stop.
105
if
( passingSelection[cutIndex].
empty
() ) {
106
ATH_MSG_DEBUG
(
"No object passed selection "
<< cutIndex <<
" rejecting"
);
107
return
StatusCode::SUCCESS;
108
}
109
}
110
111
std::set<size_t> passingIndices;
112
HLT::elementsInUniqueCombinations
( passingSelection, passingIndices );
113
114
if
( passingIndices.empty() ) {
115
ATH_MSG_DEBUG
(
"No track passed through selection "
<<
m_decisionId
);
116
return
StatusCode::SUCCESS;
117
}
118
119
for
(
auto
idx: passingIndices ) {
120
ATH_MSG_DEBUG
(
"track["
<< idx <<
"] passes through Chain/ID "
<<
m_decisionId
<<
" with pT"
);
121
TrigCompositeUtils::addDecisionID
(
m_decisionId
.numeric(), toolInputs[idx].decision );
122
}
123
124
return
StatusCode::SUCCESS;
125
}
126
127
// ------------------------------------------------------------------------------------------------
128
// ------------------------------------------------------------------------------------------------
129
130
bool
IDCalibHypoTool::decideOnSingleObject
(
IDCalibHypoInfo
& input,
size_t
cutIndex )
const
131
{
132
bool
is_passed =
false
;
133
134
// values
135
float
pt = input.track->pt();
136
pt /= Gaudi::Units::GeV;
137
138
// pt selection
139
if
( pt >=
m_cutTrackPtGeV
[cutIndex] ) is_passed =
true
;
140
141
//
142
ATH_MSG_DEBUG
(
" isPassed = "
<< is_passed <<
", cut index / pT = "
<< cutIndex <<
" / "
<< pt );
143
return
is_passed;
144
}
145
146
// ------------------------------------------------------------------------------------------------
147
// ------------------------------------------------------------------------------------------------
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
IDCalibHypoTool.h
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
Combinators.h
HLTIdentifier.h
TrigCompositeUtils.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
IDCalibHypoTool::IDCalibHypoTool
IDCalibHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
IDCalibHypoTool.cxx:20
IDCalibHypoTool::multiplicitySelection
StatusCode multiplicitySelection(std::vector< IDCalibHypoInfo > &) const
Definition
IDCalibHypoTool.cxx:86
IDCalibHypoTool::m_cutTrackPtGeV
Gaudi::Property< std::vector< float > > m_cutTrackPtGeV
Definition
IDCalibHypoTool.h:43
IDCalibHypoTool::inclusiveSelection
StatusCode inclusiveSelection(std::vector< IDCalibHypoInfo > &) const
Definition
IDCalibHypoTool.cxx:61
IDCalibHypoTool::decide
StatusCode decide(std::vector< IDCalibHypoInfo > &) const
decides upon a collection of tracks
Definition
IDCalibHypoTool.cxx:39
IDCalibHypoTool::decideOnSingleObject
bool decideOnSingleObject(IDCalibHypoInfo &, size_t) const
Definition
IDCalibHypoTool.cxx:130
IDCalibHypoTool::m_decisionId
HLT::Identifier m_decisionId
Definition
IDCalibHypoTool.h:42
IDCalibHypoTool::initialize
virtual StatusCode initialize() override
Definition
IDCalibHypoTool.cxx:27
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
IDCalibHypoTool::IDCalibHypoInfo
Definition
IDCalibHypoTool.h:28
type
Generated on
for ATLAS Offline Software by
1.17.0