1 #ifndef __JFIT__JSHOWER3EZREGRESSOR__
2 #define __JFIT__JSHOWER3EZREGRESSOR__
84 const JPDF_t::JSupervisor supervisor(
new JPDF_t::JDefaultResult(
JMATH::zero));
86 for (
int i = 0; i != NUMBER_OF_PDFS; ++i) {
92 const string file_name =
getFilename(fileDescriptor, pdf_t[i]);
94 NOTICE(
"loading PDF from file " << file_name <<
"... " << flush);
96 pdf.
load(file_name.c_str());
110 for (
int i = 1; i < NUMBER_OF_PDFS; i += 2) {
112 npe[ i ].add(npe[i-1]);
116 npe[i-1].swap(buffer);
139 const double z =
D.getDot(shower_dir);
140 const double x =
D.getX() - z * shower.
getDX();
141 const double y =
D.getY() - z * shower.
getDY();
142 const double cosDelta = z/
D.getLength();
144 U.rotate(JRotation3Z(-atan2(y,x)));
146 const double theta = U.getTheta();
147 const double phi = fabs(U.getPhi());
158 const bool hit = pmt.
getN() != 0;
161 return estimator->getRho(
u);
186 const double cosDelta,
189 const double E)
const
193 for (
int i = 0; i != NUMBER_OF_PDFS; ++i) {
195 if (!npe[i].empty() && D <= npe[i].getXmax()) {
207 ERROR(error << std::endl);
225 for (
int i = 0; i != NUMBER_OF_PDFS; ++i) {
227 if (!npe[i].empty() && npe[i].getXmax() > xmax) {
228 xmax = npe[i].getXmax();
239 static const int NUMBER_OF_PDFS = 2;
286 const JPDF_t::JSupervisor supervisor(
new JPDF_t::JDefaultResult(
JMATH::zero));
288 for (
int i = 0; i != NUMBER_OF_PDFS; ++i) {
294 const string file_name =
getFilename(fileDescriptor, pdf_t[i]);
296 NOTICE(
"loading PDF from file " << file_name <<
"... " << flush);
298 pdf.
load(file_name.c_str());
312 for (
int i = 1; i < NUMBER_OF_PDFS; i += 2) {
314 npe[ i ].add(npe[i-1]);
318 npe[i-1].swap(buffer);
342 const double z =
D.getDot(shower_dir);
343 const double x =
D.getX() - z * shower.
getDX();
344 const double y =
D.getY() - z * shower.
getDY();
345 const double R2 =
D.getLengthSquared() - z*z;
346 const double R = sqrt(R2);
347 const double d =
D.getLength();
348 const double cos_th0 = z/
d;
350 U.rotate(JRotation3Z(-atan2(y,x)));
352 const double theta = U.getTheta();
353 const double phi = fabs(U.getPhi());
364 const bool hit = pmt.
getN() != 0;
365 const double u = H1.getChi2(hit);
369 result.chi2 = estimator->getRho(
u);
379 result.gradient.mul(estimator->getPsi(
u));
380 result.gradient.mul(H1.getDerivativeOfChi2(hit));
407 const double cosDelta,
410 const double E)
const
414 for (
int i = 0; i != NUMBER_OF_PDFS; ++i) {
416 if (!npe[i].empty() && D <= npe[i].getXmax()) {
428 ERROR(error << std::endl);
446 for (
int i = 0; i != NUMBER_OF_PDFS; ++i) {
448 if (!npe[i].empty() && npe[i].getXmax() > xmax) {
449 xmax = npe[i].getXmax();
460 static const int NUMBER_OF_PDFS = 2;
Template definition of a data regressor of given model.
JPHYSICS::JPDFTable< JFunction1D_t, JPDFMaplist_t > JPDF_t
double getE() const
Get energy.
void load(const char *file_name)
Load from input file.
General purpose data regression method.
do echo Generating $dir eval D
double getR() const
Get rate.
JTOOLS::JSplineFunction1S_t JFunction1D_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
double getRmax() const
Get maximal road width of PDF.
then for HISTOGRAM in h0 h1
JNPE_t::result_type getH1(const double D, const double cosDelta, const double theta, const double phi, const double E) const
Get signal hypothesis value for time integrated PDF.
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]
JTOOLS::JMapList< JTOOLS::JPolint1FunctionalMapH, JTOOLS::JMapList< JTOOLS::JPolint1FunctionalMap, JTOOLS::JMapList< JTOOLS::JPolint1FunctionalGridMap, JTOOLS::JMapList< JTOOLS::JPolint1FunctionalGridMap > > > > JNPEMaplist_t
double getDY() const
Get y direction.
Various implementations of functional maps.
esac $JPP_DIR examples JDetector JTransitTime o $OUTPUT_FILE n N $NPE T $TTS_NS d $DEBUG for HISTOGRAM in tts tt2 pmt
Numbering scheme for PDF types.
double operator()(const JShower3EZ &shower, const JPMTW0 &pmt) const
Fit function.
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].
then print_variable DETECTOR INPUT_FILE INTERMEDIATE_FILE check_input_file $DETECTOR $INPUT_FILE check_output_file $INTERMEDIATE_FILE $OUTPUT_FILE JMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
direct light from EM shower
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.
then usage $script[distance] fi case set_variable R
General purpose messaging.
const JVersor3Z & getDirection() const
Get direction.
Fit method based on the Levenberg-Marquardt method.
JNPE_t::result_type getH1(const double D, const double cosDelta, const double theta, const double phi, const double E) const
Get signal hypothesis value for time integrated PDF.
JRegressor(const std::string &fileDescriptor)
Parameterized constructor.
int getN() const
Get number of hits.
Auxiliary class to define a range between two values.
double getRmax() const
Get maximal road width of PDF.
Simple fit method based on Powell's algorithm, see reference: Numerical Recipes in C++...
double getDX() const
Get x direction.
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.
virtual const char * what() const
Get error message.
Data structure for normalised vector in three dimensions.
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.
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.
Maximum likelihood estimator (M-estimators).
then usage $script[input file[working directory[option]]] nWhere option can be E
JPHYSICS::JNPETable< double, double, JNPEMaplist_t > JNPE_t
JRegressor(const std::string &fileDescriptor)
Parameterized constructor.