REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestRawSignalAddNoiseProcess.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_TRestRawSignalAddNoiseProcess
24 #define RestCore_TRestRawSignalAddNoiseProcess
25 
26 #include <TRestEventProcess.h>
27 
28 #include "TRestRawSignalEvent.h"
29 
32  private:
35 
38 
39  void Initialize() override;
40 
41  void LoadDefaultConfig();
42 
44  Double_t fNoiseLevel = 10.0;
45 
46  public:
48  inline Double_t GetNoiseLevel() const { return fNoiseLevel; }
49 
51  inline void SetNoiseLevel(Double_t noiseLevel) { fNoiseLevel = noiseLevel; }
52 
54  RESTValue GetInputEvent() const override { return fInputSignalEvent; }
55 
57  RESTValue GetOutputEvent() const override { return fOutputSignalEvent; }
58 
59  TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
60 
61  void LoadConfig(const std::string& configFilename, const std::string& name = "");
62 
64  inline void PrintMetadata() override {
66 
67  RESTMetadata << "Noise Level : " << fNoiseLevel << RESTendl;
68 
69  EndPrintProcess();
70  }
71 
72  TRestMetadata* GetProcessMetadata() const { return nullptr; }
73 
75  const char* GetProcessName() const override { return "rawSignalAddNoise"; }
76 
78  TRestRawSignalAddNoiseProcess(const char* configFilename);
80 
81  ClassDefOverride(TRestRawSignalAddNoiseProcess, 2);
82 };
83 #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
A base class for any REST metadata class.
Definition: TRestMetadata.h:74
endl_t RESTendl
Termination flag object for TRestStringOutput.
A process to add/emulate electronic noise into a TRestRawSignalEvent.
void LoadDefaultConfig()
Function to load the default config in absence of RML input.
void PrintMetadata() override
Prints out the metadata members of this class.
Double_t GetNoiseLevel() const
It returns the noise level defined in the process (ADC units)
RESTValue GetOutputEvent() const override
Returns a pointer to the output signal event.
const char * GetProcessName() const override
Returns a given process name.
void LoadConfig(const std::string &configFilename, const std::string &name="")
Function to load the configuration from an external configuration file.
RESTValue GetInputEvent() const override
Returns a pointer to the input signal event.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
TRestRawSignalEvent * fOutputSignalEvent
A pointer to the output signal event.
void Initialize() override
Function to initialize input/output event members and define the section name.
TRestRawSignalEvent * fInputSignalEvent
A pointer to the input signal event.
void SetNoiseLevel(Double_t noiseLevel)
It sets the noise level of the process (ADC units)
Double_t fNoiseLevel
The noise level to be added to the signal. It is 1-gaussian sigma.
An event container for time rawdata signals with fixed length.