BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
ROSFragment.h
Go to the documentation of this file.
1//Dear emacs, this is -*- c++ -*-
2
3/**
4 * @file eformat/ROSFragment.h
5 * @author <a href="mailto:[email protected]">Andre DOS ANJOS</a>
6 * $Author: maqm $
7 * $Revision: 1.3 $
8 * $Date: 2022/01/06 21:15:37 $
9 *
10 * @brief Describes the ROS fragment as defined in the Event Format note.
11 */
12
13#ifndef EFORMAT_ROSFRAGMENT_H
14#define EFORMAT_ROSFRAGMENT_H
15
16#include <zlib.h>
17#include "eformat/Header.h"
19#include "eformat/ROBFragment.h"
21
22namespace eformat {
23
24 /**
25 * Describes how to access the contents of a subdetector fragment, as
26 * prescribed by the event format note.
27 */
28 template <class TPointer>
29 class ROSFragment : 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 ROSFragment (const TPointer& it);
40
41 /**
42 * Builds an empty, otherwise useless ROSFragment
43 */
44 ROSFragment () : Header<TPointer>(), m_start() {}
45
46 /**
47 * Copy constructor
48 *
49 * @param other The fragment to be copied
50 */
51 ROSFragment (const ROSFragment& other)
52 : Header<TPointer>(other), m_start(other.m_start) {}
53
54 /**
55 * Destructor virtualisation
56 */
57 virtual ~ROSFragment() {}
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 ROSFragment& 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 the fragment is valid. This may throw exceptions.
81 */
82 bool check_tree () const;
83
84 /**
85 * Returns the run number
86 */
87 inline uint32_t run_no() const { return m_start[0]; }
88
89 /**
90 * Returns the lvl1 identifier
91 */
92 inline uint32_t lvl1_id() const { return m_start[1]; }
93
94 /**
95 * Returns the bunch crossing identifier
96 */
97 inline uint32_t bc_id() const { return m_start[2]; }
98
99 private: //static stuff
100
101 static const uint32_t NSPECIFIC;
102
103 private: //representation
104
105 TPointer m_start; ///< my start word
106
107 };
108
109}
110
111template <class TPointer>
113
114template <class TPointer>
116 : eformat::Header<TPointer>(it, eformat::ROS),
117 m_start()
118{
120}
121
122template <class TPointer> eformat::ROSFragment<TPointer>&
124{
125 ERS_DEBUG_3("Re-building ROSFragment from pointer");
128 ERS_DEBUG_1("Initialized header with source identifier = %s",
129 eformat::helper::SourceIdentifier(source_id()).human().c_str());
130 return *this;
131}
132
133template <class TPointer>
135{
136 ERS_DEBUG_2("Checking for consistency of ROSFragment");
137 eformat::Header<TPointer>::check(); //< first do a generic check
138 if (eformat::Header<TPointer>::nspecific() != NSPECIFIC)
139 throw EFORMAT_SIZE_CHECK(NSPECIFIC, this->nspecific());
140 return true;
141}
142
143template <class TPointer>
145{
146 ERS_DEBUG_2("Checking recursively for consistency of ROSFragment");
147 check(); // check myself
148 uint32_t total = this->nchildren();
149 for (size_t i=0; i<total; ++i) {
150 TPointer fp;
153 f.check_tree();
154 }
155 return true;
156}
157
158#endif /* EFORMAT_ROSFRAGMENT_H */
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")
Defines the constants used by Event Fragments.
Defines the Header entity. The definition is based on the update of ATL-DAQ-98-129,...
Defines the ROB fragment entity as described in the Event Format note.
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(...)
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 void child(TPointer &p, size_t n) const
Definition Header.h:272
virtual bool check() const
Definition Header.h:249
virtual bool check() const
uint32_t bc_id() const
Definition ROSFragment.h:97
ROSFragment & assign(const TPointer &it)
bool check_tree() const
ROSFragment & operator=(const ROSFragment &other)
Definition ROSFragment.h:64
uint32_t run_no() const
Definition ROSFragment.h:87
ROSFragment(const ROSFragment &other)
Definition ROSFragment.h:51
uint32_t lvl1_id() const
Definition ROSFragment.h:92
@ ROS
The ROS marker.