Jpp master_rocky-44-g75b7c4f75
the software that should make you happy
Loading...
Searching...
No Matches
JRegressorHelper.hh
Go to the documentation of this file.
1#ifndef __JFIT_JREGRESSORHELPER__
2#define __JFIT_JREGRESSORHELPER__
3
4#include <string>
5#include <array>
6
10
11#include "JTools/JRange.hh"
14
15/**
16 * \author mdejong
17 */
18
19namespace JFIT {}
20namespace JPP { using namespace JFIT; }
21
22namespace JFIT {
23
31
32 /**
33 * forward declarations
34 */
35 class JLine3Z;
36 template<class JModel_t>
38 template<class JModel_t>
39 class JSimplex;
40 template<class JModel_t>
41 class JGandalf;
42
43
44 /**
45 * Template data structure for PDF tables.
46 */
47 template<class JModel_t, template<class> class JMinimiser_t>
49
50
51 /**
52 * Template specialisation for PDF tables.
53 */
54 template<>
81
82
83 /**
84 * PDF types.
85 */
86 const JPDFType_t JRegressorHelper<JLine3Z, JGandalf>::pdf_t[] = { DIRECT_LIGHT_FROM_MUON,
87 SCATTERED_LIGHT_FROM_MUON,
88 DIRECT_LIGHT_FROM_DELTARAYS,
89 SCATTERED_LIGHT_FROM_DELTARAYS,
90 DIRECT_LIGHT_FROM_EMSHOWERS,
91 SCATTERED_LIGHT_FROM_EMSHOWERS };
92
93
94
95 /**
96 * Template data structure for storage for PDF tables.
97 */
98 template<class JModel_t, template<class> class JMinimiser_t>
100
101
102 /**
103 * Template specialisation for storage for PDF tables.
104 */
105 template<>
107 public JRegressorHelper<JLine3Z, JGandalf>
108 {
109 /**
110 * Default constructor.
111 */
114
115
116 /**
117 * Constructor.
118 *
119 * The PDF file descriptor should contain the wild card character JPHYSICS::WILDCARD which
120 * will be replaced by the corresponding PDF types listed in JRegressor<JLine3Z, JGandalf>::pdf_t.
121 *
122 * The <tt>TTS</tt> corresponds to the additional time smearing applied to the PDFs.
123 *
124 * \param fileDescriptor PDF file descriptor
125 * \param TTS TTS [ns]
126 * \param numberOfPoints number of points for Gauss-Hermite integration of TTS
127 * \param epsilon precision for Gauss-Hermite integration of TTS
128 */
129 JRegressorStorage(const std::string& fileDescriptor,
130 const double TTS,
131 const int numberOfPoints = 25,
132 const double epsilon = 1.0e-10)
133 {
134 using namespace std;
135 using namespace JPP;
136
137 const JPDF_t::JSupervisor supervisor(new JPDF_t::JDefaultResult(JMATH::zero));
138
139 for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
140
141 const string file_name = getFilename(fileDescriptor, pdf_t[i]);
142
143 _pdf[i].load(file_name.c_str());
144
145 _pdf[i].setExceptionHandler(supervisor);
146 }
147
148 // Add PDFs
149
150 for (int i = 1; i < NUMBER_OF_PDFS; i += 2) {
151
152 _pdf[ i ].add(_pdf[i-1]);
153
154 JPDF_t buffer;
155
156 _pdf[i-1].swap(buffer);
157
158 if (TTS > 0.0) {
159 _pdf[i].blur(TTS, numberOfPoints, epsilon);
160 }
161
162 _npe[ i ] = JNPE_t(_pdf[i]);
163 }
164 }
165
166
167 /**
168 * Get PDFs.
169 *
170 * \return PDFs
171 */
172 const JPDFs_t& getPDF() const
173 {
174 return _pdf;
175 }
176
177
178 /**
179 * Get NPEs.
180 *
181 * \return NPEs
182 */
183 const JNPEs_t& getNPE() const
184 {
185 return _npe;
186 }
187
188
189 /**
190 * Transform PDFs and NPEs.
191 *
192 * \param transformer transformer
193 */
194 void transform(const transformer_type& transformer)
195 {
196 for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
197 _pdf[i].transform(transformer);
198 _npe[i].transform(transformer);
199 }
200 }
201
202
203 /**
204 * Set maximal road width of PDF.
205 *
206 * \param Rmax road width [m]
207 */
208 inline void setRmax(const double Rmax)
209 {
211
212 for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
213 if (!_pdf[i].empty()) {
214 _pdf[i].compress(range);
215 }
216 }
217 }
218
219
220 private:
221 JPDFs_t _pdf; //!< PDFs
222 JNPEs_t _npe; //!< NPEs
223 };
224}
225
226#endif
Various implementations of functional maps.
Numbering scheme for PDF types.
Auxiliary class to define a range between two values.
int numberOfPoints
Definition JResultPDF.cc:22
Fit method based on the Levenberg-Marquardt method.
Data structure for fit of straight line in positive z-direction.
Definition JLine3Z.hh:40
Simple fit method based on Powell's algorithm, see reference: Numerical Recipes in C++,...
Definition JSimplex.hh:44
Custom class for integrated values of the PDF of the arrival time of Cherenkov light.
Definition JNPETable.hh:43
Multi-dimensional PDF table for arrival time of Cherenkov light.
Definition JPDFTable.hh:44
Interface for weight application and coordinate transformation of function.
Range of values.
Definition JRange.hh:42
Auxiliary classes and methods for linear and iterative data regression.
Definition JEnergy.hh:15
static const JZero zero
Function object to assign zero value.
Definition JZero.hh:105
JPDFType_t
PDF types.
Definition JPDFTypes.hh:24
@ SCATTERED_LIGHT_FROM_DELTARAYS
scattered light from delta-rays
Definition JPDFTypes.hh:33
@ DIRECT_LIGHT_FROM_EMSHOWERS
direct light from EM showers
Definition JPDFTypes.hh:29
@ SCATTERED_LIGHT_FROM_EMSHOWERS
scattered light from EM showers
Definition JPDFTypes.hh:30
@ SCATTERED_LIGHT_FROM_MUON
scattered light from muon
Definition JPDFTypes.hh:27
@ DIRECT_LIGHT_FROM_DELTARAYS
direct light from delta-rays
Definition JPDFTypes.hh:32
@ DIRECT_LIGHT_FROM_MUON
direct light from muon
Definition JPDFTypes.hh:26
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
JPHYSICS::JNPETable< double, double, JNPEMaplist_t > JNPE_t
time integrated PDF
JTOOLS::JMAPLIST< JTOOLS::JPolint1FunctionalMap, JTOOLS::JPolint0FunctionalGridMap, JTOOLS::JPolint0FunctionalGridMap >::maplist JPDFMaplist_t
JPHYSICS::JPDFTable< JFunction1D_t, JPDFMaplist_t > JPDF_t
time dependent PDF
JTOOLS::JMAPLIST< JTOOLS::JPolint1FunctionalMapH, JTOOLS::JPolint1FunctionalGridMap, JTOOLS::JPolint1FunctionalGridMap >::maplist JNPEMaplist_t
std::array< JNPE_t, NUMBER_OF_PDFS > JNPEs_t
NPEs.
std::array< JPDF_t, NUMBER_OF_PDFS > JPDFs_t
PDFs.
Template data structure for PDF tables.
const JNPEs_t & getNPE() const
Get NPEs.
void setRmax(const double Rmax)
Set maximal road width of PDF.
JRegressorStorage(const std::string &fileDescriptor, const double TTS, const int numberOfPoints=25, const double epsilon=1.0e-10)
Constructor.
const JPDFs_t & getPDF() const
Get PDFs.
void transform(const transformer_type &transformer)
Transform PDFs and NPEs.
Template data structure for storage for PDF tables.
Auxiliary class for recursive map list generation.
Definition JMapList.hh:109
Type definition of a zero degree polynomial interpolation based on a JGridMap implementation.
Type definition of a 1st degree polynomial interpolation based on a JGridMap implementation.
Type definition of a 1st degree polynomial interpolation based on a JMap implementation.
Type definition of a 1st degree polynomial interpolation based on a JMap implementation.
Type definition of a spline interpolation method based on a JCollection with JResultPDF result type.