1#ifndef __JFIT__JSHOWERENERGYREGRESSOR__
2#define __JFIT__JSHOWERENERGYREGRESSOR__
4#include "JPhysics/JPDFTypes.hh"
5#include "JPhysics/JPDFTable.hh"
6#include "JPhysics/JPDFToolkit.hh"
7#include "JPhysics/JNPETable.hh"
9#include "JPhysics/JConstants.hh"
10#include "JTools/JResult.hh"
12#include "JLang/JSharedPointer.hh"
13#include "JMath/JZero.hh"
15#include "JGeometry3D/JAxis3D.hh"
26#include "Jeep/JMessage.hh"
37namespace JPP {
using namespace JFIT; }
41 using JPHYSICS::JPDFType_t;
42 using JPHYSICS::DIRECT_LIGHT_FROM_BRIGHT_POINT;
43 using JPHYSICS::SCATTERED_LIGHT_FROM_BRIGHT_POINT;
44 using JTOOLS::get_value;
45 using JGEOMETRY3D::JAxis3D;
57 typedef JTOOLS::JMAPLIST<JTOOLS::JPolint1FunctionalMap,
59 typedef JPHYSICS::JPDFTable<JFunction1D_t, JMapList_t>
JPDF_t;
61 typedef JPHYSICS::JNPETable<double, double, JMapList_t>
JNPE_t;
79 const JPDF_t::JSupervisor supervisor(
new JPDF_t::JDefaultResult(JMATH::zero));
81 for (
int i = 0; i != NUMBER_OF_PDFS; ++i) {
87 const string file_name = getFilename(fileDescriptor, pdf_t[i]);
89 NOTICE(
"loading PDF from file " << file_name <<
"... " << flush);
91 pdf.load(file_name.c_str());
95 pdf.setExceptionHandler(supervisor);
99 catch(
const JException& error) {
100 FATAL(error.what() << endl);
106 for (
int i = 1; i < NUMBER_OF_PDFS; i += 2) {
125 const double E = x.
getE();
126 const double u = npe.
getChi2(E);
128 return estimator->getRho(u);
139 const double R_Hz)
const
143 const JPosition3D D(axis.getPosition());
144 const JDirection3D U(axis.getDirection());
146 const double U_length = std::sqrt(U.getDX()*U.getDX() +
147 U.getDY()*U.getDY() +
148 U.getDZ()*U.getDZ());
150 const double ct = U.getDot(D) / (D.getLength()*U_length);
152 const double y = getNPE(Y, D.getLength(), ct);
154 return JShowerNPE(getN(T_ns, R_Hz * 1.0e-9), y);
166 static inline double getNPE(
const std::vector<JNPE_t>& NPE,
172 for (std::vector<JNPE_t>::const_iterator i = NPE.begin(); i != NPE.end(); ++i) {
174 if (D <= i->getXmax()) {
178 const double y = get_value((*i)(std::max(D, i->getXmin()), cd));
184 catch(
const JLANG::JException& error) {
185 ERROR(error << std::endl);
197 static const int NUMBER_OF_PDFS = 2;
199 static const JPDFType_t pdf_t[NUMBER_OF_PDFS];
201 std::vector<JNPE_t>
Y;
210 SCATTERED_LIGHT_FROM_BRIGHT_POINT };
Maximum likelihood estimator (M-estimators).
General purpose data regression method.
Data structure for fit of energy.
double getE() const
Get energy.
Simple fit method based on Powell's algorithm, see reference: Numerical Recipes in C++,...
Auxiliary classes and methods for linear and iterative data regression.
Abstract class for global fit method.
static JTimeRange T_ns
Time window with respect to Cherenkov hypothesis [ns].
JTOOLS::JSplineFunction1S_t JFunction1D_t
JShowerNPE getNPE(const JAxis3D &axis, const double R_Hz) const
Create data structure for handling light yields for PMT.
double operator()(const JEnergy &x, const JShowerNPEHit &npe) const
Fit function.
JPHYSICS::JNPETable< double, double, JMapList_t > JNPE_t
static double getNPE(const std::vector< JNPE_t > &NPE, const double D, const double cd)
Get number of photo-electrons.
JPHYSICS::JPDFTable< JFunction1D_t, JMapList_t > JPDF_t
std::vector< JNPE_t > Y
light from EM showers
JRegressor(const std::string &fileDescriptor)
Parameterized constructor.
JTOOLS::JMAPLIST< JTOOLS::JPolint1FunctionalMap, JTOOLS::JPolint1FunctionalGridMap >::maplist JMapList_t
JLANG::JSharedPointer< JMEstimator > estimator
M-Estimator function.
static double Vmax_npe
Maximal integral of PDF [npe].
Template definition of a data regressor of given model.
Auxiliary class for simultaneously handling light yields and response of PMT.
double getChi2(const double E_GeV) const
Get chi2.
Auxiliary class for handling EM shower light yield.