REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
Loading...
Searching...
No Matches
TRestRawSignalRecoverSaturationProcess Class Reference

Detailed Description

This class recovers the saturated signals in a TRestRawSignalEvent using a fit to the AGET pulse.

This class processes signals that have saturated the ADC, recovering lost information using a fit. If the fit is successful, the saturated points are replaced by the corresponding fit values. The process reconstructs the lost signal data due to ADC saturation, allowing further event analysis as if no saturation had occurred. For example, the following image compares the original to the recovered event and the ThresholdIntegral spectrum in TRestRawSignalAnalysisProcess before (red) and after (blue) applying TRestRawSignalRecoverSaturationProcess:

Recovered Event
Spectrum Comparison

Fitting Function

The fitting function is fixed (hardcoded) to the AGET response function (without the sine term) multiplied by a logistic function:

[0] + [1] * TMath::Exp(-3. * (x-[3])/[2]) *
(x-[3])/[2] * (x-[3])/[2] * (x-[3])/[2] /
(1 + TMath::Exp(-10000 * (x-[3])))
[0] = "Baseline"
[1] = "Amplitude * e^{3}"
[2] = "HalfWidth"
[3] = "PulseStart"
Signal Fit

Parameters

Basic parameters of the process meant to configure the identification of saturated signals to process:

  • minSaturatedBins: Minimum number of saturated bins required to classify a signal as saturated (default: 3).
  • minSaturationValue: Threshold value for considering a signal as saturated (default: 0).
  • processAllSignals: If false (default), only saturated signals are processed. If true, all signals are processed.
  • nBinsIfNotSaturated: Number of bins treated as 'saturated' when processing all signals. Has no effect when processAllSignals is false. Default: 20.

Advanced parameters to configure the fitting process:

  • fitRange: Range of bins used for fitting. If not provided, the entire signal is used. Default: (-1, -1), meaning the whole signal is used.
  • baseLineRange: Range of bins used to calculate the baseline. If provided, the baseline will be fixed in the fit, improving speed and reliability. Default: (-1, -1), meaning no baseline calculation.
  • initPointsOverThreshold: Parameters used as input to TRestRawSignal::InitializePointsOverThreshold to improve amplitude and width estimation. These parameters are wrapped into a TVector3: (pointThreshold, signalThreshold, pointsOverThreshold). Default: (-1, -1, -1), meaning no initialization.
    • pointThreshold: Number of standard deviations above baseline fluctuations required to identify a point as over-threshold.
    • signalThreshold: Minimum required signal fluctuation, measured in standard deviations.
    • pointsOverThreshold: Minimum number of points over threshold needed to classify a signal as such.

Observables

The process adds the following observables to the event:

  • addedAmplitude: Sum of the extra amplitude (new amplitude - previous amplitude) from recovered saturated signals.
  • addedIntegral: Sum of the extra integral (sum of new value - previous value in saturated bins) from recovered signals.
  • saturatedSignals: Number of signals detected as saturated in the event.
  • recoveredSignals: Number of saturated signals successfully modified by the fitted pulse. Always ≤ saturatedSignals. If lower, it means the fit values were below the original signal values, so no replacements were made.
Added Amplitude and Integral

Examples

Example of usage with a minimal RML configuration:

<addProcess type="TRestRawSignalRecoverSaturationProcess" name="recSat" value="ON" observable="all">
<parameter name="minSaturationValue" value="3500" />
<parameter name="baseLineRange" value="(20,150)" />
<parameter name="fitRange" value="(150,300)" />
</addProcess>

Example of a more complex RML configuration:

<addProcess type="TRestRawSignalRecoverSaturationProcess" name="recSat" value="ON" obervable="all">
<parameter name="minSaturatedBins" value="3" />
<parameter name="processAllSignals" value="true" />
<parameter name="nBinsIfNotSaturated" value="16" />
<parameter name="fitRange" value="(150,300)" />
<parameter name="baseLineRange" value="(20,150)" />
<parameter name="initPointsOverThreshold" value="(3.5, 2.5, 7)" />
</addProcess>

Example of a testing RML configuration:

<addProcess type="TRestRawSignalRecoverSaturationProcess" name="recSat" value="ON"
verboseLevel="extreme" observable="all">
<parameter name="minSaturatedBins" value="3" />
<parameter name="processAllSignals" value="true" />
<parameter name="nBinsIfNotSaturated" value="16" />
<parameter name="fitRange" value="(150,300)" />
<parameter name="baseLineRange" value="(20,150)" />
<parameter name="initPointsOverThreshold" value="(3.5, 2.5, 7)" />
</addProcess>

REST-for-Physics - Software for Rare Event Searches Toolkit

History of developments:

2025-Jan: First implementation of TRestRawSignalRecoverSaturationProcess by Álvaro Ezquerro

Author
Álvaro Ezquerro

Definition at line 30 of file TRestRawSignalRecoverSaturationProcess.h.

#include <TRestRawSignalRecoverSaturationProcess.h>

Inheritance diagram for TRestRawSignalRecoverSaturationProcess:
TRestEventProcess TRestMetadata

Public Member Functions

 ClassDefOverride (TRestRawSignalRecoverSaturationProcess, 1)
void EndProcess () override
 Function to include required actions after all events have been processed.
RESTValue GetInputEvent () const override
 Get pointer to input event. Must be implemented in the derived class.
RESTValue GetOutputEvent () const override
 Get pointer to output event. Must be implemented in the derived class.
const char * GetProcessName () const override
void InitProcess () override
 Process initialization. Observable names can be re-interpreted here. Any action in the process required before starting event process might be added here.
void PrintMetadata () override
 It prints out the process parameters stored in the metadata structure.
TRestEvent * ProcessEvent (TRestEvent *eventInput) override
 The main processing event function.
 TRestRawSignalRecoverSaturationProcess ()
 Default constructor.
 ~TRestRawSignalRecoverSaturationProcess ()
 Default destructor.
Public Member Functions inherited from TRestEventProcess
virtual Bool_t AddInputFile (const std::string &file)
bool ApplyCut ()
 Apply cut according to the cut conditions saved in fCut.
virtual void BeginOfEventProcess (TRestEvent *inputEvent=nullptr)
 Begin of event process, preparation work. Called right before ProcessEvent().
 ClassDefOverride (TRestEventProcess, 3)
virtual void EndOfEventProcess (TRestEvent *inputEvent=nullptr)
 End of event process. Nothing to do. Called directly after ProcessEvent().
TRestAnalysisTree * GetAnalysisTree () const
 Return the local analysis tree (dummy).
TCanvas * GetCanvas () const
 Get canvas.
TRestAnalysisTree * GetFullAnalysisTree ()
 Get the full analysis tree from TRestRun, with non-empty entries.
std::vector< std::string > GetListOfAddedObservables ()
 Get list of observables, convert map to vector.
TRestRun * GetRunInfo () const
 Return the pointer of the hosting TRestRun object.
virtual Long64_t GetTotalBytes () const
virtual Long64_t GetTotalBytesRead () const
 Interface to external file reading, get the read bytes. To be implemented in external processes.
virtual void InitFromConfigFile () override
 To make settings from rml file. This method must be implemented in the derived class.
Bool_t isExternal () const
 Return whether this process is external process.
Int_t LoadSectionMetadata () override
 Load extra section metadata: outputlevel after calling TRestMetadata::LoadSectionMetadata().
virtual void NotifyAnalysisTreeReset ()
 In case the analysis tree is reset(switched to new file), some process needs to have action.
virtual Bool_t OpenInputFiles (const std::vector< std::string > &files)
 Interface to external file reading, open input file. To be implemented in external processes.
std::vector< std::string > ReadObservables ()
void RegisterAllObservables (Bool_t value=true)
virtual Bool_t ResetEntry ()
void SetAnalysisTree (TRestAnalysisTree *tree)
 Set analysis tree of this process, then add observables to it.
void SetCanvasSize (Int_t x, Int_t y)
 Set canvas size.
void SetFriendProcess (TRestEventProcess *p)
 Add friendly process to this process.
void SetObservableValidation (bool validate)
void SetParallelProcess (TRestEventProcess *p)
 Add parallel process to this process.
void SetRunInfo (TRestRun *r)
 Set TRestRun for this process.
Bool_t singleThreadOnly () const
 Return whether this process is single std::thread only.
 TRestEventProcess ()
 ~TRestEventProcess ()

Private Member Functions

void Initialize () override
 Function to initialize input/output event members and define the section name.

