Jpp 20.0.0-rc.9-29-gccc23c492-D
the software that should make you happy
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Private Attributes | List of all members
JFIT::JRegressor< JLine3Z, JGandalf > Struct Reference

Regressor function object for JLine3Z fit using JGandalf minimiser. More...

#include <JLine3ZRegressor.hh>

Inheritance diagram for JFIT::JRegressor< JLine3Z, JGandalf >:
JFIT::JAbstractRegressor< JLine3Z, JGandalf > JFIT::JRegressorStorage< JLine3Z, JGandalf >

Public Types

typedef JRegressorStorage< JLine3Z, JGandalfstorage_type
 
typedef JGandalf< JLine3Zminimiser_type
 
typedef JRegressor< JLine3Z, JGandalfregressor_type
 
typedef minimiser_type::result_type result_type
 
typedef JTOOLS::JSplineFunction1S_t JFunction1D_t
 
typedef JTOOLS::JMAPLIST< JTOOLS::JPolint1FunctionalMap, JTOOLS::JPolint0FunctionalGridMap, JTOOLS::JPolint0FunctionalGridMap >::maplist JPDFMaplist_t
 
typedef JPHYSICS::JPDFTable< JFunction1D_t, JPDFMaplist_tJPDF_t
 time dependent PDF
 
typedef JTOOLS::JMAPLIST< JTOOLS::JPolint1FunctionalMapH, JTOOLS::JPolint1FunctionalGridMap, JTOOLS::JPolint1FunctionalGridMap >::maplist JNPEMaplist_t
 
typedef JPHYSICS::JNPETable< double, double, JNPEMaplist_tJNPE_t
 time integrated PDF
 
typedef JPDF_t::transformer_type transformer_type
 
typedef std::array< JPDF_t, NUMBER_OF_PDFSJPDFs_t
 PDFs.
 
typedef std::array< JNPE_t, NUMBER_OF_PDFSJNPEs_t
 NPEs.
 

Public Member Functions

 JRegressor ()
 Default constructor.
 
 JRegressor (const std::string &fileDescriptor, const JTimeRange &T_ns, const double TTS_ns, const int numberOfPoints=25, const double epsilon=1.0e-10)
 Constructor.
 
 JRegressor (const storage_type &storage)
 Constructor.
 
template<class JHit_t >
result_type operator() (const JLine3Z &track, const JHit_t &hit) const
 Fit function.
 
result_type operator() (const JLine3Z &track, const JPMTW0 &pmt) const
 Fit function.
 
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 getH0 (const double R_Hz) const
 Get background hypothesis value for time integrated 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.
 
double getRmax () const
 Get maximal road width of PDF.
 
result_type operator() (const JLine3Z &value, T __begin, T __end)
 Global fit.
 
const JPDFs_tgetPDF () const
 Get PDFs.
 
const JNPEs_tgetNPE () const
 Get NPEs.
 
void transform (const transformer_type &transformer)
 Transform PDFs and NPEs.
 

Public Attributes

const JPDFs_tpdf
 PDF.
 
const JNPEs_tnpe
 PDF.
 
double E_GeV = 0.0
 Energy of muon at vertex [GeV].
 
std::shared_ptr< JMEstimatorestimator
 M-Estimator function.
 
JTimeRange T_ns
 Time window with respect to Cherenkov hypothesis [ns].
 

Static Public Attributes

static double Vmax_npe = std::numeric_limits<double>::max()
 Maximal integral of PDF [npe].
 
static const int NUMBER_OF_PDFS = 6
 Number of PDFs.
 
static const JPDFType_t pdf_t [NUMBER_OF_PDFS]
 PDF types.
 

Private Attributes

JPDFs_t _pdf
 PDFs.
 
JNPEs_t _npe
 NPEs.
 

Detailed Description

Regressor function object for JLine3Z fit using JGandalf minimiser.

Definition at line 262 of file JLine3ZRegressor.hh.

Member Typedef Documentation

◆ storage_type

Definition at line 268 of file JLine3ZRegressor.hh.

◆ minimiser_type

typedef JGandalf <JLine3Z > JFIT::JAbstractRegressor< JLine3Z , JGandalf >::minimiser_type
inherited

Definition at line 80 of file JRegressor.hh.

◆ regressor_type

typedef JRegressor<JLine3Z , JGandalf > JFIT::JAbstractRegressor< JLine3Z , JGandalf >::regressor_type
inherited

Definition at line 81 of file JRegressor.hh.

◆ result_type

Definition at line 82 of file JRegressor.hh.

◆ JFunction1D_t

