Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JGetRiseTime.hh
Go to the documentation of this file.
1 #ifndef __JTRIGGER__JGETRISETIME__
2 #define __JTRIGGER__JGETRISETIME__
3 
4 #include <vector>
5 #include <cmath>
6 
7 #include "JLang/JCC.hh"
8 
9 
10 /**
11  * \file
12  *
13  * Rise time evaluation.
14  * \author mdejong
15  */
16 namespace JTRIGGER {}
17 namespace JPP { using namespace JTRIGGER; }
18 
19 namespace JTRIGGER {
20 
21  /**
22  * Auxiliary class for rise time evaluation.
23  *
24  * \f[ \Delta t = p_0 \exp(p_1 \sqrt{x} + p_2 x) ~+~ p_3 \f]
25  *
26  * where
27  * \f$\Delta t\f$ (ns) is the time it takes the analogue pulse to rise to the discriminator threshold and
28  * \f$x\f$ the time over threshold (ns).
29  */
30  struct JGetRiseTime :
31  public std::vector<double>
32  {
33  /**
34  * Default constructor.
35  */
37  {
38  for (int i = 0; i <= 256; ++i) {
39 
40  const double tot = i;
41  const double t1 = p0() * exp(p1()*sqrt(tot) + p2()*tot) + p3();
42 
43  this->push_back(t1);
44  }
45  }
46 
47 
48  /**
49  * Get time of analogue signal to rise to discriminator threshold (so-called time slewing).
50  *
51  * \param tot time over threshold [ns]
52  * \return rise time [ns]
53  */
54  double operator()(const double tot) const
55  {
56  int i = (int) tot;
57 
58  if (i < 0)
59  return *(this->begin());
60  else if (i >= (int) this->size())
61  return *(this->rbegin());
62  else
63  return (*this)[i];
64  }
65 
66 
67  static double p0() { return 7.70824; }
68  static double p1() { return 0.00879447; }
69  static double p2() { return -0.0621101; }
70  static double p3() { return -1.90226; }
71  };
72 
73 
74  /**
75  * Function object for rise time evaluation.
76  */
77  static const JGetRiseTime getRiseTime;
78 }
79 
80 #endif
static double p1()
Definition: JGetRiseTime.hh:68
JGetRiseTime()
Default constructor.
Definition: JGetRiseTime.hh:36
static double p0()
Definition: JGetRiseTime.hh:67
Compiler version dependent expressions, macros, etc.
static const JGetRiseTime getRiseTime
Function object for rise time evaluation.
Definition: JGetRiseTime.hh:77
Auxiliary class for rise time evaluation.
Definition: JGetRiseTime.hh:30
double operator()(const double tot) const
Get time of analogue signal to rise to discriminator threshold (so-called time slewing).
Definition: JGetRiseTime.hh:54
static double p3()
Definition: JGetRiseTime.hh:70
static double p2()
Definition: JGetRiseTime.hh:69