BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/MdcPatRec/ProbTools/include/ProbTools/Consistency.h
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2// File and Version Information:
3// $Id: Consistency.h,v 1.1.1.1 2005/04/21 01:17:17 zhangy Exp $
4//
5// Description:
6// The Consistency class is a top level parent for various
7// statistical classes
8//
9// This class also defines an enum ConsistentStatus for representing
10// various error conditions
11//
12// Return an object of this class from a chisquared calculation, for
13// example, so that probability and chisquared can be treated
14// directly. Future subclasses might implement other statistics
15// (Poisson, etc), and this class could use operations to combine,
16// print, etc. (Or other statistics could be added to this class,
17// allowing it to convert between different measures; the uses
18// will dictate the structure)
19//
20// Note: implementation of this class is minimal at present; please
21// read the comments!
22//
23// Environment:
24// Software developed for the BaBar Detector at the SLAC B-Factory.
25//
26// Author List:
27// Bob Jacobsen
28//
29// History :
30// April 98 - Gautier Hamel de Monchenault
31// o introduce genealogy methods
32// o add significanceLevel() accessor which returns _value
33// o comment out the automatic translation to double
34// o add 'const' to operators == and <
35//
36//
37// Copyright Information:
38// Copyright (C) 1995, 1996
39//
40//------------------------------------------------------------------------
41#ifndef CONSISTENCY_HH
42#define CONSISTENCY_HH
43
44// #include "BaBar/BaBar.hh"
45
46#include <iosfwd>
47class ConsistencySet;
48
49//-----------------
50// BaBar Headers --
51//-----------------
52
53class Consistency {
54
55public:
56 // default constructor; sets internal state to noMeasure and value to zero
58
59 // default value for likelihood is for backward compatibility
60 Consistency( double consistency, double likelihood = 0. );
61
62 // copy constructor
63 Consistency( const Consistency& rhs );
64
65 virtual ~Consistency() {}
66
67 // assignment
69
70 // equality -- this will never work right since one has to compare
71 // two doubles. But RW sometimes requires this.
72 bool operator==( const Consistency& rhs ) const;
73 // less operator is better in that regard, but it's not unique
74 bool operator<( const Consistency& rhs ) const;
75 // greater than operator
76 bool operator>( const Consistency& rhs ) const;
77
78 // members for returning
79 // the statistical significance level
80 // and the likelihood
81 // of the represented observation;
82 // subclasses are responsible
83 // for keeping the data member up to date
84 double significanceLevel() const { return _value; }
85 double likelihood() const { return _likelihood; }
86
87 // Old function kept in the interface for back compatibility.
88 // Avoid to use it - use significanceLevel() instead.
89 // Will disappear eventually
90 double consistency() const { return _value; }
91
92 // represent the various ways that a statistical measure could be bad
94
95 // OK just that; usable statistical data
96 // noMeasure no statistical statement possible; DOF == 0, for example.
97 // may or may not be consistent
98 // underFlow probability too small to calculate with; may or may not want
99 // to treat as zero, but value may have been treated by machine
100 // underflow handling
101 // unPhysical because of a "can't happen" condition, probability is
102 // identically equal to zero;
103
104 // return the status
105 ConsistentStatus status() const { return _stat; }
107
108 // represent whether the measured value was "left" or "right" of
109 // the expected. This is generally only useful if there is more
110 // than one provider of consistencies in a given situation (e.g.
111 // multiple systems doing PID), and they have a convention for
112 // what these mean
113 enum ConsistentSign { left = -1, unknown = 0, right = 1 };
114
115 // return the sign
116 ConsistentSign sign() const { return _sign; }
118
119 // use as a double returns the consistency value; this member is
120 // intended as just a convenience, and may be removed if it makes
121 // trouble.
122
123 // genealogy
124 virtual const ConsistencySet* genealogy() const;
125
126 // print
127 virtual void print( std::ostream& ) const;
128
129protected:
132 double _value; // value of the consistency
133 double _likelihood; // value of the likelihood
134
135 //------------------
136 // Static methods --
137 //------------------
138
139public:
141};
142
143#endif
XmlRpcServer s
bool operator>(const Consistency &rhs) const
Consistency(const Consistency &rhs)
virtual const ConsistencySet * genealogy() const
static const Consistency & badMeasurement()
bool operator<(const Consistency &rhs) const
virtual void print(std::ostream &) const
Consistency & operator=(const Consistency &rhs)
bool operator==(const Consistency &rhs) const
Consistency(double consistency, double likelihood=0.)