Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JCDFTable1D.hh
Go to the documentation of this file.
1#ifndef __JSIRENE__JCDFTABLE1D__
2#define __JSIRENE__JCDFTABLE1D__
3
4#include <cmath>
5
9#include "JTools/JPolint.hh"
14
15
16/**
17 * \author mdejong
18 */
19
20namespace JPHYSICS {}
21namespace JPP { using namespace JPHYSICS; }
22
23namespace JPHYSICS {
24
25 using JTOOLS::JMapList;
31
32
33 /**
34 * Custom class for CDF table in 1 dimension.
35 * This class provides an upper limit for the avegare number of photo-electrons
36 * as a function of the distance.
37 */
38 template<class JArgument_t, class JResult_t>
40 public JPolintFunction1D<1, JElement2D<JArgument_t,JResult_t>, JGridCollection>
41 {
42 public:
43
44 typedef JArgument_t argument_type;
45 typedef JResult_t result_type;
46
49
51
52
53 /**
54 * Default constructor.
55 */
57 {}
58
59
60 /**
61 * Constructor.
62 *
63 * \param cdf CDF (4D table)
64 * \param number_of_bins number of bins (1D table)
65 * \param safety_factor safety factor
66 */
67 template<class JCDF_t, class JCDFMaplist_t, class JCDFDistance_t>
69 const int number_of_bins,
70 const double safety_factor = 2.0)
71 {
72 using namespace JPP;
73
74 // extract the weight function
75
76 try {
77
79
80 const JPDFTransformer_t& object = dynamic_cast<const JPDFTransformer_t&>(*(cdf.transformer));
81
82 transformer.reset(object.transformer.clone());
83 }
84 catch(const std::exception& error) {
86 }
87
88 // build the 1D table
89
90 this->configure(make_grid(number_of_bins, cdf.intensity.begin()->getX(), cdf.intensity.rbegin()->getX()));
91
92 const JOmega3D omega(JDirection3D(0,1,0), JOmega3D::range_type(0.0,0.501*PI), 0.07*PI);
93
94 for (typename JFunction1D_t::iterator j = this->begin(); j != this->end(); ++j) {
95
96 const double R = j->getX();
97 const double W = transformer->getWeight(R);
98
99 double y = 0.0;
100
101 for (JOmega3D::const_iterator dir = omega.begin(); dir != omega.end(); ++dir) {
102 y += cdf.getNPE(R, dir->getTheta(), fabs(dir->getPhi()));
103 }
104
105 y /= omega.size();
106
107 j->getY() = safety_factor * y / W;
108 }
109
110 this->compile();
111 }
112
113
114 /**
115 * Get number of photo-electrons.
116 *
117 * \param R distance between muon and PMT [m]
118 * \return number of photo-electrons
119 */
120 double getNPE(const double R) const
121 {
122 const double buffer[] = { R };
123
124 const double y = this->evaluate(buffer);
125 const double W = this->transformer->getWeight(R);
126
127 return y * W;
128 }
129
130
132 };
133}
134
135#endif
Various implementations of functional maps.
Physics constants.
Data structure for direction in three dimensions.
Direction set covering (part of) solid angle.
Definition JOmega3D.hh:68
The template JSharedPointer class can be used to share a pointer to an object.
Custom class for CDF table in 1 dimension.
JArgument_t argument_type
JMultiMapTransformer< 1, argument_type > transformer_type
double getNPE(const double R) const
Get number of photo-electrons.
JCDFTable1D(const JCDFTable< JCDF_t, JCDFMaplist_t, JCDFDistance_t > &cdf, const int number_of_bins, const double safety_factor=2.0)
Constructor.
JPolintFunction1D< 1, JElement2D_t, JGridCollection > JFunction1D_t
JElement2D< argument_type, result_type > JElement2D_t
JLANG::JSharedPointer< transformer_type > transformer
JCDFTable1D()
Default constructor.
Multi-dimensional CDF table for arrival time of Cherenkov light.
Definition JCDFTable.hh:58
std::shared_ptr< transformer_type > transformer
Definition JCDFTable.hh:232
JMultiQuantile_t intensity
Definition JCDFTable.hh:230
double getNPE(const Args &...args) const
Get number of photo-electrons.
Definition JCDFTable.hh:160
Transformer for the 1D probability density function (PDF) of the time response of a PMT to a muon.
Template definition of transformer of the probability density function (PDF) of the time response of ...
General purpose class for collection of equidistant elements.
Multidimensional interpolation method.
Interface for weight application and coordinate transformation of function.
static JMultiMapTransformer * getClone()
Get clone of default transformer.
Template class for polynomial interpolation in 1D.
Definition JPolint.hh:1095
collection_type::iterator iterator
Definition JPolint.hh:1107
Auxiliary methods for light properties of deep-sea water.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
2D Element.
Definition JPolint.hh:1131
Map list.
Definition JMapList.hh:25
Type definition of a 1st degree polynomial interpolation based on a JGridMap implementation.