1#ifndef __JFIT__JSHOWERBJORKENYREGRESSOR__
2#define __JFIT__JSHOWERBJORKENYREGRESSOR__
54 struct JRegressor<JShowerEH, JSimplex> :
55 public JAbstractRegressor<JShowerEH, JSimplex>
57 using JAbstractRegressor<JShowerEH, JSimplex>::operator();
92 JRegressor(
const std::string& fileDescriptor):
93 estimator(new JMEstimatorNull())
98 const JPDF_t::JSupervisor supervisor(
new JPDF_t::JDefaultResult(
JMATH::zero));
99 const JPDF_t2::JSupervisor supervisor2(
new JPDF_t2::JDefaultResult(
JMATH::zero));
101 for (
int i = 0; i != NUMBER_OF_PDFS; ++i) {
108 const string file_name = getFilename(fileDescriptor, pdf_t[i]);
110 NOTICE(
"loading PDF from file " << file_name <<
"... " << flush);
114 pdf.load(file_name.c_str());
116 pdf.setExceptionHandler(supervisor);
118 npe[ i ] = JNPE_t(pdf);
122 pdf2.load(file_name.c_str());
126 pdf2.setExceptionHandler(supervisor2);
128 npe2[ i-2 ] = JNPE_t2(pdf2);
138 for (
int i = 1; i < (NUMBER_OF_PDFS-2); i += 2) {
140 npe[ i ].add(npe[i-1]);
144 npe[i-1].swap(buffer);
146 npe2[ i ].add(npe2[i-1]);
150 npe2[i-1].swap(buffer2);
173 double ct = U.getDot(D) / D.getLength();
177 const double z = D.getDot(shower_dir);
178 const double x = D.getX() - z * shower.
getDX();
179 const double y = D.getY() - z * shower.
getDY();
180 const double cosDelta = z/D.getLength();
184 const double theta = U.getTheta();
185 const double phi = fabs(U.getPhi());
187 double H0 = getH0(pmt.
getR());
188 double H1 = getH1(D.getLength(), ct, cosDelta, theta, phi,
191 if (H1 >= Vmax_npe) {
197 const bool hit = pmt.
getN() != 0;
198 const double u =
getChi2(H1, hit);
200 return estimator->getRho(u);
209 double getH0(
const double R_Hz)
const
211 return get_value(JNPE_t::result_type(R_Hz * 1e-9 * T_ns.getLength()));
227 double getH1(
const double D,
229 const double cosDelta,
234 const double Y)
const
239 for (
int i = 0; i != (NUMBER_OF_PDFS-1); ++i) {
241 if (!npe[i].empty() && D <= npe[i].getXmax() && !npe2[i].empty() && D <= npe2[i].getXmax()) {
245 JNPE_t::result_type P_em;
246 JNPE_t2::result_type P_h;
248 P_em = fabs(Eem) * npe[i](std::max(D, npe[i].getXmin()), cosDelta, theta, phi);
250 P_h = fabs(Eh) * npe2[i](std::max(D, npe2[i].getXmin()), ct);
252 double y1 = get_value(P_em) + get_value(P_h);
260 ERROR(error << std::endl);
269 static double Vmax_npe;
271 static const int NUMBER_OF_PDFS = 4;
273 static const JPDFType_t pdf_t[NUMBER_OF_PDFS];
275 JNPE_t npe[NUMBER_OF_PDFS-2];
276 JNPE_t2 npe2[NUMBER_OF_PDFS-2];
285 SCATTERED_LIGHT_FROM_EMSHOWER,
286 DIRECT_LIGHT_FROM_BRIGHT_POINT,
287 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.