GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TMidasEvent.h
Go to the documentation of this file.
1#ifndef TMIDASEVENT_H
2#define TMIDASEVENT_H
3
4/** \addtogroup Sorting
5 * @{
6 */
8#include "Globals.h"
9#include "TMidasEventHeader.h"
10#include "TDataParser.h"
11
12#include "TRawEvent.h"
13
14/////////////////////////////////////////////////////////////////
15///
16/// \class TMidasEvent
17///
18/// C++ class representing one midas event.
19///
20/// Objects of this class are created by reading
21/// midas events from a file, by reading
22/// them from a midas shared memory buffer or by
23/// receiving them through the mserver
24///
25/// Contains the information within a Midas Event. This
26/// usually includes a header, midas information such as timestamp
27/// bank id, etc. And the bank data. The bank data is usually
28/// the information supplied by either a scaler or the
29/// experimental DAQ system.
30///
31/////////////////////////////////////////////////////////////////
33/// MIDAS event
34
35class TMidasEvent : public TRawEvent {
36public:
37#include "TMidasBanks.h"
39 // houskeeping functions
40 TMidasEvent(); ///< default constructor
41 TMidasEvent(const TMidasEvent&); ///< copy constructor
42 TMidasEvent(TMidasEvent&&) noexcept = default;
43 TMidasEvent& operator=(const TMidasEvent&); ///< assignement operator
44 TMidasEvent& operator=(TMidasEvent&&) noexcept = default;
45 ~TMidasEvent() override; ///< destructor
46 void Clear(Option_t* opt = "") override; ///< clear event for reuse
47 void Copy(TObject&) const override; ///< copy helper
48 void Print(const char* option = "") const override; ///< show all event information
50 // get event information
51
52 uint16_t GetEventId() const; ///< return the event id
53 uint16_t GetTriggerMask() const; ///< return the triger mask
54 uint32_t GetSerialNumber() const; ///< return the serial number
55 uint32_t GetTimeStamp() const override; ///< return the time stamp (unix time in seconds)
56 uint32_t GetDataSize() const override; ///< return the event size
57
58 // get data banks
59
60 const char* GetBankList() const; ///< return a list of data banks
61 int FindBank(const char* name, int* bklen, int* bktype, void** pdata) const;
62 int LocateBank(const void* unused, const char* name, void** pdata) const;
63
64 bool IsBank32() const; ///< returns "true" if event uses 32-bit banks
65 int IterateBank(TMidas_BANK**, char** pdata) const; ///< iterate through 16-bit data banks
66 int IterateBank32(TMidas_BANK32**, char** pdata) const; ///< iterate through 32-bit data banks
67
68 // helpers for event creation
69
70 TMidas_EVENT_HEADER* GetEventHeader(); ///< return pointer to the event header
71 char* GetData() override; ///< return pointer to the data buffer
72
73 void AllocateData(); ///< allocate data buffer using the existing event header
74 void SetData(uint32_t size, char* data); ///< set an externally allocated data buffer
75
76 int SetBankList(); ///< create the list of data banks, return number of banks
77 bool IsGoodSize() const; ///< validate the event length
78
79 void SwapBytesEventHeader(); ///< convert event header between little-endian (Linux-x86) and big endian (MacOS-PPC)
80 int SwapBytes(bool) override; ///< convert event data between little-endian (Linux-x86) and big endian (MacOS-PPC)
81
82private:
84 char* fData; ///< event data buffer
85 int fBanksN; ///< number of banks in this event
86 char* fBankList; ///< list of bank names in this event
87 bool fAllocatedByUs; ///< "true" if we own the data buffer
88
89 /// \cond CLASSIMP
90 ClassDefOverride(TMidasEvent, 0) // All of the data contained in a Midas Event // NOLINT(readability-else-after-return)
91 /// \endcond
92};
93/*! @} */
94#endif // TMidasEvent.h
MIDAS event.
Definition TMidasEvent.h:35
bool IsBank32() const
returns "true" if event uses 32-bit banks
int IterateBank32(TMidas_BANK32 **, char **pdata) const
iterate through 32-bit data banks
TMidas_EVENT_HEADER * GetEventHeader()
return pointer to the event header
int fBanksN
number of banks in this event
Definition TMidasEvent.h:85
int SetBankList()
create the list of data banks, return number of banks
void SetData(uint32_t size, char *data)
set an externally allocated data buffer
void Clear(Option_t *opt="") override
clear event for reuse
char * GetData() override
return pointer to the data buffer
void AllocateData()
allocate data buffer using the existing event header
const char * GetBankList() const
return a list of data banks
int IterateBank(TMidas_BANK **, char **pdata) const
iterate through 16-bit data banks
uint16_t GetEventId() const
return the event id
void Print(const char *option="") const override
show all event information
uint32_t GetTimeStamp() const override
return the time stamp (unix time in seconds)
int FindBank(const char *name, int *bklen, int *bktype, void **pdata) const
TMidasEvent()
default constructor
bool fAllocatedByUs
"true" if we own the data buffer
Definition TMidasEvent.h:87
int LocateBank(const void *unused, const char *name, void **pdata) const
char * fData
event data buffer
Definition TMidasEvent.h:84
uint32_t GetSerialNumber() const
return the serial number
uint16_t GetTriggerMask() const
return the triger mask
int SwapBytes(bool) override
convert event data between little-endian (Linux-x86) and big endian (MacOS-PPC)
TMidasEvent(TMidasEvent &&) noexcept=default
TMidas_EVENT_HEADER fEventHeader
event header
Definition TMidasEvent.h:83
bool IsGoodSize() const
validate the event length
uint32_t GetDataSize() const override
return the event size
void Copy(TObject &) const override
copy helper
char * fBankList
list of bank names in this event
Definition TMidasEvent.h:86
void SwapBytesEventHeader()
convert event header between little-endian (Linux-x86) and big endian (MacOS-PPC)
RAW event.
Definition TRawEvent.h:23
16-bit data bank
Definition TMidasEvent.h:38