Jpp
Public Types | Public Member Functions | Public Attributes | List of all members
JTOOLS::JResultPDF< JResult_t > Struct Template Reference

Data structure for result including value, first derivative and integrals of function. More...

#include <JResult.hh>

Inheritance diagram for JTOOLS::JResultPDF< JResult_t >:
JMATH::JMath< JResultPDF< JResult_t > >

Public Types

typedef JLANG::JClass< JResult_t >::argument_type argument_type
 

Public Member Functions

 JResultPDF ()
 Default constructor. More...
 
 JResultPDF (argument_type f, argument_type fp, argument_type v, argument_type V)
 Constructor. More...
 
 JResultPDF (argument_type R, argument_type x, const JRange< JResult_t > &X)
 Constructor. More...
 
JResultPDFnegate ()
 Prefix unary minus for function value of PDF. More...
 
JResultPDFadd (const JResultPDF &value)
 Addition operator for function value of PDF. More...
 
JResultPDFsub (const JResultPDF &value)
 Subtraction operator for function value of PDF. More...
 
JResultPDFmul (const double value)
 Multiplication operator for function value of PDF. More...
 
JResultPDFdiv (const double value)
 Division operator for function value of PDF. More...
 
double getP () const
 Get probability of first hit. More...
 
double getChi2 () const
 Get chi2 of first hit. More...
 
double getDerivativeOfChi2 () const
 Get derivative of chi2 of first hit. More...
 
JResultPDF< JResult_t > & mul (const JSecond_t &object)
 Multiply with object. More...
 

Public Attributes

JResult_t f
 function value More...
 
JResult_t fp
 first derivative More...
 
JResult_t v
 integral <xmin,x] More...
 
JResult_t V
 integral <xmin,xmax> More...
 

Detailed Description

template<class JResult_t>
struct JTOOLS::JResultPDF< JResult_t >

Data structure for result including value, first derivative and integrals of function.

This data structure contains the following data mambers:

   JResultPDF::f   = function value;
   JResultPDF::fp  = first derivative;
   JResultPDF::v   = partial  integral;
   JResultPDF::V   = complete integral.

The partial and complete integrals are used to evaluate the probability of the first hit.

This class implements the JMATH::JMath interface.

Definition at line 335 of file JResult.hh.

Member Typedef Documentation

◆ argument_type

template<class JResult_t>
typedef JLANG::JClass<JResult_t>::argument_type JTOOLS::JResultPDF< JResult_t >::argument_type

Definition at line 339 of file JResult.hh.

Constructor & Destructor Documentation

◆ JResultPDF() [1/3]

template<class JResult_t>
JTOOLS::JResultPDF< JResult_t >::JResultPDF ( )
inline

Default constructor.

Definition at line 345 of file JResult.hh.

345  :
346  f (JMATH::zero),
347  fp(JMATH::zero),
348  v (JMATH::zero),
349  V (JMATH::zero)
350  {}

◆ JResultPDF() [2/3]

template<class JResult_t>
JTOOLS::JResultPDF< JResult_t >::JResultPDF ( argument_type  f,
argument_type  fp,
argument_type  v,
argument_type  V 
)
inline

Constructor.

Parameters
ffunction value
fpfirst derivative
vintegral <xmin,x]
Vintegral <xmin,xmax>

Definition at line 361 of file JResult.hh.

364  :
365  f (f ),
366  fp(fp),
367  v (v),
368  V (V)
369  {}

◆ JResultPDF() [3/3]

template<class JResult_t>
JTOOLS::JResultPDF< JResult_t >::JResultPDF ( argument_type  R,
argument_type  x,
const JRange< JResult_t > &  X 
)
inline

Constructor.


This constructor refers to the result of a signal with a constant rate R to produce an event occuring at the given moment x within the fixed range X.

Parameters
Rrate
xabscissa value
Xabscissa range

Definition at line 381 of file JResult.hh.

383  :
384  f (R),
385  fp(JMATH::zero),
386  v (R * (X.constrain(x) - X.getLowerLimit())),
387  V (R * (X.getUpperLimit() - X.getLowerLimit()))
388  {}

Member Function Documentation

◆ negate()

template<class JResult_t>
JResultPDF& JTOOLS::JResultPDF< JResult_t >::negate ( )
inline

Prefix unary minus for function value of PDF.

Returns
function value of PDF

Definition at line 396 of file JResult.hh.

397  {
398  f = -f;
399  fp = -fp;
400  v = -v;
401  V = -V;
402 
403  return *this;
404  }

◆ add()

template<class JResult_t>
JResultPDF& JTOOLS::JResultPDF< JResult_t >::add ( const JResultPDF< JResult_t > &  value)
inline

Addition operator for function value of PDF.

Parameters
valuefunction value of PDF
Returns
function value of PDF

Definition at line 413 of file JResult.hh.

414  {
415  f += value.f;
416  fp += value.fp;
417  v += value.v;
418  V += value.V;
419 
420  return *this;
421  }

◆ sub()

template<class JResult_t>
JResultPDF& JTOOLS::JResultPDF< JResult_t >::sub ( const JResultPDF< JResult_t > &  value)
inline

Subtraction operator for function value of PDF.

Parameters
valuefunction value of PDF
Returns
function value of PDF

Definition at line 430 of file JResult.hh.

431  {
432  f -= value.f;
433  fp -= value.fp;
434  v -= value.v;
435  V -= value.V;
436 
437  return *this;
438  }

◆ mul() [1/2]

template<class JResult_t>
JResultPDF& JTOOLS::JResultPDF< JResult_t >::mul ( const double  value)
inline

Multiplication operator for function value of PDF.

Parameters
valuemultiplication factor
Returns
function value of PDF

Definition at line 447 of file JResult.hh.

448  {
449  f *= value;
450  fp *= value;
451  v *= value;
452  V *= value;
453 
454  return *this;
455  }

◆ div()

template<class JResult_t>
JResultPDF& JTOOLS::JResultPDF< JResult_t >::div ( const double  value)
inline

Division operator for function value of PDF.

Parameters
valuedivision factor
Returns
function value of PDF

Definition at line 464 of file JResult.hh.

465  {
466  f /= value;
467  fp /= value;
468  v /= value;
469  V /= value;
470 
471  return *this;
472  }

◆ getP()

template<class JResult_t>
double JTOOLS::JResultPDF< JResult_t >::getP ( ) const
inline

Get probability of first hit.


The probability is defined at the moment JResultPDF::f and JResultPDF::v have been evaluated and it is normalised to the total interval corresponding to JResultPDF::V.

Returns
probability

Definition at line 482 of file JResult.hh.

483  {
484  return exp(-v) * f / (1.0 - exp(-V));
485  }

◆ getChi2()

template<class JResult_t>
double JTOOLS::JResultPDF< JResult_t >::getChi2 ( ) const
inline

Get chi2 of first hit.


The chi2 corresponds to -log(P), where P is the probability JResultPDF::f.

Returns
chi2

Definition at line 494 of file JResult.hh.

495  {
496  return -log(getP());
497  }

◆ getDerivativeOfChi2()

template<class JResult_t>
double JTOOLS::JResultPDF< JResult_t >::getDerivativeOfChi2 ( ) const
inline

Get derivative of chi2 of first hit.

Returns
derivative

Definition at line 505 of file JResult.hh.

506  {
507  return fp/f - f;
508  }

◆ mul() [2/2]

JResultPDF< JResult_t > & JMATH::JMath< JResultPDF< JResult_t > , JSecond_t >::mul ( const JSecond_t &  object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 273 of file JMath.hh.

274  {
275  return static_cast<JFirst_t&>(*this) = JCalculator<JFirst_t>::calculator.mul(static_cast<const JFirst_t&>(*this), object);
276  }

Member Data Documentation

◆ f

template<class JResult_t>
JResult_t JTOOLS::JResultPDF< JResult_t >::f

function value

Definition at line 511 of file JResult.hh.

◆ fp

template<class JResult_t>
JResult_t JTOOLS::JResultPDF< JResult_t >::fp

first derivative

Definition at line 512 of file JResult.hh.

◆ v

template<class JResult_t>
JResult_t JTOOLS::JResultPDF< JResult_t >::v

integral <xmin,x]

Definition at line 513 of file JResult.hh.

◆ V

template<class JResult_t>
JResult_t JTOOLS::JResultPDF< JResult_t >::V

integral <xmin,xmax>

Definition at line 514 of file JResult.hh.


The documentation for this struct was generated from the following file:
JTOOLS::JRange::getLowerLimit
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:215
JTOOLS::JRange::getUpperLimit
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:226
JTOOLS::JResultPDF::f
JResult_t f
function value
Definition: JResult.hh:511
JTOOLS::JResultPDF::getP
double getP() const
Get probability of first hit.
Definition: JResult.hh:482
JTOOLS::JRange::constrain
T constrain(argument_type x) const
Constrain value to range.
Definition: JRange.hh:340
JTOOLS::JResultPDF::V
JResult_t V
integral <xmin,xmax>
Definition: JResult.hh:514
JMATH::JCalculator
Auxiliary class for arithmetic operations on objects.
Definition: JCalculator.hh:18
JMATH::zero
static const JZero zero
Function object to assign zero value.
Definition: JZero.hh:94
JTOOLS::JResultPDF::fp
JResult_t fp
first derivative
Definition: JResult.hh:512
JTOOLS::JResultPDF::v
JResult_t v
integral <xmin,x]
Definition: JResult.hh:513