BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
ChisqConsistency Class Reference

#include <ChisqConsistency.h>

Inheritance diagram for ChisqConsistency:

Public Member Functions

 ChisqConsistency ()
 ChisqConsistency (double chisq, double nDof)
 ChisqConsistency (unsigned nDof, double consistency)
 ChisqConsistency (const ChisqConsistency &)
ChisqConsistencyoperator= (const ChisqConsistency &)
virtual ~ChisqConsistency ()
const double & chisqValue () const
const double & nDOF () const
 ChisqConsistency ()
 ChisqConsistency (double chisq, double nDof)
 ChisqConsistency (unsigned nDof, double consistency)
 ChisqConsistency (const ChisqConsistency &)
ChisqConsistencyoperator= (const ChisqConsistency &)
virtual ~ChisqConsistency ()
const double & chisqValue () const
const double & nDOF () const
 ChisqConsistency ()
 ChisqConsistency (double chisq, double nDof)
 ChisqConsistency (unsigned nDof, double consistency)
 ChisqConsistency (const ChisqConsistency &)
ChisqConsistencyoperator= (const ChisqConsistency &)
virtual ~ChisqConsistency ()
const double & chisqValue () const
const double & nDOF () const
Public Member Functions inherited from Consistency
 Consistency ()
 Consistency (double consistency, double likelihood=0.)
 Consistency (const Consistency &rhs)
virtual ~Consistency ()
Consistencyoperator= (const Consistency &rhs)
bool operator== (const Consistency &rhs) const
bool operator< (const Consistency &rhs) const
bool operator> (const Consistency &rhs) const
double significanceLevel () const
double likelihood () const
double consistency () const
ConsistentStatus status () const
void setStatus (ConsistentStatus s)
ConsistentSign sign () const
void setSign (ConsistentSign s)
virtual const ConsistencySet * genealogy () const
virtual void print (std::ostream &) const
 Consistency ()
 Consistency (double consistency, double likelihood=0.)
 Consistency (const Consistency &rhs)
virtual ~Consistency ()
Consistencyoperator= (const Consistency &rhs)
bool operator== (const Consistency &rhs) const
bool operator< (const Consistency &rhs) const
bool operator> (const Consistency &rhs) const
double significanceLevel () const
double likelihood () const
double consistency () const
ConsistentStatus status () const
void setStatus (ConsistentStatus s)
ConsistentSign sign () const
void setSign (ConsistentSign s)
virtual const ConsistencySet * genealogy () const
virtual void print (std::ostream &) const
 Consistency ()
 Consistency (double consistency, double likelihood=0.)
 Consistency (const Consistency &rhs)
virtual ~Consistency ()
Consistencyoperator= (const Consistency &rhs)
bool operator== (const Consistency &rhs) const
bool operator< (const Consistency &rhs) const
bool operator> (const Consistency &rhs) const
double significanceLevel () const
double likelihood () const
double consistency () const
ConsistentStatus status () const
void setStatus (ConsistentStatus s)
ConsistentSign sign () const
void setSign (ConsistentSign s)
virtual const ConsistencySet * genealogy () const
virtual void print (std::ostream &) const

Protected Attributes

double _chisq
double _nDof
Protected Attributes inherited from Consistency
ConsistentStatus _stat
ConsistentSign _sign
double _value
double _likelihood

Additional Inherited Members

Public Types inherited from Consistency
enum  ConsistentStatus {
  OK = 0 , noMeasure , underFlow , unPhysical ,
  OK = 0 , noMeasure , underFlow , unPhysical ,
  OK = 0 , noMeasure , underFlow , unPhysical
}
enum  ConsistentSign {
  left = -1 , unknown = 0 , right = 1 , left = -1 ,
  unknown = 0 , right = 1 , left = -1 , unknown = 0 ,
  right = 1
}
enum  ConsistentStatus {
  OK = 0 , noMeasure , underFlow , unPhysical ,
  OK = 0 , noMeasure , underFlow , unPhysical ,
  OK = 0 , noMeasure , underFlow , unPhysical
}
enum  ConsistentSign {
  left = -1 , unknown = 0 , right = 1 , left = -1 ,
  unknown = 0 , right = 1 , left = -1 , unknown = 0 ,
  right = 1
}
enum  ConsistentStatus {
  OK = 0 , noMeasure , underFlow , unPhysical ,
  OK = 0 , noMeasure , underFlow , unPhysical ,
  OK = 0 , noMeasure , underFlow , unPhysical
}
enum  ConsistentSign {
  left = -1 , unknown = 0 , right = 1 , left = -1 ,
  unknown = 0 , right = 1 , left = -1 , unknown = 0 ,
  right = 1
}
Static Public Member Functions inherited from Consistency
static const ConsistencybadMeasurement ()
static const ConsistencybadMeasurement ()
static const ConsistencybadMeasurement ()

Detailed Description

Constructor & Destructor Documentation

◆ ChisqConsistency() [1/12]

◆ ChisqConsistency() [2/12]

ChisqConsistency::ChisqConsistency ( double chisq,
double nDof )

Definition at line 40 of file ChisqConsistency.cxx.

