RawEvent.h
Go to the documentation of this file.
1 #ifndef RAWEVENT_H
2 #define RAWEVENT_H
3 #include "DAQDataFormats/RawEventV1.h"
4 #include "DAQDataFormats/RawEventHeader.h"
5 #include "DAQDataFormats/RawEventTail.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 RawEvent
17 #define LAST_CLASS_VERSION 1
18 #define CURRENT_FIELDS_SUB_NAMESPACE rawevent
19 #include "DAQDataFormats/DataFormatLast.inc"
20 
21 namespace daqdataformats {
22 
23  //--------------------------------------------------------------------------
24  /// Function to get the tail version from Event version
25  inline version_t getTailVersion(const version_t event_version){
26 
29 
30  const RawEventHeader header(event_version);
31  return header.getTailVersion();
32  }
33 
34  //--------------------------------------------------------------------------
35  /// Function to get the tail size from Event version
36  inline uint32_t getTailSize(const version_t event_version){
37  const version_t event_tail_version = getTailVersion(event_version);
38 
39  if(event_tail_version == rawdaqdataformat::DAQDATAFORMAT_UNKNOWN_VERSION)
40  return 0;
41 
42  const RawEventTail tail(event_tail_version);
43  return tail.sizeofdata();
44  }
45 
46  static const uint32_t DEFAULT_EVENT_SIZE = 262144; /* Maximum MicroBlock Buffer Size 64k */
47 
48  class RawEvent : public PREVIOUS_VERSION_CLASS_NAME {
49 
50  public:
51  /// Constructors
52  RawEvent (const uint32_t buffersize = DEFAULT_EVENT_SIZE, const version_t version=raweventhdr::RAWEVENTHEADER_LATEST_VERSION); //! The default constructor
53  RawEvent (const RawEvent& copy_in); //! Deep copy constructor
54  RawEvent (const void* datablock_buffer, const version_t version = rawdaqdataformat::DAQDATAFORMAT_UNKNOWN_VERSION); //! Shallow copy constructor
55  /// Destructor
56  ~RawEvent();
57 
60 
62  bool addDataBlock (const void* buffer, const uint32_t size){ RETURN_FUNCTION(addDataBlockWithSize)(buffer, size);}
63  bool close (const bool produce_crc=false) {RETURN_FUNCTION(close)(produce_crc);}
65  bool setTrigger(const void* buffer) {RETURN_FUNCTION(setTrigger2)(buffer);}
66 
67  /// Next event. Advance the event number and clear the DataBlocks and CRC
69 
74 
75  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_0PAR(getHeaderMarkerLeft , const, uint32_t)
76  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_0PAR(getHeaderMarkerRight, const, uint32_t)
77  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_0PAR(getVersion , const, uint32_t)
78  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_0PAR(getDataLoggerID , const, uint32_t)
79  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_0PAR(getRunNumber , const, uint32_t)
80  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_0PAR(getRunType , const, uint32_t)
81  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_0PAR(getConfigIDX , const, uint32_t)
82  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_0PAR(getPartition , const, uint32_t)
83  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_0PAR(getSubrun , const, uint32_t)
84  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_0PAR(getEventNumberLo , const, uint32_t)
85  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_0PAR(getEventNumberHi , const, uint32_t)
86  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_0PAR(getEventNumber , const, uint64_t)
87  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_0PAR(getEventType , const, uint32_t)
88  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_0PAR(getEventSize , const, uint32_t)
89  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_0PAR(getDataBlockNumber , const, uint32_t)
90  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_0PAR(isEventIncomplete , const, bool)
91  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_0PAR(getMonteCarloFlag , const, bool)
92  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_0PAR(isCRCCalculationUsed, const, bool)
93  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_1PAR(setTriggerPointer , , bool, const void*)
94 
95  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_1PAR(setDataLoggerID , , bool, const uint32_t)
96  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_1PAR(setRunNumber , , bool, const uint32_t)
97  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_1PAR(setRunType , , bool, const uint32_t)
98  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_1PAR(setConfigIDX , , bool, const uint32_t)
99  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_1PAR(setPartition , , bool, const uint32_t)
100  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_1PAR(setSubrun , , bool, const uint32_t)
101  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_1PAR(setEventNumberLo , , bool, const uint32_t)
102  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_1PAR(setEventNumberHi , , bool, const uint32_t)
103  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_1PAR(setEventNumber , , bool, const uint64_t)
104  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_1PAR(setEventType , , bool, const uint32_t)
105  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_1PAR(setEventIncomplete , , bool, const bool)
106  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_1PAR(setMonteCarloFlag , , bool, const bool)
107  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_1PAR(setFloatingDataBlock, const ,bool, const uint32_t)
108 
110 
111  protected:
116 
117  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_1PAR(setAppropriateMCFlag, , bool, const void*)
118 
119  IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_1PAR(setFloatingDataBlockToBufferSource, const, bool, const void*)
120 
121  bool setFunctionPointers();
122 
123 
124  };// end of class definition
125 
126 } // END NAMESPCE daqdataformats
127 #endif /* RAWEVENT_H */
bool addDataBlock(const void *buffer, const uint32_t size)
Definition: RawEvent.h:62
bool close(const bool produce_crc=false)
Definition: RawEvent.h:63
#define IMPLEMENT_MAIN_STANDARD
Definition: Macros.h:230
#define IMPLEMENT_MAIN_setBufferSource
Definition: Macros.h:228
::xsd::cxx::tree::buffer< char > buffer
Definition: Database.h:179
Class to hold the data from the global trigger in the correct format.
Definition: RawTrigger.h:40
bool setFunctionPointers()
Next event. Advance the event number and clear the DataBlocks and CRC.
#define RETURN_FUNCTION(FULLFUNCTIONNAME)
Definition: Macros.h:57
#define IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_0PAR(FUNC, CONSTNESS, OUTPUT)
Definition: Macros.h:181
IMPLEMENT_MAIN_STANDARD IMPLEMENT_MAIN_setBufferSource bool addDataBlock(const void *buffer)
Definition: RawEvent.h:61
bool setTrigger(const daqdataformats::RawTrigger &tr)
Definition: RawEvent.h:64
#define IMPLEMENT_FUNCTION_RETURNING_FUNCTION_POINTER_1PAR(FUNC, CONSTNESS, OUTPUT, INP1)
Definition: Macros.h:183
uint32_t getTailSize(const version_t event_version)
Function to get the tail size from Event version.
Definition: RawEvent.h:36
version_t getTailVersion(const version_t event_version)
Function to get the tail version from Event version.
Definition: RawEvent.h:25
static const uint32_t DEFAULT_EVENT_SIZE
Definition: RawEvent.h:46
static const version_t RAWEVENTHEADER_LATEST_VERSION
RawEvent(const uint32_t buffersize=DEFAULT_EVENT_SIZE, const version_t version=raweventhdr::RAWEVENTHEADER_LATEST_VERSION)
Constructors.
Definition: RawEvent.cpp:23
const XML_Char * version
Definition: expat.h:187
#define IMPLEMENT_FIGUREOUT_VERSION_STATIC(CLASS)
This should be in the header.
Definition: Macros.h:295
bool setTrigger(const void *buffer)
Definition: RawEvent.h:65
int32_t version_t
Definition: RawDAQData.h:72
def tail(path, window=20)
Definition: log_trawl.py:24
static const version_t DAQDATAFORMAT_UNKNOWN_VERSION
Definition: RawDAQData.h:81
Class to hold the data from the FEBs in correct formats.
~RawEvent()
Destructor.
Definition: RawEvent.cpp:48