RawRunHeaderV0.h
Go to the documentation of this file.
1 #ifndef RAWRUNHEADERV0_H
2 #define RAWRUNHEADERV0_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 RawRunHeader
17 #define CURRENT_CLASS_VERSION 0
18 #define CURRENT_FIELDS_SUB_NAMESPACE rawrunhdr
19 #include "DAQDataFormats/DataFormatLast.inc"
20 
21 
22 namespace daqdataformats {
23 
25  // Run header delimiter
26  static const uint32_t Marker_value[2] = {0x41764F4E, 0x39323945};
27 
28  }
29 
30  namespace rawruntail {
31  // Run tail delimiters
32  static const uint32_t Marker_value[4] = {0x4C494154, 0x4C494154, 0x39323945, 0x41764F4E};
33  }
34 
35  namespace VERSION_NAMESPACE {
37 
38  static const uint32_t RUNHEADER_SIZE = 25;
39 
41  MASK_MarkerHi = 0xFFFFFFFF, //! Marker Mask upper word (32 bits)
42  MASK_MarkerLo = 0xFFFFFFFF, //! Marker Mask lower word (32 bits)
43  MASK_RunNumber = 0x00FFFFFF, //! Run number (24 bits)
44  MASK_RunType = 0xFF000000, //! Run type (8 bits)
45  MASK_ConfigIDX = 0x0000FFFF, //! Detector configuration identifier (16 bits)
46  MASK_Partition = 0x00FF0000, //! Partition identifier that Run Control and Data Logger belong to (8 bits)
47  MASK_Subrun = 0x3F000000, //! Subrun number (6 bits)
48  MASK_ConfigurationBlockSet = 0x80000000, //! Is the configuration Block set? (1bit)
49  MASK_Version = 0x000000FF, //! Run Header Version (8 bits)
50  MASK_RunControlVersion = 0x0000FF00, //! Run Control version (8 bits)
51  MASK_RunControlID = 0xFFFF0000, //! Run control identifier (16 bits)
52  MASK_DataLoggerVersion = 0x00000FFF, //! Data Logger version (12 bits)
53  MASK_DataLoggerID = 0xFFFF0000, //! Data Logger identifier (16 bits)
54  MASK_RunStartTime = 0xFFFFFFFF, //! Run Start Time (32 bits)
55  MASK_SubRunStartTime = 0xFFFFFFFF, //! SubRun Start Time (32 bits)
56  MASK_SubRunEndTime = 0xFFFFFFFF, //! SubRun End Time (32 bits)
57  MASK_RunEndTime = 0xFFFFFFFF, //! Run End Time (32 bits)
58  MASK_TotalEvents = 0xFFFFFFFF, //! Total number of events (32 bits)
59  MASK_UniversalEventStartLo = 0xFFFFFFFF, //! Universal event number lower 32 bits
60  MASK_UniversalEventStartHi = 0x000000FF, //! Universal event number higher 8 bits
61  MASK_UniversalEventEndLo = 0xFFFFFFFF, //! Universal event number lower 32 bits
62  MASK_UniversalEventEndHi = 0x000000FF, //! Universal event number higher 8 bits
63  MASK_RunSize = 0xFFFFFFFF, //! Size of the run in words
64  MASK_TriggerVersion = 0x00000FFF, //! Trigger version (12 bits)
65  MASK_TriggerCtrlID = 0xFFFF0000, //! Identifier of the global trigger processor (16 bits)
66  MASK_TriggerMC = 0x80000000, //! MC triggering flag
67  MASK_VTMod = 0x3F000000, //! Valid trigger modification modes
68  MASK_ValidTriggerTypesLow = 0x00FFFFFF, //! Logical OR of all valid trigger types. First word
69  MASK_ValidTriggerTypesHigh = 0xFFFFFFFF, //! Logical OR of all valid trigger types. Second word
70  MASK_ValidTriggerTypesHigh2 = 0xFFFFFFFF, //! Logical OR of all valid trigger types. Third word
71  MASK_TriggerListIDX = 0xFFFFFFFF,
73  MASK_Reserved1 = 0xFFFFFFFF,
74  MASK_Reserved2 = 0xFFFFFFFF,
75  MASK_CRC = 0xFFFFFFFF
76  };
77 
79  WORD_MarkerHi = 0, //! Marker Mask upper word (32 bits)
80  WORD_MarkerLo = 1, //! Marker Mask lower word (32 bits)
81  WORD_RunNumber = 2, //! Run number (24 bits)
82  WORD_RunType = 2, //! Run type (8 bits)
83  WORD_ConfigIDX = 3, //! Detector configuration identifier (16 bits)
84  WORD_Partition = 3, //! Partition identifier that Run Control and Data Logger belong to (8 bits)
85  WORD_Subrun = 3, //! Subrun number (6 bits)
86  WORD_ConfigurationBlockSet = 3, //! Is the configuration Block set? (1bit)
87  WORD_Version = 4, //! Run Header Version (8 bits)
88  WORD_RunControlVersion = 4, //! Run Control version (8 bits)
89  WORD_RunControlID = 4, //! Run control identifier (16 bits)
90  WORD_DataLoggerVersion = 5, //! Data Logger version (12 bits)
91  WORD_DataLoggerID = 5, //! Data Logger identifier (16 bits)
92  WORD_RunStartTime = 6, //! Run Start Time (32 bits)
93  WORD_SubRunStartTime = 7, //! SubRun Start Time (32 bits)
94  WORD_SubRunEndTime = 8, //! SubRun End Time (32 bits)
95  WORD_RunEndTime = 9, //! Run End Time (32 bits)
96  WORD_TotalEvents = 10, //! Total number of events (32 bits)
97  WORD_UniversalEventStartLo = 11, //! Universal event number lower 32 bits
98  WORD_UniversalEventStartHi = 12, //! Universal event number higher 8 bits
99  WORD_UniversalEventEndLo = 13, //! Universal event number lower 32 bits
100  WORD_UniversalEventEndHi = 14, //! Universal event number higher 8 bits
101  WORD_RunSize = 15, //! Size of the run in words
102  WORD_TriggerVersion = 16, //! Trigger version (12 bits)
103  WORD_TriggerCtrlID = 16,//! Identifier of the global trigger processor (16 bits)
104  WORD_TriggerMC = 17,//! MC triggering flag
105  WORD_VTMod = 17,//! Valid trigger modification modes
106  WORD_ValidTriggerTypesLow = 17, //! Logical OR of all valid trigger types. First word
107  WORD_ValidTriggerTypesHigh = 18, //! Logical OR of all valid trigger types. Second word
108  WORD_ValidTriggerTypesHigh2 = 19, //! Logical OR of all valid trigger types. Third word
111  WORD_Reserved1 = 22,
112  WORD_Reserved2 = 23,
113  WORD_CRC = 24
114  };
115 
116 
117  DEFINE_SHIFT_FROM_MASK(MarkerHi );
118  DEFINE_SHIFT_FROM_MASK(MarkerLo );
119  DEFINE_SHIFT_FROM_MASK(RunNumber );
121  DEFINE_SHIFT_FROM_MASK(ConfigIDX );
122  DEFINE_SHIFT_FROM_MASK(Partition );
123  DEFINE_SHIFT_FROM_MASK(Subrun );
124  DEFINE_SHIFT_FROM_MASK(ConfigurationBlockSet );
125  DEFINE_SHIFT_FROM_MASK(Version );
126  DEFINE_SHIFT_FROM_MASK(RunControlVersion );
127  DEFINE_SHIFT_FROM_MASK(RunControlID );
128  DEFINE_SHIFT_FROM_MASK(DataLoggerVersion );
129  DEFINE_SHIFT_FROM_MASK(DataLoggerID );
130  DEFINE_SHIFT_FROM_MASK(RunStartTime );
131  DEFINE_SHIFT_FROM_MASK(SubRunStartTime );
132  DEFINE_SHIFT_FROM_MASK(SubRunEndTime );
133  DEFINE_SHIFT_FROM_MASK(RunEndTime );
134  DEFINE_SHIFT_FROM_MASK(TotalEvents );
135  DEFINE_SHIFT_FROM_MASK(UniversalEventStartLo );
136  DEFINE_SHIFT_FROM_MASK(UniversalEventStartHi );
137  DEFINE_SHIFT_FROM_MASK(UniversalEventEndLo );
138  DEFINE_SHIFT_FROM_MASK(UniversalEventEndHi );
139  DEFINE_SHIFT_FROM_MASK(RunSize );
141  DEFINE_SHIFT_FROM_MASK(TriggerCtrlID );
142  DEFINE_SHIFT_FROM_MASK(TriggerMC );
143  DEFINE_SHIFT_FROM_MASK(VTMod );
144  DEFINE_SHIFT_FROM_MASK(ValidTriggerTypesLow );
145  DEFINE_SHIFT_FROM_MASK(ValidTriggerTypesHigh );
146  DEFINE_SHIFT_FROM_MASK(ValidTriggerTypesHigh2 );
147  DEFINE_SHIFT_FROM_MASK(TriggerListIDX );
148  DEFINE_SHIFT_FROM_MASK(TriggerPrescaleListIDX );
149  DEFINE_SHIFT_FROM_MASK(Reserved1 );
150  DEFINE_SHIFT_FROM_MASK(Reserved2 );
152  }// end of namespace rawrunhdr
153 
154 
155  class RawRunHeader: public PREVIOUS_VERSION_CLASS_NAME {
156  public:
157 
158  RawRunHeader (const version_t); ///< The default constructor
159  RawRunHeader (const RawRunHeader&);
160  ~RawRunHeader(); ///< Destructor
161 
162  void init ();
164  void print (std::ostream& os=std::cout) const;
166  using RawDAQData::readData;
167  void* readData(const void* pointer){return RawDAQData::readDataGeneral(pointer);};
168 
169  protected:
170 
171  IMPLEMENT_FIRST_GET (MarkerHi , uint32_t);
172  IMPLEMENT_FIRST_SET (MarkerHi , uint32_t);
173  IMPLEMENT_FIRST_GET (MarkerLo , uint32_t);
174  IMPLEMENT_FIRST_SET (MarkerLo , uint32_t);
175  IMPLEMENT_FIRST_GET (Reserved1 , uint32_t);
176  IMPLEMENT_FIRST_SET (Reserved1 , uint32_t);
177  IMPLEMENT_FIRST_GET (Reserved2 , uint32_t);
178  IMPLEMENT_FIRST_SET (Reserved2 , uint32_t);
179  IMPLEMENT_FIRST_GET (Version , uint32_t);
180  IMPLEMENT_FIRST_SET (Version , uint32_t);
181  IMPLEMENT_FIRST_GET_AND_SET(RunNumber , uint32_t);
183  IMPLEMENT_FIRST_GET_AND_SET(ConfigIDX , uint32_t);
184  IMPLEMENT_FIRST_GET_AND_SET(Partition , uint32_t);
185  IMPLEMENT_FIRST_GET_AND_SET(Subrun , uint32_t);
186  IMPLEMENT_FIRST_GET_AND_SET(ConfigurationBlockSet , uint32_t);
187  IMPLEMENT_FIRST_GET_AND_SET(RunControlVersion , uint32_t);
188  IMPLEMENT_FIRST_GET_AND_SET(RunControlID , uint32_t);
189  IMPLEMENT_FIRST_GET_AND_SET(DataLoggerVersion , uint32_t);
190  IMPLEMENT_FIRST_GET_AND_SET(DataLoggerID , uint32_t);
191  IMPLEMENT_FIRST_GET_AND_SET(RunStartTime , uint32_t);
192  IMPLEMENT_FIRST_GET_AND_SET(SubRunStartTime , uint32_t);
193  IMPLEMENT_FIRST_GET_AND_SET(SubRunEndTime , uint32_t);
194  IMPLEMENT_FIRST_GET_AND_SET(RunEndTime , uint32_t);
195  IMPLEMENT_FIRST_GET_AND_SET(TotalEvents , uint32_t);
196  IMPLEMENT_FIRST_GET_AND_SET(UniversalEventStartLo , uint32_t);
197  IMPLEMENT_FIRST_GET_AND_SET(UniversalEventStartHi , uint32_t);
198  IMPLEMENT_FIRST_GET_AND_SET(UniversalEventEndLo , uint32_t);
199  IMPLEMENT_FIRST_GET_AND_SET(UniversalEventEndHi , uint32_t);
200  IMPLEMENT_FIRST_GET_AND_SET(RunSize , uint32_t);
202  IMPLEMENT_FIRST_GET_AND_SET(TriggerCtrlID , uint32_t);
203  IMPLEMENT_FIRST_GET_AND_SET(TriggerMC , uint32_t);
204  IMPLEMENT_FIRST_GET_AND_SET(VTMod , uint32_t);
205  IMPLEMENT_FIRST_GET_AND_SET(ValidTriggerTypesLow , uint32_t);
206  IMPLEMENT_FIRST_GET_AND_SET(ValidTriggerTypesHigh , uint32_t);
207  IMPLEMENT_FIRST_GET_AND_SET(ValidTriggerTypesHigh2, uint32_t);
208  IMPLEMENT_FIRST_GET_AND_SET(TriggerListIDX , uint32_t);
209  IMPLEMENT_FIRST_GET_AND_SET(TriggerPrescaleListIDX, uint32_t);
210  IMPLEMENT_FIRST_GET_AND_SET(CRC , uint32_t);
211 
212  INIT_FIRST(getUniversalEventStart, const,uint64_t, );
213  INIT_FIRST(setUniversalEventStart, ,bool , const uint64_t);
214  INIT_FIRST(getUniversalEventEnd , const,uint64_t, );
215  INIT_FIRST(setUniversalEventEnd , ,bool , const uint64_t);
216 
217  INIT_FIRST(setTail , ,bool, );
218  INIT_FIRST(close , ,bool, );
219  INIT_FIRST(advanceEventNumber , ,bool, );
220 
221  INIT_FIRST(addValidTriggerTypesLow , ,bool , const uint32_t);
222  INIT_FIRST(addValidTriggerTypesHigh , ,bool , const uint32_t);
223  INIT_FIRST(addValidTriggerTypesHigh2, ,bool , const uint32_t);
224  INIT_FIRST(addRunSize , ,bool , const uint32_t);
225 
226  };
227 
228 
229  }} // END NAMESPCE daqdataformats
230 #endif /* RAWRUNHEADERV0_H */
void * readDataGeneral(const void *buffer)
General ReadData method when the sizeofdata is known.
Definition: RawDAQData.cpp:186
#define IMPLEMENT_FIRST_GET(FUNC, UNITS)
Definition: Macros.h:154
#define IMPLEMENT_FIRST_SET(FUNC, UNITS)
Definition: Macros.h:157
#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)
#define CURRENT_FIELDS_SUB_NAMESPACE
bool print
Partition identifier that Run Control and Data Logger belong to (8 bits)
OStream cout
Definition: OStream.cxx:6
void * readData(const void *buffer)
Shallow copy constructor.
Definition: RawDAQData.cpp:181
int32_t version_t
Definition: RawDAQData.h:72
Class to hold the data from the FEBs in correct formats.
procfile close()