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.2 by buchmann, Tue Jul 19 15:04:16 2011 UTC vs.
Revision 1.3 by buchmann, Wed Jul 20 08:52:17 2011 UTC

# Line 22 | Line 22 | using namespace PlottingSetup;
22  
23  
24   void rediscover_the_top(string mcjzb, string datajzb) {
25 <  cout << "Hi! today we are going to (try to) rediscover the top!" << endl;
25 >  dout << "Hi! today we are going to (try to) rediscover the top!" << endl;
26    TCanvas *c3 = new TCanvas("c3","c3");
27    c3->SetLogy(1);
28    vector<float> binning;
# Line 62 | Line 62 | void rediscover_the_top(string mcjzb, st
62    TH1F *datapredictiont = allsamples.Draw("datapredictiont",    "-"+datajzb, nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,data,  luminosity);
63    TH1F *datapredictiono = allsamples.Draw("datapredictiono",    "-"+datajzb, nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,data,  luminosity);
64    datapredictiont->Add(datapredictiono,-1);
65 <  cout << "Second way of doing this !!!! Analytical shape to the left :-D" << endl;
65 >  dout << "Second way of doing this !!!! Analytical shape to the left :-D" << endl;
66    vector<TF1*> functions = do_cb_fit_to_plot(datapredictiont,10);
67    datapredictiont->SetMarkerColor(kRed);
68    datapredictiont->SetLineColor(kRed);
# Line 141 | Line 141 | ratio_binning.push_back(80);
141    ratio->Divide(datapredictiontb);
142    
143    for (int i=0;i<=ratio_binning.size();i++) {
144 <    cout << observedtb->GetBinLowEdge(i+1) << ";"<<observedtb->GetBinContent(i+1) << ";" << datapredictiontb->GetBinContent(i+1) << " --> " << ratio->GetBinContent(i+1) << "+/-" << ratio->GetBinError(i+1) << endl;
144 >    dout << observedtb->GetBinLowEdge(i+1) << ";"<<observedtb->GetBinContent(i+1) << ";" << datapredictiontb->GetBinContent(i+1) << " --> " << ratio->GetBinContent(i+1) << "+/-" << ratio->GetBinError(i+1) << endl;
145    }
146    
147   //  ratio->Divide(datapredictiontb);
# Line 204 | Line 204 | void calculate_upper_limits(string mcjzb
204  
205   vector<float> compute_one_upper_limit(float mceff,float mcefferr, int ibin, string mcjzb, bool doobserved=false) {
206    float sigma95=0.0,sigma95A=0.0;
207 <  cout << "Now calling : CL95(" << luminosity << "," <<  lumiuncert*luminosity << "," << mceff << "," << mcefferr << "," << Npred[ibin] << "," << Nprederr[ibin] << "," << Nobs[ibin] << "," << false << "," << 1<< ") " << endl;
207 >  dout << "Now calling : CL95(" << luminosity << "," <<  lumiuncert*luminosity << "," << mceff << "," << mcefferr << "," << Npred[ibin] << "," << Nprederr[ibin] << "," << Nobs[ibin] << "," << false << "," << 1<< ") " << endl;
208    sigma95 = CL95(luminosity, lumiuncert*luminosity, mceff, mcefferr, Npred[ibin], Nprederr[ibin], Nobs[ibin], false, 1);
209    if(doobserved) {
210 <    cout << "Now calling : CL95A(" << luminosity << "," <<  lumiuncert*luminosity << "," << mceff << "," << mcefferr << "," << Npred[ibin] << "," << Nprederr[ibin] << "," << 1<< ") " << endl;
210 >    dout << "Now calling : CL95A(" << luminosity << "," <<  lumiuncert*luminosity << "," << mceff << "," << mcefferr << "," << Npred[ibin] << "," << Nprederr[ibin] << "," << 1<< ") " << endl;
211      sigma95A = CLA(luminosity, lumiuncert*luminosity, mceff, mcefferr, Npred[ibin], Nprederr[ibin], 1);
212    }
213    vector<float> sigmas;
# Line 217 | Line 217 | vector<float> compute_one_upper_limit(fl
217   }
218  
219   void compute_upper_limits_from_counting_experiment(vector<vector<float> > uncertainties,vector<float> jzbcuts, string mcjzb, bool doobserved) {
220 <  cout << "Doing counting experiment ... " << endl;
220 >  dout << "Doing counting experiment ... " << endl;
221    vector<vector<string> > limits;
222    vector<vector<float> > vlimits;
223    
# Line 225 | Line 225 | void compute_upper_limits_from_counting_
225    for(int isample=0;isample<signalsamples.collection.size();isample++) {
226      vector<string> rows;
227      vector<float> vrows;
228 <    cout << "Considering sample " << signalsamples.collection[isample].samplename << endl;
228 >    dout << "Considering sample " << signalsamples.collection[isample].samplename << endl;
229      rows.push_back(signalsamples.collection[isample].samplename);
230      for(int ibin=0;ibin<jzbcuts.size();ibin++) {
231 <      cout << "_________________________________________________________________________________" << endl;
231 >      dout << "_________________________________________________________________________________" << endl;
232        float JZBcutat=uncertainties[isample*jzbcuts.size()+ibin][0];
233        float mceff=uncertainties[isample*jzbcuts.size()+ibin][1];
234        float staterr=uncertainties[isample*jzbcuts.size()+ibin][2];
# Line 239 | Line 239 | void compute_upper_limits_from_counting_
239        observed-=result;//this is the actual excess we see!
240        float expected=observed/luminosity;
241        
242 <      cout << "Sample: " << signalsamples.collection[isample].samplename << ", JZB>"<<JZBcutat<< " : " << mceff << " +/- " << staterr << " (stat) +/- " << systerr << " (syst) --> toterr = " << toterr << endl;
242 >      dout << "Sample: " << signalsamples.collection[isample].samplename << ", JZB>"<<JZBcutat<< " : " << mceff << " +/- " << staterr << " (stat) +/- " << systerr << " (syst) --> toterr = " << toterr << endl;
243        vector<float> sigmas = compute_one_upper_limit(mceff,toterr,ibin,mcjzb,doobserved);
244        
245        if(doobserved) {
# Line 257 | Line 257 | void compute_upper_limits_from_counting_
257      limits.push_back(rows);
258      vlimits.push_back(vrows);
259    }//end of sample loop
260 <  cout << endl << endl << "PAS table 3: " << endl << endl;
261 <  cout << "\t";
260 >  dout << endl << endl << "PAS table 3: " << endl << endl;
261 >  dout << "\t";
262    for (int irow=0;irow<jzbcuts.size();irow++) {
263 <    cout << jzbcuts[irow] << "\t";
263 >    dout << jzbcuts[irow] << "\t";
264    }
265 <  cout << endl;
265 >  dout << endl;
266    for(int irow=0;irow<limits.size();irow++) {
267      for(int ientry=0;ientry<limits[irow].size();ientry++) {
268 <      cout << limits[irow][ientry] << "\t";
268 >      dout << limits[irow][ientry] << "\t";
269      }
270 <    cout << endl;
270 >    dout << endl;
271    }
272    
273    if(!doobserved) {
274 <    cout << endl << endl << "LIMITS: " << endl;
275 <    cout << "\t";
274 >    dout << endl << endl << "LIMITS: " << endl;
275 >    dout << "\t";
276      for (int irow=0;irow<jzbcuts.size();irow++) {
277 <      cout << jzbcuts[irow] << "\t";
277 >      dout << jzbcuts[irow] << "\t";
278      }
279 <    cout << endl;
279 >    dout << endl;
280      for(int irow=0;irow<limits.size();irow++) {
281 <      cout << limits[irow][0] << "\t";
281 >      dout << limits[irow][0] << "\t";
282        for(int ientry=0;ientry<jzbcuts.size();ientry++) {
283 <        cout << Round(vlimits[irow][2*ientry] / vlimits[irow][2*ientry+1],3)<< "\t";
283 >        dout << Round(vlimits[irow][2*ientry] / vlimits[irow][2*ientry+1],3)<< "\t";
284        }
285 <      cout << endl;
285 >      dout << endl;
286      }
287    }//do observed
288 +  
289 +  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;
290 +  dout << "Scenario \t Efficiency [%] \t Upper limits [pb] \t Prediction [pb]" << endl;
291 +  for(int icut=0;icut<jzbcuts.size();icut++) {
292 +    dout << "Region with JZB>" << jzbcuts[icut] << endl;
293 +    for(int isample=0;isample<signalsamples.collection.size();isample++) {
294 +      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;
295 +    }
296 +    dout << endl;
297 +  }
298   }
299  
300   void susy_scan_axis_labeling(TH2F *histo) {
# Line 353 | Line 363 | void scan_susy_space(string mcjzb, strin
363        puresignal->Scale(ndata/(20*puresignal->Integral()));//normalizing it to 5% of the data
364        stringstream saveas;
365        saveas<<"Model_Scan/m0_"<<m0<<"__m23_"<<m23;
366 <      cout << "PLEASE KEEP IN MIND THAT SIGNAL CONTAMINATION IS NOT REALLY TAKEN CARE OF YET DUE TO LOW STATISTICS! SHOULD BE SOMETHING LIKE THIS : "<< endl;
366 >      dout << "PLEASE KEEP IN MIND THAT SIGNAL CONTAMINATION IS NOT REALLY TAKEN CARE OF YET DUE TO LOW STATISTICS! SHOULD BE SOMETHING LIKE THIS : "<< endl;
367   //        TH1F *signalpredlo   = allsamples.Draw("signalpredlo",  "-"+mcjzb,  binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,mc,  luminosity,allsamples.FindSample("LM4"));
368   //        TH1F *signalpredro   = allsamples.Draw("signalpredro",      mcjzb,  binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,mc,  luminosity,allsamples.FindSample("LM4"));
369   //        TH1F *puredata       = allsamples.Draw("puredata",          datajzb,binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,data,luminosity);
# Line 361 | Line 371 | void scan_susy_space(string mcjzb, strin
371   //        signalpred->Add(signalpredro);
372   //        puresignal->Add(signalpred,-1);//subtracting signal contamination
373   //---------------------
374 < //      cout << "(m0,m23)=("<<m0<<","<<m23<<") contains " << puresignal->Integral() << endl;
374 > //      dout << "(m0,m23)=("<<m0<<","<<m23<<") contains " << puresignal->Integral() << endl;
375   //    TH1F *puresignal = allsamples.Draw("puresignal",mcjzb,  binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,mc,  luminosity,allsamples.FindSample("LM4"));
376        vector<float> results=establish_upper_limits(puredata,allbgs,puresignal,saveas.str(),myfile);  
377        if(results.size()==0) {
# Line 373 | Line 383 | void scan_susy_space(string mcjzb, strin
383        exclusionmap2s->Fill(m23,m0,results[2]);
384        exclusionmap3s->Fill(m23,m0,results[3]);
385        delete puresignal;
386 <      cout << "(m0,m23)=("<<m0<<","<<m23<<") : 3 sigma at " << results[3] << endl;
386 >      dout << "(m0,m23)=("<<m0<<","<<m23<<") : 3 sigma at " << results[3] << endl;
387      }
388    }//end of model scan for loop
389    
390 <  cout << "Exclusion Map contains" << exclusionmap->Integral() << " (integral) and entries: " << exclusionmap->GetEntries() << endl;
390 >  dout << "Exclusion Map contains" << exclusionmap->Integral() << " (integral) and entries: " << exclusionmap->GetEntries() << endl;
391    c3->cd();
392    exclusionmap->Draw("CONTZ");
393    CompleteSave(c3,"Model_Scan/CONT/Model_Scan_Mean_values");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines