REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestRawSignalShapingProcess.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_TRestRawSignalShapingProcess
24 #define RestCore_TRestRawSignalShapingProcess
25 
26 #include <TRestRawSignalEvent.h>
27 
28 #include "TRestEventProcess.h"
29 
33  private:
36 
39 
40  void Initialize() override;
41 
42  protected:
43  // add here the members of your event process
44  TString fResponseFilename;
45 
47  TString fShapingType = "shaperSin";
49  Double_t fShapingTime = 10.0; // ns
51  Double_t fShapingGain = 1.0;
52 
53  public:
54  inline TString GetShapingType() const { return fShapingType; }
55  inline void SetShapingType(const TString& samplingType) { fShapingType = samplingType; }
56 
57  inline Double_t GetShapingTime() const { return fShapingTime; }
58  inline void SetShapingTime(Double_t shapingTime) { fShapingTime = shapingTime; }
59 
60  inline Double_t GetShapingGain() const { return fShapingGain; }
61  inline void SetShapingGain(Double_t shapingGain) { fShapingGain = shapingGain; }
62 
63  RESTValue GetInputEvent() const override { return fInputSignalEvent; }
64  RESTValue GetOutputEvent() const override { return fOutputSignalEvent; }
65 
66  void InitProcess() override;
67  TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
68  void EndProcess() override;
69 
70  void LoadConfig(const std::string& configFilename, const std::string& name = "");
71 
73  inline void PrintMetadata() override {
75 
76  RESTMetadata << "Shaping type : " << fShapingType << RESTendl;
77  RESTMetadata << "Shaping time : " << fShapingTime << RESTendl;
78  RESTMetadata << "Amplitude gain : " << fShapingGain << RESTendl;
79  if (fShapingType == "responseFile") {
80  RESTMetadata << "Response file : " << fResponseFilename << RESTendl;
81  }
82 
83  EndPrintProcess();
84  }
85 
88 
90  const char* GetProcessName() const override { return "rawSignalShaping"; }
91 
93  TRestRawSignalShapingProcess(const char* configFilename);
95 
96  ClassDefOverride(TRestRawSignalShapingProcess, 2);
97 };
98 #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 event container for time rawdata signals with fixed length.
Double_t fShapingTime
The characteristic time of the shaping.
void Initialize() override
Function to initialize input/output event members and define the section name.
TRestRawSignalEvent * fOutputSignalEvent
A pointer to the specific TRestRawSignalEvent output.
TRestEventProcess * Maker()
Returns a new instance of this class.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
void PrintMetadata() override
It prints out the process parameters stored in the metadata structure.
void EndProcess() override
Function to include required actions after all events have been processed.
TRestRawSignalEvent * fInputSignalEvent
A pointer to the specific TRestRawSignalEvent input.
RESTValue GetOutputEvent() const override
Get pointer to output event. Must be implemented in the derived class.
TString fShapingType
Types are : gaus, shaper, shaperSin, responseFile.
void LoadConfig(const std::string &configFilename, const std::string &name="")
Function to load the configuration from an external configuration file.
void InitProcess() override
Process initialization. Observable names are interpreted and auxiliar observable members,...
Double_t fShapingGain
A value used to scale the input signal.
const char * GetProcessName() const override
Returns the name of this process.
RESTValue GetInputEvent() const override
Get pointer to input event. Must be implemented in the derived class.