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

Comparing UserCode/cbrown/Development/Plotting/Modules/Plotting_Functions.C (file contents):
Revision 1.35 by buchmann, Mon Jul 9 16:26:00 2012 UTC vs.
Revision 1.37 by buchmann, Thu Jul 12 12:57:05 2012 UTC

# Line 147 | Line 147 | void find_peaks(float &MCPeak,float &MCP
147      
148      mcjzb << ")";
149    }
150 <    
150 >  
151    
152   }
153  
# Line 1889 | Line 1889 | void jzb_plots(string mcjzb, string data
1889      flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
1890      if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning);
1891      if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning);
1892
1892      draw_normalized_data_vs_data_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,"ee","mm","jzb_ee_vs_mm",can,binning);
1893      draw_normalized_data_vs_data_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,"ee","mm","jzb_ee_vs_mm_coarse",can,coarse_binning);
1894 +    draw_normalized_data_vs_data_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,"ee","mm","jzb_ee_vs_mm_coarsest",can,coarsest_binning);
1895  
1896    }
1897    
# Line 2449 | Line 2449 | void ttbar_sidebands_comparison(string m
2449      
2450      stringstream mcjzbnoPU;
2451      find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,resultsNoPU,true,noPUdatajzb,noPUmcjzb);
2452 <    if(MCPeakNoPU>0) mcjzbnoPU<<"("<<jzbvariablemc<<"-"<<TMath::Abs(MCPeakNoPU)<<")";
2453 <    else mcjzbnoPU<<"("<<jzbvariablemc<<"+"<<TMath::Abs(MCPeakNoPU)<<")";
2454 <    dout << "The peak corrected JZB expression for MC without pileup is : " <<  mcjzbnoPU.str() << endl;
2455 <    
2456 <    mcjzb = mcjzbnoPU.str();
2457 <    
2452 >    mcjzb = noPUmcjzb.str();
2453    }
2454  
2455      
# Line 2733 | Line 2728 | void ttbar_sidebands_comparison(string m
2728  
2729   void zjets_prediction_comparison(string mcjzbWithPUa) {
2730    TCanvas *zcan = new TCanvas("zcan","zcan");  
2731 <  zcan->SetLogy(1);
2731 > //  zcan->SetLogy(1);
2732    TCut weightbackup=cutWeight;
2733 <
2734 <
2735 <  // Do it without PU re-weighting
2736 <  float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0;
2737 <  stringstream resultsNoPU;
2738 <  stringstream noPUdatajzb;
2739 <  stringstream noPUmcjzb;
2740 <
2741 <  stringstream mcjzbnoPU;
2742 < //  void find_peaks(float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, stringstream &result, bool doPUreweighting, stringstream &datajzb, stringstream &mcjzb)
2743 <  find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,resultsNoPU,true,noPUdatajzb,noPUmcjzb);
2744 <  if(MCPeakNoPU>0) mcjzbnoPU<<"("<<jzbvariablemc<<"-"<<TMath::Abs(MCPeakNoPU)<<")";
2745 <  else mcjzbnoPU<<"("<<jzbvariablemc<<"+"<<TMath::Abs(MCPeakNoPU)<<")";
2746 <  dout << "The peak corrected JZB expression for MC without pileup is : " <<  mcjzbnoPU.str() << endl;
2747 <
2748 <  string mcjzb = mcjzbnoPU.str();
2749 <
2750 <  cutWeight="1.0";
2733 >  
2734 >  bool UsePURW=false;
2735 >  
2736 >  
2737 >  string mcjzb;
2738 >  if(UsePURW) {
2739 >    mcjzb=mcjzbWithPUa;
2740 >  } else {
2741 >    // Do it without PU re-weighting
2742 >    float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0;
2743 >    stringstream resultsNoPU;
2744 >    stringstream noPUdatajzb;
2745 >    stringstream noPUmcjzb;
2746 >    
2747 >    find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,resultsNoPU,false,noPUdatajzb,noPUmcjzb);
2748 >    dout << "The peak corrected JZB expression for MC without pileup is : " <<  noPUmcjzb.str() << endl;
2749 >    
2750 >    mcjzb = noPUmcjzb.str();
2751 >    
2752 >    cutWeight="1.0";
2753 >  }
2754  
2755    
2756    vector<float> binning;
2757    binning.push_back(0);
2758    binning.push_back(10);
2759    binning.push_back(20);
2760 + //  binning.push_back(30);
2761    binning.push_back(40);
2762 < //  binning.push_back(80);
2762 > //   binning.push_back(50);
2763 > //   binning.push_back(60);
2764 > //   binning.push_back(70);
2765 > //   binning.push_back(80);
2766 > //   binning.push_back(90);
2767    binning.push_back(100);
2768 < //  float sbg_min=0.;
2766 < //  float sbg_max=100.;
2767 < //  int sbg_nbins=5;
2768 >
2769    float simulatedlumi = luminosity;//in pb please - adjust to your likings
2770    
2771    TCut kPos((mcjzb+">0").c_str());
2772    TCut kNeg((mcjzb+"<0").c_str());
2773    string var( "abs("+mcjzb+")" );
2774 +  
2775 +  TCut notTau("abs(genMID1)!=15");
2776 +  TCut ONLYTau("mll>20");
2777 +  
2778  
2779 <  TCut kcut(cutmass&&cutOSSF&&cutnJets);
2780 <  TH1F *hJZBpos = systsamples.Draw("hJZBpos",var,binning, "JZB [GeV]", "events",kcut&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY"));
2781 <  TH1F *hJZBneg = systsamples.Draw("hJZBneg",var,binning, "JZB [GeV]", "events",kcut&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY"));
2779 >  TH1F *hJZBpos = systsamples.Draw("hJZBpos",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&&notTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY"));
2780 >  TH1F *hJZBneg = systsamples.Draw("hJZBneg",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&&notTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY"));
2781 >  
2782    hJZBpos->SetLineColor(kBlack);
2783    hJZBneg->SetLineColor(kRed);
2784    
# Line 2782 | Line 2787 | void zjets_prediction_comparison(string
2787    hJZBneg->Draw("same,hist");
2788    hJZBpos->Draw("same,e1"); // So it's on top...
2789    
2790 <  TLegend *leg = make_legend("MC Z+jets",0.55,0.75,false);
2790 >  TLegend *leg = make_legend("MC Z+jets #rightarrow ee,#mu#mu",0.55,0.75,false);
2791    leg->AddEntry(hJZBpos,"Observed","pe");
2792    leg->AddEntry(hJZBneg,"Predicted","l");
2793    leg->Draw("same");
2794    DrawMCPrelim(simulatedlumi);
2795 <  CompleteSave(zcan,"Systematics/zjets_prediction");
2795 >  CompleteSave(zcan,"Systematics/ZJets/zjets_eemm_prediction");
2796    
2797    TH1F* hratio = (TH1F*)hJZBpos->Clone("hratio");
2798    hratio->Divide(hJZBneg);
2799    
2800    for(int i=1;i<=hJZBpos->GetNbinsX();i++) {
2801 <    cout << "Positive: " << hJZBpos->GetBinContent(i) << "   vs    Negative : " << hJZBneg->GetBinContent(i) << endl;
2801 >    cout << "Positive: " << hJZBpos->GetBinContent(i) << "   vs    Negative : " << hJZBneg->GetBinContent(i) << "   (ratio : " << hJZBpos->GetBinContent(i) / hJZBneg->GetBinContent(i) << endl;
2802    }
2803    
2804    zcan->SetLogy(0);
# Line 2814 | Line 2819 | void zjets_prediction_comparison(string
2819    center->Draw("same");
2820    bottom->Draw("same");
2821    
2822 <  TLegend *leg2 = make_legend("MC Z+jets",0.25,0.75,false);
2822 >  TLegend *leg2 = make_legend("MC Z+jets #rightarrow ee,#mu#mu",0.25,0.75,false);
2823    leg2->AddEntry(hratio,"obs / pred","pe");
2824    leg2->AddEntry(bottom,"syst. envelope","l");
2825    leg2->Draw("same");
2826    DrawMCPrelim(simulatedlumi);
2827 <  CompleteSave(zcan,"Systematics/zjets_prediction_ratio");
2827 >  CompleteSave(zcan,"Systematics/ZJets/zjets_eemm_prediction_ratio");
2828 >  
2829 >  TCut reducedNJets(cutnJets);
2830 >  
2831 >  TH1F *TAUhJZBpos = systsamples.Draw("TAUhJZBpos",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY"));
2832 >  TH1F *LcorrJZBeemm     = systsamples.Draw("LcorrJZBeemm",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY"));
2833 >  TH1F *RcorrJZBem       = systsamples.Draw("RcorrJZBem",var,binning, "JZB [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY"));
2834 >  TH1F *LcorrJZBem       = systsamples.Draw("LcorrJZBem",var,binning, "JZB [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY"));
2835 >
2836 >  TH1F *RcorrJZBSBem;
2837 >  TH1F *LcorrJZBSBem;
2838 >  TH1F *RcorrJZBSBeemm;
2839 >  TH1F *LcorrJZBSBeemm;
2840 >
2841 >  if(PlottingSetup::RestrictToMassPeak) {
2842 >    RcorrJZBSBem   = systsamples.Draw("RcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY"));
2843 >    LcorrJZBSBem   = systsamples.Draw("LcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY"));
2844 >    RcorrJZBSBeemm = systsamples.Draw("RcorrJZBSBeemm",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY"));
2845 >    LcorrJZBSBeemm = systsamples.Draw("LcorrJZBSBeemm",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY"));
2846 >  }
2847 >  
2848 >  TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred");
2849 >  if(PlottingSetup::RestrictToMassPeak) {
2850 >    Bpred->Add(RcorrJZBem,1.0/3.);
2851 >    Bpred->Add(LcorrJZBem,-1.0/3.);
2852 >    Bpred->Add(RcorrJZBSBem,1.0/3.);
2853 >    Bpred->Add(LcorrJZBSBem,-1.0/3.);
2854 >    Bpred->Add(RcorrJZBSBeemm,1.0/3.);
2855 >    Bpred->Add(LcorrJZBSBeemm,-1.0/3.);
2856 >  } else {
2857 >    Bpred->Add(RcorrJZBem,1.0);
2858 >    Bpred->Add(LcorrJZBem,-1.0);
2859 >  }
2860 >  
2861 >  Bpred->SetLineColor(kRed);
2862 >
2863 >  TAUhJZBpos->SetLineColor(kBlack);
2864 >  Bpred->SetLineColor(kRed);
2865 >  
2866 >  TAUhJZBpos->SetMinimum(1.0);
2867 >  TAUhJZBpos->Draw("e1");
2868 >  Bpred->Draw("same,hist");
2869 >  TAUhJZBpos->Draw("same,e1");
2870 >  
2871 >  TLegend *TAUleg = make_legend("MC Z+jets #rightarrow ee,#mu#mu,#tau#tau",0.55,0.75,false);
2872 >  TAUleg->AddEntry(TAUhJZBpos,"Observed","pe");
2873 >  TAUleg->AddEntry(Bpred,"Predicted","l");
2874 >  TAUleg->Draw("same");
2875 >  DrawMCPrelim(simulatedlumi);
2876 >  CompleteSave(zcan,"Systematics/ZJets/zjets_eemumutautau_prediction");
2877 >  
2878 >  TH1F* TAUhratio = (TH1F*)TAUhJZBpos->Clone("TAUhratio");
2879 >  TAUhratio->Divide(Bpred);
2880 >  
2881 >  for(int i=1;i<=TAUhJZBpos->GetNbinsX();i++) {
2882 >    cout << "ee/mm/tautau observed: " << TAUhJZBpos->GetBinContent(i) << "   vs    predicted : " << Bpred->GetBinContent(i) << "   (ratio : " << TAUhJZBpos->GetBinContent(i) / Bpred->GetBinContent(i) << endl;
2883 >  }
2884 >  
2885 >  zcan->SetLogy(0);
2886 >  TAUhratio->GetYaxis()->SetRangeUser(0,2.5);
2887 >  TAUhratio->GetYaxis()->SetTitle("Observed/Predicted");
2888 >  TAUhratio->Draw("e1");
2889 >  
2890 >  top->Draw("same");
2891 >  center->Draw("same");
2892 >  bottom->Draw("same");
2893 >  
2894 >  TLegend *TAUleg2 = make_legend("MC Z+jets #rightarrow #tau#tau",0.25,0.75,false);
2895 >  TAUleg2->AddEntry(TAUhratio,"obs / pred","pe");
2896 >  TAUleg2->AddEntry(bottom,"syst. envelope","l");
2897 >  TAUleg2->Draw("same");
2898 >  DrawMCPrelim(simulatedlumi);
2899 >  CompleteSave(zcan,"Systematics/ZJets/zjets_eemumutautau_prediction_ratio");
2900 >  
2901 >  delete Bpred;
2902 >  delete TAUhJZBpos;
2903 >  delete LcorrJZBeemm;
2904 >  delete RcorrJZBem;
2905 >  delete LcorrJZBem;
2906 >  
2907 >  if(PlottingSetup::RestrictToMassPeak) {
2908 >    delete RcorrJZBSBem;
2909 >    delete LcorrJZBSBem;
2910 >    delete RcorrJZBSBeemm;
2911 >    delete LcorrJZBSBeemm;
2912 >  }
2913 >  
2914    
2915    delete zcan;
2916    cutWeight=weightbackup;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines