Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
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< JFirst_t, JSecond_t >

Public Types

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

Public Member Functions

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

Public Attributes

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

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 337 of file JResult.hh.

Member Typedef Documentation

◆ argument_type

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

Definition at line 341 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 347 of file JResult.hh.

347 :
348 f (JMATH::zero),
350 v (JMATH::zero),
351 V (JMATH::zero)
352 {}
static const JZero zero
Function object to assign zero value.
Definition JZero.hh:105
JResult_t f
function value
Definition JResult.hh:513
JResult_t V
integral <xmin,xmax>
Definition JResult.hh:516
JResult_t fp
first derivative
Definition JResult.hh:514
JResult_t v
integral <xmin,x]
Definition JResult.hh:515

◆ 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 363 of file JResult.hh.

366 :
367 f (f ),
368 fp(fp),
369 v (v),
370 V (V)
371 {}

◆ 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 occurring at the given moment x within the fixed range X.

Parameters
Rrate
xabscissa value
Xabscissa range

Definition at line 383 of file JResult.hh.

385 :
386 f (R),
388 v (R * (X.constrain(x) - X.getLowerLimit())),
389 V (R * (X.getUpperLimit() - X.getLowerLimit()))
390 {}

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 398 of file JResult.hh.

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

◆ 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 415 of file JResult.hh.

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

◆ 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 432 of file JResult.hh.

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

◆ 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 449 of file JResult.hh.

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

◆ 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 466 of file JResult.hh.

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

◆ 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 484 of file JResult.hh.

485 {
486 return exp(-v) * f / (1.0 - exp(-V));
487 }

◆ 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 496 of file JResult.hh.

497 {
498 return -log(getP());
499 }
double getP() const
Get probability of first hit.
Definition JResult.hh:484

◆ 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 507 of file JResult.hh.

508 {
509 return fp/f - f;
510 }

◆ mul() [2/2]

template<class JFirst_t , class JSecond_t >
JFirst_t & JMATH::JMath< JFirst_t, JSecond_t >::mul ( const JSecond_t & object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 354 of file JMath.hh.

355 {
356 return static_cast<JFirst_t&>(*this) = JFirst_t().mul(static_cast<const JFirst_t&>(*this), object);
357 }

Member Data Documentation

◆ f

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

function value

Definition at line 513 of file JResult.hh.

◆ fp

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

first derivative

Definition at line 514 of file JResult.hh.

◆ v

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

integral <xmin,x]

Definition at line 515 of file JResult.hh.

◆ V

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

integral <xmin,xmax>

Definition at line 516 of file JResult.hh.


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