22 #ifndef RestCore_TRestDetectorSignal
23 #define RestCore_TRestDetectorSignal
26 #include <TRestStringOutput.h>
35 Int_t GetTimeIndex(Double_t t);
40 std::vector<Float_t> fSignalTime;
41 std::vector<Float_t> fSignalCharge;
50 std::vector<Int_t> fPointsOverThreshold;
56 Int_t GetMaxIndex(Int_t from = 0, Int_t to = 0);
58 TVector2 GetMaxGauss();
59 TVector2 GetMaxLandau();
60 TVector2 GetMaxAget();
62 std::string GetSignalName()
const {
return fName; }
63 std::string GetSignalType()
const {
return fType; }
65 void SetSignalName(
const std::string& name) { fName = name; }
66 void SetSignalType(
const std::string& type) { fType = type; }
69 TVector2 GetPoint(Int_t n) {
70 TVector2 vector2(GetTime(n), GetData(n));
75 inline Int_t GetSignalID()
const {
return fSignalID; }
76 inline Int_t GetID()
const {
return fSignalID; }
78 void IncreaseTimeBinBy(Int_t bin, Double_t data) {
79 if (bin >= GetNumberOfPoints()) {
80 std::cout <<
"Increase time bin: outside limits" << std::endl;
84 fSignalCharge[bin] += data;
87 Int_t GetNumberOfPoints()
const {
88 if (fSignalTime.size() != fSignalCharge.size()) {
89 RESTError <<
"WARNING, the two std::vector sizes did not match" << RESTendl;
92 return fSignalTime.size();
95 Double_t GetIntegralWithTime(Double_t startTime, Double_t endTime)
const;
96 Double_t GetIntegral(Int_t startBin = 0, Int_t endBin = 0)
const;
98 void Normalize(Double_t scale = 1.);
100 std::vector<Int_t> GetPointsOverThreshold() {
return fPointsOverThreshold; }
102 Double_t GetAverage(Int_t start = 0, Int_t end = 0);
103 Int_t GetMaxPeakWidth();
104 Double_t GetMaxPeakWithTime(Double_t startTime, Double_t endTime);
106 Double_t GetMaxPeakValue();
107 Double_t GetMinPeakValue();
109 Double_t GetMaxPeakTime(Int_t from = 0, Int_t to = 0);
111 Double_t GetMaxValue() {
return GetMaxPeakValue(); }
112 Double_t GetMinValue() {
return GetMinPeakValue(); }
114 Double_t GetMinTime()
const;
115 Double_t GetMaxTime()
const;
117 Double_t GetData(Int_t index)
const {
return (
double)fSignalCharge[index]; }
118 Double_t GetTime(Int_t index)
const {
return (
double)fSignalTime[index]; }
121 void SetSignalID(Int_t sID) { fSignalID = sID; }
122 void SetID(Int_t sID) { fSignalID = sID; }
124 void NewPoint(Float_t time, Float_t data);
127 void SetPoint(Double_t t, Double_t d);
128 void SetPoint(Int_t index, Double_t t, Double_t d);
130 Double_t GetStandardDeviation(Int_t startBin, Int_t endBin);
131 Double_t GetBaseLine(Int_t startBin, Int_t endBin);
132 Double_t GetBaseLineSigma(Int_t startBin, Int_t endBin, Double_t baseline = 0);
134 Double_t SubstractBaseline(Int_t startBin, Int_t endBin);
135 void AddOffset(Double_t offset);
137 void MultiplySignalBy(Double_t factor);
138 void ExponentialConvolution(Double_t fromTime, Double_t decayTime, Double_t offset = 0);
152 void AddGaussianSignal(Double_t amp, Double_t sigma, Double_t time, Int_t N, Double_t fromTime,
157 fSignalCharge.clear();
160 void WriteSignalToTextFile(
const TString& filename);
163 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....