Jpp 21.0.0-rc.1
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 <memory>
5#include <cmath>
6
10#include "JTools/JPolint.hh"
13#include "JTools/JMultiGrid.hh"
16
17
18/**
19 * \author mdejong
20 */
21
22namespace JPHYSICS {}
23namespace JPP { using namespace JPHYSICS; }
24
25namespace JPHYSICS {
26
27 using JTOOLS::JMapList;
33
34
35 /**
36 * Custom class for CDF table in 2 dimensions.
37 * This class provides an upper limit for the average number of photo-electrons
38 * as a function of the distance and the cosine of the emission angle.
39 */
40 template<class JArgument_t, class JResult_t>
42 public JMultiFunction<JPolintFunction1D<1, JElement2D<JArgument_t,JResult_t>, JGridCollection>,
43 JMapList<JPolint1FunctionalGridMap> >
44 {
45 public:
46
47 typedef JArgument_t argument_type;
48 typedef JResult_t result_type;
49
54
56
57
58 /**
59 * Default constructor.
60 */
62 {}
63
64
65 /**
66 * Constructor.
67 *
68 * \param cdf CDF (5D table)
69 * \param number_of_bins number of bins (2D table)
70 * \param safety_factor safety factor
71 */
72 template<class JCDF_t, class JCDFMaplist_t, class JCDFDistance_t>
74 const int number_of_bins,
75 const double safety_factor = 2.0) :
77 {
78 using namespace JPP;
79
80 // extract the weight function
81
82 try {
83
85
86 const JPDFTransformer_t& object = dynamic_cast<const JPDFTransformer_t&>(*(cdf.transformer));
87
88 transformer.reset(object.transformer.clone());
89 }
90 catch(const std::exception& error) {
92 }
93
94
95 // build the 2D table
96
97 this->configure(make_grid(number_of_bins, cdf.intensity.begin()->getX(), cdf.intensity.rbegin()->getX()));
98
99 const JOmega3D omega(JDirection3D(0,1,0), JOmega3D::range_type(0.0,0.501*PI), 0.07*PI);
100
101 for (typename JFunction2D_t::iterator i = this->begin(); i != this->end(); ++i) {
102
103 i->getY().configure(make_grid(number_of_bins, -1.0, +1.0));
104
105 for (typename JFunction1D_t::iterator j = i->getY().begin(); j != i->getY().end(); ++j) {
106
107 const double D = i->getX();
108 const double cd = j->getX();
109 const double W = transformer->getWeight(D, cd);
110
111 double y = 0.0;
112
113 for (JOmega3D::const_iterator dir = omega.begin(); dir != omega.end(); ++dir) {
114 y += cdf.getNPE(D, cd, dir->getTheta(), fabs(dir->getPhi()));
115 }
116
117 y /= omega.size();
118
119 j->getY() = safety_factor * y / W;
120 }
121 }
122
123 this->compile();
124 }
125
126
127 /**
128 * Get number of photo-electrons.
129 *
130 * \param D distance between EM shower and PMT [m]
131 * \param cd cosine angle EM shower direction and EM shower - PMT position
132 * \return number of photo-electrons
133 */
134 double getNPE(const double D,
135 const double cd) const
136 {
137 const double buffer[] = { D, cd };
138
139 const double y = this->evaluate(buffer);
140 const double W = this->transformer->getWeight(D, cd);
141
142 return y * W;
143 }
144
145
146 std::shared_ptr<transformer_type> transformer;
147 };
148}
149
150#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
Custom class for CDF table in 2 dimensions.
JMultiFunction< JFunction1D_t, JMaplist_t > JFunction2D_t
double getNPE(const double D, const double cd) const
Get number of photo-electrons.
JPolintFunction1D< 1, JElement2D_t, JGridCollection > JFunction1D_t
JMapList< JPolint1FunctionalGridMap > JMaplist_t
JCDFTable2D(const JCDFTable< JCDF_t, JCDFMaplist_t, JCDFDistance_t > &cdf, const int number_of_bins, const double safety_factor=2.0)
Constructor.
JCDFTable2D()
Default constructor.
JArgument_t argument_type
JElement2D< argument_type, result_type > JElement2D_t
std::shared_ptr< transformer_type > transformer
JMultiMapTransformer< 2, argument_type > transformer_type
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.
void compile()
Compilation.
multimap_type::iterator iterator
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
Functional map with polynomial interpolation.
Definition JPolint.hh:1153
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