Jpp 20.0.0-27-g39925593c-D
the software that should make you happy
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
JASTRONOMY::JDiscovery< T, factor > Struct Template Reference

Auxiliary data structure for discovery calculations. More...

#include <JAstronomyToolkit.hh>

Inheritance diagram for JASTRONOMY::JDiscovery< T, factor >:
JASTRONOMY::JGarage< T, factor > std::vector< std::vector< T > >

Public Types

typedef std::vector< std::vector< T > > map_type
 
typedef map_type::value_type value_type
 
typedef map_type::const_iterator const_iterator
 
typedef map_type::const_reverse_iterator const_reverse_iterator
 

Public Member Functions

 JDiscovery (JPseudoExperiment_t &px)
 Constructor.
 
double operator() (const double Q, const double P, const size_t numberOfTests, const double precision=1.0e-3)
 Get signal strength for which given likelihood is exceeded with given probability.
 
size_t getN () const
 Get total number of values.
 
getMin () const
 Get minimal value.
 
getMax () const
 Get maximal value.
 
void put (const T value)
 Add value to container.
 
void put (const size_t N, const JFunction_t &object)
 Add values to container.
 
void operator() (const JFunction_t &object) const
 For-each method.
 
getValue (const double P) const
 Get minimal value corresponding given maximal probability.
 
double getProbability (const T value) const
 Get maximal probability corresponding given minimal value.
 

Static Public Member Functions

static size_t getKey (const T value)
 Get hash key corresponding to given value.
 

Protected Member Functions

double getProbability (const double fS, const double Q, const size_t numberOfTests)
 Run pseudo experiments to get probability corresponding to given minimal likelihood.
 

Protected Attributes

JPseudoExperiment_tpx
 

Detailed Description

template<class T, const size_t factor>
struct JASTRONOMY::JDiscovery< T, factor >

Auxiliary data structure for discovery calculations.

Definition at line 22 of file JAstronomyToolkit.hh.

Member Typedef Documentation

◆ map_type

typedef std::vector< std::vector<T> > JASTRONOMY::JGarage< T, factor >::map_type
inherited

Definition at line 31 of file JGarage.hh.

◆ value_type

typedef map_type::value_type JASTRONOMY::JGarage< T, factor >::value_type
inherited

Definition at line 32 of file JGarage.hh.

◆ const_iterator

typedef map_type::const_iterator JASTRONOMY::JGarage< T, factor >::const_iterator
inherited

Definition at line 33 of file JGarage.hh.

◆ const_reverse_iterator

typedef map_type::const_reverse_iterator JASTRONOMY::JGarage< T, factor >::const_reverse_iterator
inherited

Definition at line 34 of file JGarage.hh.

Constructor & Destructor Documentation

◆ JDiscovery()

template<class T , const size_t factor>
JASTRONOMY::JDiscovery< T, factor >::JDiscovery ( JPseudoExperiment_t & px)
inline

Constructor.

Parameters
pxpseudo experiment

Definition at line 32 of file JAstronomyToolkit.hh.

32 :
33 px(px)
34 {}
JPseudoExperiment_t & px

Member Function Documentation

◆ operator()() [1/2]

template<class T , const size_t factor>
double JASTRONOMY::JDiscovery< T, factor >::operator() ( const double Q,
const double P,
const size_t numberOfTests,
const double precision = 1.0e-3 )
inline

Get signal strength for which given likelihood is exceeded with given probability.

Parameters
Qlikelihood
Pprobability [0,1>
numberOfTestsnumber of tests
precisionprecision of signal strength
Returns
signal strength

Definition at line 46 of file JAstronomyToolkit.hh.

50 {
51 double xmin = 1.0;
52 double xmax = 2.0;
53
54 while (getProbability(xmin, Q, numberOfTests) > P) { // set lower limit
55 xmax = xmin;
56 xmin *= 0.5;
57 }
58
59 while (getProbability(xmax, Q, numberOfTests) < P) { // set upper limit
60 xmin = xmax;
61 xmax *= 2.0;
62 }
63
64 while (xmax - xmin > precision) { // bisection
65
66 const double x = 0.5 * (xmin + xmax);
67
68 if (getProbability(x, Q, numberOfTests) < P)
69 xmin = x;
70 else
71 xmax = x;
72 }
73
74 return 0.5 * (xmin + xmax);
75 }
double getProbability(const double fS, const double Q, const size_t numberOfTests)
Run pseudo experiments to get probability corresponding to given minimal likelihood.

◆ getProbability() [1/2]

template<class T , const size_t factor>
double JASTRONOMY::JDiscovery< T, factor >::getProbability ( const double fS,
const double Q,
const size_t numberOfTests )
inlineprotected

Run pseudo experiments to get probability corresponding to given minimal likelihood.

Parameters
fSsignal strength
Qlikelihood
numberOfTestsnumber of tests
Returns
probability

Definition at line 86 of file JAstronomyToolkit.hh.

89 {
90 px.set(fS);
91
92 this->clear();
93
94 for (size_t i = 0; i != numberOfTests; ++i) {
95 this->put(px().likelihood);
96 }
97
98 return this->getProbability(Q);
99 }
void put(const T value)
Add value to container.
Definition JGarage.hh:108
virtual void set(const double fS, const double fB=1.0)=0
Set scaling factors of signal and background strengths.

◆ getN()

size_t JASTRONOMY::JGarage< T, factor >::getN ( ) const
inlineinherited

Get total number of values.

Returns
number of values

Definition at line 42 of file JGarage.hh.

◆ getMin()

T JASTRONOMY::JGarage< T, factor >::getMin ( ) const
inlineinherited

Get minimal value.

Returns
value

Definition at line 55 of file JGarage.hh.

◆ getMax()

T JASTRONOMY::JGarage< T, factor >::getMax ( ) const
inlineinherited

Get maximal value.

Returns
value

Definition at line 74 of file JGarage.hh.

◆ getKey()

static size_t JASTRONOMY::JGarage< T, factor >::getKey ( const T value)
inlinestaticinherited

Get hash key corresponding to given value.

Parameters
valuevalue
Returns
key

Definition at line 94 of file JGarage.hh.

◆ put() [1/2]

void JASTRONOMY::JGarage< T, factor >::put ( const T value)
inlineinherited

Add value to container.

Parameters
valuevalue

Definition at line 108 of file JGarage.hh.

◆ put() [2/2]

void JASTRONOMY::JGarage< T, factor >::put ( const size_t N,
const JFunction_t & object )
inlineinherited

Add values to container.

Parameters
Nnumber of values
objectfunction object returning value

Definition at line 127 of file JGarage.hh.

◆ operator()() [2/2]

void JASTRONOMY::JGarage< T, factor >::operator() ( const JFunction_t & object) const
inlineinherited

For-each method.

Parameters
objectfunction object

Definition at line 141 of file JGarage.hh.

◆ getValue()

T JASTRONOMY::JGarage< T, factor >::getValue ( const double P) const
inlineinherited

Get minimal value corresponding given maximal probability.

Parameters
Pprobability [0,1>
Returns
value

Definition at line 157 of file JGarage.hh.

◆ getProbability() [2/2]

double JASTRONOMY::JGarage< T, factor >::getProbability ( const T value) const
inlineinherited

Get maximal probability corresponding given minimal value.

Parameters
valuevalue
Returns
probability

Definition at line 199 of file JGarage.hh.

Member Data Documentation

◆ px

template<class T , const size_t factor>
JPseudoExperiment_t& JASTRONOMY::JDiscovery< T, factor >::px
protected

Definition at line 101 of file JAstronomyToolkit.hh.


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