1 #ifndef __JFIT__JLINE3ZREGRESSOR__
2 #define __JFIT__JLINE3ZREGRESSOR__
33 namespace JPP {
using namespace JFIT; }
81 template<
class JHit_t>
84 using namespace JGEOMETRY3D;
85 using namespace JTOOLS;
92 const double R = sqrt(D.getLengthSquared() - z*z);
96 const double u = (t1 - hit.getT()) / sigma;
98 return estimator->getRho(u) * hit.getW();
149 const double epsilon = 1.0e-10) :
154 using namespace JPHYSICS;
156 const JPDF_t::JSupervisor supervisor(
new JPDF_t::JDefaultResult(
JMATH::zero));
158 for (
int i = 0; i != NUMBER_OF_PDFS; ++i) {
162 const string file_name =
getFilename(fileDescriptor, pdf_t[i]);
164 NOTICE(
"loading PDF from file " << file_name <<
"... " << flush);
166 pdf[i].load(file_name.c_str());
170 pdf[i].setExceptionHandler(supervisor);
174 }
else if (TTS < 0.0) {
175 ERROR(
"Illegal value of TTS [ns]: " << TTS << endl);
185 for (
int i = 1; i < NUMBER_OF_PDFS; i += 2) {
187 pdf[ i ].add(pdf[i-1]);
190 npe[ i ] =
JNPE_t(pdf[i]);
191 npe[ i ].transform(JNPE_t::transformer_type::getDefaultTransformer());
213 template<
class JHit_t>
216 using namespace JGEOMETRY3D;
217 using namespace JTOOLS;
218 using namespace JPHYSICS;
226 const double x = D.getX() - z * track.
getDX();
227 const double y = D.getY() - z * track.
getDY();
228 const double R = sqrt(D.getLengthSquared() - z*z);
234 const double theta = U.getTheta();
235 const double phi = fabs(U.getPhi());
238 const double dt = T_ns.constrain(hit.getT() - t1);
243 if (H1.V >= Vmax_npe) {
244 H1 *= Vmax_npe / H1.V;
251 result.chi2 = H1.getChi2() - H0.getChi2();
260 wc * (D.getY() - D.getZ()*track.
getDY()/track.
getDZ())));
263 H0.getDerivativeOfChi2()));
279 using namespace JGEOMETRY3D;
280 using namespace JPHYSICS;
288 const double x = D.getX() - z * track.
getDX();
289 const double y = D.getY() - z * track.
getDY();
290 const double R = sqrt(D.getLengthSquared() - z*z);
294 const double theta = U.getTheta();
295 const double phi = fabs(U.getPhi());
302 if (H1.f >= Vmax_npe) {
303 H1 *= Vmax_npe / H1.f;
308 const bool hit = pmt.
getN() != 0;
309 const double u = H1.getChi2(hit);
313 result.chi2 = estimator->getRho(u);
322 result.gradient.mul(estimator->getPsi(u));
323 result.gradient.mul(H1.getDerivativeOfChi2(hit));
337 const double t1)
const
357 const double t1)
const
359 using namespace JPHYSICS;
363 for (
int i = 0; i != NUMBER_OF_PDFS; ++i) {
365 if (!pdf[i].empty() && R <= pdf[i].getXmax()) {
420 const double phi)
const
422 using namespace JPHYSICS;
426 for (
int i = 0; i != NUMBER_OF_PDFS; ++i) {
428 if (!npe[i].empty() && R <= npe[i].getXmax()) {
450 ERROR(error << std::endl);
468 for (
int i = 0; i != NUMBER_OF_PDFS; ++i) {
469 if (!pdf[i].empty() && pdf[i].getXmax() > xmax) {
470 xmax = pdf[i].getXmax();
481 static const int NUMBER_OF_PDFS = 4;
Template definition of a data regressor of given model.
General purpose data regression method.
static const JGeane gWater(2.67e-1 *JTOOLS::DENSITY_SEA_WATER, 3.4e-4 *JTOOLS::DENSITY_SEA_WATER)
Function object for Energy loss of muon in sea water.
double getE(const double E, const double dx) const
Get energy of muon after specified distance.
transformablemultifunction_t::result_type result_type
double getR() const
Get rate.
JTOOLS::JSplineFunction1S_t JFunction1D_t
JPDF_t::result_type getH0(const double R_Hz, const double t1) const
Get background hypothesis value for time differentiated PDF.
JPDF_t::result_type getH1(const double E, const double R, const double theta, const double phi, const double t1) const
Get signal hypothesis value for time differentiated PDF.
JNPE_t::result_type getH1(const double E, const double R, const double theta, const double phi) const
Get signal hypothesis value for time integrated PDF.
Data structure for direction in three dimensions.
JRegressor(const std::string &fileDescriptor, const double TTS, const int numberOfPoints=25, const double epsilon=1.0e-10)
Constructor.
Auxiliary class for handling PMT geometry, rate and response.
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
const JDirection3D & getDirection() const
Get direction.
JRegressor(double sigma)
Constructor.
direct light from EM showers
Data structure for fit of straight line in positive z-direction.
static const JZero zero
Function object to assign zero value.
JNPE_t::result_type getH0(const double R_Hz) const
Get background hypothesis value for time integrated PDF.
Definition of zero value for any class.
double getDot(const JAngle3D &angle) const
Get dot product.
double getDY() const
Get y direction.
Various implementations of functional maps.
static JTimeRange T_ns
Time window with respect to Cherenkov hypothesis [ns].
Numbering scheme for PDF types.
result_type operator()(const JLine3Z &track, const JHit_t &hit) const
Fit function.
bool is_bremsstrahlung(const int pdf)
Test if given PDF type corresponds to Cherenkov light from Bremsstrahlung.
JVersor3D getDirection(const JVector3D &pos) const
Get photon direction of Cherenkov light on PMT.
scattered light from muon
JVector3D & sub(const JVector3D &vector)
Subtract vector.
The template JSharedPointer class can be used to share a pointer to an object.
JTOOLS::JMAPLIST< JTOOLS::JPolint1FunctionalMapH, JTOOLS::JPolint1FunctionalGridMap, JTOOLS::JPolint1FunctionalGridMap >::maplist JNPEMaplist_t
multifunction_t::result_type result_type
double E_GeV
Energy of muon at vertex [GeV].
scattered light from delta-rays
scattered light from EM showers
JLANG::JSharedPointer< JMEstimator > estimator
M-Estimator function.
const JPosition3D & getPosition() const
Get position.
double operator()(const JLine3Z &track, const JHit_t &hit) const
Fit function.
result_type operator()(const JLine3Z &track, const JPMTW0 &pmt) const
Fit function.
JPHYSICS::JNPETable< double, double, JNPEMaplist_t > JNPE_t
General purpose messaging.
JLine3Z & mul(const double value)
Multiplication operator.
double getRmax() const
Get maximal road width of PDF.
Fit method based on the Levenberg-Marquardt method.
direct light from delta-rays
double sigma
Time resolution [ns].
int getN() const
Get number of hits.
Simple fit method based on Powell's algorithm, see reference: Numerical Recipes in C++...
static double Vmax_npe
Maximal integral of PDF [npe].
double getDX() const
Get x direction.
bool is_deltarays(const int pdf)
Test if given PDF type corresponds to Cherenkov light from delta-rays.
Data structure for fit of straight line paralel to z-axis.
double getDeltaRaysFromMuon(const double E)
Equivalent EM-shower energy due to delta-rays per unit muon track length.
std::string getFilename(const std::string &file_name)
Get file name part, i.e.
JPHYSICS::JPDFTable< JFunction1D_t, JPDFMaplist_t > JPDF_t
double getDot(const JVector3D &vector) const
Get dot product.
Data structure for position in three dimensions.
double getDZ() const
Get z direction.
virtual const char * what() const
Get error message.
JLANG::JSharedPointer< JMEstimator > estimator
M-Estimator function.
Data structure for normalised vector in positive z-direction.
JRegressor()
Default constructor.
JTOOLS::JMAPLIST< JTOOLS::JPolint1FunctionalMap, JTOOLS::JPolint0FunctionalGridMap, JTOOLS::JPolint0FunctionalGridMap >::maplist JPDFMaplist_t
Abstract class for global fit method.
Maximum likelihood estimator (M-estimators).