BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
SubDetectorFragment.h
Go to the documentation of this file.
1//Dear emacs, this is -*- c++ -*-
2
3/**
4 * @file eformat/SubDetectorFragment.h
5 * @author <a href="mailto:[email protected]">Andre DOS ANJOS</a>
6 * $Author: maqm $
7 * $Revision: 1.2 $
8 * $Date: 2011/02/20 23:38:21 $
9 *
10 * @brief Defines the subdetector fragment entity. The definition is based on
11 * the update of ATL-DAQ-98-129, by D.Francis et al.
12 */
13
14#ifndef EFORMAT_SUBDETECTORFRAGMENT_H
15#define EFORMAT_SUBDETECTORFRAGMENT_H
16
17#include "eformat/Header.h"
19#include "eformat/ROSFragment.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 SubDetectorFragment : 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 SubDetectorFragment (const TPointer& it);
40
41 /**
42 * Builds an empty, otherwise useless SubDetectorFragment
43 */
44 SubDetectorFragment () : Header<TPointer>(), m_start() {}
45
46 /**
47 * Copy constructor
48 *
49 * @param other The fragment to be copied
50 */
52 : Header<TPointer>(other), m_start(other.m_start) {}
53
54 /**
55 * Destructor virtualisation
56 */
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 SubDetectorFragment& 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 private: //static stuff
85
86 static const uint32_t NSPECIFIC;
87
88 private: //representation
89
90 TPointer m_start; ///< my start word
91
92 };
93
94}
95
96template <class TPointer>
98
99template <class TPointer>
101(const TPointer& it)
102 : eformat::Header<TPointer>(it, eformat::SUB_DETECTOR),
103 m_start()
104{
105 specific_header(m_start);
106}
107
108template <class TPointer> eformat::SubDetectorFragment<TPointer>&
110{
111 ERS_DEBUG_3("Re-building SubDetectorFragment from pointer");
113 specific_header(m_start);
114 ERS_DEBUG_1("Initialized header with source identifier = %s",
115 eformat::helper::SourceIdentifier(source_id()).human().c_str());
116 return *this;
117}
118
119template <class TPointer>
121{
122 ERS_DEBUG_2("Checking for consistency of SubDetectorFragment");
123 eformat::Header<TPointer>::check(); //< first do a generic check
124 if (this->nspecific() != NSPECIFIC) {
125 throw EFORMAT_SIZE_CHECK(NSPECIFIC, this->nspecific());
126 }
127 return true;
128}
129
130template <class TPointer>
132{
133 ERS_DEBUG_2("Checking recursively for consistency of SubDetectorFragment");
134 check(); // check myself
135 uint32_t total = this->nchildren();
136 for (size_t i=0; i<total; ++i) {
137 TPointer fp;
138 child(fp, i);
140 f.check_tree();
141 }
142 return true;
143}
144
145#endif /* EFORMAT_SUBDETECTORFRAGMENT_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,...
Describes the ROS fragment as defined 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 bool check() const
Definition: Header.h:249
SubDetectorFragment & operator=(const SubDetectorFragment &other)
SubDetectorFragment & assign(const TPointer &it)
SubDetectorFragment(const SubDetectorFragment &other)
@ SUB_DETECTOR
The SubDet. marker.
Definition: HeaderMarker.h:29