typedef JTOOLS::JSplineFunction1S_t JFIT::JRegressorStorage< JLine3Z, JGandalf >::JFunction1D_t
inherited

Definition at line 115 of file JLine3ZRegressor.hh.

◆ JPDFMaplist_t

typedef JTOOLS::JMAPLIST<JTOOLS::JPolint1FunctionalMap,JTOOLS::JPolint0FunctionalGridMap,JTOOLS::JPolint0FunctionalGridMap>::maplist JFIT::JRegressorStorage< JLine3Z, JGandalf >::JPDFMaplist_t
inherited

Definition at line 118 of file JLine3ZRegressor.hh.

◆ JPDF_t

typedef JPHYSICS::JPDFTable<JFunction1D_t, JPDFMaplist_t> JFIT::JRegressorStorage< JLine3Z, JGandalf >::JPDF_t
inherited

time dependent PDF

Definition at line 119 of file JLine3ZRegressor.hh.

◆ JNPEMaplist_t

typedef JTOOLS::JMAPLIST<JTOOLS::JPolint1FunctionalMapH,JTOOLS::JPolint1FunctionalGridMap,JTOOLS::JPolint1FunctionalGridMap>::maplist JFIT::JRegressorStorage< JLine3Z, JGandalf >::JNPEMaplist_t
inherited

Definition at line 123 of file JLine3ZRegressor.hh.

◆ JNPE_t

typedef JPHYSICS::JNPETable<double, double, JNPEMaplist_t> JFIT::JRegressorStorage< JLine3Z, JGandalf >::JNPE_t
inherited

time integrated PDF

Definition at line 124 of file JLine3ZRegressor.hh.

◆ transformer_type

typedef JPDF_t::transformer_type JFIT::JRegressorStorage< JLine3Z, JGandalf >::transformer_type
inherited

Definition at line 126 of file JLine3ZRegressor.hh.

◆ JPDFs_t

typedef std::array<JPDF_t, NUMBER_OF_PDFS> JFIT::JRegressorStorage< JLine3Z, JGandalf >::JPDFs_t
inherited

PDFs.

Definition at line 130 of file JLine3ZRegressor.hh.

◆ JNPEs_t

typedef std::array<JNPE_t, NUMBER_OF_PDFS> JFIT::JRegressorStorage< JLine3Z, JGandalf >::JNPEs_t
inherited

NPEs.

Definition at line 131 of file JLine3ZRegressor.hh.

Constructor & Destructor Documentation

◆ JRegressor() [1/3]

JFIT::JRegressor< JLine3Z, JGandalf >::JRegressor ( )
inline

Default constructor.

Definition at line 273 of file JLine3ZRegressor.hh.

273 :
274 storage_type(),
275 pdf(getPDF()),
276 npe(getNPE()),
277 estimator()
278 {}
const JNPEs_t & getNPE() const
Get NPEs.
const JPDFs_t & getPDF() const
Get PDFs.
JRegressorStorage< JLine3Z, JGandalf > storage_type
std::shared_ptr< JMEstimator > estimator
M-Estimator function.

◆ JRegressor() [2/3]

JFIT::JRegressor< JLine3Z, JGandalf >::JRegressor ( const std::string & fileDescriptor,
const JTimeRange & T_ns,
const double TTS_ns,
const int numberOfPoints = 25,
const double epsilon = 1.0e-10 )
inline

Constructor.

The PDF file descriptor should contain the wild card character JPHYSICS::WILDCARD which will be replaced by the PDF types listed in JRegressorStorage<JLine3Z, JGandalf>::pdf_t.

The TTS_ns corresponds to the additional Gaussian time smearing applied to the PDFs.

Parameters
fileDescriptorPDF file descriptor
T_nstime range [ns]
TTS_nsTTS [ns]
numberOfPointsnumber of points for Gauss-Hermite integration of TTS
epsilonprecision for Gauss-Hermite integration of TTS

Definition at line 295 of file JLine3ZRegressor.hh.

299 :
300 storage_type(fileDescriptor, T_ns, TTS_ns, numberOfPoints, epsilon),
301 pdf(getPDF()),
302 npe(getNPE()),
303 estimator(new JMEstimatorNormal())
304 {}
JTimeRange T_ns
Time window with respect to Cherenkov hypothesis [ns].

◆ JRegressor() [3/3]

JFIT::JRegressor< JLine3Z, JGandalf >::JRegressor ( const storage_type & storage)
inline

Constructor.

Parameters
storagePDF storage

Definition at line 312 of file JLine3ZRegressor.hh.

312 :
313 pdf(storage.getPDF()),
314 npe(storage.getNPE()),
315 estimator(new JMEstimatorNormal())
316 {
317 T_ns = storage.T_ns;
318 }

