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, JAbstractMinimiser > Struct Reference

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

#include <JShower3EZRegressor.hh>

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

Public Types

typedef JRegressorStorage< JShower3EZ, JAbstractMinimiserstorage_type
 
typedef JAbstractMinimiser< JShower3EZminimiser_type
 
typedef JRegressor< JShower3EZ, JAbstractMinimiserregressor_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::JPolint0FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalGridMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalGridMap > > > > 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.
 
double 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.
 
JNPE_t::result_type getH1 (const JShower3EZ &shower, const JPMTW0 &pmt) 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 729 of file JShower3EZRegressor.hh.

Member Typedef Documentation

◆ storage_type

Definition at line 735 of file JShower3EZRegressor.hh.

◆ minimiser_type

Definition at line 80 of file JRegressor.hh.

◆ regressor_type

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, JAbstractMinimiser >::JFunction1D_t
inherited

Definition at line 628 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, JAbstractMinimiser >::JPDFMaplist_t
inherited

Definition at line 632 of file JShower3EZRegressor.hh.

◆ JPDF_t

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

Definition at line 633 of file JShower3EZRegressor.hh.

◆ JNPEMaplist_t

typedef JTOOLS::JMapList<JTOOLS::JPolint0FunctionalMap, JTOOLS::JMapList<JTOOLS::JPolint0FunctionalMap, JTOOLS::JMapList<JTOOLS::JPolint0FunctionalGridMap, JTOOLS::JMapList<JTOOLS::JPolint0FunctionalGridMap> > > > JFIT::JRegressorStorage< JShower3EZ, JAbstractMinimiser >::JNPEMaplist_t
inherited

Definition at line 638 of file JShower3EZRegressor.hh.

◆ JNPE_t

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

Definition at line 639 of file JShower3EZRegressor.hh.

◆ JNPEs_t

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

NPEs.

Definition at line 644 of file JShower3EZRegressor.hh.

Constructor & Destructor Documentation

◆ JRegressor() [1/3]

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

Default constructor.

Definition at line 740 of file JShower3EZRegressor.hh.

740 :
741 storage_type(),
742 npe(getNPE()),
743 estimator()
744 {}
JRegressorStorage< JShower3EZ, JAbstractMinimiser > storage_type
std::shared_ptr< JMEstimator > estimator
M-Estimator function

◆ JRegressor() [2/3]

JFIT::JRegressor< JShower3EZ, JAbstractMinimiser >::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 756 of file JShower3EZRegressor.hh.

756 :
757 storage_type(fileDescriptor, T_ns),
758 npe(getNPE()),
759 estimator(new JMEstimatorNull())
760 {}
JTimeRange T_ns
Time window with respect to Cherenkov hypothesis [ns].

◆ JRegressor() [3/3]

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

Constructor.

Parameters
storagePDF storage

Definition at line 767 of file JShower3EZRegressor.hh.

767 :
768 npe(storage.getNPE()),
769 estimator(new JMEstimatorNull())
770 {
771 T_ns = storage.T_ns;
772 }

Member Function Documentation

◆ operator()() [1/2]

double JFIT::JRegressor< JShower3EZ, JAbstractMinimiser >::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 782 of file JShower3EZRegressor.hh.

783 {
784 using namespace JPP;
785
786 JPosition3D D(pmt.getPosition());
787 JDirection3D U(pmt.getDirection());
788
789 D.sub(shower.getPosition());
790
791 const double z = D.getDot(shower.getDirection());
792 const double x = D.getX();
793 const double y = D.getY();
794 const double cd = z/D.getLength(); // cosine angle between shower direction and PMT position
795
796 U.rotate(JRotation3Z(-atan2(y,x))); // rotate PMT axis to x-z plane
797
798 const double theta = getPMTAngle(U.getTheta());
799 const double phi = getPMTAngle(U.getPhi());
800
801 JNPE_t::result_type H0 = getH0(pmt.getR()); // background hypothesis value for time integrated PDF.
802 JNPE_t::result_type H1 = getH1(D.getLength(), cd, theta, phi, shower.getE()); // signal hypothesis value for time integrated PDF.
803
804 if (get_value(H1) >= Vmax_npe) {
805 H1 *= Vmax_npe / get_value(H1);
806 }
807
808 H1 += H0; // now H1 is signal + background
809
810 const bool hit = pmt.getN() != 0;
811 const double u = getChi2(get_value(H1), hit) - getChi2(get_value(H0), hit); // -log likelihood ratio
812
813 return estimator->getRho(u);
814 }
double getPMTAngle(const double angle)
Constrain PMT angle to [0,pi].
double getChi2(const double P)
Get chi2 corresponding to given probability.
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.
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.