41 : _chisq( chisq ), _nDof( nDof ) {
42 double z2 = 0.5 * _chisq;
43 double n2 = 0.5 * _nDof;
44
45 if ( n2 <= 0 || z2 < 0 )
46 {
47 std::cout << "ErrMsg(warning)"
48 << " Got unphysical values: chisq = " << chisq << " #dof = " << nDof
49 << std::endl;
50 _value = 0;
51 _likelihood = 0;
53 return;
54 }
56
57 // given that n2>0 && z2>=0, gammq will NOT abort
59
60 if ( _chisq == 0 ) { _likelihood = 1; }
61 else
62 {
63 double loglike = ( n2 - 1 ) * log( z2 ) - z2 - NumRecipes::gammln( n2 );
64 if ( loglike < DBL_MIN_EXP )
65 {
66 _likelihood = 0;
68 }
69 else { _likelihood = 0.5 * exp( loglike ); }
70 }
71}
EvtComplex exp(const EvtComplex &c)
int n2
Definition SD0Tag.cxx:59
static double gammq(double a, double x)
static double gammln(double x)

◆ ChisqConsistency() [3/12]

ChisqConsistency::ChisqConsistency ( unsigned nDof,
double consistency )

Definition at line 73 of file ChisqConsistency.cxx.

73 : _nDof( nDof ) {
74 if ( prob >= 0.0 || prob <= 1.0 || nDof < 0 ) _value = prob;
75 else
76 {
77 std::cout << "ErrMsg(warning)"
78 << " Got unphysical values: prob = " << prob << " #dof = " << nDof << std::endl;
79 _value = 0;
80 _likelihood = 0;
82 return;
83 }
85 if ( prob != 1.0 )
86 {
87 // use the cernlib function to get chisq. Note the funny convention on prob!!
88 float value = 1.0 - float( _value );
89 int ndof = nDof;
90 if ( value < 1.0 ) _chisq = chisin_( value, ndof );
91 else _chisq = log( double( FLT_MAX ) );
92 // use the same algorithm as above to get loglikelihood
93 double z2 = 0.5 * _chisq;
94 double n2 = 0.5 * _nDof;
95 if ( _chisq == 0 ) { _likelihood = 1; }
96 else
97 {
98 double loglike = ( n2 - 1 ) * log( z2 ) - z2 - NumRecipes::gammln( n2 );
99 if ( loglike < DBL_MIN_EXP )
100 {
101 _likelihood = 0;
103 }
104 else { _likelihood = 0.5 * exp( loglike ); }
105 }
106 }
107}
float chisin_(const float &, const int &)

◆ ChisqConsistency() [4/12]

ChisqConsistency::ChisqConsistency ( const ChisqConsistency & other)

Definition at line 109 of file ChisqConsistency.cxx.

110 : Consistency( other ), _chisq( other._chisq ), _nDof( other._nDof ) {}
Index other(Index i, Index j)

◆ ~ChisqConsistency() [1/3]

virtual ChisqConsistency::~ChisqConsistency ( )
inlinevirtual

◆ ChisqConsistency() [5/12]

ChisqConsistency::ChisqConsistency ( )

◆ ChisqConsistency() [6/12]

ChisqConsistency::ChisqConsistency ( double chisq,
double nDof )

◆ ChisqConsistency() [7/12]

ChisqConsistency::ChisqConsistency ( unsigned nDof,
double consistency )

◆ ChisqConsistency() [8/12]

ChisqConsistency::ChisqConsistency ( const ChisqConsistency & )

◆ ~ChisqConsistency() [2/3]

virtual ChisqConsistency::~ChisqConsistency ( )
inlinevirtual

◆ ChisqConsistency() [9/12]

ChisqConsistency::ChisqConsistency ( )

◆ ChisqConsistency() [10/12]

ChisqConsistency::ChisqConsistency ( double chisq,
double nDof )

◆ ChisqConsistency() [11/12]

ChisqConsistency::ChisqConsistency ( unsigned nDof,
double consistency )

◆ ChisqConsistency() [12/12]

ChisqConsistency::ChisqConsistency ( const ChisqConsistency & )

◆ ~ChisqConsistency() [3/3]

virtual ChisqConsistency::~ChisqConsistency ( )
inlinevirtual

Member Function Documentation

◆ chisqValue() [1/3]

const double & ChisqConsistency::chisqValue ( ) const
inline

◆ chisqValue() [2/3]

const double & ChisqConsistency::chisqValue ( ) const
inline

◆ chisqValue() [3/3]

const double & ChisqConsistency::chisqValue ( ) const
inline

◆ nDOF() [1/3]

const double & ChisqConsistency::nDOF ( ) const
inline

◆ nDOF() [2/3]

const double & ChisqConsistency::nDOF ( ) const
inline

◆ nDOF() [3/3]

const double & ChisqConsistency::nDOF ( ) const
inline

◆ operator=() [1/3]

ChisqConsistency & ChisqConsistency::operator= ( const ChisqConsistency & other)

Definition at line 112 of file ChisqConsistency.cxx.

112 {
113 if ( this != &other )
114 {
115 Consistency::operator=( other );
116 _chisq = other._chisq;
117 _nDof = other._nDof;
118 }
119 return *this;
120}
Consistency & operator=(const Consistency &rhs)

◆ operator=() [2/3]

ChisqConsistency & ChisqConsistency::operator= ( const ChisqConsistency & )

◆ operator=() [3/3]

ChisqConsistency & ChisqConsistency::operator= ( const ChisqConsistency & )

Member Data Documentation

◆ _chisq

◆ _nDof


The documentation for this class was generated from the following files: