RawMicroBlockHeaderV0.h
Go to the documentation of this file.
1 #ifndef RAWMICROBLOCKHEADERV0_H
2 #define RAWMICROBLOCKHEADERV0_H
3 #include "DAQDataFormats/RawDAQData.h"
4 #include "DAQDataFormats/Macros.h"
5 #include "DAQDataFormats/BitFields.h"
6 #include "DAQDataFormats/RawDCMChan.h"
7 
8 /// It is requred to
9 /// 1. include DAQDataFormats/DataFormatFirst.inc
10 /// 2. define CURRENT_CLASS
11 /// 3. define CURRENT_CLASS_VERSION for version of the class
12 /// OR define LAST_CLASS_VERSION for the main structure of the class
13 /// 4. (optional) define CURRENT_FIELDS_SUB_NAMESPACE
14 /// 5. include DAQDataFormats/DataFormatLast.inc
15 /// before the declaration of the DataFormat version class in the header.
16 #include "DAQDataFormats/DataFormatFirst.inc"
17 #define CURRENT_CLASS RawMicroBlockHeader
18 #define CURRENT_CLASS_VERSION 0
19 #define CURRENT_FIELDS_SUB_NAMESPACE rawmicroblockhdr
20 #include "DAQDataFormats/DataFormatLast.inc"
21 
22 namespace daqdataformats {
23 namespace VERSION_NAMESPACE {
25 
26  static const uint32_t RAWMICROBLOCKHEADER_SIZE = 1;
27  static const uint32_t RAWMICROBLOCKHEADER_SIZE_PLUS_ONE = RAWMICROBLOCKHEADER_SIZE + 1;
28 
30  MASK_Partition = 0xFC000000, //! Partition ( 6 bits)
31  MASK_V0 = 0x02000000, //! First Version bit ( 1 bit)
32  MASK_DestBuffID = 0x01FF0000, //! Dest Buffer ID Mask ( 9 bits, 512 buffer nodes)
33  MASK_DCMChan = 0x0000FFFF,
34  };
35 
37  WORD_Partition = 0,
38  WORD_V0 = 0,
41  };
42 
43  DEFINE_SHIFT_FROM_MASK(Partition);
45  DEFINE_SHIFT_FROM_MASK(DestBuffID);
46  DEFINE_SHIFT_FROM_MASK(DCMChan);
47  }// end of namespace rawmicroblockhdr
48 
49 
50 
51  class RawMicroBlockHeader: public PREVIOUS_VERSION_CLASS_NAME {
52 
53  public:
54 
55  // Constructors
59 
60  void init ();
62  void print (std::ostream& os=std::cout) const;
64  bool setBufferSource(const void* pointer);
65 
66  /// RawMicroBlockHeader is a fixed size format
68  void* readData(const void* pointer){return RawDAQData::readDataGeneral(pointer);};
69 
70  daqdataformats::RawDCMChan* getDCMChan() {return _DCMChan;}
71 
72  bool setAllParameters(const void*);
73 
74  uint32_t getDiblockId() const {return _DCMChan->getDiblockId();}
75  uint32_t getDCMId() const {return _DCMChan->getDCMId();}
76  uint32_t getDetId() const {return _DCMChan->getDetId();}
77  uint32_t getGlobalDCMID() const {return _DCMChan->getGlobalDCMID();}
78 
79  bool setDiblockId (const uint32_t a) {return _DCMChan->setDiblockId(a);}
80  bool setDCMId (const uint32_t a) {return _DCMChan->setDCMId(a);}
81  bool setDetId (const uint32_t a) {return _DCMChan->setDetId(a);}
82  bool setGlobalDCMID(const uint32_t a) {return _DCMChan->setGlobalDCMID(a);}
83 
84  // V1 field is defined in versions greater than 0
85  uint32_t getV1( ) const { GENERATE_FUNCTION_IS_NOT_ALLOWED; return 0;}
86  bool setV1(const uint32_t) { return GENERATE_FUNCTION_IS_NOT_ALLOWED;}
87 
88  protected:
89 
90  IMPLEMENT_FIRST_GET_AND_SET(DestBuffID, uint32_t);
91  IMPLEMENT_FIRST_GET_AND_SET(Partition , uint32_t);
92  IMPLEMENT_FIRST_GET_AND_SET(V0 , uint32_t);
93 
94  INIT_FIRST(getVersion , const, uint32_t, );
95  INIT_FIRST(setVersion , , bool ,uint32_t);
96 
97 
98  protected:
99  daqdataformats::RawDCMChan* _DCMChan; //<! DCM identifier
100  };
101 
102 
103 }} // END NAMESPCE daqdataformats
104 #endif /* RAWMICROBLOCKHEADERV0_H */
void * readDataGeneral(const void *buffer)
General ReadData method when the sizeofdata is known.
Definition: RawDAQData.cpp:186
#define GENERATE_FUNCTION_IS_NOT_ALLOWED
calling functionIsNotAllowed
Definition: RawDAQData.h:21
#define VERSION_NAMESPACE
Configuration IDX (Configuration Database table number) (16 bits)
#define INIT_FIRST(FUNC, CONSTNESS, OUTPUT_UNITS,...)
Definition: Macros.h:239
#define IMPLEMENT_FIRST_GET_AND_SET(FUNC, UNITS)
Definition: Macros.h:171
const double a
bool print
#define CURRENT_FIELDS_SUB_NAMESPACE
Configuration IDX (Configuration Database table number) (16 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.