BOSS 6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
FullEventFragment.h
Go to the documentation of this file.
1//Dear emacs, this is -*- c++ -*-
2
3/**
4 * @file eformat/FullEventFragment.h
5 * @author <a href="mailto:[email protected]">Andre DOS ANJOS</a>
6 * $Author: maqm $
7 * $Revision: 1.2 $
8 * $Date: 2011/02/20 23:38:21 $
9 *
10 * @brief Defines the Event Fragment entity. The definition is based on the
11 * update of ATL-DAQ-98-129, by D.Francis et al.
12 */
13
14#ifndef EFORMAT_FULLEVENTFRAGMENT_H
15#define EFORMAT_FULLEVENTFRAGMENT_H
16
17#include "eformat/Header.h"
21
22namespace eformat {
23
24 /**
25 * Describes how to access the contents of an event fragment, as prescribed
26 * by the event format note.
27 */
28 template <class TPointer>
29 class FullEventFragment : public eformat::Header<TPointer> {
30
31 public: //interface
32
33 /**
34 * To build a fragment given the containing buffer. I need to know
35 * where the fragment starts in order to do that.
36 *
37 * @param it The exact position where this fragment should start.
38 */
39 FullEventFragment (const TPointer& it);
40
41 /**
42 * Builds an empty, otherwise useless FullEventFragment
43 */
44 FullEventFragment () : Header<TPointer>(), m_start() {}
45
46 /**
47 * Copy constructor
48 *
49 * @param other The fragment to be copied
50 */
52 : Header<TPointer>(other), m_start(other.m_start) {}
53
54 /**
55 * Destructor virtualisation
56 */
57 virtual ~FullEventFragment() {}
58
59 /**
60 * Copy operator
61 *
62 * @param other The fragment to be copied
63 */
65 { Header<TPointer>::operator=(other); m_start=other.m_start; return *this; }
66
67 /**
68 * Manual re-assignment
69 *
70 * @param it The position pointing the first word of this fragment
71 */
72 FullEventFragment& assign (const TPointer& it);
73
74 /**
75 * Says if the the fragment is valid. This may throw exceptions.
76 */
77 virtual bool check () const;
78
79 /**
80 * Says if the Fragment and all children are valid.
81 */
82 bool check_tree () const;
83
84 /**
85 * Returns the date, in seconds elapsed since the 1st. January,
86 * 1970. The timezone is fixed to UTC.
87 */
88 inline uint32_t time() const
89 { return m_start[0]; }
90
91 /**
92 * Returns the global identifier
93 */
94 inline uint32_t global_id() const
95 { return m_start[1]; }
96
97 /**
98 * Returns the run number
99 */
100 inline uint32_t run_no() const
101 { return m_start[2]; }
102
103 /**
104 * Returns the lvl1 identifier
105 */
106 inline uint32_t lvl1_id() const
107 { return m_start[3]; }
108
109 /**
110 * Retursn the lvl1 trigger type
111 */
112 inline uint32_t lvl1_trigger_type() const
113 { return m_start[4]; }
114
115 /**
116 * Returns the lvl2 trigger info
117 */
118 inline uint32_t lvl2_trigger_info() const
119 { return m_start[5]; }
120
121 /**
122 * Returns the number of Event Filter words (constant = 4)
123 */
124 inline uint32_t nevent_filter_info () const { return 4; }
125
126 /**
127 * Returns an iterator to the first of the (4) EF words
128 *
129 * @param it An <em>updateable</em> iterator you should provide.
130 */
131 void event_filter_info(TPointer& it) const;
132
133 private: //static stuff
134
135 static const uint32_t NSPECIFIC;
136
137 private: //representation
138
139 TPointer m_start; ///< my start word
140
141 };
142
143}
144
145template <class TPointer>
147
148template <class TPointer>
150 : eformat::Header<TPointer>(it, eformat::FULL_EVENT),
151 m_start()
152{
153 specific_header(m_start);
154}
155
156template <class TPointer> eformat::FullEventFragment<TPointer>&
158{
159 ERS_DEBUG_3("Re-building FullEventFragment from pointer");
161 specific_header(m_start);
162 ERS_DEBUG_1("Initialized header with source identifier = %s",
163 eformat::helper::SourceIdentifier(source_id()).human().c_str());
164 return *this;
165}
166
167template <class TPointer>
169 const
170{
171 it = m_start;
172 it += 6;
173}
174
175template <class TPointer>
177{
178 ERS_DEBUG_2("Checking for consistency of FullEventFragment");
179 eformat::Header<TPointer>::check(); //< first do a generic check
180 if (this->nspecific() != NSPECIFIC) {
181 throw EFORMAT_SIZE_CHECK(NSPECIFIC, this->nspecific());
182 }
183 return true;
184}
185
186template <class TPointer>
188{
189 ERS_DEBUG_2("Checking recursively for consistency of FullEventFragment");
190 check(); // check myself
191 uint32_t total = this->nchildren();
192 for (size_t i=0; i<total; ++i) {
193 TPointer fp;
194 child(fp, i);
196 f.check_tree();
197 }
198 return true;
199}
200
201#endif /* EFORMAT_FULLEVENTFRAGMENT_H */
Defines the constants used by Event Fragments.
Defines the Header entity. The definition is based on the update of ATL-DAQ-98-129,...
When size checks do not match, this exception must be thrown.
#define EFORMAT_SIZE_CHECK(actual, informed)
#define ERS_DEBUG_1(...)
#define ERS_DEBUG_3(...)
#define ERS_DEBUG_2(...)
Defines the subdetector fragment entity. The definition is based on the update of ATL-DAQ-98-129,...
FullEventFragment & operator=(const FullEventFragment &other)
FullEventFragment & assign(const TPointer &it)
FullEventFragment(const FullEventFragment &other)
uint32_t nevent_filter_info() const
uint32_t lvl1_trigger_type() const
virtual bool check() const
void event_filter_info(TPointer &it) const
uint32_t lvl2_trigger_info() const
Header & operator=(const Header &other)
Definition: Header.h:75
Header & assign(const TPointer &it, uint32_t match)
Definition: Header.h:236
void specific_header(TPointer &it) const
Definition: Header.h:172
virtual bool check() const
Definition: Header.h:249
@ FULL_EVENT
Definition: HeaderMarker.h:30