1#ifndef __JFIT__JSHOWERBJORKENYREGRESSOR__
2#define __JFIT__JSHOWERBJORKENYREGRESSOR__
55 struct JRegressor<JShowerEH, JSimplex> :
56 public JAbstractRegressor<JShowerEH, JSimplex>
58 using JAbstractRegressor<JShowerEH, JSimplex>::operator();
93 JRegressor(
const std::string& fileDescriptor):
94 estimator(new JMEstimatorNull())
99 const JPDF_t::JSupervisor supervisor(
new JPDF_t::JDefaultResult(
JMATH::zero));
100 const JPDF_t2::JSupervisor supervisor2(
new JPDF_t2::JDefaultResult(
JMATH::zero));
102 for (
int i = 0; i != NUMBER_OF_PDFS; ++i) {
109 const string file_name = getFilename(fileDescriptor, pdf_t[i]);
111 NOTICE(
"loading PDF from file " << file_name <<
"... " << flush);
115 pdf.load(file_name.c_str());
117 pdf.setExceptionHandler(supervisor);
119 npe[ i ] = JNPE_t(pdf);
123 pdf2.load(file_name.c_str());
127 pdf2.setExceptionHandler(supervisor2);
129 npe2[ i-2 ] = JNPE_t2(pdf2);
139 for (
int i = 1; i < (NUMBER_OF_PDFS-2); i += 2) {
141 npe[ i ].add(npe[i-1]);
145 npe[i-1].swap(buffer);
147 npe2[ i ].add(npe2[i-1]);
151 npe2[i-1].swap(buffer2);
174 double ct = U.getDot(D) / D.getLength();
178 const double z = D.getDot(shower_dir);
179 const double x = D.getX() - z * shower.
getDX();
180 const double y = D.getY() - z * shower.
getDY();
181 const double cosDelta = z/D.getLength();
185 const double theta = U.getTheta();
186 const double phi = fabs(U.getPhi());
188 double H0 = getH0(pmt.
getR());
189 double H1 = getH1(D.getLength(), ct, cosDelta, theta, phi,
192 if (H1 >= Vmax_npe) {
198 const bool hit = pmt.
getN() != 0;
199 const double u =
getChi2(H1, hit);
201 return estimator->getRho(u);
210 double getH0(
const double R_Hz)
const
212 return get_value(JNPE_t::result_type(R_Hz * 1e-9 * T_ns.getLength()));
228 double getH1(
const double D,
230 const double cosDelta,
235 const double Y)
const
240 for (
int i = 0; i != (NUMBER_OF_PDFS-1); ++i) {
242 if (!npe[i].empty() && D <= npe[i].getXmax() && !npe2[i].empty() && D <= npe2[i].getXmax()) {
246 JNPE_t::result_type P_em;
247 JNPE_t2::result_type P_h;
249 P_em = fabs(Eem) * npe[i](std::max(D, npe[i].getXmin()), cosDelta, theta, phi);
251 P_h = fabs(Eh) * npe2[i](std::max(D, npe2[i].getXmin()), ct);
253 double y1 = get_value(P_em) + get_value(P_h);
261 ERROR(error << std::endl);
270 static double Vmax_npe;
272 static const int NUMBER_OF_PDFS = 4;
274 static const JPDFType_t pdf_t[NUMBER_OF_PDFS];
276 JNPE_t npe[NUMBER_OF_PDFS-2];
277 JNPE_t2 npe2[NUMBER_OF_PDFS-2];
279 std::shared_ptr<JMEstimator> estimator;
286 SCATTERED_LIGHT_FROM_EMSHOWER,
287 DIRECT_LIGHT_FROM_BRIGHT_POINT,
288 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.
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.