|
| 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