BOSS 7.0.3
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
 
- 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
 

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
}
 
enum  ConsistentSign {
  left =-1 , unknown =0 , right =1 , left =-1 ,
  unknown =0 , right =1
}
 
enum  ConsistentStatus {
  OK =0 , noMeasure , underFlow , unPhysical ,
  OK =0 , noMeasure , underFlow , unPhysical
}
 
enum  ConsistentSign {
  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 ()
 

Detailed Description

Constructor & Destructor Documentation

◆ ChisqConsistency() [1/8]

ChisqConsistency::ChisqConsistency ( )

◆ ChisqConsistency() [2/8]

ChisqConsistency::ChisqConsistency ( double  chisq,
double  nDof 
)

Definition at line 42 of file ChisqConsistency.cxx.

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

◆ ChisqConsistency() [3/8]

ChisqConsistency::ChisqConsistency ( unsigned  nDof,
double  consistency 
)

Definition at line 76 of file ChisqConsistency.cxx.

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

◆ ChisqConsistency() [4/8]

ChisqConsistency::ChisqConsistency ( const ChisqConsistency other)

Definition at line 116 of file ChisqConsistency.cxx.

116 :
117 Consistency(other), _chisq(other._chisq), _nDof(other._nDof)
118{}
Index other(Index i, Index j)
Definition: EvtCyclic3.cc:118

◆ ~ChisqConsistency() [1/2]

virtual ChisqConsistency::~ChisqConsistency ( )
inlinevirtual

◆ ChisqConsistency() [5/8]

ChisqConsistency::ChisqConsistency ( )

◆ ChisqConsistency() [6/8]

ChisqConsistency::ChisqConsistency ( double  chisq,
double  nDof 
)

◆ ChisqConsistency() [7/8]

ChisqConsistency::ChisqConsistency ( unsigned  nDof,
double  consistency 
)

◆ ChisqConsistency() [8/8]

ChisqConsistency::ChisqConsistency ( const ChisqConsistency )

◆ ~ChisqConsistency() [2/2]

virtual ChisqConsistency::~ChisqConsistency ( )
inlinevirtual

Member Function Documentation

◆ chisqValue() [1/2]

const double & ChisqConsistency::chisqValue ( ) const
inline

Definition at line 46 of file InstallArea/include/ProbTools/ProbTools/ChisqConsistency.h.

46{ return _chisq; }

◆ chisqValue() [2/2]

const double & ChisqConsistency::chisqValue ( ) const
inline

◆ nDOF() [1/2]

const double & ChisqConsistency::nDOF ( ) const
inline

Definition at line 47 of file InstallArea/include/ProbTools/ProbTools/ChisqConsistency.h.

47{ return _nDof; }

◆ nDOF() [2/2]

const double & ChisqConsistency::nDOF ( ) const
inline

◆ operator=() [1/2]

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

Definition at line 121 of file ChisqConsistency.cxx.

121 {
122 if(this != &other){
124 _chisq = other._chisq;
125 _nDof = other._nDof;
126 }
127 return *this;
128}
Consistency & operator=(const Consistency &rhs)
Definition: Consistency.cxx:72

◆ operator=() [2/2]

ChisqConsistency & ChisqConsistency::operator= ( const ChisqConsistency )

Member Data Documentation

◆ _chisq

double ChisqConsistency::_chisq
protected

◆ _nDof

double ChisqConsistency::_nDof
protected

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