REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestRawSignalRangeReductionProcess.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_TRestRawSignalRangeReductionProcess
24#define RestCore_TRestRawSignalRangeReductionProcess
25
26#include <TRestEventProcess.h>
27
28#include "TRestRawSignalEvent.h"
29
34 private:
35 TRestRawSignalEvent* fInputRawSignalEvent;
36 TRestRawSignalEvent* fOutputRawSignalEvent;
37
38 void InitFromConfigFile() override;
39 void LoadDefaultConfig();
40
41 UShort_t fResolutionInBits = 12; // from 1 to 16 bits
42 TVector2 fDigitizationInputRange =
43 TVector2(std::numeric_limits<Short_t>::min(), std::numeric_limits<Short_t>::max());
44
45 TVector2 fDigitizationOutputRange;
46
47 public:
48 void Initialize() override;
49
50 inline Double_t GetResolutionInNumberOfBits() const { return fResolutionInBits; }
51 void SetResolutionInNumberOfBits(UShort_t nBits);
52
53 inline TVector2 GetDigitizationInputRange() const { return fDigitizationInputRange; }
54 void SetDigitizationInputRange(const TVector2& range);
55
56 RESTValue GetInputEvent() const override { return fInputRawSignalEvent; }
57 RESTValue GetOutputEvent() const override { return fOutputRawSignalEvent; }
58
59 void InitProcess() override;
60 TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
61
62 void LoadConfig(const std::string& configFilename, const std::string& name = "");
63
64 Double_t ConvertFromStartingRangeToTargetRange(Double_t value) const;
65 Double_t ConvertFromTargetRangeToStartingRange(Double_t value) const;
66
67 inline void PrintMetadata() override {
69
70 RESTMetadata << "Resolution in bits: " << fResolutionInBits << RESTendl;
71 RESTMetadata << "Digitization range: (" << fDigitizationInputRange.X() << ", "
72 << fDigitizationInputRange.Y() << ")" << RESTendl;
73
74 EndPrintProcess();
75 }
76
77 TRestMetadata* GetProcessMetadata() const { return nullptr; }
78
79 const char* GetProcessName() const override { return "rawSignalRangeReductionProcess"; }
80
81 // Constructor
83 TRestRawSignalRangeReductionProcess(const char* configFilename);
84 // Destructor
86
87 ClassDefOverride(TRestRawSignalRangeReductionProcess, 2);
88};
89#endif // RestCore_TRestRawSignalRangeReductionProcess
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:70
endl_t RESTendl
Termination flag object for TRestStringOutput.
An event container for time rawdata signals with fixed length.
RESTValue GetInputEvent() const override
Get pointer to input event. Must be implemented in the derived class.
void Initialize() override
Making default settings.
RESTValue GetOutputEvent() const override
Get pointer to output event. Must be implemented in the derived class.
void PrintMetadata() override
Implemented it in the derived metadata class to print out specific metadata information.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
Process one event.
void InitFromConfigFile() override
To make settings from rml file. This method must be implemented in the derived class.
void InitProcess() override
To be executed at the beginning of the run (outside event loop)