ATLAS Offline Software
TrigMonROBData.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 
11 
12 namespace ROBbits
13 {
14  const uint32_t maskHistory = 0x0000000f;
15  const uint32_t maskStatus = 0x000000f0;
16  const uint32_t maskState = 0x000000ff;
17  const uint32_t maskSize = 0xffffff00;
18  const uint32_t shiftSize = 8;
19 }
20 
21 
22 //--------------------------------------------------------------------------------------
24  :m_rob_id(0),
25  m_word(0)
26 {
27 }
28 
29 //--------------------------------------------------------------------------------------
31  :m_rob_id(rob_id),
32  m_word(0)
33 {
34  if(rob_size >= 16777215) {
35  REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "TrigMonROBData")
36  << "Size out of range";
37  }
38  else {
39  m_word |= (rob_size << ROBbits::shiftSize);
40  }
41 }
42 
43 //--------------------------------------------------------------------------------------
45 {
46  //
47  // Set history enum.
48  //
50  m_word |= hist;
51 }
52 
53 //--------------------------------------------------------------------------------------
55 {
56  //
57  // Set status bit
58  //
59  m_word |= kOK;
60 }
61 
62 //--------------------------------------------------------------------------------------
64 {
65  //
66  // Set status bit
67  //
68  m_word |= kPREFETCH;
69 }
70 
71 //--------------------------------------------------------------------------------------
73 {
74  //
75  // Return status bit
76  //
77  return (m_word & kOK);
78 }
79 
80 //--------------------------------------------------------------------------------------
82 {
83  //
84  // Return status bit
85  //
86  return (m_word & kPREFETCH);
87 }
88 
89 //--------------------------------------------------------------------------------------
91 {
92  //
93  // Get data size
94  //
96 }
97 
98 //--------------------------------------------------------------------------------------
100 {
101  //
102  // Return encoded Status and History integer
103  //
104  return (m_word & ROBbits::maskState);
105 }
106 
107 //--------------------------------------------------------------------------------------
109 {
110  //
111  // Mask history bits and get history
112  //
113  return Trig::getROBHistory(m_word);
114 }
115 
116 //--------------------------------------------------------------------------------------
118 {
119  //
120  // Mask status bits and get status
121  //
122  return Trig::getROBStatus(m_word);
123 }
124 
125 //--------------------------------------------------------------------------------------
126 void TrigMonROBData::print(std::ostream &os) const
127 {
128  os << str(*this) << "\n";
129 }
130 
131 //--------------------------------------------------------------------------------------
132 std::string str(const TrigMonROBData &o)
133 {
134  std::stringstream str;
135  str << "TrigMonROBData: rob id=" << o.getROBId()
136  << " size=" << o.getROBSize();
137 
138  return str.str();
139 }
140 
141 //--------------------------------------------------------------------------------------
143 {
145 
146  if(hist == 1) return TrigMonROBData::kRETRIEVED;
147  if(hist == 2) return TrigMonROBData::kCACHED;
148  if(hist == 4) return TrigMonROBData::kIGNORED;
149  if(hist == 8) return TrigMonROBData::kDISABLED;
150 
152 }
153 
154 //--------------------------------------------------------------------------------------
156 {
158 
161 
163 }
164 
165 //--------------------------------------------------------------------------------------
167 {
168  if(hist == TrigMonROBData::kUNCLASSIFIED) return "UNCLASSIFIED";
169  if(hist == TrigMonROBData::kRETRIEVED) return "RETRIEVED";
170  if(hist == TrigMonROBData::kCACHED) return "CACHED";
171  if(hist == TrigMonROBData::kIGNORED) return "IGNORED";
172  if(hist == TrigMonROBData::kDISABLED) return "DISABLED";
173 
174  return "UNCLASSIFIED";
175 }
Trig::getROBStatus
TrigMonROBData::Status getROBStatus(unsigned int val)
Definition: TrigMonROBData.cxx:155
TrigMonROB.h
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
plotmaker.hist
hist
Definition: plotmaker.py:148
TrigMonROBData::setHistory
void setHistory(History hist)
Definition: TrigMonROBData.cxx:44
TrigMonROBData::getEncodedState
uint32_t getEncodedState() const
Definition: TrigMonROBData.cxx:99
TrigMonROBData::getROBId
uint32_t getROBId() const
Definition: TrigMonROBData.h:59
TrigMonROBData::getROBSize
uint32_t getROBSize() const
Definition: TrigMonROBData.cxx:90
ROBbits::maskState
const uint32_t maskState
Definition: TrigMonROBData.cxx:16
TrigMonROBData::Status
Status
Definition: TrigMonROBData.h:37
str
std::string str(const TrigMonROBData &o)
Definition: TrigMonROBData.cxx:132
TrigMonROBData::kCACHED
@ kCACHED
Definition: TrigMonROBData.h:33
TrigMonROBData::History
History
Definition: TrigMonROBData.h:30
TrigMonROBData::TrigMonROBData
TrigMonROBData()
Definition: TrigMonROBData.cxx:23
ROBbits::maskSize
const uint32_t maskSize
Definition: TrigMonROBData.cxx:17
TrigMonROBData::print
void print(std::ostream &os=std::cout) const
Definition: TrigMonROBData.cxx:126
TrigMonROBData::setStatusPREFETCH
void setStatusPREFETCH()
Definition: TrigMonROBData.cxx:63
Trig::AsStringROBHistory
std::string AsStringROBHistory(TrigMonROBData::History hist)
Definition: TrigMonROBData.cxx:166
TrigMonROBData::kDISABLED
@ kDISABLED
Definition: TrigMonROBData.h:35
TrigMonROBData::setStatusOK
void setStatusOK()
Definition: TrigMonROBData.cxx:54
TrigMonROBData
Definition: TrigMonROBData.h:27
TrigMonROBData::isStatusOk
bool isStatusOk() const
Definition: TrigMonROBData.cxx:72
TrigMonROBData::kUNCLASSIFIED
@ kUNCLASSIFIED
Definition: TrigMonROBData.h:31
beamspotman.stat
stat
Definition: beamspotman.py:266
ROBbits
Definition: TrigMonROBData.cxx:13
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
TrigMonROBData::getHistory
History getHistory() const
Definition: TrigMonROBData.cxx:108
TrigMonROBData::kRETRIEVED
@ kRETRIEVED
Definition: TrigMonROBData.h:32
TrigMonROBData::getStatus
Status getStatus() const
Definition: TrigMonROBData.cxx:117
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
TrigMonROBData::kPREFETCH
@ kPREFETCH
Definition: TrigMonROBData.h:39
Trig::getROBHistory
TrigMonROBData::History getROBHistory(unsigned int val)
Definition: TrigMonROBData.cxx:142
errorcheck.h
Helpers for checking error return status codes and reporting errors.
ROBbits::maskStatus
const uint32_t maskStatus
Definition: TrigMonROBData.cxx:15
TrigMonROBData::kOK
@ kOK
Definition: TrigMonROBData.h:40
TrigMonROBData::m_word
uint32_t m_word
Definition: TrigMonROBData.h:72
TrigMonROBData::isStatusPrefetched
bool isStatusPrefetched() const
Definition: TrigMonROBData.cxx:81
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
ROBbits::shiftSize
const uint32_t shiftSize
Definition: TrigMonROBData.cxx:18
str
Definition: BTagTrackIpAccessor.cxx:11
TrigMonROBData::kIGNORED
@ kIGNORED
Definition: TrigMonROBData.h:34
TrigMonROBData::kUNKNOWN
@ kUNKNOWN
Definition: TrigMonROBData.h:38
ROBbits::maskHistory
const uint32_t maskHistory
Definition: TrigMonROBData.cxx:14