RawEventV0.h
Go to the documentation of this file.
1 #ifndef RAWEVENTV0_H
2 #define RAWEVENTV0_H
3 #include "DAQDataFormats/RawDAQData.h"
4 #include "DAQDataFormats/Macros.h"
5 
6 /// It is requred to
7 /// 1. include DAQDataFormats/DataFormatFirst.inc
8 /// 2. define CURRENT_CLASS
9 /// 3. define CURRENT_CLASS_VERSION for version of the class
10 /// OR define LAST_CLASS_VERSION for the main structure of the class
11 /// 4. (optional) define CURRENT_FIELDS_SUB_NAMESPACE
12 /// 5. include DAQDataFormats/DataFormatLast.inc
13 /// before the declaration of the DataFormat version class in the header.
14 #include "DAQDataFormats/DataFormatFirst.inc"
15 #define CURRENT_CLASS RawEvent
16 #define CURRENT_CLASS_VERSION 0
17 #define CURRENT_FIELDS_SUB_NAMESPACE rawevent
18 #include "DAQDataFormats/DataFormatLast.inc"
19 
20 // forward declarations
21 namespace daqdataformats{
22  class RawEventHeader;
23  class RawEventTail;
24  class RawDataBlock;
25  class RawTrigger;
26 }
27 
28 
29 namespace daqdataformats {
30 
32  static const int32_t MC_FLAG_UNKNOWN = -1;
33 
34  }// end of namespace rawevent
35 
36 
37 namespace VERSION_NAMESPACE {
38 
39 
40  class RawEvent : public PREVIOUS_VERSION_CLASS_NAME {
41 
42  public:
43  // Constructors
44  RawEvent (const version_t); //! The default constructor
45  RawEvent (const RawEvent&);
46  /// Destructor
47  ~RawEvent();
48 
49  void init ();
51  void print (std::ostream& os=std::cout) const;
52  uint32_t sizeofdata () const;
53  bool setBufferSource(const void* pointer);
54  using PREVIOUS_VERSION_CLASS_NAME::readData; // unhide the reset of the readData methods
55  void* readData(const void*);
56 
57  protected:
58 
59  ///Add a MicroSlice into the MilliSlice changing the MilliSlice Header appropriately
60  /// If check_mc_flag = true, the method checks whether the DataBlock is MC generated
61  /// and adds an appropriate flag to the Event Header.
62  INIT_FIRST(addDataBlock , , bool, const void*);
63  ///Add a MicroSlice of into the MilliSlice changing the MilliSlice Header appropriately
64  /// If check_mc_flag = true, the method checks whether the DataBlock is MC generated
65  /// and adds an appropriate flag to the Event Header.
66  INIT_FIRST(addDataBlockWithSize, , bool, const void*, const uint32_t);
67  INIT_FIRST(close, , bool, const bool);
68 
69  INIT_FIRST(setTrigger1, , bool, const daqdataformats::RawTrigger&);
70  INIT_FIRST(setTrigger2, , bool, const void*);
71 
72  INIT_FIRST(setFloatingDataBlockToBufferSource, const, bool, const void*);
73 
74 
75  /// Next event. Advance the event number and clear the DataBlocks and CRC
76  INIT_FIRST(nextEvent , , bool, );
77  INIT_FIRST(setAppropriateMCFlag, , bool, const void*);
78 
79  INIT_FIRST(getHeader , const, daqdataformats::RawEventHeader*, );
81  INIT_FIRST(getTrigger , , daqdataformats::RawTrigger*, );
82  INIT_FIRST(getFloatingDataBlock, , daqdataformats::RawDataBlock*, );
83 
84  INIT_FIRST(getHeaderConst , const, daqdataformats::RawEventHeader*, );
85  INIT_FIRST(getTailConst , const, daqdataformats::RawEventTail*, );
86  INIT_FIRST(getTriggerConst , const, daqdataformats::RawTrigger*, );
87  INIT_FIRST(getFloatingDataBlockConst, const, daqdataformats::RawDataBlock*, );
88 
89 
90  INIT_FIRST(getHeaderMarkerLeft , const, uint32_t, );
91  INIT_FIRST(getHeaderMarkerRight, const, uint32_t, );
92  INIT_FIRST(getVersion , const, uint32_t, );
93  INIT_FIRST(getDataLoggerID , const, uint32_t, );
94  INIT_FIRST(getRunNumber , const, uint32_t, );
95  INIT_FIRST(getRunType , const, uint32_t, );
96  INIT_FIRST(getConfigIDX , const, uint32_t, );
97  INIT_FIRST(getPartition , const, uint32_t, );
98  INIT_FIRST(getSubrun , const, uint32_t, );
99  INIT_FIRST(getEventNumberLo , const, uint32_t, );
100  INIT_FIRST(getEventNumberHi , const, uint32_t, );
101  INIT_FIRST(getEventNumber , const, uint64_t, );
102  INIT_FIRST(getEventType , const, uint32_t, );
103  INIT_FIRST(getEventSize , const, uint32_t, );
104  INIT_FIRST(getDataBlockNumber , const, uint32_t, );
105  INIT_FIRST(isEventIncomplete , const, bool, );
106  INIT_FIRST(getMonteCarloFlag , const, bool, );
107  INIT_FIRST(isCRCCalculationUsed, const, bool, );
108  INIT_FIRST(setTriggerPointer , , bool, const void*);
109 
110  INIT_FIRST(setDataLoggerID , , bool, const uint32_t);
111  INIT_FIRST(setRunNumber , , bool, const uint32_t);
112  INIT_FIRST(setRunType , , bool, const uint32_t);
113  INIT_FIRST(setConfigIDX , , bool, const uint32_t);
114  INIT_FIRST(setPartition , , bool, const uint32_t);
115  INIT_FIRST(setSubrun , , bool, const uint32_t);
116  INIT_FIRST(setEventNumberLo , , bool, const uint32_t);
117  INIT_FIRST(setEventNumberHi , , bool, const uint32_t);
118  INIT_FIRST(setEventNumber , , bool, const uint64_t);
119  INIT_FIRST(setEventType , , bool, const uint32_t);
120  INIT_FIRST(setEventIncomplete , , bool, const bool);
121  INIT_FIRST(setMonteCarloFlag , , bool, const bool);
122  INIT_FIRST(setFloatingDataBlock, const ,bool, const uint32_t);
123 
124  uint32_t getPredefinedSize() const {return 1;}
125  private:
126  /// Attempt to set the trigger to the pointer
127  bool tryToSetTrigger();
128  /// Attempt to set the Event Tail to the pointer
129  bool tryToSetTail ();
130 
131  protected:
132 
133  daqdataformats::RawEventHeader* _Header; //! RawEventV0 Header
134  daqdataformats::RawEventTail* _Tail; //! RawEventV0 Tail
136  mutable daqdataformats::RawDataBlock* _FloatingDataBlock; //! Floating DataBlock. The count starts from 0.
137  mutable int32_t _FloatingDataBlockNumber; //! Floating DataBlock number
138 
141 
142  int32_t _mcFlag;
144 
145  uint32_t _tailSize;
146  };
147 
148 
149 }} // END NAMESPCE daqdataformats
150 #endif /* RAWEVENTV0_H */
#define VERSION_NAMESPACE
version_t _triggerVersion
Floating DataBlock number.
Definition: RawEventV0.h:139
#define INIT_FIRST(FUNC, CONSTNESS, OUTPUT_UNITS,...)
Definition: Macros.h:239
daqdataformats::RawEventHeader * _Header
Definition: RawEventV0.h:133
Class to hold the data from the global trigger in the correct format.
Definition: RawTrigger.h:40
int32_t _FloatingDataBlockNumber
Floating DataBlock. The count starts from 0.
Definition: RawEventV0.h:137
#define CURRENT_FIELDS_SUB_NAMESPACE
Definition: RawEventV0.h:17
bool print
daqdataformats::RawDataBlock * _FloatingDataBlock
Trigger.
Definition: RawEventV0.h:136
OStream cout
Definition: OStream.cxx:6
daqdataformats::RawTrigger * _Trigger
RawEventV0 Tail.
Definition: RawEventV0.h:135
daqdataformats::RawEventTail * _Tail
RawEventV0 Header.
Definition: RawEventV0.h:134
int32_t version_t
Definition: RawDAQData.h:72
Class to hold the data from the FEBs in correct formats.
procfile close()