91 #include "TRestEventRateAnalysisProcess.h"
93 #include "TRestDataBase.h"
113 SetSectionName(this->ClassName());
117 fSingleThreadOnly =
true;
119 fFirstEventTime = -1;
120 fPreviousEventTime.clear();
127 if (fRunInfo != NULL && fRunInfo->GetStartTimestamp() != 0) {
128 fFirstEventTime = fRunInfo->GetStartTimestamp();
130 fFirstEventTime = -1;
134 fRateAnalysis = GetNumberOfParallelProcesses() <= 1;
143 if (fFirstEventTime == -1) fFirstEventTime = fEvent->GetTime();
145 Double_t secondsFromStart = fEvent->GetTime() - fFirstEventTime;
146 SetObservableValue(
"SecondsFromStart", secondsFromStart);
147 SetObservableValue(
"HoursFromStart", secondsFromStart / 3600.);
150 Double_t evTimeDelay = 0;
151 if (fPreviousEventTime.size() > 0) evTimeDelay = fEvent->GetTime() - fPreviousEventTime.back();
152 SetObservableValue(
"EventTimeDelay", evTimeDelay);
154 Double_t meanRate = 0;
155 if (fPreviousEventTime.size() == 10)
156 meanRate = 10. / (fEvent->GetTime() - fPreviousEventTime.front());
157 SetObservableValue(
"MeanRate_InHz", meanRate);
160 for (
auto i : fObservablesDefined) {
161 fAnalysisTree->PrintObservable(i.second);
165 fPreviousEventTime.push_back(fEvent->GetTimeStamp());
166 if (fPreviousEventTime.size() > 10) fPreviousEventTime.erase(fPreviousEventTime.begin());
169 if (ApplyCut())
return NULL;
A pure analysis process used to calculate event rates and other time observables.
void InitProcess() override
Process initialization.
void Initialize() override
Function to initialize input/output event members and define the section name.
~TRestEventRateAnalysisProcess()
Default destructor.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
TRestEventRateAnalysisProcess()
Default constructor.
A base class for any REST event.
@ REST_Debug
+show the defined debug messages