REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestRawSignalAnalysisProcess.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_TRestRawSignalAnalysisProcess
24 #define RestCore_TRestRawSignalAnalysisProcess
25 
26 #include <TRestRawSignalEvent.h>
27 
28 #include "TRestEventProcess.h"
29 
32  private:
35 
37  Bool_t fRangeEnabled = false;
38 
40  TVector2 fBaseLineRange = TVector2(5, 55);
41 
43  TVector2 fIntegralRange = TVector2(10, 500);
44 
46  std::string fBaseLineOption; //<
47 
49  Double_t fPointThreshold = 2;
50 
52  Double_t fSignalThreshold = 5;
53 
55  std::string fChannelType;
56 
59 
61  TVector2 fSignalsRange = TVector2(-1, -1); //<
62 
63  TRestRawReadoutMetadata* fReadoutMetadata = nullptr;
64 
65  void Initialize() override;
66 
67  std::set<std::string> fChannelTypes = {}; // this process will only be applied to selected channel types
68 
69  protected:
70  // add here the members of your event process
71 
72  public:
73  RESTValue GetInputEvent() const override { return fSignalEvent; }
74 
75  RESTValue GetOutputEvent() const override { return fSignalEvent; }
76 
77  void InitProcess() override;
78 
79  TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
80 
81  void InitFromConfigFile() override;
82 
83  void PrintMetadata() override {
85 
86  RESTMetadata << "Baseline range : ( " << fBaseLineRange.X() << " , " << fBaseLineRange.Y() << " ) "
87  << RESTendl;
88  RESTMetadata << "Integral range : ( " << fIntegralRange.X() << " , " << fIntegralRange.Y() << " ) "
89  << RESTendl;
90  RESTMetadata << "Point Threshold : " << fPointThreshold << " sigmas" << RESTendl;
91  RESTMetadata << "Signal threshold : " << fSignalThreshold << " sigmas" << RESTendl;
92  RESTMetadata << "Number of points over threshold : " << fPointsOverThreshold << RESTendl;
93  RESTMetadata << "Baseline calculation method: " << (fBaseLineOption.empty() ? "Standard" : "Robust")
94  << RESTendl;
95 
96  EndPrintProcess();
97  }
98 
99  const char* GetProcessName() const override { return "rawSignalAnalysis"; }
100 
102 
104 
105  ClassDefOverride(TRestRawSignalAnalysisProcess, 5);
106 };
107 
108 #endif
A base class for any REST event process.
void BeginPrintProcess()
[name, cut range]
A base class for any REST event.
Definition: TRestEvent.h:38
endl_t RESTendl
Termination flag object for TRestStringOutput.
An analysis process to extract valuable information from a TRestRawSignalEvent.
void InitProcess() override
Process initialization.
TVector2 fSignalsRange
It defines the signals id range where analysis is applied.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
Double_t fPointThreshold
The number of sigmas over baseline fluctuations to identify a point over threshold.
void PrintMetadata() override
Implemented it in the derived metadata class to print out specific metadata information.
std::string fBaseLineOption
Option for calculation of baseline parameters, can be set to "ROBUST".
void Initialize() override
Function to initialize input/output event members and define the section name.
Double_t fSignalThreshold
A parameter to define a minimum signal fluctuation. Measured in sigmas.
Bool_t fRangeEnabled
Just a flag to quickly determine if we have to apply the range filter.
Int_t fPointsOverThreshold
The minimum number of points over threshold to identify a signal as such.
TRestRawSignalEvent * fSignalEvent
A pointer to the specific TRestRawSignalEvent input.
TVector2 fIntegralRange
The range where the observables will be calculated.
RESTValue GetInputEvent() const override
Get pointer to input event. Must be implemented in the derived class.
TVector2 fBaseLineRange
The range where the baseline range will be calculated.
void InitFromConfigFile() override
To make settings from rml file. This method must be implemented in the derived class.
RESTValue GetOutputEvent() const override
Get pointer to output event. Must be implemented in the derived class.
std::string fChannelType
avoid error when loading parameters (not used)
An event container for time rawdata signals with fixed length.