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< JShower3EZ, JGandalf > Struct Reference

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

#include <JShower3EZRegressor.hh>

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

Public Types

typedef JRegressorStorage< JShower3EZ, JGandalfstorage_type
 
typedef JGandalf< JShower3EZminimiser_type
 
typedef JRegressor< JShower3EZ, JGandalfregressor_type
 
typedef minimiser_type::result_type result_type
 
typedef JTOOLS::JPolint1Function1D_t JFunction1D_t
 
typedef JTOOLS::JMapList< JTOOLS::JPolint0FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalGridMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalGridMap > > > > JPDFMaplist_t
 
typedef JPHYSICS::JPDFTable< JFunction1D_t, JPDFMaplist_tJPDF_t
 
typedef JTOOLS::JMapList< JTOOLS::JPolint1FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint1FunctionalMapH, JTOOLS::JMapList< JTOOLS::JPolint1FunctionalGridMap, JTOOLS::JMapList< JTOOLS::JPolint1FunctionalGridMap > > > > JNPEMaplist_t
 
typedef JPHYSICS::JNPETable< double, double, JNPEMaplist_tJNPE_t
 
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)
 Constructor.
 
 JRegressor (const storage_type &storage)
 Constructor.
 
result_type operator() (const JShower3EZ &shower, const JPMTW0 &pmt) const
 Fit function.
 
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 D, const double cd, const double theta, const double phi, const double E) const
 Get signal hypothesis value for time integrated PDF.
 
result_type operator() (const JShower3EZ &value, T __begin, T __end)
 Global fit.
 
const JNPEs_tgetNPE () const
 Get NPEs.
 

Public Attributes

const JNPEs_tnpe
 
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 = 2
 
static const JPDFType_t pdf_t [NUMBER_OF_PDFS]
 PDF types.
 

Private Attributes

JNPEs_t _npe
 PDFs.
 

Detailed Description

Regressor function object for JShower3EZ fit using JGandalf minimiser.

Definition at line 451 of file JShower3EZRegressor.hh.

Member Typedef Documentation

◆ storage_type

Definition at line 457 of file JShower3EZRegressor.hh.

◆ minimiser_type

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

Definition at line 80 of file JRegressor.hh.

◆ regressor_type

typedef JRegressor<JShower3EZ , JGandalf > JFIT::JAbstractRegressor< JShower3EZ , 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::JPolint1Function1D_t JFIT::JRegressorStorage< JShower3EZ, JGandalf >::JFunction1D_t
inherited

Definition at line 351 of file JShower3EZRegressor.hh.

◆ JPDFMaplist_t

typedef JTOOLS::JMapList<JTOOLS::JPolint0FunctionalMap, JTOOLS::JMapList<JTOOLS::JPolint0FunctionalMap, JTOOLS::JMapList<JTOOLS::JPolint0FunctionalGridMap, JTOOLS::JMapList<JTOOLS::JPolint0FunctionalGridMap> > > > JFIT::JRegressorStorage< JShower3EZ, JGandalf >::JPDFMaplist_t
inherited

Definition at line 355 of file JShower3EZRegressor.hh.

◆ JPDF_t

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

Definition at line 356 of file JShower3EZRegressor.hh.

◆ JNPEMaplist_t

typedef JTOOLS::JMapList<JTOOLS::JPolint1FunctionalMap, JTOOLS::JMapList<JTOOLS::JPolint1FunctionalMapH, JTOOLS::JMapList<JTOOLS::JPolint1FunctionalGridMap, JTOOLS::JMapList<JTOOLS::JPolint1FunctionalGridMap> > > > JFIT::JRegressorStorage< JShower3EZ, JGandalf >::JNPEMaplist_t
inherited

Definition at line 361 of file JShower3EZRegressor.hh.

◆ JNPE_t

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

Definition at line 362 of file JShower3EZRegressor.hh.

◆ JNPEs_t

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

NPEs.

Definition at line 367 of file JShower3EZRegressor.hh.

Constructor & Destructor Documentation

◆ JRegressor() [1/3]

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

Default constructor.

Definition at line 462 of file JShower3EZRegressor.hh.

462 :
463 storage_type(),
464 npe(getNPE()),
465 estimator()
466 {}
JRegressorStorage< JShower3EZ, JGandalf > storage_type
std::shared_ptr< JMEstimator > estimator
M-Estimator function.

◆ JRegressor() [2/3]

JFIT::JRegressor< JShower3EZ, JGandalf >::JRegressor ( const std::string & fileDescriptor,
const JTimeRange & T_ns )
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<JShower3EZ, JSimplex>::pdf_t.

Parameters
fileDescriptorPDF file descriptor
T_nstime range [ns]

Definition at line 477 of file JShower3EZRegressor.hh.

477 :
478 storage_type(fileDescriptor, T_ns),
479 npe(getNPE()),
480 estimator(new JMEstimatorNull())
481 {}
JTimeRange T_ns
Time window with respect to Cherenkov hypothesis [ns].

◆ JRegressor() [3/3]

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

Constructor.

Parameters
storagePDF storage

Definition at line 488 of file JShower3EZRegressor.hh.

488 :
489 npe(storage.getNPE()),
490 estimator(new JMEstimatorNull())
491 {
492 T_ns = storage.T_ns;
493 }

Member Function Documentation

◆ operator()() [1/2]

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

Fit function.

This method is used to determine the chi2 of given PMT with respect to shower hypothesis.

Parameters
showershower
pmtpmt
Returns
chi2

Definition at line 504 of file JShower3EZRegressor.hh.

