ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/AnalysisFramework/DistributedModelCalculations/Limits/LimitCapsule.C
Revision: 1.1
Committed: Tue Sep 6 10:39:13 2011 UTC (13 years, 8 months ago) by buchmann
Content type: text/plain
Branch: MAIN
Log Message:
Implemented an 'external' capsule called LimitCapsule to calculate the limits. If this capsule fails, it returns a non-zero exit code, prompting the script to run it again (up to five times).

File Contents

# User Rev Content
1 buchmann 1.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    
11     /*
12    
13     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.
14    
15     */
16    
17     int main(int nargs, char* args[]) {
18     /* we obtain lumi etc. directly from the template; the only things passed are the following:
19     - report filename [1]
20     - luminosity [2]
21     - lumi uncert [3]
22     - MC efficiency [4]
23     - MC efficiency error [5]
24     - Npred [6]
25     - Nprederr [7]
26     - Nobs [8]
27     - JZB cut [9]
28     - plot name [10]
29     */
30    
31     if(nargs<11) {
32     cout << "NOT ENOUGH ARGUMENTS!" << endl;
33     return -1;
34     }
35    
36     string reportname=args[1];
37     float luminosity=atof(args[2]);
38     float lumiuncert=atof(args[3]);
39     float mceff=atof(args[4]);
40     float mcefferr=atof(args[5]);
41     float Npred=atof(args[6]);
42     float Nprederr=atof(args[7]);
43     float Nobs=atof(args[8]);
44     int JZBcutused=atoi(args[9]);
45     string plotname=args[10];
46    
47     std::cout << "Now calling : CL95(" << luminosity << "," << lumiuncert << "," << mceff << "," << mcefferr << "," << Npred << "," << Nprederr << "," << Nobs << "," << false << "," << PlottingSetup::nuisancemodel<< ") " << std::endl;
48    
49     float sigma95 = CL95(luminosity, lumiuncert, mceff, mcefferr, Npred, Nprederr, Nobs, false, PlottingSetup::nuisancemodel);
50     LimitDroplet limres;
51     limres.JZB=JZBcutused;
52     limres.upper68=-2;
53     limres.lower68=-3;
54     limres.expected=sigma95;
55     limres.observed=-5;
56     limres.upper95=-6;
57     limres.lower95=-7;
58     //needs to be updated once we switch to roostats :-) at that point we'll have all this information.
59     limres.saveDroplet(reportname);
60    
61     return 0;
62     }