ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigConfiguration
TrigConfHLTData
Root
HLTPrescaleSet.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include <iomanip>
6
#include <iostream>
7
8
#include "
TrigConfHLTData/HLTPrescaleSet.h
"
9
#include "
TrigConfHLTData/HLTFrame.h
"
10
#include "
TrigConfHLTData/HLTChain.h
"
11
#include "
TrigConfHLTData/HLTChainList.h
"
12
13
using namespace
std
;
14
using namespace
TrigConf
;
15
16
TrigConf::HLTPrescaleSet::HLTPrescaleSet
() :
17
m_iovstart
(0),
18
m_iovend
(0)
19
{}
20
21
TrigConf::HLTPrescale
&
22
TrigConf::HLTPrescaleSet::setPrescale
(
const
HLTPrescale
&
sc
,
unsigned
int
chain_counter,
HLTLevel
level) {
23
ScalingMap_t
& map =
m_scalers
[
static_cast<
unsigned
int
>
(level)];
24
ScalingMap_t::iterator s = map.find(chain_counter);
25
if
(s==map.end()) {
26
s = map.insert(ScalingMap_t::value_type(chain_counter,
sc
)).first;
27
}
else
{
28
s->second =
sc
;
29
}
30
return
s->second;
31
}
32
33
34
bool
35
TrigConf::HLTPrescaleSet::hasPrescale
(
unsigned
int
counter
,
HLTLevel
level )
const
{
36
const
ScalingMap_t
& map_for_level =
m_scalers
[
static_cast<
unsigned
int
>
(level)];
37
return
!map_for_level.empty() && map_for_level.count(
counter
)>0;
38
}
39
40
41
const
TrigConf::HLTPrescale
&
42
TrigConf::HLTPrescaleSet::getPrescale
(
unsigned
int
chain_counter,
HLTLevel
level)
const
{
43
const
ScalingMap_t
& map =
m_scalers
[
static_cast<
unsigned
int
>
(level)];
44
ScalingMap_t::const_iterator s = map.find(chain_counter);
45
if
(s==map.end()) {
46
cerr <<
"HLTPrescaleSet::getPrescale: chain counter "
<< chain_counter <<
" in level "
<< level <<
" has no prescales"
<< endl;
47
throw
std::runtime_error(
"HLTPrescaleSet::getPrescale: chain has no prescales defined"
);
48
}
49
return
s->second;
50
}
51
52
TrigConf::HLTPrescale
&
53
TrigConf::HLTPrescaleSet::thePrescale
(
unsigned
int
chain_counter,
HLTLevel
level) {
54
ScalingMap_t
& map =
m_scalers
[
static_cast<
unsigned
int
>
(level)];
55
ScalingMap_t::iterator s = map.find(chain_counter);
56
if
(s==map.end())
57
s = map.insert(ScalingMap_t::value_type(chain_counter,
HLTPrescale
())).first;
58
59
return
s->second;
60
}
61
62
63
//________________________________________________________________________________
64
void
65
TrigConf::HLTPrescaleSet::setIOV
(uint32_t start_run, uint32_t start_lb, uint32_t end_run, uint32_t end_lb ) {
66
m_iovstart
= start_run;
m_iovstart
<<= 32;
m_iovstart
+= start_lb;
67
m_iovend
= end_run;
m_iovend
<<= 32;
m_iovend
+= end_lb;
68
}
69
70
//________________________________________________________________________________
71
void
72
TrigConf::HLTPrescaleSet::setIOV
(uint64_t start, uint64_t end ) {
73
m_iovstart
= start;
74
m_iovend
= end;
75
}
76
77
//________________________________________________________________________________
78
// note that end_run/end_lb specifies the first lb for which the HLT PSS is not valid anymore (COOL design)
79
void
80
TrigConf::HLTPrescaleSet::getIOV
(uint32_t& start_run, uint32_t& start_lb, uint32_t& end_run, uint32_t& end_lb )
const
{
81
start_lb =
m_iovstart
& 0xFFFFFFFF;
82
start_run =
m_iovstart
>>32;
83
end_lb =
m_iovend
& 0xFFFFFFFF;
84
end_run =
m_iovend
>>32;
85
}
86
87
//________________________________________________________________________________
88
bool
89
TrigConf::HLTPrescaleSet::isValid
(uint32_t
run
, uint32_t
lb
)
const
{
90
unsigned
long
long
iovtime =
run
;
91
iovtime <<= 32;
92
iovtime +=
lb
;
93
94
return
iovtime >=
m_iovstart
&& iovtime<
m_iovend
;
// m_iovend is not part of the IOV
95
}
96
97
//________________________________________________________________________________
98
void
99
TrigConf::HLTPrescaleSet::reset
() {
100
for
(
unsigned
int
i = 0; i<3; ++i )
101
m_scalers
[i].
clear
();
102
}
103
104
//________________________________________________________________________________
105
void
TrigConf::HLTPrescaleSet::print
(
const
std::string&
indent
,
unsigned
int
detail
)
const
{
106
if
(
detail
>=1) {
107
cout <<
indent
<<
"HLTPrescaleSet "
;
printNameIdV
();
108
cout <<
indent
<<
" L2 scalers "
<<
size
(
L2
) << endl
109
<<
indent
<<
" EF scalers "
<<
size
(
EF
) << endl
110
<<
indent
<<
" HLT scalers "
<<
size
(
HLT
) << endl;
111
if
(
detail
>=3) {
112
cout.unsetf(ios_base::floatfield);
113
for
(
unsigned
int
i=
L2
; i<=
HLT
; i++) {
114
HLTLevel
level =
HLTLevel
(i);
115
if
(
size
(level)==0)
continue
;
116
if
(level!=
HLT
)
117
cout <<
indent
<<
" "
<< (level==
L2
?
"L2"
:
"EF"
) <<
" prescales:"
<< endl;
118
119
const
ScalingMap_t
& map =
m_scalers
[
static_cast<
unsigned
int
>
(level)];
120
121
for
(
uint
cc=0; cc<8192;cc++) {
122
auto
s_iter = map.find(cc);
123
if
(s_iter==map.end())
continue
;
124
const
HLTPrescale
& s = s_iter->second;
125
cout <<
indent
<<
" Chain counter: "
<< setw(4) << cc
126
<<
", prescale: "
<< setw(4) << s.prescale()
127
<<
", pass-through: "
<< setw(4) << s.pass_through();
128
if
( s.getRerunPrescales().size()>0 ) {
129
cout <<
", rerun prescales: "
;
130
for
( HLTPrescale::PrescaleMap_t::value_type ps: s.getRerunPrescales())
131
cout << ps.first <<
": "
<< ps.second <<
", "
;
132
}
133
if
( s.getStreamPrescales().size()>0 ) {
134
cout <<
", stream prescales: "
;
135
for
( HLTPrescale::PrescaleMap_t::value_type str_ps: s.getStreamPrescales())
136
cout << str_ps.first <<
": "
<< str_ps.second <<
", "
;
137
}
138
cout << endl;
139
}
140
}
141
}
142
}
143
}
144
145
146
//________________________________________________________________________________
147
std::ostream&
148
TrigConf::operator<<
(std::ostream & o,
const
TrigConf::HLTPrescaleSet
& c) {
149
o <<
"HLTPrescaleSet "
<< c.name();
150
if
(c.id()>0 || c.version()>0) o <<
" (id="
<< c.id() <<
"/v="
<< c.version() <<
")"
;
151
o << endl;
152
if
(c.comment()!=
""
) o <<
"Comment : "
<< c.comment() << endl;
153
154
for
(
unsigned
int
i =
TrigConf::L2
; i <=
TrigConf::HLT
; i++) {
155
TrigConf::HLTLevel
level =
TrigConf::HLTLevel
(i);
156
if
(c.size(level)==0)
continue
;
157
o << (level==
TrigConf::L2
?
"L2"
:
"EF"
) <<
" prescales:"
<< endl;
158
for
(
const
TrigConf::HLTPrescaleSet::ScalingMap_t::value_type&
sc
: c.getPrescales(level)) {
159
o <<
"Chain counter: "
<< setw(4) <<
sc
.first
160
<<
", prescale: "
<< setw(4) <<
sc
.second.prescale()
161
<<
", pass-through: "
<< setw(4) <<
sc
.second.pass_through()
162
<< endl;
163
}
164
}
165
o <<
"---------------------------------------------------------- "
<< endl;
166
return
o;
167
}
168
169
string
HLTPrescaleSet::__str__
()
const
{
170
stringstream s;
171
s << *
this
;
172
return
s.str();
173
}
HLTChainList.h
HLTFrame.h
HLTPrescaleSet.h
uint
unsigned int uint
Definition
LArOFPhaseFill.cxx:19
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
size
size_t size() const
Number of registered mappings.
clear
void clear()
Empty the pool.
HLTChain.h
TrigConf::HLTPrescaleSet
HLT chain configuration information.
Definition
HLTPrescaleSet.h:31
TrigConf::HLTPrescaleSet::print
void print(const std::string &indent="", unsigned int detail=1) const override
print the prescale set
Definition
HLTPrescaleSet.cxx:105
TrigConf::HLTPrescaleSet::m_scalers
std::array< ScalingMap_t, 3 > m_scalers
Definition
HLTPrescaleSet.h:72
TrigConf::HLTPrescaleSet::setIOV
void setIOV(uint32_t start_run, uint32_t start_lb, uint32_t end_run, uint32_t end_lb)
sets the IOV of the prescale set
Definition
HLTPrescaleSet.cxx:65
TrigConf::HLTPrescaleSet::HLTPrescaleSet
HLTPrescaleSet()
default constructor
Definition
HLTPrescaleSet.cxx:16
TrigConf::HLTPrescaleSet::m_iovend
uint64_t m_iovend
Definition
HLTPrescaleSet.h:75
TrigConf::HLTPrescaleSet::getIOV
void getIOV(uint32_t &start_run, uint32_t &start_lb, uint32_t &end_run, uint32_t &end_lb) const
gets the IOV of the prescale set
Definition
HLTPrescaleSet.cxx:80
TrigConf::HLTPrescaleSet::isValid
bool isValid(uint32_t run, uint32_t lb) const
checks if run/lb are in the current IOV
Definition
HLTPrescaleSet.cxx:89
TrigConf::HLTPrescaleSet::__str__
std::string __str__() const override
Definition
HLTPrescaleSet.cxx:169
TrigConf::HLTPrescaleSet::hasPrescale
bool hasPrescale(unsigned int counter, TrigConf::HLTLevel level=HLT) const
Definition
HLTPrescaleSet.cxx:35
TrigConf::HLTPrescaleSet::thePrescale
HLTPrescale & thePrescale(unsigned int chain_counter, HLTLevel level)
Definition
HLTPrescaleSet.cxx:53
TrigConf::HLTPrescaleSet::reset
void reset()
Definition
HLTPrescaleSet.cxx:99
TrigConf::HLTPrescaleSet::setPrescale
HLTPrescale & setPrescale(const HLTPrescale &sc, unsigned int chain_counter, HLTLevel level=HLT)
Definition
HLTPrescaleSet.cxx:22
TrigConf::HLTPrescaleSet::m_iovstart
uint64_t m_iovstart
Definition
HLTPrescaleSet.h:74
TrigConf::HLTPrescaleSet::getPrescale
const HLTPrescale & getPrescale(unsigned int chain_counter, HLTLevel level=HLT) const
Definition
HLTPrescaleSet.cxx:42
TrigConf::HLTPrescaleSet::ScalingMap_t
std::unordered_map< unsigned int, HLTPrescale > ScalingMap_t
Definition
HLTPrescaleSet.h:34
TrigConf::HLTPrescale
Definition
HLTPrescale.h:30
TrigConf::TrigConfData::indent
std::ostream & indent(std::ostream &o, int lvl, int size) const
Definition
TrigConfData.cxx:23
TrigConf::TrigConfData::printNameIdV
void printNameIdV(const std::string &indent="") const
Definition
TrigConfData.cxx:31
lb
int lb
Definition
globals.cxx:23
HLT
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
Definition
HLTResultReader.h:26
TrigConf
Forward iterator to traverse the main components of the trigger configuration.
Definition
Config.h:22
TrigConf::HLTLevel
HLTLevel
Definition
HLTLevel.h:12
TrigConf::L2
@ L2
Definition
HLTLevel.h:12
TrigConf::HLT
@ HLT
Definition
HLTLevel.h:12
TrigConf::EF
@ EF
Definition
HLTLevel.h:12
TrigConf::operator<<
std::ostream & operator<<(std::ostream &os, const TrigConf::IsolationLegacy &iso)
Definition
L1ThresholdBase.cxx:339
detail
Definition
extract_histogram_tag.cxx:14
std
STL namespace.
TrigConf::counter
Definition
HLTChainList.h:37
run
int run(int argc, char *argv[])
Definition
ttree2hdf5.cxx:28
Generated on
for ATLAS Offline Software by
1.17.0