CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
eformat::write::ROSFragment Class Reference

forward More...

#include <ROSFragment.h>

Public Member Functions

 ROSFragment (uint32_t source_id, uint32_t run_no, uint32_t lvl1_id, uint32_t bc_id)
 
 ROSFragment (uint32_t *ros)
 
 ROSFragment (eformat::write::node_t *ros)
 
 ROSFragment ()
 
 ROSFragment (const ROSFragment &other)
 
virtual ~ROSFragment ()
 
ROSFragmentoperator= (const ROSFragment &other)
 
void status (uint32_t n, const uint32_t *status)
 
uint32_t nstatus (void) const
 
const uint32_t * status (void) const
 
void minor_version (uint16_t v)
 
uint16_t minor_version (void) const
 
void source_id (uint32_t s)
 
uint32_t source_id (void) const
 
void run_no (uint32_t s)
 
uint32_t run_no (void) const
 
void lvl1_id (uint32_t s)
 
uint32_t lvl1_id (void) const
 
void bc_id (uint32_t s)
 
uint32_t bc_id (void) const
 
uint32_t meta_size_word (void) const
 
uint32_t size_word (void) const
 
void append (eformat::write::ROBFragment *rob)
 
const ROBFragmentfirst_child (void) const
 
void size_change (uint32_t o, uint32_t n)
 
const SubDetectorFragmentparent (void) const
 
void parent (eformat::write::SubDetectorFragment *sd)
 
const ROSFragmentnext (void) const
 
void next (const ROSFragment *n)
 
uint32_t page_count (void) const
 
const eformat::write::node_tbind (void)
 
const eformat::write::node_textra (void)
 

Detailed Description

forward

Defines a helper class to aid the creation of ROS fragments.

Definition at line 27 of file write/ROSFragment.h.

Constructor & Destructor Documentation

◆ ROSFragment() [1/5]

eformat::write::ROSFragment::ROSFragment ( uint32_t source_id,
uint32_t run_no,
uint32_t lvl1_id,
uint32_t bc_id )

Builds a new ROS fragment from scratch

Parameters
source_idThe source identifier to be using for this ROS
run_noThe run number for this ROS
lvl1_idThe LVL1 identifier for this ROS
bc_idThe bunch crossing identifier for this ROS

Definition at line 19 of file ROSFragment.cxx.

