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