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

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

#include <JShowerBrightPointRegressor.hh>

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

Public Types

typedef JRegressorStorage< JPoint4E, JGandalfstorage_type
 
typedef JGandalf< JPoint4Eminimiser_type
 
typedef JRegressor< JPoint4E, JGandalfregressor_type
 
typedef minimiser_type::result_type result_type
 
typedef JTOOLS::JSplineFunction1S_t JFunction1D_t
 
typedef JTOOLS::JMAPLIST< JTOOLS::JPolint2FunctionalMap, JTOOLS::JPolint1FunctionalGridMap >::maplist JPDFMapList_t
 
typedef JPHYSICS::JPDFTable< JFunction1D_t, JPDFMapList_tJPDF_t
 
typedef std::array< JPDF_t, NUMBER_OF_PDFSJPDFs_t
 PDFs.
 

Public Member Functions

 JRegressor ()
 Default constructor.
 
 JRegressor (const std::string &fileDescriptor, const JTimeRange &T_ns, const double TTS, 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 JPoint4E &vx, const JHit_t &hit) 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 D, const double ct, const double t) const
 Get signal hypothesis value per 1 GeV for bright point emission PDF.
 
double getRmax () const
 Get maximal road width of PDF.
 
result_type operator() (const JPoint4E &value, T __begin, T __end)
 Global fit.
 
const JPDFs_tgetPDF () const
 Get PDFs.
 

Public Attributes

const JPDFs_tpdf
 PDF.
 
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

JPDFs_t _pdf
 PDFs.
 

Detailed Description

Regressor function object for JLine3Z fit using JGandalf minimiser.

Definition at line 161 of file JShowerBrightPointRegressor.hh.

Member Typedef Documentation

◆ storage_type

Definition at line 167 of file JShowerBrightPointRegressor.hh.

◆ minimiser_type

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

Definition at line 80 of file JRegressor.hh.

◆ regressor_type

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

Definition at line 61 of file JShowerBrightPointRegressor.hh.

◆ JPDFMapList_t

typedef JTOOLS::JMAPLIST<JTOOLS::JPolint2FunctionalMap,JTOOLS::JPolint1FunctionalGridMap>::maplist JFIT::JRegressorStorage< JPoint4E, JGandalf >::JPDFMapList_t
inherited

Definition at line 63 of file JShowerBrightPointRegressor.hh.

◆ JPDF_t

typedef JPHYSICS::JPDFTable<JFunction1D_t, JPDFMapList_t> JFIT::JRegressorStorage< JPoint4E, JGandalf >::JPDF_t
inherited

Definition at line 64 of file JShowerBrightPointRegressor.hh.

◆ JPDFs_t

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

PDFs.

Definition at line 68 of file JShowerBrightPointRegressor.hh.

Constructor & Destructor Documentation

◆ JRegressor() [1/3]

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

Default constructor.

Definition at line 172 of file JShowerBrightPointRegressor.hh.

172 :
173 storage_type(),
174 pdf(getPDF())
175 {}
JRegressorStorage< JPoint4E, JGandalf > storage_type

◆ JRegressor() [2/3]