21 : m_parent(0),
22 m_child(0),
23 m_last(0),
24 m_next(0),
25 m_extra_count(0)
26{
27 m_header[0] = eformat::ROS; //marker
28 m_header[1] = 11; //this header size + status size
29 m_header[2] = 11; //this header size + status size
30 m_header[3] = eformat::DEFAULT_VERSION; //format version
31 m_header[4] = source_id;
32 m_header[5] = 1; //number of status
33 m_header[6] = 3; //number of fragment specific
34 m_header[7] = run_no;
35 m_header[8] = lvl1_id;
36 m_header[9] = bc_id;
37
38 //now initialize pages
39 set(m_node[0], m_header, 6, &m_node[1]);
40 set(m_node[1], &eformat::DEFAULT_STATUS, 1, &m_node[2]);
41 set(m_node[2], &m_header[6], 4, 0);
42 ERS_DEBUG_3("%s Source Id. = 0x%x., LVL1 Id. = %d, Run Number = %d",
43 "Built (write) ros fragment from scratch, with",
46}
#define ERS_DEBUG_3(...)
uint32_t source_id(void) const
void set(node_t &i, const uint32_t *b, size_t l, node_t *n=0)
Definition node.cxx:16
@ ROS
The ROS marker.
const uint32_t DEFAULT_VERSION
Definition Version.h:24
const uint32_t DEFAULT_STATUS
Definition Status.h:44

◆ ROSFragment() [2/5]

eformat::write::ROSFragment::ROSFragment ( uint32_t * ros)

Builds a new ROS fragment from an existing ROS fragment in contiguous memory.

Parameters
rosThe existing ROS fragment

Definition at line 48 of file ROSFragment.cxx.

49 : m_parent(0),
50 m_child(0),
51 m_last(0),
52 m_next(0),
53 m_extra_count(0)
54{
55 //now initialize pages
56 set(m_node[0], ros, 6, &m_node[1]);
57 set(m_node[1], &ros[6], ros[5], &m_node[2]);
58 set(m_node[2], &ros[6+ros[5]], 4, &m_extra);
59 eformat::write::set(m_extra, &ros[10+ros[5]], ros[1]-ros[2]);
60 ++m_extra_count;
61 ERS_DEBUG_3("%s Source Id. = 0x%x., LVL1 Id. = %d, Run Number = %d",
62 "Built (write) ros fragment from contiguous memory, with",
63 source_id(), lvl1_id(), run_no());
64}

◆ ROSFragment() [3/5]

eformat::write::ROSFragment::ROSFragment ( eformat::write::node_t * ros)

Builds a new ROS fragment from an existing ROS fragment in non-contiguous memory. The top-level fragment header is expected to be on a contiguous area of memory, together with the first word of the first child fragment (i.e. the ROB header marker). The following data can be spread around.

Parameters
rosThe existing ROS fragment, as a list of nodes, pre-concatenated by the caller.

Definition at line 66 of file ROSFragment.cxx.

67 : m_parent(0),
68 m_child(0),
69 m_last(0),
70 m_next(0),
71 m_extra_count(0)
72{
73 //now initialize pages
74 set(m_node[0], ros->base, 6, &m_node[1]);
75 set(m_node[1], &ros->base[6], ros->base[5], &m_node[2]);
76 set(m_node[2], &ros->base[6+ros->base[5]], 4, &m_extra);
77 eformat::write::set(m_extra, &ros->base[10+ros->base[5]],
78 ros->size_word - ros->base[2], ros->next);
79 m_extra_count += eformat::write::count(m_extra);
80 ERS_DEBUG_3("%s Source Id. = 0x%x., LVL1 Id. = %d, Run Number = %d",
81 "Built (write) ros fragment from paged memory, with",
82 source_id(), lvl1_id(), run_no());
83}
uint32_t count(const node_t &list)
Definition node.cxx:42
node_t * next
The next node.
Definition node.h:29
uint32_t * base
The base address for this page.
Definition node.h:27
size_t size_word
The size, in 4-byte words for this page.
Definition node.h:28

◆ ROSFragment() [4/5]

eformat::write::ROSFragment::ROSFragment ( )

Builds a new empty ROS fragment, otherwise invalid. This is useful for array builds and standard containers.

Definition at line 85 of file ROSFragment.cxx.

86 : m_parent(0),
87 m_child(0),
88 m_last(0),
89 m_next(0),
90 m_extra_count(0)
91{
92 m_header[0] = eformat::ROS; //marker
93 m_header[1] = 11; //this header size + status size
94 m_header[2] = 11; //this header size + status size
95 m_header[3] = eformat::DEFAULT_VERSION; //format version
96 m_header[4] = 0; //source identifier
97 m_header[5] = 1; //number of status
98 m_header[6] = 3; //number of fragment specific
99 m_header[7] = 0; //run number
100 m_header[8] = 0; //LVL1 identifier
101 m_header[9] = 0; //bunch crossing identifier
102
103 //now initialize pages
104 set(m_node[0], m_header, 6, &m_node[1]);
105 set(m_node[1], &eformat::DEFAULT_STATUS, 1, &m_node[2]);
106 set(m_node[2], &m_header[6], 4, 0);
107 ERS_DEBUG_3("%s Source Id. = 0x%x., LVL1 Id. = %d, Run Number = %d",
108 "Built empty (write) ros fragment from scratch, with",
111}

◆ ROSFragment() [5/5]

eformat::write::ROSFragment::ROSFragment ( const ROSFragment & other)

Copy constructor. This will only copy the meta data, not the fragment relationships and block-data (children, parent and status block) contained in the to-be-copied fragment. If you wish this fragment has the same parents, and children of the copied fragment, you have to do this operation manually, after copying. If you wish to make a copy of the status as well, do it manually and then assign it to this fragment using the status() method.

Parameters
otherThe other fragment to take the meta data from.

Definition at line 113 of file ROSFragment.cxx.

115 : m_parent(0),
116 m_child(0),
117 m_last(0),
118 m_next(0),
119 m_extra_count(0)
120{
121 *this = other;
122 ERS_DEBUG_3("%s Source Id. = 0x%x., LVL1 Id. = %d, Run Number = %d",
123 "Built (write) ros fragment from copy, with",
126}
Index other(Index i, Index j)

◆ ~ROSFragment()

virtual eformat::write::ROSFragment::~ROSFragment ( )
inlinevirtual

Base destructor

Definition at line 84 of file write/ROSFragment.h.

84{}

Member Function Documentation

◆ append()

void eformat::write::ROSFragment::append ( eformat::write::ROBFragment * rob)

Appends a new ROB fragment to this ROS fragment.

Warning
This will change the page structure of the last ROB fragment inserted here, in order to concatenate the ROB fragments together. Please note that this operation is not compatible with multiple threads of operation, if you would like to share eformat::write::ROBFragment's between threads. A better strategy would be create, for every thread of operation, a proper ROBFragment instead.
Parameters
robThe ROB fragment to be appended to myself

Definition at line 169 of file ROSFragment.cxx.

170{
171 ERS_DEBUG_3("%s Source Id. = 0x%x to ros fragment with Source Id. = 0x%x",
172 "Appending rob fragment with",
173 rob->source_id(), source_id());
174 rob->parent(this);
175 uint32_t old_size = m_node[0].base[1];
176 m_node[0].base[1] += rob->size_word();
177
178 //adjust `m_last' and `m_child' to point to the new last ROB
179 if (m_last) m_last->next(rob);
180 else m_child = rob;
181 m_last = rob;
182
183 //propagate changes to my parent
184 if (m_parent) m_parent->size_change(old_size, m_node[0].base[1]);
185}
void next(const ROBFragment *n)
uint32_t size_word(void) const
void parent(eformat::write::ROSFragment *ros)
void size_change(uint32_t o, uint32_t n)

Referenced by Builder::append2event(), eformat::old::convert(), convert_ros(), and main().

◆ bc_id() [1/2]

void eformat::write::ROSFragment::bc_id ( uint32_t s)
inline

Changes the bunch crossing identifier in this fragment

Parameters
sThe new value to set

Definition at line 179 of file write/ROSFragment.h.

180 { m_node[2].base[3] = s; }
XmlRpcServer s

◆ bc_id() [2/2]

uint32_t eformat::write::ROSFragment::bc_id ( void ) const
inline

Returns the bunch crossing identifier for this fragment

Definition at line 185 of file write/ROSFragment.h.

186 { return m_node[2].base[3]; }

Referenced by ROSFragment().

◆ bind()

const eformat::write::node_t * eformat::write::ROSFragment::bind ( void )

Returns the first node of a list of nodes that represent the fragment you have constructed. To make use of it, just browse the list as defined in node.h

Definition at line 195 of file ROSFragment.cxx.

196{
197 //the header is already concatenated by construction
198 eformat::write::node_t* last = &m_node[2];
199 if (m_extra_count) {
200 last = &m_extra;
201 while (last->next) last = last->next;
202 }
203 for (const ROBFragment* curr = m_child; curr; curr = curr->next()) {
204 last->next = const_cast<eformat::write::node_t*>(curr->bind());
205 while (last->next) last = last->next; //advance until end
206 }
207 return m_node;
208}

Referenced by convert_ros().

◆ extra()

const eformat::write::node_t * eformat::write::ROSFragment::extra ( void )
inline

Return the extra node of the fragment for OHFiller_write. lifei

Definition at line 281 of file write/ROSFragment.h.

281{return & m_extra;};

◆ first_child()

const ROBFragment * eformat::write::ROSFragment::first_child ( void ) const
inline

This returns the first child of this fragment. The system operates as a concatenated list of fragments. From this child you can get to the next.

Definition at line 222 of file write/ROSFragment.h.

222{ return m_child; }

Referenced by PackedRawDataCnvSvc::commitOutput().

◆ lvl1_id() [1/2]

void eformat::write::ROSFragment::lvl1_id ( uint32_t s)
inline

Changes the lvl1 identifier in this fragment

Parameters
sThe new value to set

Definition at line 165 of file write/ROSFragment.h.

166 { m_node[2].base[2] = s; }

◆ lvl1_id() [2/2]

uint32_t eformat::write::ROSFragment::lvl1_id ( void ) const
inline

Returns the lvl1 identifier for this fragment

Definition at line 171 of file write/ROSFragment.h.

172 { return m_node[2].base[2]; }

Referenced by operator=(), ROSFragment(), ROSFragment(), ROSFragment(), ROSFragment(), and ROSFragment().

◆ meta_size_word()

uint32_t eformat::write::ROSFragment::meta_size_word ( void ) const
inline

Returns the total size for the meta data (everything that does not encompass the contents of the m_data pointer in the private representation of this class) in the fragment, in words

Definition at line 193 of file write/ROSFragment.h.

194 { return m_node[0].base[2]; }

◆ minor_version() [1/2]

void eformat::write::ROSFragment::minor_version ( uint16_t v)
inline

Changes the minor version number of the fragment

Parameters
vThe new minor version for this header

Definition at line 123 of file write/ROSFragment.h.

124 { m_node[0].base[3] = eformat::DEFAULT_VERSION | v; }
**********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

Referenced by eformat::old::convert(), and convert_ros().

◆ minor_version() [2/2]

uint16_t eformat::write::ROSFragment::minor_version ( void ) const
inline

Returns the minor version number of the fragment

Definition at line 129 of file write/ROSFragment.h.

130 { return 0xffff & m_node[0].base[3]; }

◆ next() [1/2]

void eformat::write::ROSFragment::next ( const ROSFragment * n)
inline

Sets the next sibling

Parameters
nThe sibling following this fragment

Definition at line 257 of file write/ROSFragment.h.

257{ m_next = n; }
const Int_t n

◆ next() [2/2]

const ROSFragment * eformat::write::ROSFragment::next ( void ) const
inline

Returns the next sibling

Definition at line 250 of file write/ROSFragment.h.

250{ return m_next; }

Referenced by PackedRawDataCnvSvc::commitOutput(), and eformat::write::SubDetectorFragment::page_count().

◆ nstatus()

uint32_t eformat::write::ROSFragment::nstatus ( void ) const
inline

Returns the number of status wors in this fragment

Definition at line 111 of file write/ROSFragment.h.

111{ return m_node[0].base[5]; }

◆ operator=()

eformat::write::ROSFragment & eformat::write::ROSFragment::operator= ( const ROSFragment & other)

Assigment operator. This will only copy the meta data, not the fragment relationships and block-data (children and parent and status block) contained in the to-be-copied fragment. If you wish this fragment has the same parents, and children of the copied fragment, you have to do this operation manually, after copying. If you wish to make a copy of the status as well, do it manually and then assign it to this fragment using the status() method.

Parameters
otherThe other fragment to take the meta data from.

Definition at line 128 of file ROSFragment.cxx.

130{
131 memcpy(reinterpret_cast<void*>(m_header),
132 reinterpret_cast<const void*>(other.m_node[0].base),
133 6*sizeof(uint32_t));
134 memcpy(reinterpret_cast<void*>(m_header+6),
135 reinterpret_cast<const void*>(other.m_node[2].base),
136 4*sizeof(uint32_t));
137
138 //now initialize pages
139 set(m_node[0], m_header, 6, &m_node[1]);
140 set(m_node[1], other.m_node[1].base, other.m_node[1].size_word, &m_node[2]);
141 set(m_node[2], &m_header[6], 4, 0);
142 ERS_DEBUG_3("%s Source Id. = 0x%x., LVL1 Id. = %d, Run Number = %d",
143 "Copied (write) ros fragment, with",
146 return *this;
147}

◆ page_count()

uint32_t eformat::write::ROSFragment::page_count ( void ) const

Returns the total number of (raw memory) pages this fragment is composed of.

Warning
This operation navigates at a potentially large list of child page nodes (for a full ATLAS event this should be bigger than 2,000 pages when built from scratch). If you don't do your bookkeeping, avoid calling this too often.

Definition at line 187 of file ROSFragment.cxx.

188{
189 uint32_t retval = 3 + m_extra_count;
190 for (const ROBFragment* curr = m_child; curr; curr = curr->next())
191 retval += curr->page_count();
192 return retval;
193}

◆ parent() [1/2]

void eformat::write::ROSFragment::parent ( eformat::write::SubDetectorFragment * sd)
inline

This sets the parent fragment

Parameters
sdThe SubDetectorFragment parent fragment of this ROS

Definition at line 244 of file write/ROSFragment.h.

245 { m_parent = sd; }

◆ parent() [2/2]

const SubDetectorFragment * eformat::write::ROSFragment::parent ( void ) const
inline

This returns the parent fragment

Definition at line 236 of file write/ROSFragment.h.

237 { return m_parent; }

Referenced by eformat::write::SubDetectorFragment::append().

◆ run_no() [1/2]

void eformat::write::ROSFragment::run_no ( uint32_t s)
inline

Changes the run number

Parameters
sThe new value to set

Definition at line 151 of file write/ROSFragment.h.

152 { m_node[2].base[1] = s; }

◆ run_no() [2/2]

uint32_t eformat::write::ROSFragment::run_no ( void ) const
inline

Returns the run number for this fragment

Definition at line 157 of file write/ROSFragment.h.

158 { return m_node[2].base[1]; }

Referenced by operator=(), ROSFragment(), ROSFragment(), ROSFragment(), ROSFragment(), and ROSFragment().

◆ size_change()

void eformat::write::ROSFragment::size_change ( uint32_t o,
uint32_t n )

This method is used by children of this fragment to notify fragment size changes.

Parameters
oThe old size, in 32-bit words
nThe new size, in 32-bit words

Definition at line 161 of file ROSFragment.cxx.

162{
163 uint32_t old_size = m_node[0].base[1];
164 m_node[0].base[1] -= o;
165 m_node[0].base[1] += n;
166 if (m_parent) m_parent->size_change(old_size, m_node[0].base[1]);
167}

Referenced by eformat::write::SubDetectorFragment::append(), and status().

◆ size_word()

uint32_t eformat::write::ROSFragment::size_word ( void ) const
inline

Returns the total size for this fragment, in words

Definition at line 199 of file write/ROSFragment.h.

200 { return m_node[0].base[1]; }

Referenced by eformat::write::SubDetectorFragment::append().

◆ source_id() [1/2]

void eformat::write::ROSFragment::source_id ( uint32_t s)
inline

Changes the source identifier for this fragment

Parameters
sThe new value to set

Definition at line 137 of file write/ROSFragment.h.

138 { m_node[0].base[4] = s; }

Referenced by eformat::write::SubDetectorFragment::append().

◆ source_id() [2/2]

uint32_t eformat::write::ROSFragment::source_id ( void ) const
inline

Returns the source identifier for this fragment

Definition at line 143 of file write/ROSFragment.h.

144 { return m_node[0].base[4]; }

Referenced by operator=(), ROSFragment(), ROSFragment(), ROSFragment(), ROSFragment(), and ROSFragment().

◆ status() [1/2]

void eformat::write::ROSFragment::status ( uint32_t n,
const uint32_t * status )

Changes the number of status words and the status words themselves from the fragment

Parameters
nHow many status words this fragment is supposed to have.
statusA pointer to n pre-allocated words

Definition at line 149 of file ROSFragment.cxx.

150{
151 if (m_parent) m_parent->size_change(m_node[0].base[1],
152 m_node[0].base[1]-m_node[0].base[5]+n);
153 m_node[0].base[1] -= m_node[0].base[5]; //remove count from previous status
154 m_node[0].base[2] -= m_node[0].base[5]; //remove count from previous status
155 m_node[1].size_word = m_node[0].base[5] = n; //set new values
156 m_node[0].base[1] += n;
157 m_node[0].base[2] += n;
158 m_node[1].base = const_cast<uint32_t*>(status);
159}
const uint32_t * status(void) const

Referenced by Builder::append2event(), eformat::old::convert(), and convert_ros().

◆ status() [2/2]

const uint32_t * eformat::write::ROSFragment::status ( void ) const
inline

Returns a pointer to the first status word to be used by this fragment

Definition at line 116 of file write/ROSFragment.h.

116{ return m_node[1].base; }

The documentation for this class was generated from the following files: