BOSS 8.0.0
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 <assert.h>
28#include <math.h>
29}
30
31//--------------------
32// This C++ Headers --
33//--------------------
34#include <iomanip>
35#include <iostream>
36
37//-----------------------
38// This Class's Header --
39//-----------------------
40#include "ProbTools/Consistency.h"
41using std::endl;
42using std::ios;
43using std::ostream;
44using std::setiosflags;
45using std::setprecision;
46using std::setw;
47
48// ----------------------------------------
49// -- Public Function Member Definitions --
50// ----------------------------------------
51
54
55Consistency::Consistency( double v, double l )
56 : _stat( OK ), _value( v ), _likelihood( l ), _sign( unknown ) {}
57
59 : _stat( rhs._stat )
60 , _value( rhs._value )
62 , _sign( rhs._sign ) {}
63
64// operators
66 if ( this != &rhs )
67 {
68 _stat = rhs._stat;
69 _value = rhs._value;
71 _sign = rhs._sign;
72 }
73 return *this;
74}
75
76bool Consistency::operator==( const Consistency& rhs ) const {
77 bool answer = false;
78 if ( _stat == rhs._stat && _value == rhs._value && _likelihood == rhs._likelihood &&
79 _sign == rhs._sign )
80 { answer = true; }
81
82 return answer;
83}
84
85bool Consistency::operator<( const Consistency& rhs ) const {
86 //
87 // this is not unique...
88 //
89
90 bool answer = false;
91 if ( _stat == OK && rhs._stat == OK )
92 {
93 //
94 // Dare to use consistency for comparison.
95 // Likelihood may give a different answer
96 //
97 if ( _value < rhs._value ) { answer = true; }
98 }
99 else
100 {
101 if ( rhs._stat == OK ) { answer = true; }
102 }
103
104 return answer;
105}
106
107bool Consistency::operator>( const Consistency& rhs ) const {
108 // ghm
109 if ( *this == rhs ) return false;
110 return ( !( *this < rhs ) );
111}
112
113const ConsistencySet* Consistency::genealogy() const { return 0; }
114
115void Consistency::print( ostream& os ) const {
116 os << "Likelihood = ";
117 os << setiosflags( ios::fixed ) << setw( 7 ) << setprecision( 4 );
118 os << _likelihood;
119 os << "\t SignificanceLevel = ";
120 os << setiosflags( ios::fixed ) << setw( 7 ) << setprecision( 4 );
121 os << _value;
122 os << "\t Status ";
123 switch ( status() )
124 {
125 case Consistency::OK: os << "OK"; break;
126 case Consistency::noMeasure: os << "noMeasure"; break;
127 case Consistency::underFlow: os << "underFlow"; break;
128 case Consistency::unPhysical: os << "unPhysical"; break;
129 default: os << "unknown";
130 }
131 os << endl;
132 os << resetiosflags( std::ios::floatfield );
133}
134
135//------------------
136// Static methods --
137//------------------
138
140 static Consistency bad( 1., 1. );
141 bad.setStatus( noMeasure );
142
143 return bad;
144}
**********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
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