250#include "TRestRawSignalAnalysisProcess.h"
288 const auto filterType =
GetParameter(
"channelType",
"");
289 if (!filterType.empty()) {
290 fChannelTypes.insert(filterType);
301 if (run !=
nullptr) {
305 if (fReadoutMetadata ==
nullptr) {
306 fReadoutMetadata =
fInputEvent->GetReadoutMetadata();
309 if (fReadoutMetadata ==
nullptr && !fChannelTypes.empty()) {
310 cerr <<
"TRestRawSignalAnalysisProcess::ProcessEvent: readout metadata is null, cannot filter "
311 "the process by signal type"
316 auto event =
fInputEvent->GetSignalEventForTypes(fChannelTypes, fReadoutMetadata);
319 map<int, Double_t> baseline;
320 map<int, Double_t> baselinesigma;
321 map<int, Double_t> ampsgn_maxmethod;
322 map<int, Double_t> ampsgn_intmethod;
323 map<int, int> risetime;
324 map<int, int> peak_time;
325 map<int, int> npointsot;
326 vector<int> saturatedchnId;
329 baselinesigma.clear();
330 ampsgn_maxmethod.clear();
331 ampsgn_intmethod.clear();
335 Int_t nGoodSignals = 0;
344 for (
int s = 0; s <
event.GetNumberOfSignals(); s++) {
382 Double_t baseLineMean =
event.GetBaseLineAverage();
385 Double_t baseLineSigma =
event.GetBaseLineSigmaAverage();
388 Double_t timeDelay =
event.GetMaxTime() -
event.GetMinTime();
391 Int_t nSignals =
event.GetNumberOfSignals();
428 Double_t fullIntegral =
event.GetIntegral();
431 Double_t thrIntegral =
event.GetThresholdIntegral();
434 Double_t riseSlope =
event.GetRiseSlope();
437 Double_t slopeIntegral =
event.GetSlopeIntegral();
440 Double_t rateOfChange = riseSlope / slopeIntegral;
441 if (slopeIntegral == 0) rateOfChange = 0;
444 Double_t riseTime =
event.GetRiseTime();
447 Double_t tripleMaxIntegral =
event.GetTripleMaxIntegral();
450 Double_t integralRatio = (fullIntegral - thrIntegral) / (fullIntegral + thrIntegral);
453 Double_t maxValue = 0;
454 Double_t minValue = 1.e6;
455 Double_t maxValueIntegral = 0;
456 Double_t minDownValue = 1.e6;
458 Double_t minPeakTime = 1000;
459 Double_t maxPeakTime = 0;
460 Double_t peakTimeAverage = 0;
462 for (
int s = 0; s <
event.GetNumberOfSignals(); s++) {
469 Double_t value =
event.GetSignal(s)->
GetMaxValue();
470 maxValueIntegral += value;
472 if (value > maxValue) maxValue = value;
473 if (value < minValue) minValue = value;
476 peakTimeAverage += peakBin;
478 if (minPeakTime > peakBin) minPeakTime = peakBin;
479 if (maxPeakTime < peakBin) maxPeakTime = peakBin;
481 Double_t mindownvalue =
event.GetSignal(s)->GetMinValue();
482 if (mindownvalue < minDownValue) {
483 minDownValue = mindownvalue;
487 if (nGoodSignals > 0) peakTimeAverage /= nGoodSignals;
489 Double_t ampIntRatio = thrIntegral / maxValueIntegral;
490 if (maxValueIntegral == 0) ampIntRatio = 0;
499 Double_t amplitudeRatio = maxValueIntegral / maxValue;
500 if (maxValue == 0) amplitudeRatio = 0;
506 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.
TRestRawSignalEvent * fInputEvent
A pointer to the specific TRestRawSignalEvent input.
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.
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