Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Public Attributes | List of all members
JTOOLS::JResultDerivative< JResult_t > Struct Template Reference

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

#include <JResult.hh>

Inheritance diagram for JTOOLS::JResultDerivative< JResult_t >:
JMATH::JMath< JResultDerivative< JResult_t > > JTOOLS::JResultHesse< JResult_t >

Public Types

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

Public Member Functions

 JResultDerivative ()
 Default constructor. More...
 
 JResultDerivative (argument_type f, argument_type fp)
 Constructor. More...
 
JResultDerivativenegate ()
 Prefix unary minus for function value of PDF. More...
 
JResultDerivativeadd (const JResultDerivative &value)
 Addition operator for function value of PDF. More...
 
JResultDerivativesub (const JResultDerivative &value)
 Subtraction operator for function value of PDF. More...
 
JResultDerivativemul (const double value)
 Multiplication operator for function value of PDF. More...
 
JResultDerivativediv (const double value)
 Division operator for function value of PDF. More...
 
double getP (const bool hit) const
 Get probability. More...
 
double getChi2 (const bool hit) const
 Get chi2. More...
 
double getDerivativeOfChi2 (const bool hit) const
 Get derivative of chi2. More...
 
JResultDerivative< JResult_t > & mul (const JNullType &object)
 Multiply with object. More...
 

Public Attributes

JResult_t f
 function value More...
 
JResult_t fp
 first derivative More...
 

Detailed Description

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

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

This data structure contains the following data mambers:

   JResultDerivative::f   = function value;
   JResultDerivative::fp  = first  derivative;

This class implements the JMATH::JMath interface.

Definition at line 41 of file JResult.hh.

Member Typedef Documentation

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

Definition at line 45 of file JResult.hh.

Constructor & Destructor Documentation

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

Default constructor.

Definition at line 51 of file JResult.hh.

51  :
52  f (JMATH::zero),
53  fp (JMATH::zero)
54  {}
static const JZero zero
Function object to assign zero value.
Definition: JZero.hh:105
JResult_t fp
first derivative
Definition: JResult.hh:193
JResult_t f
function value
Definition: JResult.hh:192
template<class JResult_t>
JTOOLS::JResultDerivative< JResult_t >::JResultDerivative ( argument_type  f,
argument_type  fp 
)
inline

Constructor.

Parameters
ffunction value
fpfirst derivative

Definition at line 63 of file JResult.hh.

64  :
65  f (f ),
66  fp (fp)
67  {}
JResult_t fp
first derivative
Definition: JResult.hh:193
JResult_t f
function value
Definition: JResult.hh:192

Member Function Documentation

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

Prefix unary minus for function value of PDF.

Returns
function value of PDF

Definition at line 75 of file JResult.hh.

76  {
77  f = -f;
78  fp = -fp;
79 
80  return *this;
81  }
JResult_t fp
first derivative
Definition: JResult.hh:193
JResult_t f
function value
Definition: JResult.hh:192
template<class JResult_t>
JResultDerivative& JTOOLS::JResultDerivative< JResult_t >::add ( const JResultDerivative< JResult_t > &  value)
inline

Addition operator for function value of PDF.

Parameters
valuefunction value of PDF
Returns
function value of PDF

Definition at line 90 of file JResult.hh.

91  {
92  f += value.f;
93  fp += value.fp;
94 
95  return *this;
96  }
JResult_t fp
first derivative
Definition: JResult.hh:193
JResult_t f
function value
Definition: JResult.hh:192
template<class JResult_t>
JResultDerivative& JTOOLS::JResultDerivative< JResult_t >::sub ( const JResultDerivative< JResult_t > &  value)
inline

Subtraction operator for function value of PDF.

Parameters
valuefunction value of PDF
Returns
function value of PDF

Definition at line 105 of file JResult.hh.

106  {
107  f -= value.f;
108  fp -= value.fp;
109 
110  return *this;
111  }
JResult_t fp
first derivative
Definition: JResult.hh:193
JResult_t f
function value
Definition: JResult.hh:192
template<class JResult_t>
JResultDerivative& JTOOLS::JResultDerivative< 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 120 of file JResult.hh.

121  {
122  f *= value;
123  fp *= value;
124 
125  return *this;
126  }
JResult_t fp
first derivative
Definition: JResult.hh:193
JResult_t f
function value
Definition: JResult.hh:192
template<class JResult_t>
JResultDerivative& JTOOLS::JResultDerivative< JResult_t >::div ( const double  value)
inline

Division operator for function value of PDF.

Parameters
valuemultiplication factor
Returns
function value of PDF

Definition at line 135 of file JResult.hh.

136  {
137  f /= value;
138  fp /= value;
139 
140  return *this;
141  }
JResult_t fp
first derivative
Definition: JResult.hh:193
JResult_t f
function value
Definition: JResult.hh:192
template<class JResult_t>
double JTOOLS::JResultDerivative< JResult_t >::getP ( const bool  hit) const
inline

Get probability.


If the given hit is false (true), the return value corresponds to the Poisson probability that zero (one or more) hits occur for the given expectation value JResultDerivative::f.

Parameters
hithit (or not)
Returns
probability

Definition at line 152 of file JResult.hh.

153  {
154  if (!hit)
155  return exp(-f); // probability of 0 hits
156  else
157  return 1.0 - getP(false); // probability of 1 or more hits
158  }
JResult_t f
function value
Definition: JResult.hh:192
double getP(const bool hit) const
Get probability.
Definition: JResult.hh:152
then set_variable FORMULA *[0] exp(-0.5 *(x-[1])*(x-[1])/([2]*[2]))" set_variable OUTPUT_FILE histogram.root JHistogram1D -o $WORKDIR/$OUTPUT_FILE -F "$FORMULA" -
template<class JResult_t>
double JTOOLS::JResultDerivative< JResult_t >::getChi2 ( const bool  hit) const
inline

Get chi2.

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

Parameters
hithit (or not)
Returns
chi2

Definition at line 168 of file JResult.hh.

169  {
170  if (!hit)
171  return f; // = -log(getP(false))
172  else
173  return -log(getP(true));
174  }
JResult_t f
function value
Definition: JResult.hh:192
double getP(const bool hit) const
Get probability.
Definition: JResult.hh:152
template<class JResult_t>
double JTOOLS::JResultDerivative< JResult_t >::getDerivativeOfChi2 ( const bool  hit) const
inline

Get derivative of chi2.

Parameters
hithit (or not)
Returns
derivative

Definition at line 183 of file JResult.hh.

184  {
185  if (!hit)
186  return fp;
187  else
188  return -fp * getP(false) / getP(true);
189  }
JResult_t fp
first derivative
Definition: JResult.hh:193
double getP(const bool hit) const
Get probability.
Definition: JResult.hh:152
JResultDerivative< JResult_t > & JMATH::JMath< JResultDerivative< JResult_t > , JNullType >::mul ( const JNullType 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  }
Auxiliary class for arithmetic operations on objects.
Definition: JCalculator.hh:18

Member Data Documentation

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

function value

Definition at line 192 of file JResult.hh.

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

first derivative

Definition at line 193 of file JResult.hh.


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