22#ifndef RestCore_TRestDetectorSignal
23#define RestCore_TRestDetectorSignal
26#include <TRestStringOutput.h>
35 Int_t GetMinIndex()
const;
36 Int_t GetTimeIndex(Double_t t);
41 std::vector<Double_t> fSignalTime;
42 std::vector<Double_t> fSignalCharge;
51 std::vector<Int_t> fPointsOverThreshold;
57 Int_t GetMaxIndex(Int_t from = 0, Int_t to = 0);
59 std::optional<std::pair<Double_t, Double_t>> GetPeakGauss();
60 std::optional<std::pair<Double_t, Double_t>> GetPeakLandau();
61 std::optional<std::pair<Double_t, Double_t>> GetPeakAget();
63 std::string GetSignalName()
const {
return fName; }
64 std::string GetSignalType()
const {
return fType; }
66 void SetSignalName(
const std::string& name) { fName = name; }
67 void SetSignalType(
const std::string& type) { fType = type; }
70 TVector2 GetPoint(Int_t n) {
return {GetTime(n), GetData(n)}; }
72 inline Int_t GetSignalID()
const {
return fSignalID; }
73 inline Int_t GetID()
const {
return fSignalID; }
75 void IncreaseTimeBinBy(Int_t bin, Double_t data) {
76 if (bin >= GetNumberOfPoints()) {
77 std::cout <<
"Increase time bin: outside limits" << std::endl;
81 fSignalCharge[bin] += data;
84 Int_t GetNumberOfPoints()
const {
85 if (fSignalTime.size() != fSignalCharge.size()) {
86 RESTError <<
"WARNING, the two std::vector sizes did not match" << RESTendl;
89 return fSignalTime.size();
92 Double_t GetIntegralWithTime(Double_t startTime, Double_t endTime)
const;
93 Double_t GetIntegral(Int_t startBin = 0, Int_t endBin = 0)
const;
95 void Normalize(Double_t scale = 1.);
97 std::vector<Int_t> GetPointsOverThreshold()
const {
return fPointsOverThreshold; }
99 Double_t GetAverage(Int_t start = 0, Int_t end = 0);
100 Int_t GetMaxPeakWidth();
101 Double_t GetMaxPeakWithTime(Double_t startTime, Double_t endTime)
const;
103 Double_t GetMaxPeakValue();
104 Double_t GetMinPeakValue();
106 Double_t GetMaxPeakTime(Int_t from = 0, Int_t to = 0);
108 Double_t GetMaxValue() {
return GetMaxPeakValue(); }
109 Double_t GetMinValue() {
return GetMinPeakValue(); }
111 Double_t GetMinTime()
const;
112 Double_t GetMaxTime()
const;
114 Double_t GetData(Int_t index)
const {
return fSignalCharge[index]; }
115 Double_t GetTime(Int_t index)
const {
return fSignalTime[index]; }
118 void SetSignalID(Int_t sID) { fSignalID = sID; }
119 void SetID(Int_t sID) { fSignalID = sID; }
121 void NewPoint(Double_t time, Double_t data);
124 void SetPoint(Double_t t, Double_t d);
125 void SetPoint(Int_t index, Double_t t, Double_t d);
127 Double_t GetStandardDeviation(Int_t startBin, Int_t endBin);
128 Double_t GetBaseLine(Int_t startBin, Int_t endBin);
129 Double_t GetBaseLineSigma(Int_t startBin, Int_t endBin, Double_t baseline = 0);
131 Double_t SubstractBaseline(Int_t startBin, Int_t endBin);
132 void AddOffset(Double_t offset);
134 void MultiplySignalBy(Double_t factor);
135 void ExponentialConvolution(Double_t fromTime, Double_t decayTime, Double_t offset = 0);
138 Bool_t isSorted()
const;
149 void AddGaussianSignal(Double_t amp, Double_t sigma, Double_t time, Int_t N, Double_t fromTime,
154 fSignalCharge.clear();
157 void WriteSignalToTextFile(
const TString& filename)
const;
160 TGraph* GetGraph(Int_t color = 1);
void IncreaseAmplitude(const TVector2 &p)
If the point already exists inside the detector signal event, the amplitude value will be added to th...
void SetPoint(const TVector2 &p)
If the point already exists inside the detector signal event, it will be overwritten....