ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigHypothesis
TrigHLTJetHypo
src
FastReductionMatcher.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
./FastReductionMatcher.h
"
6
#include "
./FastReducer.h
"
7
#include "
./ITrigJetHypoInfoCollector.h
"
8
9
#include <map>
10
#include <algorithm>
11
#include <sstream>
12
13
FastReductionMatcher::FastReductionMatcher
(
ConditionPtrs
&& conditions,
14
ConditionFilters
&& filters,
15
const
ConditionFilterInds
& filterInds,
16
const
Tree
&
tree
):
17
m_conditions
(
std
::move(conditions)),
18
m_conditionFilters
(
std
::move(filters)),
19
m_conditionFilterInds
(filterInds),
20
m_tree
(
tree
){
21
22
if
(
m_conditions
[0]->capacity() != 0 or
23
m_conditions
[0]-> multiplicity() != 1) {
24
m_validState
=
false
;
25
m_msg
=
"Condition tree root node is not AcceptAll"
;
26
}
27
28
int
minNjets{0};
29
for
(
const
auto
& il :
m_tree
.leaves()){
30
const auto& condition = m_conditions[il];
31
32
if (!condition->isFromChainPart()) {
33
m_validState = false;
34
m_msg =
"Tree leaf condition but not from ChainPart"
;
35
}
36
minNjets += condition->capacity() * condition->multiplicity();
37
38
}
39
40
m_minNjets = std::max(1, minNjets);
41
42
if
(filterInds.size() != m_conditions.size()) {
43
m_validState =
false
;
44
std::stringstream
ss
;
45
ss
<<
"ConditionFilterInds and Conditions sequence sizes differ: "
;
46
ss
<< filterInds.size() <<
" "
<< m_conditions.size();
47
m_msg =
ss
.str();
48
}
49
50
}
51
52
53
std::optional<bool>
54
FastReductionMatcher::match
(
const
HypoJetVector
& jv,
55
xAODJetCollector
& jetCollector,
56
const
std::unique_ptr<ITrigJetHypoInfoCollector>& collector,
57
bool
)
const
{
58
/*
59
Decide if the incomming jet groups satisfiy all the conditions of the
60
condition tree.
61
62
The leaf nodes are tested first. Jet groups satisfyng the leaves
63
stored in a table. Once all leaves have been processed, the satisfying
64
groups are combined, and tested against the aprent nodes.
65
66
The procedure is iterated until the entire tree is checked, or
67
an unsatisfied condition is found. If no unsatisfied condition,
68
there is a match.
69
*/
70
71
auto
njets = jv.size();
72
73
if
(njets <
m_minNjets
) {
74
if
(collector) {
75
collector->collect(
"FastReductionMatcher"
,
76
"have "
+ std::to_string(njets) +
77
" jets need "
+ std::to_string(
m_minNjets
) +
78
" pass: false"
);
79
}
80
return
false
;
81
}
82
83
FastReducer
reducer(jv,
84
m_conditions
,
85
m_conditionFilters
,
86
m_conditionFilterInds
,
87
m_tree
,
88
jetCollector,
89
collector);
90
91
return
std::make_optional<bool>(reducer.
pass
());
92
}
93
94
95
std::string
FastReductionMatcher::toString
()
const
{
96
std::stringstream
ss
;
97
ss
<<
"FastReductionMatcher:\n"
98
<<
" treeVector: "
<<
m_tree
<<
'\n'
99
<<
" min required jets "
<<
m_minNjets
<<
"\n\n"
100
<<
"FastReductionMatcher Conditions ["
101
<<
m_conditions
.size() <<
"]: \n\n"
;
102
103
std::size_t
count
{0u};
104
for
(
const
auto
& c :
m_conditions
){
105
auto
sc
= std::to_string(
count
++);
106
sc
.insert(
sc
.begin(), 3-
sc
.length(),
' '
);
107
ss
<<
sc
<<
": "
<< c->toString() +
'\n'
;
108
}
109
110
111
ss
<<
"FastReductionMatcher ConditionFilter indices ["
112
<<
m_conditionFilterInds
.size() <<
"]: \n"
;
113
114
115
count
= 0;
116
for
(
const
auto
& c :
m_conditionFilterInds
){
117
auto
sc
= std::to_string(
count
++);
118
sc
.insert(
sc
.begin(), 3-
sc
.length(),
' '
);
119
ss
<<
sc
<<
": "
<< c <<
'\n'
;
120
}
121
122
123
ss
<<
"FastReductionMatcher ConditionFilters ["
124
<<
m_conditionFilters
.size() <<
"]: \n"
;
125
126
127
count
= 0;
128
for
(
const
auto
& c :
m_conditionFilters
){
129
auto
sc
= std::to_string(
count
++);
130
sc
.insert(
sc
.begin(), 3-
sc
.length(),
' '
);
131
ss
<<
sc
<<
": "
<< c->toString() +
'\n'
;
132
}
133
134
135
return
ss
.str();
136
}
137
138
bool
FastReductionMatcher::valid
()
const
{
return
m_validState
;}
139
std::string
FastReductionMatcher::msg
()
const
{
return
m_msg
;}
FastReducer.h
FastReductionMatcher.h
ConditionFilterInds
std::vector< int > ConditionFilterInds
Definition
FastReductionMatcher.h:21
ConditionFilters
std::vector< std::unique_ptr< IHypoJetVectorFilter > > ConditionFilters
Definition
FastReductionMatcher.h:18
HypoJetVector
std::vector< pHypoJet > HypoJetVector
Definition
HypoJetDefs.h:27
ITrigJetHypoInfoCollector.h
ss
static Double_t ss
Definition
LArPhysWaveHECTool.cxx:37
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
ConditionPtrs
std::vector< ConditionPtr > ConditionPtrs
Definition
RepeatedConditionsDefs.h:20
FastReducer
Definition
FastReducer.h:35
FastReducer::pass
bool pass() const
determine whether a set of jets satisfies all hypo conditions.
Definition
FastReducer.cxx:552
FastReductionMatcher::m_msg
std::string m_msg
Definition
FastReductionMatcher.h:74
FastReductionMatcher::toString
std::string toString() const override
Definition
FastReductionMatcher.cxx:95
FastReductionMatcher::m_conditions
ConditionPtrs m_conditions
Definition
FastReductionMatcher.h:57
FastReductionMatcher::FastReductionMatcher
FastReductionMatcher(ConditionPtrs &&, ConditionFilters &&, const ConditionFilterInds &, const Tree &)
Definition
FastReductionMatcher.cxx:13
FastReductionMatcher::match
virtual std::optional< bool > match(const HypoJetVector &jv, xAODJetCollector &, const std::unique_ptr< ITrigJetHypoInfoCollector > &collector, bool) const override
determine whether a set of jets satisfies all hypo conditions.
Definition
FastReductionMatcher.cxx:54
FastReductionMatcher::m_tree
Tree m_tree
tree structure for Conditions objects.
Definition
FastReductionMatcher.h:66
FastReductionMatcher::msg
virtual std::string msg() const override
Definition
FastReductionMatcher.cxx:139
FastReductionMatcher::m_conditionFilterInds
ConditionFilterInds m_conditionFilterInds
Definition
FastReductionMatcher.h:59
FastReductionMatcher::valid
virtual bool valid() const override
Definition
FastReductionMatcher.cxx:138
FastReductionMatcher::m_conditionFilters
ConditionFilters m_conditionFilters
Definition
FastReductionMatcher.h:58
FastReductionMatcher::m_minNjets
long unsigned int m_minNjets
Definition
FastReductionMatcher.h:70
FastReductionMatcher::m_validState
bool m_validState
Definition
FastReductionMatcher.h:73
Tree
Definition
Tree.h:18
xAODJetCollector
Definition
xAODJetCollector.h:20
count
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
Definition
hcg.cxx:148
std
STL namespace.
tree
TChain * tree
Definition
tile_monitor.h:30
Generated on
for ATLAS Offline Software by
1.17.0