505 {
506 using namespace JPP;
507 using namespace std;
508
509 JPosition3D D(pmt.getPosition());
510 JDirection3D U(pmt.getDirection());
511
512 D.sub(shower.getPosition());
513
514 const double x = D.getX();
515 const double y = D.getY();
516 const double d = D.getLength();
517 const double cd = D.getDot(shower.getDirection())/d; // cosine angle between shower direction and PMT position
518
519 U.rotate(JRotation3Z(-atan2(y,x))); // rotate PMT axis to x-z plane
520
521 const double theta = getPMTAngle(U.getTheta());
522 const double phi = getPMTAngle(U.getPhi());
523
524 JNPE_t::result_type H0 = getH0(pmt.getR()); // background hypothesis value for time integrated PDF.
525 JNPE_t::result_type H1 = getH1(d, cd, theta, phi, shower.getE()); // signal hypothesis value for time integrated PDF.
526
527 if (get_value(H1) >= Vmax_npe) {
528 H1 *= Vmax_npe / get_value(H1);
529 }
530
531 double signal_npe = get_value(H1);
532
533 H1 += H0; // now H1 is signal + background
534
535 double expectation = get_value(H1);
536
537 const bool hit = pmt.getN() != 0;
538 const double u = H1.getChi2(hit) - H0.getChi2(hit);
539
540 result_type result;
541
542 result.chi2 = estimator->getRho(u);
543
544 double energy_gradient = signal_npe/shower.getE(); // dP/dE
545 if(hit) energy_gradient *= -exp(-expectation)/(1-exp(-expectation)); //dchi2/d(H1), if !hit is 1
546
547 result.gradient = JShower3EZ(JPoint4D(JVector3D(0, // d(cos_th0)/d(x)
548 0, // d(cos_th0)/d(y)
549 0), // d(cos_th0)/d(z)
550 0.0), // d(cos_th0)/d(t)
551 JVersor3Z(x/d, // d(cos_th0)/d(dx)
552 y/d), // d(cos_th0)/d(dy)
553 energy_gradient); // d(chi2)/d(E)
554
555 result.gradient.mul(estimator->getPsi(u));
556 static_cast<JShower3Z&>(result.gradient).mul(H1.getDerivativeOfChi2(hit) - H0.getDerivativeOfChi2(hit)); // x d(chi2)/d(cos_th0)
557
558 return result;
559 }
Data structure for vertex fit.
Definition JPoint4D.hh:24
Data structure for fit of straight line in positive z-direction with energy.
Definition JShower3EZ.hh:30
Data structure for cascade in positive z-direction.
Definition JShower3Z.hh:36
double getPMTAngle(const double angle)
Constrain PMT angle to [0,pi].
static double Vmax_npe
Maximal integral of PDF [npe].
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 D, const double cd, const double theta, const double phi, const double E) const
Get signal hypothesis value for time integrated PDF.

◆ getH0()

JNPE_t::result_type JFIT::JRegressor< JShower3EZ, 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 567 of file JShower3EZRegressor.hh.

568 {
569 return JNPE_t::result_type(R_Hz * 1e-9 * T_ns.getLength(), 0.0);
570 }

◆ getH1()

JNPE_t::result_type JFIT::JRegressor< JShower3EZ, JGandalf >::getH1 ( const double D,
const double cd,
const double theta,
const double phi,
const double E ) const
inline

Get signal hypothesis value for time integrated PDF.

Parameters
DPMT distance from shower [m]
cdcosine angle between shower direction and PMT position
thetaPMT zenith angle [deg]
phiPMT azimuth angle [deg]
Eshower energy [GeV]
Returns
hypothesis value

Definition at line 582 of file JShower3EZRegressor.hh.

587 {
588 JNPE_t::result_type h1 = JMATH::zero;
589
590 for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
591
592 if (!npe[i].empty() && D <= npe[i].getXmax()) {
593
594 try {
595
596 JNPE_t::result_type y1 = E * npe[i](std::max(D, npe[i].getXmin()), cd, theta, phi);
597
598 if (get_value(y1) > 0.0) {
599 h1 += y1;
600 }
601
602 }
603 catch(JLANG::JException& error) {
604 ERROR(error << std::endl);
605 }
606 }
607 }
608
609 return h1;
610 }

◆ operator()() [2/2]

result_type JFIT::JAbstractRegressor< JShower3EZ , JGandalf >::operator() ( const JShower3EZ & 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.

◆ getNPE()

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

Get NPEs.

Returns
PDFs

Definition at line 424 of file JShower3EZRegressor.hh.

Member Data Documentation

◆ Vmax_npe

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

Maximal integral of PDF [npe].

Definition at line 613 of file JShower3EZRegressor.hh.

◆ npe

Definition at line 615 of file JShower3EZRegressor.hh.

◆ estimator

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

M-Estimator function.

Definition at line 617 of file JShower3EZRegressor.hh.

◆ NUMBER_OF_PDFS

const int JFIT::JRegressorStorage< JShower3EZ, JGandalf >::NUMBER_OF_PDFS = 2
staticinherited

Definition at line 365 of file JShower3EZRegressor.hh.

◆ pdf_t

const JPDFType_t JFIT::JRegressorStorage< JShower3EZ, JGandalf >::pdf_t
staticinherited
Initial value:
= {
DIRECT_LIGHT_FROM_EMSHOWER,
SCATTERED_LIGHT_FROM_EMSHOWER
}

PDF types.

Definition at line 432 of file JShower3EZRegressor.hh.

◆ T_ns

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

Time window with respect to Cherenkov hypothesis [ns].

Definition at line 433 of file JShower3EZRegressor.hh.

◆ _npe

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

PDFs.

Definition at line 436 of file JShower3EZRegressor.hh.


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