ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
L1Topo
L1TopoAlgorithms
Root
Ratio.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
* Ratio.cpp
6
* Created by Joerg Stelzer on 11/16/12.
7
*
8
* @brief algorithm calculates the phi-distance between one or two lists and applies delta-phi criteria
9
*
10
* @param NumberLeading
11
**********************************/
12
13
#include <cmath>
14
15
#include "
L1TopoAlgorithms/Ratio.h
"
16
#include "
L1TopoCommon/Exception.h
"
17
#include "
L1TopoInterfaces/Decision.h
"
18
19
20
REGISTER_ALG_TCS
(Ratio)
21
22
// not the best solution but we will move to athena where this comes for free
23
#define LOG std::cout << name() << ": "
24
25
26
TCS::Ratio::Ratio
(
const
std::string &
name
) :
DecisionAlg
(
name
)
27
{
28
defineParameter
(
"InputWidth1"
, 9);
29
defineParameter
(
"InputWidth2"
, 9);
30
defineParameter
(
"MaxTob1"
, 0);
31
defineParameter
(
"MaxTob2"
, 0);
32
defineParameter
(
"NumResultBits"
, 2);
33
defineParameter
(
"isXE2"
,0);
34
defineParameter
(
"MinET2"
,0);
35
defineParameter
(
"EtaMin"
,0);
36
defineParameter
(
"EtaMax"
,49);
37
defineParameter
(
"MinET1"
,0);
38
defineParameter
(
"HT"
,0);
39
defineParameter
(
"Ratio"
,0,0);
40
defineParameter
(
"Ratio"
,0,1);
41
setNumberOutputBits
(2);
42
}
43
44
TCS::Ratio::~Ratio
()
45
{}
46
47
48
TCS::StatusCode
49
TCS::Ratio::initialize
() {
50
p_MinET1
=
parameter
(
"MinET1"
).value();
51
p_MinET2
=
parameter
(
"MinET2"
).value();
52
p_EtaMin
=
parameter
(
"EtaMin"
).value();
53
p_EtaMax
=
parameter
(
"EtaMax"
).value();
54
p_HT
=
parameter
(
"HT"
).value();
55
TRG_MSG_INFO
(
"MinET1 : "
<<
p_MinET1
);
56
TRG_MSG_INFO
(
"MinET2 : "
<<
p_MinET2
);
57
TRG_MSG_INFO
(
"EtaMin : "
<<
p_EtaMin
);
58
TRG_MSG_INFO
(
"EtaMax : "
<<
p_EtaMax
);
59
TRG_MSG_INFO
(
"HT : "
<<
p_HT
);
60
61
p_isXE2
=
parameter
(
"isXE2"
).value();
62
TRG_MSG_INFO
(
"isXE2 : "
<<
p_isXE2
);
63
64
for
(
int
i=0; i<2; ++i) {
65
p_Ratio
[i] =
parameter
(
"Ratio"
, i).value();
66
TRG_MSG_INFO
(
"Ratio "
<< i <<
" : "
<<
p_Ratio
[i]);
67
}
68
TRG_MSG_INFO
(
"number output : "
<<
numberOutputBits
());
69
return
StatusCode::SUCCESS
;
70
}
71
72
TCS::StatusCode
73
TCS::Ratio::processBitCorrect
(
const
std::vector<TCS::TOBArray const *> & input,
74
const
std::vector<TCS::TOBArray *> & output,
75
Decision
& decision )
76
77
{
78
return
process
(input,output,decision);
79
}
80
81
82
TCS::StatusCode
83
TCS::Ratio::process
(
const
std::vector<TCS::TOBArray const *> & input,
84
const
std::vector<TCS::TOBArray *> & output,
85
Decision
& decision )
86
{
87
88
if
(input.size()!=2) {
89
TCS_EXCEPTION
(
"Ratio alg must have exactly 2 input lists, but got "
<< input.size());
90
}
91
92
unsigned
int
sumET = 0;
93
94
95
const
TCS::GenericTOB
&
met
= (*input[0])[0];
96
97
98
// loop over all jets
99
unsigned
int
objC(0);
100
for
(
TCS::GenericTOB
* tob : *input[1]) {
101
102
103
if
(
parType_t
(std::abs(tob->eta())) >
p_EtaMax
)
continue
;
// Eta cut
104
if
(
parType_t
(std::abs(tob->eta())) <
p_EtaMin
)
continue
;
// Eta cut
105
if
( tob->Et() <=
p_MinET2
)
continue
;
// E_T cut
106
107
TRG_MSG_DEBUG
(
"Jet ET = "
<< tob->Et());
108
++objC;
109
sumET += tob->Et();
110
}
111
112
for
(
unsigned
int
i=0; i<
numberOutputBits
(); ++i) {
113
114
bool
accept = objC!=0 &&
met
.Et() >
p_MinET1
&& 10*
met
.Et() >=
p_Ratio
[i]*sumET;
115
116
if
(
p_isXE2
) accept = objC!=0 &&
met
.Et() >
p_MinET1
&& 10*(
met
.Et()*
met
.Et()) >=
p_Ratio
[i]*sumET;
117
118
decision.
setBit
( i, accept );
119
120
if
(accept)
121
output[i]->push_back(
CompositeTOB
(
GenericTOB::createOnHeap
(
GenericTOB
(sumET,0,0) ) ));
122
123
TRG_MSG_DEBUG
(
"Decision "
<< i <<
": "
<< (accept?
"pass"
:
"fail"
) <<
" HT = "
<< sumET <<
" XE = "
<<
met
.Et() );
124
125
}
126
127
return
TCS::StatusCode::SUCCESS
;
128
}
REGISTER_ALG_TCS
#define REGISTER_ALG_TCS(CLASS)
Definition
AlgFactory.h:62
Decision.h
Ratio.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::parameter
const Parameter & parameter(std::string_view parameterName) const
Definition
ConfigurableAlg.cxx:245
TCS::ConfigurableAlg::defineParameter
void defineParameter(std::string_view name, TCS::parType_t value)
Definition
ConfigurableAlg.cxx:203
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::GenericTOB
Definition
GenericTOB.h:35
TCS::GenericTOB::createOnHeap
static GenericTOB * createOnHeap(const GenericTOB &)
Definition
GenericTOB.cxx:271
TCS::Ratio::process
virtual StatusCode process(const std::vector< TCS::TOBArray const * > &input, const std::vector< TCS::TOBArray * > &output, Decision &decison)
Definition
Ratio.cxx:83
TCS::Ratio::p_MinET1
parType_t p_MinET1
Definition
Ratio.h:33
TCS::Ratio::~Ratio
virtual ~Ratio()
Definition
Ratio.cxx:44
TCS::Ratio::Ratio
Ratio(const std::string &name)
Definition
Ratio.cxx:26
TCS::Ratio::p_MinET2
parType_t p_MinET2
Definition
Ratio.h:34
TCS::Ratio::processBitCorrect
virtual StatusCode processBitCorrect(const std::vector< TCS::TOBArray const * > &input, const std::vector< TCS::TOBArray * > &output, Decision &decison)
Definition
Ratio.cxx:73
TCS::Ratio::p_Ratio
parType_t p_Ratio[2]
Definition
Ratio.h:38
TCS::Ratio::p_EtaMin
parType_t p_EtaMin
Definition
Ratio.h:35
TCS::Ratio::initialize
virtual StatusCode initialize()
Definition
Ratio.cxx:49
TCS::Ratio::p_EtaMax
parType_t p_EtaMax
Definition
Ratio.h:36
TCS::Ratio::p_isXE2
parType_t p_isXE2
Definition
Ratio.h:39
TCS::Ratio::p_HT
parType_t p_HT
Definition
Ratio.h:37
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
met
Definition
IMETSignificance.h:24
Generated on
for ATLAS Offline Software by
1.17.0