10#include <klm/simulation/ScintillatorFirmware.h>
30 const int nPointsSigBg = 10;
33 int i, ithr, ibg, sum, bgSum, min;
39 for (i = 0; i < m_nPoints; i++) {
40 if (amp[i] < threshold) {
47 else if (amp[i] < min)
52 return c_ScintillatorFirmwareNoSignal;
54 ibg = std::max(ithr - nPointsSigBg, 0);
57 return c_ScintillatorFirmwareNoSignal;
59 for (i = 0; i < ibg; i++)
60 bgSum = bgSum + amp[i];
61 bg = float(bgSum) / i;
62 sigAmp = bg * m_nPoints - sum;
65 fitData->setStartTime(ithr);
66 fitData->setBackgroundAmplitude(bg);
67 fitData->setAmplitude(sigAmp);
68 fitData->setMinimalAmplitude(min);
69 return c_ScintillatorFirmwareSuccessfulFit;
FPGA fit simulation data.
ScintillatorFirmware(int nPoints)
Constructor.
enum ScintillatorFirmwareFitStatus fit(const int *amp, int threshold, KLMScintillatorFirmwareFitResult *fitData)
FPGA fitter.
~ScintillatorFirmware()
Destructor.
Abstract base class for different kinds of events.