Regressor function object for JLine3Z fit using JGandalf minimiser.
More...
#include <JLine3ZRegressor.hh>
|
| JRegressor () |
| Default constructor. More...
|
|
| JRegressor (const std::string &fileDescriptor, const double TTS, const int numberOfPoints=25, const double epsilon=1.0e-10) |
| Constructor. More...
|
|
template<class JHit_t > |
result_type | operator() (const JLine3Z &track, const JHit_t &hit) const |
| Fit function. More...
|
|
result_type | operator() (const JLine3Z &track, const JPMTW0 &pmt) const |
| Fit function. More...
|
|
JPDF_t::result_type | getH0 (const double R_Hz, const double t1) const |
| Get background hypothesis value for time differentiated PDF. More...
|
|
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. More...
|
|
JNPE_t::result_type | getH0 (const double R_Hz) const |
| Get background hypothesis value for time integrated PDF. More...
|
|
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. More...
|
|
void | compress (const JRange< typename JFunction1D_t::abscissa_type > &R_compress) |
| Compresses PDFs to abscissa range specified by R_compress. More...
|
|
double | getRmax () const |
| Get maximal road width of PDF. More...
|
|
result_type | operator() (const JLine3Z &value, T __begin, T __end) |
| Global fit. More...
|
|
result_type | operator() (const JLine3Z &value, T1 __begin1, T1 __end1, T2 __begin2, T2 __end2) |
| Global fit. More...
|
|
result_type | operator() (const JFunction_t &fit, T1 __begin1, T1 __end1, T2 __begin2, T2 __end2) |
| Multi-dimensional fit of two data sets. More...
|
|
result_type | operator() (const JFunction_t &fit, T __begin, T __end) |
| Multi-dimensional fit of one data set. More...
|
|
template<>
struct JFIT::JRegressor< JLine3Z, JGandalf >
Regressor function object for JLine3Z fit using JGandalf minimiser.
Definition at line 111 of file JLine3ZRegressor.hh.
◆ JFunction1D_t
◆ JPDFMaplist_t
◆ JPDF_t
◆ JNPEMaplist_t
◆ JNPE_t
◆ minimiser_type
◆ regressor_type
◆ result_type
◆ parameter_type
Data type of fit parameter.
Definition at line 56 of file JGandalf.hh.
◆ JRegressor() [1/2]
◆ JRegressor() [2/2]
Constructor.
The PDF file descriptor should contain the wild card character JPHYSICS::WILD_CARD which will be replaced by the corresponding PDF types listed in JRegressor<JLine3Z, JGandalf>::pdf_t.
The TTS
corresponds to the additional time smearing applied to the PDFs.
- Parameters
-
fileDescriptor | PDF file descriptor |
TTS | TTS [ns] |
numberOfPoints | number of points for Gauss-Hermite integration of TTS |
epsilon | precision for Gauss-Hermite integration of TTS |
Definition at line 147 of file JLine3ZRegressor.hh.
157 const JPDF_t::JSupervisor supervisor(
new JPDF_t::JDefaultResult(
JMATH::zero));
165 NOTICE(
"loading PDF from file " << file_name <<
"... " << flush);
167 pdf[i].
load(file_name.c_str());
175 }
else if (TTS < 0.0) {
176 ERROR(
"Illegal value of TTS [ns]: " << TTS << endl);
179 catch(
const JException&
error) {
◆ operator()() [1/6]
Fit function.
This method is used to determine the chi2 and gradient of given hit with respect to trajectory of muon.
The template argument JHit_t
refers to a data structure which should have the following member methods:
- double getX(); // [m]
- double getY(); // [m]
- double getZ(); // [m]
- double getDX(); // [u]
- double getDY(); // [u]
- double getDZ(); // [u]
- double getT(); // [ns]
- Parameters
-
- Returns
- chi2 and gradient
Definition at line 214 of file JLine3ZRegressor.hh.
224 const double x = D.getX() - z * track.
getDX();
225 const double y = D.getY() - z * track.
getDY();
226 const double R = sqrt(D.getLengthSquared() - z*z);
232 const double theta = U.getTheta();
233 const double phi = fabs(U.getPhi());
238 JPDF_t::result_type H0 =
getH0(hit.getR(), dt);
239 JPDF_t::result_type H1 =
getH1(E, R, theta, phi, dt);
249 result.chi2 = H1.getChi2() - H0.getChi2();
258 wc * (D.getY() - D.getZ()*track.
getDY()/track.
getDZ())));
261 H0.getDerivativeOfChi2()));
◆ operator()() [2/6]
Fit function.
This method is used to determine the chi2 and gradient of given PMT with respect to trajectory of muon.
- Parameters
-
- Returns
- chi2 and gradient
Definition at line 275 of file JLine3ZRegressor.hh.
286 const double x = D.getX() - z * track.
getDX();
287 const double y = D.getY() - z * track.
getDY();
288 const double R = sqrt(D.getLengthSquared() - z*z);
292 const double theta = U.getTheta();
293 const double phi = fabs(U.getPhi());
297 JNPE_t::result_type H0 =
getH0(pmt.
getR());
298 JNPE_t::result_type H1 =
getH1(E, R, theta, phi);
306 const bool hit = pmt.
getN() != 0;
307 const double u = H1.getChi2(hit);
321 result.gradient.mul(H1.getDerivativeOfChi2(hit));
◆ getH0() [1/2]
Get background hypothesis value for time differentiated PDF.
- Parameters
-
R_Hz | rate [Hz] |
t1 | time [ns] |
- Returns
- hypothesis value
Definition at line 334 of file JLine3ZRegressor.hh.
337 return JPDF_t::result_type(R_Hz * 1e-9, t1,
T_ns);
◆ getH1() [1/2]
Get signal hypothesis value for time differentiated PDF.
- Parameters
-
E | muon energy at minimum distance of approach [GeV] |
R | minimum distance of approach [m] |
theta | PMT zenith angle [rad] |
phi | PMT azimuth angle [rad] |
t1 | arrival time relative to Cherenkov hypothesis [ns] |
- Returns
- hypothesis value
Definition at line 351 of file JLine3ZRegressor.hh.
360 JPDF_t::result_type h1 =
zero;
364 if (!
pdf[i].empty() && R <=
pdf[i].getXmax()) {
366 JPDF_t::result_type y1 =
pdf[i](max(R,
pdf[i].getXmin()), theta, phi, t1);
◆ getH0() [2/2]
Get background hypothesis value for time integrated PDF.
- Parameters
-
- Returns
- hypothesis value
Definition at line 401 of file JLine3ZRegressor.hh.
403 return JNPE_t::result_type(R_Hz * 1e-9 *
T_ns.
getLength(), 0.0);
◆ getH1() [2/2]
Get signal hypothesis value for time integrated PDF.
- Parameters
-
E | muon energy at minimum distance of approach [GeV] |
R | minimum distance of approach [m] |
theta | PMT zenith angle [rad] |
phi | PMT azimuth angle [rad] |
- Returns
- hypothesis value
Definition at line 416 of file JLine3ZRegressor.hh.
428 if (!
npe[i].empty() && R <=
npe[i].getXmax()) {
432 JNPE_t::result_type y1 =
npe[i](max(R,
npe[i].getXmin()), theta, phi);
449 catch(JException&
error) {
◆ compress()
Compresses PDFs to abscissa range specified by R_compress.
- Parameters
-
R_compress | Compression Range [abscissa_type of 0-th dim. in PDF table] |
Definition at line 464 of file JLine3ZRegressor.hh.
468 NOTICE(
"Compressing PDFs to " << R_compress.getLowerLimit() <<
" " << R_compress.getUpperLimit() << endl);
471 if (!
pdf[i].empty() && R_compress.is_valid()) {
◆ getRmax()
Get maximal road width of PDF.
- Returns
- road width [m]
Definition at line 484 of file JLine3ZRegressor.hh.
489 if (!
pdf[i].empty() &&
pdf[i].getXmax() > xmax) {
490 xmax =
pdf[i].getXmax();
◆ operator()() [3/6]
Global fit.
- Parameters
-
value | start value |
__begin | begin of data set |
__end | end of data set |
- Returns
- chi2
Definition at line 92 of file JRegressor.hh.
94 static_cast<minimiser_type&>(*this).value =
value;
96 return static_cast<minimiser_type&>(*
this)(static_cast<regressor_type&>(*
this), __begin, __end);
◆ operator()() [4/6]
Global fit.
- Parameters
-
value | start value |
__begin1 | begin of first data set |
__end1 | end of first data set |
__begin2 | begin of second data set |
__end2 | end of second data set |
- Returns
- chi2
Definition at line 111 of file JRegressor.hh.
115 static_cast<minimiser_type&>(*this).value =
value;
117 return static_cast<minimiser_type&>(*
this)(static_cast<regressor_type&>(*
this), __begin1, __end1, __begin2, __end2);
◆ operator()() [5/6]
Multi-dimensional fit of two data sets.
The fit function should return the equivalent of chi2 for the current value of the model and the given data point as well as the partial derivatives.
- Parameters
-
fit | fit function |
__begin1 | begin of first data set |
__end1 | end of first data set |
__begin2 | begin of second data set |
__end2 | end of second data set |
- Returns
- chi2
Definition at line 122 of file JGandalf.hh.
137 result_type precursor = result_type(numeric_limits<double>::max(), JModel_t());
182 DEBUG(
"Hesse matrix:" << endl);
188 for (
int i = 0; i != N; ++i) {
194 h[i] = 1.0 / sqrt(
H(i,i));
200 for (
int i = 0; i != N; ++i) {
201 for (
int j = 0;
j != i; ++
j) {
202 H(
j,i) *=
h[i] *
h[
j];
207 for (
int i = 0; i != N; ++i) {
215 catch (
const JException&
error) {
221 for (
int i = 0; i != N; ++i) {
224 for (
int j = 0;
j != N; ++
j) {
◆ operator()() [6/6]
Multi-dimensional fit of one data set.
The fit function should return the equivalent of chi2 for the current value of the model and the given data point as well as the partial derivatives.
- Parameters
-
fit | fit function |
__begin | begin of data |
__end | end of data |
- Returns
- chi2
Definition at line 251 of file JGandalf.hh.
253 return (*
this)(fit, __begin, __end, __end, __end);
◆ reset()
◆ evaluate()
Evaluate fit for given data set.
- Parameters
-
fit | fit function |
__begin | begin of data |
__end | end of data |
Definition at line 292 of file JGandalf.hh.
294 for (T hit = __begin; hit != __end; ++hit) {
301 for (
unsigned int i = 0; i !=
parameters.size(); ++i) {
◆ T_ns
Time window with respect to Cherenkov hypothesis [ns].
Default values.
Definition at line 498 of file JLine3ZRegressor.hh.
◆ Vmax_npe
◆ NUMBER_OF_PDFS
◆ pdf_t
◆ pdf
◆ npe
◆ E_GeV
◆ estimator
◆ MAXIMUM_ITERATIONS
maximal number of iterations
maximal number of iterations.
Definition at line 257 of file JGandalf.hh.
◆ EPSILON
maximal distance to minimum
maximal distance to minimum.
Definition at line 258 of file JGandalf.hh.
◆ LAMBDA_MIN
minimal value control parameter
Definition at line 259 of file JGandalf.hh.
◆ LAMBDA_MAX
maximal value control parameter
Definition at line 260 of file JGandalf.hh.
◆ LAMBDA_UP
multiplication factor control parameter
Definition at line 261 of file JGandalf.hh.
◆ LAMBDA_DOWN
multiplication factor control parameter
Definition at line 262 of file JGandalf.hh.
◆ PIVOT
minimal value diagonal element of matrix
Definition at line 263 of file JGandalf.hh.
◆ lambda
◆ value
◆ error
◆ parameters
◆ numberOfIterations
◆ successor
◆ previous
◆ debug
debug level (default is off).
Definition at line 45 of file JMessage.hh.
The documentation for this struct was generated from the following file:
static double LAMBDA_MAX
maximal value control parameter
void compress(const JRange< typename function_type::abscissa_type > &Crange)
Compresses PDF to abscissa range specified by Crange.
static const JPDFType_t pdf_t[NUMBER_OF_PDFS]
PDF types.
void blur(const double TTS, const int numberOfPoints=25, const double epsilon=1.0e-10, const double quantile=0.99)
Blur PDF.
Auxiliary data structure for floating point format specification.
Data structure for fit of straight line in positive z-direction.
static double LAMBDA_DOWN
multiplication factor control parameter
JPHYSICS::JNPETable< double, double, JNPEMaplist_t > JNPE_t
time integrated PDF
void evaluate(const JFunction_t &fit, T __begin, T __end)
Evaluate fit for given data set.
static const JGeaneWater gWater
Function object for energy loss of muon in sea water.
JPDF_t::result_type getH0(const double R_Hz, const double t1) const
Get background hypothesis value for time differentiated PDF.
Data structure for normalised vector in positive z-direction.
static int MAXIMUM_ITERATIONS
maximal number of iterations
double getR() const
Get rate.
bool is_deltarays(const int pdf)
Test if given PDF type corresponds to Cherenkov light from delta-rays.
const JDirection3D & getDirection() const
Get direction.
static JTimeRange T_ns
Time window with respect to Cherenkov hypothesis [ns].
static double EPSILON
maximal distance to minimum
double getDot(const JAngle3D &angle) const
Get dot product.
Auxiliary classes and methods for calculation of PDF and muon energy loss.
Data structure for direction in three dimensions.
static double Vmax_npe
Maximal integral of PDF [npe].
minimiser_type::result_type result_type
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.
double getDeltaRaysFromMuon(const double E)
Equivalent EM-shower energy due to delta-rays per unit muon track length.
virtual double getE(const double E, const double dx) const
Get energy of muon after specified distance.
JPDF_t pdf[NUMBER_OF_PDFS]
PDF.
double E_GeV
Energy of muon at vertex [GeV].
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
JLANG::JSharedPointer< JMEstimator > estimator
M-Estimator function.
int getN() const
Get number of hits.
JVersor3D getDirection(const JVector3D &pos) const
Get photon direction of Cherenkov light on PMT.
static double PIVOT
minimal value diagonal element of matrix
static double LAMBDA_MIN
minimal value control parameter
Data structure for position in three dimensions.
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
std::vector< parameter_type > parameters
bool is_bremsstrahlung(const int pdf)
Test if given PDF type corresponds to Cherenkov light from Bremsstrahlung.
std::string getFilename(const std::string &file_name)
Get file name part, i.e.
Auxiliary data structure for floating point format specification.
scattered light from EM showers
Data structure for fit of straight line paralel to z-axis.
JMatrixND & reset()
Set matrix to the null matrix.
const JPosition3D & getPosition() const
Get position.
void invert()
Invert matrix according LDU decomposition.
#define DEBUG(A)
Message macros.
double getDY() const
Get y direction.
static double LAMBDA_UP
multiplication factor control parameter
Auxiliary classes and methods for 3D geometrical objects and operations.
static const int NUMBER_OF_PDFS
static const JZero zero
Function object to assign zero value.
void resize(const size_t size)
Resize matrix.
double getDZ() const
Get z direction.
direct light from EM showers
void load(const char *file_name)
Load from input file.
JNPE_t npe[NUMBER_OF_PDFS]
PDF.
double getDX() const
Get x direction.
scattered light from muon