ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
L1Topo
L1TopoAlgorithms
Root
DisambiguationDetaDPhiIncl3.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
* DisambiguationDetaDPhiIncl3.cpp
6
* Created by Joerg Stelzer / V Sorin on 9/16/14.
7
*
8
* @brief algorithm calculates the dR distance between objects in three lists, check first two with eta/phi differences, if pass
9
* check dR agains 3rd object, passed if no match with 3rd
10
*
11
* @param NumberLeading
12
**********************************/
13
14
#include <cmath>
15
16
#include "
L1TopoAlgorithms/DisambiguationDetaDPhiIncl3.h
"
17
#include "
L1TopoCommon/Exception.h
"
18
#include "
L1TopoInterfaces/Decision.h
"
19
#include "
L1TopoSimulationUtils/Helpers.h
"
20
21
REGISTER_ALG_TCS
(DisambiguationDetaDPhiIncl3)
22
23
24
// not the best solution but we will move to athena where this comes for free
25
#define LOG std::cout << "TCS::DisambiguationDetaDPhiIncl3: "
26
27
28
TCS::DisambiguationDetaDPhiIncl3::DisambiguationDetaDPhiIncl3
(
const
std::string &
name
) :
DecisionAlg
(
name
)
29
{
30
defineParameter
(
"InputWidth1"
, 9);
31
defineParameter
(
"InputWidth2"
, 9);
32
defineParameter
(
"InputWidth3"
, 9);
33
defineParameter
(
"MaxTob1"
, 0);
34
defineParameter
(
"MaxTob2"
, 0);
35
defineParameter
(
"MaxTob3"
, 0);
36
defineParameter
(
"NumResultBits"
, 2);
37
defineParameter
(
"MinET1"
,1);
38
defineParameter
(
"MinET2"
,1);
39
defineParameter
(
"MinET3"
,1);
40
defineParameter
(
"EtaMin1"
,0);
41
defineParameter
(
"EtaMax1"
,49);
42
defineParameter
(
"EtaMin2"
,0);
43
defineParameter
(
"EtaMax2"
,49);
44
defineParameter
(
"EtaMin3"
,0);
45
defineParameter
(
"EtaMax3"
,49);
46
defineParameter
(
"DeltaPhiMin"
, 0);
47
defineParameter
(
"DeltaPhiMax"
, 64);
48
defineParameter
(
"DeltaEtaMin"
, 0);
49
defineParameter
(
"DeltaEtaMax"
, 99);
50
defineParameter
(
"DisambDR"
,0,0);
51
defineParameter
(
"DisambDR"
,0,1);
52
setNumberOutputBits
(2);
53
}
54
55
TCS::DisambiguationDetaDPhiIncl3::~DisambiguationDetaDPhiIncl3
(){}
56
57
58
TCS::StatusCode
59
TCS::DisambiguationDetaDPhiIncl3::initialize
() {
60
61
p_NumberLeading1
=
parameter
(
"InputWidth1"
).value();
62
p_NumberLeading2
=
parameter
(
"InputWidth2"
).value();
63
p_NumberLeading3
=
parameter
(
"InputWidth3"
).value();
64
65
if
(
parameter
(
"MaxTob1"
).value() > 0)
p_NumberLeading1
=
parameter
(
"MaxTob1"
).value();
66
if
(
parameter
(
"MaxTob2"
).value() > 0)
p_NumberLeading2
=
parameter
(
"MaxTob2"
).value();
67
if
(
parameter
(
"MaxTob3"
).value() > 0)
p_NumberLeading3
=
parameter
(
"MaxTob3"
).value();
68
69
70
p_MinET1
=
parameter
(
"MinET1"
).value();
71
p_MinET2
=
parameter
(
"MinET2"
).value();
72
p_MinET3
=
parameter
(
"MinET3"
).value();
73
p_EtaMin1
=
parameter
(
"EtaMin1"
).value();
74
p_EtaMax1
=
parameter
(
"EtaMax1"
).value();
75
p_EtaMin2
=
parameter
(
"EtaMin2"
).value();
76
p_EtaMax2
=
parameter
(
"EtaMax2"
).value();
77
p_EtaMin3
=
parameter
(
"EtaMin3"
).value();
78
p_EtaMax3
=
parameter
(
"EtaMax3"
).value();
79
p_DeltaPhiMin
=
parameter
(
"DeltaPhiMin"
).value();
80
p_DeltaPhiMax
=
parameter
(
"DeltaPhiMax"
).value();
81
p_DeltaEtaMin
=
parameter
(
"DeltaEtaMin"
).value();
82
p_DeltaEtaMax
=
parameter
(
"DeltaEtaMax"
).value();
83
84
85
for
(
unsigned
int
i=0; i<
numberOutputBits
(); ++i) {
86
p_DisambDR
[i] =
parameter
(
"DisambDR"
, i).value();
87
}
88
89
90
91
TRG_MSG_INFO
(
"MinET1 : "
<<
p_MinET1
);
92
TRG_MSG_INFO
(
"EtaMin1 : "
<<
p_EtaMin1
);
93
TRG_MSG_INFO
(
"EtaMax1 : "
<<
p_EtaMax1
);
94
TRG_MSG_INFO
(
"MinET2 : "
<<
p_MinET2
);
95
TRG_MSG_INFO
(
"EtaMin2 : "
<<
p_EtaMin2
);
96
TRG_MSG_INFO
(
"EtaMax2 : "
<<
p_EtaMax2
);
97
TRG_MSG_INFO
(
"MinET3 : "
<<
p_MinET3
);
98
TRG_MSG_INFO
(
"EtaMin3 : "
<<
p_EtaMin3
);
99
TRG_MSG_INFO
(
"EtaMax3 : "
<<
p_EtaMax3
);
100
TRG_MSG_INFO
(
"DisambDR0 : "
<<
p_DisambDR
[0]);
101
TRG_MSG_INFO
(
"DisambDR1 : "
<<
p_DisambDR
[1]);
102
TRG_MSG_INFO
(
"DeltaPhimin : "
<<
p_DeltaPhiMin
);
103
TRG_MSG_INFO
(
"DeltaPhimin : "
<<
p_DeltaPhiMax
);
104
TRG_MSG_INFO
(
"DeltaEtamin : "
<<
p_DeltaEtaMin
);
105
TRG_MSG_INFO
(
"DeltaEtamin : "
<<
p_DeltaEtaMax
);
106
107
TRG_MSG_INFO
(
"number output : "
<<
numberOutputBits
());
108
109
110
return
StatusCode::SUCCESS
;
111
}
112
113
114
115
TCS::StatusCode
116
TCS::DisambiguationDetaDPhiIncl3::processBitCorrect
(
const
std::vector<TCS::TOBArray const *> & input,
117
const
std::vector<TCS::TOBArray *> & output,
118
Decision
& decision )
119
{
120
121
122
if
( input.size() == 3) {
123
124
125
for
(
TOBArray::const_iterator
tob1 = input[0]->begin();
126
tob1 != input[0]->end() && distance(input[0]->begin(), tob1) <
p_NumberLeading1
;
127
++tob1)
128
{
129
130
if
(
parType_t
((*tob1)->Et()) <=
p_MinET1
)
continue
;
// ET cut
131
if
(
parType_t
(std::abs((*tob1)->eta())) >
p_EtaMax1
)
continue
;
// Eta cut
132
if
(
parType_t
(std::abs((*tob1)->eta())) <
p_EtaMin1
)
continue
;
// Eta cut
133
134
for
(
TCS::TOBArray::const_iterator
tob2 = input[1]->begin();
135
tob2 != input[1]->end() && distance(input[1]->begin(), tob2) <
p_NumberLeading2
;
136
++tob2) {
137
138
if
(
parType_t
((*tob2)->Et()) <=
p_MinET2
)
continue
;
// ET cut
139
if
(
parType_t
(std::abs((*tob2)->eta())) >
p_EtaMax2
)
continue
;
// Eta cut
140
if
(
parType_t
(std::abs((*tob2)->eta())) <
p_EtaMin2
)
continue
;
// Eta cut
141
142
// DeltaPhi cuts
143
unsigned
int
deltaPhi
=
calcDeltaPhiBW
( *tob1, *tob2 );
144
// DeltaEta cuts
145
unsigned
int
deltaEta =
calcDeltaEtaBW
( *tob1, *tob2 );
146
147
if
(
deltaPhi
>
p_DeltaPhiMax
|| deltaEta >
p_DeltaEtaMax
)
continue
;
148
if
(deltaEta <
p_DeltaEtaMin
&&
deltaPhi
<
p_DeltaPhiMin
)
continue
;
149
150
for
(
TCS::TOBArray::const_iterator
tob3 = input[2]->begin();
151
tob3 != input[2]->end() ;
152
++tob3) {
153
if
(
parType_t
((*tob3)->Et()) <=
p_MinET3
)
continue
;
// ET cut
154
if
(
parType_t
(std::abs((*tob3)->eta())) >
p_EtaMax3
)
continue
;
// Eta cut
155
if
(
parType_t
(std::abs((*tob3)->eta())) <
p_EtaMin3
)
continue
;
// Eta cut
156
unsigned
int
deltaR13 =
calcDeltaR2BW
( *tob1, *tob3 );
157
unsigned
int
deltaR23 =
calcDeltaR2BW
( *tob2, *tob3 );
158
for
(
unsigned
int
i=0; i<
numberOutputBits
(); ++i) {
159
bool
accept =
false
;
160
accept = deltaR13 >
p_DisambDR
[i] && deltaR23 >
p_DisambDR
[i] ;
161
if
( accept ) {
162
decision.
setBit
(i,
true
);
163
output[i]->push_back(
TCS::CompositeTOB
(*tob1, *tob2));
164
}
165
TRG_MSG_DEBUG
(
"Decision "
<< i <<
": "
<< (accept?
"pass"
:
"fail"
) <<
" deltaR13 = "
<< deltaR13 <<
" deltaR23 = "
<< deltaR23);
166
}
167
}
168
}
169
}
170
bool
hasAmbiguousInputs =
TSU::isAmbiguousTruncation
(input[0],
p_NumberLeading1
,
p_MinET1
)
171
||
TSU::isAmbiguousTruncation
(input[1],
p_NumberLeading2
,
p_MinET2
)
172
||
TSU::isAmbiguousTruncation
(input[2],
p_NumberLeading3
,
p_MinET3
);
173
for
(
unsigned
int
i=0; i <
numberOutputBits
(); ++i) {
174
output[i]->setAmbiguityFlag(hasAmbiguousInputs);
175
}
176
}
else
{
177
TCS_EXCEPTION
(
"DisambiguationDetaDPhiIncl3 alg must have 3 inputs, but got "
<< input.size());
178
}
179
return
TCS::StatusCode::SUCCESS
;
180
181
}
182
183
TCS::StatusCode
184
TCS::DisambiguationDetaDPhiIncl3::process
(
const
std::vector<TCS::TOBArray const *> & input,
185
const
std::vector<TCS::TOBArray *> & output,
186
Decision
& decision )
187
{
188
189
190
if
( input.size() == 3) {
191
192
193
for
(
TOBArray::const_iterator
tob1 = input[0]->begin();
194
tob1 != input[0]->end() && distance(input[0]->begin(), tob1) <
p_NumberLeading1
;
195
++tob1)
196
{
197
198
if
(
parType_t
((*tob1)->Et()) <=
p_MinET1
)
continue
;
// ET cut
199
if
(
parType_t
(std::abs((*tob1)->eta())) >
p_EtaMax1
)
continue
;
// Eta cut
200
if
(
parType_t
(std::abs((*tob1)->eta())) <
p_EtaMin1
)
continue
;
// Eta cut
201
202
for
(
TCS::TOBArray::const_iterator
tob2 = input[1]->begin();
203
tob2 != input[1]->end() && distance(input[1]->begin(), tob2) <
p_NumberLeading2
;
204
++tob2) {
205
206
if
(
parType_t
((*tob2)->Et()) <=
p_MinET2
)
continue
;
// ET cut
207
if
(
parType_t
(std::abs((*tob2)->eta())) >
p_EtaMax2
)
continue
;
// Eta cut
208
if
(
parType_t
(std::abs((*tob2)->eta())) <
p_EtaMin2
)
continue
;
// Eta cut
209
210
// DeltaPhi cuts
211
unsigned
int
deltaPhi
=
calcDeltaPhi
( *tob1, *tob2 );
212
// DeltaEta cuts
213
unsigned
int
deltaEta =
calcDeltaEta
( *tob1, *tob2 );
214
215
if
(
deltaPhi
>
p_DeltaPhiMax
|| deltaEta >
p_DeltaEtaMax
)
continue
;
216
if
(deltaEta <
p_DeltaEtaMin
&&
deltaPhi
<
p_DeltaPhiMin
)
continue
;
217
218
for
(
TCS::TOBArray::const_iterator
tob3 = input[2]->begin();
219
tob3 != input[2]->end() ;
220
++tob3) {
221
if
(
parType_t
((*tob3)->Et()) <=
p_MinET3
)
continue
;
// ET cut
222
if
(
parType_t
(std::abs((*tob3)->eta())) >
p_EtaMax3
)
continue
;
// Eta cut
223
if
(
parType_t
(std::abs((*tob3)->eta())) <
p_EtaMin3
)
continue
;
// Eta cut
224
unsigned
int
deltaR13 =
calcDeltaR2
( *tob1, *tob3 );
225
unsigned
int
deltaR23 =
calcDeltaR2
( *tob2, *tob3 );
226
for
(
unsigned
int
i=0; i<
numberOutputBits
(); ++i) {
227
bool
accept =
false
;
228
accept = deltaR13 >
p_DisambDR
[i] && deltaR23 >
p_DisambDR
[i] ;
229
if
( accept ) {
230
decision.
setBit
(i,
true
);
231
output[i]->push_back(
TCS::CompositeTOB
(*tob1, *tob2));
232
}
233
TRG_MSG_DEBUG
(
"Decision "
<< i <<
": "
<< (accept?
"pass"
:
"fail"
) <<
" deltaR13 = "
<< deltaR13 <<
" deltaR23 = "
<< deltaR23);
234
}
235
}
236
}
237
}
238
}
else
{
239
TCS_EXCEPTION
(
"DisambiguationDetaDPhiIncl3 alg must have 3 inputs, but got "
<< input.size());
240
}
241
return
TCS::StatusCode::SUCCESS
;
242
}
REGISTER_ALG_TCS
#define REGISTER_ALG_TCS(CLASS)
Definition
AlgFactory.h:62
deltaPhi
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
Definition
AmgMatrixBasePlugin.h:112
Decision.h
DisambiguationDetaDPhiIncl3.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
Helpers.h
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::calcDeltaR2BW
unsigned int calcDeltaR2BW(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
Definition
ConfigurableAlg.cxx:154
TCS::ConfigurableAlg::calcDeltaPhiBW
unsigned int calcDeltaPhiBW(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
Definition
ConfigurableAlg.cxx:122
TCS::ConfigurableAlg::calcDeltaEta
unsigned int calcDeltaEta(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
Definition
ConfigurableAlg.cxx:175
TCS::ConfigurableAlg::calcDeltaEtaBW
unsigned int calcDeltaEtaBW(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
Definition
ConfigurableAlg.cxx:130
TCS::ConfigurableAlg::defineParameter
void defineParameter(std::string_view name, TCS::parType_t value)
Definition
ConfigurableAlg.cxx:203
TCS::ConfigurableAlg::calcDeltaR2
unsigned int calcDeltaR2(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
Definition
ConfigurableAlg.cxx:193
TCS::ConfigurableAlg::calcDeltaPhi
unsigned int calcDeltaPhi(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
Definition
ConfigurableAlg.cxx:167
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::DisambiguationDetaDPhiIncl3::p_EtaMax2
parType_t p_EtaMax2
Definition
DisambiguationDetaDPhiIncl3.h:45
TCS::DisambiguationDetaDPhiIncl3::p_DeltaEtaMin
parType_t p_DeltaEtaMin
Definition
DisambiguationDetaDPhiIncl3.h:50
TCS::DisambiguationDetaDPhiIncl3::p_EtaMin2
parType_t p_EtaMin2
Definition
DisambiguationDetaDPhiIncl3.h:44
TCS::DisambiguationDetaDPhiIncl3::p_DisambDR
parType_t p_DisambDR[2]
Definition
DisambiguationDetaDPhiIncl3.h:38
TCS::DisambiguationDetaDPhiIncl3::~DisambiguationDetaDPhiIncl3
virtual ~DisambiguationDetaDPhiIncl3()
Definition
DisambiguationDetaDPhiIncl3.cxx:55
TCS::DisambiguationDetaDPhiIncl3::initialize
virtual StatusCode initialize()
Definition
DisambiguationDetaDPhiIncl3.cxx:59
TCS::DisambiguationDetaDPhiIncl3::p_EtaMax3
parType_t p_EtaMax3
Definition
DisambiguationDetaDPhiIncl3.h:47
TCS::DisambiguationDetaDPhiIncl3::processBitCorrect
virtual StatusCode processBitCorrect(const std::vector< TCS::TOBArray const * > &input, const std::vector< TCS::TOBArray * > &output, Decision &decison)
Definition
DisambiguationDetaDPhiIncl3.cxx:116
TCS::DisambiguationDetaDPhiIncl3::p_EtaMin3
parType_t p_EtaMin3
Definition
DisambiguationDetaDPhiIncl3.h:46
TCS::DisambiguationDetaDPhiIncl3::p_NumberLeading1
parType_t p_NumberLeading1
Definition
DisambiguationDetaDPhiIncl3.h:35
TCS::DisambiguationDetaDPhiIncl3::p_EtaMax1
parType_t p_EtaMax1
Definition
DisambiguationDetaDPhiIncl3.h:43
TCS::DisambiguationDetaDPhiIncl3::p_MinET3
parType_t p_MinET3
Definition
DisambiguationDetaDPhiIncl3.h:41
TCS::DisambiguationDetaDPhiIncl3::DisambiguationDetaDPhiIncl3
DisambiguationDetaDPhiIncl3(const std::string &name)
Definition
DisambiguationDetaDPhiIncl3.cxx:28
TCS::DisambiguationDetaDPhiIncl3::p_MinET1
parType_t p_MinET1
Definition
DisambiguationDetaDPhiIncl3.h:39
TCS::DisambiguationDetaDPhiIncl3::p_MinET2
parType_t p_MinET2
Definition
DisambiguationDetaDPhiIncl3.h:40
TCS::DisambiguationDetaDPhiIncl3::p_NumberLeading2
parType_t p_NumberLeading2
Definition
DisambiguationDetaDPhiIncl3.h:36
TCS::DisambiguationDetaDPhiIncl3::p_DeltaPhiMax
parType_t p_DeltaPhiMax
Definition
DisambiguationDetaDPhiIncl3.h:49
TCS::DisambiguationDetaDPhiIncl3::p_NumberLeading3
parType_t p_NumberLeading3
Definition
DisambiguationDetaDPhiIncl3.h:37
TCS::DisambiguationDetaDPhiIncl3::p_DeltaEtaMax
parType_t p_DeltaEtaMax
Definition
DisambiguationDetaDPhiIncl3.h:51
TCS::DisambiguationDetaDPhiIncl3::process
virtual StatusCode process(const std::vector< TCS::TOBArray const * > &input, const std::vector< TCS::TOBArray * > &output, Decision &decison)
Definition
DisambiguationDetaDPhiIncl3.cxx:184
TCS::DisambiguationDetaDPhiIncl3::p_DeltaPhiMin
parType_t p_DeltaPhiMin
Definition
DisambiguationDetaDPhiIncl3.h:48
TCS::DisambiguationDetaDPhiIncl3::p_EtaMin1
parType_t p_EtaMin1
Definition
DisambiguationDetaDPhiIncl3.h:42
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
TSU::isAmbiguousTruncation
bool isAmbiguousTruncation(TCS::TOBArray const *tobs, size_t pos, unsigned minEt=0)
Definition
Trigger/TrigT1/L1Topo/L1TopoSimulationUtils/Root/Helpers.cxx:23
Generated on
for ATLAS Offline Software by
1.17.0