ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
L1Topo
L1TopoAlgorithms
Root
DisambiguationIncl2.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
* DisambiguationIncl2.cpp
6
* Created by Joerg Stelzer / V Sorin on 2014.
7
*
8
* @brief algorithm calculates the dR distance between objects in two lists, accept if at least a pair does not match in dR
9
*
10
* @param NumberLeading
11
**********************************/
12
13
#include <cmath>
14
15
#include "
L1TopoAlgorithms/DisambiguationIncl2.h
"
16
#include "
L1TopoCommon/Exception.h
"
17
#include "
L1TopoInterfaces/Decision.h
"
18
#include "
L1TopoSimulationUtils/Helpers.h
"
19
20
REGISTER_ALG_TCS
(DisambiguationIncl2)
21
22
23
// not the best solution but we will move to athena where this comes for free
24
#define LOG std::cout << "TCS::DisambiguationIncl2: "
25
26
TCS::DisambiguationIncl2::DisambiguationIncl2
(
const
std::string &
name
) :
DecisionAlg
(
name
)
27
{
28
defineParameter
(
"InputWidth1"
, 9);
29
defineParameter
(
"InputWidth2"
, 9);
30
defineParameter
(
"MaxTob1"
, 0);
31
defineParameter
(
"MaxTob2"
, 0);
32
defineParameter
(
"NumResultBits"
, 2);
33
defineParameter
(
"ClusterOnly"
,0);
34
defineParameter
(
"ApplyDR"
,0);
35
defineParameter
(
"MinET1"
,1,0);
36
defineParameter
(
"MinET2"
,1,0);
37
defineParameter
(
"DisambDRSqrMin"
,0,0);
38
defineParameter
(
"MinET1"
,1,1);
39
defineParameter
(
"MinET2"
,1,1);
40
defineParameter
(
"DisambDRSqrMin"
,0,1);
41
setNumberOutputBits
(2);
42
}
43
44
TCS::DisambiguationIncl2::~DisambiguationIncl2
(){}
45
46
47
TCS::StatusCode
48
TCS::DisambiguationIncl2::initialize
() {
49
p_NumberLeading1
=
parameter
(
"InputWidth1"
).value();
50
p_NumberLeading2
=
parameter
(
"InputWidth2"
).value();
51
if
(
parameter
(
"MaxTob1"
).value() > 0)
p_NumberLeading1
=
parameter
(
"MaxTob1"
).value();
52
if
(
parameter
(
"MaxTob2"
).value() > 0)
p_NumberLeading2
=
parameter
(
"MaxTob2"
).value();
53
54
for
(
unsigned
int
i=0; i<
numberOutputBits
(); ++i) {
55
p_MinET1
[i] =
parameter
(
"MinET1"
,i).value();
56
p_MinET2
[i] =
parameter
(
"MinET2"
,i).value();
57
58
p_DisambDR
[i] =
parameter
(
"DisambDRSqrMin"
, i).value();
59
60
TRG_MSG_INFO
(
"MinET1 "
<< i <<
" : "
<<
p_MinET1
[i]);
61
TRG_MSG_INFO
(
"MinET2 "
<< i <<
" : "
<<
p_MinET2
[i]);
62
TRG_MSG_INFO
(
"DisambDR "
<< i <<
" : "
<<
p_DisambDR
[i]);
63
64
65
}
66
67
68
TRG_MSG_INFO
(
"number output : "
<<
numberOutputBits
());
69
70
71
return
StatusCode::SUCCESS
;
72
}
73
74
75
76
TCS::StatusCode
77
TCS::DisambiguationIncl2::processBitCorrect
(
const
std::vector<TCS::TOBArray const *> & input,
78
const
std::vector<TCS::TOBArray *> & output,
79
Decision
& decision )
80
{
81
82
83
if
( input.size() == 2) {
84
85
86
for
(
TOBArray::const_iterator
tob1 = input[0]->begin();
87
tob1 != input[0]->end() && distance(input[0]->begin(), tob1) <
p_NumberLeading1
;
88
++tob1)
89
{
90
91
92
for
(
TCS::TOBArray::const_iterator
tob2 = input[1]->begin();
93
tob2 != input[1]->end() && distance(input[1]->begin(), tob2) <
p_NumberLeading2
;
94
++tob2) {
95
96
97
// test DeltaR2Min, DeltaR2Max
98
unsigned
int
deltaR2 =
calcDeltaR2BW
( *tob1, *tob2 );
99
100
for
(
unsigned
int
i=0; i<
numberOutputBits
(); ++i) {
101
bool
accept =
false
;
102
if
(
parType_t
((*tob1)->Et()) <=
p_MinET1
[i])
continue
;
// ET cut
103
if
(
parType_t
((*tob2)->Et()) <=
p_MinET2
[i])
continue
;
// ET cut
104
accept = deltaR2 >
p_DisambDR
[i] ;
105
if
( accept ) {
106
decision.
setBit
(i,
true
);
107
output[i]->push_back(
TCS::CompositeTOB
(*tob1, *tob2));
108
}
109
TRG_MSG_DEBUG
(
"Decision "
<< i <<
": "
<< (accept?
"pass"
:
"fail"
) <<
" deltaR2 = "
<< deltaR2);
110
}
111
}
112
}
113
for
(
unsigned
int
i=0; i <
numberOutputBits
(); ++i) {
114
bool
hasAmbiguousInputs =
TSU::isAmbiguousTruncation
(input[0],
p_NumberLeading1
,
p_MinET1
[i])
115
||
TSU::isAmbiguousTruncation
(input[1],
p_NumberLeading2
,
p_MinET2
[i]);
116
output[i]->setAmbiguityFlag(hasAmbiguousInputs);
117
}
118
}
else
{
119
120
TCS_EXCEPTION
(
"DisambiguationIncl2 alg must have 2 inputs, but got "
<< input.size());
121
122
}
123
return
TCS::StatusCode::SUCCESS
;
124
125
}
126
127
TCS::StatusCode
128
TCS::DisambiguationIncl2::process
(
const
std::vector<TCS::TOBArray const *> & input,
129
const
std::vector<TCS::TOBArray *> & output,
130
Decision
& decision )
131
{
132
133
134
if
( input.size() == 2) {
135
136
137
for
(
TOBArray::const_iterator
tob1 = input[0]->begin();
138
tob1 != input[0]->end() && distance(input[0]->begin(), tob1) <
p_NumberLeading1
;
139
++tob1)
140
{
141
142
143
for
(
TCS::TOBArray::const_iterator
tob2 = input[1]->begin();
144
tob2 != input[1]->end() && distance(input[1]->begin(), tob2) <
p_NumberLeading2
;
145
++tob2) {
146
147
148
// test DeltaR2Min, DeltaR2Max
149
unsigned
int
deltaR2 =
calcDeltaR2
( *tob1, *tob2 );
150
151
for
(
unsigned
int
i=0; i<
numberOutputBits
(); ++i) {
152
bool
accept =
false
;
153
if
(
parType_t
((*tob1)->Et()) <=
p_MinET1
[i])
continue
;
// ET cut
154
if
(
parType_t
((*tob2)->Et()) <=
p_MinET2
[i])
continue
;
// ET cut
155
accept = deltaR2 >
p_DisambDR
[i] ;
156
if
( accept ) {
157
decision.
setBit
(i,
true
);
158
output[i]->push_back(
TCS::CompositeTOB
(*tob1, *tob2));
159
}
160
TRG_MSG_DEBUG
(
"Decision "
<< i <<
": "
<< (accept?
"pass"
:
"fail"
) <<
" deltaR2 = "
<< deltaR2);
161
}
162
}
163
}
164
}
else
{
165
166
TCS_EXCEPTION
(
"DisambiguationIncl2 alg must have 2 inputs, but got "
<< input.size());
167
168
}
169
return
TCS::StatusCode::SUCCESS
;
170
}
REGISTER_ALG_TCS
#define REGISTER_ALG_TCS(CLASS)
Definition
AlgFactory.h:62
Decision.h
DisambiguationIncl2.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::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::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::DisambiguationIncl2::~DisambiguationIncl2
virtual ~DisambiguationIncl2()
Definition
DisambiguationIncl2.cxx:44
TCS::DisambiguationIncl2::processBitCorrect
virtual StatusCode processBitCorrect(const std::vector< TCS::TOBArray const * > &input, const std::vector< TCS::TOBArray * > &output, Decision &decison)
Definition
DisambiguationIncl2.cxx:77
TCS::DisambiguationIncl2::p_DisambDR
parType_t p_DisambDR[2]
Definition
DisambiguationIncl2.h:36
TCS::DisambiguationIncl2::DisambiguationIncl2
DisambiguationIncl2(const std::string &name)
Definition
DisambiguationIncl2.cxx:26
TCS::DisambiguationIncl2::p_MinET1
parType_t p_MinET1[2]
Definition
DisambiguationIncl2.h:37
TCS::DisambiguationIncl2::initialize
virtual StatusCode initialize()
Definition
DisambiguationIncl2.cxx:48
TCS::DisambiguationIncl2::process
virtual StatusCode process(const std::vector< TCS::TOBArray const * > &input, const std::vector< TCS::TOBArray * > &output, Decision &decison)
Definition
DisambiguationIncl2.cxx:128
TCS::DisambiguationIncl2::p_NumberLeading2
parType_t p_NumberLeading2
Definition
DisambiguationIncl2.h:35
TCS::DisambiguationIncl2::p_NumberLeading1
parType_t p_NumberLeading1
Definition
DisambiguationIncl2.h:34
TCS::DisambiguationIncl2::p_MinET2
parType_t p_MinET2[2]
Definition
DisambiguationIncl2.h:38
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