GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TRlmdEvent.cxx
Go to the documentation of this file.
1#include <cstdio>
2#include <cstdlib>
3#include <ctime>
4#include <cstring>
5#include <cassert>
6
7#include "TRlmdEvent.h"
8
9/// \cond CLASSIMP
11/// \endcond
12
14{
15 // Default constructor
16 fData.resize(0);
17}
18
19void TRlmdEvent::Copy(TObject& rhs) const
20{
21 // Copies the entire TRlmdEvent.
22 static_cast<TRlmdEvent&>(rhs).fData = fData;
23}
24
26{
27 // Copy ctor.
28 rhs.Copy(*this);
29}
30
35
37{
38 if(&rhs != this) {
39 Clear();
40 }
41
42 rhs.Copy(*this);
43 return *this;
44}
45
46void TRlmdEvent::Clear(Option_t*)
47{
48 // Clears the TRlmdEvent.
49 fData.clear();
50}
51
52void TRlmdEvent::SetData(std::vector<char>& buffer)
53{
54 // Sets the data in the TRlmdEvent as the data argument passed into
55 // this function.
56 fData = buffer;
57 SwapBytes(false);
58}
59
61{
62 return fData.size();
63}
64
66{
67 // returns the allocated data.
68 return fData.data();
69}
70
71void TRlmdEvent::Print(const char* option) const
72{
73 /// Print data held in this class.
74 /// \param [in] option If 'a' (for "all") then the raw data will be
75 /// printed out too.
76 ///
77
78 std::cout<<"Event start:"<<std::endl;
79 if(option[0] == 'a') {
80 for(size_t i = 0; i < fData.size() / 4; ++i) {
81 std::cout<<hex(((uint32_t*)fData.data())[i], 8);
82 if(i % 10 == 9) {
83 std::cout<<std::endl;
84 } else {
85 std::cout<<" ";
86 }
87 }
88 }
89}
90
92{
93 return 1;
94}
95
96// end
std::string hex(T val, int width=-1)
Definition Globals.h:129
ClassImp(THILMnemonic) void THILMnemonic
RAW event.
Definition TRawEvent.h:23
RLMD event.
Definition TRlmdEvent.h:22
int SwapBytes(bool) override
convert event data between little-endian (Linux-x86) and big endian (MacOS-PPC)
uint32_t GetDataSize() const override
return the event size
char * GetData() override
return pointer to the data buffer
void SetData(std::vector< char > &buffer)
set an externally allocated data buffer
std::vector< char > fData
event data buffer
Definition TRlmdEvent.h:45
void Print(const char *option="") const override
show all event information
~TRlmdEvent() override
destructor
TRlmdEvent & operator=(const TRlmdEvent &)
assignement operator
void Copy(TObject &) const override
copy helper
void Clear(Option_t *opt="") override
clear event for reuse
TRlmdEvent()
default constructor