ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
L1Topo
L1TopoAlgorithms
Root
DisambiguationInvmIncl2.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
* DisambiguationInvmIncl2.cpp
6
* Created by Davide Gerbaudo on 2016-10-10.
7
*
8
* @brief compute the INVMASS**2 between distinct objects from two lists and applies invmass criteria
9
*
10
* The 'distinct object' criterion is based on the disambiguation
11
* as implemented in DisambiguationDRIncl2, where deltaR is > 0.
12
*
13
**********************************/
14
15
#include <cmath>
16
17
#include "
L1TopoAlgorithms/DisambiguationInvmIncl2.h
"
18
#include "
L1TopoCommon/Exception.h
"
19
#include "
L1TopoInterfaces/Decision.h
"
20
#include "
L1TopoSimulationUtils/Helpers.h
"
21
22
REGISTER_ALG_TCS
(DisambiguationInvmIncl2)
23
24
25
// not the best solution but we will move to athena where this comes for free
26
#define LOG std::cout << "TCS::DisambiguationInvmIncl2: "
27
28
29
TCS::DisambiguationInvmIncl2::DisambiguationInvmIncl2
(
const
std::string &
name
) :
DecisionAlg
(
name
)
30
{
31
defineParameter
(
"InputWidth1"
, 9);
32
defineParameter
(
"InputWidth2"
, 9);
33
defineParameter
(
"MaxTob1"
, 0);
34
defineParameter
(
"MaxTob2"
, 0);
35
defineParameter
(
"NumResultBits"
, 2);
36
defineParameter
(
"MinET1"
, 1, 0);
37
defineParameter
(
"MinET2"
, 1, 0);
38
defineParameter
(
"MinMSqr"
, 0, 0);
39
defineParameter
(
"MaxMSqr"
, 0, 0);
40
defineParameter
(
"MinET1"
, 1, 1);
41
defineParameter
(
"MinET2"
, 1, 1);
42
defineParameter
(
"MinMSqr"
, 0, 1);
43
defineParameter
(
"MaxMSqr"
, 0, 1);
44
45
setNumberOutputBits
(2);
46
}
47
48
TCS::DisambiguationInvmIncl2::~DisambiguationInvmIncl2
(){}
49
50
TCS::StatusCode
51
TCS::DisambiguationInvmIncl2::initialize
() {
52
p_NumberLeading1
=
parameter
(
"InputWidth1"
).value();
53
p_NumberLeading2
=
parameter
(
"InputWidth2"
).value();
54
if
(
parameter
(
"MaxTob1"
).value() > 0)
p_NumberLeading1
=
parameter
(
"MaxTob1"
).value();
55
if
(
parameter
(
"MaxTob2"
).value() > 0)
p_NumberLeading2
=
parameter
(
"MaxTob2"
).value();
56
57
for
(
unsigned
int
i=0; i<
numberOutputBits
(); ++i) {
58
p_MinET1
[i] =
parameter
(
"MinET1"
,i).value();
59
p_MinET2
[i] =
parameter
(
"MinET2"
,i).value();
60
p_InvMassMin
[i] =
parameter
(
"MinMSqr"
, i).value();
61
p_InvMassMax
[i] =
parameter
(
"MaxMSqr"
, i).value();
62
TRG_MSG_INFO
(
"MinET1 : "
<< i <<
" : "
<<
p_MinET1
[i]);
63
TRG_MSG_INFO
(
"MinET2 : "
<< i <<
" : "
<<
p_MinET2
[i]);
64
TRG_MSG_INFO
(
"MinMSqr : "
<< i <<
" : "
<<
p_InvMassMin
[i]);
65
TRG_MSG_INFO
(
"MaxMSqr : "
<< i <<
" : "
<<
p_InvMassMin
[i]);
66
}
67
TRG_MSG_INFO
(
"number output : "
<<
numberOutputBits
());
68
return
StatusCode::SUCCESS
;
69
}
70
71
TCS::StatusCode
72
TCS::DisambiguationInvmIncl2::processBitCorrect
(
const
std::vector<TCS::TOBArray const *> & input,
73
const
std::vector<TCS::TOBArray *> & output,
74
Decision
& decision)
75
{
76
if
(input.size() == 2) {
77
for
(
TOBArray::const_iterator
tob1 = input[0]->begin();
78
tob1 != input[0]->end() && distance(input[0]->begin(), tob1) <
p_NumberLeading1
;
79
++tob1) {
80
for
(
TCS::TOBArray::const_iterator
tob2 = input[1]->begin();
81
tob2 != input[1]->end() && distance(input[1]->begin(), tob2) <
p_NumberLeading2
;
82
++tob2) {
83
unsigned
int
invmass2 =
calcInvMassBW
( *tob1, *tob2 );
84
unsigned
int
deltaR2 =
calcDeltaR2BW
( *tob1, *tob2 );
85
for
(
unsigned
int
i=0; i<
numberOutputBits
(); ++i) {
86
bool
accept =
false
;
87
if
(
parType_t
((*tob1)->Et()) <=
p_MinET1
[i])
continue
;
// ET cut
88
if
(
parType_t
((*tob2)->Et()) <=
p_MinET2
[i])
continue
;
// ET cut
89
accept = (deltaR2 > 0 &&
90
invmass2 >=
p_InvMassMin
[i] &&
91
invmass2 <=
p_InvMassMax
[i] );
92
if
( accept ) {
93
decision.
setBit
(i,
true
);
94
output[i]->push_back(
TCS::CompositeTOB
(*tob1, *tob2));
95
}
96
TRG_MSG_DEBUG
(
"Decision "
<< i <<
": "
<< (accept?
"pass"
:
"fail"
)
97
<<
" deltaR = "
<< deltaR2
98
<<
" invmass2 = "
<< invmass2);
99
}
// for(i)
100
}
// for(tob2)
101
}
// for(tob1)
102
for
(
unsigned
int
i=0; i <
numberOutputBits
(); ++i) {
103
bool
hasAmbiguousInputs =
TSU::isAmbiguousTruncation
(input[0],
p_NumberLeading1
,
p_MinET1
[i])
104
||
TSU::isAmbiguousTruncation
(input[1],
p_NumberLeading2
,
p_MinET2
[i]);
105
output[i]->setAmbiguityFlag(hasAmbiguousInputs);
106
}
107
}
else
{
108
TCS_EXCEPTION
(
"DisambiguationInvmIncl2 alg must have 2 inputs, but got "
<< input.size());
109
}
110
return
TCS::StatusCode::SUCCESS
;
111
}
112
113
TCS::StatusCode
114
TCS::DisambiguationInvmIncl2::process
(
const
std::vector<TCS::TOBArray const *> & input,
115
const
std::vector<TCS::TOBArray *> & output,
116
Decision
& decision)
117
{
118
if
( input.size() == 2) {
119
for
(
TOBArray::const_iterator
tob1 = input[0]->begin();
120
tob1 != input[0]->end() && distance(input[0]->begin(), tob1) <
p_NumberLeading1
;
121
++tob1) {
122
for
(
TCS::TOBArray::const_iterator
tob2 = input[1]->begin();
123
tob2 != input[1]->end() && distance(input[1]->begin(), tob2) <
p_NumberLeading2
;
124
++tob2) {
125
unsigned
int
invmass2 =
calcInvMass
( *tob1, *tob2 );
126
unsigned
int
deltaR2 =
calcDeltaR2
( *tob1, *tob2 );
127
for
(
unsigned
int
i=0; i<
numberOutputBits
(); ++i) {
128
bool
accept =
false
;
129
if
(
parType_t
((*tob1)->Et()) <=
p_MinET1
[i])
continue
;
130
if
(
parType_t
((*tob2)->Et()) <=
p_MinET2
[i])
continue
;
131
accept = (deltaR2 > 0 &&
132
invmass2 >=
p_InvMassMin
[i] &&
133
invmass2 <=
p_InvMassMax
[i] );
134
if
( accept ) {
135
decision.
setBit
(i,
true
);
136
output[i]->push_back(
TCS::CompositeTOB
(*tob1, *tob2));
137
}
138
TRG_MSG_DEBUG
(
"Decision "
<< i <<
": "
<< (accept?
"pass"
:
"fail"
) <<
" deltaR = "
<< deltaR2 );
139
}
// for(i)
140
}
// for(tob2)
141
}
// for(tob1)
142
}
else
{
143
TCS_EXCEPTION
(
"DisambiguationInvmIncl2 alg must have 2 inputs, but got "
<< input.size());
144
}
145
return
TCS::StatusCode::SUCCESS
;
146
}
REGISTER_ALG_TCS
#define REGISTER_ALG_TCS(CLASS)
Definition
AlgFactory.h:62
Decision.h
DisambiguationInvmIncl2.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::calcInvMassBW
unsigned int calcInvMassBW(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
Definition
ConfigurableAlg.cxx:138
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::calcInvMass
unsigned int calcInvMass(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
Definition
ConfigurableAlg.cxx:183
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::DisambiguationInvmIncl2::process
virtual StatusCode process(const std::vector< TCS::TOBArray const * > &input, const std::vector< TCS::TOBArray * > &output, Decision &decison)
Definition
DisambiguationInvmIncl2.cxx:114
TCS::DisambiguationInvmIncl2::p_InvMassMin
parType_t p_InvMassMin[2]
Definition
DisambiguationInvmIncl2.h:32
TCS::DisambiguationInvmIncl2::DisambiguationInvmIncl2
DisambiguationInvmIncl2(const std::string &name)
Definition
DisambiguationInvmIncl2.cxx:29
TCS::DisambiguationInvmIncl2::processBitCorrect
virtual StatusCode processBitCorrect(const std::vector< TCS::TOBArray const * > &input, const std::vector< TCS::TOBArray * > &output, Decision &decison)
Definition
DisambiguationInvmIncl2.cxx:72
TCS::DisambiguationInvmIncl2::p_NumberLeading1
parType_t p_NumberLeading1
Definition
DisambiguationInvmIncl2.h:28
TCS::DisambiguationInvmIncl2::p_InvMassMax
parType_t p_InvMassMax[2]
Definition
DisambiguationInvmIncl2.h:33
TCS::DisambiguationInvmIncl2::~DisambiguationInvmIncl2
virtual ~DisambiguationInvmIncl2()
Definition
DisambiguationInvmIncl2.cxx:48
TCS::DisambiguationInvmIncl2::p_NumberLeading2
parType_t p_NumberLeading2
Definition
DisambiguationInvmIncl2.h:29
TCS::DisambiguationInvmIncl2::p_MinET1
parType_t p_MinET1[2]
Definition
DisambiguationInvmIncl2.h:30
TCS::DisambiguationInvmIncl2::initialize
virtual StatusCode initialize()
Definition
DisambiguationInvmIncl2.cxx:51
TCS::DisambiguationInvmIncl2::p_MinET2
parType_t p_MinET2[2]
Definition
DisambiguationInvmIncl2.h:31
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