2 |
|
#include <fstream> |
3 |
|
#include <vector> |
4 |
|
#include <algorithm> |
5 |
+ |
#include <assert.h> |
6 |
|
|
7 |
|
class ShapeDroplet{ |
8 |
|
public: |
18 |
|
float PDF; |
19 |
|
float toterr; |
20 |
|
float staterr; |
21 |
+ |
float SignalIntegral; |
22 |
|
|
23 |
|
void saveDroplet(std::string filename);//save droplet to file |
24 |
|
void readDroplet(std::string filename);//get droplet from file |
27 |
|
}; |
28 |
|
|
29 |
|
ShapeDroplet::ShapeDroplet() { |
30 |
< |
observed=-1;expected=-1;expectedPlus1Sigma=-1;expectedPlus2Sigma=-1;expectedMinus1Sigma=-1;expectedMinus2Sigma=-1;JES=-1;JSU=-1;PDF=-1;toterr=-1;staterr=-1; |
30 |
> |
observed=-1;expected=-1;expectedPlus1Sigma=-1;expectedPlus2Sigma=-1;expectedMinus1Sigma=-1;expectedMinus2Sigma=-1;JES=-1;JSU=-1;PDF=-1;toterr=-1;staterr=-1;SignalIntegral=1; |
31 |
|
} |
32 |
|
|
33 |
|
std::ostream &operator<<(std::ostream &ostr, ShapeDroplet v) |
34 |
|
{ |
35 |
< |
return ostr << " ShapeDroplet : Limits::observed : " << v.observed << " \n " << |
36 |
< |
" Limits::expected : " << v.expected << " \n " << |
37 |
< |
" Limits::1 sigma : [" << v.expectedMinus1Sigma << " , " << v.expectedPlus1Sigma << " ] \n " << |
38 |
< |
" Limits::2 sigma : [" << v.expectedMinus2Sigma << " , " << v.expectedPlus2Sigma << " ] \n " << |
39 |
< |
" Systematics::JES : " << v.JES << " \n " << |
40 |
< |
" Systematics::JSU : " << v.JSU << " \n " << |
41 |
< |
" Systematics::PDF : " << v.PDF << " \n " << |
42 |
< |
" Systematics::toterr : " << v.toterr << " \n " << |
43 |
< |
" Systematics::staterr : " << v.staterr << " \n "; |
35 |
> |
return ostr << " ShapeDroplet : Limits::observed : " << v.observed << " (normalized: " << v.observed/v.SignalIntegral << ") \n " << |
36 |
> |
" Limits::expected : " << v.expected << " (normalized: " << v.expected/v.SignalIntegral << ") \n " << |
37 |
> |
" Limits::1 sigma : [" << v.expectedMinus1Sigma << " , " << v.expectedPlus1Sigma << " ] \n " << |
38 |
> |
" Limits::2 sigma : [" << v.expectedMinus2Sigma << " , " << v.expectedPlus2Sigma << " ] \n " << |
39 |
> |
" Systematics::JES : " << v.JES << " \n " << |
40 |
> |
" Systematics::JSU : " << v.JSU << " \n " << |
41 |
> |
" Systematics::PDF : " << v.PDF << " \n " << |
42 |
> |
" Systematics::toterr : " << v.toterr << " \n " << |
43 |
> |
" Systematics::staterr : " << v.staterr << " \n " << |
44 |
> |
" Systematics::SignalIntegral : " << v.SignalIntegral << " \n "; |
45 |
|
} |
46 |
|
|
47 |
|
void ShapeDroplet::saveDroplet(std::string filename) { |
48 |
+ |
assert(filename!=""); |
49 |
|
std::ofstream myreport(filename.c_str()); |
50 |
< |
myreport<<this->observed<<";"<<this->expected<<";"<<this->expectedMinus1Sigma<<";"<<this->expectedPlus1Sigma<<";"<<this->expectedMinus2Sigma<<";"<<this->expectedPlus2Sigma<<";"<<this->JES<<";"<<this->JSU<<";"<<this->PDF<<";"<<this->toterr<<";"<<this->staterr<<";"; |
50 |
> |
myreport<<this->observed<<";"<<this->expected<<";"<<this->expectedMinus1Sigma<<";"<<this->expectedPlus1Sigma<<";"<<this->expectedMinus2Sigma<<";"<<this->expectedPlus2Sigma<<";"<<this->JES<<";"<<this->JSU<<";"<<this->PDF<<";"<<this->toterr<<";"<<this->staterr<<";"<<this->SignalIntegral<<";"; |
51 |
|
myreport.close(); |
52 |
|
} |
53 |
|
|
72 |
|
myreport.getline(c,255); |
73 |
|
this->fill_limit_vector((std::string)c,lresults); |
74 |
|
} |
75 |
< |
if(lresults.size()<10) std::cerr << "Watch out, stored limit droplet from " << filename << " does not contain sufficient information" << std::endl; |
75 |
> |
if(lresults.size()<11) std::cerr << "Watch out, stored limit droplet from " << filename << " does not contain sufficient information" << std::endl; |
76 |
|
else { |
77 |
|
this->observed=lresults[0]; |
78 |
|
this->expected=lresults[1]; |
85 |
|
this->PDF=lresults[8]; |
86 |
|
this->toterr=lresults[9]; |
87 |
|
this->staterr=lresults[10]; |
88 |
+ |
this->SignalIntegral=lresults[11]; |
89 |
|
}//result vector is of right size |
90 |
|
}//report exists |
91 |
|
myreport.close(); |