ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/AnalysisFramework/DistributedModelCalculations/Limits/NewLimitCapsule.C
Revision: 1.5
Committed: Tue Nov 8 15:57:29 2011 UTC (13 years, 6 months ago) by buchmann
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +0 -0 lines
State: FILE REMOVED
Error occurred while calculating annotation data.
Log Message:
Removed all limits/efficiency plotting scripts as they have been supersededby PlotScanResults.C

File Contents

# Content
1 #include <iostream>
2 #include <vector>
3 #include <sys/stat.h>
4 #include "../../Plotting/Modules/LimitDroplet.C"
5 #include "../../Plotting/Modules/GeneralToolBox.C"
6 #include "../../Plotting/Modules/SampleClass.C"
7 #include "../../Plotting/Modules/Setup.C"
8 //#include "../../Plotting/Modules/external/cl95cms.c"
9
10 #include <TSystem.h>
11 #include <TROOT.h>
12
13 /*
14
15 This capsule computes the limits; the advantage is that in this way the capsule can fail (segfault/...) without problems, while the main program is not affected.
16
17 */
18
19 int main(int nargs, char* args[]) {
20 /* we obtain lumi etc. directly from the template; the only things passed are the following:
21 - report filename [1]
22 - luminosity [2]
23 - lumi uncert [3]
24 - MC efficiency [4]
25 - MC efficiency error [5]
26 - Npred [6]
27 - Nprederr [7]
28 - Nobs [8]
29 - JZB cut [9]
30 - plot name [10]
31 */
32
33 if(nargs<12) {
34 dout << "NOT ENOUGH ARGUMENTS!" << endl;
35 dout << "You're supposed to provide: " << endl;
36 dout << "LUMI LUMIUNCERT MCEFF MCEFFERR NPRED NPREDERR NOBS JZBCUT PLOTNAME DOEXPECTED" << endl;
37 return -1;
38 }
39
40 string reportname=args[1];
41 float luminosity=atof(args[2]);
42 float lumiuncert=atof(args[3]);
43 float mceff=atof(args[4]);
44 float mcefferr=atof(args[5]);
45 float Npred=atof(args[6]);
46 float Nprederr=atof(args[7]);
47 float Nobs=atof(args[8]);
48 int JZBcutused=atoi(args[9]);
49 string plotname=args[10];
50 int doexpected=atoi(args[11]);
51
52 dout << "Should expected limits be calculated? " << doexpected << endl;
53
54 /*
55 // TODO:
56 - *everything* needs to have absolute paths
57 - need to create a directory for every process (otherwise ws.root's will be overwritten!) --> Good possibility: use the reportname and add some time specific string.
58 */
59 char currentpath[1024];
60 char *path = getcwd(currentpath,1024);
61 extract_cbaf_dir(currentpath);
62 stringstream loadroostats;
63 loadroostats << ".L " << PlottingSetup::cbafbasedir << "/Plotting/Modules/external/roostats_cl95.C+";
64 stringstream loadLimitDroplet;
65 loadLimitDroplet << ".L " << PlottingSetup::cbafbasedir << "/Plotting/Modules/LimitDroplet.C";
66
67 gROOT->ProcessLine(loadroostats.str().c_str());
68 gROOT->ProcessLine(loadLimitDroplet.str().c_str());
69
70 stringstream allargs95;
71 allargs95 << "("<<luminosity<<","<<lumiuncert<<","<<mceff<<","<<mcefferr<<","<<Npred<<","<<Nprederr<<","<<Nobs<<","<<false<<","<<PlottingSetup::nuisancemodel<<",\""<<PlottingSetup::limitmethod<<"\",\""<<plotname<<"\"";
72 stringstream allargslm;
73 allargslm << "("<<luminosity<<","<<lumiuncert<<","<<mceff<<","<<mcefferr<<","<<Npred<<","<<Nprederr<<","<<Nobs<<","<<false<<","<<PlottingSetup::nuisancemodel<<",\""<<PlottingSetup::limitmethod<<"\",\"" << plotname << "\",0";
74
75 stringstream obscommand;
76 obscommand <<"float observed=roostats_cl95"<<allargs95.str()<<");";
77 if(doexpected==0) gROOT->ProcessLine(obscommand.str().c_str());
78 stringstream expcommand;
79 expcommand <<"LimitResult limit = roostats_limit"<<allargslm.str()<<");";
80 dout << expcommand.str() << endl;
81 if(doexpected!=0) gROOT->ProcessLine(expcommand.str().c_str());
82 gROOT->ProcessLine("LimitDroplet limres;");
83 stringstream setjzb;
84 setjzb<<"limres.JZB="<<JZBcutused<<";";
85 gROOT->ProcessLine(setjzb.str().c_str());
86 if(doexpected==0) gROOT->ProcessLine("limres.observed=observed;");
87
88 if(doexpected!=0) {
89 gROOT->ProcessLine("limres.upper68=limit.GetOneSigmaHighRange();");
90 gROOT->ProcessLine("limres.lower68=limit.GetOneSigmaLowRange();");
91 gROOT->ProcessLine("limres.expected=limit.GetExpectedLimit();");
92 gROOT->ProcessLine("limres.upper95= limit.GetTwoSigmaHighRange();");
93 gROOT->ProcessLine("limres.lower95=limit.GetTwoSigmaLowRange();");
94 gROOT->ProcessLine("limres.observed=limit.GetObservedLimit();");
95 }
96
97 stringstream savecommand;
98 savecommand << "limres.saveDroplet(\""<<reportname<<"\");";
99 gROOT->ProcessLine(savecommand.str().c_str());
100 gROOT->ProcessLine(".q");
101
102
103 return 0;
104 }