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