Member Function Documentation

◆ operator()() [1/3]

template<class JHit_t >
result_type JFIT::JRegressor< JLine3Z, JGandalf >::operator() ( const JLine3Z & track,
const JHit_t & hit ) const
inline

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
tracktrack
hithit
Returns
chi2 and gradient

Definition at line 339 of file JLine3ZRegressor.hh.

340 {
341 using namespace JPP;
342
343 JPosition3D D(hit.getX(), hit.getY(), hit.getZ());
344 JDirection3D U(hit.getDX(), hit.getDY(), hit.getDZ());
345
346 D.sub(track.getPosition());
347
348 const double z = D.getDot(track.getDirection());
349 const double x = D.getX() - z * track.getDX();
350 const double y = D.getY() - z * track.getDY();
351 const double R2 = D.getLengthSquared() - z*z;
352 const double R = sqrt(R2);
353
354 const double t1 = track.getT() + (z + R * getTanThetaC()) * getInverseSpeedOfLight();
355
356 U.rotate(JRotation3Z(-atan2(y,x))); // rotate PMT axis to x-z plane
357
358 const double theta = U.getTheta();
359 const double phi = fabs(U.getPhi());
360
361 const double E = gWater.getE(E_GeV, z);
362 const double dt = T_ns.constrain(hit.getT() - t1);
363
364 JPDF_t::result_type H0 = getH0(hit.getR(), dt);
365 JPDF_t::result_type H1 = getH1(E, R, theta, phi, dt);
366
367 if (H1.V >= Vmax_npe) {
368 H1 *= Vmax_npe / H1.V;
369 }
370
371 H1 += H0; // signal + background
372
373 result_type result;
374
375 result.chi2 = H1.getChi2() - H0.getChi2(); // Likelihood ratio
376
377 const double wc = 1.0 - getTanThetaC() * z / R; // d(ct1)/d(z)
378
379 result.gradient = JLine3Z(JLine1Z(JPosition3D(-getTanThetaC() * D.getX() / R, // d(ct1)/d(x)
380 -getTanThetaC() * D.getY() / R, // d(ct1)/d(y)
381 0.0),
382 getSpeedOfLight()), // d(ct1)/d(t)
383 JVersor3Z(wc * (D.getX() - D.getZ()*track.getDX()/track.getDZ()), // d(ct1)/d(dx)
384 wc * (D.getY() - D.getZ()*track.getDY()/track.getDZ()))); // d(ct1)/d(dy)
385
386 result.gradient.mul(getInverseSpeedOfLight() * (H1.getDerivativeOfChi2() -
387 H0.getDerivativeOfChi2())); // x d(chi2)/d(ct1)
388
389 return result;
390 }
Data structure for fit of straight line paralel to z-axis.
Definition JLine1Z.hh:29
Data structure for fit of straight line in positive z-direction.
Definition JLine3Z.hh:40
minimiser_type::result_type result_type
Definition JRegressor.hh:82
static double Vmax_npe
Maximal integral of PDF [npe].
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.
double E_GeV
Energy of muon at vertex [GeV].

◆ operator()() [2/3]

result_type JFIT::JRegressor< JLine3Z, JGandalf >::operator() ( const JLine3Z & track,
const JPMTW0 & pmt ) const
inline

Fit function.

This method is used to determine the chi2 and gradient of given PMT with respect to trajectory of muon.

Parameters
tracktrack
pmtpmt
Returns
chi2 and gradient

Definition at line 401 of file JLine3ZRegressor.hh.

402 {
403 using namespace JGEOMETRY3D;
404 using namespace JPHYSICS;
405
406 JPosition3D D(pmt.getPosition());
407 JDirection3D U(pmt.getDirection());
408
409 D.sub(track.getPosition());
410
411 const double z = D.getDot(track.getDirection());
412 const double x = D.getX() - z * track.getDX();
413 const double y = D.getY() - z * track.getDY();
414 const double R2 = D.getLengthSquared() - z*z;
415 const double R = sqrt(R2);
416
417 U.rotate(JRotation3Z(-atan2(y,x))); // rotate PMT axis to x-z plane
418
419 const double theta = U.getTheta();
420 const double phi = fabs(U.getPhi());
421
422 const double E = gWater.getE(E_GeV, z);
423
424 JNPE_t::result_type H0 = getH0(pmt.getR());
425 JNPE_t::result_type H1 = getH1(E, R, theta, phi);
426
427 if (H1.f >= Vmax_npe) {
428 H1 *= Vmax_npe / H1.f;
429 }
430
431 H1 += H0;
432
433 const bool hit = pmt.getN() != 0;
434 const double u = H1.getChi2(hit);
435
436 result_type result;
437
438 result.chi2 = estimator->getRho(u);
439
440 result.gradient = JLine3Z(JLine1Z(JPosition3D(-D.getX() / R, // d(R)/d(x)
441 -D.getY() / R, // d(R)/d(y)
442 0.0),
443 0.0),
444 JVersor3Z(-z * D.getX() / R, // d(R)/d(dx)
445 -z * D.getY() / R)); // d(R)/d(dy)
446
447 result.gradient.mul(estimator->getPsi(u));
448 result.gradient.mul(H1.getDerivativeOfChi2(hit)); // x d(chi2)/d(R)
449
450 return result;
451 }

◆ getH0() [1/2]

JPDF_t::result_type JFIT::JRegressor< JLine3Z, JGandalf >::getH0 ( const double R_Hz,
const double t1 ) const
inline

Get background hypothesis value for time differentiated PDF.

Parameters
R_Hzrate [Hz]
t1time [ns]
Returns
hypothesis value

Definition at line 461 of file JLine3ZRegressor.hh.

463 {
464 return JPDF_t::result_type(R_Hz * 1e-9, t1, T_ns);
465 }

◆ getH1() [1/2]

JPDF_t::result_type JFIT::JRegressor< JLine3Z, JGandalf >::getH1 ( const double E,
const double R,
const double theta,
const double phi,
const double t1 ) const
inline

Get signal hypothesis value for time differentiated PDF.

Parameters
Emuon energy at minimum distance of approach [GeV]
Rminimum distance of approach [m]
thetaPMT zenith angle [rad]
phiPMT azimuth angle [rad]
t1arrival time relative to Cherenkov hypothesis [ns]
Returns
hypothesis value

Definition at line 478 of file JLine3ZRegressor.hh.

483 {
484 using namespace std;
485 using namespace JPP;
486
487 JPDF_t::result_type h1 = zero;
488
489 for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
490
491 if (!pdf[i].empty() && R <= pdf[i].getXmax()) {
492
493 JPDF_t::result_type y1 = pdf[i](max(R, pdf[i].getXmin()), theta, phi, t1);
494
495 // safety measures
496
497 if (y1.f <= 0.0) {
498 y1.f = 0.0;
499 y1.fp = 0.0;
500 }
501
502 if (y1.v <= 0.0) {
503 y1.v = 0.0;
504 }
505
506 // energy dependence
507
508 if (is_deltarays(pdf_t[i])) {
509 y1 *= JDeltaRays::getEnergyLossFromMuon(E);
510 } else if (is_bremsstrahlung(pdf_t[i])) {
511 y1 *= E;
512 }
513
514 h1 += y1;
515 }
516 }
517
518 return h1;
519 }
static const JPDFType_t pdf_t[NUMBER_OF_PDFS]
PDF types.
static const int NUMBER_OF_PDFS
Number of PDFs.

◆ getH0() [2/2]

JNPE_t::result_type JFIT::JRegressor< JLine3Z, JGandalf >::getH0 ( const double R_Hz) const
inline

Get background hypothesis value for time integrated PDF.

Parameters
R_Hzrate [Hz]
Returns
hypothesis value

Definition at line 528 of file JLine3ZRegressor.hh.

529 {
530 return JNPE_t::result_type(R_Hz * 1e-9 * T_ns.getLength(), 0.0);
531 }

◆ getH1() [2/2]

JNPE_t::result_type JFIT::JRegressor< JLine3Z, JGandalf >::getH1 ( const double E,
const double R,
const double theta,
const double phi ) const
inline

Get signal hypothesis value for time integrated PDF.

Parameters
Emuon energy at minimum distance of approach [GeV]
Rminimum distance of approach [m]
thetaPMT zenith angle [rad]
phiPMT azimuth angle [rad]
Returns
hypothesis value

Definition at line 543 of file JLine3ZRegressor.hh.

547 {
548 using namespace std;
549 using namespace JPP;
550
551 JNPE_t::result_type h1 = JMATH::zero;
552
553 for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
554
555 if (!npe[i].empty() && R <= npe[i].getXmax()) {
556
557 try {
558
559 JNPE_t::result_type y1 = npe[i](max(R, npe[i].getXmin()), theta, phi);
560
561 // safety measures
562
563 if (y1.f > 0.0) {
564
565 // energy dependence
566
567 if (is_deltarays(pdf_t[i])) {
568 y1 *= JDeltaRays::getEnergyLossFromMuon(E);
569 } else if (is_bremsstrahlung(pdf_t[i])) {
570 y1 *= E;
571 }
572
573 h1 += y1;
574 }
575 }
576 catch(JException& error) {
577 ERROR(error << endl);
578 }
579 }
580 }
581
582 return h1;
583 }

