1#ifndef __JFIT__JLINE3ZREGRESSOR__
2#define __JFIT__JLINE3ZREGRESSOR__
36namespace JPP {
using namespace JFIT; }
75 template<
class JHit_t>
76 double operator()(
const JLine3Z& track,
const JHit_t& hit)
const
85 const double R = sqrt(D.getLengthSquared() - z*z);
87 const double t1 = track.
getT() + (z + R *
getKappaC()) * getInverseSpeedOfLight();
89 const double u = (t1 - hit.getT()) /
sigma;
91 return estimator->getRho(u) * hit.getW();
137 const double epsilon = 1.0e-10) :
150 pdf(storage.getPDF()),
172 template<
class JHit_t>
173 result_type operator()(
const JLine3Z& track,
const JHit_t& hit)
const
183 const double x = D.getX() - z * track.
getDX();
184 const double y = D.getY() - z * track.
getDY();
185 const double R2 = D.getLengthSquared() - z*z;
186 const double R = (R2 > Rmin_m*Rmin_m ? sqrt(R2) : Rmin_m);
188 const double t1 = track.
getT() + (z + R * getTanThetaC()) * getInverseSpeedOfLight();
192 const double theta = U.getTheta();
193 const double phi = fabs(U.getPhi());
195 const double E = gWater.getE(E_GeV, z);
196 const double dt = T_ns.constrain(hit.getT() - t1);
198 JPDF_t::result_type H0 = getH0(hit.getR(), dt);
199 JPDF_t::result_type H1 = getH1(E, R, theta, phi, dt);
201 if (H1.V >= Vmax_npe) {
202 H1 *= Vmax_npe / H1.V;
209 result.chi2 = H1.getChi2() - H0.getChi2();
211 const double wc = 1.0 - getTanThetaC() * z / R;
214 -getTanThetaC() * D.getY() / R,
218 wc * (D.getY() - D.getZ()*track.
getDY()/track.
getDZ())));
220 result.gradient.mul(getInverseSpeedOfLight() * (H1.getDerivativeOfChi2() -
221 H0.getDerivativeOfChi2()));
235 result_type operator()(
const JLine3Z& track,
const JPMTW0& pmt)
const
246 const double x = D.getX() - z * track.
getDX();
247 const double y = D.getY() - z * track.
getDY();
248 const double R2 = D.getLengthSquared() - z*z;
249 const double R = (R2 > Rmin_m*Rmin_m ? sqrt(R2) : Rmin_m);
253 const double theta = U.getTheta();
254 const double phi = fabs(U.getPhi());
256 const double E = gWater.getE(E_GeV, z);
258 JNPE_t::result_type H0 = getH0(pmt.
getR());
259 JNPE_t::result_type H1 = getH1(E, R, theta, phi);
261 if (H1.f >= Vmax_npe) {
262 H1 *= Vmax_npe / H1.f;
267 const bool hit = pmt.
getN() != 0;
268 const double u = H1.getChi2(hit);
272 result.chi2 = estimator->getRho(u);
281 result.gradient.mul(estimator->getPsi(u));
282 result.gradient.mul(H1.getDerivativeOfChi2(hit));
295 JPDF_t::result_type getH0(
const double R_Hz,
296 const double t1)
const
298 return JPDF_t::result_type(R_Hz * 1e-9, t1, T_ns);
312 JPDF_t::result_type getH1(
const double E,
316 const double t1)
const
321 JPDF_t::result_type h1 = zero;
323 for (
int i = 0; i != NUMBER_OF_PDFS; ++i) {
325 if (!pdf[i].empty() && R <= pdf[i].getXmax()) {
327 JPDF_t::result_type y1 = pdf[i](max(R, pdf[i].getXmin()), theta, phi, t1);
362 JNPE_t::result_type getH0(
const double R_Hz)
const
364 return JNPE_t::result_type(R_Hz * 1e-9 * T_ns.getLength(), 0.0);
377 JNPE_t::result_type getH1(
const double E,
380 const double phi)
const
387 for (
int i = 0; i != NUMBER_OF_PDFS; ++i) {
389 if (!npe[i].empty() && R <= npe[i].getXmax()) {
393 JNPE_t::result_type y1 = npe[i](max(R, npe[i].getXmin()), theta, phi);
411 ERROR(error << endl);
425 inline double getRmax()
const
429 for (
int i = 0; i != NUMBER_OF_PDFS; ++i) {
430 if (!pdf[i].empty() && pdf[i].getXmax() > xmax) {
431 xmax = pdf[i].getXmax();
440 static double Vmax_npe;
441 static double Rmin_m;
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.
Definition of zero value for any class.
Fit method based on the Levenberg-Marquardt method.
Data structure for fit of straight line paralel to z-axis.
Data structure for fit of straight line in positive z-direction.
JVersor3D getDirection(const JVector3D &pos) const
Get photon direction of Cherenkov light on PMT.
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
Simple fit method based on Powell's algorithm, see reference: Numerical Recipes in C++,...
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 positive z-direction.
double getDZ() const
Get z direction.
double getDY() const
Get y direction.
double getDX() const
Get x direction.
The template JSharedPointer class can be used to share a pointer to an object.
double getNPE(const Hit &hit)
Get true charge of hit.
Auxiliary classes and methods for linear and iterative data regression.
Auxiliary classes and methods for 3D geometrical objects and operations.
static const JZero zero
Function object to assign zero value.
Auxiliary methods for light properties of deep-sea water.
double getDeltaRaysFromMuon(const double E, const JRange< double > T_GeV=JRange< double >(DELTARAY_TMIN, DELTARAY_TMAX))
Equivalent EM-shower energy due to delta-rays per unit muon track length.
double getKappaC()
Get average R-dependence of arrival time of Cherenkov light (a.k.a.
bool is_deltarays(const int pdf)
Test if given PDF type corresponds to Cherenkov light from delta-rays.
bool is_bremsstrahlung(const int pdf)
Test if given PDF type corresponds to Cherenkov light from Bremsstrahlung.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Abstract class for global fit method.
Auxiliary class for handling PMT geometry, rate and response.
int getN() const
Get number of hits.
double getR() const
Get rate.
Template data structure for storage for PDF tables.
Template definition of a data regressor of given model.
Auxiliary class to set-up Hit.