1 |
#include <iostream>
|
2 |
#include <TMath.h>
|
3 |
#define YieldClassLoaded
|
4 |
|
5 |
using namespace std;
|
6 |
|
7 |
class Yield
|
8 |
{
|
9 |
public:
|
10 |
float value;
|
11 |
float syserror;
|
12 |
float staterror;
|
13 |
|
14 |
Yield(float value, float syserror, float staterr);
|
15 |
float getValue();
|
16 |
float getSysError();
|
17 |
float getStatError();
|
18 |
};
|
19 |
|
20 |
Yield::Yield(float newvalue = 0, float newsyserror = -999, float newstaterror = -998) : value(newvalue) {
|
21 |
if(newstaterror!=-998) staterror=newstaterror;
|
22 |
else staterror = TMath::Sqrt(newvalue);
|
23 |
|
24 |
if(newsyserror!=-999) syserror=newsyserror;
|
25 |
else syserror = 0; // if not specified we assume 0 systematic error
|
26 |
}
|
27 |
|
28 |
float Yield::getValue() {
|
29 |
return this->value;
|
30 |
}
|
31 |
|
32 |
float Yield::getSysError() {
|
33 |
return this->syserror;
|
34 |
}
|
35 |
|
36 |
float Yield::getStatError() {
|
37 |
return this->staterror;
|
38 |
}
|
39 |
|
40 |
std::ostream &operator<<(std::ostream &ostr, Yield y)
|
41 |
{
|
42 |
return ostr << y.value << " +/- " << y.syserror << "(sys) +/- " << y.staterror << "(stat)";
|
43 |
}
|