Private Attributes

TRestRawSignalEvent * fAnaEvent
 A pointer to the specific TRestRawSignalEvent input event.
TVector2 fBaseLineRange
 Range of bins to calculate the baseline and fix that parameter in the fit.
TCanvas * fC
 Canvas to draw the signals.
TVector2 fFitRange
 Range of bins to fit the signal.
TVector3 fInitPointsOverThreshold
 Wrapper of (pointThreshold, signalThreshold, pointsOverThreshold) params.
Size_t fMinSaturatedBins
 Minimum number of saturated bins to consider a signal as saturated.
Short_t fMinSaturationValue
 Minimum value to consider a signal as saturated.
Size_t fNBinsIfNotSaturated
 Number of bins to consider if the signal is not saturated.
Bool_t fProcessAllSignals
 Process all signals in the event.

Additional Inherited Members

Protected Types inherited from TRestEventProcess
enum  REST_Process_Output { No_Output , Observable , Internal_Var , Full_Output }
Protected Member Functions inherited from TRestEventProcess
void BeginPrintProcess ()
 [name, cut range]
void CreateCanvas ()
 Create the canvas.
void EndPrintProcess ()
 Pre-defined printer, can be used at the ending in the implementation of PrintMetadata().
TRestEventProcess * GetFriend (const std::string &nameOrType)
 Get friendly TRestEventProcess object.
TRestEventProcess * GetFriendLive (const std::string &nameOrType)
 Get friendly TRestEventProcess object.
template<class T>
T * GetMetadata ()
 Get a metadata object from the host TRestRun.
TRestMetadata * GetMetadata (const std::string &nameOrType)
 Get a metadata object from the host TRestRun.
size_t GetNumberOfParallelProcesses () const
template<class T>
T GetObservableValue (const std::string &name)
TRestEventProcess * GetParallel (int i)
 Get a list of parallel processes from this process.
template<class T>
std::vector< T > GetParallelDataMembers (T *member_of_process)
 Get a list of data members from parallel processes which is same to this process's certain data member.
template<class T>
void SetObservableValue (const std::string &name, const T &value)
 Set observable value for AnalysisTree.
Protected Attributes inherited from TRestEventProcess
TRestAnalysisTree * fAnalysisTree = nullptr
TCanvas * fCanvas = nullptr
 < Canvas for some viewer event
TVector2 fCanvasSize
 Canvas size.
std::vector< std::pair< std::string, TVector2 > > fCuts
 Stores cut definitions. Any listed observables should be in the range.
bool fDynamicObs = false
 It defines whether to use added observables only or all the observables appear in the code.
bool fIsExternal = false
 It defines if the process reads event data from an external source.
std::map< std::string, int > fObservablesDefined
 Stores the list of all the appeared process observables in the code.
std::map< std::string, int > fObservablesUpdated
 Stores the list of process observables updated when processing this event.
bool fReadOnly = false
 not used, keep for compatibility
TRestRun * fRunInfo = nullptr
 < Pointer to TRestRun object where to find metadata.
bool fSingleThreadOnly = false
bool fValidateObservables = false
 It defines if observable names should be added to the validation list.

Constructor & Destructor Documentation

◆ TRestRawSignalRecoverSaturationProcess()

TRestRawSignalRecoverSaturationProcess::TRestRawSignalRecoverSaturationProcess ( )

Default constructor.

Definition at line 151 of file TRestRawSignalRecoverSaturationProcess.cxx.

◆ ~TRestRawSignalRecoverSaturationProcess()

TRestRawSignalRecoverSaturationProcess::~TRestRawSignalRecoverSaturationProcess ( )

Default destructor.

Definition at line 156 of file TRestRawSignalRecoverSaturationProcess.cxx.

Member Function Documentation

◆ EndProcess()

void TRestRawSignalRecoverSaturationProcess::EndProcess ( )
overridevirtual

Function to include required actions after all events have been processed.

Reimplemented from TRestEventProcess.

Definition at line 425 of file TRestRawSignalRecoverSaturationProcess.cxx.

◆ GetInputEvent()

RESTValue TRestRawSignalRecoverSaturationProcess::GetInputEvent ( ) const
inlineoverridevirtual

Get pointer to input event. Must be implemented in the derived class.

Implements TRestEventProcess.

