CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
Consistency.cxx
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2// File and Version Information:
3// $Id: Consistency.cxx,v 1.1.1.1 2005/04/21 01:17:17 zhangy Exp $
4//
5// Description:
6// Class Consistency; encapsulates statistics
7//
8// See header for more info. This implementation
9// is not complete
10//
11// Environment:
12// Software developed for the BaBar Detector at the SLAC B-Factory.
13//
14// Author List:
15// Bob Jacobsen Original Author
16//
17// Copyright Information:
18// Copyright (C) 1995 Lawrence Berkeley Laboratory
19//
20//------------------------------------------------------------------------
21//#include "BaBar/BaBar.hh"
22
23//------------------
24// This C Headers --
25//------------------
26extern "C" {
27#include <math.h>
28#include <assert.h>
29}
30
31//--------------------
32// This C++ Headers --
33//--------------------
34#include <iostream>
35#include <iomanip>
36
37//-----------------------
38// This Class's Header --
39//-----------------------
41using std::endl;
42using std::ios;
43using std::ostream;
44using std::setiosflags;
45using std::setprecision;
46using std::setw;
47
48
49// ----------------------------------------
50// -- Public Function Member Definitions --
51// ----------------------------------------
52
53
55 : _stat(noMeasure), _value(0), _likelihood(1.), _sign(unknown)
56{
57}
58
59Consistency::Consistency(double v, double l)
60 : _stat(OK), _value(v), _likelihood(l), _sign(unknown)
61{
62}
63
65 : _stat(rhs._stat), _value(rhs._value)
66 , _likelihood(rhs._likelihood), _sign(rhs._sign)
67{
68}
69
70// operators
73{
74 if(this != &rhs){
75 _stat=rhs._stat;
76 _value=rhs._value;
78 _sign=rhs._sign;
79 }
80 return *this;
81}
82
83bool
85{
86 bool answer = false;
87 if (_stat == rhs._stat &&
88 _value == rhs._value &&
89 _likelihood == rhs._likelihood &&
90 _sign == rhs._sign) {
91 answer = true;
92 }
93
94 return answer;
95}
96
97bool
98Consistency::operator<(const Consistency& rhs) const
99{
100 //
101 // this is not unique...
102 //
103
104 bool answer = false;
105 if (_stat == OK && rhs._stat == OK ) {
106 //
107 // Dare to use consistency for comparison.
108 // Likelihood may give a different answer
109 //
110 if (_value < rhs._value) {
111 answer = true;
112 }
113 } else {
114 if (rhs._stat == OK) {
115 answer = true;
116 }
117 }
118
119 return answer;
120}
121
122bool
124{
125 // ghm
126 if( *this==rhs ) return false;
127 return( ! (*this<rhs) );
128}
129
130
131const ConsistencySet*
133{
134 return 0;
135}
136
137
138void
139Consistency::print(ostream& os) const
140{
141 os << "Likelihood = ";
142 os << setiosflags(ios::fixed) << setw(7) << setprecision(4);
143 os << _likelihood;
144 os << "\t SignificanceLevel = ";
145 os << setiosflags(ios::fixed) << setw(7) << setprecision(4);
146 os << _value;
147 os << "\t Status ";
148 switch( status() ) {
149 case Consistency::OK :
150 os << "OK";
151 break;
153 os << "noMeasure";
154 break;
156 os << "underFlow";
157 break;
159 os << "unPhysical";
160 break;
161 default:
162 os << "unknown";
163 }
164 os << endl;
165}
166
167//------------------
168// Static methods --
169//------------------
170
171const Consistency&
173{
174 static Consistency bad(1.,1.);
175 bad.setStatus(noMeasure);
176
177 return bad;
178}
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition: KarLud.h:35
bool operator>(const Consistency &rhs) const
virtual const ConsistencySet * genealogy() const
void setStatus(ConsistentStatus s)
Definition: Consistency.h:107
ConsistentStatus status() const
Definition: Consistency.h:106
double _value
Definition: Consistency.h:134
double _likelihood
Definition: Consistency.h:135
static const Consistency & badMeasurement()
bool operator<(const Consistency &rhs) const
Definition: Consistency.cxx:98
virtual void print(std::ostream &) const
ConsistentSign _sign
Definition: Consistency.h:133
Consistency & operator=(const Consistency &rhs)
Definition: Consistency.cxx:72
ConsistentStatus _stat
Definition: Consistency.h:132
bool operator==(const Consistency &rhs) const
Definition: Consistency.cxx:84