Jpp  15.0.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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< JFirst_t, JSecond_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...
 
JFirst_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 337 of file JResult.hh.

Member Typedef Documentation

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

Definition at line 341 of file JResult.hh.

Constructor & Destructor Documentation

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),
349  fp(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 fp
first derivative
Definition: JResult.hh:514
JResult_t V
integral &lt;xmin,xmax&gt;
Definition: JResult.hh:516
JResult_t f
function value
Definition: JResult.hh:513
JResult_t v
integral &lt;xmin,x]
Definition: JResult.hh:515
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  {}
JResult_t fp
first derivative
Definition: JResult.hh:514
JResult_t V
integral &lt;xmin,xmax&gt;
Definition: JResult.hh:516
JResult_t f
function value
Definition: JResult.hh:513
JResult_t v
integral &lt;xmin,x]
Definition: JResult.hh:515
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 383 of file JResult.hh.

385  :
386  f (R),
387  fp(JMATH::zero),
388  v (R * (X.constrain(x) - X.getLowerLimit())),
389  V (R * (X.getUpperLimit() - X.getLowerLimit()))
390  {}
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
static const JZero zero
Function object to assign zero value.
Definition: JZero.hh:105
JResult_t fp
first derivative
Definition: JResult.hh:514
JResult_t V
integral &lt;xmin,xmax&gt;
Definition: JResult.hh:516
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
JResult_t f
function value
Definition: JResult.hh:513
T constrain(argument_type x) const
Constrain value to range.
Definition: JRange.hh:350
JResult_t v
integral &lt;xmin,x]
Definition: JResult.hh:515
then usage $script[distance] fi case set_variable R
Definition: JDrawLED.sh:43

Member Function Documentation

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  }
JResult_t fp
first derivative
Definition: JResult.hh:514
JResult_t V
integral &lt;xmin,xmax&gt;
Definition: JResult.hh:516
JResult_t f
function value
Definition: JResult.hh:513
JResult_t v
integral &lt;xmin,x]
Definition: JResult.hh:515
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  }
JResult_t fp
first derivative
Definition: JResult.hh:514
JResult_t V
integral &lt;xmin,xmax&gt;
Definition: JResult.hh:516
JResult_t f
function value
Definition: JResult.hh:513
JResult_t v
integral &lt;xmin,x]
Definition: JResult.hh:515
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  }
JResult_t fp
first derivative
Definition: JResult.hh:514
JResult_t V
integral &lt;xmin,xmax&gt;
Definition: JResult.hh:516
JResult_t f
function value
Definition: JResult.hh:513
JResult_t v
integral &lt;xmin,x]
Definition: JResult.hh:515
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  }
JResult_t fp
first derivative
Definition: JResult.hh:514
JResult_t V
integral &lt;xmin,xmax&gt;
Definition: JResult.hh:516
JResult_t f
function value
Definition: JResult.hh:513
JResult_t v
integral &lt;xmin,x]
Definition: JResult.hh:515
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  }
JResult_t fp
first derivative
Definition: JResult.hh:514
JResult_t V
integral &lt;xmin,xmax&gt;
Definition: JResult.hh:516
JResult_t f
function value
Definition: JResult.hh:513
JResult_t v
integral &lt;xmin,x]
Definition: JResult.hh:515
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  }
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"` typeset -Z 4 STRING JOpera1D -f hydrophone.root
JResult_t V
integral &lt;xmin,xmax&gt;
Definition: JResult.hh:516
JResult_t f
function value
Definition: JResult.hh:513
JResult_t v
integral &lt;xmin,x]
Definition: JResult.hh:515
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
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  }
JResult_t fp
first derivative
Definition: JResult.hh:514
JResult_t f
function value
Definition: JResult.hh:513
template<class JFirst_t, class JSecond_t = JNullType>
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 357 of file JMath.hh.

358  {
359  return static_cast<JFirst_t&>(*this) = JCalculator<JFirst_t>::calculator.mul(static_cast<const JFirst_t&>(*this), object);
360  }
Auxiliary class for arithmetic operations on objects.
Definition: JCalculator.hh:18

Member Data Documentation

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

function value

Definition at line 513 of file JResult.hh.

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

first derivative

Definition at line 514 of file JResult.hh.

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

integral <xmin,x]

Definition at line 515 of file JResult.hh.

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: