70#include "TRestRawBaseLineCorrectionProcess.h"
76TRestRawBaseLineCorrectionProcess::TRestRawBaseLineCorrectionProcess() {
Initialize(); }
78TRestRawBaseLineCorrectionProcess::~TRestRawBaseLineCorrectionProcess() {
87 fInputEvent =
nullptr;
99 if (fReadoutMetadata ==
nullptr) {
100 fReadoutMetadata = fInputEvent->GetReadoutMetadata();
103 if (fReadoutMetadata ==
nullptr && !fChannelTypes.empty()) {
104 cerr <<
"TRestRawBaseLineCorrectionProcess::ProcessEvent: readout metadata is null, cannot filter "
105 "the process by signal type"
110 for (
int s = 0; s < fInputEvent->GetNumberOfSignals(); s++) {
114 const string channelType = fReadoutMetadata->GetTypeForChannelDaqId(signalId);
115 const string channelName = fReadoutMetadata->GetNameForChannelDaqId(signalId);
118 if (!fChannelTypes.empty() && fChannelTypes.find(channelType) == fChannelTypes.end()) {
120 fOutputEvent->AddSignal(*signal);
126 fOutputEvent->AddSignal(*signal);
133 fOutputEvent->AddSignal(signalCorrected);
146 const auto filterType =
GetParameter(
"channelType",
"");
147 if (!filterType.empty()) {
148 fChannelTypes.insert(filterType);
158 if (fChannelTypes.empty()) {
159 RESTMetadata <<
"No type specified. All signal types will be processed." <<
RESTendl;
161 RESTMetadata <<
"Channel type for baseline correction: ";
162 for (
const auto& channelType : fChannelTypes) {
163 RESTMetadata << channelType <<
" ";
169 RESTMetadata <<
"Baseline correction applied to signals with IDs in range (" <<
fSignalsRange.X() <<
","
TRestRun * GetRunInfo() const
Return the pointer of the hosting TRestRun object.
void BeginPrintProcess()
[name, cut range]
A base class for any REST event.
virtual void InitializeReferences(TRestRun *run)
Initialize dynamical references when loading the event from a root file.
void InitProcess() override
To be executed at the beginning of the run (outside event loop)
TRestEvent * ProcessEvent(TRestEvent *eventInput) override
Process one event.
void EndProcess() override
To be executed at the end of the run (outside event loop)
void PrintMetadata() override
Implemented it in the derived metadata class to print out specific metadata information.
TVector2 fSignalsRange
It defines the signals id range where analysis is applied.
void Initialize() override
Making default settings.
Int_t fSmoothingWindow
Time window width in bins for the moving average filter for baseline correction.
Bool_t fRangeEnabled
Just a flag to quickly determine if we have to apply the range filter.
void InitFromConfigFile() override
To make settings from rml file. This method must be implemented in the derived class.
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.
Int_t GetID() const
Returns the value of signal ID.
void SetID(Int_t sID)
It sets the id number of the signal.
Int_t GetSignalID() const
Returns the value of signal ID.
void GetBaseLineCorrected(TRestRawSignal *smoothedSignal, Int_t averagingPoints)
It applies the moving average filter (GetSignalSmoothed) to the signal, which is then subtracted from...
Double_t StringToDouble(std::string in)
Gets a double from a string.