REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestRawToDetectorSignalProcess.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_TRestRawToDetectorSignalProcess
24 #define RestCore_TRestRawToDetectorSignalProcess
25 
26 #include <TRestDetectorSignalEvent.h>
27 #include <TRestRawSignalEvent.h>
28 
29 #include "TRestEventProcess.h"
30 
33  private:
36 
39 
40  void Initialize() override;
41 
42  protected:
44  Double_t fSampling = 0.1;
45 
47  Double_t fTriggerStarts = 0;
48 
50  Double_t fGain = 1;
51 
53  Double_t fThreshold = 0.1;
54 
55  // Perform Zero suppression to the data
56  Bool_t fZeroSuppression = false;
57 
59  TVector2 fBaseLineRange = TVector2(5, 55);
60 
62  TVector2 fIntegralRange = TVector2(10, 500);
63 
65  Double_t fPointThreshold = 3;
66 
68  Double_t fSignalThreshold = 5;
69 
72 
74  Bool_t fBaseLineCorrection = false;
75 
76  public:
77  RESTValue GetInputEvent() const override { return fInputSignalEvent; }
78  RESTValue GetOutputEvent() const override { return fOutputSignalEvent; }
79 
80  TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
81 
82  void ZeroSuppresion(TRestRawSignal* rawSignal, TRestDetectorSignal& signal);
83 
85  void PrintMetadata() override {
87 
88  RESTMetadata << "Sampling time : " << fSampling << " us" << RESTendl;
89  RESTMetadata << "Trigger starts : " << fTriggerStarts << " us" << RESTendl;
90  RESTMetadata << "Gain : " << fGain << RESTendl;
91 
92  if (fZeroSuppression) {
93  RESTMetadata << "Base line range definition : ( " << fBaseLineRange.X() << " , "
94  << fBaseLineRange.Y() << " ) " << RESTendl;
95  RESTMetadata << "Integral range : ( " << fIntegralRange.X() << " , " << fIntegralRange.Y()
96  << " ) " << RESTendl;
97  RESTMetadata << "Point Threshold : " << fPointThreshold << " sigmas" << RESTendl;
98  RESTMetadata << "Signal threshold : " << fSignalThreshold << " sigmas" << RESTendl;
99  RESTMetadata << "Number of points over threshold : " << fNPointsOverThreshold << RESTendl;
100  }
101 
103  RESTMetadata << "BaseLine correction is enabled for TRestRawSignalAnalysisProcess" << RESTendl;
104 
105  EndPrintProcess();
106  }
107 
110 
112  const char* GetProcessName() const override { return "rawSignalToSignal"; }
113 
114  // Constructor
116 
117  // Destructor
119 
120  ClassDefOverride(TRestRawToDetectorSignalProcess, 2);
121 };
122 #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.
It defines a Short_t array with a physical parameter that evolves in time using a fixed time bin.
A process to convert a TRestRawSignalEvent into a TRestDetectorSignalEvent.
Double_t fSignalThreshold
A threshold parameter to accept or reject a pre-identified signal. See process description.
const char * GetProcessName() const override
Returns the name of this process.
void Initialize() override
Function to initialize input/output event members and define the section name.
RESTValue GetOutputEvent() const override
Get pointer to output event. Must be implemented in the derived class.
void PrintMetadata() override
It prints out the process parameters stored in the metadata structure.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
Double_t fPointThreshold
Number of sigmas over baseline fluctuation to accept a point is over threshold.
Double_t fTriggerStarts
The corresponding time of the first bin inside the raw signal.
Int_t fNPointsOverThreshold
Number of consecutive points over threshold required to accept a signal.
Double_t fGain
A factor the data values will be multiplied by at the output signal.
TVector2 fBaseLineRange
The ADC range used for baseline offset definition.
TRestRawSignalEvent * fInputSignalEvent
A pointer to the specific TRestRawSignalEvent input.
TRestDetectorSignalEvent * fOutputSignalEvent
A pointer to the specific TRestDetectorSignalEvent input.
TRestEventProcess * Maker()
Returns a new instance of this class.
Double_t fThreshold
A factor the data values will be multiplied by at the output signal.
RESTValue GetInputEvent() const override
Get pointer to input event. Must be implemented in the derived class.
Bool_t fBaseLineCorrection
A parameter to determine if baseline correction has been applied by a previous process.
TVector2 fIntegralRange
The ADC range used for integral definition and signal identification.
Double_t fSampling
The sampling time used to transform the binned data to time information.