ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/AnalysisFramework/Plotting/Modules/LimitCalculation.C
(Generate patch)

Comparing UserCode/cbrown/AnalysisFramework/Plotting/Modules/LimitCalculation.C (file contents):
Revision 1.19 by buchmann, Fri Sep 2 12:55:22 2011 UTC vs.
Revision 1.20 by buchmann, Tue Sep 6 10:39:13 2011 UTC

# Line 15 | Line 15
15   #include <TF1.h>
16   #include <TSQLResult.h>
17   #include <TProfile.h>
18 + #include <TSystem.h>
19 + #include "LimitDroplet.C"
20  
21   //#include "TTbar_stuff.C"
22   using namespace std;
# Line 170 | Line 172 | ratio_binning.push_back(80);
172  
173   vector<float> compute_one_upper_limit(float mceff,float mcefferr, int ibin, string mcjzb, string plotfilename, bool doobserved) {
174    float sigma95=-9.9,sigma95A=-9.9;
173  int nuisancemodel=0;
175   /*
176   USAGE OF ROOSTATS_CL95
177   " Double_t             limit = roostats_cl95(ilum, slum, eff, seff, bck, sbck, n, gauss = false, nuisanceModel, method, plotFileName, seed); \n"
# Line 194 | Line 195 | USAGE OF ROOSTATS_CL95
195      return sigmas;
196    } else {
197      int nlimittoysused=1;
198 +    
199 +    ///------------------------------------------ < NEW > ----------------------------------------------------------
200 +    
201 +    int secondssince1970=time(NULL);
202 +    stringstream repname;
203 +    repname << PlottingSetup::cbafbasedir << "/exchange/report_" << secondssince1970 << "_"<<plotfilename<< "__"<< ".txt";
204 +    
205 +      /* - report filename [1]
206 +         - luminosity [2]
207 +         - lumi uncert [3]
208 +         - MC efficiency [4]
209 +         - MC efficiency error [5]
210 +         - Npred [6]
211 +         - Nprederr [7]
212 +         - Nobs [8]
213 +         - JZB cut [9]
214 +         - plot name  [10]*/
215 +
216 +  cout << "Calling limit capsule instead of calling : CL95(" << luminosity << "," <<  lumiuncert*luminosity << "," << mceff << "," << mcefferr << "," << Npred[ibin] << "," << Nprederr[ibin] << "," << Nobs[ibin] << "," << false << "," << nuisancemodel<< ") " << endl;
217 +    
218 +    stringstream command;
219 +    command << PlottingSetup::cbafbasedir << "/DistributedModelCalculations/Limits/LimitCapsule.exec " << repname.str() << " " << luminosity << " " << luminosity*lumiuncert << " " << mceff << " " << mcefferr << " " << Npred[ibin] << " " << Nprederr[ibin] << " " << Nobs[ibin] << " " << -1 << " " << plotfilename;
220 +    std::cout << command.str() << std::endl;
221 +    
222 +    int retval = 256;
223 +    int attempts=0;
224 +    while(!(retval==0||attempts>=5)) {//try up to 5 times
225 +        attempts++;
226 +        cout << "Starting limit calculation (LimitCapsule) now : Attempt " << attempts << endl;
227 +        retval=gSystem->Exec(command.str().c_str());
228 +    }
229 +    
230 +    LimitDroplet limres;
231 +    limres.readDroplet(repname.str());
232 +    cout << limres << endl;
233 +    remove(repname.str().c_str());
234 +    sigma95=limres.expected;
235 +
236 +    
237 +    ///------------------------------------------ < /NEW > ----------------------------------------------------------
238      //if(doobserved) nlimittoysused=nlimittoys;
239 <    nlimittoysused=nlimittoys;
240 <  dout << "Now calling : CL95(" << luminosity << "," <<  lumiuncert*luminosity << "," << mceff << "," << mcefferr << "," << Npred[ibin] << "," << Nprederr[ibin] << "," << Nobs[ibin] << "," << false << "," << nuisancemodel<< ") " << endl;
241 <  sigma95 = CL95(luminosity, lumiuncert*luminosity, mceff, mcefferr, Npred[ibin], Nprederr[ibin], Nobs[ibin], false, nuisancemodel);
242 <  sigma95 = CL95(luminosity, lumiuncert*luminosity, mceff, mcefferr, Npred[ibin], Nprederr[ibin], Nobs[ibin], false, nuisancemodel);
239 > //    nlimittoysused=nlimittoys;
240 > //  dout << "Now calling : CL95(" << luminosity << "," <<  lumiuncert*luminosity << "," << mceff << "," << mcefferr << "," << Npred[ibin] << "," << Nprederr[ibin] << "," << Nobs[ibin] << "," << false << "," << nuisancemodel<< ") " << endl;
241 > //  sigma95 = CL95(luminosity, lumiuncert*luminosity, mceff, mcefferr, Npred[ibin], Nprederr[ibin], Nobs[ibin], false, nuisancemodel);
242 > //  sigma95 = CL95(luminosity, lumiuncert*luminosity, mceff, mcefferr, Npred[ibin], Nprederr[ibin], Nobs[ibin], false, nuisancemodel);
243    
244   /*  dout << "Now calling : roostats_cl95(" << luminosity << "," << lumiuncert*luminosity << ","<<mceff <<","<<mcefferr<<","<<Npred[ibin]<<","<<Nprederr[ibin] << ",n=" << nlimittoysused << ",gauss=" << false << ",nuisanceModel="<<nuisancemodel<<",method="<<limitmethod<<",plotfilename="<<plotfilename<<",seed=0) " << endl;
245   /*  dout << "Now calling : roostats_limit(" << luminosity << "," << lumiuncert*luminosity << ","<<mceff <<","<<mcefferr<<","<<Npred[ibin]<<","<<Nprederr[ibin] << ",n=" << nlimittoysused << ",gauss=" << false << ", nuisanceModel="<<nuisancemodel<<",method="<<limitmethod<<",plotfilename="<<plotfilename<<",seed=1) " << endl;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines