RawTriggerHeaderV0.h
Go to the documentation of this file.
1 #ifndef DAQRAWTRIGGERHEADERV0_H
2 #define DAQRAWTRIGGERHEADERV0_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 RawTriggerHeader
17 #define CURRENT_CLASS_VERSION 0
18 #define CURRENT_FIELDS_SUB_NAMESPACE triggerheader
19 #include "DAQDataFormats/DataFormatLast.inc"
20 
21 namespace daqdataformats {
22 
24  const static uint32_t TriggerHeaderDelimiter = 0xAAAA;
25  }
26 
27  namespace VERSION_NAMESPACE {
29  static const uint32_t TRIGGERHEADER_SIZE = 6;
30 
32  MASK_Delimiter = 0xFFFF0000,
33  MASK_Version = 0x00000FFF,
34  MASK_HWFlag = 0x80000000,
35  MASK_Source = 0x78000000,
36  MASK_SourceSubID = 0x00FF0000,
37  MASK_SourceID = 0x0000FFFF,
38  MASK_TriggerNumberLow = 0xFFFFFFFF,
39  MASK_TriggerNumberHigh = 0x000000FF,
42  };// end of TriggerHeaderMASKS
43 
44 
47  WORD_Version = 0,
56  };
57 
58  DEFINE_SHIFT_FROM_MASK(Delimiter);
59  DEFINE_SHIFT_FROM_MASK(Version);
60  DEFINE_SHIFT_FROM_MASK(HWFlag);
61  DEFINE_SHIFT_FROM_MASK(Source);
62  DEFINE_SHIFT_FROM_MASK(SourceSubID);
63  DEFINE_SHIFT_FROM_MASK(SourceID);
64  DEFINE_SHIFT_FROM_MASK(TriggerNumberLow);
65  DEFINE_SHIFT_FROM_MASK(TriggerNumberHigh);
66  DEFINE_SHIFT_FROM_MASK(MasterTriggerNumberLow);
67  DEFINE_SHIFT_FROM_MASK(MasterTriggerNumberHigh);
68  }// end of namespace triggerheader
69 
70  //! Class to hold the data from the global trigger header in the correct format
71  /*!
72  The RawTriggerHeaderV0 contains the basic information required to
73  reconstruct where and how the trigger was generated.
74 
75  The class supports general initialization with an internal or external
76  data buffer as well as copyin style initialization for use with
77  STL containers.
78  */
79  class RawTriggerHeader: public PREVIOUS_VERSION_CLASS_NAME {
80 
81  public:
82 
83  RawTriggerHeader (const version_t); ///< The default constructor
85  ~RawTriggerHeader(); ///< Destructor
86 
87  void init ();
89  void print (std::ostream& os=std::cout) const;
91 
92  /// Nanoslice of version 0 is a fixed size format
94  void* readData(const void* pointer){return RawDAQData::readDataGeneral(pointer);};
95 
96  IMPLEMENT_FIRST_GET_AND_SET(Delimiter , uint32_t);
97  IMPLEMENT_FIRST_GET_AND_SET(Version , uint32_t);
98  IMPLEMENT_FIRST_GET_AND_SET(HWFlag , uint32_t);
99  IMPLEMENT_FIRST_GET_AND_SET(Source , uint32_t);
100  IMPLEMENT_FIRST_GET_AND_SET(SourceID , uint32_t);
101  IMPLEMENT_FIRST_GET_AND_SET(SourceSubID , uint32_t);
102  IMPLEMENT_FIRST_GET_AND_SET(TriggerNumberLow , uint32_t);
103  IMPLEMENT_FIRST_GET_AND_SET(TriggerNumberHigh , uint32_t);
104  IMPLEMENT_FIRST_GET_AND_SET(MasterTriggerNumberLow , uint32_t);
105  IMPLEMENT_FIRST_GET_AND_SET(MasterTriggerNumberHigh, uint32_t);
106 
107  INIT_FIRST(getMasterTriggerNumber, const, uint64_t, );
108  INIT_FIRST(setMasterTriggerNumber, , bool , const uint64_t);
109  INIT_FIRST(getTriggerNumber , const, uint64_t, );
110  INIT_FIRST(setTriggerNumber , , bool , const uint64_t);
111 
112  };
113 
114 
115  }} // END NAMESPCE daqdataformats
116 #endif /* DAQRAWTRIGGERHEADERV0_H */
void * readDataGeneral(const void *buffer)
General ReadData method when the sizeofdata is known.
Definition: RawDAQData.cpp:186
#define VERSION_NAMESPACE
#define CURRENT_FIELDS_SUB_NAMESPACE
#define INIT_FIRST(FUNC, CONSTNESS, OUTPUT_UNITS,...)
Definition: Macros.h:239
#define IMPLEMENT_FIRST_GET_AND_SET(FUNC, UNITS)
Definition: Macros.h:171
Class to hold the data from the global trigger header in the correct format.
bool print
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.