ATLAS Offline Software
ROBDataMonitor.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include <iomanip>
7 
8 using namespace robmonitor;
9 
10 //
11 //--- ROBDataStruct
12 // -------------
14  : rob_id(srcId)
15 {}
16 
18  return ((rob_history == robmonitor::UNCLASSIFIED) ? true : false);
19 }
20 
22  return ((rob_history == robmonitor::HLT_CACHED) ? true : false);
23 }
24 
26  return ((rob_history == robmonitor::DCM_CACHED) ? true : false);
27 }
28 
30  return ((rob_history == robmonitor::RETRIEVED) ? true : false);
31 }
32 
34  return ((rob_history == robmonitor::IGNORED) ? true : false);
35 }
36 
38  return ((rob_history == robmonitor::UNDEFINED) ? true : false);
39 }
40 
42  return (rob_status_word == 0) ? true : false;
43 }
44 
45 // Extraction operator for ROBDataStruct
46 std::ostream& robmonitor::operator<<(std::ostream& os, const ROBDataStruct& rhs) {
47  os << "[SourceID,Size(words),History,(Status words)]=["
48  << std::hex << std::setfill( '0' ) << "0x" << std::setw(6) << rhs.rob_id
49  << std::dec << std::setfill(' ')
50  << "," << std::setw(8) << rhs.rob_size;
51  os << "," << std::setw(12);
53  os << "UNCLASSIFIED";
54  } else if (rhs.rob_history == robmonitor::RETRIEVED) {
55  os << "RETRIEVED";
56  } else if (rhs.rob_history == robmonitor::HLT_CACHED) {
57  os << "HLT_CACHED";
58  } else if (rhs.rob_history == robmonitor::DCM_CACHED) {
59  os << "DCM_CACHED";
60  }else if (rhs.rob_history == robmonitor::IGNORED) {
61  os << "IGNORED";
62  } else if (rhs.rob_history == robmonitor::UNDEFINED) {
63  os << "UNDEFINED";
64  } else {
65  os << "invalid code";
66  }
67  os << ",(";
68  os << std::hex << std::setfill( '0' ) << "0x" << std::setw(8) << rhs.rob_status_word;
69  os << ")]";
70  return os;
71 }
72 
73 //
74 //--- ROBDataMonitorStruct
75 // --------------------
76 ROBDataMonitorStruct::ROBDataMonitorStruct(const uint32_t l1_id, const std::string& req_nam="UNKNOWN")
77  :lvl1ID(l1_id),
78  requestor_name(req_nam)
79 {}
80 
82  const std::vector<uint32_t>& req_robs,
83  const std::string& req_nam="UNKNOWN")
84  :lvl1ID(l1_id),
85  requestor_name(req_nam)
86 {
87  for (uint32_t rob : req_robs) {
89  }
90 }
91 
93  return requested_ROBs.size();
94 }
95 
97  ptrdiff_t ret=0;
98  for (const auto& p : requested_ROBs) {
99  if (p.second.isUnclassified()) ++ret;
100  }
101  return ret;
102 }
103 
105  ptrdiff_t ret=0;
106  for (const auto& p : requested_ROBs) {
107  if (p.second.isHLTCached()) ++ret;
108  }
109  return ret;
110 }
111 
113  ptrdiff_t ret=0;
114  for (const auto& p : requested_ROBs) {
115  if (p.second.isDCMCached()) ++ret;
116  }
117  return ret;
118 }
119 
121  ptrdiff_t ret=0;
122  for (const auto& p : requested_ROBs) {
123  if (p.second.isRetrieved()) ++ret;
124  }
125  return ret;
126 }
127 
129  ptrdiff_t ret=0;
130  for (const auto& p : requested_ROBs) {
131  if (p.second.isIgnored()) ++ret;
132  }
133  return ret;
134 }
135 
137  ptrdiff_t ret=0;
138  for (const auto& p : requested_ROBs) {
139  if (p.second.isUndefined()) ++ret;
140  }
141  return ret;
142 }
143 
145  ptrdiff_t ret=0;
146  for (const auto& p : requested_ROBs) {
147  if (p.second.isStatusOk()) ++ret;
148  }
149  return ret;
150 }
151 
153  float secs = 0 ;
154  if (end_time >= start_time)
155  secs = (end_time - start_time)/1e3;
156  return secs;
157 }
158 
159 // Extraction operator for ROBDataMonitorStruct
160 std::ostream& robmonitor::operator<<(std::ostream& os, const ROBDataMonitorStruct& rhs) {
161  const std::string prefix(" ");
162  const std::string prefix2("-> ");
163  os << "ROB Request for L1 ID = " << std::dec << rhs.lvl1ID << " (decimal), L1 ID = 0x"
164  << std::hex << rhs.lvl1ID << " (hex)" << std::dec;
165  os << "\n" << prefix << "Requestor name = " << rhs.requestor_name;
166 
167  const std::time_t s_time(rhs.start_time / static_cast<int>(1e6));
168  struct tm buf;
169  localtime_r(&s_time, &buf);
170  os << "\n" << prefix << "Start time of ROB request = "
171  << std::put_time(&buf, "%c")
172  << " + " << (rhs.start_time % static_cast<int>(1e6)) / 1000.0f << " [ms]";
173 
174  const std::time_t e_time(rhs.end_time / static_cast<int>(1e6));
175  localtime_r(&e_time, &buf);
176  os << "\n" << prefix << "Stop time of ROB request = "
177  << std::put_time(&buf, "%c")
178  << " + " << (rhs.end_time % static_cast<int>(1e6)) / 1000.0f << " [ms]";
179  os << "\n" << prefix << "Elapsed time for ROB request [ms] = " << rhs.elapsedTime();
180  os << "\n" << prefix << "Requested ROBs:";
181  os << "\n" << prefix << prefix2 << "All " << rhs.allROBs() ;
182  os << "\n" << prefix << prefix2 << "Unclassified " << rhs.unclassifiedROBs() ;
183  os << "\n" << prefix << prefix2 << "HLT Cached " << rhs.HLTcachedROBs() ;
184  os << "\n" << prefix << prefix2 << "DCM Cached " << rhs.DCMcachedROBs() ;
185  os << "\n" << prefix << prefix2 << "Retrieved " << rhs.retrievedROBs() ;
186  os << "\n" << prefix << prefix2 << "Ignored " << rhs.ignoredROBs() ;
187  os << "\n" << prefix << prefix2 << "Undefined " << rhs.undefinedROBs() ;
188  os << "\n" << prefix << prefix2 << "Status OK " << rhs.statusOkROBs() ;
189  for (const auto& [id, rob] : rhs.requested_ROBs ) {
190  os << "\n" << prefix << prefix2 << rob;
191  }
192  return os;
193 }
robmonitor::ROBDataMonitorStruct::retrievedROBs
unsigned retrievedROBs() const
number of retrieved ROBs in structure
Definition: ROBDataMonitor.cxx:120
robmonitor::UNDEFINED
@ UNDEFINED
Definition: ROBDataMonitor.h:30
robmonitor::ROBDataMonitorStruct
The structure which is used to monitor the ROB data request in L2 It is created for every addROBData ...
Definition: ROBDataMonitor.h:79
robmonitor::ROBDataMonitorStruct::ignoredROBs
unsigned ignoredROBs() const
number of ignored ROBs in structure
Definition: ROBDataMonitor.cxx:128
robmonitor::ROBDataStruct
A structure with data about ROB properties.
Definition: ROBDataMonitor.h:37
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
robmonitor::operator<<
std::ostream & operator<<(std::ostream &os, const ROBDataStruct &rhs)
Definition: ROBDataMonitor.cxx:46
robmonitor::DCM_CACHED
@ DCM_CACHED
Definition: ROBDataMonitor.h:28
robmonitor::ROBDataMonitorStruct::HLTcachedROBs
unsigned HLTcachedROBs() const
number of ROBDataProviderSvc cached ROBs in structure
Definition: ROBDataMonitor.cxx:104
robmonitor::ROBDataStruct::isIgnored
bool isIgnored() const
ROB was ignored.
Definition: ROBDataMonitor.cxx:33
ROBDataMonitor.h
robmonitor::ROBDataStruct::rob_size
uint32_t rob_size
Definition: ROBDataMonitor.h:50
robmonitor::ROBDataStruct::isStatusOk
bool isStatusOk() const
ROB has no status words set.
Definition: ROBDataMonitor.cxx:41
robmonitor::ROBDataMonitorStruct::DCMcachedROBs
unsigned DCMcachedROBs() const
number of DCM cached ROBs in structure
Definition: ROBDataMonitor.cxx:112
robmonitor::ROBDataMonitorStruct::elapsedTime
float elapsedTime() const
elapsed time for ROB request in [ms]
Definition: ROBDataMonitor.cxx:152
robmonitor::ROBDataStruct::isDCMCached
bool isDCMCached() const
ROB was found in DCM cache.
Definition: ROBDataMonitor.cxx:25
robmonitor::ROBDataMonitorStruct::end_time
uint64_t end_time
start time of ROB request (microsec since epoch)
Definition: ROBDataMonitor.h:113
robmonitor::IGNORED
@ IGNORED
Definition: ROBDataMonitor.h:29
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
CheckAppliedSFs.e3
e3
Definition: CheckAppliedSFs.py:264
robmonitor::ROBDataStruct::isUndefined
bool isUndefined() const
ROB was not enabled.
Definition: ROBDataMonitor.cxx:37
robmonitor::ROBDataStruct::rob_id
uint32_t rob_id
Definition: ROBDataMonitor.h:49
robmonitor::ROBDataMonitorStruct::undefinedROBs
unsigned undefinedROBs() const
number of undefined ROBs in structure
Definition: ROBDataMonitor.cxx:136
robmonitor::ROBDataStruct::rob_status_word
uint32_t rob_status_word
Definition: ROBDataMonitor.h:52
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
robmonitor::ROBDataMonitorStruct::lvl1ID
uint32_t lvl1ID
Definition: ROBDataMonitor.h:107
robmonitor::ROBDataStruct::ROBDataStruct
ROBDataStruct()=default
default constructor
robmonitor::ROBDataStruct::rob_history
robmonitor::ROBHistory rob_history
Definition: ROBDataMonitor.h:51
robmonitor::ROBDataStruct::isHLTCached
bool isHLTCached() const
ROB was found in ROBDataProviderSvc cache.
Definition: ROBDataMonitor.cxx:21
robmonitor::ROBDataMonitorStruct::ROBDataMonitorStruct
ROBDataMonitorStruct()=default
default constructor
robmonitor::ROBDataMonitorStruct::statusOkROBs
unsigned statusOkROBs() const
number of ROBs with no status words set in structure
Definition: ROBDataMonitor.cxx:144
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
robmonitor::ROBDataMonitorStruct::start_time
uint64_t start_time
map of ROBs requested
Definition: ROBDataMonitor.h:112
robmonitor
Definition: ROBDataMonitor.h:19
robmonitor::ROBDataStruct::isUnclassified
bool isUnclassified() const
ROB is unclassified.
Definition: ROBDataMonitor.cxx:17
robmonitor::ROBDataMonitorStruct::requestor_name
std::string requestor_name
current L1 ID from L1 ROBs
Definition: ROBDataMonitor.h:108
robmonitor::RETRIEVED
@ RETRIEVED
Definition: ROBDataMonitor.h:26
robmonitor::HLT_CACHED
@ HLT_CACHED
Definition: ROBDataMonitor.h:27
robmonitor::ROBDataMonitorStruct::requested_ROBs
std::map< const uint32_t, robmonitor::ROBDataStruct > requested_ROBs
name of requesting algorithm
Definition: ROBDataMonitor.h:109
robmonitor::ROBDataMonitorStruct::unclassifiedROBs
unsigned unclassifiedROBs() const
number of unclassified ROBs in structure
Definition: ROBDataMonitor.cxx:96
robmonitor::UNCLASSIFIED
@ UNCLASSIFIED
Definition: ROBDataMonitor.h:25
robmonitor::ROBDataStruct::isRetrieved
bool isRetrieved() const
ROB was retrieved over network.
Definition: ROBDataMonitor.cxx:29
robmonitor::ROBDataMonitorStruct::allROBs
unsigned allROBs() const
stop time of ROB request (microsec since epoch)
Definition: ROBDataMonitor.cxx:92