250#include "TRestRawSignalAnalysisProcess.h"
287 const auto filterType =
GetParameter(
"channelType",
"");
288 if (!filterType.empty()) {
289 fChannelTypes.insert(filterType);
299 auto event =
fSignalEvent->GetSignalEventForTypes(fChannelTypes, fReadoutMetadata);
302 map<int, Double_t> baseline;
303 map<int, Double_t> baselinesigma;
304 map<int, Double_t> ampsgn_maxmethod;
305 map<int, Double_t> ampsgn_intmethod;
306 map<int, int> risetime;
307 map<int, int> peak_time;
308 map<int, int> npointsot;
309 vector<int> saturatedchnId;
312 baselinesigma.clear();
313 ampsgn_maxmethod.clear();
314 ampsgn_intmethod.clear();
318 Int_t nGoodSignals = 0;
327 for (
int s = 0; s <
event.GetNumberOfSignals(); s++) {
365 Double_t baseLineMean =
event.GetBaseLineAverage();
368 Double_t baseLineSigma =
event.GetBaseLineSigmaAverage();
371 Double_t timeDelay =
event.GetMaxTime() -
event.GetMinTime();
374 Int_t nSignals =
event.GetNumberOfSignals();
411 Double_t fullIntegral =
event.GetIntegral();
414 Double_t thrIntegral =
event.GetThresholdIntegral();
417 Double_t riseSlope =
event.GetRiseSlope();
420 Double_t slopeIntegral =
event.GetSlopeIntegral();
423 Double_t rateOfChange = riseSlope / slopeIntegral;
424 if (slopeIntegral == 0) rateOfChange = 0;
427 Double_t riseTime =
event.GetRiseTime();
430 Double_t tripleMaxIntegral =
event.GetTripleMaxIntegral();
433 Double_t integralRatio = (fullIntegral - thrIntegral) / (fullIntegral + thrIntegral);
436 Double_t maxValue = 0;
437 Double_t minValue = 1.e6;
438 Double_t maxValueIntegral = 0;
439 Double_t minDownValue = 1.e6;
441 Double_t minPeakTime = 1000;
442 Double_t maxPeakTime = 0;
443 Double_t peakTimeAverage = 0;
445 for (
int s = 0; s <
event.GetNumberOfSignals(); s++) {
452 Double_t value =
event.GetSignal(s)->
GetMaxValue();
453 maxValueIntegral += value;
455 if (value > maxValue) maxValue = value;
456 if (value < minValue) minValue = value;
459 peakTimeAverage += peakBin;
461 if (minPeakTime > peakBin) minPeakTime = peakBin;
462 if (maxPeakTime < peakBin) maxPeakTime = peakBin;
464 Double_t mindownvalue =
event.GetSignal(s)->GetMinValue();
465 if (mindownvalue < minDownValue) {
466 minDownValue = mindownvalue;
470 if (nGoodSignals > 0) peakTimeAverage /= nGoodSignals;
472 Double_t ampIntRatio = thrIntegral / maxValueIntegral;
473 if (maxValueIntegral == 0) ampIntRatio = 0;
482 Double_t amplitudeRatio = maxValueIntegral / maxValue;
483 if (maxValue == 0) amplitudeRatio = 0;
489 Double_t peakTimeDelay = maxPeakTime - minPeakTime;
virtual void InitFromConfigFile() override
To make settings from rml file. This method must be implemented in the derived class.
TRestAnalysisTree * fAnalysisTree
TRestRun * GetRunInfo() const
Return the pointer of the hosting TRestRun object.
std::map< std::string, int > fObservablesDefined
Stores the list of all the appeared process observables in the code.
void SetObservableValue(const std::string &name, const T &value)
Set observable value for AnalysisTree.
A base class for any REST event.
virtual void InitializeReferences(TRestRun *run)
Initialize dynamical references when loading the event from a root file.
An analysis process to extract valuable information from a TRestRawSignalEvent.
void InitProcess() override
Process initialization.
TVector2 fSignalsRange
It defines the signals id range where analysis is applied.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
Double_t fPointThreshold
The number of sigmas over baseline fluctuations to identify a point over threshold.
std::string fBaseLineOption
Option for calculation of baseline parameters, can be set to "ROBUST".
TRestRawSignalAnalysisProcess()
Default constructor.
void Initialize() override
Function to initialize input/output event members and define the section name.
Double_t fSignalThreshold
A parameter to define a minimum signal fluctuation. Measured in sigmas.
~TRestRawSignalAnalysisProcess()
Default destructor.
Bool_t fRangeEnabled
Just a flag to quickly determine if we have to apply the range filter.
Int_t fPointsOverThreshold
The minimum number of points over threshold to identify a signal as such.
TRestRawSignalEvent * fSignalEvent
A pointer to the specific TRestRawSignalEvent input.
TVector2 fIntegralRange
The range where the observables will be calculated.
TVector2 fBaseLineRange
The range where the baseline range will be calculated.
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.
void SetBaseLineRange(TVector2 blRange, std::string option="")
It defines a Short_t array with a physical parameter that evolves in time using a fixed time bin.
Double_t GetBaseLineSigma() const
Double_t GetThresholdIntegral()
It returns the integral of points identified over threshold. InitializePointsOverThreshold should hav...
Int_t GetID() const
Returns the value of signal ID.
Double_t GetMaxValue()
Returns the maximum value found in the data points. It includes baseline correction.
Double_t GetMaxPeakValue()
It returns the amplitude of the signal maximum, baseline will be corrected if CalculateBaseLine was c...
std::vector< Int_t > GetPointsOverThreshold() const
Returns a std::vector containing the indexes of data points over threshold.
Double_t GetBaseLine() const
void InitializePointsOverThreshold(const TVector2 &thrPar, Int_t nPointsOver, Int_t nPointsFlat=512)
It initializes the fPointsOverThreshold array with the indexes of data points that are found over thr...
Int_t GetRiseTime()
It returns the time required from the signal to reach the maximum. InitializePointsOverThreshold shou...
Bool_t IsADCSaturation(int Nflat=3)
It returns whether the signal has ADC saturation.
Int_t GetMaxPeakBin()
It returns the bin at which the maximum peak amplitude happens.
@ REST_Debug
+show the defined debug messages