Regressor function object for JShower3EZ fit using JSimplex minimiser.
More...
#include <JShower3EZRegressor.hh>
|
typedef JTOOLS::JSplineFunction1S_t | JFunction1D_t |
|
typedef JTOOLS::JMapList< JTOOLS::JPolint1FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint1FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalGridMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalGridMap > > > > | JPDFMaplist_t |
|
typedef JPHYSICS::JPDFTable< JFunction1D_t, JPDFMaplist_t > | JPDF_t |
|
typedef JTOOLS::JMapList< JTOOLS::JPolint1FunctionalMapH, JTOOLS::JMapList< JTOOLS::JPolint1FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalGridMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalGridMap > > > > | JNPEMaplist_t |
|
typedef JPHYSICS::JNPETable< double, double, JNPEMaplist_t > | JNPE_t |
|
typedef JSimplex< JShower3EZ > | minimiser_type |
|
typedef JRegressor< JShower3EZ, JSimplex > | regressor_type |
|
typedef minimiser_type::result_type | result_type |
|
|
| JRegressor () |
| Default constructor. More...
|
|
| JRegressor (const std::string &fileDescriptor) |
| Parameterized constructor. More...
|
|
double | operator() (const JShower3EZ &shower, const JPMTW0 &pmt) const |
| Fit function. More...
|
|
JNPE_t::result_type | getH0 (const double R_Hz) const |
| Get background hypothesis value for time integrated PDF. More...
|
|
JNPE_t::result_type | getH1 (const double D, const double cosDelta, const double theta, const double phi, const double E) const |
| Get signal hypothesis value for time integrated PDF. More...
|
|
double | getRmax () const |
| Get maximal road width of PDF. More...
|
|
result_type | operator() (const JShower3EZ &value, T __begin, T __end) |
| Global fit. More...
|
|
result_type | operator() (const JShower3EZ &value, T1 __begin1, T1 __end1, T2 __begin2, T2 __end2) |
| Global fit. More...
|
|
double | operator() (const JFunction_t &fit, T __begin, T __end) |
| Multi-dimensional fit. More...
|
|
double | operator() (const JFunction_t &fit, T __begin, T __end, const JShower3EZ &step) |
| 1D fit. More...
|
|
|
double | evaluate (const JFunction_t &fit, T __begin, T __end) const |
| Evaluate chi2 for given data set. More...
|
|
template<>
struct JFIT::JRegressor< JShower3EZ, JSimplex >
Regressor function object for JShower3EZ fit using JSimplex minimiser.
Definition at line 44 of file JShower3EZRegressor.hh.
◆ JFunction1D_t
◆ JPDFMaplist_t
◆ JPDF_t
◆ JNPEMaplist_t
◆ JNPE_t
◆ minimiser_type
◆ regressor_type
◆ result_type
◆ JRegressor() [1/2]
◆ JRegressor() [2/2]
Parameterized constructor.
The PDF file descriptor should contain the wild card character JPHYSICS::WILD_CARD which will be replaced by the corresponding PDF types listed in JRegressor<JShower3Z, JGandalf>::pdf_t.
- Parameters
-
fileDescriptor | PDF file descriptor |
Definition at line 77 of file JShower3EZRegressor.hh.
83 const JPDF_t::JSupervisor supervisor(
new JPDF_t::JDefaultResult(
JMATH::zero));
91 NOTICE(
"loading PDF from file " << file_name <<
"... " << flush);
100 catch(
const JException& error) {
101 FATAL(error.what() << endl);
◆ operator()() [1/5]
Fit function.
This method is used to determine the chi2 of given PMT with respect to shower hypothesis.
- Parameters
-
- Returns
- chi2
Definition at line 120 of file JShower3EZRegressor.hh.
128 D.sub(shower.getPosition());
130 JVersor3D shower_dir(shower.getDirection());
132 const double z = D.
getDot(shower_dir);
133 const double x = D.getX() - z * shower.getDX();
134 const double y = D.getY() - z * shower.getDY();
135 const double cosDelta = z/D.getLength();
139 const double theta = U.getTheta();
140 const double phi = fabs(U.getPhi());
142 JNPE_t::result_type H0 =
getH0(pmt.getR());
143 JNPE_t::result_type H1 =
getH1(D.getLength(), cosDelta, theta, phi, shower.getE());
151 const bool hit = pmt.getN() != 0;
152 const double u = H1.getChi2(hit);
◆ getH0()
Get background hypothesis value for time integrated PDF.
- Parameters
-
- Returns
- hypothesis value
Definition at line 163 of file JShower3EZRegressor.hh.
165 return JNPE_t::result_type(R_Hz * 1e-9 *
T_ns.
getLength(), 0.0);
◆ getH1()
Get signal hypothesis value for time integrated PDF.
- Parameters
-
D | PMT distance from shower [m] |
cosDelta | angle between shower direction and PMT position |
theta | PMT zenith angle [deg] |
phi | PMT azimuth angle [deg] |
E | shower energy [GeV] |
- Returns
- hypothesis value
Definition at line 178 of file JShower3EZRegressor.hh.
188 if (!
npe[i].empty() && D <=
npe[i].getXmax()) {
192 JNPE_t::result_type y1 = E *
npe[i](std::max(D,
npe[i].getXmin()), cosDelta, theta, phi);
200 ERROR(error << std::endl);
◆ getRmax()
Get maximal road width of PDF.
- Returns
- road width [m]
Definition at line 214 of file JShower3EZRegressor.hh.
220 if (!
pdf[i].empty() &&
pdf[i].getXmax() > xmax) {
221 xmax =
pdf[i].getXmax();
◆ operator()() [2/5]
Global fit.
- Parameters
-
value | start value |
__begin | begin of data set |
__end | end of data set |
- Returns
- chi2
Definition at line 92 of file JRegressor.hh.
94 static_cast<minimiser_type&>(*this).value =
value;
96 return static_cast<minimiser_type&>(*
this)(static_cast<regressor_type&>(*
this), __begin, __end);
◆ operator()() [3/5]
Global fit.
- Parameters
-
value | start value |
__begin1 | begin of first data set |
__end1 | end of first data set |
__begin2 | begin of second data set |
__end2 | end of second data set |
- Returns
- chi2
Definition at line 111 of file JRegressor.hh.
115 static_cast<minimiser_type&>(*this).value =
value;
117 return static_cast<minimiser_type&>(*
this)(static_cast<regressor_type&>(*
this), __begin1, __end1, __begin2, __end2);
◆ operator()() [4/5]
Multi-dimensional fit.
The given fit function should return the equivalent of chi2 for the current value of the given model and a given data point.
- Parameters
-
fit | fit function |
__begin | begin of data |
__end | end of data |
- Returns
- chi2
Definition at line 71 of file JSimplex.hh.
76 double chi2_old =
evaluate(fit, __begin, __end);
78 const int N =
step.size();
88 DEBUG(
"old: " <<
FIXED(12,5) << chi2_old << endl);
90 const JModel_t p0(
value);
92 for (
int i = 0; i != N; ++i) {
96 chi2[i] = (*this)(fit, __begin, __end,
step[i]);
101 JModel_t wall =
value - p0;
103 const double chi2_new = (*this)(fit, __begin, __end, wall);
105 DEBUG(
"new: " <<
FIXED(12,5) << chi2_new << endl);
108 if (fabs(chi2_old - chi2_new) <
EPSILON*fabs(chi2_old)) {
118 const double fe =
evaluate(fit, __begin, __end);
123 for (
int i = N-1; i != 0; --i) {
124 chi2[i] = chi2[i-1] - chi2[i];
127 chi2[0] = chi2_old - chi2[0];
132 for (
int i = 0; i != N; ++i) {
138 const double fn = chi2_new;
139 const double f0 = chi2_old;
140 const double ff = f0 - fn - df;
144 if (fe < f0 && 2.0*(f0 - 2.0*fn + fe)*ff*ff < (f0-fe)*(f0-fe)*df) {
146 for (
int i = 0; i != N - 1; ++i) {
◆ operator()() [5/5]
1D fit.
The given fit function should return the equivalent of chi2 for the current value of the given model and a given data point.
- Parameters
-
fit | fit function |
__begin | begin of data |
__end | end of data |
step | step direction |
Definition at line 173 of file JSimplex.hh.
181 double chi2_old =
evaluate(fit, __begin, __end);
187 const double chi2_new =
evaluate(fit, __begin, __end);
189 DEBUG(
"step: " << setw(3) << i <<
' ' <<
FIXED(12,5) << chi2_old <<
' ' <<
FIXED(12,5) << chi2_new <<
' ' <<
FIXED(5,2) << lambda << endl);
191 if (fabs(chi2_old - chi2_new) <
EPSILON*fabs(chi2_old)) {
193 if (chi2_new > chi2_old) {
205 if (chi2_new < chi2_old) {
219 lambda = factor * lambda;
◆ evaluate()
Evaluate chi2 for given data set.
- Parameters
-
fit | fit function |
__begin | begin of data |
__end | end of data |
Definition at line 242 of file JSimplex.hh.
246 for (T hit = __begin; hit != __end; ++hit) {
247 chi2 += fit(
value, *hit);
◆ T_ns
Time window with respect to Cherenkov hypothesis [ns].
Default values.
Definition at line 230 of file JShower3EZRegressor.hh.
◆ Vmax_npe
◆ NUMBER_OF_PDFS
◆ pdf_t
◆ pdf
◆ npe
◆ estimator
◆ MAXIMUM_ITERATIONS
maximal number of iterations
maximal number of iterations.
Definition at line 226 of file JSimplex.hh.
◆ EPSILON
maximal distance to minimum
maximal distance to minimum.
Definition at line 227 of file JSimplex.hh.
◆ value
◆ step
◆ numberOfIterations
◆ debug
debug level (default is off).
Definition at line 45 of file JMessage.hh.
The documentation for this struct was generated from the following file:
static JTimeRange T_ns
Time window with respect to Cherenkov hypothesis [ns].
JNPE_t::result_type getH1(const double D, const double cosDelta, const double theta, const double phi, const double E) const
Get signal hypothesis value for time integrated PDF.
JPHYSICS::JNPETable< double, double, JNPEMaplist_t > JNPE_t
static const int NUMBER_OF_PDFS
Auxiliary data structure for floating point format specification.
Auxiliary classes and methods for calculation of PDF and muon energy loss.
Data structure for direction in three dimensions.
Data structure for normalised vector in three dimensions.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
JPDF_t pdf[NUMBER_OF_PDFS]
PDF.
static double Vmax_npe
Maximal integral of PDF [npe].
Data structure for position in three dimensions.
double getDot(const JVersor3D &versor) const
Get dot product.
std::string getFilename(const std::string &file_name)
Get file name part, i.e.
JLANG::JSharedPointer< JMEstimator > estimator
M-Estimator function.
static const JPDFType_t pdf_t[NUMBER_OF_PDFS]
PDF types.
JNPE_t::result_type getH0(const double R_Hz) const
Get background hypothesis value for time integrated PDF.
double evaluate(const JFunction_t &fit, T __begin, T __end) const
Evaluate chi2 for given data set.
#define DEBUG(A)
Message macros.
JNPE_t npe[NUMBER_OF_PDFS]
PDF.
Auxiliary classes and methods for 3D geometrical objects and operations.
static const JZero zero
Function object to assign zero value.
std::vector< JShower3EZ > step
static double EPSILON
maximal distance to minimum
void load(const char *file_name)
Load from input file.
static int MAXIMUM_ITERATIONS
maximal number of iterations