ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigEvent
TrigMonitoringEvent
src
TrigMonROBSum.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
// C/C++
6
#include <iostream>
7
#include <sstream>
8
9
#include "
AthenaKernel/errorcheck.h
"
10
#include "
TrigMonitoringEvent/TrigMonROBSum.h
"
11
12
namespace
SumBits
13
{
14
const
uint32_t
maskHist
= 0x0000000f;
15
const
uint32_t
maskNrob
= 0x00000ff0;
16
const
uint32_t
maskSize
= 0xfffff000;
17
18
const
uint32_t
shiftNrob
= 4;
19
const
uint32_t
shiftSize
= 12;
20
}
21
22
23
//--------------------------------------------------------------------------------------
24
TrigMonROBSum::TrigMonROBSum
()
25
:
m_word
(0)
26
{
27
}
28
29
//--------------------------------------------------------------------------------------
30
TrigMonROBSum::TrigMonROBSum
(uint32_t word)
31
:
m_word
(word)
32
{
33
}
34
35
//--------------------------------------------------------------------------------------
36
bool
TrigMonROBSum::setHistory
(uint32_t hist)
37
{
38
//
39
// Set encoded state
40
//
41
if
(hist < 16) {
42
m_word
=
m_word
& (
~SumBits
::maskHist);
43
m_word
|= hist;
44
return
true
;
45
}
46
REPORT_MESSAGE_WITH_CONTEXT
(MSG::ERROR,
"TrigMonROBSum"
) <<
"setHistory: Bad int"
;
47
return
false
;
48
}
49
50
//--------------------------------------------------------------------------------------
51
bool
TrigMonROBSum::setNROB
(uint32_t nrob)
52
{
53
//
54
// Set number of robs
55
//
56
if
(nrob < 256) {
57
m_word
=
m_word
& (
~SumBits
::maskNrob);
58
m_word
|= (nrob <<
SumBits::shiftNrob
);
59
return
true
;
60
}
61
REPORT_MESSAGE_WITH_CONTEXT
(MSG::ERROR,
"TrigMonROBSum"
) <<
"setNROB: Bad int"
;
62
return
false
;
63
}
64
65
//--------------------------------------------------------------------------------------
66
bool
TrigMonROBSum::setSize
(uint32_t
size
)
67
{
68
//
69
// Set number of robs
70
//
71
if
(
size
< 1048576) {
72
m_word
=
m_word
& (
~SumBits
::maskSize);
73
m_word
|= (
size
<<
SumBits::shiftSize
);
74
return
true
;
75
}
76
REPORT_MESSAGE_WITH_CONTEXT
(MSG::ERROR,
"TrigMonROBSum"
) <<
"setSize: Bad int"
;
77
return
false
;
78
}
79
80
//--------------------------------------------------------------------------------------
81
bool
TrigMonROBSum::addROB
(
const
TrigMonROBData
&data,
int
subdet)
82
{
83
//
84
// Add rob data
85
//
86
87
if
(
getNROB
() > 254)
return
false
;
88
if
(
getSize
() > 1048574)
return
false
;
89
90
setHistory
(data.getHistory());
91
setSize
(
getSize
()+data.getROBSize());
92
93
if
(subdet < 0) {
94
setNROB
(
getNROB
()+1);
95
}
96
else
{
97
setNROB
(subdet);
98
}
99
100
return
true
;
101
}
102
103
//--------------------------------------------------------------------------------------
104
uint32_t
TrigMonROBSum::getSize
()
const
105
{
106
//
107
// Return History enum
108
//
109
return
((
m_word
&
SumBits::maskSize
) >>
SumBits::shiftSize
);
110
}
111
112
//--------------------------------------------------------------------------------------
113
uint32_t
TrigMonROBSum::getNROB
()
const
114
{
115
//
116
// Return History enum
117
//
118
return
((
m_word
&
SumBits::maskNrob
) >>
SumBits::shiftNrob
);
119
}
120
121
//--------------------------------------------------------------------------------------
122
uint32_t
TrigMonROBSum::getSubDet
()
const
123
{
124
//
125
// Return History enum
126
//
127
return
((
m_word
&
SumBits::maskNrob
) >>
SumBits::shiftNrob
);
128
}
129
130
//--------------------------------------------------------------------------------------
131
TrigMonROBData::History
TrigMonROBSum::getHistory
()
const
132
{
133
//
134
// Return History enum
135
//
136
return
Trig::getROBHistory
(
m_word
&
SumBits::maskHist
);
137
}
138
139
//--------------------------------------------------------------------------------------
140
void
TrigMonROBSum::print
(std::ostream &os)
const
141
{
142
os <<
str
(*
this
) <<
"\n"
;
143
}
144
145
//--------------------------------------------------------------------------------------
146
std::string
str
(
const
TrigMonROBSum
&o)
147
{
148
std::stringstream s;
149
s <<
"TrigMonROBSum: "
150
<<
Trig::AsStringROBHistory
(o.
getHistory
())
151
<<
" nrob="
<< o.
getNROB
()
152
<<
" size="
<< o.
getSize
();
153
154
return
s.str();
155
}
errorcheck.h
Helpers for checking error return status codes and reporting errors.
REPORT_MESSAGE_WITH_CONTEXT
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:345
size
size_t size() const
Number of registered mappings.
TrigMonROBSum.h
TrigMonROBData
Definition
TrigMonROBData.h:27
TrigMonROBData::History
History
Definition
TrigMonROBData.h:30
TrigMonROBSum
Definition
TrigMonROBSum.h:25
TrigMonROBSum::getNROB
uint32_t getNROB() const
Definition
TrigMonROBSum.cxx:113
TrigMonROBSum::m_word
uint32_t m_word
Definition
TrigMonROBSum.h:49
TrigMonROBSum::print
void print(std::ostream &os=std::cout) const
Definition
TrigMonROBSum.cxx:140
TrigMonROBSum::TrigMonROBSum
TrigMonROBSum()
Definition
TrigMonROBSum.cxx:24
TrigMonROBSum::setSize
bool setSize(uint32_t size)
Definition
TrigMonROBSum.cxx:66
TrigMonROBSum::setNROB
bool setNROB(uint32_t nrob)
Definition
TrigMonROBSum.cxx:51
TrigMonROBSum::getHistory
TrigMonROBData::History getHistory() const
Definition
TrigMonROBSum.cxx:131
TrigMonROBSum::getSize
uint32_t getSize() const
Definition
TrigMonROBSum.cxx:104
TrigMonROBSum::getSubDet
uint32_t getSubDet() const
Definition
TrigMonROBSum.cxx:122
TrigMonROBSum::setHistory
bool setHistory(uint32_t hist)
Definition
TrigMonROBSum.cxx:36
TrigMonROBSum::addROB
bool addROB(const TrigMonROBData &data, int subdet=-1)
Definition
TrigMonROBSum.cxx:81
SumBits
Definition
TrigMonROBSum.cxx:13
SumBits::shiftSize
const uint32_t shiftSize
Definition
TrigMonROBSum.cxx:19
SumBits::maskSize
const uint32_t maskSize
Definition
TrigMonROBSum.cxx:16
SumBits::maskHist
const uint32_t maskHist
Definition
TrigMonROBSum.cxx:14
SumBits::shiftNrob
const uint32_t shiftNrob
Definition
TrigMonROBSum.cxx:18
SumBits::maskNrob
const uint32_t maskNrob
Definition
TrigMonROBSum.cxx:15
Trig::getROBHistory
TrigMonROBData::History getROBHistory(unsigned int val)
Definition
TrigMonROBData.cxx:142
Trig::AsStringROBHistory
std::string AsStringROBHistory(TrigMonROBData::History hist)
Definition
TrigMonROBData.cxx:166
str
Definition
BTagTrackIpAccessor.cxx:11
Generated on
for ATLAS Offline Software by
1.17.0