ATLAS Offline Software
Loading...
Searching...
No Matches
v40_ROBFragment.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
11
12#include "v40_ROBFragment.h"
13#include "eformat/HeaderMarker.h"
14#include "eformat/Issue.h"
15
22
28
33
34offline_eformat::v40::ROBFragment::ROBFragment (const eformat::helper::u32list& blob)
35 : Header(blob.ptr()),
36 m_start()
37{
39}
40
41offline_eformat::v40::ROBFragment::ROBFragment (const eformat::helper::u32slice& blob)
42 : Header(blob.ptr()),
43 m_start()
44{
46}
47
51
52offline_eformat::v40::ROBFragment& offline_eformat::v40::ROBFragment::operator=
54{
55 if (this != &other) {
56 Header::operator=(other);
57 m_start=other.m_start;
58 }
59 return *this;
60}
61
64{
67 return *this;
68}
69
70bool
72 const bool exc)
73 const
74{
75 bool result = true;
76
77 try{
78 if (Header::marker() != eformat::ROB) {
79 throw EFORMAT_WRONG_MARKER(marker(), eformat::ROB);
80 }
81 if (Header::version() >> 16 != version) {
82 throw EFORMAT_BAD_VERSION(Header::version() >> 16, version);
83 }
84 uint32_t calculated = 7 + Header::nstatus();
85 if (Header::header_size_word() != calculated) {
86 throw EFORMAT_SIZE_CHECK(calculated, Header::header_size_word());
87 }
88 }catch(eformat::WrongMarkerIssue &ex){
89 if(exc) throw ex;
90 result = false;
91 }catch(eformat::SizeCheckIssue &ex){
92 if(exc) throw ex;
93 result = false;
94 }catch(eformat::BadVersionIssue &ex){
95 if(exc) throw ex;
96 result = false;
97 }
98
99 return result;
100}
101
103{
104 return this->check_rob_impl(version, false);
105}
106
108{
109 return this->check_rob_impl(version, true);
110}
111
112
113bool
115 const bool exc)
116 const
117{
118 bool result = true;
119
120 try{
121 if ( rod_version() >> 16 != version ) {
122 throw EFORMAT_BAD_ROD_VERSION(rod_version() >> 16, version);
123 }
124 if ( rod_header_size_word() != 9 ) {
125 throw EFORMAT_SIZE_CHECK(9, rod_header_size_word());
126 }
127 if ( rod_fragment_size_word() != 12 + rod_nstatus() + rod_ndata() ) {
128 throw EFORMAT_ROD_SIZE_CHECK(rod_fragment_size_word(),
129 (12 + rod_nstatus() + rod_ndata()));
130 }
131 }catch(eformat::RODSizeCheckIssue &ex){
132 if(exc) throw ex;
133 result = false;
134 }catch(eformat::SizeCheckIssue &ex){
135 if(exc) throw ex;
136 result = false;
137 }catch(eformat::BadRodVersionIssue &ex){
138 if(exc) throw ex;
139 result = false;
140 }
141
142 return result;
143}
144
146{
147 return this->check_rod_impl(version, false);
148}
149
151{
152 return this->check_rod_impl(version, true);
153}
154
155
156bool
158 const uint16_t rod_version,
159 const bool exc)
160 const
161{
162 return this->check_rob_impl(version, exc) &&
163 this->check_rod_impl(rod_version, exc);
164}
165
166bool
168 const uint16_t rod_version) const
169{
170 return this->check_impl(version, rod_version, false);
171}
172
173bool
175 const uint16_t rod_version) const
176{
177 return this->check_impl(version, rod_version, true);
178}
179
181 (std::vector<eformat::FragmentProblem>& p, const uint16_t version) const
182{
183 //ROB checking
184 if (Header::marker() != eformat::ROB)
185 p.push_back(eformat::WRONG_MARKER);
186 if ( Header::version() >> 16 != version )
187 p.push_back(eformat::UNSUPPORTED_VERSION);
188 uint32_t calculated = 7 + Header::nstatus();
189 if (Header::header_size_word() != calculated)
190 p.push_back(eformat::WRONG_FRAGMENT_SIZE);
191}
192
194 (std::vector<eformat::FragmentProblem>& p, const uint16_t version) const
195{
196 //ROD stuff
197 if (rod_marker() != eformat::ROD) p.push_back(eformat::WRONG_ROD_MARKER);
198 if (rod_version() >> 16 != version)
199 p.push_back(eformat::UNSUPPORTED_ROD_VERSION);
200 if (rod_header_size_word() != 9) p.push_back(eformat::WRONG_ROD_HEADER_SIZE);
201 if (rod_fragment_size_word() != 12 + rod_nstatus() + rod_ndata())
202 p.push_back(eformat::WRONG_ROD_FRAGMENT_SIZE);
203}
204
206(std::vector<eformat::FragmentProblem>& p,
207 const uint16_t version, const uint16_t rod_version) const
208{
211}
212
214{
215 if (rod_status_position()) return m_start + 9 + rod_ndata();
216 return m_start + 9;
217}
218
220{
221 if (!rod_status_position()) return m_start + 9 + rod_nstatus();
222 return m_start + 9;
223}
224
225const uint32_t* offline_eformat::v40::ROBFragment::child (size_t n) const
226{
227 if (n == 0) return m_start;
228 return 0;
229}
230
231uint32_t offline_eformat::v40::ROBFragment::children (const uint32_t** p, size_t max)
232 const
233{
234 if (max == 0) return 0;
235 p[0] = m_start;
236 return 1;
237}
238
243
248
253
258
260{
261 return m_start;
262}
263
265{
266 return m_start[0];
267}
268
273
275{
276 return m_start[1];
277}
278
280{
281 return 3;
282}
283
285{
286 return m_start[2];
287}
288
290{
291 return m_start[3];
292}
293
295{
296 return m_start[4];
297}
298
300{
301 return m_start[5];
302}
303
305{
306 return m_start[6];
307}
308
313
315{
316 return m_start[8];
317}
318
320{
321 return 1;
322}
#define max(a, b)
Definition cfImp.cxx:41
const uint32_t * specific_header() const
Returns an iterator to the start of the specific header part.
Header(const uint32_t *it)
To build a header given the containing buffer.
uint32_t payload_size_word(void) const
Returns the payload size.
Header & operator=(const Header &other)
Assigment operator.
uint32_t source_id() const
Returns the full source identifier.
uint32_t marker() const
Returns the fragment type.
uint32_t nstatus() const
Returns the number of status words available.
uint32_t version() const
Returns the formatting version.
uint32_t header_size_word() const
Returns the size, in words, of the current header.
Header & assign(const uint32_t *it)
Reassign this header.
Describes how to access the contents of a subdetector fragment, as prescribed by the event format not...
bool check_rod_impl(const uint16_t rod_version=eformat::MAJOR_V31_VERSION, const bool exc=true) const
Says if the underlying ROD fragmentis valid.
uint32_t rod_version() const
Returns the formatting version for the ROD fragment.
const uint32_t * m_start
my one-after-the-last word
uint32_t rod_detev_type() const
Returns the detector event type.
bool check_rob_noex(const uint16_t version=eformat::MAJOR_V40_VERSION) const
Says if the ROB fragment is valid.
uint32_t rod_status_position() const
Returns the status block position.
bool check_noex(const uint16_t version=eformat::MAJOR_V40_VERSION, const uint16_t rod_version=eformat::MAJOR_V31_VERSION) const
Says if the fragment is valid.
void problems(std::vector< eformat::FragmentProblem > &p, const uint16_t version=eformat::MAJOR_V40_VERSION, const uint16_t rod_version=eformat::MAJOR_V31_VERSION) const
Tells which problemS the current fragment has.
uint32_t rod_bc_id() const
Returns the bunch crossing identifier.
const uint32_t * rod_start() const
Sets the given pointer to the ROD fragment start.
uint32_t rod_fragment_size_word() const
Returns the total fragment size.
uint32_t rod_source_id() const
Returns the source identifier of the ROD fragment.
bool check(const uint16_t version=eformat::MAJOR_V40_VERSION, const uint16_t rod_version=eformat::MAJOR_V31_VERSION) const
Says if the fragment is valid.
virtual uint32_t children(const uint32_t **p, size_t max) const
Returns all the children of this fragment.
uint32_t rod_ndata() const
Returns the number of data words available.
uint32_t rod_header_size_word() const
Returns the size, in words, of the current header.
uint32_t rod_lvl1_trigger_type() const
Returns the lvl1 trigger type.
const uint32_t * child(size_t n) const
Returns the nth child fragment.
bool check_rod(const uint16_t rod_version=eformat::MAJOR_V31_VERSION) const
Says if the underlying ROD fragment is valid.
uint32_t rod_marker() const
Returns the fragment type.
bool check_impl(const uint16_t version=eformat::MAJOR_V40_VERSION, const uint16_t rod_version=eformat::MAJOR_V31_VERSION, const bool exc=true) const
Says if the fragment is valid.
ROBFragment(const uint32_t *it)
To build a fragment given the containing buffer.
ROBFragment & assign(const uint32_t *it)
Manual re-assignment.
uint32_t rod_run_no() const
Returns the current run number.
uint32_t rob_source_id() const
Gets the source_id of the ROB fragment itself.
virtual ~ROBFragment()
Destructor virtualisation.
void rod_problems(std::vector< eformat::FragmentProblem > &p, const uint16_t version=eformat::MAJOR_V31_VERSION) const
Tells which problemS the underlying ROD fragment has.
const uint32_t * rod_data() const
Returns a pointer to the first data word.
const uint32_t * rod_status() const
Returns the status words, as an iterator to the status words available.
uint32_t rod_nstatus() const
Returns the number of status words available.
bool check_rod_noex(const uint16_t rod_version=eformat::MAJOR_V31_VERSION) const
Says if the underlying ROD fragment is valid.
uint32_t rod_trailer_size_word() const
Returns the size, in words, of the trailer.
void rob_problems(std::vector< eformat::FragmentProblem > &p, const uint16_t version=eformat::MAJOR_V40_VERSION) const
Tells which problemS the current ROB fragment has.
bool check_rob_impl(const uint16_t version=eformat::MAJOR_V40_VERSION, const bool exc=true) const
Says if the ROB fragment is valid.
bool check_rob(const uint16_t version=eformat::MAJOR_V40_VERSION) const
Says if the ROB fragment is valid.
uint32_t rod_lvl1_id() const
Returns the lvl1 identifier.
virtual uint32_t nchildren() const
Returns the number of children available.