RawMicroSliceHeaderV0.cpp
Go to the documentation of this file.
1 #include "DAQDataFormats/RawMicroSliceHeaderV0.h"
2 #include "DAQDataFormats/RawTimingMarker.h"
3 #include <boost/format.hpp>
4 
5 /// It is requred to
6 /// 1. include DAQDataFormats/DataFormatFirst.inc
7 /// 2. define CURRENT_CLASS
8 /// 3. define CURRENT_CLASS_VERSION for version of the class
9 /// OR define LAST_CLASS_VERSION for the main structure of the class
10 /// 4. (optional) define CURRENT_FIELDS_SUB_NAMESPACE
11 /// 5. include DAQDataFormats/DataFormatLast.inc
12 /// before the declaration of the DataFormat version class in the header.
13 #include "DAQDataFormats/DataFormatFirst.inc"
14 #define CURRENT_CLASS RawMicroSliceHeader
15 #define CURRENT_CLASS_VERSION 0
16 #define CURRENT_FIELDS_SUB_NAMESPACE rawmuhdr
17 #include "DAQDataFormats/DataFormatLast.inc"
18 
19 namespace daqdataformats{
20 namespace VERSION_NAMESPACE{
21 
22 //------------------------Constructors------------------------------------------
24  PREVIOUS_VERSION_CLASS_NAME(version, (sizeofdata_t) &RawMicroSliceHeader::sizeofdata) ///< it is assumed that the size of data is the same
25  ,ZEROOUT_GET_AND_SET (Extra)
26  ,ZEROOUT_GET_AND_SET (Status)
27 {}
28 
29 //------------------------------------------------------------------------------
31  PREVIOUS_VERSION_CLASS_NAME(copyin)
32  ,DEEPCOPY_GET_AND_SET (Extra)
33  ,DEEPCOPY_GET_AND_SET (Status)
34 {}
35 
36 //------------------------Destructor--------------------------------------------
38 
39 //------------------------------------------------------------------------------
40 // Default initialization at wherever the pointer points
42 {
43  initSoft();
44 
45  /// Set version in the buffer
47 }
48 
49 //------------------------------------------------------------------------------
51  for(uint32_t i=0; i< sizeofdata(); ++i){
52  RAWBUFF32[i] = 0;
53  }
55 }
56 
57 //------------------------------------------------------------------------------
58 // Add byte count. When adding a NanoSlice a ByteCount is increased by 12;
59 // After that. DataPresent is always true.
61 {
62  setByteCount(getByteCount() + nbytes);
63  return setDataPresent(true);
64 }
65 
66 //------------------------------------------------------------------------------
68 {
69  setByteCount(sizeof(uint32_t) * RAWTIMINGMARKER_SIZE);
70  return setDataPresent(false);
71 }
72 
73 //------------------------------------------------------------------------------
75 {
76  return sizeofdata() + getByteCount() / 4;
77 }
78 
79 //------------------------------------------------------------------------------
80 uint32_t RawMicroSliceHeader::getStatus() const { GENERATE_FUNCTION_IS_NOT_ALLOWED; return 0;}
81 //------------------------------------------------------------------------------
82 bool RawMicroSliceHeader::setStatus(const uint32_t) { return GENERATE_FUNCTION_IS_NOT_ALLOWED;}
83 
84 //------------------------------------------------------------------------------
86 {
88  BITFIELDSET(*pointer, val, VERSION_NAMESPACE::CURRENT_FIELDS_SUB_NAMESPACE::MASK_Version, VERSION_NAMESPACE::CURRENT_FIELDS_SUB_NAMESPACE::SHIFT_Version);
89  return true;
90 }
91 
92 //------------------------------------------------------------------------------
93 // Printing method
94 void RawMicroSliceHeader::print(std::ostream& os) const
95 {
96 
97  os<<boost::format("MicroSlice Header: Version=%d DP=%d SIM=%d Extra=%d Timeout=%d, LBC=%d\n")
98  % getVersion()
99  % getDataPresent()
100  % getMonteCarloFlag()
101  % EXECUTE_FUNCTION(getExtra)()
102  % getTimeout()
103  % getByteCount()
104  ;
105 
106  printBuffer(os);
107 
108  //os<<"RAW(binary):";
109  //printWord(0,true, os);
110  //os<<std::endl;
111 }// end of print1
112 
113 }}// end of daqdataformats::version0
#define EXECUTE_FUNCTION(FULLFUNCTIONNAME)
Execute and return the delegate.
Definition: Macros.h:54
#define DEEPCOPY_GET_AND_SET(FUNC)
Definition: FunctionBind.h:44
#define sizeofdata_t
Definition: FunctionBind.h:30
static const uint32_t RAWTIMINGMARKER_SIZE
#define GENERATE_FUNCTION_IS_NOT_ALLOWED
calling functionIsNotAllowed
Definition: RawDAQData.h:21
#define VERSION_NAMESPACE
void initSoft()
initing without setting the version field
#define ZEROOUT_GET_AND_SET(FUNC)
Definition: FunctionBind.h:56
std::string format(const int32_t &value, const int &ndigits=8)
Definition: HexUtils.cpp:14
const XML_Char * version
Definition: expat.h:187
#define BITFIELDSET(block, data, mask, shift)
Definition: BitFields.h:24
#define RAWBUFF32
Definition: RawDAQData.h:16
Long64_t nbytes
int32_t version_t
Definition: RawDAQData.h:72
Class to hold the data from the FEBs in correct formats.