23#ifndef RestProcess_TRestEventTimeSelectionProcess
24#define RestProcess_TRestEventTimeSelectionProcess
26#include <TRestEventProcess.h>
33 std::string fFileWithTimes;
36 Long_t fTimeOffsetInSeconds;
37 Long_t fTimeStartMarginInSeconds;
38 Long_t fTimeEndMarginInSeconds;
39 std::vector<std::pair<std::string, std::string>> fStartEndTimes;
44 Int_t fNEventsSelected;
45 Double_t fTotalTimeInSeconds;
65 const char* GetProcessName()
const override {
return "EventTimeSelectionProcess"; }
67 std::string GetFileWithTimes()
const {
return fFileWithTimes; }
69 Bool_t GetIsActiveTime()
const {
return fIsActiveTime; }
70 Char_t GetDelimiter()
const {
return fDelimiter; }
72 std::vector<std::pair<std::string, std::string>> GetStartEndTimes()
const {
return fStartEndTimes; }
73 std::string
GetTimeStampCut(std::string timeStampObsName =
"timeStamp", Bool_t useOffset =
true,
74 Bool_t useMargins =
true, Int_t nTimes = -1);
76 Int_t GetNEventsSelected()
const {
return fNEventsSelected; }
77 Double_t GetTotalTimeInSeconds()
const {
return fTotalTimeInSeconds; }
78 Long_t GetTimeOffsetInSeconds()
const {
return fTimeOffsetInSeconds; }
79 Long_t GetTimeStartMarginInSeconds()
const {
return fTimeStartMarginInSeconds; }
80 Long_t GetTimeEndMarginInSeconds()
const {
return fTimeEndMarginInSeconds; }
83 static std::vector<std::pair<std::string, std::string>> ReadFileWithTimes(std::string fileWithTimes,
84 Char_t delimiter =
',');
86 void SetAsActiveTime() { fIsActiveTime =
true; }
87 void SetAsDeadTime() { fIsActiveTime =
false; }
88 void SetFileWithTimes(
const std::string& fileWithTimes) { fFileWithTimes = fileWithTimes; }
89 void SetIsActiveTime(Bool_t isActiveTime) { fIsActiveTime = isActiveTime; }
90 void SetDelimiter(Char_t delimiter) { fDelimiter = delimiter; }
91 void SetStartEndTimes(
const std::vector<std::pair<std::string, std::string>>& startEndTimes) {
92 fStartEndTimes = startEndTimes;
94 void SetTimeOffsetInSeconds(Long_t timeOffsetInSeconds) { fTimeOffsetInSeconds = timeOffsetInSeconds; }
95 void SetTimeStartMarginInSeconds(Long_t timeStartMarginInSeconds) {
96 fTimeStartMarginInSeconds = timeStartMarginInSeconds;
98 void SetTimeEndMarginInSeconds(Long_t timeEndMarginInSeconds) {
99 fTimeEndMarginInSeconds = timeEndMarginInSeconds;
A base class for any REST event process.
RESTValue GetOutputEvent() const override
Get pointer to output event. Must be implemented in the derived class.
Double_t CalculateTotalTimeInSeconds()
Function to calculate the total time in seconds of all the time ranges (active or dead periods of tim...
TRestEventTimeSelectionProcess()
Default constructor.
void PrintMetadata() override
Prints on screen the process data members.
void EndProcess() override
Function to include required actions after all events have been processed.
Int_t fNEventsRejected
Information about the events processed.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
void Initialize() override
Function to initialize input/output event members and define the section name.
std::string GetTimeStampCut(std::string timeStampObsName="timeStamp", Bool_t useOffset=true, Bool_t useMargins=true, Int_t nTimes=-1)
Function to get the cut string that reproduce the time selection done by this process (useful for TRe...
void InitProcess() override
Process initialization.
RESTValue GetInputEvent() const override
Get pointer to input event. Must be implemented in the derived class.
A base class for any REST event.