ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
L1Topo
L1TopoAlgorithms
Root
RatioSum.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
/*********************************
5
* RatioSum.cpp
6
* Created by Joerg Stelzer on 11/16/12.
7
*
8
* @brief algorithm to select W tag-and-probe events using MET/sumET
9
*
10
* In addition, also apply cuts on Ht and MET.
11
* For a more detailed description, see Sec. 4.3.2 of
12
* ATL-COM-DAQ-2014-005 and the references therein.
13
*
14
**********************************/
15
16
#include <cmath>
17
18
#include "
L1TopoAlgorithms/RatioSum.h
"
19
#include "
L1TopoCommon/Exception.h
"
20
#include "
L1TopoInterfaces/Decision.h
"
21
22
23
REGISTER_ALG_TCS
(RatioSum)
24
25
// not the best solution but we will move to athena where this comes for free
26
#define LOG std::cout << name() << ": "
27
28
29
TCS::RatioSum::RatioSum
(
const
std::string &
name
) :
DecisionAlg
(
name
)
30
{
31
defineParameter
(
"InputWidth1"
, 9);
32
defineParameter
(
"InputWidth2"
, 9);
33
defineParameter
(
"InputWidth3"
, 9);
34
defineParameter
(
"MaxTob1"
, 0);
35
defineParameter
(
"MaxTob2"
, 0);
36
defineParameter
(
"MaxTob3"
, 0);
37
defineParameter
(
"NumResultBits"
, 2);
38
defineParameter
(
"UseCluster05Granularity"
,0);
39
defineParameter
(
"MinET2"
,0);
40
defineParameter
(
"EtaMin2"
,0);
41
defineParameter
(
"EtaMax2"
,49);
42
defineParameter
(
"MinET3"
,0);
43
defineParameter
(
"EtaMin3"
,0);
44
defineParameter
(
"EtaMax3"
,49);
45
defineParameter
(
"MinMET"
,0);
46
defineParameter
(
"HT"
,0);
47
defineParameter
(
"SUM"
,0);
48
defineParameter
(
"Ratio"
,0,0);
49
defineParameter
(
"Ratio"
,0,1);
50
setNumberOutputBits
(2);
51
}
52
53
TCS::RatioSum::~RatioSum
()
54
{}
55
56
57
TCS::StatusCode
58
TCS::RatioSum::initialize
() {
59
p_NumberLeading1
=
parameter
(
"InputWidth1"
).value();
60
p_NumberLeading2
=
parameter
(
"InputWidth2"
).value();
61
p_NumberLeading3
=
parameter
(
"InputWidth3"
).value();
62
63
if
(
parameter
(
"MaxTob1"
).value() > 0)
p_NumberLeading1
=
parameter
(
"MaxTob1"
).value();
64
if
(
parameter
(
"MaxTob2"
).value() > 0)
p_NumberLeading2
=
parameter
(
"MaxTob2"
).value();
65
if
(
parameter
(
"MaxTob3"
).value() > 0)
p_NumberLeading3
=
parameter
(
"MaxTob3"
).value();
66
67
68
69
70
TRG_MSG_INFO
(
"Maxtob 1 : "
<<
p_NumberLeading1
);
71
TRG_MSG_INFO
(
"Maxtob 2 : "
<<
p_NumberLeading2
);
72
TRG_MSG_INFO
(
"Maxtob 3 : "
<<
p_NumberLeading3
);
73
74
p_MinMET
=
parameter
(
"MinMET"
).value();
75
p_MinET2
=
parameter
(
"MinET2"
).value();
76
p_MinET3
=
parameter
(
"MinET3"
).value();
77
78
p_EtaMin2
=
parameter
(
"EtaMin2"
).value();
79
p_EtaMax2
=
parameter
(
"EtaMax2"
).value();
80
p_EtaMin3
=
parameter
(
"EtaMin3"
).value();
81
p_EtaMax3
=
parameter
(
"EtaMax3"
).value();
82
83
84
85
TRG_MSG_INFO
(
"MinMET : "
<<
p_MinMET
);
86
TRG_MSG_INFO
(
"MinET2 : "
<<
p_MinET2
);
87
TRG_MSG_INFO
(
"EtaMin2 : "
<<
p_EtaMin2
);
88
TRG_MSG_INFO
(
"EtaMax2 : "
<<
p_EtaMax2
);
89
90
TRG_MSG_INFO
(
"MinET3 : "
<<
p_MinET3
);
91
TRG_MSG_INFO
(
"EtaMin3 : "
<<
p_EtaMin3
);
92
TRG_MSG_INFO
(
"EtaMax3 : "
<<
p_EtaMax3
);
93
94
95
96
p_HT
=
parameter
(
"HT"
).value();
97
p_SUM
=
parameter
(
"SUM"
).value();
98
for
(
unsigned
int
i=0; i<
numberOutputBits
(); ++i) {
99
p_Ratio
[i] =
parameter
(
"Ratio"
, i).value();
100
101
TRG_MSG_INFO
(
"Ratio "
<< i <<
" : "
<<
p_Ratio
[i]);
102
}
103
TRG_MSG_INFO
(
"HT "
<<
p_HT
);
104
TRG_MSG_INFO
(
"SUM "
<<
p_SUM
);
105
106
TRG_MSG_INFO
(
"nummber output : "
<<
numberOutputBits
());
107
return
StatusCode::SUCCESS
;
108
}
109
110
TCS::StatusCode
111
TCS::RatioSum::processBitCorrect
(
const
std::vector<TCS::TOBArray const *> & input,
112
const
std::vector<TCS::TOBArray *> & output,
113
Decision
& decision )
114
115
{
116
//Only difference between this method and process()
117
//is the replacement of the function fabs() --> abs()
118
//Note, however, that this algorithm benefits from MetSort
119
//which is a sorting algorithm that does have a distinct bitwise implementation
120
121
if
(input.size()!=3) {
122
TCS_EXCEPTION
(
"RatioSum alg must have exactly 3 input lists, but got "
<< input.size());
123
}
124
// Note (from Murrough, ATR-14913, 2016-08-25):
125
// summing Et in ints so it might be losing 0.5 GeV counts from EM/Tau lists
126
unsigned
int
sumET = 0;
127
unsigned
int
sumET2 = 0;
128
unsigned
int
nLeadingele =
p_NumberLeading3
;
129
130
const
TCS::GenericTOB
&
met
= (*input[0])[0];
131
132
// loop over all jets
133
unsigned
int
objC(0);
134
for
(
TCS::GenericTOB
* tob : *input[1]) {
135
136
if
(
parType_t
(abs(tob->eta())) >
p_EtaMax2
)
continue
;
// Eta cut
137
if
(
parType_t
(abs(tob->eta())) <
p_EtaMin2
)
continue
;
// Eta cut
138
if
( tob->Et() <=
p_MinET2
)
continue
;
// E_T cut
139
140
TRG_MSG_DEBUG
(
"Jet : ET = "
<< tob->Et());
141
++objC;
142
sumET2 += tob->Et();
143
144
}
145
146
sumET = sumET2;
147
148
// loop over the third collection (EM/tau)
149
for
(
TOBArray::const_iterator
tob1 = input[2]->begin();
150
tob1 != input[2]->end() && distance( input[2]->begin(), tob1) < nLeadingele;
151
++tob1)
152
{
153
154
if
(
parType_t
(abs((*tob1)->eta())) >
p_EtaMax3
)
continue
;
// Eta cut
155
if
(
parType_t
(abs((*tob1)->eta())) <
p_EtaMin3
)
continue
;
// Eta cut
156
if
( (*tob1)->Et() <=
p_MinET3
)
continue
;
// E_T cut
157
sumET += (*tob1)->Et() ;
158
159
}
160
161
for
(
unsigned
int
i=0; i<
numberOutputBits
(); ++i) {
162
163
bool
accept = (objC!=0 &&
met
.Et() >
p_MinMET
&&
164
sumET!=sumET2 &&
// in practice, require an EM TOB with Et > 0 (see ATR-14913)
165
sumET2 >
p_HT
&&
166
sumET >
p_SUM
&&
167
10*
met
.Et() >=
p_Ratio
[i]*sumET);
168
169
decision.
setBit
( i, accept );
170
171
if
(accept)
172
output[i]->push_back(
CompositeTOB
(
GenericTOB::createOnHeap
(
GenericTOB
(sumET,0,0) ) ));
173
174
TRG_MSG_DEBUG
(
"Decision "
<< i <<
": "
<< (accept?
"pass"
:
"fail"
) <<
" HT = "
<< sumET2 <<
" SUM = "
<< sumET);
175
176
}
177
178
return
TCS::StatusCode::SUCCESS
;
179
}
180
181
TCS::StatusCode
182
TCS::RatioSum::process
(
const
std::vector<TCS::TOBArray const *> & input,
183
const
std::vector<TCS::TOBArray *> & output,
184
Decision
& decision )
185
{
186
187
if
(input.size()!=3) {
188
TCS_EXCEPTION
(
"RatioSum alg must have exactly 3 input lists, but got "
<< input.size());
189
}
190
// Note (from Murrough, ATR-14913, 2016-08-25):
191
// summing Et in ints so it might be losing 0.5 GeV counts from EM/Tau lists
192
unsigned
int
sumET = 0;
193
unsigned
int
sumET2 = 0;
194
unsigned
int
nLeadingele =
p_NumberLeading3
;
195
196
const
TCS::GenericTOB
&
met
= (*input[0])[0];
197
198
// loop over all jets
199
unsigned
int
objC(0);
200
for
(
TCS::GenericTOB
* tob : *input[1]) {
201
202
if
(
parType_t
(std::abs(tob->eta())) >
p_EtaMax2
)
continue
;
// Eta cut
203
if
(
parType_t
(std::abs(tob->eta())) <
p_EtaMin2
)
continue
;
// Eta cut
204
if
( tob->Et() <=
p_MinET2
)
continue
;
// E_T cut
205
206
TRG_MSG_DEBUG
(
"Jet : ET = "
<< tob->Et());
207
++objC;
208
sumET2 += tob->Et();
209
}
210
211
sumET = sumET2;
212
213
// loop over the third collection (EM/tau)
214
for
(
TOBArray::const_iterator
tob1 = input[2]->begin();
215
tob1 != input[2]->end() && distance( input[2]->begin(), tob1) < nLeadingele;
216
++tob1)
217
{
218
219
if
(
parType_t
(std::abs((*tob1)->eta())) >
p_EtaMax3
)
continue
;
// Eta cut
220
if
(
parType_t
(std::abs((*tob1)->eta())) <
p_EtaMin3
)
continue
;
// Eta cut
221
if
( (*tob1)->Et() <=
p_MinET3
)
continue
;
// E_T cut
222
sumET += (*tob1)->Et() ;
223
224
}
225
226
for
(
unsigned
int
i=0; i<
numberOutputBits
(); ++i) {
227
228
bool
accept = (objC!=0 &&
met
.Et() >
p_MinMET
&&
229
sumET!=sumET2 &&
// in practice, require an EM TOB with Et > 0 (see ATR-14913)
230
sumET2 >
p_HT
&&
231
sumET >
p_SUM
&&
232
10*
met
.Et() >=
p_Ratio
[i]*sumET);
233
234
decision.
setBit
( i, accept );
235
236
if
(accept)
237
output[i]->push_back(
CompositeTOB
(
GenericTOB::createOnHeap
(
GenericTOB
(sumET,0,0) ) ));
238
239
TRG_MSG_DEBUG
(
"Decision "
<< i <<
": "
<< (accept?
"pass"
:
"fail"
) <<
" HT = "
<< sumET2 <<
" SUM = "
<< sumET);
240
241
}
242
243
return
TCS::StatusCode::SUCCESS
;
244
}
REGISTER_ALG_TCS
#define REGISTER_ALG_TCS(CLASS)
Definition
AlgFactory.h:62
Decision.h
RatioSum.h
TRG_MSG_INFO
#define TRG_MSG_INFO(x)
Definition
Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStreamMacros.h:27
TRG_MSG_DEBUG
#define TRG_MSG_DEBUG(x)
Definition
Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStreamMacros.h:25
Exception.h
TCS_EXCEPTION
#define TCS_EXCEPTION(MSG)
Definition
Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/Exception.h:15
TCS::CompositeTOB
Definition
CompositeTOB.h:16
TCS::ConfigurableAlg::name
const std::string & name() const
Definition
ConfigurableAlg.h:49
TCS::ConfigurableAlg::parameter
const Parameter & parameter(std::string_view parameterName) const
Definition
ConfigurableAlg.cxx:245
TCS::ConfigurableAlg::defineParameter
void defineParameter(std::string_view name, TCS::parType_t value)
Definition
ConfigurableAlg.cxx:203
TCS::DataArrayImpl< GenericTOB >::const_iterator
data_t::const_iterator const_iterator
Definition
DataArrayImpl.h:18
TCS::DecisionAlg::setNumberOutputBits
void setNumberOutputBits(unsigned int numberOutputBits)
Definition
DecisionAlg.h:39
TCS::DecisionAlg::DecisionAlg
DecisionAlg(const std::string &name)
Definition
DecisionAlg.h:24
TCS::DecisionAlg::numberOutputBits
unsigned int numberOutputBits() const
Definition
DecisionAlg.h:38
TCS::Decision
Definition
Decision.h:19
TCS::Decision::setBit
void setBit(unsigned int index, bool value)
Definition
Decision.cxx:12
TCS::GenericTOB
Definition
GenericTOB.h:35
TCS::GenericTOB::createOnHeap
static GenericTOB * createOnHeap(const GenericTOB &)
Definition
GenericTOB.cxx:271
TCS::RatioSum::p_EtaMax3
parType_t p_EtaMax3
Definition
RatioSum.h:44
TCS::RatioSum::process
virtual StatusCode process(const std::vector< TCS::TOBArray const * > &input, const std::vector< TCS::TOBArray * > &output, Decision &decison)
Definition
RatioSum.cxx:182
TCS::RatioSum::initialize
virtual StatusCode initialize()
Definition
RatioSum.cxx:58
TCS::RatioSum::p_MinET2
parType_t p_MinET2
Definition
RatioSum.h:39
TCS::RatioSum::p_HT
parType_t p_HT
Definition
RatioSum.h:46
TCS::RatioSum::p_NumberLeading2
parType_t p_NumberLeading2
Definition
RatioSum.h:35
TCS::RatioSum::p_EtaMax2
parType_t p_EtaMax2
Definition
RatioSum.h:41
TCS::RatioSum::~RatioSum
virtual ~RatioSum()
Definition
RatioSum.cxx:53
TCS::RatioSum::RatioSum
RatioSum(const std::string &name)
Definition
RatioSum.cxx:29
TCS::RatioSum::p_NumberLeading1
parType_t p_NumberLeading1
Definition
RatioSum.h:34
TCS::RatioSum::p_EtaMin2
parType_t p_EtaMin2
Definition
RatioSum.h:40
TCS::RatioSum::p_EtaMin3
parType_t p_EtaMin3
Definition
RatioSum.h:43
TCS::RatioSum::p_MinMET
parType_t p_MinMET
Definition
RatioSum.h:38
TCS::RatioSum::p_MinET3
parType_t p_MinET3
Definition
RatioSum.h:42
TCS::RatioSum::p_NumberLeading3
parType_t p_NumberLeading3
Definition
RatioSum.h:36
TCS::RatioSum::p_SUM
parType_t p_SUM
Definition
RatioSum.h:47
TCS::RatioSum::processBitCorrect
virtual StatusCode processBitCorrect(const std::vector< TCS::TOBArray const * > &input, const std::vector< TCS::TOBArray * > &output, Decision &decison)
Definition
RatioSum.cxx:111
TCS::RatioSum::p_Ratio
parType_t p_Ratio[2]
Definition
RatioSum.h:48
TCS::StatusCode
Definition
Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:15
TCS::StatusCode::SUCCESS
@ SUCCESS
Definition
Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:17
TCS::parType_t
uint32_t parType_t
Definition
Parameter.h:23
met
Definition
IMETSignificance.h:24
Generated on
for ATLAS Offline Software by
1.17.0