Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
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 >:
JTOOLS::JResultDerivative< JResult_t > JMATH::JMath< JFirst_t, JSecond_t > JMATH::JMath< JFirst_t, JSecond_t >

Public Types

typedef JResultDerivative< JResult_t >::argument_type argument_type
 

Public Member Functions

 JResultHesse ()
 Default constructor.
 
 JResultHesse (argument_type f, argument_type fp, argument_type fpp)
 Constructor.
 
JResultHessenegate ()
 Prefix unary minus for function value of PDF.
 
JResultHesseadd (const JResultHesse &value)
 Addition operator for function value of PDF.
 
JResultHessesub (const JResultHesse &value)
 Subtraction operator for function value of PDF.
 
JResultHessemul (const double value)
 Multiplication operator for function value of PDF.
 
JResultHessediv (const double value)
 Division operator for function value of PDF.
 
JResultDerivativeadd (const JResultDerivative &value)
 Addition operator for function value of PDF.
 
JResultDerivativesub (const JResultDerivative &value)
 Subtraction operator for function value of PDF.
 
JFirst_t & mul (const JSecond_t &object)
 Multiply with object.
 
double getP (const bool hit) const
 Get probability.
 
double getChi2 (const bool hit) const
 Get chi2.
 
double getDerivativeOfChi2 (const bool hit) const
 Get derivative of chi2.
 
JFirst_t & mul (const JSecond_t &object)
 Multiply with object.
 

Public Attributes

JResult_t fpp
 second derivative
 
JResult_t f
 function value
 
JResult_t fp
 first derivative
 

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;
   JResultHesse::fpp = second derivative;

This class implements the JMATH::JMath interface.

Definition at line 212 of file JResult.hh.

Member Typedef Documentation

◆ argument_type

template<class JResult_t >
JResultDerivative<JResult_t>::argument_type JTOOLS::JResultHesse< JResult_t >::argument_type

Definition at line 217 of file JResult.hh.

Constructor & Destructor Documentation

◆ JResultHesse() [1/2]

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

Default constructor.

Definition at line 223 of file JResult.hh.

223 :
226 {}
static const JZero zero
Function object to assign zero value.
Definition JZero.hh:105
JResultDerivative()
Default constructor.
Definition JResult.hh:53
JResult_t fpp
second derivative
Definition JResult.hh:318

◆ JResultHesse() [2/2]

template<class JResult_t >
JTOOLS::JResultHesse< JResult_t >::JResultHesse ( argument_type f,
argument_type fp,
argument_type fpp )
inline

Constructor.

Parameters
ffunction value
fpfirst derivative
fppsecond derivative

Definition at line 236 of file JResult.hh.

238 :
240 fpp(fpp)
241 {}
JResult_t f
function value
Definition JResult.hh:194
JResult_t fp
first derivative
Definition JResult.hh:195

Member Function Documentation

◆ negate()

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

250 {
251 static_cast<JResultDerivative<JResult_t>&>(*this).negate();
252 fpp = -fpp;
253
254 return *this;
255 }

◆ add() [1/2]

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

265 {
266 static_cast<JResultDerivative<JResult_t>&>(*this).add(value);
267 fpp += value.fpp;
268
269 return *this;
270 }

◆ sub() [1/2]

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

280 {
281 static_cast<JResultDerivative<JResult_t>&>(*this).sub(value);
282 fpp -= value.fpp;
283
284 return *this;
285 }

◆ mul() [1/3]

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

295 {
296 static_cast<JResultDerivative<JResult_t>&>(*this).mul(value);
297 fpp *= value;
298
299 return *this;
300 }

◆ div()

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

310 {
311 static_cast<JResultDerivative<JResult_t>&>(*this).div(value);
312 fpp /= value;
313
314 return *this;
315 }

◆ add() [2/2]

template<class JResult_t >
JResultDerivative & JTOOLS::JResultDerivative< JResult_t >::add ( const JResultDerivative< JResult_t > & value)
inlineinherited

Addition operator for function value of PDF.

Parameters
valuefunction value of PDF
Returns
function value of PDF

Definition at line 92 of file JResult.hh.

93 {
94 f += value.f;
95 fp += value.fp;
96
97 return *this;
98 }

◆ sub() [2/2]

template<class JResult_t >
JResultDerivative & JTOOLS::JResultDerivative< JResult_t >::sub ( const JResultDerivative< JResult_t > & value)
inlineinherited

Subtraction operator for function value of PDF.

Parameters
valuefunction value of PDF
Returns
function value of PDF

Definition at line 107 of file JResult.hh.

108 {
109 f -= value.f;
110 fp -= value.fp;
111
112 return *this;
113 }

◆ mul() [2/3]

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 }

◆ getP()

template<class JResult_t >
double JTOOLS::JResultDerivative< JResult_t >::getP ( const bool hit) const
inlineinherited

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

155 {
156 if (!hit)
157 return exp(-f); // probability of 0 hits
158 else
159 return 1.0 - getP(false); // probability of 1 or more hits
160 }
double getP(const bool hit) const
Get probability.
Definition JResult.hh:154

◆ getChi2()

template<class JResult_t >
double JTOOLS::JResultDerivative< JResult_t >::getChi2 ( const bool hit) const
inlineinherited

Get chi2.

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

Parameters
hithit (or not)
Returns
chi2

Definition at line 170 of file JResult.hh.

171 {
172 if (!hit)
173 return f; // = -log(getP(false))
174 else
175 return -log(getP(true));
176 }

◆ getDerivativeOfChi2()

template<class JResult_t >
double JTOOLS::JResultDerivative< JResult_t >::getDerivativeOfChi2 ( const bool hit) const
inlineinherited

Get derivative of chi2.

Parameters
hithit (or not)
Returns
derivative

Definition at line 185 of file JResult.hh.

186 {
187 if (!hit)
188 return fp;
189 else
190 return -fp * getP(false) / getP(true);
191 }

◆ mul() [3/3]

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

◆ fpp

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

second derivative

Definition at line 318 of file JResult.hh.

◆ f

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

function value

Definition at line 194 of file JResult.hh.

◆ fp

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

first derivative

Definition at line 195 of file JResult.hh.


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