/** * @file SWaveform.cpp * @author Dan Saunders, on behalf of the SoLid collaboration. * @date 16 Feb 2016 */ #include "SWaveform.h" //============================================================================== SWaveform::SWaveform(uint64_t time, double htime, SChannel * channel) : m_time(time), m_htime(htime), m_channel(channel) { } //! Constructor setting passed values. /*! Passed values times and channel of the waveform, but not the samples. Those * are added separetly. */ SWaveform::SWaveform(uint64_t time, double htime, std::vector samples, SChannel * channel) : m_samples(samples), m_time(time), m_htime(htime), m_channel(channel) { } //============================================================================== //! Creates a histogram showing the samples in this waveform. TH1D * SWaveform::getHistogram(std::string name, std::string title) { TH1D * histo = new TH1D(name.c_str(), title.c_str(), 2048, 0, 2048); for (int i=0; iSetBinContent(i+1, m_samples[i]); return histo; } //============================================================================== //! Integral of this waveform over a set range. Units of ADCSamples. float SWaveform::integrate(int iSample, int m_integralRange, float baseline) { float integral = 0; /* Requests may want to access part of the waveform that doesnt exist, for * example, a peak found at the second sample in a random trigger. Need to check * iSample is not negative; if so, just start from zero. */ for (int i=0; i