REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestSummaryProcess.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_TRestSummaryProcess
24#define RestCore_TRestSummaryProcess
25
26#include "TRestEventProcess.h"
27#include "TVector2.h"
28
31 private:
33 Double_t fMeanRate;
34
37
39 std::map<TString, Double_t> fAverage;
40
42 std::map<TString, TVector2> fAverageRange;
43
45 std::map<TString, Double_t> fRMS;
46
48 std::map<TString, TVector2> fRMSRange;
49
51 std::map<TString, Double_t> fMaximum;
52
54 std::map<TString, TVector2> fMaximumRange;
55
57 std::map<TString, Double_t> fMinimum;
58
60 std::map<TString, TVector2> fMinimumRange;
61
63 TRestEvent* fEvent = nullptr;
64
65 void InitProcess() override;
66 void EndProcess() override;
67
68 void InitFromConfigFile() override;
69
70 void Initialize() override;
71
72 void LoadDefaultConfig();
73
74 protected:
75 public:
76 RESTValue GetInputEvent() const override { return fEvent; }
77 RESTValue GetOutputEvent() const override { return fEvent; }
78
79 TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
80
81 void LoadConfig(const std::string& configFilename, const std::string& name = "");
82
83 void PrintMetadata() override;
84
87
89 const char* GetProcessName() const override { return "summary"; }
90
92 TRestSummaryProcess(const char* configFilename);
93
95
96 // If new members are added, removed or modified in this class version number must be increased!
97 ClassDefOverride(TRestSummaryProcess, 2);
98};
99#endif
A base class for any REST event process.
A base class for any REST event.
Definition: TRestEvent.h:38
A process to define basic data members to serve as a metadata summary in a data processing chain.
void EndProcess() override
Function to use when all events have been processed.
std::map< TString, TVector2 > fMinimumRange
If defined it will set the range where minimum is calculated.
std::map< TString, TVector2 > fMaximumRange
If defined it will set the range where maximum is calculated.
void LoadConfig(const std::string &configFilename, const std::string &name="")
Function to load the configuration from an external configuration file.
Double_t fMeanRate
The mean rate during the run, calculated as the final number of entries in the run.
void InitFromConfigFile() override
Function reading input parameters from the RML TRestSummaryProcess section.
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 and library version.
TRestEvent * fEvent
The event pointer is not used in this process.
Double_t fMeanRateSigma
The mean rate sigma calculated as the square root of the corresponding mean rate counts.
std::map< TString, TVector2 > fRMSRange
If defined it will set the range where RMS is calculated.
std::map< TString, TVector2 > fAverageRange
If defined it will set the range where average is calculated.
void PrintMetadata() override
It prints out the process parameters stored in the metadata structure.
void LoadDefaultConfig()
Function to load the default config in absence of RML input.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
TRestSummaryProcess()
Default constructor.
RESTValue GetOutputEvent() const override
Get pointer to output event. Must be implemented in the derived class.
TRestEventProcess * Maker()
Returns a new instance of this class.
std::map< TString, Double_t > fMaximum
It will register the maximum value of an existing analyisTree observable.
void InitProcess() override
Function to use in initialization of process members before starting to process the event.
std::map< TString, Double_t > fAverage
It will register the average of an existing analyisTree observable.
const char * GetProcessName() const override
Returns the name of this process.
~TRestSummaryProcess()
Default destructor.
std::map< TString, Double_t > fRMS
It will register the RMS of an existing analysisTree observable.
std::map< TString, Double_t > fMinimum
It will register the minimum value of an existing analyisTree observable.