File indexing completed on 2025-01-17 09:55:58
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #ifndef SIPM_SIPMSIGNAL_H
0020 #define SIPM_SIPMSIGNAL_H
0021
0022 #include <algorithm>
0023 #include <cmath>
0024 #include <iomanip>
0025 #include <iostream>
0026 #include <numeric>
0027 #include <stdint.h>
0028 #include <vector>
0029
0030 namespace sipm {
0031
0032 class SiPMAnalogSignal {
0033 public:
0034
0035 SiPMAnalogSignal() = default;
0036
0037
0038 SiPMAnalogSignal(const std::vector<double>& wav, const double sampling) noexcept
0039 : m_Waveform(wav), m_Sampling(sampling){};
0040
0041
0042 SiPMAnalogSignal& operator=(const std::vector<double>&& aVect) noexcept {
0043 m_Waveform = std::move(aVect);
0044 return *this;
0045 }
0046
0047
0048 inline double& operator[](const uint32_t i) noexcept { return m_Waveform[i]; }
0049
0050 inline double operator[](const uint32_t i) const noexcept { return m_Waveform[i]; }
0051
0052
0053 uint32_t size() const { return m_Waveform.size(); }
0054
0055 void clear() { m_Waveform.clear(); m_peak = -1;}
0056
0057 double sampling() const { return m_Sampling; }
0058
0059 std::vector<double> waveform() const { return m_Waveform; }
0060
0061
0062 double integral(const double, const double, const double) const;
0063
0064 double peak(const double, const double, const double) const;
0065
0066 double tot(const double, const double, const double) const;
0067
0068 double toa(const double, const double, const double) const;
0069
0070 double top(const double, const double, const double) const;
0071
0072
0073 void setSampling(const double x) { m_Sampling = x; }
0074
0075
0076 SiPMAnalogSignal lowpass(const double) const;
0077
0078 friend std::ostream& operator<<(std::ostream&, const SiPMAnalogSignal&);
0079
0080 private:
0081 std::vector<double> m_Waveform;
0082 double m_Sampling;
0083 mutable double m_peak = -1;
0084
0085 } ;
0086 }
0087 #endif