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