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.6 by buchmann, Fri Jul 22 10:15:34 2011 UTC vs.
Revision 1.11 by buchmann, Thu Aug 25 20:19:12 2011 UTC

# Line 169 | Line 169 | ratio_binning.push_back(80);
169   }
170  
171   vector<float> compute_one_upper_limit(float mceff,float mcefferr, int ibin, string mcjzb, bool doobserved=false) {
172 <  float sigma95=0.0,sigma95A=0.0;
172 >  float sigma95=-9.9,sigma95A=-9.9;
173    int nuisancemodel=1;
174 +  if(mceff<0) {
175 +    write_warning(__FUNCTION__,"Cannot compute upper limit in this configuration as the efficiency is negative:");
176 +    dout << "mc efficiency=" << mceff << " +/- " << mcefferr;
177 +    vector<float> sigmas;
178 +    sigmas.push_back(-1);
179 +    sigmas.push_back(-1);
180 +    return sigmas;
181 +  } else {
182    dout << "Now calling : CL95(" << luminosity << "," <<  lumiuncert*luminosity << "," << mceff << "," << mcefferr << "," << Npred[ibin] << "," << Nprederr[ibin] << "," << Nobs[ibin] << "," << false << "," << nuisancemodel<< ") " << endl;
183    sigma95 = CL95(luminosity, lumiuncert*luminosity, mceff, mcefferr, Npred[ibin], Nprederr[ibin], Nobs[ibin], false, nuisancemodel);
184    if(doobserved) {
# Line 181 | Line 189 | vector<float> compute_one_upper_limit(fl
189    sigmas.push_back(sigma95);
190    sigmas.push_back(sigma95A);
191    return sigmas;
192 +  }
193   }
194  
195   void compute_upper_limits_from_counting_experiment(vector<vector<float> > uncertainties,vector<float> jzbcuts, string mcjzb, bool doobserved) {
# Line 201 | Line 210 | void compute_upper_limits_from_counting_
210        float staterr=uncertainties[isample*jzbcuts.size()+ibin][2];
211        float systerr=uncertainties[isample*jzbcuts.size()+ibin][3];
212        float toterr =uncertainties[isample*jzbcuts.size()+ibin][4];
213 <      float observed,null,result;
214 <      fill_result_histos(observed, null,null,null,null,null,null,null,mcjzb,JZBcutat,(int)5,result,(signalsamples.FindSample(signalsamples.collection[isample].filename)),signalsamples);
215 <      observed-=result;//this is the actual excess we see!
216 <      float expected=observed/luminosity;
213 >      float observed,observederr,null,result;
214 >      
215 > //      fill_result_histos(observed,observederr, null,null,null,null,null,null,null,mcjzb,JZBcutat,14000,(int)5,result,(signalsamples.FindSample(signalsamples.collection[isample].filename)),signalsamples);
216 > //      observed-=result;//this is the actual excess we see!
217 > //      float expected=observed/luminosity;
218        
219        dout << "Sample: " << signalsamples.collection[isample].samplename << ", JZB>"<<JZBcutat<< " : " << mceff << " +/- " << staterr << " (stat) +/- " << systerr << " (syst) --> toterr = " << toterr << endl;
220        vector<float> sigmas = compute_one_upper_limit(mceff,toterr,ibin,mcjzb,doobserved);
221        
222        if(doobserved) {
223 <        rows.push_back(any2string(sigmas[0])+";"+any2string(sigmas[1])+";"+"("+any2string(expected)+")");
223 > //      rows.push_back(any2string(sigmas[0])+";"+any2string(sigmas[1])+";"+"("+any2string(expected)+")");
224 >        rows.push_back(any2string(sigmas[0])+";"+any2string(sigmas[1])+";"+"("+any2string(signalsamples.collection[isample].xs)+")");
225          vrows.push_back(sigmas[0]);
226          vrows.push_back(sigmas[1]);
227 <        vrows.push_back(expected);
227 > //      vrows.push_back(expected);
228 >        vrows.push_back(signalsamples.collection[isample].xs);
229        }
230        else {
231 <        rows.push_back(any2string(sigmas[0])+"("+any2string(expected)+")");
231 > //      rows.push_back(any2string(sigmas[0])+"("+any2string(expected)+")");
232 >        rows.push_back(any2string(sigmas[0]));
233          vrows.push_back(sigmas[0]);
234 <        vrows.push_back(expected);
234 >        vrows.push_back(signalsamples.collection[isample].xs);
235 > //      vrows.push_back(expected);
236        }
237      }//end of bin loop
238      limits.push_back(rows);
239      vlimits.push_back(vrows);
240    }//end of sample loop
241 <  dout << endl << endl << "PAS table 3: " << endl << endl;
241 >  dout << endl << endl << "PAS table 3:   (notation: limit [95%CL])" << endl << endl;
242    dout << "\t";
243    for (int irow=0;irow<jzbcuts.size();irow++) {
244      dout << jzbcuts[irow] << "\t";
# Line 247 | Line 261 | void compute_upper_limits_from_counting_
261      for(int irow=0;irow<limits.size();irow++) {
262        dout << limits[irow][0] << "\t";
263        for(int ientry=0;ientry<jzbcuts.size();ientry++) {
264 <        dout << Round(vlimits[irow][2*ientry] / vlimits[irow][2*ientry+1],3)<< "\t";
264 >        dout << "(" << Round(vlimits[irow][2*ientry] / vlimits[irow][2*ientry+1],3)<< "x \\sigma ) \t";
265 > //      dout << Round(vlimits[irow][2*ientry],3) << " / " << Round(vlimits[irow][2*ientry+1],3)<< "\t";
266        }
267        dout << endl;
268      }
269    }//do observed
270    
271    dout << endl << endl << "Final selection efficiencies with total statistical and systematic errors, and corresponding observed and expected upper limits (UL) on ($\\sigma\\times$  BR $\\times$ acceptance) for the LM4 and LM8 scenarios, in the different regions. The last column contains the predicted ($\\sigma \\times $BR$\\times$ acceptance) at NLO obtained from Monte Carlo simulation." << endl;
272 <  dout << "Scenario \t Efficiency [%] \t Upper limits [pb] \t Prediction [pb]" << endl;
272 >  dout << "Scenario \t Efficiency [%] \t Upper limits [pb] \t \\sigma [pb]" << endl;
273    for(int icut=0;icut<jzbcuts.size();icut++) {
274      dout << "Region with JZB>" << jzbcuts[icut] << endl;
275      for(int isample=0;isample<signalsamples.collection.size();isample++) {
276 <      dout << limits[icut][0] << "\t" << Round(100*uncertainties[isample*jzbcuts.size()+icut][1],1) << "+/-" << Round(100*uncertainties[isample*jzbcuts.size()+icut][2],1) << " (stat) +/- " << Round(100*uncertainties[isample*jzbcuts.size()+icut][3],1) << " (syst) \t" << Round((vlimits[isample][2*icut]),3) << "\t" << Round(vlimits[isample][2*icut+1],3) << endl;
276 >      dout << limits[isample][0] << "\t" << Round(100*uncertainties[isample*jzbcuts.size()+icut][1],3) << "+/-" << Round(100*uncertainties[isample*jzbcuts.size()+icut][2],3) << " (stat) +/- " << Round(100*uncertainties[isample*jzbcuts.size()+icut][3],3) << " (syst) \t" << Round((vlimits[isample][2*icut]),3) << "\t" << Round(vlimits[isample][2*icut+1],3) << endl;
277      }
278      dout << endl;
279    }
280    
281 <  write_warning("compute_upper_limits_from_counting_experiment","Still need to update the script");
281 >  write_warning(__FUNCTION__,"Still need to update the script");
282   }
283  
284  
285  
286 < //********************************************************************** new : Limits using SHAPES ***********************************
286 > /********************************************************************** new : Limits using SHAPES ***********************************
287 >
288 >
289 >   SSSSSSSSSSSSSSS hhhhhhh                                                                                      
290 > SS:::::::::::::::Sh:::::h                                                                                      
291 > S:::::SSSSSS::::::Sh:::::h                                                                                      
292 > S:::::S     SSSSSSSh:::::h                                                                                      
293 > S:::::S             h::::h hhhhh         aaaaaaaaaaaaa  ppppp   ppppppppp       eeeeeeeeeeee        ssssssssss  
294 > S:::::S             h::::hh:::::hhh      a::::::::::::a p::::ppp:::::::::p    ee::::::::::::ee    ss::::::::::s  
295 > S::::SSSS          h::::::::::::::hh    aaaaaaaaa:::::ap:::::::::::::::::p  e::::::eeeee:::::eess:::::::::::::s
296 >  SS::::::SSSSS     h:::::::hhh::::::h            a::::app::::::ppppp::::::pe::::::e     e:::::es::::::ssss:::::s
297 >    SSS::::::::SS   h::::::h   h::::::h    aaaaaaa:::::a p:::::p     p:::::pe:::::::eeeee::::::e s:::::s  ssssss
298 >       SSSSSS::::S  h:::::h     h:::::h  aa::::::::::::a p:::::p     p:::::pe:::::::::::::::::e    s::::::s      
299 >            S:::::S h:::::h     h:::::h a::::aaaa::::::a p:::::p     p:::::pe::::::eeeeeeeeeee        s::::::s  
300 >            S:::::S h:::::h     h:::::ha::::a    a:::::a p:::::p    p::::::pe:::::::e           ssssss   s:::::s
301 > SSSSSSS     S:::::S h:::::h     h:::::ha::::a    a:::::a p:::::ppppp:::::::pe::::::::e          s:::::ssss::::::s
302 > S::::::SSSSSS:::::S h:::::h     h:::::ha:::::aaaa::::::a p::::::::::::::::p  e::::::::eeeeeeee  s::::::::::::::s
303 > S:::::::::::::::SS  h:::::h     h:::::h a::::::::::aa:::ap::::::::::::::pp    ee:::::::::::::e   s:::::::::::ss  
304 > SSSSSSSSSSSSSSS    hhhhhhh     hhhhhhh  aaaaaaaaaa  aaaap::::::pppppppp        eeeeeeeeeeeeee    sssssssssss    
305 >                                                         p:::::p                                                
306 >                                                         p:::::p                                                
307 >                                                        p:::::::p                                                
308 >                                                        p:::::::p                                                
309 >                                                        p:::::::p                                                
310 >                                                        ppppppppp                                                
311 >                                                                                                                
312 >
313 > *********************************************************************** new : Limits using SHAPES ***********************************/
314 >
315  
316   void limit_shapes_for_systematic_effect(TFile *limfile, string identifier, string mcjzb, string datajzb, int JES,vector<float> binning, TCanvas *limcan) {
317    dout << "Creatig shape templates ... ";
# Line 414 | Line 457 | void prepare_limits(string mcjzb, string
457    limfile->Close();
458    write_info("prepare_limits","limitfile.root and datacard.txt have been generated. You can now use them to calculate limits!");
459    
460 < }
460 > }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines