Jpp 20.0.0-27-g39925593c-D
the software that should make you happy
Loading...
Searching...
No Matches
JCDFTable2D.hh
Go to the documentation of this file.
1#ifndef __JSIRENE__JCDFTABLE2D__
2#define __JSIRENE__JCDFTABLE2D__
3
4#include <cmath>
5
9#include "JTools/JPolint.hh"
12#include "JTools/JMultiGrid.hh"
15
16
17/**
18 * \author mdejong
19 */
20
21namespace JPHYSICS {}
22namespace JPP { using namespace JPHYSICS; }
23
24namespace JPHYSICS {
25
26 using JTOOLS::JMapList;
32
33
34 /**
35 * Custom class for CDF table in 2 dimensions.
36 * This class provides an upper limit for the average number of photo-electrons
37 * as a function of the distance and the cosine of the emission angle.
38 */
39 template<class JArgument_t, class JResult_t>
41 public JMultiFunction<JPolintFunction1D<1, JElement2D<JArgument_t,JResult_t>, JGridCollection>,
42 JMapList<JPolint1FunctionalGridMap> >
43 {
44 public:
45
46 typedef JArgument_t argument_type;
47 typedef JResult_t result_type;
48
53
55
56
57 /**
58 * Default constructor.
59 */
61 {}
62
63
64 /**
65 * Constructor.
66 *
67 * \param cdf CDF (5D table)
68 * \param number_of_bins number of bins (2D table)
69 * \param safety_factor safety factor
70 */
71 template<class JCDF_t, class JCDFMaplist_t, class JCDFDistance_t>
73 const int number_of_bins,
74 const double safety_factor = 2.0) :
76 {
77 using namespace JPP;
78
79 // extract the weight function
80
81 try {
82
84
85 const JPDFTransformer_t& object = dynamic_cast<const JPDFTransformer_t&>(*(cdf.transformer));
86
87 transformer.reset(object.transformer.clone());
88 }
89 catch(const std::exception& error) {
91 }
92
93
94 // build the 2D table
95
96 this->configure(make_grid(number_of_bins, cdf.intensity.begin()->getX(), cdf.intensity.rbegin()->getX()));
97
98 const JOmega3D omega(JDirection3D(0,1,0), JOmega3D::range_type(0.0,0.501*PI), 0.07*PI);
99
100 for (typename JFunction2D_t::iterator i = this->begin(); i != this->end(); ++i) {
101
102 i->getY().configure(make_grid(number_of_bins, -1.0, +1.0));
103
104 for (typename JFunction1D_t::iterator j = i->getY().begin(); j != i->getY().end(); ++j) {
105
106 const double D = i->getX();
107 const double cd = j->getX();
108 const double W = transformer->getWeight(D, cd);
109
110 double y = 0.0;
111
112 for (JOmega3D::const_iterator dir = omega.begin(); dir != omega.end(); ++dir) {
113 y += cdf.getNPE(D, cd, dir->getTheta(), fabs(dir->getPhi()));
114 }
115
116 y /= omega.size();
117
118 j->getY() = safety_factor * y / W;
119 }
120 }
121
122 this->compile();
123 }
124
125
126 /**
127 * Get number of photo-electrons.
128 *
129 * \param D distance between EM shower and PMT [m]
130 * \param cd cosine angle EM shower direction and EM shower - PMT position
131 * \return number of photo-electrons
132 */
133 double getNPE(const double D,
134 const double cd) const
135 {
136 const double buffer[] = { D, cd };
137
138 const double y = this->evaluate(buffer);
139 const double W = this->transformer->getWeight(D, cd);
140
141 return y * W;
142 }
143
144
146 };
147}
148
149#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.
Template definition of a multi-dimensional oscillation probability interpolation table.
Custom class for CDF table in 2 dimensions.
JPolintFunction1D< 1, JElement2D_t, JGridCollection > JFunction1D_t
JLANG::JSharedPointer< transformer_type > transformer
double getNPE(const double D, const double cd) const
Get number of photo-electrons.
JCDFTable2D(const JCDFTable< JCDF_t, JCDFMaplist_t, JCDFDistance_t > &cdf, const int number_of_bins, const double safety_factor=2.0)
Constructor.
JMapList< JPolint1FunctionalGridMap > JMaplist_t
JElement2D< argument_type, result_type > JElement2D_t
JCDFTable2D()
Default constructor.
JArgument_t argument_type
JMultiMapTransformer< 2, argument_type > transformer_type
JMultiFunction< JFunction1D_t, JMaplist_t > JFunction2D_t
Multi-dimensional CDF table for arrival time of Cherenkov light.
Definition JCDFTable.hh:58
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.
multimap_type::iterator iterator
void compile()
Compilation.
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 JElement.hh:47
Map list.
Definition JMapList.hh:25
Type definition of a 1st degree polynomial interpolation based on a JGridMap implementation.