REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestEventRateAnalysisProcess.h
1 /*************************************************************************
2  * This file is part of the REST software framework. *
3  * *
4  * Copyright (C) 2016 GIFNA/TREX (University of Zaragoza) *
5  * For more information see http://gifna.unizar.es/trex *
6  * *
7  * REST is free software: you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation, either version 3 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * REST is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have a copy of the GNU General Public License along with *
18  * REST in $REST_PATH/LICENSE. *
19  * If not, see http://www.gnu.org/licenses/. *
20  * For the list of contributors see $REST_PATH/CREDITS. *
21  *************************************************************************/
22 
23 #ifndef RestCore_TRestEventRateAnalysisProcess
24 #define RestCore_TRestEventRateAnalysisProcess
25 
26 #include "TRestEventProcess.h"
27 
30  private:
33 
35  Double_t fFirstEventTime;
36 
38  std::vector<Double_t> fPreviousEventTime;
39 
41  bool fRateAnalysis = false;
42 
43  void Initialize() override;
44 
45  protected:
46  // add here the members of your event process
47 
48  public:
49  RESTValue GetInputEvent() const override { return fEvent; }
50  RESTValue GetOutputEvent() const override { return fEvent; }
51 
52  void InitProcess() override;
53  TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
54 
55  void PrintMetadata() override {
57 
58  if (fRateAnalysis) {
59  RESTMetadata << "Rate analysis is on under single thread mode" << RESTendl;
60  } else {
61  RESTMetadata << "Rate analysis is off due to multi-thread" << RESTendl;
62  }
63 
64  EndPrintProcess();
65  }
66 
67  const char* GetProcessName() const override { return "eventRateAnalysis"; }
68 
69  TRestEventRateAnalysisProcess(); // Constructor
70  ~TRestEventRateAnalysisProcess(); // Destructor
71 
72  ClassDefOverride(TRestEventRateAnalysisProcess, 1);
73 };
74 #endif
A base class for any REST event process.
void BeginPrintProcess()
[name, cut range]
A pure analysis process used to calculate event rates and other time observables.
TRestEvent * fEvent
A pointer to the input event.
void InitProcess() override
Process initialization.
RESTValue GetInputEvent() const override
Get pointer to input event. Must be implemented in the derived class.
void Initialize() override
Function to initialize input/output event members and define the section name.
std::vector< Double_t > fPreviousEventTime
It keeps a historic list of timestamps of the previous N events. Now fixed to N=10 events.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
void PrintMetadata() override
Implemented it in the derived metadata class to print out specific metadata information.
Double_t fFirstEventTime
It registers the timestamp from the first event to calculate time from start observables.
bool fRateAnalysis
It indicates whether to add rate observables which is correct only under single thread run.
RESTValue GetOutputEvent() const override
Get pointer to output event. Must be implemented in the derived class.
A base class for any REST event.
Definition: TRestEvent.h:38
endl_t RESTendl
Termination flag object for TRestStringOutput.