BOSS 7.0.5
BESIII Offline Software System
Loading...
Searching...
No Matches
InstallArea/include/ProbTools/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
54
55 public:
56
57 // default constructor; sets internal state to noMeasure and value to zero
59
60 // default value for likelihood is for backward compatibility
61 Consistency( double consistency, double likelihood=0.);
62
63 // copy constructor
64 Consistency(const Consistency& rhs);
65
66 virtual ~Consistency() {}
67
68 // assignment
70
71 // equality -- this will never work right since one has to compare
72 // two doubles. But RW sometimes requires this.
73 bool operator==(const Consistency& rhs) const;
74 // less operator is better in that regard, but it's not unique
75 bool operator < (const Consistency& rhs) const;
76 // greater than operator
77 bool operator > (const Consistency& rhs) const;
78
79 // members for returning
80 // the statistical significance level
81 // and the likelihood
82 // of the represented observation;
83 // subclasses are responsible
84 // for keeping the data member up to date
85 double significanceLevel() const { return _value; }
86 double likelihood() const { return _likelihood;}
87
88 // Old function kept in the interface for back compatibility.
89 // Avoid to use it - use significanceLevel() instead.
90 // Will disappear eventually
91 double consistency() const { return _value; }
92
93 // represent the various ways that a statistical measure could be bad
95
96 // OK just that; usable statistical data
97 // noMeasure no statistical statement possible; DOF == 0, for example.
98 // may or may not be consistent
99 // underFlow probability too small to calculate with; may or may not want
100 // to treat as zero, but value may have been treated by machine
101 // underflow handling
102 // unPhysical because of a "can't happen" condition, probability is
103 // identically equal to zero;
104
105 // return the status
106 ConsistentStatus status() const {return _stat;}
108
109 // represent whether the measured value was "left" or "right" of
110 // the expected. This is generally only useful if there is more
111 // than one provider of consistencies in a given situation (e.g.
112 // multiple systems doing PID), and they have a convention for
113 // what these mean
114 enum ConsistentSign { left=-1, unknown=0, right=1 };
115
116 // return the sign
117 ConsistentSign sign() const {return _sign; }
119
120 // use as a double returns the consistency value; this member is
121 // intended as just a convenience, and may be removed if it makes
122 // trouble.
123
124 // genealogy
125 virtual const ConsistencySet* genealogy() const;
126
127 // print
128 virtual void print(std::ostream& ) const;
129
130protected:
131
134 double _value; // value of the consistency
135 double _likelihood; // value of the likelihood
136
137 //------------------
138 // Static methods --
139 //------------------
140
141public:
142 static const Consistency& badMeasurement();
143
144};
145
146#endif
147
148
149
150
XmlRpcServer s
Definition: HelloServer.cpp:11
bool operator>(const Consistency &rhs) const
virtual const ConsistencySet * genealogy() const
static const Consistency & badMeasurement()
bool operator<(const Consistency &rhs) const
Definition: Consistency.cxx:98
virtual void print(std::ostream &) const
Consistency & operator=(const Consistency &rhs)
Definition: Consistency.cxx:72
bool operator==(const Consistency &rhs) const
Definition: Consistency.cxx:84