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
10{
11 // Default constructor
12 fData.resize(0);
13}
14
15void TRlmdEvent::Copy(TObject& rhs) const
16{
17 // Copies the entire TRlmdEvent.
18 static_cast<TRlmdEvent&>(rhs).fData = fData;
19}
20
22{
23 // Copy ctor.
24 rhs.Copy(*this);
25}
26
31
33{
34 if(&rhs != this) {
35 Clear();
36 }
37
38 rhs.Copy(*this);
39 return *this;
40}
41
42void TRlmdEvent::Clear(Option_t*)
43{
44 // Clears the TRlmdEvent.
45 fData.clear();
46}
47
48void TRlmdEvent::SetData(std::vector<char> buffer)
49{
50 // Sets the data in the TRlmdEvent as the data argument passed into
51 // this function.
52 fData = buffer;
53 SwapBytes(false);
54}
55
57{
58 return fData.size();
59}
60
62{
63 // returns the allocated data.
64 return fData.data();
65}
66
67void TRlmdEvent::Print(const char* option) const
68{
69 /// Print data held in this class.
70 /// \param [in] option If 'a' (for "all") then the raw data will be
71 /// printed out too.
72 ///
73
74 std::cout << "Event start:" << std::endl;
75 if(option[0] == 'a') {
76 for(size_t i = 0; i < fData.size() / 4; ++i) {
77 std::cout << hex(((uint32_t*)fData.data())[i], 8);
78 if(i % 10 == 9) {
79 std::cout << std::endl;
80 } else {
81 std::cout << " ";
82 }
83 }
84 }
85}
86
88{
89 return 1;
90}
91
92// end
std::string hex(T val, int width=-1)
Definition Globals.h:129
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
void SetData(std::vector< char > buffer)
set an externally allocated data buffer
char * GetData() override
return pointer to the 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
Definition TRlmdEvent.cxx:9