1#ifndef __JFIT__JSHOWERBRIGHTPOINTREGRESSOR__
2#define __JFIT__JSHOWERBRIGHTPOINTREGRESSOR__
33namespace JPP {
using namespace JFIT; }
51 const double Emin = 0.1;
53 double E = max(Emin, value.
getE());
69 static const int NUMBER_OF_PDFS = 2;
97 const double epsilon = 1.0e-10) :
104 const JPDF_t::JSupervisor supervisor(
new JPDF_t::JDefaultResult(
JMATH::zero));
106 for (
int i = 0; i != NUMBER_OF_PDFS; ++i) {
108 const string file_name = getFilename(fileDescriptor, pdf_t[i]);
110 _pdf[i].load(file_name.c_str());
112 _pdf[i].setExceptionHandler(supervisor);
116 for (
int i = 1; i < NUMBER_OF_PDFS; i += 2) {
118 _pdf[ i ].add(_pdf[i-1]);
122 _pdf[i-1].swap(buffer);
155 DIRECT_LIGHT_FROM_BRIGHT_POINT,
156 SCATTERED_LIGHT_FROM_BRIGHT_POINT
198 const double epsilon = 1.0e-10) :
209 pdf(storage.getPDF())
233 template<
class JHit_t>
234 result_type operator()(
const JPoint4E& vx,
const JHit_t& hit)
const
242 double length = D.getLength();
243 double ct = U.getDot(D) / length;
245 if (ct > +1.0) { ct = +1.0; }
246 if (ct < -1.0) { ct = -1.0; }
248 const double t = vx.
getT() + (length * getIndexOfRefraction() * getInverseSpeedOfLight());
250 const double dt = T_ns.constrain(hit.getT() - t);
252 JPDF_t::result_type H0 = getH0(hit.getR(), dt);
253 JPDF_t::result_type H1 = getH1(length, ct, dt);
257 if (get_value(H1) >= Vmax_npe) {
258 H1 *= Vmax_npe / get_value(H1);
261 const double H1_value = get_value(H1);
263 const double v_H1 = H1.v;
264 const double V_H1 = H1.V;
268 JPDF_t::result_type HT = H1 + H0;
270 const double HT_value = get_value(HT);
274 result.chi2 = HT.getChi2() - H0.getChi2();
276 double exp_V_HT = exp(-HT.V);
278 double energy_gradient = -1 / HT_value;
280 energy_gradient *= (H1_value - HT_value * v_H1) * (1-exp_V_HT) - HT_value * exp_V_HT * V_H1;
281 energy_gradient /= (1-exp_V_HT);
286 -getIndexOfRefraction() * D.getY() / length,
287 -getIndexOfRefraction() * D.getZ() / length),
291 static_cast<JPoint4D&
>(
result.gradient).mul(getInverseSpeedOfLight() * (HT.getDerivativeOfChi2() -
292 H0.getDerivativeOfChi2()));
304 JPDF_t::result_type getH0(
const double R_Hz,
305 const double t1)
const
309 return JPDF_t::result_type(R_Hz * 1e-9, t1, T_ns);
320 JPDF_t::result_type getH1(
const double D,
322 const double t)
const
328 for (
int i = 0; i != NUMBER_OF_PDFS; ++i) {
330 if (!pdf[i].empty() && D <= pdf[i].getXmax()) {
334 JPDF_t::result_type y1 = pdf[i](std::max(D, pdf[i].getXmin()), ct, t);
350 ERROR(error << std::endl);
363 inline double getRmax()
const
369 for (
int i = 0; i != NUMBER_OF_PDFS; ++i) {
371 if (!pdf[i].empty() && pdf[i].getXmax() > xmax) {
372 xmax = pdf[i].getXmax();
380 static double Vmax_npe;
Maximum likelihood estimator (M-estimators).
General purpose messaging.
Numbering scheme for PDF types.
General purpose data regression method.
This include file containes various data structures that can be used as specific return types for the...
Definition of zero value for any class.
Fit method based on the Levenberg-Marquardt method.
Data structure for vertex fit.
Data structure for vertex fit.
double getE() const
Get energy.
Data structure for direction in three dimensions.
Data structure for position in three dimensions.
const JPosition3D & getPosition() const
Get position.
Data structure for vector in three dimensions.
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
Multi-dimensional PDF table for arrival time of Cherenkov light.
Auxiliary classes and methods for linear and iterative data regression.
void model(JModel_t &value)
Auxiliary function to constrain model during fit.
static const JZero zero
Function object to assign zero value.
@ SCATTERED_LIGHT_FROM_BRIGHT_POINT
scattered light from bright point
@ DIRECT_LIGHT_FROM_BRIGHT_POINT
direct light from bright point
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Abstract class for global fit method.
JRegressorStorage(const std::string &fileDescriptor, const JTimeRange &T_ns, const double TTS, const int numberOfPoints=25, const double epsilon=1.0e-10)
Parameterized constructor.
const JPDFs_t & getPDF() const
Get PDFs.
JPHYSICS::JPDFTable< JFunction1D_t, JPDFMapList_t > JPDF_t
std::array< JPDF_t, NUMBER_OF_PDFS > JPDFs_t
PDFs.
JTOOLS::JMAPLIST< JTOOLS::JPolint2FunctionalMap, JTOOLS::JPolint1FunctionalGridMap >::maplist JPDFMapList_t
JRegressorStorage()
Default constructor.
JTimeRange T_ns
Time window with respect to Cherenkov hypothesis [ns].
JTOOLS::JSplineFunction1S_t JFunction1D_t
Template data structure for storage of internal data.
Template definition of a data regressor of given model.
Auxiliary class to set-up Hit.