REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestRawCommonNoiseReductionProcess.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_TRestRawCommonNoiseReductionProcess
24#define RestCore_TRestRawCommonNoiseReductionProcess
25
26#include <TRestEventProcess.h>
27#include <TRestRawSignalEvent.h>
28
29#include "TRestRawSignal.h"
30
33 private:
36
39
41 Int_t fBlocks = 0;
42
44 Int_t fMode = 0;
45
48 Int_t fCenterWidth = 10;
49
52
53 std::string fChannelType;
54 TRestRawReadoutMetadata* fReadoutMetadata = nullptr;
55
56 void Initialize() override;
57
58 void LoadDefaultConfig();
59
60 public:
61 RESTValue GetInputEvent() const override { return fInputEvent; }
62 RESTValue GetOutputEvent() const override { return fOutputEvent; }
63
64 void InitProcess() override;
65
66 TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
67
68 void EndProcess() override;
69
70 void LoadConfig(const std::string& configFilename, const std::string& name = "");
71
72 void PrintMetadata() override {
74
75 if (!fChannelType.empty()) {
76 RESTMetadata << "channelType : " << fChannelType << RESTendl;
77 }
78
79 RESTMetadata << " mode : [" << fMode << "]";
80 if (fMode == 0) {
81 RESTMetadata << " --> Mode 0 activated." << RESTendl;
82 }
83 if (fMode == 1) {
84 RESTMetadata << " --> Mode 1 activated." << RESTendl;
85 }
86 RESTMetadata << " centerWidth : " << fCenterWidth << RESTendl;
87 RESTMetadata << "blocks : [" << fBlocks << "]" << RESTendl;
88 RESTMetadata << " Minimum number of signals : " << fMinSignalsRequired << RESTendl;
89
90 EndPrintProcess();
91 }
92
95
97 const char* GetProcessName() const override { return "commonNoiseReduction"; }
98
99 // Constructor
101 TRestRawCommonNoiseReductionProcess(const char* configFilename);
102
103 // Destructor
105
106 ClassDefOverride(TRestRawCommonNoiseReductionProcess, 3);
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.
A process to subtract the common channels noise from RawSignal type.
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 Initialize() override
Function to initialize input/output event members and define the section name.
const char * GetProcessName() const override
Returns the reduced process name.
Int_t fBlocks
Common noise to all signals or by groups (It can be 0 or 1).
TRestRawSignalEvent * fInputEvent
A pointer to the specific TRestRawSignalEvent input.
Int_t fMinSignalsRequired
Minimum number of signals required to apply the process.
TRestRawSignalEvent * fOutputEvent
A pointer to the specific TRestRawSignalEvent output.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
void EndProcess() override
Function to include required actions after all events have been processed. This method will write the...
void LoadDefaultConfig()
Function to load the default config in absence of RML input.
void InitProcess() override
Process initialization.
void PrintMetadata() override
Implemented it in the derived metadata class to print out specific metadata information.
RESTValue GetOutputEvent() const override
Get pointer to output event. Must be implemented in the derived class.
void LoadConfig(const std::string &configFilename, const std::string &name="")
Function to load the configuration from an external configuration file.
Int_t fMode
The mode defines the method to be used (It can be 0 or 1).
An event container for time rawdata signals with fixed length.