Jpp  17.2.1-pre0
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::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< JFirst_t, JSecond_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...
 
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...
 

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

Constructor & Destructor Documentation

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

Default constructor.

Definition at line 53 of file JResult.hh.

53  :
54  f (JMATH::zero),
55  fp (JMATH::zero)
56  {}
static const JZero zero
Function object to assign zero value.
Definition: JZero.hh:105
JResult_t fp
first derivative
Definition: JResult.hh:195
JResult_t f
function value
Definition: JResult.hh:194
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 65 of file JResult.hh.

66  :
67  f (f ),
68  fp (fp)
69  {}
JResult_t fp
first derivative
Definition: JResult.hh:195
JResult_t f
function value
Definition: JResult.hh:194

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

78  {
79  f = -f;
80  fp = -fp;
81 
82  return *this;
83  }
JResult_t fp
first derivative
Definition: JResult.hh:195
JResult_t f
function value
Definition: JResult.hh:194
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 92 of file JResult.hh.

93  {
94  f += value.f;
95  fp += value.fp;
96 
97  return *this;
98  }
JResult_t fp
first derivative
Definition: JResult.hh:195
JResult_t f
function value
Definition: JResult.hh:194
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 107 of file JResult.hh.

108  {
109  f -= value.f;
110  fp -= value.fp;
111 
112  return *this;
113  }
JResult_t fp
first derivative
Definition: JResult.hh:195
JResult_t f
function value
Definition: JResult.hh:194
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 122 of file JResult.hh.

123  {
124  f *= value;
125  fp *= value;
126 
127  return *this;
128  }
JResult_t fp
first derivative
Definition: JResult.hh:195
JResult_t f
function value
Definition: JResult.hh:194
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 137 of file JResult.hh.

138  {
139  f /= value;
140  fp /= value;
141 
142  return *this;
143  }
JResult_t fp
first derivative
Definition: JResult.hh:195
JResult_t f
function value
Definition: JResult.hh:194
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 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  }
JResult_t f
function value
Definition: JResult.hh:194
double getP(const bool hit) const
Get probability.
Definition: JResult.hh:154
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"` source JAcousticsToolkit.sh typeset -A TRIPODS get_tripods $WORKDIR/tripod.txt TRIPODS XMEAN
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 170 of file JResult.hh.

171  {
172  if (!hit)
173  return f; // = -log(getP(false))
174  else
175  return -log(getP(true));
176  }
JResult_t f
function value
Definition: JResult.hh:194
double getP(const bool hit) const
Get probability.
Definition: JResult.hh:154
then cat $TRIPOD_INITIAL<< EOF1 256877.5 4743716.7-2438.42 256815.5 4743395.0-2435.53 257096.2 4743636.0-2439.5EOFfiif[[!-f $DETECTOR]];then JEditDetector-a $DETECTOR_INITIAL-s"-1 addz -6.9"-o $DETECTOR--!eval`JPrintDetector-a $DETECTOR-O SUMMARY`for STRING in ${STRINGS[*]};do set_variable MODULE`getModule-a $DETECTOR-L"$STRING 0"`JEditDetector-a $DETECTOR-M"$MODULE setz -2.9"-o $DETECTOR--!donefiif[[!-f $TRIPOD]];then cp-p $TRIPOD_INITIAL $TRIPODfiJAcoustics.sh $DETECTOR_IDcat > acoustics_trigger_parameters txt<< EOFQ=0.0;TMax_s=0.020;quantile=0.9;numberOfHits=90;EOFJAcousticsEventBuilder.sh $DETECTOR $RUNS[*]INPUT_FILES=(`ls KM3NeT_ ${(l:8::0::0:) DETECTOR_ID}_0 *${^RUNS}_event.root`) cd $WORKDIRif[!$HOMEDIR-ef $WORKDIR];then cp-p $HOMEDIR/$DETECTOR $WORKDIR cp-p $HOMEDIR/$TRIPOD $WORKDIR cp-p $HOMEDIR/${^INPUT_FILES}$WORKDIR cp-p $HOMEDIR/{acoustics_fit_parameters, acoustics_trigger_parameters, disable, hydrophone, mechanics, sound_velocity, tripod, waveform}.txt $WORKDIRfisource $JPP_DIR/examples/JAcoustics/acoustics-fit-toolkit.shtimer_startinitialise stage_1B 0.002 0.1 0 > &stage log
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 185 of file JResult.hh.

186  {
187  if (!hit)
188  return fp;
189  else
190  return -fp * getP(false) / getP(true);
191  }
JResult_t fp
first derivative
Definition: JResult.hh:195
double getP(const bool hit) const
Get probability.
Definition: JResult.hh:154
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 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

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

function value

Definition at line 194 of file JResult.hh.

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

first derivative

Definition at line 195 of file JResult.hh.


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