BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
write/ROBFragment.h
Go to the documentation of this file.
1//Dear emacs, this is -*- c++ -*-
2
3/**
4 * @file eformat/write/ROBFragment.h
5 * @author <a href="mailto:[email protected]">Andre DOS ANJOS</a>
6 * $Author: zhangy $
7 * $Revision: 1.1.1.1 $
8 * $Date: 2009/06/19 07:35:41 $
9 *
10 * @brief Helps the user to define and build a ROB fragment.
11 */
12
13#ifndef EFORMAT_WRITE_ROBFRAGMENT_H
14#define EFORMAT_WRITE_ROBFRAGMENT_H
15
16#include "eformat/write/node.h"
17#include "eformat/Version.h"
18
19namespace eformat {
20
21 namespace write {
22
23 class ROSFragment; ///< forward
24
25 /**
26 * Defines a helper class to aid the creation of ROB fragments.
27 */
29
30 public:
31
32 /**
33 * Builds a new ROB fragment from scratch
34 *
35 * @param source_id The source identifier to be using for this ROB
36 * @param run_no The run number for this ROB/ROD
37 * @param lvl1_id The LVL1 identifier for this ROB/ROD
38 * @param bc_id The bunch crossing identifier for this ROB/ROD
39 * @param lvl1_type The LVL1 trigger type identifier for this ROB/ROD
40 * @param detev_type The detector event type for this ROB/ROD
41 * @param ndata The number of 32-bits pointed by "data" bellow
42 * @param data A set of 32-bit words that consist the data block of
43 * this ROB fragment
44 * @param status_position The status block position you want to have on
45 * the ROD format. Use the definitions available in Status.h to
46 * get generic identifiers for the possibilities.
47 */
48 ROBFragment (uint32_t source_id,
49 uint32_t run_no,
50 uint32_t lvl1_id,
51 uint32_t bc_id,
52 uint32_t lvl1_type,
53 uint32_t detev_type,
54 uint32_t ndata,
55 const uint32_t* data,
56 uint32_t status_position);
57
58 /**
59 * Builds a new "empty" ROB fragment, otherwise invalid. Use the methods
60 * bellow to set its fields. This is useful to pre-allocate objects of
61 * this class in the stack and later use them by assigment. Another
62 * option are standard containers, that demand the contained classes to
63 * have this method.
64 */
65 ROBFragment ();
66
67 /**
68 * Copy constructor. This will perform a shallow copy of the fragment. In
69 * this case, the data and status blocks are not copied, only the meta
70 * information, i.e., @b all but the payload of the underlying ROD
71 * fragment and non-variable data blocks are copied. If you wish to have
72 * the data/status copied, you have to copy it manually yourself and set
73 * the data pointer with the rod_data() and status() and rod_status()
74 * methods. The parent fragment remains unset, and you have to append
75 * this fragment manually after creation. Binding also doesn't take
76 * place.
77 *
78 * @param other The other fragment to copy the meta data from.
79 */
80 ROBFragment (const ROBFragment& other);
81
82 /**
83 * Builds a new ROB fragment from scratch, starting from an existing ROD
84 * fragment as basis.
85 *
86 * @param rod The rod fragment you want to start with, in a contiguous
87 * block of memory
88 * @param size_word The size of the ROD fragment, in words
89 */
90 ROBFragment (uint32_t* rod, uint32_t size_word);
91
92 /**
93 * Builds a new ROB fragment from an existing ROB fragment in contiguous
94 * memory
95 *
96 * @warning You cannot build from non-contiguous memory. If you have that
97 * requirement, please post it to the eformat developers.
98 *
99 * @param rob The ROB fragment you want to start with, in a contiguous
100 * block of memory
101 */
102 ROBFragment (uint32_t* rob);
103
104 /**
105 * Base destructor
106 */
107 virtual ~ROBFragment () {}
108
109 /**
110 * Assignment operator. This will perform a shallow copy of the
111 * fragment. In this case, the data and status blocks are not copied,
112 * only the meta information, i.e., @b all but the payload of the
113 * underlying ROD fragment and non-variable data blocks are copied. If
114 * you wish to have the data/status copied, you have to copy it manually
115 * yourself and set the data pointer with the rod_data() and status() and
116 * rod_status() methods. The parent fragment is @b not changed in this
117 * operation. Previous binding operations remain valid after assignment.
118 *
119 * @param other The other fragment to copy the meta data from.
120 */
121 ROBFragment& operator= (const ROBFragment& other);
122
123 /**
124 * Changes the number of status words and the status words themselves
125 * from the fragment
126 *
127 * @param n How many status words the underlying ROD fragment supposed
128 * to have.
129 * @param status A pointer to <tt>n</tt> pre-allocated words
130 */
131 void status (uint32_t n, const uint32_t* status);
132
133 /**
134 * Returns the number of status wors in this fragment
135 */
136 inline uint32_t nstatus (void) const { return m_node[0].base[5]; }
137
138 /**
139 * Returns a pointer to the first status word to be used by this fragment
140 */
141 inline const uint32_t* status (void) const { return m_node[1].base; }
142
143 /**
144 * Changes the minor version number of the fragment
145 *
146 * @param v The new minor version for this header
147 */
148 inline void minor_version (uint16_t v)
149 { m_node[0].base[3] = eformat::DEFAULT_VERSION | v; }
150
151 /**
152 * Returns the minor version number of the fragment
153 */
154 inline uint16_t minor_version (void) const
155 { return 0xffff & m_node[0].base[3]; }
156
157 /**
158 * Changes the number of status words and the status words themselves
159 * from the ROD fragment
160 *
161 * @param n How many status words the underlying ROD fragment supposed to
162 * have
163 * @param status A pointer to <tt>n</tt> pre-allocated words
164 */
165 void rod_status (uint32_t n, const uint32_t* status);
166
167 /**
168 * Returns the number of status wors in this fragment
169 */
170 inline uint32_t rod_nstatus (void) const { return m_node[6].base[0]; }
171
172 /**
173 * Returns a pointer to the first ROD status word to be used by this
174 * fragment
175 */
176 inline const uint32_t* rod_status (void) const { return m_node[4].base; }
177
178 /**
179 * Changes the order of the status and data blocks in the ROD fragment
180 *
181 * @param s The new value. If v is zero, the status will preceed the
182 * data, while the contrary will happen if v equals 1.
183 */
184 void status_position (uint32_t v);
185
186 /**
187 * Returns the current status position
188 */
189 inline uint32_t status_position (void) const
190 { return m_node[6].base[2]; }
191
192 /**
193 * Changes the minor version number of the underlying ROD fragment
194 *
195 * @param v The new minor version for this header
196 */
197 inline void rod_minor_version (uint16_t v)
198 { m_node[3].base[2] = eformat::DEFAULT_VERSION | v; }
199
200 /**
201 * Changes the number of data words and the data words themselves
202 * from the ROD fragment
203 *
204 * @param n How many data words the underlying ROD fragment supposed to
205 * have
206 * @param status A pointer to <tt>n</tt> pre-allocated words
207 */
208 void rod_data (uint32_t n, const uint32_t* data);
209
210 /**
211 * Returns the number of data words at the ROD fragment
212 */
213 inline uint32_t rod_ndata (void) const { return m_node[6].base[1]; }
214
215 /**
216 * Returns a pointer to the first of the data words at the ROD fragment
217 */
218 inline const uint32_t* rod_data (void) const { return m_node[5].base; }
219
220 /**
221 * Changes the source identifier for both the ROB and the ROD fragments
222 *
223 * @param s The new value to set
224 */
225 inline void source_id (uint32_t s)
226 { m_node[0].base[4] = m_node[3].base[3] = s; }
227
228 /**
229 * Returns the source identifier for both the ROB and the ROD fragments
230 */
231 inline uint32_t source_id (void) const
232 { return m_node[0].base[4]; }
233
234 /**
235 * Changes the run number for the ROD fragment
236 *
237 * @param s The new value to set
238 */
239 inline void rod_run_no (uint32_t s)
240 { m_node[3].base[4] = s; }
241
242 /**
243 * Returns the run number for the ROD fragment
244 */
245 inline uint32_t rod_run_no (void) const
246 { return m_node[3].base[4]; }
247
248 /**
249 * Changes the lvl1 identifier in the ROD fragment
250 *
251 * @param s The new value to set
252 */
253 inline void rod_lvl1_id (uint32_t s)
254 { m_node[3].base[5] = s; }
255
256 /**
257 * Returns the lvl1 identifier for the ROD fragment
258 */
259 inline uint32_t rod_lvl1_id (void) const
260 { return m_node[3].base[5]; }
261
262 /**
263 * Changes the bunch crossing identifier in the ROD fragment
264 *
265 * @param s The new value to set
266 */
267 inline void rod_bc_id (uint32_t s)
268 { m_node[3].base[6] = s; }
269
270 /**
271 * Returns the bunch crossing identifier for the ROD fragment
272 */
273 inline uint32_t rod_bc_id (void) const
274 { return m_node[3].base[6]; }
275
276 /**
277 * Changes the lvl1 trigger type in the ROD fragment
278 *
279 * @param s The new value to set
280 */
281 inline void rod_lvl1_type (uint32_t s)
282 { m_node[3].base[7] = s; }
283
284 /**
285 * Returns the lvl1 event type identifier for the ROD fragment
286 */
287 inline uint32_t rod_lvl1_type (void) const
288 { return m_node[3].base[7]; }
289
290 /**
291 * Changes the detector event type in the ROD fragment
292 *
293 * @param s The new value to set
294 */
295 inline void rod_detev_type (uint32_t s)
296 { m_node[3].base[8] = s; }
297
298 /**
299 * Returns the detector event type identifier for the ROD fragment
300 */
301 inline uint32_t rod_detev_type (void) const
302 { return m_node[3].base[8]; }
303
304 /**
305 * Returns the total size for the meta data (everything that does @b not
306 * encompass the contents of the m_data pointer in the private
307 * representation of this class) in the fragment, in words
308 */
309 inline uint32_t meta_size_word (void) const
310 { return 7 + m_node[0].base[5] + 12 + m_node[6].base[0]; }
311
312 /**
313 * Returns the total size for this fragment, in words
314 */
315 inline uint32_t size_word (void) const
316 { return meta_size_word() + m_node[6].base[1]; }
317
318 /**
319 * Returns the number of pages of memory I have
320 */
321 inline uint32_t page_count (void) const { return 7; }
322
323 /**
324 * Outputs a concatenation of eformat::write::node making up a list with
325 * the contents of this ROB fragment.
326 */
327 inline const eformat::write::node_t* bind (void) const
328 { return m_node; }
329
330 /**
331 * This sets the parent fragment
332 *
333 * @param ros The ROS parent fragment of this ROB/ROD
334 */
336 { m_parent = ros; }
337
338 /**
339 * This returns the parent fragment
340 */
341 inline const ROSFragment* parent (void) const { return m_parent; }
342
343 /**
344 * Sets the next sibling
345 *
346 * @param n The sibling following this fragment
347 */
348 inline void next (const ROBFragment* n) { m_next = n; }
349
350 /**
351 * Returns the next sibling
352 */
353 inline const ROBFragment* next (void) const { return m_next; }
354
355 private: //representation
356
357 uint32_t m_header[7]; ///< The ROB Header
358 uint32_t m_rod_header[9]; ///< The ROD Header
359 uint32_t m_rod_trailer[3]; ///< The ROD trailer
360 eformat::write::node_t m_node[7]; ///< Node representation
361 eformat::write::ROSFragment* m_parent; ///< My parent
362 const eformat::write::ROBFragment* m_next; ///< Next sibling
363
364 };
365
366 }
367
368}
369
370#endif /* EFORMAT_WRITE_ROBFRAGMENT_H */
const Int_t n
TTree * data
XmlRpcServer s
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition KarLud.h:35
Defines a helper class to encode and decode version numbers.
uint32_t rod_run_no(void) const
uint32_t page_count(void) const
uint32_t rod_ndata(void) const
const uint32_t * rod_data(void) const
const ROSFragment * parent(void) const
uint32_t rod_lvl1_id(void) const
uint32_t rod_nstatus(void) const
void next(const ROBFragment *n)
const uint32_t * rod_status(void) const
uint32_t source_id(void) const
ROBFragment & operator=(const ROBFragment &other)
uint16_t minor_version(void) const
uint32_t meta_size_word(void) const
const uint32_t * status(void) const
uint32_t size_word(void) const
uint32_t rod_bc_id(void) const
void parent(eformat::write::ROSFragment *ros)
uint32_t rod_lvl1_type(void) const
uint32_t rod_detev_type(void) const
const ROBFragment * next(void) const
uint32_t status_position(void) const
const eformat::write::node_t * bind(void) const
const uint32_t DEFAULT_VERSION
Definition Version.h:24
uint32_t * base
The base address for this page.
Definition node.h:27