REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestRawBaseLineCorrectionProcess.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 RESTProc_TRestRawBaseLineCorrectionProcess
24 #define RESTProc_TRestRawBaseLineCorrectionProcess
25 
26 #include "TRestEventProcess.h"
27 #include "TRestRawSignalEvent.h"
28 
30  private:
31  // We define specific input/output event data holders
32  TRestRawSignalEvent* fInputEvent;
33  TRestRawSignalEvent* fOutputEvent;
34 
35  void Initialize() override;
36 
38  TVector2 fSignalsRange = TVector2(-1, -1);
39 
41  Int_t fSmoothingWindow = 75;
42 
44  Bool_t fRangeEnabled = false;
45 
46  public:
47  RESTValue GetInputEvent() const override { return fInputEvent; }
48  RESTValue GetOutputEvent() const override { return fOutputEvent; }
49 
50  void InitProcess() override;
51 
52  TRestEvent* ProcessEvent(TRestEvent* eventInput) override;
53 
54  void EndProcess() override;
55 
56  void PrintMetadata() override {
58 
59  RESTMetadata << "Smoothing window size: " << fSmoothingWindow << RESTendl;
60  RESTMetadata << "Baseline correction applied to signals with IDs in range (" << fSignalsRange.X()
61  << "," << fSignalsRange.Y() << ")" << RESTendl;
62 
63  EndPrintProcess();
64  }
65 
68 
70  const char* GetProcessName() const override { return "baseLineCorrection"; }
71 
74 
75  // ROOT class definition helper. Increase the number in it every time
76  // you add/rename/remove the process parameters
77  ClassDefOverride(TRestRawBaseLineCorrectionProcess, 1);
78 };
79 #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.
void InitProcess() override
To be executed at the beginning of the run (outside event loop)
RESTValue GetOutputEvent() const override
Get pointer to output event. Must be implemented in the derived class.
TRestEvent * ProcessEvent(TRestEvent *eventInput) override
Process one event.
const char * GetProcessName() const override
Returns the name of this process.
void EndProcess() override
To be executed at the end of the run (outside event loop)
TRestEventProcess * Maker()
Returns a new instance of this class.
RESTValue GetInputEvent() const override
Get pointer to input event. Must be implemented in the derived class.
void PrintMetadata() override
Implemented it in the derived metadata class to print out specific metadata information.
TVector2 fSignalsRange
It defines the signals id range where analysis is applied.
void Initialize() override
Making default settings.
Int_t fSmoothingWindow
Time window width in bins for the moving average filter for baseline correction.
Bool_t fRangeEnabled
Just a flag to quickly determine if we have to apply the range filter.
An event container for time rawdata signals with fixed length.