ATLAS Offline Software
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 
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 //--------------------------------------------------------------------------------------
25  :m_word(0)
26 {
27 }
28 
29 //--------------------------------------------------------------------------------------
31  :m_word(word)
32 {
33 }
34 
35 //--------------------------------------------------------------------------------------
37 {
38  //
39  // Set encoded state
40  //
41  if(hist < 16) {
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 //--------------------------------------------------------------------------------------
52 {
53  //
54  // Set number of robs
55  //
56  if(nrob < 256) {
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 //--------------------------------------------------------------------------------------
67 {
68  //
69  // Set number of robs
70  //
71  if(size < 1048576) {
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 //--------------------------------------------------------------------------------------
105 {
106  //
107  // Return History enum
108  //
110 }
111 
112 //--------------------------------------------------------------------------------------
114 {
115  //
116  // Return History enum
117  //
119 }
120 
121 //--------------------------------------------------------------------------------------
123 {
124  //
125  // Return History enum
126  //
128 }
129 
130 //--------------------------------------------------------------------------------------
132 {
133  //
134  // Return History enum
135  //
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: "
151  << " nrob=" << o.getNROB()
152  << " size=" << o.getSize();
153 
154  return s.str();
155 }
SumBits::maskHist
const uint32_t maskHist
Definition: TrigMonROBSum.cxx:14
TrigMonROBSum
Definition: TrigMonROBSum.h:25
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
TrigMonROBSum::setSize
bool setSize(uint32_t size)
Definition: TrigMonROBSum.cxx:66
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TrigMonROBSum::setNROB
bool setNROB(uint32_t nrob)
Definition: TrigMonROBSum.cxx:51
plotmaker.hist
hist
Definition: plotmaker.py:148
SumBits
Definition: TrigMonROBSum.cxx:13
SumBits::shiftNrob
const uint32_t shiftNrob
Definition: TrigMonROBSum.cxx:18
TrigMonROBSum::getSubDet
uint32_t getSubDet() const
Definition: TrigMonROBSum.cxx:122
TrigMonROBSum.h
TrigMonROBSum::getNROB
uint32_t getNROB() const
Definition: TrigMonROBSum.cxx:113
SumBits::shiftSize
const uint32_t shiftSize
Definition: TrigMonROBSum.cxx:19
TrigMonROBSum::m_word
uint32_t m_word
Definition: TrigMonROBSum.h:49
TrigMonROBData::History
History
Definition: TrigMonROBData.h:30
TrigMonROBSum::getHistory
TrigMonROBData::History getHistory() const
Definition: TrigMonROBSum.cxx:131
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
Trig::AsStringROBHistory
std::string AsStringROBHistory(TrigMonROBData::History hist)
Definition: TrigMonROBData.cxx:166
TrigMonROBData
Definition: TrigMonROBData.h:27
TrigMonROBSum::addROB
bool addROB(const TrigMonROBData &data, int subdet=-1)
Definition: TrigMonROBSum.cxx:81
TrigMonROBSum::print
void print(std::ostream &os=std::cout) const
Definition: TrigMonROBSum.cxx:140
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
TrigMonROBSum::setHistory
bool setHistory(uint32_t hist)
Definition: TrigMonROBSum.cxx:36
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
SumBits::maskNrob
const uint32_t maskNrob
Definition: TrigMonROBSum.cxx:15
Trig::getROBHistory
TrigMonROBData::History getROBHistory(unsigned int val)
Definition: TrigMonROBData.cxx:142
errorcheck.h
Helpers for checking error return status codes and reporting errors.
str
std::string str(const TrigMonROBSum &o)
Definition: TrigMonROBSum.cxx:146
TrigMonROBSum::getSize
uint32_t getSize() const
Definition: TrigMonROBSum.cxx:104
TrigMonROBSum::TrigMonROBSum
TrigMonROBSum()
Definition: TrigMonROBSum.cxx:24
SumBits::maskSize
const uint32_t maskSize
Definition: TrigMonROBSum.cxx:16