Definition at line 62 of file TRestRawSignalRecoverSaturationProcess.h.

◆ GetOutputEvent()

RESTValue TRestRawSignalRecoverSaturationProcess::GetOutputEvent ( ) const
inlineoverridevirtual

Get pointer to output event. Must be implemented in the derived class.

Implements TRestEventProcess.

Definition at line 63 of file TRestRawSignalRecoverSaturationProcess.h.

◆ GetProcessName()

const char * TRestRawSignalRecoverSaturationProcess::GetProcessName ( ) const
inlineoverridevirtual

Implements TRestEventProcess.

Definition at line 67 of file TRestRawSignalRecoverSaturationProcess.h.

◆ Initialize()

void TRestRawSignalRecoverSaturationProcess::Initialize ( )
overrideprivatevirtual

Function to initialize input/output event members and define the section name.

Reimplemented from TRestMetadata.

Definition at line 162 of file TRestRawSignalRecoverSaturationProcess.cxx.

◆ InitProcess()

void TRestRawSignalRecoverSaturationProcess::InitProcess ( )
overridevirtual

Process initialization. Observable names can be re-interpreted here. Any action in the process required before starting event process might be added here.

Reimplemented from TRestEventProcess.

Definition at line 183 of file TRestRawSignalRecoverSaturationProcess.cxx.

◆ PrintMetadata()

void TRestRawSignalRecoverSaturationProcess::PrintMetadata ( )
inlineoverridevirtual

It prints out the process parameters stored in the metadata structure.

Reimplemented from TRestMetadata.

Definition at line 74 of file TRestRawSignalRecoverSaturationProcess.h.

◆ ProcessEvent()

TRestEvent * TRestRawSignalRecoverSaturationProcess::ProcessEvent ( TRestEvent * eventInput)
overridevirtual

The main processing event function.

Implements TRestEventProcess.

Definition at line 195 of file TRestRawSignalRecoverSaturationProcess.cxx.

Field Documentation

◆ fAnaEvent

TRestRawSignalEvent* TRestRawSignalRecoverSaturationProcess::fAnaEvent
private

A pointer to the specific TRestRawSignalEvent input event.

Definition at line 33 of file TRestRawSignalRecoverSaturationProcess.h.

◆ fBaseLineRange

TVector2 TRestRawSignalRecoverSaturationProcess::fBaseLineRange
private

Range of bins to calculate the baseline and fix that parameter in the fit.

Definition at line 50 of file TRestRawSignalRecoverSaturationProcess.h.

◆ fC

TCanvas* TRestRawSignalRecoverSaturationProcess::fC
private

Canvas to draw the signals.

Definition at line 59 of file TRestRawSignalRecoverSaturationProcess.h.

◆ fFitRange

TVector2 TRestRawSignalRecoverSaturationProcess::fFitRange
private

Range of bins to fit the signal.

Definition at line 53 of file TRestRawSignalRecoverSaturationProcess.h.

◆ fInitPointsOverThreshold

TVector3 TRestRawSignalRecoverSaturationProcess::fInitPointsOverThreshold
private

Wrapper of (pointThreshold, signalThreshold, pointsOverThreshold) params.

Definition at line 56 of file TRestRawSignalRecoverSaturationProcess.h.

◆ fMinSaturatedBins

Size_t TRestRawSignalRecoverSaturationProcess::fMinSaturatedBins
private

Minimum number of saturated bins to consider a signal as saturated.

Definition at line 38 of file TRestRawSignalRecoverSaturationProcess.h.

◆ fMinSaturationValue

Short_t TRestRawSignalRecoverSaturationProcess::fMinSaturationValue
private

Minimum value to consider a signal as saturated.

Definition at line 47 of file TRestRawSignalRecoverSaturationProcess.h.

◆ fNBinsIfNotSaturated

Size_t TRestRawSignalRecoverSaturationProcess::fNBinsIfNotSaturated
private

Number of bins to consider if the signal is not saturated.

Definition at line 44 of file TRestRawSignalRecoverSaturationProcess.h.

◆ fProcessAllSignals

Bool_t TRestRawSignalRecoverSaturationProcess::fProcessAllSignals
private

Process all signals in the event.

Definition at line 41 of file TRestRawSignalRecoverSaturationProcess.h.


The documentation for this class was generated from the following files: