1#ifndef __JFIT__JSHOWERBJORKENYREGRESSOR__
2#define __JFIT__JSHOWERBJORKENYREGRESSOR__
53 struct JRegressor<JShowerEH, JSimplex> :
54 public JAbstractRegressor<JShowerEH, JSimplex>
56 using JAbstractRegressor<JShowerEH, JSimplex>::operator();
91 JRegressor(
const std::string& fileDescriptor):
92 estimator(new JMEstimatorNull())
97 const JPDF_t::JSupervisor supervisor(
new JPDF_t::JDefaultResult(
JMATH::zero));
98 const JPDF_t2::JSupervisor supervisor2(
new JPDF_t2::JDefaultResult(
JMATH::zero));
100 for (
int i = 0; i != NUMBER_OF_PDFS; ++i) {
107 const string file_name = getFilename(fileDescriptor, pdf_t[i]);
109 NOTICE(
"loading PDF from file " << file_name <<
"... " << flush);
113 pdf.load(file_name.c_str());
115 pdf.setExceptionHandler(supervisor);
117 npe[ i ] = JNPE_t(pdf);
121 pdf2.load(file_name.c_str());
125 pdf2.setExceptionHandler(supervisor2);
127 npe2[ i-2 ] = JNPE_t2(pdf2);
137 for (
int i = 1; i < (NUMBER_OF_PDFS-2); i += 2) {
139 npe[ i ].add(npe[i-1]);
143 npe[i-1].swap(buffer);
145 npe2[ i ].add(npe2[i-1]);
149 npe2[i-1].swap(buffer2);
172 double ct = U.getDot(D) / D.getLength();
176 const double z = D.getDot(shower_dir);
177 const double x = D.getX() - z * shower.
getDX();
178 const double y = D.getY() - z * shower.
getDY();
179 const double cosDelta = z/D.getLength();
183 const double theta = U.getTheta();
184 const double phi = fabs(U.getPhi());
186 double H0 = getH0(pmt.
getR());
187 double H1 = getH1(D.getLength(), ct, cosDelta, theta, phi,
190 if (H1 >= Vmax_npe) {
196 const bool hit = pmt.
getN() != 0;
199 return estimator->getRho(u);
208 double getH0(
const double R_Hz)
const
210 return get_value(JNPE_t::result_type(R_Hz * 1e-9 * T_ns.getLength()));
226 double getH1(
const double D,
228 const double cosDelta,
233 const double Y)
const
238 for (
int i = 0; i != (NUMBER_OF_PDFS-1); ++i) {
240 if (!npe[i].empty() && D <= npe[i].getXmax() && !npe2[i].empty() && D <= npe2[i].getXmax()) {
244 JNPE_t::result_type P_em;
245 JNPE_t2::result_type P_h;
247 P_em = fabs(Eem) * npe[i](std::max(D, npe[i].getXmin()), cosDelta, theta, phi);
249 P_h = fabs(Eh) * npe2[i](std::max(D, npe2[i].getXmin()), ct);
251 double y1 = get_value(P_em) + get_value(P_h);
259 ERROR(error << std::endl);
268 static double Vmax_npe;
270 static const int NUMBER_OF_PDFS = 4;
272 static const JPDFType_t pdf_t[NUMBER_OF_PDFS];
274 JNPE_t npe[NUMBER_OF_PDFS-2];
275 JNPE_t2 npe2[NUMBER_OF_PDFS-2];
284 SCATTERED_LIGHT_FROM_EMSHOWER,
285 DIRECT_LIGHT_FROM_BRIGHT_POINT,
286 SCATTERED_LIGHT_FROM_BRIGHT_POINT };
Various implementations of functional maps.
Maximum likelihood estimator (M-estimators).
General purpose messaging.
Numbering scheme for PDF types.
Auxiliary class to define a range between two values.
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.
const JVersor3Z & getDirection() const
Get direction.
Data structure for fit of straight line in positive z-direction with energy.
double getEem() const
Get EM energy.
double getEh() const
Get Hadronic energy.
double getBy() const
Get bjorken y.
Data structure for direction in three dimensions.
const JDirection3D & getDirection() const
Get direction.
Data structure for position in three dimensions.
const JPosition3D & getPosition() const
Get position.
Data structure for normalised vector in three dimensions.
double getDY() const
Get y direction.
double getDX() const
Get x direction.
virtual const char * what() const override
Get error message.
The template JSharedPointer class can be used to share a pointer to an object.
Custom class for integrated values of the PDF of the arrival time of Cherenkov light.
Multi-dimensional PDF table for arrival time of Cherenkov light.
Auxiliary classes and methods for linear and iterative data regression.
double getChi2(const double P)
Get chi2 corresponding to given probability.
static const JZero zero
Function object to assign zero value.
@ SCATTERED_LIGHT_FROM_EMSHOWER
scattered light from EM shower
@ SCATTERED_LIGHT_FROM_BRIGHT_POINT
scattered light from bright point
@ DIRECT_LIGHT_FROM_BRIGHT_POINT
direct light from bright point
@ DIRECT_LIGHT_FROM_EMSHOWER
direct light from EM shower
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary class for handling PMT geometry, rate and response.
int getN() const
Get number of hits.
double getR() const
Get rate.
Template definition of a data regressor of given model.