Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
WaveformSpikeFunctor.h
Go to the documentation of this file.
1 /*
2  * WaveformSpikeFunctor.h
3  *
4  * Created on: Jun 8, 2017
5  * Author: Hovanes Egiyan
6  */
7 
8 #ifndef LIBRARIES_TAC_WAVEFORMSPIKEFUNCTOR_H_
9 #define LIBRARIES_TAC_WAVEFORMSPIKEFUNCTOR_H_
10 
11 #include <math.h>
12 
13 #include <iostream>
14 #include <string>
15 #include <functional>
16 
18 public:
20  }
22  }
24  return "SPIKE";
25  }
26  double operator()(const double* xArray, const double* pArray) {
27  static const double zeroTolerance = 1.0e-25;
28 
29  double x = xArray[0];
30  double pedestal = pArray[0];
31  double peakPoint = pArray[1];
32  double riseTime = pArray[2];
33 // double lineSlope = pArray[2];
34 
35  double expAmpl = pArray[3];
36  double expLambda = pArray[4];
37 
38  double lineSlope = 0;
39  if( riseTime > zeroTolerance ) {
40  lineSlope = expAmpl / riseTime;
41  }
42 
43  double lineIntersect = expAmpl - lineSlope * peakPoint;
44 
45  double value = 0;
46 
47  if (x > peakPoint) {
48  if (fabs(expLambda) > 1.0e-25) {
49  value = expAmpl * exp(-(x - peakPoint) / expLambda) + pedestal;
50  } else {
51  value = pedestal;
52  }
53  } else {
54  value = lineSlope * x + lineIntersect + pedestal;
55  if (value < pedestal)
56  value = pedestal;
57  }
58  return value;
59  }
60 };
61 
62 #endif /* LIBRARIES_TAC_WAVEFORMSPIKEFUNCTOR_H_ */
Double_t x[NCHANNELS]
Definition: st_tw_resols.C:39
char string[256]
double operator()(const double *xArray, const double *pArray)
TEllipse * e
static TH1I * pedestal[nChan]
static std::string getTagString()