250 #include "TRestRawSignalAnalysisProcess.h"
271 SetSectionName(this->ClassName());
272 SetLibraryVersion(LIBRARY_VERSION);
273 fSignalEvent =
nullptr;
280 if (fSignalsRange.X() != -1 && fSignalsRange.Y() != -1) {
281 fRangeEnabled =
true;
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;
324 event.SetBaseLineRange(fBaseLineRange, fBaseLineOption);
325 event.SetRange(fIntegralRange);
327 for (
int s = 0; s <
event.GetNumberOfSignals(); s++) {
332 fPointsOverThreshold);
334 if (fRangeEnabled && (sgnl->
GetID() < fSignalsRange.X() || sgnl->
GetID() > fSignalsRange.Y())) {
356 SetObservableValue(
"pointsoverthres_map", npointsot);
357 SetObservableValue(
"risetime_map", risetime);
358 SetObservableValue(
"peak_time_map", peak_time);
359 SetObservableValue(
"baseline_map", baseline);
360 SetObservableValue(
"baselinesigma_map", baselinesigma);
361 SetObservableValue(
"max_amplitude_map", ampsgn_maxmethod);
362 SetObservableValue(
"thr_integral_map", ampsgn_intmethod);
363 SetObservableValue(
"SaturatedChannelID", saturatedchnId);
365 Double_t baseLineMean =
event.GetBaseLineAverage();
366 SetObservableValue(
"BaseLineMean", baseLineMean);
368 Double_t baseLineSigma =
event.GetBaseLineSigmaAverage();
369 SetObservableValue(
"BaseLineSigmaMean", baseLineSigma);
371 Double_t timeDelay =
event.GetMaxTime() -
event.GetMinTime();
372 SetObservableValue(
"TimeBinsLength", timeDelay);
374 Int_t nSignals =
event.GetNumberOfSignals();
375 SetObservableValue(
"NumberOfSignals", nSignals);
376 SetObservableValue(
"NumberOfGoodSignals", nGoodSignals);
411 Double_t fullIntegral =
event.GetIntegral();
412 SetObservableValue(
"FullIntegral", fullIntegral);
414 Double_t thrIntegral =
event.GetThresholdIntegral();
415 SetObservableValue(
"ThresholdIntegral", thrIntegral);
417 Double_t riseSlope =
event.GetRiseSlope();
418 SetObservableValue(
"RiseSlopeAvg", riseSlope);
420 Double_t slopeIntegral =
event.GetSlopeIntegral();
421 SetObservableValue(
"SlopeIntegral", slopeIntegral);
423 Double_t rateOfChange = riseSlope / slopeIntegral;
424 if (slopeIntegral == 0) rateOfChange = 0;
425 SetObservableValue(
"RateOfChangeAvg", rateOfChange);
427 Double_t riseTime =
event.GetRiseTime();
428 SetObservableValue(
"RiseTimeAvg", riseTime);
430 Double_t tripleMaxIntegral =
event.GetTripleMaxIntegral();
431 SetObservableValue(
"TripleMaxIntegral", tripleMaxIntegral);
433 Double_t integralRatio = (fullIntegral - thrIntegral) / (fullIntegral + thrIntegral);
434 SetObservableValue(
"IntegralBalance", integralRatio);
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++) {
448 if (fRangeEnabled && (sgnl->
GetID() < fSignalsRange.X() || sgnl->
GetID() > fSignalsRange.Y()))
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;
475 SetObservableValue(
"AmplitudeIntegralRatio", ampIntRatio);
476 SetObservableValue(
"MinPeakAmplitude", minValue);
477 SetObservableValue(
"MaxPeakAmplitude", maxValue);
478 SetObservableValue(
"PeakAmplitudeIntegral", maxValueIntegral);
480 SetObservableValue(
"MinEventValue", minDownValue);
482 Double_t amplitudeRatio = maxValueIntegral / maxValue;
483 if (maxValue == 0) amplitudeRatio = 0;
485 SetObservableValue(
"AmplitudeRatio", amplitudeRatio);
486 SetObservableValue(
"MaxPeakTime", maxPeakTime);
487 SetObservableValue(
"MinPeakTime", minPeakTime);
489 Double_t peakTimeDelay = maxPeakTime - minPeakTime;
491 SetObservableValue(
"MaxPeakTimeDelay", peakTimeDelay);
492 SetObservableValue(
"AveragePeakTime", peakTimeAverage);
495 for (
const auto& i : fObservablesDefined) {
496 fAnalysisTree->PrintObservable(i.second);
virtual void InitFromConfigFile() override
To make settings from rml file. This method must be implemented in the derived class.
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.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
TRestRawSignalAnalysisProcess()
Default constructor.
void Initialize() override
Function to initialize input/output event members and define the section name.
~TRestRawSignalAnalysisProcess()
Default destructor.
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.
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...
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...
std::vector< Int_t > GetPointsOverThreshold() const
Returns a std::vector containing the indexes of data points over threshold.
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