ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
L1Topo
L1TopoAlgorithms
Root
SimpleCone.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
* SimpleCone.cpp
6
*
7
* @brief algorithm calculates the sum of jets ET around each jet within radius R, makes cut on leading sum ET
8
*
9
* @param NumberLeading
10
**********************************/
11
12
#include <cmath>
13
#include <string>
14
#include <iostream>
15
#include <sstream>
16
#include <vector>
17
#include <algorithm>
18
19
#include "
L1TopoAlgorithms/SimpleCone.h
"
20
#include "
L1TopoCommon/Exception.h
"
21
#include "
L1TopoInterfaces/Decision.h
"
22
23
24
REGISTER_ALG_TCS
(SimpleCone)
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::SimpleCone::SimpleCone
(
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
(
"MaxRSqr"
,10*10);
37
defineParameter
(
"MinET"
,0);
38
defineParameter
(
"MinSumET"
,0,0);
39
defineParameter
(
"MinSumET"
,0,1);
40
defineParameter
(
"MinSumET"
,0,2);
41
defineParameter
(
"MinSumET"
,0,3);
42
defineParameter
(
"MinSumET"
,0,4);
43
defineParameter
(
"MinSumET"
,0,5);
44
setNumberOutputBits
(6);
45
}
46
47
TCS::SimpleCone::~SimpleCone
()
48
{}
49
50
51
TCS::StatusCode
52
TCS::SimpleCone::initialize
() {
53
p_NumberLeading1
=
parameter
(
"InputWidth"
).value();
54
if
(
parameter
(
"MaxTob"
).value() > 0)
p_NumberLeading1
=
parameter
(
"MaxTob"
).value();
55
p_R2
=
parameter
(
"MaxRSqr"
).value();
56
p_MinET
=
parameter
(
"MinET"
).value();
57
58
TRG_MSG_INFO
(
"MaxTob : "
<<
p_NumberLeading1
);
59
TRG_MSG_INFO
(
"MaxRSqr : "
<<
p_R2
);
60
TRG_MSG_INFO
(
"MinET : "
<<
p_MinET
);
61
for
(
unsigned
int
i=0; i<
numberOutputBits
(); ++i) {
62
p_MinSumET
[i] =
parameter
(
"MinSumET"
, i).value();
63
TRG_MSG_INFO
(
"SimpleCone "
<< i <<
" : "
<<
p_MinSumET
[i]);
64
}
65
TRG_MSG_INFO
(
"number output : "
<<
numberOutputBits
());
66
67
// book histograms
68
for
(
unsigned
int
i=0; i<
numberOutputBits
(); ++i) {
69
std::string hname_accept =
"hSimpleCone_accept_bit"
+std::to_string((
int
)i);
70
std::string hname_reject =
"hSimpleCone_reject_bit"
+std::to_string((
int
)i);
71
// mass
72
bookHist
(
m_histAccept
, hname_accept,
"ET"
, 100, 0,
p_MinSumET
[i]);
73
bookHist
(
m_histReject
, hname_reject,
"ET"
, 100, 0,
p_MinSumET
[i]);
74
}
75
76
return
StatusCode::SUCCESS
;
77
}
78
79
TCS::StatusCode
80
TCS::SimpleCone::processBitCorrect
(
const
std::vector<TCS::TOBArray const *> & input,
81
const
std::vector<TCS::TOBArray *> & output,
82
Decision
& decision )
83
84
{
85
return
process
(input,output,decision);
86
}
87
88
89
TCS::StatusCode
90
TCS::SimpleCone::process
(
const
std::vector<TCS::TOBArray const *> & input,
91
const
std::vector<TCS::TOBArray *> & output,
92
Decision
& decision )
93
{
94
95
if
(input.size()!=1) {
96
TCS_EXCEPTION
(
"SimpleCone alg must have exactly 1 input list, but got "
<< input.size());
97
}
98
99
unsigned
int
leadingET = 0;
100
101
// loop over jets
102
for
(
TOBArray::const_iterator
tob = input[0]->begin();
103
tob != input[0]->end() && distance(input[0]->begin(), tob) <
p_NumberLeading1
;
104
++tob) {
105
106
if
(
parType_t
((*tob)->Et()) <=
p_MinET
)
continue
;
// E_T cut
107
108
TRG_MSG_DEBUG
(
"Jet : ET = "
<< (*tob)->Et());
109
110
unsigned
int
tmp_SumET = (*tob)->Et();
111
112
for
(
TOBArray::const_iterator
tob1 = input[0]->begin();
113
tob1 != input[0]->end() && distance(input[0]->begin(), tob1) <
p_NumberLeading1
;
114
++tob1) {
115
116
if
( tob1 == tob )
continue
;
// Avoid double counting of central jet
117
if
(
parType_t
((*tob1)->Et()) <=
p_MinET
)
continue
;
// E_T cut
118
119
unsigned
int
deltaR2 =
calcDeltaR2BW
( *tob1, *tob );
120
121
if
(deltaR2 >
p_R2
)
continue
;
// Exclude jets outside cone
122
123
tmp_SumET += (*tob1)->Et();
124
}
125
126
if
(tmp_SumET > leadingET) leadingET = tmp_SumET;
127
}
128
129
for
(
unsigned
int
i=0; i<
numberOutputBits
(); ++i) {
130
131
bool
accept = leadingET >
p_MinSumET
[i];
132
const
bool
fillAccept =
fillHistos
() and (
fillHistosBasedOnHardware
() ?
getDecisionHardwareBit
(i) : accept);
133
const
bool
fillReject =
fillHistos
() and not fillAccept;
134
decision.
setBit
( i, accept );
135
136
if
(accept) {
137
output[i]->push_back(
CompositeTOB
(
GenericTOB::createOnHeap
(
GenericTOB
(leadingET,0,0) ) ));
138
}
139
if
(fillAccept)
140
fillHist1D
(
m_histAccept
[i],leadingET);
141
else
if
(fillReject)
142
fillHist1D
(
m_histReject
[i],leadingET);
143
144
145
TRG_MSG_DEBUG
(
"Decision "
<< i <<
": "
<< (accept?
"pass"
:
"fail"
) <<
" SimpleCone = "
<< leadingET);
146
147
}
148
149
return
TCS::StatusCode::SUCCESS
;
150
}
REGISTER_ALG_TCS
#define REGISTER_ALG_TCS(CLASS)
Definition
AlgFactory.h:62
Decision.h
SimpleCone.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::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::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::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::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::SimpleCone::SimpleCone
SimpleCone(const std::string &name)
Definition
SimpleCone.cxx:30
TCS::SimpleCone::~SimpleCone
virtual ~SimpleCone()
Definition
SimpleCone.cxx:47
TCS::SimpleCone::p_MinSumET
parType_t p_MinSumET[6]
Definition
SimpleCone.h:34
TCS::SimpleCone::initialize
virtual StatusCode initialize()
Definition
SimpleCone.cxx:52
TCS::SimpleCone::p_NumberLeading1
parType_t p_NumberLeading1
Definition
SimpleCone.h:31
TCS::SimpleCone::process
virtual StatusCode process(const std::vector< TCS::TOBArray const * > &input, const std::vector< TCS::TOBArray * > &output, Decision &decison)
Definition
SimpleCone.cxx:90
TCS::SimpleCone::processBitCorrect
virtual StatusCode processBitCorrect(const std::vector< TCS::TOBArray const * > &input, const std::vector< TCS::TOBArray * > &output, Decision &decison)
Definition
SimpleCone.cxx:80
TCS::SimpleCone::p_R2
parType_t p_R2
Definition
SimpleCone.h:32
TCS::SimpleCone::p_MinET
parType_t p_MinET
Definition
SimpleCone.h:33
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