Diana Software
QAveragePulseEstimator.cc
Go to the documentation of this file.
2 
3 using namespace Diana;
4 
6 {
7  fAlignment = false;
8  fFractional = false;
9  fMaxShift = 0;
10  fAveragePulse.Resize(size);
11  Clear();
12 }
13 
15 {
16  int size = fAveragePulse.Size();
17  fAveragePulse.Clear();
18  fAveragePulse.Resize(size);
19  fAveragePulse.Initialize(0);
20  fNumberOfPulses = 0;
21 }
22 
23 /*
24 void QAveragePulseEstimator::SetAlignment(bool fractional, const int maxShift)
25 {
26  fAlignment = true;
27  fFractional = fractional;
28  fMaxShift = maxShift;
29 }
30 */
31 QError QAveragePulseEstimator::Add(const QVector& pulse)
32 {
34  if(!fAlignment) {
35  if(fAveragePulse.Size() != pulse.Size()) return QERR_SIZE_NOT_MATCH;
36  fAveragePulse += pulse;
37  fNumberOfPulses++;
38  }
39  return err;
40 }
41 
43 {
44  QVector ret;
45  if(fNumberOfPulses <= 0) {
46  return ret;
47  }
48  ret = fAveragePulse;
49  ret /= fNumberOfPulses;
50  return ret;
51 }
52 
53 
err
Definition: CheckOF.C:114
@ QERR_SIZE_NOT_MATCH
Definition: QError.hh:31
@ QERR_SUCCESS
Definition: QError.hh:27
QError Add(const Diana::QVector &pulse)
Diana::QVector GetAveragePulse() const
QAveragePulseEstimator(const int size)
error class with error type and description
Definition: QError.hh:115
the Diana namespace is needed because sometimes we use Qt libraries, that use same class names of our...