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::JResultHesse< JResult_t > Struct Template Reference

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

#include <JResult.hh>

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

Public Types

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

Public Member Functions

 JResultHesse ()
 Default constructor. More...
 
 JResultHesse (argument_type __f, argument_type __fp)
 Constructor. More...
 
JResultHessenegate ()
 Prefix unary minus for function value of PDF. More...
 
JResultHesseadd (const JResultHesse &value)
 Addition operator for function value of PDF. More...
 
JResultHessesub (const JResultHesse &value)
 Subtraction operator for function value of PDF. More...
 
JResultHessemul (const double value)
 Multiplication operator for function value of PDF. More...
 
JResultHessediv (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...
 
JResultHesse< 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::JResultHesse< JResult_t >

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

This data structure contains the following data mambers:

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

This class implements the JMATH::JMath interface.

Definition at line 40 of file JResult.hh.

Member Typedef Documentation

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

Definition at line 44 of file JResult.hh.

Constructor & Destructor Documentation

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

Default constructor.

Definition at line 50 of file JResult.hh.

50  :
51  f (JMATH::zero),
53  {}
JResult_t f
function value
Definition: JResult.hh:191
static const JZero zero
Function object to assign zero value.
Definition: JZero.hh:94
JResult_t fp
first derivative
Definition: JResult.hh:192
template<class JResult_t>
JTOOLS::JResultHesse< JResult_t >::JResultHesse ( argument_type  __f,
argument_type  __fp 
)
inline

Constructor.

Parameters
__ffunction value
__fpfirst derivative

Definition at line 62 of file JResult.hh.

63  :
64  f (__f ),
65  fp(__fp)
66  {}
JResult_t f
function value
Definition: JResult.hh:191
JResult_t fp
first derivative
Definition: JResult.hh:192

Member Function Documentation

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

Prefix unary minus for function value of PDF.

Returns
function value of PDF

Definition at line 74 of file JResult.hh.

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

Addition operator for function value of PDF.

Parameters
valuefunction value of PDF
Returns
function value of PDF

Definition at line 89 of file JResult.hh.

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

Subtraction operator for function value of PDF.

Parameters
valuefunction value of PDF
Returns
function value of PDF

Definition at line 104 of file JResult.hh.

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

120  {
121  f *= value;
122  fp *= value;
123 
124  return *this;
125  }
JResult_t f
function value
Definition: JResult.hh:191
JResult_t fp
first derivative
Definition: JResult.hh:192
template<class JResult_t>
JResultHesse& JTOOLS::JResultHesse< 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 134 of file JResult.hh.

135  {
136  f /= value;
137  fp /= value;
138 
139  return *this;
140  }
JResult_t f
function value
Definition: JResult.hh:191
JResult_t fp
first derivative
Definition: JResult.hh:192
template<class JResult_t>
double JTOOLS::JResultHesse< 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 JResultHesse::f.

Parameters
hithit (or not)
Returns
probability

Definition at line 151 of file JResult.hh.

152  {
153  if (!hit)
154  return exp(-f); // probability of 0 hits
155  else
156  return 1.0 - getP(false); // probability of 1 or more hits
157  }
JResult_t f
function value
Definition: JResult.hh:191
double getP(const bool hit) const
Get probability.
Definition: JResult.hh:151
template<class JResult_t>
double JTOOLS::JResultHesse< JResult_t >::getChi2 ( const bool  hit) const
inline

Get chi2.

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

Parameters
hithit (or not)
Returns
chi2

Definition at line 167 of file JResult.hh.

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

Get derivative of chi2.

Parameters
hithit (or not)
Returns
derivative

Definition at line 182 of file JResult.hh.

183  {
184  if (!hit)
185  return fp;
186  else
187  return -fp * getP(false) / getP(true);
188  }
JResult_t fp
first derivative
Definition: JResult.hh:192
double getP(const bool hit) const
Get probability.
Definition: JResult.hh:151
JResultHesse< JResult_t > & JMATH::JMath< JResultHesse< 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 product evaluation of objects.
Definition: JCalculator.hh:18

Member Data Documentation

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

function value

Definition at line 191 of file JResult.hh.

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

first derivative

Definition at line 192 of file JResult.hh.


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