ATLAS Offline Software
Loading...
Searching...
No Matches
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
12
14#include "eformat/HeaderMarker.h"
15#include "eformat/util.h"
16
23
28
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
54
55offline_eformat::v40::FullEventFragment& offline_eformat::v40::FullEventFragment::operator=
57{
58 if (this != &other) {
59 Header::operator=(other);
60 m_start=other.m_start;
61 }
62 return *this;
63}
64
72
74{
75 return m_start + 10;
76}
77
82
87
93
94
95bool
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() +
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
145bool
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() +
209 nstream_tag();
210 if (Header::header_size_word() != calculated)
211 p.push_back(eformat::WRONG_FRAGMENT_SIZE);
212}
213
214void
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
288uint32_t offline_eformat::v40::FullEventFragment::children (const uint32_t** p, size_t max) const
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
299
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
339
344
349
354
#define max(a, b)
Definition cfImp.cxx:41
Describes how to access the contents of an event fragment, as prescribed by the event format note.
FullEventFragment()
Builds an empty, otherwise useless FullEventFragment.
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.
bool check_impl(const uint16_t version=eformat::MAJOR_V40_VERSION, bool exc=true) const
Says if the the fragment is valid.
uint32_t run_type() const
Returns the run type.
bool check_noex(const uint16_t version=eformat::MAJOR_V40_VERSION) const
Says if the the fragment is valid.
uint32_t lvl1_id() const
Returns the lvl1 identifier.
uint32_t nevent_filter_info() const
Returns the number of Event Filter words.
virtual ~FullEventFragment()
Destructor virtualisation.
const uint32_t * stream_tag() const
Returns an iterator to the first of the stream tag words.
uint16_t bc_id() const
Returns the bunch crossing identifier.
uint16_t lumi_block() const
Returns the luminosity block number.
const uint32_t * event_filter_info() const
Returns an iterator to the first of the EF info words.
uint8_t lvl1_trigger_type() const
Returns the lvl1 trigger type.
void problems(std::vector< eformat::FragmentProblem > &p, const uint16_t version=eformat::MAJOR_V40_VERSION) const
Tells which problems the current fragment has.
uint32_t bc_time_seconds() const
Returns amount of seconds since the (unix) origin, for the bunch crossing time.
const uint32_t * child(size_t n) const
Returns the nth child fragment.
uint32_t run_no() const
Returns the run number.
const uint32_t * lvl2_trigger_info() const
Returns an iterator to the first of the LVL2 trigger info words.
uint32_t global_id() const
Returns the global identifier.
uint32_t nstream_tag() const
Returns the number of stream tag words.
uint32_t bc_time_nanoseconds() const
Returns amount of nanoseconds aditionally to the amount of seconds returned by bc_time_seconds,...
uint32_t nlvl1_trigger_info() const
Returns the number of lvl1 trigger info words.
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.
virtual uint32_t nchildren() const
Returns the number of children available.
bool check(const uint16_t version=eformat::MAJOR_V40_VERSION) const
Says if the the fragment is valid.
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.
uint32_t nlvl2_trigger_info() const
Returns the number of lvl2 trigger info words.
FullEventFragment & assign(const uint32_t *it)
Manual re-assignment.
virtual uint32_t children(const uint32_t **p, size_t max) const
Returns all the children of this fragment.
void robs(std::vector< ROBFragment > &robs) const
Retrieves a vector of all ROBs from this fragment.
const uint32_t * lvl1_trigger_info() const
Returns an iterator to the first of the LVL1 trigger info words.
const uint32_t * child_check(size_t n) const
Returns the nth child fragment.
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.
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.
const uint32_t * payload() const
Sets the pointer to where the payload starts.
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...
int r
Definition globals.cxx:22