50#include "TRestEvent.h"
86 auto seconds = (Int_t)time;
87 auto nanoseconds = (Int_t)((time - seconds) * 1E9);
99 if (this->ClassName() != target->ClassName()) {
100 cout <<
"In TRestEvent::CloneTo() : Event type doesn't match! (This :" << this->ClassName()
101 <<
", Target : " << target->ClassName() <<
")" << endl;
105 TBufferFile buffer(TBuffer::kWrite);
106 buffer.MapObject(
this);
108 Bool_t isRef = this->TestBit(kIsReferenced);
109 ((TObject*)
this)->ResetBit(kIsReferenced);
111 ((TObject*)
this)->Streamer(buffer);
113 if (isRef) ((TObject*)
this)->SetBit(kIsReferenced);
117 buffer.SetReadMode();
119 buffer.SetBufferOffset(0);
120 buffer.MapObject(target);
121 target->Streamer(buffer);
122 target->ResetBit(kIsReferenced);
123 target->ResetBit(kCanDelete);
138 if (eve !=
nullptr) {
140 SetSubID(eve->GetSubID());
141 SetTimeStamp(eve->GetTimeStamp());
142 SetSubEventTag(eve->GetSubEventTag());
147void TRestEvent::RestartPad(Int_t nElements) {
148 if (fPad !=
nullptr) {
153 fPad =
new TPad(this->GetName(),
"", 0., 0., 1., 1.);
155 if (nElements == 1) fPad->Divide(1, 1);
156 if (nElements == 2) fPad->Divide(2, 1);
157 if (nElements == 3 || nElements == 4) fPad->Divide(2, 2);
158 if (nElements == 5) fPad->Divide(3, 2);
159 if (nElements == 6) fPad->Divide(3, 2);
160 if (nElements > 6) fPad->Divide(3, 3);
163 cout <<
"REST_WARNING. TRestEvent::RestartPad. Maximum number of pad "
166 cout <<
"Setting the pad elements to 9" << endl;
177 SetRunOrigin(fRun->GetRunNumber());
178 SetSubRunOrigin(fRun->GetSubRunNumber());
189 cout << TString::Format(
"EventID: %d - SubEventID: %d",
fEventID,
fSubEventID).Data() << endl;
190 cout << TString::Format(
"- Timestamp: %s",
fEventTime.AsString()) << endl;
195 cout <<
"- Status not OK" << endl;
A base class for any REST event.
void SetTime(Double_t time)
virtual void InitializeReferences(TRestRun *run)
Initialize dynamical references when loading the event from a root file.
virtual void CloneTo(TRestEvent *target)
Clone the content of this TRestEvent object to another.
void SetEventInfo(TRestEvent *eve)
virtual void PrintEvent() const
TString fSubEventTag
A short length label to identify the sub-Event.
TTimeStamp fEventTime
Absolute event time.
Bool_t fOk
Flag to be used by processes to define an event status. fOk=true is the default.
virtual void Initialize()=0
Int_t fEventID
Event identification number.
Int_t fSubEventID
Sub-Event identification number.
Data provider and manager in REST.