JFIT::JRegressor< JPoint4E, JGandalf >::JRegressor ( const std::string & fileDescriptor,
const JTimeRange & T_ns,
const double TTS,
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<JPoint4E, JGandalf>::pdf_t.

The TTS corresponds to the additional time smearing applied to the PDFs.

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

Definition at line 191 of file JShowerBrightPointRegressor.hh.

195 :
196 storage_type(fileDescriptor, T_ns, TTS, numberOfPoints, epsilon),
197 pdf(getPDF())
198 {}
JTimeRange T_ns
Time window with respect to Cherenkov hypothesis [ns].

◆ JRegressor() [3/3]

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

Constructor.

Parameters
storagePDF storage

Definition at line 205 of file JShowerBrightPointRegressor.hh.

205 :
206 pdf(storage.getPDF())
207 {
208 T_ns = storage.T_ns;
209 }

Member Function Documentation

◆ operator()() [1/2]

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

Fit function.

This method is used to determine the chi2 and gradient of given hit with respect a bright point emitting isotropically

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

Definition at line 229 of file JShowerBrightPointRegressor.hh.

230 {
231 using namespace JPP;
232
233 JPosition3D D(hit.getPosition());
234 JDirection3D U(hit.getDirection());
235
236 D.sub(vx.getPosition());
237 double length = D.getLength();
238 double ct = U.getDot(D) / length;
239
240 if (ct > +1.0) { ct = +1.0; }
241 if (ct < -1.0) { ct = -1.0; }
242
243 const double t = vx.getT() + (length * getIndexOfRefraction() * getInverseSpeedOfLight());
244
245 const double dt = T_ns.constrain(hit.getT() - t);
246
247 JPDF_t::result_type H0 = getH0(hit.getR(), dt); // getH0 = Get background hypothesis value
248 JPDF_t::result_type H1 = getH1(length, ct, dt); // getH1 = Get signal hypothesis value / 1 GeV
249
250 if (get_value(H1) >= Vmax_npe) {
251 H1 *= Vmax_npe / get_value(H1);
252 }
253
254 double H1_value = get_value(H1);
255 double v_H1 = H1.v; //Integral from tmin to t of just H1
256 double V_H1 = H1.V; //Integral from tmin to tmax of just H1
257 H1 *= vx.getE();
258
259 JPDF_t::result_type HT = H1+H0; //now H1 is signal + background
260 double HT_value = get_value(HT);
261 result_type result;
262 result.chi2 = HT.getChi2() - H0.getChi2(); // Likelihood ratio
263
264 double exp_V_HT = exp(-HT.V); //V is the integral from tmin to tmax of EH1+H0
265
266 double energy_gradient = -1 / HT_value; //dPdE
267 energy_gradient *= (H1_value - HT_value * v_H1) * (1-exp_V_HT) - HT_value * exp_V_HT * V_H1; //Numerator
268 energy_gradient /= (1-exp_V_HT); // Denominator
269
270 /*
271 * Here it is evaluated: d(chi2)/d(ct) * d(ct)/d(x0,y0,z0,t0) + d(chi2)/dE
272 */
273 result.gradient = JPoint4E(JPoint4D(JVector3D(-getIndexOfRefraction() * D.getX() / length, // d(ct)/d(x0)
274 -getIndexOfRefraction() * D.getY() / length, // d(ct)/d(y0)
275 -getIndexOfRefraction() * D.getZ() / length), // d(ct)/d(z0)
276 getSpeedOfLight()), // d(ct)/d(t0)
277 energy_gradient); // d(chi2)/d(E)
278
279 static_cast<JPoint4D&>(result.gradient).mul(getInverseSpeedOfLight() * (HT.getDerivativeOfChi2() -
280 H0.getDerivativeOfChi2())); // x d(chi2)/d(ct1)
281
282 return result;
283
284 }
Data structure for vertex fit.
Definition JPoint4D.hh:24
Data structure for vertex fit.
Definition JPoint4E.hh:24
minimiser_type::result_type result_type
Definition JRegressor.hh:82
JPDF_t::result_type getH0(const double R_Hz, const double t1) const
Get background hypothesis value for time differentiated PDF.
static double Vmax_npe
Maximal integral of PDF [npe].
JPDF_t::result_type getH1(const double D, const double ct, const double t) const
Get signal hypothesis value per 1 GeV for bright point emission PDF.

◆ getH0()

JPDF_t::result_type JFIT::JRegressor< JPoint4E, 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 293 of file JShowerBrightPointRegressor.hh.

295 {
296 using namespace JPP;
297
298 return JPDF_t::result_type(R_Hz * 1e-9, t1, T_ns);
299 }

◆ getH1()

JPDF_t::result_type JFIT::JRegressor< JPoint4E, JGandalf >::getH1 ( const double D,
const double ct,
const double t ) const
inline

Get signal hypothesis value per 1 GeV for bright point emission PDF.

Parameters
Dhit distance from shower vertex [m]
ctcosine of the HIT angle
tarrival time of the light
Returns
hypothesis value / GeV

Definition at line 309 of file JShowerBrightPointRegressor.hh.

312 {
313 using namespace JPP;
314
315 JPDF_t::result_type h1 = JMATH::zero;
316
317 for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
318
319 if (!pdf[i].empty() && D <= pdf[i].getXmax()) {
320
321 try {
322
323 JPDF_t::result_type y1 = pdf[i](std::max(D, pdf[i].getXmin()), ct, t);
324
325 // safety measures
326
327 if (y1.f <= 0.0) {
328 y1.f = 0.0;
329 y1.fp = 0.0;
330 }
331
332 if (y1.v <= 0.0) {
333 y1.v = 0.0;
334 }
335
336 h1 += y1;
337 }
338 catch(JLANG::JException& error) {
339 ERROR(error << std::endl);
340 }
341 }
342 }
343
344 return h1;
345 }

◆ getRmax()

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

Get maximal road width of PDF.

Returns
road width [m]

Definition at line 352 of file JShowerBrightPointRegressor.hh.

353 {
354 using namespace JPP;
355
356 double xmax = 0.0;
357
358 for (int i = 0; i != NUMBER_OF_PDFS; ++i) {
359
360 if (!pdf[i].empty() && pdf[i].getXmax() > xmax) {
361 xmax = pdf[i].getXmax();
362 }
363
364 }
365
366 return xmax;
367 }

◆ operator()() [2/2]

result_type JFIT::JAbstractRegressor< JPoint4E , JGandalf >::operator() ( const JPoint4E & 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< JPoint4E, JGandalf >::getPDF ( ) const
inlineinherited

Get PDFs.

Returns
PDFs

Definition at line 132 of file JShowerBrightPointRegressor.hh.

Member Data Documentation

◆ Vmax_npe

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

Maximal integral of PDF [npe].

Default values.

Definition at line 369 of file JShowerBrightPointRegressor.hh.

◆ pdf

PDF.

Definition at line 371 of file JShowerBrightPointRegressor.hh.

◆ NUMBER_OF_PDFS

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

Definition at line 66 of file JShowerBrightPointRegressor.hh.

◆ pdf_t

const JPDFType_t JFIT::JRegressorStorage< JPoint4E, JGandalf >::pdf_t
staticinherited
Initial value:
= {
DIRECT_LIGHT_FROM_BRIGHT_POINT,
SCATTERED_LIGHT_FROM_BRIGHT_POINT
}

PDF types.

Definition at line 141 of file JShowerBrightPointRegressor.hh.

◆ T_ns

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

Time window with respect to Cherenkov hypothesis [ns].

Definition at line 142 of file JShowerBrightPointRegressor.hh.

◆ _pdf

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

PDFs.

Definition at line 145 of file JShowerBrightPointRegressor.hh.


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