BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Event/eformat/include/eformat/FullEventFragment.h
Go to the documentation of this file.
1// Dear emacs, this is -*- c++ -*-
2
3/**
4 * @file eformat/FullEventFragment.h
5 * @author <a href="mailto:Andre.dos.Anjos@cern.ch">Andre DOS ANJOS</a>
6 * $Author: maqm $
7 * $Revision: 1.3 $
8 * $Date: 2022/01/06 21:15:37 $
9 *
10 * @brief Defines the Event Fragment entity. The definition is based on the
11 * update of ATL-DAQ-98-129, by D.Francis et al.
12 */
13
14#ifndef EFORMAT_FULLEVENTFRAGMENT_H
15#define EFORMAT_FULLEVENTFRAGMENT_H
16
17#include "eformat/Header.h"
18#include "eformat/HeaderMarker.h"
19#include "eformat/SizeCheckIssue.h"
20#include "eformat/SubDetectorFragment.h"
21
22namespace eformat {
23
24 /**
25 * Describes how to access the contents of an event fragment, as prescribed
26 * by the event format note.
27 */
28 template <class TPointer> class FullEventFragment : public eformat::Header<TPointer> {
29
30 public: // interface
31 /**
32 * To build a fragment given the containing buffer. I need to know
33 * where the fragment starts in order to do that.
34 *
35 * @param it The exact position where this fragment should start.
36 */
37 FullEventFragment( const TPointer& it );
38
39 /**
40 * Builds an empty, otherwise useless FullEventFragment
41 */
42 FullEventFragment() : Header<TPointer>(), m_start() {}
43
44 /**
45 * Copy constructor
46 *
47 * @param other The fragment to be copied
48 */
50 : Header<TPointer>( other ), m_start( other.m_start ) {}
51
52 /**
53 * Destructor virtualisation
54 */
55 virtual ~FullEventFragment() {}
56
57 /**
58 * Copy operator
59 *
60 * @param other The fragment to be copied
61 */
64 m_start = other.m_start;
65 return *this;
66 }
67
68 /**
69 * Manual re-assignment
70 *
71 * @param it The position pointing the first word of this fragment
72 */
73 FullEventFragment& assign( const TPointer& it );
74
75 /**
76 * Says if the the fragment is valid. This may throw exceptions.
77 */
78 virtual bool check() const;
79
80 /**
81 * Says if the Fragment and all children are valid.
82 */
83 bool check_tree() const;
84
85 /**
86 * Returns the date, in seconds elapsed since the 1st. January,
87 * 1970. The timezone is fixed to UTC.
88 */
89 inline uint32_t time() const { return m_start[0]; }
90
91 /**
92 * Returns the global identifier
93 */
94 inline uint32_t global_id() const { return m_start[1]; }
95
96 /**
97 * Returns the run number
98 */
99 inline uint32_t run_no() const { return m_start[2]; }
100
101 /**
102 * Returns the lvl1 identifier
103 */
104 inline uint32_t lvl1_id() const { return m_start[3]; }
105
106 /**
107 * Retursn the lvl1 trigger type
108 */
109 inline uint32_t lvl1_trigger_type() const { return m_start[4]; }
110
111 /**
112 * Returns the lvl2 trigger info
113 */
114 inline uint32_t lvl2_trigger_info() const { return m_start[5]; }
115
116 /**
117 * Returns the number of Event Filter words (constant = 4)
118 */
119 inline uint32_t nevent_filter_info() const { return 4; }
120
121 /**
122 * Returns an iterator to the first of the (4) EF words
123 *
124 * @param it An <em>updateable</em> iterator you should provide.
125 */
126 void event_filter_info( TPointer& it ) const;
127
128 private: // static stuff
129 static const uint32_t NSPECIFIC;
130
131 private: // representation
132 TPointer m_start; ///< my start word
133 };
134
135} // namespace eformat
136
137template <class TPointer> const uint32_t eformat::FullEventFragment<TPointer>::NSPECIFIC = 10;
138
139template <class TPointer>
144
145template <class TPointer>
148 ERS_DEBUG_3( "Re-building FullEventFragment from pointer" );
151 ERS_DEBUG_1( "Initialized header with source identifier = %s",
152 eformat::helper::SourceIdentifier( source_id() ).human().c_str() );
153 return *this;
154}
155
156template <class TPointer>
158 it = m_start;
159 it += 6;
160}
161
162template <class TPointer> bool eformat::FullEventFragment<TPointer>::check() const {
163 ERS_DEBUG_2( "Checking for consistency of FullEventFragment" );
164 eformat::Header<TPointer>::check(); //< first do a generic check
165 if ( this->nspecific() != NSPECIFIC )
166 { throw EFORMAT_SIZE_CHECK( NSPECIFIC, this->nspecific() ); }
167 return true;
168}
169
170template <class TPointer> bool eformat::FullEventFragment<TPointer>::check_tree() const {
171 ERS_DEBUG_2( "Checking recursively for consistency of FullEventFragment" );
172 check(); // check myself
173 uint32_t total = this->nchildren();
174 for ( size_t i = 0; i < total; ++i )
175 {
176 TPointer fp;
179 f.check_tree();
180 }
181 return true;
182}
183
184#endif /* EFORMAT_FULLEVENTFRAGMENT_H */
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")
#define EFORMAT_SIZE_CHECK(actual, informed)
#define ERS_DEBUG_1(...)
#define ERS_DEBUG_3(...)
#define ERS_DEBUG_2(...)
FullEventFragment & operator=(const FullEventFragment &other)
Header & operator=(const Header &other)
Header(const TPointer &it, uint32_t match)
Header & assign(const TPointer &it, uint32_t match)
void specific_header(TPointer &it) const
virtual void child(TPointer &p, size_t n) const