Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JNPETable1D.hh
Go to the documentation of this file.
1 #ifndef __JNPETABLE1D__
2 #define __JNPETABLE1D__
3 
4 #include <cmath>
5 
6 #include "JTools/JSpline.hh"
7 #include "JTools/JElement.hh"
10 #include "JGeometry3D/JOmega3D.hh"
11 #include "JPhysics/JNPETable.hh"
12 
13 
14 /**
15  * \author mdejong
16  */
17 
18 namespace JPHYSICS {}
19 namespace JPP { using namespace JPHYSICS; }
20 
21 namespace JPHYSICS {
22 
27 
28 
29  /**
30  * Custom class for the integrated values of the PDF of the arrival time of Cherenkov light.
31  *
32  * This class provides for the average number of photo-electrons as a function of
33  * the leading parameter value (<tt>R</tt>).
34  * The average is taken over the orientations of the PMT in the full solid angle.
35  */
36  template<class JFunction1D_t>
37  class JNPETable1D :
38  public JFunction1D_t
39  {
40  public:
41 
42  typedef typename JFunction1D_t::argument_type argument_type;
43  typedef typename JFunction1D_t::result_type result_type;
44 
45 
46  /**
47  * Default constructor.
48  */
50  {}
51 
52 
53  /**
54  * Constructor.
55  *
56  * \param input multi-dimensional PDF
57  */
58  template<class JPDF_t, class JPDFMaplist_t, class JPDFDistance_t>
60  {
61  using namespace JTOOLS;
62  using namespace JGEOMETRY3D;
63 
64  typedef JTransformableMultiFunction<JPDF_t, JPDFMaplist_t, JPDFDistance_t> JTransformableMultiFunction_t;
65 
67 
68  const JOmega3D omega(0.03*PI);
69 
70  for (typename JTransformableMultiFunction_t::const_iterator i = input.begin(); i != input.end(); ++i) {
71 
72  const double R = i->getX();
73 
74  // average intensity
75 
76  double y = 0.0;
77 
78  for (JOmega3D::const_iterator dir = omega.begin(); dir != omega.end(); ++dir) {
79  y += intensity(R, dir->getTheta(), fabs(dir->getPhi()));
80  }
81 
82  this->put(R,y/omega.size());
83  }
84 
85  this->compile();
86  this->setExceptionHandler(new typename JFunction1D_t::JDefaultResult(JMATH::zero));
87  }
88  };
89 }
90 
91 #endif
JFunction1D_t::argument_type argument_type
Definition: JNPETable1D.hh:42
JNPETable1D()
Default constructor.
Definition: JNPETable1D.hh:49
JFunction1D_t::result_type result_type
Definition: JNPETable1D.hh:43
Transformable multidimensional function.
The elements in a collection are sorted according to their abscissa values and a given distance opera...
Custom class for the integrated values of the PDF of the arrival time of Cherenkov light...
Definition: JNPETable1D.hh:37
static const double PI
Constants.
Definition: JConstants.hh:20
static const JZero zero
Function object to assign zero value.
Definition: JZero.hh:105
Direction set covering (part of) solid angle.
Definition: JOmega3D.hh:64
Template class for spline interpolation in 1D.
Definition: JSpline.hh:657
General purpose class for collection of equidistant elements.
then usage $script[distance] fi case set_variable R
Definition: JDrawLED.sh:40
JNPETable1D(const JTransformableMultiFunction< JPDF_t, JPDFMaplist_t, JPDFDistance_t > &input)
Constructor.
Definition: JNPETable1D.hh:59
2D Element for spline interpolations.
Definition: JElement.hh:151
Custom class for integrated values of the PDF of the arrival time of Cherenkov light.
Definition: JNPETable.hh:39