22#ifndef RestCore_TRestDetectorSignal
23#define RestCore_TRestDetectorSignal
34 Int_t GetTimeIndex(Double_t t);
39 std::vector<Float_t> fSignalTime;
40 std::vector<Float_t> fSignalCharge;
45 std::vector<Int_t> fPointsOverThreshold;
51 Int_t GetMaxIndex(Int_t from = 0, Int_t to = 0);
53 TVector2 GetMaxGauss();
54 TVector2 GetMaxLandau();
55 TVector2 GetMaxAget();
58 TVector2 GetPoint(Int_t n) {
59 TVector2 vector2(GetTime(n), GetData(n));
64 inline Int_t GetSignalID()
const {
return fSignalID; }
65 inline Int_t GetID()
const {
return fSignalID; }
67 void IncreaseTimeBinBy(Int_t bin, Double_t data) {
68 if (bin >= GetNumberOfPoints()) {
69 std::cout <<
"Increase time bin: outside limits" << std::endl;
73 fSignalCharge[bin] += data;
76 Int_t GetNumberOfPoints() {
77 if (fSignalTime.size() != fSignalCharge.size()) {
78 std::cout <<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
79 std::cout <<
"WARNING, the two std::vector sizes did not match" << std::endl;
80 std::cout <<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
82 return fSignalTime.size();
85 Double_t GetIntegralWithTime(Double_t startTime, Double_t endTime);
86 Double_t GetIntegral(Int_t startBin = 0, Int_t endBin = 0);
88 void Normalize(Double_t scale = 1.);
90 std::vector<Int_t> GetPointsOverThreshold() {
return fPointsOverThreshold; }
92 Double_t GetAverage(Int_t start = 0, Int_t end = 0);
93 Int_t GetMaxPeakWidth();
94 Double_t GetMaxPeakWithTime(Double_t startTime, Double_t endTime);
96 Double_t GetMaxPeakValue();
97 Double_t GetMinPeakValue();
99 Double_t GetMaxPeakTime(Int_t from = 0, Int_t to = 0);
101 Double_t GetMaxValue() {
return GetMaxPeakValue(); }
102 Double_t GetMinValue() {
return GetMinPeakValue(); }
104 Double_t GetMinTime();
105 Double_t GetMaxTime();
107 Double_t GetData(Int_t index) {
return (
double)fSignalCharge[index]; }
108 Double_t GetTime(Int_t index) {
return (
double)fSignalTime[index]; }
111 void SetSignalID(Int_t sID) { fSignalID = sID; }
112 void SetID(Int_t sID) { fSignalID = sID; }
114 void NewPoint(Float_t time, Float_t data);
117 void SetPoint(Double_t t, Double_t d);
118 void SetPoint(Int_t index, Double_t t, Double_t d);
120 Double_t GetStandardDeviation(Int_t startBin, Int_t endBin);
121 Double_t GetBaseLine(Int_t startBin, Int_t endBin);
122 Double_t GetBaseLineSigma(Int_t startBin, Int_t endBin, Double_t baseline = 0);
124 Double_t SubstractBaseline(Int_t startBin, Int_t endBin);
125 void AddOffset(Double_t offset);
127 void MultiplySignalBy(Double_t factor);
128 void ExponentialConvolution(Double_t fromTime, Double_t decayTime, Double_t offset = 0);
142 void AddGaussianSignal(Double_t amp, Double_t sigma, Double_t time, Int_t N, Double_t fromTime,
147 fSignalCharge.clear();
150 void WriteSignalToTextFile(TString filename);
153 TGraph* GetGraph(Int_t color = 1);
void IncreaseAmplitude(TVector2 p)
If the point already exists inside the detector signal event, the amplitude value will be added to th...
void SetPoint(TVector2 p)
If the point already exists inside the detector signal event, it will be overwritten....