ATLAS Offline Software
v40_FullEventFragment.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
13 #include "v40_FullEventFragment.h"
14 #include "eformat/HeaderMarker.h"
15 #include "eformat/util.h"
16 
18  : Header(it),
19  m_start()
20 {
22 }
23 
25  : Header(), m_start()
26 {
27 }
28 
32 {
33 }
34 
36  (const eformat::helper::u32list& blob)
37  : Header(blob.ptr()),
38  m_start()
39 {
41 }
42 
44  (const eformat::helper::u32slice& blob)
45  : Header(blob.ptr()),
46  m_start()
47 {
49 }
50 
52 {
53 }
54 
55 offline_eformat::v40::FullEventFragment& offline_eformat::v40::FullEventFragment::operator=
57 {
58  if (this != &other) {
60  m_start=other.m_start;
61  }
62  return *this;
63 }
64 
66 (const uint32_t* it)
67 {
70  return *this;
71 }
72 
74 {
75  return m_start + 10;
76 }
77 
79 {
80  return m_start + 11 + nlvl1_trigger_info();
81 }
82 
84 {
85  return m_start + 12 + nlvl1_trigger_info() + nlvl2_trigger_info();
86 }
87 
89 {
90  return m_start + 13 + nlvl1_trigger_info() + nlvl2_trigger_info() +
91  nevent_filter_info();
92 }
93 
94 
95 bool
97 (const uint16_t version,
98  const bool exc)
99  const
100 {
101 
102  bool result = true;
103 
104  //Fragment checking, only this header
105  try{
106  if (Header::marker() != eformat::FULL_EVENT) {
107  throw EFORMAT_WRONG_MARKER(marker(), eformat::FULL_EVENT);
108  }
109 
110  if (Header::version() >> 16 != version) {
111  throw EFORMAT_BAD_VERSION(Header::version() >> 16, version);
112  }
113 
114  uint32_t calculated = 20 + Header::nstatus() +
115  nlvl1_trigger_info() + nlvl2_trigger_info() + nevent_filter_info() +
116  nstream_tag();
117  if (Header::header_size_word() != calculated) {
118  throw EFORMAT_SIZE_CHECK(calculated, Header::header_size_word());
119  }
120  }catch(eformat::WrongMarkerIssue &ex){
121  if(exc) throw ex;
122  result = false;
123  }catch(eformat::BadVersionIssue &ex){
124  if(exc) throw ex;
125  result = false;
126  }catch(eformat::SizeCheckIssue &ex){
127  if(exc) throw ex;
128  result = false;
129  }
130 
131  return result;
132 }
133 
134 
136 {
137  return this->check_impl(version, true);
138 }
139 
141 {
142  return this->check_impl(version, false);
143 }
144 
145 bool
147 (const uint16_t version, const uint16_t rod_version, const bool exc)
148  const
149 {
150 
151  if (!check_impl(version, exc)) return false; // check myself
152  uint32_t total = nchildren();
153  for (size_t i=0; i<total; ++i) {
154  const uint32_t* fp;
155  child(fp, i);
156  ROBFragment f(fp);
157  bool rob_check;
158  try{
159  rob_check = f.check(version, rod_version);
160  }catch(eformat::RODSizeCheckIssue &ex){
161  //In case of a truncated ROD fragment, we ignore and continue
162  //Anyway the ROB is good, hence we can safely navigate the event
163  continue;
164  }catch(eformat::WrongMarkerIssue &ex){
165  if(exc) throw ex;
166  rob_check = false;
167  }catch(eformat::BadVersionIssue &ex){
168  if(exc) throw ex;
169  rob_check = false;
170  }catch(eformat::SizeCheckIssue &ex){
171  if(exc) throw ex;
172  rob_check = false;
173  }catch(eformat::BadRodVersionIssue &ex){
174  if(exc) throw ex;
175  rob_check = false;
176  }catch(eformat::Issue &ex){
177  if(exc) throw ex;
178  rob_check = false;
179  }
180 
181  if (!rob_check) return false;
182  }
183  return true;
184 }
185 
187  const uint16_t rod_version)
188  const
189 {
190  return this->check_tree_impl(version, rod_version, true);
191 }
192 
194  const uint16_t rod_version)
195  const
196 {
197  return this->check_tree_impl(version, rod_version, false);
198 }
199 
201  (std::vector<eformat::FragmentProblem>& p, const uint16_t version) const {
202  //Fragment checking, only this header
203  if (Header::marker() != eformat::FULL_EVENT)
204  p.push_back(eformat::WRONG_MARKER);
205  if ( Header::version() >> 16 != version )
206  p.push_back(eformat::UNSUPPORTED_VERSION);
207  uint32_t calculated = 20 + Header::nstatus() +
208  nlvl1_trigger_info() + nlvl2_trigger_info() + nevent_filter_info() +
209  nstream_tag();
210  if (Header::header_size_word() != calculated)
211  p.push_back(eformat::WRONG_FRAGMENT_SIZE);
212 }
213 
214 void
216 (std::vector<eformat::helper::ProblemContainer>& p,
217  const uint16_t version,
218  const uint16_t rod_version)
219  const
220 {
221  std::vector<eformat::FragmentProblem> tmp;
222  this->problems(tmp, version);
223 
224  if (!tmp.empty()){
225  eformat::helper::ProblemContainer pc(this->source_id(), tmp);
226  p.push_back(pc);
227  return;
228  }
229 
230  uint32_t total = this->nchildren();
231  for (size_t i=0; i<total; ++i) {
232  const uint32_t* fp;
233  child(fp, i);
234  ROBFragment f(fp);
235  std::vector<eformat::FragmentProblem> tmp;
236  f.problems(tmp, version, rod_version);
237  eformat::helper::ProblemContainer pc(f.source_id(), tmp);
238  p.push_back(pc);
239  }
240 }
241 
243 (std::vector<ROBFragment>& r) const
244 {
245  uint32_t total = nchildren();
246  r.reserve(total);
247  for (size_t i=0; i<total; ++i) {
248  const uint32_t* fp;
249  child(fp, i);
250  r.push_back(fp);
251  }
252 }
253 
255 (std::vector<ROBFragment>& good,
256  std::vector<ROBFragment>& bad,
257  const uint16_t version, const uint16_t rod_version) const
258 {
259  uint32_t total = nchildren();
260  for (size_t i=0; i<total; ++i) {
261  const uint32_t* fp;
262  child(fp, i);
263  ROBFragment f(fp);
264  if (f.check_noex(version, rod_version)) good.push_back(f);
265  else bad.push_back(f);
266  }
267 }
268 
270 {
271  return children(0,0);
272 }
273 
275 {
276  const uint32_t* next = Header::payload();
277  for (size_t i=0; i<n; ++i) next += next[1];
278  return next;
279 }
280 
282 {
283  uint32_t total = nchildren();
284  if (n >= total) throw EFORMAT_NO_SUCH_CHILD(n, total);
285  return child(n);
286 }
287 
289 {
290  const uint32_t* payload_start;
291  Header::payload(payload_start);
292  return find_fragments(child_marker(static_cast<eformat::HeaderMarker>(Header::marker())), payload_start, Header::payload_size_word(), p, max);
293 }
294 
296 {
297  return m_start[0];
298 }
299 
301 {
302  return m_start[1];
303 }
304 
306 {
307  return m_start[2];
308 }
309 
311 {
312  return m_start[3];
313 }
314 
316 {
317  return m_start[4];
318 }
319 
321 {
322  return m_start[5];
323 }
324 
326 {
327  return m_start[6];
328 }
329 
331 {
332  return m_start[7];
333 }
334 
336 {
337  return m_start[8];
338 }
339 
341 {
342  return m_start[9];
343 }
344 
346 {
347  return m_start[10+nlvl1_trigger_info()];
348 }
349 
351 {
352  return m_start[11+nlvl1_trigger_info()+nlvl2_trigger_info()];
353 }
354 
356 {
357  return m_start[12+nlvl1_trigger_info() +
358  nlvl2_trigger_info() + nevent_filter_info()];
359 }
bad
@ bad
Definition: SUSYToolsTester.cxx:95
beamspotman.r
def r
Definition: beamspotman.py:676
offline_eformat::v40::FullEventFragment::~FullEventFragment
virtual ~FullEventFragment()
Destructor virtualisation.
Definition: v40_FullEventFragment.cxx:51
offline_eformat::v40::FullEventFragment::check_tree
bool check_tree(const uint16_t version=eformat::MAJOR_V40_VERSION, const uint16_t rod_version=eformat::MAJOR_V31_VERSION) const
Says if the Fragment and all children are valid.
Definition: v40_FullEventFragment.cxx:186
offline_eformat::v40::FullEventFragment::robs
void robs(std::vector< ROBFragment > &robs) const
Retrieves a vector of all ROBs from this fragment.
Definition: v40_FullEventFragment.cxx:243
python.CaloRecoConfig.f
f
Definition: CaloRecoConfig.py:127
offline_eformat::v40::FullEventFragment::problems_tree
void problems_tree(std::vector< eformat::helper::ProblemContainer > &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 and all the children have.
Definition: v40_FullEventFragment.cxx:216
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
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
max
#define max(a, b)
Definition: cfImp.cxx:41
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
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:575
offline_eformat::v40::FullEventFragment::assign
FullEventFragment & assign(const uint32_t *it)
Manual re-assignment.
Definition: v40_FullEventFragment.cxx:66
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
offline_eformat::v40::FullEventFragment::child
const uint32_t * child(size_t n) const
Returns the nth child fragment.
Definition: v40_FullEventFragment.cxx:274
offline_eformat::v40::FullEventFragment::check_tree_noex
bool check_tree_noex(const uint16_t version=eformat::MAJOR_V40_VERSION, const uint16_t rod_version=eformat::MAJOR_V31_VERSION) const
Says if the Fragment, all children and all RODs are valid, without throwing exceptions.
Definition: v40_FullEventFragment.cxx:193
Issue
Configuration Issue
Definition: PscIssues.h:31
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::FullEventFragment::lvl2_trigger_info
const uint32_t * lvl2_trigger_info() const
Returns an iterator to the first of the LVL2 trigger info words.
Definition: v40_FullEventFragment.cxx:78
skel.it
it
Definition: skel.GENtoEVGEN.py:423
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::FullEventFragment::FullEventFragment
FullEventFragment()
Builds an empty, otherwise useless FullEventFragment.
Definition: v40_FullEventFragment.cxx:24
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::FullEventFragment::check_tree_impl
bool check_tree_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 and all children are valid.
Definition: v40_FullEventFragment.cxx:147
offline_eformat::v40::Header
Contains the information on the Header of a fragment as described by the original note.
Definition: v40_Header.h:37
offline_eformat::v40::FullEventFragment::nstream_tag
uint32_t nstream_tag() const
Returns the number of stream tag words.
Definition: v40_FullEventFragment.cxx:355
python.Include.marker
string marker
Definition: Include.py:21
offline_eformat::v40::FullEventFragment::run_no
uint32_t run_no() const
Returns the run number.
Definition: v40_FullEventFragment.cxx:315
v40_FullEventFragment.h
offline_eformat::v40::FullEventFragment::m_start
const uint32_t * m_start
my start word
Definition: v40_FullEventFragment.h:313
offline_eformat::v40::FullEventFragment::nevent_filter_info
uint32_t nevent_filter_info() const
Returns the number of Event Filter words.
Definition: v40_FullEventFragment.cxx:350
offline_eformat::v40::Header::payload
const uint32_t * payload() const
Sets the pointer to where the payload starts.
Definition: v40_Header.cxx:77
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
fillPileUpNoiseLumi.next
next
Definition: fillPileUpNoiseLumi.py:52
lumiFormat.i
int i
Definition: lumiFormat.py:92
offline_eformat::v40::FullEventFragment::problems
void problems(std::vector< eformat::FragmentProblem > &p, const uint16_t version=eformat::MAJOR_V40_VERSION) const
Tells which problems the current fragment has.
Definition: v40_FullEventFragment.cxx:201
trigmenu_modify_prescale_json.fp
fp
Definition: trigmenu_modify_prescale_json.py:53
offline_eformat::v40::FullEventFragment::check_noex
bool check_noex(const uint16_t version=eformat::MAJOR_V40_VERSION) const
Says if the the fragment is valid.
Definition: v40_FullEventFragment.cxx:140
offline_eformat::v40::FullEventFragment::global_id
uint32_t global_id() const
Returns the global identifier.
Definition: v40_FullEventFragment.cxx:305
beamspotman.n
n
Definition: beamspotman.py:731
offline_eformat::v40::Header::operator=
Header & operator=(const Header &other)
Assigment operator.
Definition: v40_Header.cxx:34
offline_eformat::v40::FullEventFragment::lvl1_trigger_type
uint8_t lvl1_trigger_type() const
Returns the lvl1 trigger type.
Definition: v40_FullEventFragment.cxx:335
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
offline_eformat::v40::FullEventFragment::bc_time_seconds
uint32_t bc_time_seconds() const
Returns amount of seconds since the (unix) origin, for the bunch crossing time.
Definition: v40_FullEventFragment.cxx:295
offline_eformat::v40::FullEventFragment::nchildren
virtual uint32_t nchildren() const
Returns the number of children available.
Definition: v40_FullEventFragment.cxx:269
offline_eformat::v40::FullEventFragment::check_impl
bool check_impl(const uint16_t version=eformat::MAJOR_V40_VERSION, bool exc=true) const
Says if the the fragment is valid.
Definition: v40_FullEventFragment.cxx:97
offline_eformat::v40::FullEventFragment::nlvl1_trigger_info
uint32_t nlvl1_trigger_info() const
Returns the number of lvl1 trigger info words.
Definition: v40_FullEventFragment.cxx:340
offline_eformat::v40::FullEventFragment::check
bool check(const uint16_t version=eformat::MAJOR_V40_VERSION) const
Says if the the fragment is valid.
Definition: v40_FullEventFragment.cxx:135
offline_eformat::v40::FullEventFragment::bc_id
uint16_t bc_id() const
Returns the bunch crossing identifier.
Definition: v40_FullEventFragment.cxx:330
offline_eformat::v40::Header::marker
uint32_t marker() const
Returns the fragment type.
Definition: v40_Header.cxx:42
offline_eformat::v40::FullEventFragment::nlvl2_trigger_info
uint32_t nlvl2_trigger_info() const
Returns the number of lvl2 trigger info words.
Definition: v40_FullEventFragment.cxx:345
python.changerun.m_start
m_start
Definition: changerun.py:84
offline_eformat::v40::Header::assign
Header & assign(const uint32_t *it)
Reassign this header.
Definition: v40_Header.cxx:117
get_generator_info.version
version
Definition: get_generator_info.py:33
ReadBchFromCool.good
good
Definition: ReadBchFromCool.py:433
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
offline_eformat::v40::FullEventFragment::bc_time_nanoseconds
uint32_t bc_time_nanoseconds() const
Returns amount of nanoseconds aditionally to the amount of seconds returned by bc_time_seconds,...
Definition: v40_FullEventFragment.cxx:300
offline_eformat::v40::FullEventFragment::run_type
uint32_t run_type() const
Returns the run type.
Definition: v40_FullEventFragment.cxx:310
python.DecayParser.children
children
Definition: DecayParser.py:32
offline_eformat::v40::FullEventFragment::children
virtual uint32_t children(const uint32_t **p, size_t max) const
Returns all the children of this fragment.
Definition: v40_FullEventFragment.cxx:288
offline_eformat::v40::FullEventFragment::child_check
const uint32_t * child_check(size_t n) const
Returns the nth child fragment.
Definition: v40_FullEventFragment.cxx:281
offline_eformat::v40::FullEventFragment
Describes how to access the contents of an event fragment, as prescribed by the event format note.
Definition: v40_FullEventFragment.h:35
offline_eformat::v40::FullEventFragment::event_filter_info
const uint32_t * event_filter_info() const
Returns an iterator to the first of the EF info words.
Definition: v40_FullEventFragment.cxx:83
offline_eformat::v40::FullEventFragment::lvl1_trigger_info
const uint32_t * lvl1_trigger_info() const
Returns an iterator to the first of the LVL1 trigger info words.
Definition: v40_FullEventFragment.cxx:73
python.SystemOfUnits.pc
float pc
Definition: SystemOfUnits.py:99
offline_eformat::v40::FullEventFragment::lumi_block
uint16_t lumi_block() const
Returns the luminosity block number.
Definition: v40_FullEventFragment.cxx:320
CaloCondBlobAlgs_fillNoiseFromASCII.blob
blob
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:96
offline_eformat::v40::FullEventFragment::lvl1_id
uint32_t lvl1_id() const
Returns the lvl1 identifier.
Definition: v40_FullEventFragment.cxx:325
offline_eformat::v40::Header::nstatus
uint32_t nstatus() const
Returns the number of status words available.
Definition: v40_Header.cxx:67
offline_eformat::v40::FullEventFragment::stream_tag
const uint32_t * stream_tag() const
Returns an iterator to the first of the stream tag words.
Definition: v40_FullEventFragment.cxx:88