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