◆ getRmax()

double JFIT::JRegressor< JLine3Z, JGandalf >::getRmax ( ) const
inline

Get maximal road width of PDF.

Returns
road width [m]

Definition at line 591 of file JLine3ZRegressor.hh.

592 {
593 double xmax = 0.0;
594
595 for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
596 if (!pdf[i].empty() && pdf[i].getXmax() > xmax) {
597 xmax = pdf[i].getXmax();
598 }
599 }
600
601 return xmax;
602 }

◆ operator()() [3/3]

result_type JFIT::JAbstractRegressor< JLine3Z , JGandalf >::operator() ( const JLine3Z & value,
T __begin,
T __end )
inlineinherited

Global fit.

Parameters
valuestart value
__beginbegin of data set
__endend of data set
Returns
chi2

Definition at line 94 of file JRegressor.hh.

◆ getPDF()

const JPDFs_t & JFIT::JRegressorStorage< JLine3Z, JGandalf >::getPDF ( ) const
inlineinherited

Get PDFs.

Returns
PDFs

Definition at line 201 of file JLine3ZRegressor.hh.

202 {
203 return _pdf;
204 }

◆ getNPE()

const JNPEs_t & JFIT::JRegressorStorage< JLine3Z, JGandalf >::getNPE ( ) const
inlineinherited

Get NPEs.

Returns
NPEs

Definition at line 212 of file JLine3ZRegressor.hh.

213 {
214 return _npe;
215 }

◆ transform()

void JFIT::JRegressorStorage< JLine3Z, JGandalf >::transform ( const transformer_type & transformer)
inlineinherited

Transform PDFs and NPEs.

Parameters
transformertransformer

Definition at line 223 of file JLine3ZRegressor.hh.

224 {
225 for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
226 _pdf[i].transform(transformer);
227 _npe[i].transform(transformer);
228 }
229 }

Member Data Documentation

◆ Vmax_npe

double JFIT::JRegressor< JLine3Z, JGandalf >::Vmax_npe = std::numeric_limits<double>::max()
static

Maximal integral of PDF [npe].

Default values.

Definition at line 605 of file JLine3ZRegressor.hh.

◆ pdf

PDF.

Definition at line 607 of file JLine3ZRegressor.hh.

◆ npe

PDF.

Definition at line 608 of file JLine3ZRegressor.hh.

◆ E_GeV

double JFIT::JRegressor< JLine3Z, JGandalf >::E_GeV = 0.0

Energy of muon at vertex [GeV].

Definition at line 610 of file JLine3ZRegressor.hh.

◆ estimator

std::shared_ptr<JMEstimator> JFIT::JRegressor< JLine3Z, JGandalf >::estimator

M-Estimator function.

Definition at line 612 of file JLine3ZRegressor.hh.

◆ NUMBER_OF_PDFS

const int JFIT::JRegressorStorage< JLine3Z, JGandalf >::NUMBER_OF_PDFS = 6
staticinherited

Number of PDFs.

Definition at line 128 of file JLine3ZRegressor.hh.

◆ pdf_t

const JPDFType_t JFIT::JRegressorStorage< JLine3Z, JGandalf >::pdf_t
staticinherited
Initial value:
= {
DIRECT_LIGHT_FROM_MUON,
SCATTERED_LIGHT_FROM_MUON,
DIRECT_LIGHT_FROM_DELTARAYS,
SCATTERED_LIGHT_FROM_DELTARAYS,
DIRECT_LIGHT_FROM_EMSHOWERS,
SCATTERED_LIGHT_FROM_EMSHOWERS
}

PDF types.

Definition at line 235 of file JLine3ZRegressor.hh.

◆ T_ns

JTimeRange JFIT::JRegressorStorage< JLine3Z, JGandalf >::T_ns
inherited

Time window with respect to Cherenkov hypothesis [ns].

Definition at line 237 of file JLine3ZRegressor.hh.

◆ _pdf

JPDFs_t JFIT::JRegressorStorage< JLine3Z, JGandalf >::_pdf
privateinherited

PDFs.

Definition at line 240 of file JLine3ZRegressor.hh.

◆ _npe

JNPEs_t JFIT::JRegressorStorage< JLine3Z, JGandalf >::_npe
privateinherited

NPEs.

Definition at line 241 of file JLine3ZRegressor.hh.


The documentation for this struct was generated from the following file: