Skip to content

Commit 12d3311

Browse files
Implementation of TRestRawSignalRecoverSaturationProcess (#147)
* implementation of process to recover saturated signals * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * add parameters for better fitting * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * add documentation to the class * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix doc images and improve documentation of the class * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix maxPeakBin and maxValue when processing a non saturated signal * update fit parameter names and improve debug output * add second estimation of width * improve first estimation of parameters * wrapp initPointsOverThreshold parameters into a TVector3 * remove useless debug messages * improve doc * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix doc examples * fix parameter doc --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent e8b3ef8 commit 12d3311

6 files changed

+527
-0
lines changed
371 KB
Loading
659 KB
Loading
392 KB
Loading
572 KB
Loading
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
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 RESTProc_TRestRawSignalRecoverSaturationProcess
24+
#define RESTProc_TRestRawSignalRecoverSaturationProcess
25+
26+
#include "TRestEventProcess.h"
27+
#include "TRestRawSignalEvent.h"
28+
29+
/// This class recovers the saturated signals in a TRestRawSignalEvent using a fit to the AGET pulse.
30+
class TRestRawSignalRecoverSaturationProcess : public TRestEventProcess {
31+
private:
32+
/// A pointer to the specific TRestRawSignalEvent input event
33+
TRestRawSignalEvent* fAnaEvent; //!
34+
35+
void Initialize() override;
36+
37+
/// Minimum number of saturated bins to consider a signal as saturated
38+
Size_t fMinSaturatedBins; //<
39+
40+
/// Process all signals in the event
41+
Bool_t fProcessAllSignals; //<
42+
43+
/// Number of bins to consider if the signal is not saturated
44+
Size_t fNBinsIfNotSaturated; //<
45+
46+
/// Minimum value to consider a signal as saturated
47+
Short_t fMinSaturationValue; //<
48+
49+
/// Range of bins to calculate the baseline and fix that parameter in the fit
50+
TVector2 fBaseLineRange; //<
51+
52+
/// Range of bins to fit the signal
53+
TVector2 fFitRange; //<
54+
55+
/// Wrapper of (pointThreshold, signalThreshold, pointsOverThreshold) params
56+
TVector3 fInitPointsOverThreshold; //<
57+
58+
/// Canvas to draw the signals
59+
TCanvas* fC; //!
60+
61+
public:
62+
RESTValue GetInputEvent() const override { return fAnaEvent; }
63+
RESTValue GetOutputEvent() const override { return fAnaEvent; }
64+
65+
void InitProcess() override;
66+
67+
const char* GetProcessName() const override { return "RawSignalRecoverSaturationProcess"; }
68+
69+
TRestEvent* ProcessEvent(TRestEvent* eventInput) override;
70+
71+
void EndProcess() override;
72+
73+
/// It prints out the process parameters stored in the metadata structure
74+
void PrintMetadata() override {
75+
BeginPrintProcess();
76+
77+
// Write here how to print the added process members and parameters.
78+
std::string strProcessAllSignals = fProcessAllSignals ? "true" : "false";
79+
RESTMetadata << "MinSaturatedBins: " << fMinSaturatedBins << RESTendl;
80+
RESTMetadata << "ProcessAllSignals: " << strProcessAllSignals << RESTendl;
81+
RESTMetadata << "NBinsIfNotSaturated: " << fNBinsIfNotSaturated << RESTendl;
82+
RESTMetadata << "MinSaturationValue: " << fMinSaturationValue << RESTendl;
83+
RESTMetadata << "BaseLineRange: (" << fBaseLineRange.X() << ", " << fBaseLineRange.Y() << ")"
84+
<< RESTendl;
85+
RESTMetadata << "FitRange: (" << fFitRange.X() << ", " << fFitRange.Y() << ")" << RESTendl;
86+
RESTMetadata << "InitPointsOverThreshold: (" << fInitPointsOverThreshold.X() << ", "
87+
<< fInitPointsOverThreshold.Y() << ", " << fInitPointsOverThreshold.Z() << ")"
88+
<< RESTendl;
89+
90+
EndPrintProcess();
91+
}
92+
93+
TRestRawSignalRecoverSaturationProcess();
94+
~TRestRawSignalRecoverSaturationProcess();
95+
96+
// ROOT class definition helper. Increase the number in it every time
97+
// you add/rename/remove the process parameters
98+
ClassDefOverride(TRestRawSignalRecoverSaturationProcess, 1);
99+
};
100+
#endif

0 commit comments

Comments
 (0)