ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
L1Topo
L1TopoAlgorithms
Root
TransverseMassInclusive1.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
* TransverseMassInclusive1.cpp
6
* Created by V Sorin 2014.
7
*
8
* @brief algorithm calculates the sqr of the transverse MASS between one list and XE and applies mass criteria
9
*
10
* @param NumberLeading
11
**********************************/
12
13
#include <cmath>
14
#include <string>
15
#include <sstream>
16
#include <vector>
17
18
#include "
L1TopoAlgorithms/TransverseMassInclusive1.h
"
19
#include "
L1TopoCommon/Exception.h
"
20
#include "
L1TopoInterfaces/Decision.h
"
21
22
//
23
REGISTER_ALG_TCS
(TransverseMassInclusive1)
24
25
// not the best solution but we will move to athena where this comes for free
26
#define LOG std::cout << "TCS::TransverseMassInclusive1: "
27
28
29
TCS::TransverseMassInclusive1::TransverseMassInclusive1
(
const
std::string &
name
) :
DecisionAlg
(
name
)
30
{
31
defineParameter
(
"InputWidth"
, 3);
32
defineParameter
(
"MaxTob"
, 0);
33
defineParameter
(
"NumResultBits"
, 6);
34
defineParameter
(
"MinET1"
,0,0);
35
defineParameter
(
"MinET2"
,0,0);
36
defineParameter
(
"MinMTSqr"
, 0, 0);
37
defineParameter
(
"MinET1"
,0,1);
38
defineParameter
(
"MinET2"
,0,1);
39
defineParameter
(
"MinMTSqr"
, 0, 1);
40
defineParameter
(
"MinET1"
,0,2);
41
defineParameter
(
"MinET2"
,0,2);
42
defineParameter
(
"MinMTSqr"
, 0, 2);
43
defineParameter
(
"MinET1"
,0,3);
44
defineParameter
(
"MinET2"
,0,3);
45
defineParameter
(
"MinMTSqr"
, 0, 3);
46
defineParameter
(
"MinET1"
,0,4);
47
defineParameter
(
"MinET2"
,0,4);
48
defineParameter
(
"MinMTSqr"
, 0, 4);
49
defineParameter
(
"MinET1"
,0,5);
50
defineParameter
(
"MinET2"
,0,5);
51
defineParameter
(
"MinMTSqr"
, 0, 5);
52
53
setNumberOutputBits
(6);
54
}
55
56
TCS::TransverseMassInclusive1::~TransverseMassInclusive1
(){}
57
58
59
TCS::StatusCode
60
TCS::TransverseMassInclusive1::initialize
() {
61
if
(
parameter
(
"MaxTob"
).value() > 0) {
62
p_NumberLeading1
=
parameter
(
"MaxTob"
).value();
63
}
else
{
64
p_NumberLeading1
=
parameter
(
"InputWidth"
).value();
65
}
66
67
for
(
unsigned
int
i=0; i<
numberOutputBits
(); ++i) {
68
p_TMassMin
[i] =
parameter
(
"MinMTSqr"
, i).value();
69
70
p_MinET1
[i] =
parameter
(
"MinET1"
,i).value();
71
TRG_MSG_INFO
(
"MinET1 : "
<<
p_MinET1
[i]);
72
p_MinET2
[i] =
parameter
(
"MinET2"
,i).value();
73
TRG_MSG_INFO
(
"MinET2 : "
<<
p_MinET2
[i]);
74
75
TRG_MSG_INFO
(
"TMassMin : "
<<
p_TMassMin
[i]);
76
}
77
TRG_MSG_INFO
(
"NumberLeading1 : "
<<
p_NumberLeading1
);
78
TRG_MSG_INFO
(
"number output : "
<<
numberOutputBits
());
79
80
// book histograms
81
for
(
unsigned
int
i=0; i<
numberOutputBits
(); ++i) {
82
std::string hname_accept =
"hTransverseMassInclusive1_accept_bit"
+std::to_string((
int
)i);
83
std::string hname_reject =
"hTransverseMassInclusive1_reject_bit"
+std::to_string((
int
)i);
84
// mass
85
bookHist
(
m_histAccept
, hname_accept,
"MT"
, 100,
p_TMassMin
[i], 2000);
86
bookHist
(
m_histReject
, hname_reject,
"MT"
, 100,
p_TMassMin
[i], 2000);
87
}
88
89
return
StatusCode::SUCCESS
;
90
}
91
92
93
94
TCS::StatusCode
95
TCS::TransverseMassInclusive1::processBitCorrect
(
const
std::vector<TCS::TOBArray const *> & input,
96
const
std::vector<TCS::TOBArray *> & output,
97
Decision
& decision )
98
{
99
100
if
(input.size() == 2) {
// 2 lists because one is always MET
101
102
103
104
for
(
TOBArray::const_iterator
tob1 = input[0]->begin();
105
tob1 != input[0]->end() && distance( input[0]->begin(), tob1) <
p_NumberLeading1
;
106
++tob1)
107
{
108
109
110
for
(
TOBArray::const_iterator
tob2 = input[1]->begin();
111
tob2 != input[1]->end() ;
112
++tob2) {
113
114
// T Mass calculation
115
116
unsigned
int
tmass2 =
calcTMassBW
( *tob1, *tob2 );
117
118
119
for
(
unsigned
int
i=0; i<
numberOutputBits
(); ++i) {
120
bool
accept =
false
;
121
if
(
parType_t
((*tob1)->Et()) <=
p_MinET1
[i])
continue
;
// ET cut
122
if
(
parType_t
((*tob2)->Et()) <=
p_MinET2
[i])
continue
;
// ET cut
123
accept = tmass2 >=
p_TMassMin
[i] ;
//
124
const
bool
fillAccept =
fillHistos
() and (
fillHistosBasedOnHardware
() ?
getDecisionHardwareBit
(i) : accept);
125
const
bool
fillReject =
fillHistos
() and not fillAccept;
126
const
bool
alreadyFilled = decision.
bit
(i);
127
if
(accept) {
128
decision.
setBit
(i,
true
);
129
output[i]->push_back(
TCS::CompositeTOB
(*tob1, *tob2) );
130
}
131
if
(fillAccept and not alreadyFilled) {
132
fillHist1D
(
m_histAccept
[i],(
float
)tmass2);
133
}
else
if
(fillReject) {
134
fillHist1D
(
m_histReject
[i],(
float
)tmass2);
135
}
136
TRG_MSG_DEBUG
(
"Decision "
<< i <<
": "
<< (accept?
"pass"
:
"fail"
) <<
" tmass2 = "
<< tmass2);
137
}
138
}
139
}
140
}
else
{
141
142
TCS_EXCEPTION
(
"TransverseMassInclusive1 alg must have either 1 inputs, but got "
<< input.size());
143
144
}
145
return
TCS::StatusCode::SUCCESS
;
146
147
}
148
149
TCS::StatusCode
150
TCS::TransverseMassInclusive1::process
(
const
std::vector<TCS::TOBArray const *> & input,
151
const
std::vector<TCS::TOBArray *> & output,
152
Decision
& decision )
153
{
154
155
if
(input.size() == 2) {
// 2 lists because one is always MET
156
157
158
159
for
(
TOBArray::const_iterator
tob1 = input[0]->begin();
160
tob1 != input[0]->end() && distance( input[0]->begin(), tob1) <
p_NumberLeading1
;
161
++tob1)
162
{
163
164
165
for
(
TOBArray::const_iterator
tob2 = input[1]->begin();
166
tob2 != input[1]->end() ;
167
++tob2) {
168
169
// T Mass calculation
170
171
unsigned
int
tmass2 =
calcTMass
( *tob1, *tob2 );
172
173
for
(
unsigned
int
i=0; i<
numberOutputBits
(); ++i) {
174
bool
accept =
false
;
175
if
(
parType_t
((*tob1)->Et()) <=
p_MinET1
[i])
continue
;
// ET cut
176
177
if
(
parType_t
((*tob2)->Et()) <=
p_MinET2
[i])
continue
;
// ET cut
178
179
accept = tmass2 >=
p_TMassMin
[i] ;
//
180
const
bool
fillAccept =
fillHistos
() and (
fillHistosBasedOnHardware
() ?
getDecisionHardwareBit
(i) : accept);
181
const
bool
fillReject =
fillHistos
() and not fillAccept;
182
const
bool
alreadyFilled = decision.
bit
(i);
183
if
( accept ) {
184
decision.
setBit
(i,
true
);
185
output[i]->push_back(
TCS::CompositeTOB
(*tob1, *tob2) );
186
}
187
if
(fillAccept and not alreadyFilled) {
188
fillHist1D
(
m_histAccept
[i],(
float
)tmass2);
189
}
else
if
(fillReject) {
190
fillHist1D
(
m_histReject
[i],(
float
)tmass2);
191
}
192
TRG_MSG_DEBUG
(
"Decision "
<< i <<
": "
<< (accept?
"pass"
:
"fail"
) <<
" tmass2 = "
<< tmass2);
193
194
}
195
}
196
}
197
}
else
{
198
199
TCS_EXCEPTION
(
"TransverseMassInclusive1 alg must have either 1 inputs, but got "
<< input.size());
200
201
}
202
return
TCS::StatusCode::SUCCESS
;
203
}
REGISTER_ALG_TCS
#define REGISTER_ALG_TCS(CLASS)
Definition
AlgFactory.h:62
Decision.h
TransverseMassInclusive1.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::calcTMass
unsigned int calcTMass(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
Definition
ConfigurableAlg.cxx:188
TCS::ConfigurableAlg::name
const std::string & name() const
Definition
ConfigurableAlg.h:49
TCS::ConfigurableAlg::bookHist
void bookHist(std::vector< std::string > ®Name, std::string_view name, std::string_view title, const int binx, const int xmin, const int xmax)
Definition
ConfigurableAlg.cxx:272
TCS::ConfigurableAlg::parameter
const Parameter & parameter(std::string_view parameterName) const
Definition
ConfigurableAlg.cxx:245
TCS::ConfigurableAlg::fillHist1D
void fillHist1D(const std::string &histName, double x)
Definition
ConfigurableAlg.cxx:470
TCS::ConfigurableAlg::defineParameter
void defineParameter(std::string_view name, TCS::parType_t value)
Definition
ConfigurableAlg.cxx:203
TCS::ConfigurableAlg::calcTMassBW
unsigned int calcTMassBW(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
Definition
ConfigurableAlg.cxx:146
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::fillHistosBasedOnHardware
bool fillHistosBasedOnHardware() const
! getter
Definition
DecisionAlg.cxx:84
TCS::DecisionAlg::fillHistos
bool fillHistos() const
whether the monitoring histograms should be filled
Definition
DecisionAlg.cxx:100
TCS::DecisionAlg::m_histAccept
std::vector< std::string > m_histAccept
Definition
DecisionAlg.h:72
TCS::DecisionAlg::m_histReject
std::vector< std::string > m_histReject
Definition
DecisionAlg.h:73
TCS::DecisionAlg::numberOutputBits
unsigned int numberOutputBits() const
Definition
DecisionAlg.h:38
TCS::DecisionAlg::getDecisionHardwareBit
bool getDecisionHardwareBit(const unsigned int &bitNumber) const
! get one hardware decision bit from this algo
Definition
DecisionAlg.cxx:52
TCS::Decision
Definition
Decision.h:19
TCS::Decision::bit
bool bit(unsigned int index) const
Definition
Decision.h:40
TCS::Decision::setBit
void setBit(unsigned int index, bool value)
Definition
Decision.cxx:12
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::TransverseMassInclusive1::process
virtual StatusCode process(const std::vector< TCS::TOBArray const * > &input, const std::vector< TCS::TOBArray * > &output, Decision &decison)
Definition
TransverseMassInclusive1.cxx:150
TCS::TransverseMassInclusive1::p_NumberLeading1
parType_t p_NumberLeading1
Definition
TransverseMassInclusive1.h:34
TCS::TransverseMassInclusive1::TransverseMassInclusive1
TransverseMassInclusive1(const std::string &name)
Definition
TransverseMassInclusive1.cxx:29
TCS::TransverseMassInclusive1::initialize
virtual StatusCode initialize()
Definition
TransverseMassInclusive1.cxx:60
TCS::TransverseMassInclusive1::p_TMassMin
parType_t p_TMassMin[6]
Definition
TransverseMassInclusive1.h:35
TCS::TransverseMassInclusive1::p_MinET1
parType_t p_MinET1[6]
Definition
TransverseMassInclusive1.h:36
TCS::TransverseMassInclusive1::~TransverseMassInclusive1
virtual ~TransverseMassInclusive1()
Definition
TransverseMassInclusive1.cxx:56
TCS::TransverseMassInclusive1::processBitCorrect
virtual StatusCode processBitCorrect(const std::vector< TCS::TOBArray const * > &input, const std::vector< TCS::TOBArray * > &output, Decision &decison)
Definition
TransverseMassInclusive1.cxx:95
TCS::TransverseMassInclusive1::p_MinET2
parType_t p_MinET2[6]
Definition
TransverseMassInclusive1.h:37
TCS::parType_t
uint32_t parType_t
Definition
Parameter.h:23
Generated on
for ATLAS Offline Software by
1.17.0