BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
write/FullEventFragment.h
Go to the documentation of this file.
1//Dear emacs, this is -*- c++ -*-
2
3/**
4 * @file eformat/write/FullEventFragment.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 FullEvent fragment.
11 */
12
13#ifndef EFORMAT_WRITE_FULLEVENTFRAGMENT_H
14#define EFORMAT_WRITE_FULLEVENTFRAGMENT_H
15
17#include <cstring>
18
19namespace eformat {
20
21 namespace write {
22
23 /**
24 * Defines a helper class to aid the creation of FullEvent fragments.
25 */
27
28 public:
29
30 /**
31 * Builds a new FullEvent fragment from scratch, using the current time
32 * as the time label.
33 *
34 * @param source_id The source identifier to be using for this
35 * FullEvent
36 * @param global_id The global identifier for this fragment
37 * @param run_no The run number for this fragment
38 * @param lvl1_id The LVL1 trigger identifier for this fragment
39 * @param lvl1_type The LVL1 trigger type for this fragment
40 * @param lvl2_info The LVL2 trigger info for this fragment
41 * @parma ef_info The Event Filter info for this fragment: a pointer to 4
42 * pre-allocated words.
43 */
45 uint32_t global_id, uint32_t run_no,
46 uint32_t lvl1_id, uint32_t lvl1_type,
47 uint32_t lvl2_info, const uint32_t* ef_info);
48
49 /**
50 * Builds a new FullEvent fragment from scratch
51 *
52 * @param source_id The source identifier to be using for this
53 * FullEvent
54 * @param use_time The creation time in seconds since 1/1/1970 00:00 UTC
55 * for this fragment
56 * @param global_id The global identifier for this fragment
57 * @param run_no The run number for this fragment
58 * @param lvl1_id The LVL1 trigger identifier for this fragment
59 * @param lvl1_type The LVL1 trigger type for this fragment
60 * @param lvl2_info The LVL2 trigger info for this fragment
61 * @parma ef_info The Event Filter info for this fragment: a pointer to 4
62 * pre-allocated words.
63 */
64 FullEventFragment (uint32_t source_id, uint32_t use_time,
65 uint32_t global_id, uint32_t run_no,
66 uint32_t lvl1_id, uint32_t lvl1_type,
67 uint32_t lvl2_info, const uint32_t* ef_info);
68
69 /**
70 * Builds a new FullEvent fragment from an existing
71 * FullEvent fragment in contiguous memory.
72 *
73 * @param fe The existing FullEvent fragment
74 */
75 FullEventFragment (uint32_t* fe);
76
77 /**
78 * Builds a new FullEvent fragment from an existing FullEvent
79 * fragment in non-contiguous memory. The top-level fragment header is
80 * expected to be on a contiguous area of memory, together with the first
81 * word of the first child fragment (i.e. the ROS header marker). The
82 * following data can be spread around.
83 *
84 * @param fe The existing FullEvent fragment, as a list of nodes,
85 * pre-concatenated by the caller.
86 */
88
89 /**
90 * Builds a new empty FullEventFragment, otherwise invalid. This is
91 * useful for array builds and standard containers.
92 */
94
95 /**
96 * Copy constructor. This will only copy the meta data, not the fragment
97 * relationships and block-data (children and status block) contained in
98 * the to-be-copied fragment. If you wish this fragment has the same
99 * children of the copied fragment, you have to do this operation
100 * manually, after copying. If you wish to make a copy of the status as
101 * well, do it manually and then assign it to this fragment using the
102 * status() method.
103 *
104 * @param other The other fragment to take the meta data from.
105 */
107
108 /**
109 * Base destructor
110 */
111 virtual ~FullEventFragment () {}
112
113 /**
114 * Assigment operator. This will only copy the meta data, not the
115 * fragment relationships and block-data (children and parent and status
116 * block) contained in the to-be-copied fragment. If you wish this
117 * fragment has the same parents, and children of the copied fragment,
118 * you have to do this operation manually, after copying. If you wish to
119 * make a copy of the status as well, do it manually and then assign it
120 * to this fragment using the status() method.
121 *
122 * @param other The other fragment to take the meta data from.
123 */
125
126 /**
127 * Changes the number of status words and the status words themselves
128 * from the fragment
129 *
130 * @param n How many status words the underlying FullEventFragment
131 * fragment supposed to have.
132 * @param status A pointer to <tt>n</tt> pre-allocated words
133 */
134 void status (uint32_t n, const uint32_t* status);
135
136 /**
137 * Returns the number of status wors in this fragment
138 */
139 inline uint32_t nstatus (void) const { return m_node[0].base[5]; }
140
141 /**
142 * Returns a pointer to the first status word to be used by this fragment
143 */
144 inline const uint32_t* status (void) const { return m_node[1].base; }
145
146 /**
147 * Changes the minor version number of the fragment
148 *
149 * @param v The new minor version for this header
150 */
151 inline void minor_version (uint16_t v)
152 { m_node[0].base[3] = eformat::DEFAULT_VERSION | v; }
153
154 /**
155 * Returns the minor version number of the fragment
156 */
157 inline uint16_t minor_version (void) const
158 { return 0xffff & m_node[0].base[3]; }
159
160 /**
161 * Changes the source identifier for this fragment
162 *
163 * @param s The new value to set
164 */
165 inline void source_id (uint32_t s)
166 { m_node[0].base[4] = s; }
167
168 /**
169 * Returns the source identifier of this fragment
170 */
171 inline uint32_t source_id (void) const
172 { return m_node[0].base[4]; }
173
174 /**
175 * Changes the time this fragment was produced at
176 *
177 * @param s The new value to set
178 */
179 inline void time (uint32_t s)
180 { m_node[2].base[1] = s; }
181
182 /**
183 * Returns the time for this fragment
184 */
185 inline uint32_t time (void) const
186 { return m_node[2].base[1]; }
187
188 /**
189 * Changes the global identifier for this event
190 *
191 * @param s The new value to set
192 */
193 inline void global_id (uint32_t s)
194 { m_node[2].base[2] = s; }
195
196 /**
197 * Returns the global identifier for this event
198 */
199 inline uint32_t global_id (void) const
200 { return m_node[2].base[2]; }
201
202 /**
203 * Changes the run number
204 *
205 * @param s The new value to set
206 */
207 inline void run_no (uint32_t s)
208 { m_node[2].base[3] = s; }
209
210 /**
211 * Returns the run number for this fragment
212 */
213 inline uint32_t run_no (void) const
214 { return m_node[2].base[3]; }
215
216 /**
217 * Changes the lvl1 identifier in this fragment
218 *
219 * @param s The new value to set
220 */
221 inline void lvl1_id (uint32_t s)
222 { m_node[2].base[4] = s; }
223
224 /**
225 * Returns the lvl1 identifier for this fragment
226 */
227 inline uint32_t lvl1_id (void) const
228 { return m_node[2].base[4]; }
229
230 /**
231 * Changes the lvl1 trigger type in this fragment
232 *
233 * @param s The new value to set
234 */
235 inline void lvl1_trigger_type (uint32_t s)
236 { m_node[2].base[5] = s; }
237
238 /**
239 * Returns the lvl1 trigger type for this fragment
240 */
241 inline uint32_t lvl1_trigger_type (void) const
242 { return m_node[2].base[5]; }
243
244 /**
245 * Changes the lvl2 trigger info in this fragment
246 *
247 * @param s The new value to set
248 */
249 inline void lvl2_trigger_info (uint32_t s)
250 { m_node[2].base[6] = s; }
251
252 /**
253 * Returns the lvl2 trigger info for this fragment
254 */
255 inline uint32_t lvl2_trigger_info (void) const
256 { return m_node[2].base[6]; }
257
258 /**
259 * Changes the event filter trigger info in this fragment
260 *
261 * @param s The new value to set: a pointer with 4 word pre-allocated
262 */
263 inline void event_filter_info (const uint32_t* s)
264 { memcpy(&m_node[2].base[7], s, 4*sizeof(uint32_t)); }
265
266 /**
267 * Returns the event filter trigger info for this fragment
268 */
269 inline const uint32_t* event_filter_info (void) const
270 { return &m_node[2].base[7]; }
271
272 /**
273 * Returns the total size for the meta data (everything that does @b not
274 * encompass the contents of the m_data pointer in the private
275 * representation of this class) in the fragment, in words
276 */
277 inline uint32_t meta_size_word (void) const
278 { return m_node[0].base[2]; }
279
280 /**
281 * Returns the total size for this fragment, in words
282 */
283 inline uint32_t size_word (void) const
284 { return m_node[0].base[1]; }
285
286 /**
287 * Appends a new SubDetector fragment to this FullEvent fragment.
288 *
289 * @warning This will change the page structure of the last ROS fragment
290 * inserted here, in order to concatenate the ROS fragments
291 * together. Please note that this operation is not compatible with
292 * multiple threads of operation, if you would like to share
293 * eformat::write::Fragment's between threads. A better strategy would
294 * be create, for every thread of operation, a proper ROSFragment
295 * instead.
296 *
297 * @param sd The SubDetector fragment to be appended to myself
298 */
300
301 /**
302 * This returns the first child of this fragment. The system operates as
303 * a concatenated list of fragments. From this child you can get to the
304 * next.
305 */
306 inline const SubDetectorFragment* first_child (void) const
307 { return m_child; }
308
309 /**
310 * This method is used by children of this fragment to notify fragment
311 * size changes.
312 *
313 * @param o The old size, in 32-bit words
314 * @param n The new size, in 32-bit words
315 */
316 inline void size_change (uint32_t o, uint32_t n)
317 { m_node[0].base[1] -= o; m_node[0].base[1] += n; }
318
319 /**
320 * Returns the total number of (raw memory) pages this fragment is
321 * composed of.
322 *
323 * @warning This operation navigates at a potentially large list of child
324 * page nodes (for a full ATLAS event this should be bigger than 2,000
325 * pages when built from scratch). If you don't do your bookkeeping,
326 * avoid calling this too often.
327 */
328 uint32_t page_count (void) const;
329
330 /**
331 * Returns the first node of a list of nodes that represent the fragment
332 * you have constructed. To make use of it, just browse the list as
333 * defined in node.h
334 */
335 const eformat::write::node_t* bind (void);
336
337 const eformat::write::node_t* rebind (void){return m_node;};
338 private: //representation
339
340 uint32_t m_header[17]; ///< The FullEvent Header
341 eformat::write::node_t m_node[3]; ///< Node representation
342 eformat::write::SubDetectorFragment* m_child; ///< my children
343 eformat::write::SubDetectorFragment* m_last; ///< my last child
344 eformat::write::node_t m_extra; ///< Extra pages I may have
345 uint32_t m_extra_count; ///< How many extra pages I have
346
347 };
348
349 }
350
351}
352
353#endif /* EFORMAT_WRITE_FULLEVENTFRAGMENT_H */
const Int_t n
XmlRpcServer s
Definition: HelloServer.cpp:11
**********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
void append(eformat::write::SubDetectorFragment *sd)
const uint32_t * status(void) const
const uint32_t * event_filter_info(void) const
const eformat::write::node_t * bind(void)
void size_change(uint32_t o, uint32_t n)
FullEventFragment & operator=(const FullEventFragment &other)
const eformat::write::node_t * rebind(void)
const SubDetectorFragment * first_child(void) const
const uint32_t DEFAULT_VERSION
Definition: Version.h:24
uint32_t * base
The base address for this page.
Definition: node.h:27
Helps the user to define and build a SubDetector fragment.