ATLAS Offline Software
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 
12 #include "v40_ROBFragment.h"
13 #include "eformat/HeaderMarker.h"
14 #include "eformat/Issue.h"
15 
17  : Header(it),
18  m_start()
19 {
21 }
22 
26 {
27 }
28 
30  : Header(), m_start()
31 {
32 }
33 
34 offline_eformat::v40::ROBFragment::ROBFragment (const eformat::helper::u32list& blob)
35  : Header(blob.ptr()),
36  m_start()
37 {
39 }
40 
41 offline_eformat::v40::ROBFragment::ROBFragment (const eformat::helper::u32slice& blob)
42  : Header(blob.ptr()),
43  m_start()
44 {
46 }
47 
49 {
50 }
51 
52 offline_eformat::v40::ROBFragment& offline_eformat::v40::ROBFragment::operator=
54 {
55  if (this != &other) {
57  m_start=other.m_start;
58  }
59  return *this;
60 }
61 
64 {
67  return *this;
68 }
69 
70 bool
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 
113 bool
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 
156 bool
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 
166 bool
168  const uint16_t rod_version) const
169 {
170  return this->check_impl(version, rod_version, false);
171 }
172 
173 bool
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 {
209  rob_problems(p, version);
210  rod_problems(p, rod_version);
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 
226 {
227  if (n == 0) return m_start;
228  return 0;
229 }
230 
232  const
233 {
234  if (max == 0) return 0;
235  p[0] = m_start;
236  return 1;
237 }
238 
240 {
242 }
243 
245 {
247 }
248 
250 {
252 }
253 
255 {
256  return Header::source_id();
257 }
258 
260 {
261  return m_start;
262 }
263 
265 {
266  return m_start[0];
267 }
268 
270 {
271  return Header::payload_size_word();
272 }
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 
310 {
311  return m_start[7];
312 }
313 
315 {
316  return m_start[8];
317 }
318 
320 {
321  return 1;
322 }
offline_eformat::v40::ROBFragment::child
const uint32_t * child(size_t n) const
Returns the nth child fragment.
Definition: v40_ROBFragment.cxx:225
offline_eformat::v40::ROBFragment::rod_detev_type
uint32_t rod_detev_type() const
Returns the detector event type.
Definition: v40_ROBFragment.cxx:314
offline_eformat::v40::Header::version
uint32_t version() const
Returns the formatting version.
Definition: v40_Header.cxx:57
get_generator_info.result
result
Definition: get_generator_info.py:21
max
#define max(a, b)
Definition: cfImp.cxx:41
offline_eformat::v40::ROBFragment::ROBFragment
ROBFragment()
Builds an empty, otherwise useless ROBFragment.
Definition: v40_ROBFragment.cxx:29
offline_eformat::v40::ROBFragment
Describes how to access the contents of a subdetector fragment, as prescribed by the event format not...
Definition: v40_ROBFragment.h:35
offline_eformat::v40::ROBFragment::rod_lvl1_id
uint32_t rod_lvl1_id() const
Returns the lvl1 identifier.
Definition: v40_ROBFragment.cxx:299
offline_eformat::v40::ROBFragment::check_rob_impl
bool check_rob_impl(const uint16_t version=eformat::MAJOR_V40_VERSION, const bool exc=true) const
Says if the ROB fragment is valid.
Definition: v40_ROBFragment.cxx:71
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
offline_eformat::v40::ROBFragment::rod_run_no
uint32_t rod_run_no() const
Returns the current run number.
Definition: v40_ROBFragment.cxx:294
offline_eformat::v40::Header::payload_size_word
uint32_t payload_size_word(void) const
Returns the payload size.
Definition: v40_Header.cxx:87
offline_eformat::v40::ROBFragment::assign
ROBFragment & assign(const uint32_t *it)
Manual re-assignment.
Definition: v40_ROBFragment.cxx:63
offline_eformat::v40::Header::source_id
uint32_t source_id() const
Returns the full source identifier.
Definition: v40_Header.cxx:62
skel.it
it
Definition: skel.GENtoEVGEN.py:396
offline_eformat::v40::Header::header_size_word
uint32_t header_size_word() const
Returns the size, in words, of the current header.
Definition: v40_Header.cxx:52
offline_eformat::v40::ROBFragment::rod_start
const uint32_t * rod_start() const
Sets the given pointer to the ROD fragment start.
Definition: v40_ROBFragment.cxx:259
offline_eformat::v40::ROBFragment::rod_problems
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.
Definition: v40_ROBFragment.cxx:194
offline_eformat::v40::Header::specific_header
const uint32_t * specific_header() const
Returns an iterator to the start of the specific header part.
Definition: v40_Header.cxx:107
offline_eformat::v40::ROBFragment::children
virtual uint32_t children(const uint32_t **p, size_t max) const
Returns all the children of this fragment.
Definition: v40_ROBFragment.cxx:231
offline_eformat::v40::ROBFragment::rod_lvl1_trigger_type
uint32_t rod_lvl1_trigger_type() const
Returns the lvl1 trigger type.
Definition: v40_ROBFragment.cxx:309
offline_eformat::v40::ROBFragment::check_rod_noex
bool check_rod_noex(const uint16_t rod_version=eformat::MAJOR_V31_VERSION) const
Says if the underlying ROD fragment is valid.
Definition: v40_ROBFragment.cxx:145
offline_eformat::v40::Header
Contains the information on the Header of a fragment as described by the original note.
Definition: v40_Header.h:37
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
offline_eformat::v40::ROBFragment::rod_status_position
uint32_t rod_status_position() const
Returns the status block position.
Definition: v40_ROBFragment.cxx:249
offline_eformat::v40::ROBFragment::nchildren
virtual uint32_t nchildren() const
Returns the number of children available.
Definition: v40_ROBFragment.cxx:319
offline_eformat::v40::ROBFragment::rod_marker
uint32_t rod_marker() const
Returns the fragment type.
Definition: v40_ROBFragment.cxx:264
offline_eformat::v40::ROBFragment::rod_data
const uint32_t * rod_data() const
Returns a pointer to the first data word.
Definition: v40_ROBFragment.cxx:219
python.Include.marker
string marker
Definition: Include.py:21
offline_eformat::v40::ROBFragment::rod_version
uint32_t rod_version() const
Returns the formatting version for the ROD fragment.
Definition: v40_ROBFragment.cxx:284
offline_eformat::v40::ROBFragment::rod_nstatus
uint32_t rod_nstatus() const
Returns the number of status words available.
Definition: v40_ROBFragment.cxx:239
offline_eformat::v40::ROBFragment::check
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.
Definition: v40_ROBFragment.cxx:174
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
beamspotman.n
n
Definition: beamspotman.py:731
offline_eformat::v40::ROBFragment::~ROBFragment
virtual ~ROBFragment()
Destructor virtualisation.
Definition: v40_ROBFragment.cxx:48
offline_eformat::v40::ROBFragment::rod_trailer_size_word
uint32_t rod_trailer_size_word() const
Returns the size, in words, of the trailer.
Definition: v40_ROBFragment.cxx:279
offline_eformat::v40::Header::operator=
Header & operator=(const Header &other)
Assigment operator.
Definition: v40_Header.cxx:34
offline_eformat::v40::ROBFragment::m_start
const uint32_t * m_start
my one-after-the-last word
Definition: v40_ROBFragment.h:313
offline_eformat::v40::ROBFragment::check_rod_impl
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.
Definition: v40_ROBFragment.cxx:114
v40_ROBFragment.h
offline_eformat::v40::ROBFragment::check_noex
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.
Definition: v40_ROBFragment.cxx:167
offline_eformat::v40::Header::marker
uint32_t marker() const
Returns the fragment type.
Definition: v40_Header.cxx:42
offline_eformat::v40::ROBFragment::check_rob_noex
bool check_rob_noex(const uint16_t version=eformat::MAJOR_V40_VERSION) const
Says if the ROB fragment is valid.
Definition: v40_ROBFragment.cxx:102
python.changerun.m_start
m_start
Definition: changerun.py:84
offline_eformat::v40::ROBFragment::rod_header_size_word
uint32_t rod_header_size_word() const
Returns the size, in words, of the current header.
Definition: v40_ROBFragment.cxx:274
offline_eformat::v40::Header::assign
Header & assign(const uint32_t *it)
Reassign this header.
Definition: v40_Header.cxx:117
offline_eformat::v40::ROBFragment::check_rob
bool check_rob(const uint16_t version=eformat::MAJOR_V40_VERSION) const
Says if the ROB fragment is valid.
Definition: v40_ROBFragment.cxx:107
get_generator_info.version
version
Definition: get_generator_info.py:33
offline_eformat::v40::ROBFragment::problems
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.
Definition: v40_ROBFragment.cxx:206
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
offline_eformat::v40::ROBFragment::rod_status
const uint32_t * rod_status() const
Returns the status words, as an iterator to the status words available.
Definition: v40_ROBFragment.cxx:213
offline_eformat::v40::ROBFragment::rod_source_id
uint32_t rod_source_id() const
Returns the source identifier of the ROD fragment.
Definition: v40_ROBFragment.cxx:289
offline_eformat::v40::ROBFragment::check_rod
bool check_rod(const uint16_t rod_version=eformat::MAJOR_V31_VERSION) const
Says if the underlying ROD fragment is valid.
Definition: v40_ROBFragment.cxx:150
offline_eformat::v40::ROBFragment::rob_source_id
uint32_t rob_source_id() const
Gets the source_id of the ROB fragment itself.
Definition: v40_ROBFragment.cxx:254
offline_eformat::v40::ROBFragment::check_impl
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.
Definition: v40_ROBFragment.cxx:157
offline_eformat::v40::ROBFragment::rod_fragment_size_word
uint32_t rod_fragment_size_word() const
Returns the total fragment size.
Definition: v40_ROBFragment.cxx:269
offline_eformat::v40::ROBFragment::rob_problems
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.
Definition: v40_ROBFragment.cxx:181
CaloCondBlobAlgs_fillNoiseFromASCII.blob
blob
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:96
offline_eformat::v40::ROBFragment::rod_bc_id
uint32_t rod_bc_id() const
Returns the bunch crossing identifier.
Definition: v40_ROBFragment.cxx:304
offline_eformat::v40::ROBFragment::rod_ndata
uint32_t rod_ndata() const
Returns the number of data words available.
Definition: v40_ROBFragment.cxx:244
offline_eformat::v40::Header::nstatus
uint32_t nstatus() const
Returns the number of status words available.
Definition: v40_Header.cxx:67