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

Comparing UserCode/cbrown/Development/Plotting/Modules/ZbTools.C (file contents):
Revision 1.10 by buchmann, Wed Nov 14 14:52:54 2012 UTC vs.
Revision 1.13 by buchmann, Fri Nov 23 12:10:58 2012 UTC

# Line 120 | Line 120 | void print_all_b_yields() {
120    print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut);
121    cout << "10<ptZ<1000 GeV" << endl;
122    print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000");
123 +  cout << "#alpha < 0.35" << endl;
124 +  print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"(Zb3010_alpha)<0.35");
125    cout << "#alpha < 0.3" << endl;
126    print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"(Zb3010_alpha)<0.3");
127    cout << "#alpha < 0.2" << endl;
# Line 254 | Line 256 | void draw_mpf_vars() {
256    draw_kin_variable("Zb3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_alpha<0.05",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz__mpf_alpha_smaller_0p05",0,"#alpha<0.05, 10 GeV < p_{T}^{Z} < 1000 GeV");
257   }  
258  
259 < Value get_Zb_data_over_mc(string variable, TCut cut) {
259 > /*double GetMedian(TH1F *histo) {
260 >    int numBins = histo->GetXaxis()->GetNbins();
261 >    Double_t x[numBins];
262 >    Double_t y[numBins];
263 >    for (int i = 1; i <= numBins; i++) {
264 >        x[i] = histo->GetBinCenter(i);
265 >        y[i] = histo->GetBinContent(i);
266 >    }
267 >    return TMath::Median(numBins, &x, &y);
268 > }*/
269 >
270 > Value get_Zb_data_over_mc(string variable, string variable2, TCut cut, string saveas) {
271   //  write_warning(__FUNCTION__,"Debugging this function, therefore always returning 3.1415+/-1.010101"); return Value(3.1415,1.010101);
272 <  TH1F *hdata  = allsamples.Draw("hdata",variable,1000,0,30, "#alpha [GeV]", "events", cut,data,luminosity);
273 <  TH1F *hmc    = allsamples.Draw("hmc" , variable,1000,0,30, "#alpha [GeV]", "events", cut,mc,  luminosity);
272 >  TCanvas *cn = new TCanvas("cn","cn");
273 >  string varname="MPF";
274 >  if(Contains(variable,"pfJetGood")) varname="R_{abs}";
275 >  TH1F *hdata  = allsamples.Draw("hdata",variable,1200,0,30, varname, "events",  cut,data,luminosity);
276 >  TH1F *hmc    = allsamples.Draw("hmc" , variable,1200,0,30, varname, "events", cut, mc,  luminosity);
277    
278    float a=hdata->GetMean();
279    float b=hmc->GetMean();
# Line 265 | Line 281 | Value get_Zb_data_over_mc(string variabl
281    float db=hmc->GetMeanError();
282    float factor = a / b;
283    float error = TMath::Sqrt(  (1/(b*b)) * (da*da) + ((a*a)/(b*b))*db*db);
284 +  
285 +  cn->cd();
286 +  hdata->GetYaxis()->SetTitle("events / 0.1");
287 +  hdata->Rebin(4);
288 +  hmc->Rebin(4);
289 +  hdata->GetXaxis()->SetRangeUser(0,2);
290 +  hdata->Draw("e1");
291 +  hmc->Draw("histo,same");
292 +  hdata->Draw("e1,same");
293 +  stringstream summary;
294 +  summary << "#splitline{" << varname << "}{#splitline{data: " << std::setprecision(4) << a << " #pm " << std::setprecision(4) << da << "}{#splitline{mc:   " << std::setprecision(4) << b << " #pm " << std::setprecision(4) << db << "}{ratio: " << factor;
295 +  summary << " #pm " << error << "}}}";
296 +  TText *infobox = write_title(summary.str());
297 +  infobox->SetX(0.75);
298 +  infobox->SetTextSize(0.03);
299 +  infobox->SetY(0.75);
300 +  infobox->Draw();
301 +    
302 +    
303 +  DrawPrelim();
304 +  CompleteSave(cn,"ResponsePlots/"+saveas);
305 +  
306 +  cout << "Data;" << a << ";"<<da<<";MC"<<b<<";"<<db<<endl;
307 +  delete cn;
308    delete hdata;
309    delete hmc;
310  
# Line 276 | Line 316 | Value get_Zb_data_over_mc(string variabl
316    
317  
318   void new_data_mc_agreement_2d() {
319 +  
320 +  write_error(__FUNCTION__,"need to make alpha<0.3 inclusive again!!!! IMPORTANT SINCE THAT'S THE FINAL RESULT!!!");
321 +  
322    gStyle->SetOptFit(0);
323    TCut basecut(ZplusBsel&&LeadingB&&EtaB&&PhiZcut);
324 <  const int nalphacuts=5;
325 <  float alphacuts[nalphacuts] = {0.1,0.15,0.2,0.25,0.3};
324 >  const int nalphacuts=6;
325 >  float alphacuts[nalphacuts] = {0.1,0.15,0.2,0.25,0.3,0.35};
326    int PointThree=-1;
327    for(int i=0;i<nalphacuts;i++) {
328      if((alphacuts[i]-0.3)<0.01) PointThree=i-1;
# Line 301 | Line 344 | void new_data_mc_agreement_2d() {
344    for(int ia=0;ia<nalphacuts;ia++) {
345      for(int ipt=0;ipt<nptcuts-1;ipt++) {
346        stringstream specialcut;
347 <      specialcut << "((pt>" << ptcuts[ipt] << " && pt< " << ptcuts[ipt+1] << ") && (Zb3010_alpha<" << alphacuts[ia] << "))";
347 >      if(ia>0) specialcut << "((pt>" << ptcuts[ipt] << " && pt< " << ptcuts[ipt+1] << ") && (Zb3010_alpha<" << alphacuts[ia] << " && Zb3010_alpha>" << alphacuts[ia-1] << "))";
348 >      else     specialcut << "((pt>" << ptcuts[ipt] << " && pt< " << ptcuts[ipt+1] << ") && (Zb3010_alpha<" << alphacuts[ia] << "))";
349        cout << specialcut.str() << endl;
350 <      Value MPF_data_over_mc = get_Zb_data_over_mc("mpf",TCut(basecut && specialcut.str().c_str()));
351 <      Value RABS_data_over_mc = get_Zb_data_over_mc("Zb3010_pfJetGoodPt[0]/pt",TCut(basecut && specialcut.str().c_str()));
350 >      Value MPF_data_over_mc = get_Zb_data_over_mc("mpf","",TCut(basecut && specialcut.str().c_str()),"MPF___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__alpha_"+any2string(alphacuts[ia]));
351 >      Value RABS_data_over_mc = get_Zb_data_over_mc("Zb3010_pfJetGoodPt[0]/pt","",TCut(basecut && specialcut.str().c_str()),"Rabs___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__alpha_"+any2string(alphacuts[ia]));
352        
353        MPF_Results[ia][ipt]=MPF_data_over_mc.getValue();
354        MPF_Errors[ia][ipt]=MPF_data_over_mc.getError();
# Line 323 | Line 367 | void new_data_mc_agreement_2d() {
367    
368    TGraphErrors *MPF_FinalGraph = new TGraphErrors();
369    TGraphErrors *RABS_FinalGraph = new TGraphErrors();
370 <  TGraphErrors *FaceValueAtPoint3 = new TGraphErrors();
370 >  TGraphErrors *MPF_FaceValueAtPoint3 = new TGraphErrors();
371 >  TGraphErrors *RABS_FaceValueAtPoint3 = new TGraphErrors();
372    
373    for(int ipt=0;ipt<nptcuts-1;ipt++) {
374      
# Line 332 | Line 377 | void new_data_mc_agreement_2d() {
377      cout << "Going to create histo for " << filename.str() << endl;
378      TGraphErrors *mpf_gr =new TGraphErrors();
379      TGraphErrors *rabs_gr =new TGraphErrors();
380 +    
381 +    int rabs_counter=0;
382 +    int mpf_counter=0;
383 +    
384      for(int ia=0;ia<nalphacuts;ia++) {
385        cout << "Setting a point for an alpha cut at " << alphacuts[ia] << " with value " << MPF_Results[ia][ipt] << " (MPF) and " << RABS_Results[ia][ipt] << " (RABS)" << endl;
386 <      mpf_gr->SetPoint(ia,alphacuts[ia],MPF_Results[ia][ipt]);     // avoiding empty bins (nan's)
387 <      mpf_gr->SetPointError(ia,0,MPF_Errors[ia][ipt]);             // avoiding empty bins (nan's)
388 <      rabs_gr->SetPoint(ia,alphacuts[ia],RABS_Results[ia][ipt]); // avoiding empty bins (nan's)
389 <      rabs_gr->SetPointError(ia,0,RABS_Errors[ia][ipt]);         // avoiding empty bins (nan's)
390 <    }
391 <    cout << "About to add a point in pt (" << ptcuts[ipt]+ptcuts[ipt+1] << " ) to face value : " << MPF_Results[PointThree][ipt] << endl;
392 <    FaceValueAtPoint3->SetPoint(ipt,(ptcuts[ipt]+ptcuts[ipt+1]),MPF_Results[PointThree][ipt]);
393 <    FaceValueAtPoint3->SetPointError(ipt,0,MPF_Errors[PointThree][ipt]);
386 >      if(MPF_Results[ia][ipt]==MPF_Results[ia][ipt] && MPF_Errors[ia][ipt]==MPF_Errors[ia][ipt]) { // remove nan's
387 >       mpf_gr->SetPoint(mpf_counter,alphacuts[ia],MPF_Results[ia][ipt]);
388 >       mpf_gr->SetPointError(mpf_counter,0,MPF_Errors[ia][ipt]);
389 >       mpf_counter++;
390 >      } else {
391 >        dout << "Detected BS for MPF method (bin ignored) : " << endl;
392 >        dout << "       alpha: " << alphacuts[ia] << " , pt range: " << ptcuts[ipt] << " < pt < " << ptcuts[ipt+1] << endl;
393 >        cout << "       value (MPF) : " << MPF_Results[ia][ipt] << " +/- " << MPF_Errors[ia][ipt] << endl;
394 >      }
395 >      if(RABS_Results[ia][ipt]==RABS_Results[ia][ipt] && RABS_Errors[ia][ipt]==RABS_Errors[ia][ipt]) {
396 >       rabs_gr->SetPoint(rabs_counter,alphacuts[ia],RABS_Results[ia][ipt]);
397 >       rabs_gr->SetPointError(rabs_counter,0,RABS_Errors[ia][ipt]);
398 >       rabs_counter++;
399 >      } else {
400 >        dout << "Detected BS for RABS method (bin ignored) : " << endl;
401 >        dout << "       alpha: " << alphacuts[ia] << " , pt range: " << ptcuts[ipt] << " < pt < " << ptcuts[ipt+1] << endl;
402 >        cout << "       value (RABS) : " << RABS_Results[ia][ipt] << " +/- " << RABS_Errors[ia][ipt] << endl;
403 >      }
404 >    }
405 >    cout << "About to add a point in pt (" << (ptcuts[ipt]+ptcuts[ipt+1])/2 << " ) to face value : " << MPF_Results[PointThree][ipt] << endl;
406 >    
407 >    stringstream specialcut;
408 >    specialcut << "((pt>" << ptcuts[ipt] << " && pt< " << ptcuts[ipt+1] << ") && (Zb3010_alpha<0.3))";
409 >    Value MPF_data_over_mc = get_Zb_data_over_mc("mpf","",TCut(basecut && specialcut.str().c_str()),"MPF___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__INCLUSIVEalpha_0.3");
410 >    Value RABS_data_over_mc = get_Zb_data_over_mc("Zb3010_pfJetGoodPt[0]/pt","",TCut(basecut && specialcut.str().c_str()),"Rabs___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__INCLUSIVEalpha_0.3");
411 >    MPF_FaceValueAtPoint3->SetPoint(ipt,(ptcuts[ipt]+ptcuts[ipt+1])/2,MPF_data_over_mc.getValue());
412 >    MPF_FaceValueAtPoint3->SetPointError(ipt,0,MPF_data_over_mc.getError());
413 >    RABS_FaceValueAtPoint3->SetPoint(ipt,(ptcuts[ipt]+ptcuts[ipt+1])/2,RABS_data_over_mc.getValue());
414 >    RABS_FaceValueAtPoint3->SetPointError(ipt,0,RABS_data_over_mc.getError());
415      
416 +    can->cd();
417      mpf_gr->SetMarkerStyle(21);
418      mpf_gr->SetMarkerColor(kBlue);
419      mpf_gr->Draw("AP");
420 <    mpf_gr->Fit("pol1","QE"); // quiet, use minos
420 >    mpf_gr->Fit("pol1","");
421      mpf_gr->GetXaxis()->SetTitle("#alpha");
422      mpf_gr->GetXaxis()->CenterTitle();
423      mpf_gr->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}");
424      mpf_gr->GetYaxis()->CenterTitle();
425      TF1 *mpf_pol=(TF1*)mpf_gr->GetFunction("pol1");
426 +    TF1 *mpf_pol_complete = new TF1("mpf_pol_complete","[0]+[1]*x");
427 +    mpf_pol_complete->SetParameters(mpf_pol->GetParameters());
428 +    mpf_pol_complete->SetLineWidth(1);
429 +    mpf_pol_complete->SetLineColor(kBlue);
430 +    float min,max;
431 +    FindMinMax(mpf_gr,min,max);
432 +    TH1F *histo = new TH1F("histo","histo",1,0,0.4);
433 +    histo->SetStats(0);
434 +    histo->GetXaxis()->SetRangeUser(0,0.4);
435 +    histo->GetYaxis()->SetRangeUser(min,max);
436 +    mpf_gr->GetYaxis()->SetRangeUser(min,max);
437 +    
438 +    TPolyLine *mpf_fit_uncert = GetFitUncertaintyShape(mpf_gr, "pol1", min, max,0.0,0.4);
439 +    mpf_pol->SetLineColor(TColor::GetColor("#0101DF"));
440 +    mpf_fit_uncert->SetFillColor(TColor::GetColor("#0101DF"));
441 +    histo->Draw();
442 +    mpf_fit_uncert->Draw("same,f");
443 +    mpf_gr->Draw("P");
444 +    mpf_pol_complete->Draw("same");
445 +    
446      float mpf_a=mpf_pol->GetParameter(0);
447      float mpf_b=mpf_pol->GetParameter(1);
448      MPF_FinalGraph->SetPoint(ipt,0.5*(ptcuts[ipt]+ptcuts[ipt+1]),mpf_a);
# Line 377 | Line 468 | void new_data_mc_agreement_2d() {
468      filename.str("");
469      
470      rabs_gr->SetMarkerStyle(21);
471 <    rabs_gr->SetMarkerColor(kBlue);
381 <    rabs_gr->Fit("pol1","QE"); // quiet, use minos
471 >    rabs_gr->SetMarkerColor(kRed);
472      rabs_gr->Draw("AP");
473 +    rabs_gr->Fit("pol1","");
474      rabs_gr->GetXaxis()->SetTitle("#alpha");
475      rabs_gr->GetXaxis()->CenterTitle();
476 <    rabs_gr->GetYaxis()->SetTitle("<R_{abs}>_{data}/<R_{abs}>_{mc}");
476 >    rabs_gr->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}");
477      rabs_gr->GetYaxis()->CenterTitle();
387    
478      TF1 *rabs_pol=(TF1*)rabs_gr->GetFunction("pol1");
479 +    TF1 *rabs_pol_complete = new TF1("rabs_pol_complete","[0]+[1]*x");
480 +    rabs_pol_complete->SetParameters(rabs_pol->GetParameters());
481 +    rabs_pol_complete->SetLineColor(kRed);
482 +    rabs_pol_complete->SetLineWidth(1);
483 +    FindMinMax(rabs_gr,min,max);
484 +    rabs_gr->GetYaxis()->SetRangeUser(min,max);
485 +    histo->GetYaxis()->SetRangeUser(min,max);
486 +    TPolyLine *rabs_fit_uncert = GetFitUncertaintyShape(rabs_gr, "pol1", min, max,0.0,0.4);
487 +    rabs_pol->SetLineColor(TColor::GetColor("#0101DF"));
488 +    rabs_pol->SetFillColor(TColor::GetColor("#0101DF"));
489 +    histo->Draw();
490 +    rabs_fit_uncert->Draw("same,f");
491 +    rabs_gr->Draw("P");
492 +    rabs_pol_complete->Draw("same");
493 +
494 +    
495      float rabs_a=rabs_pol->GetParameter(0);
496      float rabs_b=rabs_pol->GetParameter(1);
497      RABS_FinalGraph->SetPoint(ipt,0.5*(ptcuts[ipt]+ptcuts[ipt+1]),rabs_a);
# Line 393 | Line 499 | void new_data_mc_agreement_2d() {
499      
500      cout << "!+!+!+!+!+!+!+!+!+ Just added a point to the final plot : " << rabs_a << " +/- " << rabs_pol->GetParError(0) << endl;
501      
396    
502      stringstream rabs_info;
503      rabs_info << "#splitline{#splitline{#splitline{" << ptcuts[ipt] << " GeV < p_{T}^{Z} < " << ptcuts[ipt+1] << " GeV }{ (R_{abs}) }}{Extrapolated value: " << std::setprecision(3) << rabs_a << "}}{#chi^{2}/NDF : " << rabs_pol->GetChisquare() << " / " << rabs_pol->GetNDF() << "}";
504      TText *rabs_mark = write_title(rabs_info.str());
# Line 403 | Line 508 | void new_data_mc_agreement_2d() {
508      rabs_mark->Draw();
509      
510      
406
511      RABS_ExtraPolatedResults[ipt]=rabs_a;
512      filename << filenamebkp << "__RABS";
513      DrawPrelim();
# Line 412 | Line 516 | void new_data_mc_agreement_2d() {
516    }
517    
518    MPF_FinalGraph->SetMarkerStyle(21);
519 <  MPF_FinalGraph->SetMarkerColor(kRed);
520 <  MPF_FinalGraph->Fit("pol0","QE"); // quiet, use minos
519 >  MPF_FinalGraph->SetMarkerColor(kBlue);
520 >  MPF_FinalGraph->Fit("pol0",""); // quiet, use minos
521    
522    TF1 *mpf_pol0=(TF1*)MPF_FinalGraph->GetFunction("pol0");
523 +  TF1 *mpf_pol0_complete = new TF1("mpf_pol0_complete","[0]+[1]*x");
524 +  mpf_pol0_complete->SetLineWidth(1);
525 +  mpf_pol0_complete->SetLineColor(kBlue);
526 +  mpf_pol0->SetLineColor(kBlue);
527    MPF_FinalGraph->Draw("AP");
528    MPF_FinalGraph->GetXaxis()->SetTitle("p_{T}^{Z}");
529    MPF_FinalGraph->GetXaxis()->CenterTitle();
530    MPF_FinalGraph->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}");
531    MPF_FinalGraph->GetYaxis()->CenterTitle();
532    MPF_FinalGraph->Draw("AP");
533 +  mpf_pol0_complete->Draw("same");
534    
535    stringstream mpf_result;
536    mpf_result << "#splitline{C_{abs}= " << std::setprecision(5) << 1/mpf_pol0->GetParameter(0) << " #pm " << std::setprecision(2) << mpf_pol0->GetParError(0)/(mpf_pol0->GetParameter(0)*mpf_pol0->GetParameter(0)) << "}{ (MPF)}";
# Line 467 | Line 576 | void new_data_mc_agreement_2d() {
576    CompleteSave(can,filename2.str());
577    
578    can->cd();
579 <  TCanvas *FaceValueCanvas = new TCanvas("FaceValueCanvas","FaceValueCanvas");
580 <  FaceValueAtPoint3->SetMarkerStyle(21);
581 <  FaceValueAtPoint3->SetMarkerStyle(21);
582 <  FaceValueAtPoint3->Fit("pol0","QE"); // quiet, use minos
583 <  FaceValueAtPoint3->Draw("AP");
584 <  FaceValueAtPoint3->GetXaxis()->SetTitle("p_{T}^{Z}");
585 <  FaceValueAtPoint3->GetXaxis()->CenterTitle();
586 <  FaceValueAtPoint3->GetYaxis()->SetTitle("data/mc for #alpha<0.3");
587 <  FaceValueAtPoint3->GetYaxis()->CenterTitle();
588 <  FaceValueAtPoint3->Draw("AP");
589 <  TF1 *faceval_pol0=(TF1*)FaceValueAtPoint3->GetFunction("pol0");
579 >  MPF_FaceValueAtPoint3->SetMarkerStyle(21);
580 >  MPF_FaceValueAtPoint3->SetMarkerColor(kBlue);
581 >  MPF_FaceValueAtPoint3->Fit("pol0","QE"); // quiet, use minos
582 >  MPF_FaceValueAtPoint3->Draw("AP");
583 >  MPF_FaceValueAtPoint3->GetXaxis()->SetTitle("p_{T}^{Z}");
584 >  MPF_FaceValueAtPoint3->GetXaxis()->CenterTitle();
585 >  MPF_FaceValueAtPoint3->GetYaxis()->SetTitle("<MPF>__{data}/<MPF>_{mc} for #alpha<0.3");
586 >  MPF_FaceValueAtPoint3->GetYaxis()->CenterTitle();
587 >  MPF_FaceValueAtPoint3->Draw("AP");
588 >  TF1 *faceval_pol0=(TF1*)MPF_FaceValueAtPoint3->GetFunction("pol0");
589 >  faceval_pol0->SetLineColor(kBlue);
590 >  faceval_pol0->SetLineWidth(1);
591 >  faceval_pol0->Draw("same");
592 >  TF1 *faceval_pol0_complete = new TF1("faceval_pol0_complete","[0]+[1]*x");
593 >  faceval_pol0_complete->SetParameters(faceval_pol0->GetParameters());
594    stringstream faceval_result;
595    faceval_result << "#splitline{C_{abs}= " << std::setprecision(5) << 1/faceval_pol0->GetParameter(0) << " #pm " << std::setprecision(2) << faceval_pol0->GetParError(0)/(faceval_pol0->GetParameter(0)*faceval_pol0->GetParameter(0)) << "}{ (MPF at #alpha<0.3)}";;
596    TText *faceval_final_mark = write_title(faceval_result.str());
# Line 494 | Line 607 | void new_data_mc_agreement_2d() {
607    filename2 << "Extrapolation/FINAL_RESULT_MPF_FaceValp3";
608    CompleteSave(can,filename2.str());
609    
610 +  can->cd();
611 +  RABS_FaceValueAtPoint3->SetMarkerStyle(21);
612 +  RABS_FaceValueAtPoint3->SetMarkerColor(kRed);
613 +  RABS_FaceValueAtPoint3->Fit("pol0","QE"); // quiet, use minos
614 +  RABS_FaceValueAtPoint3->Draw("AP");
615 +  RABS_FaceValueAtPoint3->GetXaxis()->SetTitle("p_{T}^{Z}");
616 +  RABS_FaceValueAtPoint3->GetXaxis()->CenterTitle();
617 +  RABS_FaceValueAtPoint3->GetYaxis()->SetTitle("<R_{abs}>_{data}/<R_{abs}>_{mc} for #alpha<0.3");
618 +  RABS_FaceValueAtPoint3->GetYaxis()->CenterTitle();
619 +  RABS_FaceValueAtPoint3->Draw("AP");
620 +  TF1 *faceval_pol0RABS=(TF1*)RABS_FaceValueAtPoint3->GetFunction("pol0");
621 +  TF1 *faceval_pol0RABS_complete = new TF1("faceval_pol0_complete","[0]+[1]*x");
622 +  faceval_pol0RABS_complete->SetParameters(faceval_pol0RABS->GetParameters());
623 +  faceval_pol0RABS->SetLineWidth(1);
624 +  faceval_pol0RABS->SetLineColor(kRed);
625 +  faceval_pol0RABS_complete->Draw("same");
626 +  stringstream RABSfaceval_result;
627 +  RABSfaceval_result << "#splitline{C_{abs}= " << std::setprecision(5) << 1/faceval_pol0RABS->GetParameter(0) << " #pm " << std::setprecision(2) << faceval_pol0RABS->GetParError(0)/(faceval_pol0RABS->GetParameter(0)*faceval_pol0RABS->GetParameter(0)) << "}{ (R_{abs} at #alpha<0.3)}";;
628 +  TText *RABSfaceval_final_mark = write_title(RABSfaceval_result.str());
629 +  RABSfaceval_final_mark->SetX(0.75);
630 +  RABSfaceval_final_mark->SetY(0.75);
631 +  RABSfaceval_final_mark->SetTextSize(0.03);
632 +  RABSfaceval_final_mark->Draw();
633 +  DrawPrelim();
634 +  
635 +  float RABSFaceValResult=1/faceval_pol0RABS->GetParameter(0);
636 +  float RABSFaceValResultError=faceval_pol0RABS->GetParError(0)/(faceval_pol0RABS->GetParameter(0)*faceval_pol0RABS->GetParameter(0));
637 +  
638 +  filename2.str("");
639 +  filename2 << "Extrapolation/FINAL_RESULT_RABS_FaceValp3";
640 +  CompleteSave(can,filename2.str());
641 +  
642    cout << "FINAL RESULTS: " << endl;
643    cout << "MPF : " << MPFResult  << " +/- " << MPFResultError  << endl;
644    cout << "Rabs: " << RabsResult << " +/- " << RabsResultError << endl;
645 <  cout << "Face value at 0.3 :" << FaceValResult << " +/- " << FaceValResultError << endl;
645 >  cout << "Face value at 0.3 :" << FaceValResult << " +/- " << FaceValResultError << "  (MPF) " << endl;
646 >  cout << "Face value at 0.3 :" << RABSFaceValResult << " +/- " << RABSFaceValResultError << "  (RABS) " << endl;
647    
648    delete can;
649    
# Line 556 | Line 702 | void DoPUStudy(string identifier) {
702   }
703  
704   void ScenarioComparison() {
705 <  
705 > //very dumb way to do this.
706    TGraphAsymmErrors *gr[5];
707    TF1 *fit[5];
708    bool dofit=false;
# Line 589 | Line 735 | void ScenarioComparison() {
735        double dyl[4] = {0.011,0.009,0.013,0.020};
736        double dyh[4] = {0.011,0.009,0.013,0.020};
737        gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh);
738 <      name="30/10";
738 >      name="30/15";
739        color="#2464bc";
740      }
741      if(i==2) {
# Line 646 | Line 792 | void ScenarioComparison() {
792   }
793  
794   void ScenarioComparisonInclusive() {
795 <  
795 >  //dumbest way ever to do this. but ok we only need to do it once.
796    TGraphAsymmErrors *gr[5];
797    TF1 *fit[5];
798    bool dofit=true;
# Line 679 | Line 825 | void ScenarioComparisonInclusive() {
825        double dyl[4] = {0.00235044,0.00225264,0.00313574,0.00541047};
826        double dyh[4] = {0.00235044,0.00225264,0.00313574,0.00541047};
827        gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh);
828 <      name="30/10";
828 >      name="30/15";
829        color="#2464bc";
830      }
831      if(i==2) {
# Line 865 | Line 1011 | void compare_selection(string identifier
1011    
1012   }
1013  
1014 < void do_basic_ZB_analysis() {
1014 > void GetNumberEventsInsideOutsideAlphaWindow() {
1015 >  
1016 >  TCut cut =  ZplusBsel&&LeadingB&&EtaB&&PhiZcut;
1017 >  TCut in  =  TCut("Zb3010_alpha<=0.3");
1018 >  TCut out =  TCut("Zb3010_alpha>0.3");
1019 >
1020 >  TH1F *data_IN  = allsamples.Draw("data_IN",    "mll",1,0,150, "nothing [GeV]", "events", cut&&in, data,luminosity);
1021 >  TH1F *data_OUT = allsamples.Draw("data_OUT",   "mll",1,0,150, "nothing [GeV]", "events", cut&&out,data,luminosity);
1022 >  TH1F *mc_IN    = allsamples.Draw("mc_IN",      "mll",1,0,150, "nothing [GeV]", "events", cut&&in, mc  ,luminosity);
1023 >  TH1F *mc_OUT   = allsamples.Draw("mc_OUT",     "mll",1,0,150, "nothing [GeV]", "events", cut&&out,mc  ,luminosity);
1024 >  
1025 >  dout << "  Data: In " << data_IN->Integral() << " vs out " << data_OUT->Integral() << endl;
1026 >  dout << "  MC  : In " << mc_IN->Integral()   << " vs out " << mc_OUT->Integral()   << endl;  
1027 > }
1028 >
1029 >    
1030 > void do_basic_ZB_analysis(int do_inclusive) {
1031    
1032 +  //https://twiki.cern.ch/twiki/bin/viewauth/CMS/BtagPOG#2011_Data_and_MC
1033 +  //https://twiki.cern.ch/twiki/pub/CMS/BtagPOG/SFb-ttbar_payload.txt
1034 +  
1035 +  if(do_inclusive) {
1036 +    LeadingB=TCut("Zb3010_bTagProbCSVBP[0]>=-10000");
1037 +    cutWeight=TCut("(weight*(weight<1000)*(is_data+(!is_data)*((id1==id2&&id1==0)*0.95+(id1==id2&&id1==1)*0.88+(id1!=id2)*0.92)))");
1038 +    write_info(__FUNCTION__,"Inclusive selection - no btag requirement, no btag efficiency/mistag correction (weight)");
1039 +  } else {
1040 +    LeadingB=TCut("Zb3010_bTagProbCSVBP[0]>0.898");
1041 +    cutWeight=TCut("(weight*(weight<1000)*(is_data+(!is_data)*((id1==id2&&id1==0)*0.95+(id1==id2&&id1==1)*0.88+(id1!=id2)*0.92)*Zb3010_BTagWgt))");
1042 +    write_info(__FUNCTION__,"Exclusive selection - switched on btag requirement and btag efficiency/mistag correction (weight)");
1043 +  }
1044 +  
1045 +  bool doquick=true;
1046    
1047    TCanvas *zbcanvas = new TCanvas("zbcanvas","zbcanvas");
1048    
# Line 884 | Line 1060 | void do_basic_ZB_analysis() {
1060   //     compare_selection("Zb3010");
1061   //     compare_selection("Zb40");
1062  
1063 +  if(!doquick) {
1064 +    print_all_b_yields();
1065 +    draw_mpf_vars();
1066 +    //  DrawEvilCutFlow();
1067 +        
1068 +    draw_Zb_kin_vars();
1069 +        
1070 +   }
1071    
1072 <  print_all_b_yields();
1073 <  draw_mpf_vars();
890 < //  DrawEvilCutFlow();
891 <  
892 <  draw_Zb_kin_vars();
893 <  
894 <  new_data_mc_agreement_2d();
895 <  
1072 >  GetNumberEventsInsideOutsideAlphaWindow();
1073 > //  new_data_mc_agreement_2d();
1074    
1075 +  write_error(__FUNCTION__,"Need to implement switch for inclusive result; inclusive result needs to have btag efficiency reweighting deactivated!");
1076    delete zbcanvas;
1077   }
1078  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines