RawConfigurationHeaderV0.h
Go to the documentation of this file.
1 #ifndef RAWCONFIGURATIONHEADERV0_H
2 #define RAWCONFIGURATIONHEADERV0_H
3 #include "DAQDataFormats/RawDAQData.h"
4 #include "DAQDataFormats/Macros.h"
5 #include "DAQDataFormats/BitFields.h"
6 
7 /// It is requred to
8 /// 1. include DAQDataFormats/DataFormatFirst.inc
9 /// 2. define CURRENT_CLASS
10 /// 3. define CURRENT_CLASS_VERSION for version of the class
11 /// OR define LAST_CLASS_VERSION for the main structure of the class
12 /// 4. (optional) define CURRENT_FIELDS_SUB_NAMESPACE
13 /// 5. include DAQDataFormats/DataFormatLast.inc
14 /// before the declaration of the DataFormat version class in the header.
15 #include "DAQDataFormats/DataFormatFirst.inc"
16 #define CURRENT_CLASS RawConfigurationHeader
17 #define CURRENT_CLASS_VERSION 0
18 #define CURRENT_FIELDS_SUB_NAMESPACE rawconfhdr
19 #include "DAQDataFormats/DataFormatLast.inc"
20 
21 namespace daqdataformats {
22 
24  static const uint32_t Marker_value[2] = {0x464E4F43, 0x54525453};
25  }
26 
27 namespace VERSION_NAMESPACE {
29 
30 
31  static const uint32_t RAWCONFIGURATIONBLOCKHEADER_SIZE = 7;
32 
34  MASK_MarkerHi1 = 0xFFFFFFFF, //! Marker Mask upper word 1 (32 bits)
35  MASK_MarkerHi2 = 0xFFFFFFFF, //! Marker Mask upper word 2 (32 bits)
36  MASK_ConfigurationHeaderVersion = 0x00000FFF, //! Configuration header version (12 bits)
37  MASK_DetectorID = 0x00007000, //! Detector ID (3 bits)
38  MASK_ConfigurationBlockSize = 0xFFFF0000, //! Size of the Configuration Block in words (16 bits)
39  MASK_ResourceManagerID = 0x0000FFFF, //! Recource manager identifier (16 bits)
40  MASK_RunNumber = 0x00FFFFFF, //! Run number (24 bits)
41  MASK_RunType = 0xFF000000, //! Run type (8 bits)
42  MASK_ConfigurationIDX = 0x0000FFFF, //! Configuration IDX (Configuration Database table number) (16 bits)
43  MASK_Partition = 0x00FF0000, //! Partition identifier that Run Control and Data Logger belong to (8 bits)
44  MASK_Subrun = 0x3F000000, //! Subrun number (6 bits)
45  MASK_SystemNumber = 0x0000FFFF, //! Number of systems (16 bits)
46  MASK_SystemVersionIDX = 0xFFFF0000, //! System versionindex key (16 bits)
47  };
48 
50  WORD_MarkerHi1 = 0, //! Marker Mask upper word (32 bits)
51  WORD_MarkerHi2 = 1, //! Marker Mask lower word (32 bits)
52  WORD_ConfigurationHeaderVersion = 2, //! Configuration header version (12 bits)
54  WORD_ConfigurationBlockSize = 2, //! Size of the Configuration Block in words (16 bits)
55  WORD_ResourceManagerID = 3, //! Recource manager identifier (16 bits)
56  WORD_RunNumber = 4, //! Run number (24 bits)
57  WORD_RunType = 4, //! Run type (8 bits)
58  WORD_ConfigurationIDX = 5, //! Configuration IDX (Configuration Database table number) (16 bits)
59  WORD_Partition = 5, //! Partition identifier that Run Control and Data Logger belong to (8 bits)
60  WORD_Subrun = 5, //! Subrun number (6 bits)
61  WORD_SystemNumber = 6, //! Number of systems
62  WORD_SystemVersionIDX = 6, //! System versionindex key
63  };
64 
65  DEFINE_SHIFT_FROM_MASK(MarkerHi1);
66  DEFINE_SHIFT_FROM_MASK(MarkerHi2);
67  DEFINE_SHIFT_FROM_MASK(ConfigurationHeaderVersion);
68  DEFINE_SHIFT_FROM_MASK(DetectorID);
69  DEFINE_SHIFT_FROM_MASK(ConfigurationBlockSize);
70  DEFINE_SHIFT_FROM_MASK(ResourceManagerID);
71  DEFINE_SHIFT_FROM_MASK(RunNumber);
73  DEFINE_SHIFT_FROM_MASK(ConfigurationIDX);
74  DEFINE_SHIFT_FROM_MASK(Partition);
75  DEFINE_SHIFT_FROM_MASK(Subrun);
76  DEFINE_SHIFT_FROM_MASK(SystemNumber);
77  DEFINE_SHIFT_FROM_MASK(SystemVersionIDX);
78  }// end of namespace rawconfhdr
79 
80 
81  class RawConfigurationHeader : public PREVIOUS_VERSION_CLASS_NAME {
82 
83  public:
84  RawConfigurationHeader (const version_t); ///< The default constructor
86  ~RawConfigurationHeader(); ///< Destructor
87 
88  void init ();
90  void print (std::ostream& os=std::cout) const;
92  using PREVIOUS_VERSION_CLASS_NAME::readData;
93  void* readData(const void* pointer){return RawDAQData::readDataGeneral(pointer);};
94 
95  IMPLEMENT_FIRST_GET_AND_SET(ConfigurationHeaderVersion, uint32_t);
96  IMPLEMENT_FIRST_GET_AND_SET(MarkerHi1, uint32_t);
97  IMPLEMENT_FIRST_GET_AND_SET(MarkerHi2, uint32_t);
98 
99  /// Both get and set methods are public
100  IMPLEMENT_FIRST_GET_AND_SET(DetectorID , uint32_t);
101  IMPLEMENT_FIRST_GET_AND_SET(ConfigurationBlockSize, uint32_t);
102  IMPLEMENT_FIRST_GET_AND_SET(ResourceManagerID , uint32_t);
103  IMPLEMENT_FIRST_GET_AND_SET(RunNumber , uint32_t);
105  IMPLEMENT_FIRST_GET_AND_SET(ConfigurationIDX , uint32_t);
106  IMPLEMENT_FIRST_GET_AND_SET(Partition , uint32_t);
107  IMPLEMENT_FIRST_GET_AND_SET(Subrun , uint32_t);
108  IMPLEMENT_FIRST_GET_AND_SET(SystemNumber , uint32_t);
109  IMPLEMENT_FIRST_GET_AND_SET(SystemVersionIDX , uint32_t);
110 
111  INIT_FIRST(advanceSystemNumber, , bool, );
112 
113  };
114 
115 
116  }} // END NAMESPCE daqdataformats
117 #endif /* RAWCONFIGURATIONHEADERV0_H */
void * readDataGeneral(const void *buffer)
General ReadData method when the sizeofdata is known.
Definition: RawDAQData.cpp:186
#define VERSION_NAMESPACE
#define INIT_FIRST(FUNC, CONSTNESS, OUTPUT_UNITS,...)
Definition: Macros.h:239
#define IMPLEMENT_FIRST_GET_AND_SET(FUNC, UNITS)
Definition: Macros.h:171
Partition identifier that Run Control and Data Logger belong to (8 bits)
bool print
Partition identifier that Run Control and Data Logger belong to (8 bits)
OStream cout
Definition: OStream.cxx:6
int32_t version_t
Definition: RawDAQData.h:72
#define CURRENT_FIELDS_SUB_NAMESPACE
Class to hold the data from the FEBs in correct formats.