◆ getH0()

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

823 {
824 return JNPE_t::result_type(R_Hz * 1e-9 * T_ns.getLength());
825 }

◆ getH1() [1/2]

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

842 {
843 JNPE_t::result_type h1 = JMATH::zero;
844
845 for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
846
847 if (!npe[i].empty() && D <= npe[i].getXmax()) {
848
849 try {
850
851 JNPE_t::result_type y1 = E * npe[i](std::max(D, npe[i].getXmin()), cd, theta, phi);
852
853 // safety measure
854
855 if(y1 < 0){
856 y1 = 0;
857 }
858
859 h1 += y1;
860
861 }
862 catch(JLANG::JException& error) {
863 ERROR(error << std::endl);
864 }
865 }
866 }
867
868 return h1;
869 }

◆ getH1() [2/2]

JNPE_t::result_type JFIT::JRegressor< JShower3EZ, JAbstractMinimiser >::getH1 ( const JShower3EZ & shower,
const JPMTW0 & pmt ) const
inline

Get signal hypothesis value for time integrated PDF.

Parameters
showershower
pmtpmt
Returns
hypothesis value

Definition at line 878 of file JShower3EZRegressor.hh.

879 {
880 using namespace JPP;
881
882 JPosition3D D(pmt.getPosition());
883 JDirection3D U(pmt.getDirection());
884
885
886 const double z = D.getDot(shower.getDirection());
887 const double x = D.getX();
888 const double y = D.getY();
889 const double cd = z/D.getLength(); // cosine angle between shower direction and PMT position
890
891 U.rotate(JRotation3Z(-atan2(y,x))); // rotate PMT axis to x-z plane
892
893 const double theta = getPMTAngle(U.getTheta());
894 const double phi = getPMTAngle(U.getPhi());
895
896 JNPE_t::result_type H1 = getH1(D.getLength(), cd, theta, phi, 1.0); // signal hypothesis value for time integrated PDF. E=1 because it is linear with E.
897
898 if (get_value(H1) >= Vmax_npe) {
899 H1 *= Vmax_npe / get_value(H1);
900 }
901
902 return H1;
903 }

◆ operator()() [2/2]

result_type JFIT::JAbstractRegressor< JShower3EZ , JAbstractMinimiser >::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, JAbstractMinimiser >::getNPE ( ) const
inlineinherited

Get NPEs.

Returns
PDFs

Definition at line 702 of file JShower3EZRegressor.hh.

Member Data Documentation

◆ Vmax_npe

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

Maximal integral of PDF [npe].

Definition at line 904 of file JShower3EZRegressor.hh.

◆ npe

Definition at line 906 of file JShower3EZRegressor.hh.

◆ estimator

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

M-Estimator function

Definition at line 908 of file JShower3EZRegressor.hh.

◆ NUMBER_OF_PDFS

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

Definition at line 642 of file JShower3EZRegressor.hh.

◆ pdf_t

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

PDF types.

Definition at line 710 of file JShower3EZRegressor.hh.

◆ T_ns

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

Time window with respect to Cherenkov hypothesis [ns].

Definition at line 711 of file JShower3EZRegressor.hh.

◆ _npe

PDFs.

Definition at line 714 of file JShower3EZRegressor.hh.


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