1 |
auterman |
1.1 |
//User
|
2 |
|
|
#include "cls.h"
|
3 |
|
|
#include "ConfigFile.h"
|
4 |
|
|
#include "table.h"
|
5 |
|
|
|
6 |
|
|
//system
|
7 |
|
|
#include <string>
|
8 |
|
|
#include <iostream>
|
9 |
|
|
#include <cmath>
|
10 |
|
|
|
11 |
|
|
//ROOT
|
12 |
|
|
#include "TH1.h"
|
13 |
|
|
|
14 |
|
|
using namespace std;
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
void Limit(int argc, char *argv[])
|
18 |
|
|
{
|
19 |
|
|
if (argc<1){
|
20 |
|
|
std::cerr<<"Error: Expected '"<<argv[0]<<" <limit config>'!"<<std::endl;
|
21 |
|
|
exit(1);
|
22 |
|
|
}
|
23 |
|
|
|
24 |
|
|
for (int file=1; file<argc; ++file){
|
25 |
|
|
std::cout << "opening: "<<argv[file]<<std::endl;
|
26 |
|
|
ConfigFile config(argv[file]);
|
27 |
|
|
int ndata = config.read<int>("data");
|
28 |
|
|
double nback = config.read<double>("background");
|
29 |
|
|
double bkgUncert = config.read<double>("background.uncertainty");
|
30 |
|
|
double signal = config.read<double>("signal");
|
31 |
|
|
double sigUncert = config.read<double>("signal.uncertainty");
|
32 |
|
|
char * n = new char[32];
|
33 |
|
|
sprintf(n,"bkgd%d",file); TH1 * bgd = new TH1F(n, "",1,0,1);
|
34 |
|
|
sprintf(n,"data%d",file); TH1 * data = new TH1F(n, "",1,0,1);
|
35 |
|
|
sprintf(n,"sig%d", file); TH1 * sig = new TH1F(n,"",1,0,1);
|
36 |
|
|
data->SetBinContent(1,ndata);
|
37 |
|
|
data->SetBinError(1,sqrt(ndata));
|
38 |
|
|
bgd->SetBinContent(1,nback);
|
39 |
|
|
bgd->SetBinError(1,bkgUncert);
|
40 |
|
|
sig->SetBinContent(1,signal);
|
41 |
|
|
sig->SetBinError(1,sigUncert);
|
42 |
|
|
|
43 |
|
|
cls limit_sys("cls_limit.ps",
|
44 |
|
|
sig, // signal with total syst. and stat. errors
|
45 |
|
|
bgd, // with total syst. and stat. errors
|
46 |
|
|
data);
|
47 |
|
|
limit_sys.SetStat(true); //Consider Bin-Errors (containing the full syst. uncertainties)
|
48 |
|
|
limit_sys.SetNMC(50000); //number of pseudo-experiments for each CL calculation
|
49 |
|
|
//limit_sys.Draw();
|
50 |
|
|
|
51 |
|
|
try {
|
52 |
|
|
limit_sys.WriteResult( &config );
|
53 |
|
|
}
|
54 |
|
|
catch(exception& e){
|
55 |
|
|
cout << "Exception catched: " << e.what();
|
56 |
|
|
}
|
57 |
|
|
|
58 |
|
|
//write stuff:
|
59 |
|
|
time_t rawtime;
|
60 |
|
|
struct tm * timeinfo;
|
61 |
|
|
time ( &rawtime );
|
62 |
|
|
timeinfo = localtime ( &rawtime );
|
63 |
|
|
ofstream ofile;
|
64 |
|
|
ofile.open (argv[file]);
|
65 |
|
|
ofile << config.getComment() << asctime (timeinfo)
|
66 |
|
|
<< config.getComment()<< "\n"
|
67 |
|
|
<< config;
|
68 |
|
|
}
|
69 |
|
|
}
|
70 |
|
|
|
71 |
|
|
|
72 |
|
|
int main(int argc, char *argv[])
|
73 |
|
|
{
|
74 |
|
|
Limit(argc,argv);
|
75 |
|
|
}
|