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.8 by buchmann, Wed Jul 27 12:16:15 2011 UTC vs.
Revision 1.12 by buchmann, Fri Aug 26 10:37:21 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 << endl << "_________________________________________________________________________________________________" << endl << endl;
242 >  dout << endl << endl << "PAS table 3:   (notation: limit [95%CL])" << endl << endl;
243    dout << "\t";
244    for (int irow=0;irow<jzbcuts.size();irow++) {
245      dout << jzbcuts[irow] << "\t";
# Line 232 | Line 247 | void compute_upper_limits_from_counting_
247    dout << endl;
248    for(int irow=0;irow<limits.size();irow++) {
249      for(int ientry=0;ientry<limits[irow].size();ientry++) {
250 <      dout << limits[irow][ientry] << "\t";
250 >      if (limits[irow][ientry]>0) dout << limits[irow][ientry] << "\t";
251 >      else dout << " (N/A) \t";
252      }
253      dout << endl;
254    }
255    
256    if(!doobserved) {
257 <    dout << endl << endl << "LIMITS: " << endl;
258 <    dout << "\t";
257 >    dout << endl << endl << "LIMITS: (Tex)" << endl;
258 >    tout << "\\begin{tabular}{ | l | ";
259 >    for (int irow=0;irow<jzbcuts.size();irow++) tout << " l |";
260 >    tout << "} " << endl << " \\hline " << endl << "& \t ";
261      for (int irow=0;irow<jzbcuts.size();irow++) {
262 <      dout << jzbcuts[irow] << "\t";
262 >      tout << "JZB $>$ " << jzbcuts[irow] << " GeV & \t ";
263      }
264 <    dout << endl;
264 >    tout << " \\\\ \\hline " << endl;
265      for(int irow=0;irow<limits.size();irow++) {
266 <      dout << limits[irow][0] << "\t";
266 >      tout << limits[irow][0] << " \t";
267        for(int ientry=0;ientry<jzbcuts.size();ientry++) {
268 <        dout << Round(vlimits[irow][2*ientry] / vlimits[irow][2*ientry+1],3)<< "\t";
268 >        if(vlimits[irow][2*ientry]>0) tout << " & " << Round(vlimits[irow][2*ientry],2) << " \t (" << Round(vlimits[irow][2*ientry] / vlimits[irow][2*ientry+1],3)<< "x \\sigma ) \t";
269 >        else tout << " & ( N / A ) \t";
270 > //      dout << Round(vlimits[irow][2*ientry],3) << " / " << Round(vlimits[irow][2*ientry+1],3)<< "\t";
271        }
272 <      dout << endl;
272 >      tout << " \\\\ \\hline " << endl;
273      }
274 +      tout << "\\end{tabular}" << endl;
275    }//do observed
276    
277    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;
278 <  dout << "Scenario \t Efficiency [%] \t Upper limits [pb] \t Prediction [pb]" << endl;
278 >  dout << "Scenario \t Efficiency [%] \t Upper limits [pb] \t \\sigma [pb]" << endl;
279    for(int icut=0;icut<jzbcuts.size();icut++) {
280      dout << "Region with JZB>" << jzbcuts[icut] << endl;
281      for(int isample=0;isample<signalsamples.collection.size();isample++) {
282 <      dout << limits[isample][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;
282 >      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;
283      }
284      dout << endl;
285    }
286    
287 <  write_warning("compute_upper_limits_from_counting_experiment","Still need to update the script");
287 >  write_warning(__FUNCTION__,"Still need to update the script");
288   }
289  
290  
# Line 442 | Line 463 | void prepare_limits(string mcjzb, string
463    limfile->Close();
464    write_info("prepare_limits","limitfile.root and datacard.txt have been generated. You can now use them to calculate limits!");
465    
466 < }
466 > }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines