ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
L1Topo
L1TopoAlgorithms
Root
JetHT.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
* JetHT.cpp
6
* Created by Joerg Stelzer on 11/16/12.
7
*
8
* @brief algorithm calculates the sum of jets ET, makes cut on HT criteria
9
*
10
* @param NumberLeading
11
**********************************/
12
13
#include <cmath>
14
#include <string>
15
#include <iostream>
16
#include <sstream>
17
#include <vector>
18
19
#include "
L1TopoAlgorithms/JetHT.h
"
20
#include "
L1TopoCommon/Exception.h
"
21
#include "
L1TopoInterfaces/Decision.h
"
22
23
24
REGISTER_ALG_TCS
(JetHT)
25
26
// not the best solution but we will move to athena where this comes for free
27
#define LOG std::cout << name() << ": "
28
29
30
TCS::JetHT::JetHT
(
const
std::string &
name
) :
DecisionAlg
(
name
)
31
{
32
defineParameter
(
"InputWidth"
, 0);
33
defineParameter
(
"MaxTob"
, 0);
34
defineParameter
(
"NumResultBits"
,6);
35
defineParameter
(
"NumRegisters"
, 2);
36
defineParameter
(
"MinET"
,0);
37
defineParameter
(
"MinEta"
,0);
38
defineParameter
(
"MaxEta"
,31);
39
defineParameter
(
"MinHt"
,0,0);
40
defineParameter
(
"MinHt"
,0,1);
41
defineParameter
(
"MinHt"
,0,2);
42
defineParameter
(
"MinHt"
,0,3);
43
defineParameter
(
"MinHt"
,0,4);
44
defineParameter
(
"MinHt"
,0,5);
45
setNumberOutputBits
(6);
46
}
47
48
TCS::JetHT::~JetHT
()
49
{}
50
51
52
TCS::StatusCode
53
TCS::JetHT::initialize
() {
54
p_NumberLeading1
=
parameter
(
"InputWidth"
).value();
55
if
(
parameter
(
"MaxTob"
).value() > 0)
p_NumberLeading1
=
parameter
(
"MaxTob"
).value();
56
p_MinET
=
parameter
(
"MinET"
).value();
57
p_EtaMin
=
parameter
(
"MinEta"
).value();
58
p_EtaMax
=
parameter
(
"MaxEta"
).value();
59
60
TRG_MSG_INFO
(
"MaxTob : "
<<
p_NumberLeading1
);
61
TRG_MSG_INFO
(
"MinET : "
<<
p_MinET
);
62
TRG_MSG_INFO
(
"EtaMin : "
<<
p_EtaMin
);
63
TRG_MSG_INFO
(
"EtaMax : "
<<
p_EtaMax
);
64
for
(
unsigned
int
i=0; i<
numberOutputBits
(); ++i) {
65
p_HT
[i] =
parameter
(
"MinHt"
, i).value();
66
TRG_MSG_INFO
(
"HT "
<< i <<
" : "
<<
p_HT
[i]);
67
}
68
TRG_MSG_INFO
(
"number output : "
<<
numberOutputBits
());
69
70
// book histograms
71
for
(
unsigned
int
i=0; i<
numberOutputBits
(); ++i) {
72
std::string hname_accept =
"hJetHT_accept_bit"
+std::to_string((
int
)i);
73
std::string hname_reject =
"hJetHT_reject_bit"
+std::to_string((
int
)i);
74
// mass
75
bookHist
(
m_histAccept
, hname_accept,
"HT"
, 100, 0,
p_HT
[i]);
76
bookHist
(
m_histReject
, hname_reject,
"HT"
, 100, 0,
p_HT
[i]);
77
}
78
79
return
StatusCode::SUCCESS
;
80
}
81
82
TCS::StatusCode
83
TCS::JetHT::processBitCorrect
(
const
std::vector<TCS::TOBArray const *> & input,
84
const
std::vector<TCS::TOBArray *> & output,
85
Decision
& decision )
86
87
{
88
return
process
(input,output,decision);
89
}
90
91
92
TCS::StatusCode
93
TCS::JetHT::process
(
const
std::vector<TCS::TOBArray const *> & input,
94
const
std::vector<TCS::TOBArray *> & output,
95
Decision
& decision )
96
{
97
98
if
(input.size()!=1) {
99
TCS_EXCEPTION
(
"JetHT alg must have exactly 1 input list, but got "
<< input.size());
100
}
101
102
unsigned
int
sumET = 0;
103
104
if
(
p_NumberLeading1
< input[0]->
size
()) { output[0]->setAmbiguityFlag(
false
); }
105
106
// loop over jets
107
for
(
TOBArray::const_iterator
tob = input[0]->begin();
108
tob != input[0]->end() && distance(input[0]->begin(), tob) <
p_NumberLeading1
;
109
++tob)
110
{
111
112
if
(input[0]->
size
() >=
p_NumberLeading1
+1) {
113
TCS::TOBArray::const_iterator
tob2 = tob; ++tob2;
114
if
((*tob)->Et() == (*tob2)->Et() && distance(input[0]->begin(), tob) ==
p_NumberLeading1
- 1) {
115
output[0]->setAmbiguityFlag(
true
);
116
}
117
}
118
119
if
(
parType_t
(std::abs((*tob)->eta())) >
p_EtaMax
)
continue
;
// Eta cut
120
if
(
parType_t
(std::abs((*tob)->eta())) <
p_EtaMin
)
continue
;
// Eta cut
121
if
(
parType_t
((*tob)->Et()) <=
p_MinET
)
continue
;
// E_T cut
122
123
TRG_MSG_DEBUG
(
"Jet : ET = "
<< (*tob)->Et());
124
125
sumET += (*tob)->Et();
126
}
127
128
for
(
unsigned
int
i=0; i<
numberOutputBits
(); ++i) {
129
130
bool
accept = sumET >
p_HT
[i];
131
const
bool
fillAccept =
fillHistos
() and (
fillHistosBasedOnHardware
() ?
getDecisionHardwareBit
(i) : accept);
132
const
bool
fillReject =
fillHistos
() and not fillAccept;
133
const
bool
alreadyFilled = decision.
bit
(i);
134
decision.
setBit
( i, accept );
135
136
if
(accept) {
137
output[i]->push_back(
CompositeTOB
(
GenericTOB::createOnHeap
(
GenericTOB
(sumET,0,0) ) ));
138
}
139
if
(fillAccept and not alreadyFilled) {
140
fillHist1D
(
m_histAccept
[i],sumET);
141
}
else
if
(fillReject) {
142
fillHist1D
(
m_histReject
[i],sumET);
143
}
144
145
TRG_MSG_DEBUG
(
"Decision "
<< i <<
": "
<< (accept?
"pass"
:
"fail"
) <<
" HT = "
<< sumET);
146
147
}
148
149
return
TCS::StatusCode::SUCCESS
;
150
}
REGISTER_ALG_TCS
#define REGISTER_ALG_TCS(CLASS)
Definition
AlgFactory.h:62
Decision.h
JetHT.h
size
size_t size() const
Number of registered mappings.
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::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::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::GenericTOB
Definition
GenericTOB.h:35
TCS::GenericTOB::createOnHeap
static GenericTOB * createOnHeap(const GenericTOB &)
Definition
GenericTOB.cxx:271
TCS::JetHT::p_EtaMin
parType_t p_EtaMin
Definition
JetHT.h:35
TCS::JetHT::processBitCorrect
virtual StatusCode processBitCorrect(const std::vector< TCS::TOBArray const * > &input, const std::vector< TCS::TOBArray * > &output, Decision &decison)
Definition
JetHT.cxx:83
TCS::JetHT::~JetHT
virtual ~JetHT()
Definition
JetHT.cxx:48
TCS::JetHT::process
virtual StatusCode process(const std::vector< TCS::TOBArray const * > &input, const std::vector< TCS::TOBArray * > &output, Decision &decison)
Definition
JetHT.cxx:93
TCS::JetHT::p_EtaMax
parType_t p_EtaMax
Definition
JetHT.h:36
TCS::JetHT::p_NumberLeading1
parType_t p_NumberLeading1
Definition
JetHT.h:33
TCS::JetHT::p_HT
parType_t p_HT[6]
Definition
JetHT.h:37
TCS::JetHT::JetHT
JetHT(const std::string &name)
Definition
JetHT.cxx:30
TCS::JetHT::p_MinET
parType_t p_MinET
Definition
JetHT.h:34
TCS::JetHT::initialize
virtual StatusCode initialize()
Definition
JetHT.cxx:53
TCS::StatusCode
Definition
Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:15
TCS::StatusCode::SUCCESS
@ SUCCESS
Definition
Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:17
process
const std::string process
Definition
fbtTestBasics.cxx:76
TCS::parType_t
uint32_t parType_t
Definition
Parameter.h:23
Generated on
for ATLAS Offline Software by
1.17.0