1 #ifndef __JFIT__JSHOWER3EZREGRESSOR__
2 #define __JFIT__JSHOWER3EZREGRESSOR__
74 double Tx = value.
getDX();
75 double Ty = value.
getDY();
76 double E = max(0.0,value.
getE());
77 const double u = hypot(Tx, Ty);
125 const JPDF_t::JSupervisor supervisor(
new JPDF_t::JDefaultResult(
JMATH::zero));
127 for (
int i = 0;
i != NUMBER_OF_PDFS; ++
i) {
133 const string file_name =
getFilename(fileDescriptor, pdf_t[
i]);
135 NOTICE(
"loading PDF from file " << file_name <<
"... " << flush);
137 pdf.
load(file_name.c_str());
151 for (
int i = 1;
i < NUMBER_OF_PDFS;
i += 2) {
153 npe[
i ].add(npe[
i-1]);
157 npe[
i-1].swap(buffer);
179 const double x =
D.getX();
180 const double y =
D.getY();
181 const double cd = z/
D.getLength();
183 U.rotate(JRotation3Z(-atan2(
y,
x)));
197 const bool hit = pmt.
getN() != 0;
200 return estimator->getRho(
u);
228 const double E)
const
232 for (
int i = 0;
i != NUMBER_OF_PDFS; ++
i) {
234 if (!npe[
i].empty() && D <= npe[
i].getXmax()) {
250 ERROR(error << std::endl);
262 static const int NUMBER_OF_PDFS = 2;
309 const JPDF_t::JSupervisor supervisor(
new JPDF_t::JDefaultResult(
JMATH::zero));
311 for (
int i = 0;
i != NUMBER_OF_PDFS; ++
i) {
317 const string file_name =
getFilename(fileDescriptor, pdf_t[
i]);
319 NOTICE(
"loading PDF from file " << file_name <<
"... " << flush);
321 pdf.
load(file_name.c_str());
335 for (
int i = 1;
i < NUMBER_OF_PDFS;
i += 2) {
337 npe[
i ].add(npe[
i-1]);
341 npe[
i-1].swap(buffer);
363 const double x =
D.getX();
364 const double y =
D.getY();
365 const double d =
D.getLength();
368 U.rotate(JRotation3Z(-atan2(
y,
x)));
386 const bool hit = pmt.
getN() != 0;
387 const double u = H1.getChi2(hit);
391 result.chi2 = estimator->getRho(
u);
393 double energy_gradient = signal_npe/shower.
getE();
394 if(hit) energy_gradient *= -
exp(-expectation)/(1-
exp(-expectation));
404 result.gradient.mul(estimator->getPsi(
u));
405 static_cast<JShower3Z&
>(
result.gradient).mul(H1.getDerivativeOfChi2(hit));
435 const double E)
const
439 for (
int i = 0;
i != NUMBER_OF_PDFS; ++
i) {
441 if (!npe[
i].empty() && D <= npe[
i].getXmax()) {
453 ERROR(error << std::endl);
465 static const int NUMBER_OF_PDFS = 2;
511 const JPDF_t::JSupervisor supervisor(
new JPDF_t::JDefaultResult(
JMATH::zero));
513 for (
int i = 0;
i != NUMBER_OF_PDFS; ++
i) {
519 const string file_name =
getFilename(fileDescriptor, pdf_t[
i]);
521 NOTICE(
"loading PDF from file " << file_name <<
"... " << flush);
523 pdf.
load(file_name.c_str());
537 for (
int i = 1;
i < NUMBER_OF_PDFS;
i += 2) {
539 npe[
i ].add(npe[
i-1]);
543 npe[
i-1].swap(buffer);
565 const double x =
D.getX();
566 const double y =
D.getY();
567 const double cd = z/
D.getLength();
569 U.rotate(JRotation3Z(-atan2(
y,
x)));
583 const bool hit = pmt.
getN() != 0;
586 return estimator->getRho(
u);
614 const double E)
const
618 for (
int i = 0;
i != NUMBER_OF_PDFS; ++
i) {
620 if (!npe[
i].empty() && D <= npe[
i].getXmax()) {
636 ERROR(error << std::endl);
660 const double x =
D.getX();
661 const double y =
D.getY();
662 const double cd = z/
D.getLength();
664 U.rotate(JRotation3Z(-atan2(
y,
x)));
680 static const int NUMBER_OF_PDFS = 2;
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.
Template definition of a data regressor of given model.
JPHYSICS::JPDFTable< JFunction1D_t, JPDFMaplist_t > JPDF_t
void load(const char *file_name)
Load from input file.
General purpose data regression method.
double getR() const
Get rate.
then usage $script< input file >[option[primary[working directory]]] nWhere option can be E
JRegressor(const std::string &fileDescriptor)
Parameterized constructor.
JTOOLS::JSplineFunction1S_t JFunction1D_t
JTOOLS::JMapList< JTOOLS::JPolint0FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalGridMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalGridMap > > > > JPDFMaplist_t
This include file containes various data structures that can be used as specific return types for the...
Auxiliary class for handling PMT geometry, rate and response.
Data structure for vertex fit.
scattered light from EM shower
const JDirection3D & getDirection() const
Get direction.
JTOOLS::JMapList< JTOOLS::JPolint0FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalGridMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalGridMap > > > > JPDFMaplist_t
JTOOLS::JSplineFunction1S_t JFunction1D_t
static const JZero zero
Function object to assign zero value.
JTOOLS::JMapList< JTOOLS::JPolint0FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalGridMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalGridMap > > > > JNPEMaplist_t
Definition of zero value for any class.
static const JFIT::JPDFType_t pdf_t[NUMBER_OF_PDFS]
double getDY() const
Get y direction.
Various implementations of functional maps.
double getPMTAngle(const double angle)
Constrain PMT angle to [0,pi].
JTOOLS::JMapList< JTOOLS::JPolint0FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalGridMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalGridMap > > > > JNPEMaplist_t
static JTimeRange T_ns
Time window with respect to Cherenkov hypothesis [ns].
Numbering scheme for PDF types.
JNPE_t::result_type getH0(const double R_Hz) const
Get background hypothesis value for time integrated PDF.
double operator()(const JShower3EZ &shower, const JPMTW0 &pmt) const
Fit function.
static const JPDFType_t pdf_t[NUMBER_OF_PDFS]
double getE() const
Get E.
Data structure for fit of straight line in positive z-direction with energy.
minimiser_type::result_type result_type
The template JSharedPointer class can be used to share a pointer to an object.
Data structure for vector in three dimensions.
multifunction_t::result_type result_type
JPHYSICS::JNPETable< double, double, JNPEMaplist_t > JNPE_t
static double Vmax_npe
Maximal integral of PDF [npe].
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.
double operator()(const JShower3EZ &shower, const JPMTW0 &pmt) const
Fit function.
direct light from EM shower
static const double PI
Mathematical constants.
JTOOLS::JMapList< JTOOLS::JPolint0FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalGridMap, JTOOLS::JMapList< JTOOLS::JPolint0FunctionalGridMap > > > > JPDFMaplist_t
const JPosition3D & getPosition() const
Get position.
JLANG::JSharedPointer< JMEstimator > estimator
M-Estimator function.
JNPE_t::result_type getH1(const JShower3EZ &shower, const JPMTW0 &pmt) const
Get signal 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.
General purpose messaging.
Data structure for cascade in positive z-direction.
const JVersor3Z & getDirection() const
Get direction.
static double Vmax_npe
Maximal integral of PDF [npe].
Fit method based on the Levenberg-Marquardt method.
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
JRegressor(const std::string &fileDescriptor)
Parameterized constructor.
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
virtual const char * what() const override
Get error message.
int getN() const
Get number of hits.
Auxiliary class to define a range between two values.
Simple fit method based on Powell's algorithm, see reference: Numerical Recipes in C++...
JPHYSICS::JPDFTable< JFunction1D_t, JPDFMaplist_t > JPDF_t
double getDX() const
Get x direction.
double getBy() const
Get bjorken y.
result_type operator()(const JShower3EZ &shower, const JPMTW0 &pmt) const
Fit function.
std::string getFilename(const std::string &file_name)
Get file name part, i.e. part after last JEEP::PATHNAME_SEPARATOR if any.
static double Vmax_npe
Maximal integral of PDF [npe].
JLANG::JSharedPointer< JMEstimator > estimator
M-Estimator function.
static JTimeRange T_ns
Time window with respect to Cherenkov hypothesis [ns].
JNPE_t::result_type getH0(const double R_Hz) const
Get background hypothesis value for time integrated PDF.
Data structure for position in three dimensions.
void model(JModel_t &value)
Auxiliary function to constrain model during fit.
JPHYSICS::JNPETable< double, double, JNPEMaplist_t > JNPE_t
JTOOLS::JSplineFunction1S_t JFunction1D_t
double getChi2(const double P)
Get chi2 corresponding to given probability.
Data structure for normalised vector in positive z-direction.
JPHYSICS::JPDFTable< JFunction1D_t, JPDFMaplist_t > JPDF_t
Abstract class for global fit method.
do echo Generating $dir eval D
static JTimeRange T_ns
Time window with respect to Cherenkov hypothesis [ns].
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable STRING $argv[2] set_array QUANTILES set_variable FORMULA *[0] exp(-0.5 *(x-[1])*(x-[1])/([2]*[2]))" set_variable MODULE `getModule -a $DETECTOR -L "$STRING 0"` source JAcousticsToolkit.sh typeset -A TRIPODS get_tripods $WORKDIR/tripod.txt TRIPODS XMEAN
JNPE_t::result_type getH0(const double R_Hz) const
Get background hypothesis value for time integrated PDF.
Maximum likelihood estimator (M-estimators).
JTOOLS::JMapList< JTOOLS::JPolint1FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint1FunctionalMapH, JTOOLS::JMapList< JTOOLS::JPolint1FunctionalGridMap, JTOOLS::JMapList< JTOOLS::JPolint1FunctionalGridMap > > > > JNPEMaplist_t
JTOOLS::JRange< double > JTimeRange
Type definition for time range (unit [s]).
JPHYSICS::JNPETable< double, double, JNPEMaplist_t > JNPE_t
JLANG::JSharedPointer< JMEstimator > estimator
M-Estimator function.
JRegressor(const std::string &fileDescriptor)
Parameterized constructor.