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.59 by fronga, Fri Sep 7 09:46:46 2012 UTC vs.
Revision 1.65 by buchmann, Thu Sep 13 09:44:16 2012 UTC

# Line 161 | Line 161 | void find_peaks(float &MCPeak,float &MCP
161      DataPeak=datapeak;
162      DataPeakError=datapeakerr;
163      
164    switch_overunderflow(true);
165  
164   }
165  
166   void make_special_obs_pred_mll_plot(string datajzb, string mcjzb, float jzbthreshold, float binWidth = 5.0) {
# Line 493 | Line 491 | float make_data_comparison_plot(string v
491    data1->GetYaxis()->CenterTitle();
492  
493    TLegend *mleg = make_legend("",legendPosition,0.7,false,legendPosition+0.2);
494 <  mleg->AddEntry(data1, "Old 5/fb", "PL");
495 <  mleg->AddEntry(data2, "New x/fb", "L");
494 >  mleg->AddEntry(data1, "New 3.8/fb", "PL");
495 >  mleg->AddEntry(data2, "Old 5.1/fb", "L");
496  
497    data1->Draw("E1");
498    data2->Draw("HIST,SAMES");
# Line 746 | Line 744 | void make_JES_plot(TCut cut, string name
744  
745   void do_kinematic_plots(string mcjzb, string datajzb, bool doPF=false)
746   {
747 +  switch_overunderflow(true);
748    bool dolog=true;
749    bool nolog=false;
750  
# Line 770 | Line 769 | void do_kinematic_plots(string mcjzb, st
769      make_OFSF_plots("pfJetGoodNum40", "met[4]>100&&pfJetGoodNumBtag30>0",  7, 3, 10, true, "#(jets)", "njets_AtLeastOneBJet30");
770  
771      make_OFSF_plots("pfJetGoodNumBtag30", "met[4]>100", 5, 0, 5, true, "#(b-jets)", "nbjets");
772 +    make_OFSF_plots("pfJetGoodPtBtag[0]", "met[4]>100&&pfJetGoodNumBtag30>0", 20, 0, 400, true, "p_{T}(leading b-jet)", "ptb1");
773 +
774      make_OFSF_plots("iso1", "met[4]>100", 20, 0, 0.3, true, "lepton 1 isolation", "iso1");
775      make_OFSF_plots("iso2", "met[4]>100", 20, 0, 0.3, true, "lepton 2 isolation", "iso2");
776      //  make_OFSF_plots("pt1",  "met[4]>100", 30, 0., 300., true, "p_{T,1}", "pt1");
# Line 791 | Line 792 | void do_kinematic_plots(string mcjzb, st
792  
793    if ( doDataComp && !PlottingSetup::openBox ) {
794      TCut mllCut("");
795 <    if ( !PlottingSetup::openBox ) mllCut = "mll>120";
795 >    float massmin = 15.;
796 >    float massmax = 315;
797 >    int massnbins = 60;
798 >    if ( !PlottingSetup::openBox ) {
799 >      mllCut = "mll>120";
800 >      massmin = 120;
801 >      massmax = 360;
802 >      massnbins = 14;
803 >    }
804  
805      TCut cutSignal = cutmass&&cutnJets&&"met[4]>100";
806 <    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut,           60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig");
807 <    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"id1==0", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_ee");
799 <    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"id1==1", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_mm");
800 <
801 <    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30==0",           60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_btagVeto");
802 <    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"id1==0&&pfJetGoodNumBtag30==0", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_ee_btagVeto");
803 <    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"id1==1&&pfJetGoodNumBtag30==0", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_mm_btagVeto");
804 <
805 <    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30>0",           60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_AtLeastOneBJet");
806 <    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"id1==0&&pfJetGoodNumBtag30>0", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_ee_AtLeastOneBJet");
807 <    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"id1==1&&pfJetGoodNumBtag30>0", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_mm_AtLeastOneBJet");
806 >    make_data_comparison_plot("mll", cutOSSF,60, 15., 315.,-1., true, "m_{ll}", "mll_SF_inclusive");
807 >    make_data_comparison_plot("mll", cutOSOF,60, 15., 315.,-1., true, "m_{ll}", "mll_OF_inclusive");
808  
809 <    make_data_comparison_plot("mll", cutOSOF&&cutSignal, 60, 20., 320.,-1., false, "m_{ll}", "mll_OF_sig");
810 <    make_data_comparison_plot("mll", cutmass&&"met[4]>100&&met[4]<150&&pfJetGoodNum40<3", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_CR");
809 >    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut,           massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig");
810 >    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30==0", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig_btagVeto");
811 >    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30>0",  massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig_AtLeastOneBJet");
812 >
813 >    make_data_comparison_plot("mll", mllCut&&cutOSOF&&cutSignal, massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig");
814 >    make_data_comparison_plot("mll", cutmass&&cutOSSF&&"met[4]>100&&met[4]<150&&pfJetGoodNum40==2", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_CR");
815 >    make_data_comparison_plot("mll", cutmass&&cutOSOF&&"met[4]>100&&met[4]<150&&pfJetGoodNum40==2", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_CR");
816 >
817 >    make_data_comparison_plot("pfJetGoodNum40", cutOSSF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(jets)", "njets_SF_sig");
818 >    make_data_comparison_plot("pfJetGoodNum40", cutOSOF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(jets)", "njets_OF_sig");
819 >    make_data_comparison_plot("pfJetGoodNumBtag30", cutOSSF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(b-jets)", "nbjets_SF_sig");
820 >    make_data_comparison_plot("pfJetGoodNumBtag30", cutOSOF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(b-jets)", "nbjets_OF_sig");
821    }
822  
823  
# Line 886 | Line 896 | void do_kinematic_plots(string mcjzb, st
896   //   make_JES_plot(cutmass&&cutOSSF&&basiccut,"_ossf");
897   //   make_JES_plot(cutmass&&cutOSOF&&basiccut,"_osof");
898  
899 +  switch_overunderflow(false);
900   }
901  
902   void make_comp_plot( string var, string xlabel, string filename, float jzbcut, string mcjzb, string datajzb,
# Line 955 | Line 966 | void region_comparison_plots(string mcjz
966  
967   //  switch_overunderflow(true);  // switching overflow/underflow bins on
968      
969 <  
969 >  switch_overunderflow(true);
970      flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- the arguments changed
971    for(int ijzb=0;ijzb<(int)jzb_cuts.size();ijzb++) {
972      float jzbcut=jzb_cuts[ijzb]; // Comparison plots are done for this JZB cut
# Line 1272 | Line 1283 | if you want to start from scratch (witho
1283  
1284   void do_prediction_plot(string jzb, TCanvas *globalcanvas, float high, int use_data, bool overlay_signal = false,string subdir="" )
1285   {
1286 < //  switch_overunderflow(true);
1286 >  
1287    bool is_data=false;
1288    bool use_signal=false;
1289    if(use_data==1) is_data=true;
1290    if(use_data==2) use_signal=true;
1291 <  int nbins=50;//100;
1292 <  if(is_data) nbins=50;
1291 >  int nbins=int(high/10);//100;
1292 >  if(is_data) nbins=int(high/10);
1293    float low=0;
1294 <  float hi=500;
1294 >  float hi=high;
1295 >  
1296 >  stringstream cutpositiveS;
1297 >  cutpositiveS << "(" << jzb << ">0)";
1298 >  TCut cutpositive(cutpositiveS.str().c_str());
1299 >  stringstream cutnegativeS;
1300 >  cutnegativeS << "(" << jzb << "<0)";
1301 >  TCut cutnegative(cutnegativeS.str().c_str());
1302 >  
1303    
1304    TH1F *blankback = new TH1F("blankback","blankback",int(high/10),0,high);
1305 <  TH1F *RcorrJZBeemm   = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1306 <  TH1F *LcorrJZBeemm   = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1307 <  TH1F *RcorrJZBem     = allsamples.Draw("RcorrJZBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1308 <  TH1F *LcorrJZBem     = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1305 >  TH1F *RcorrJZBeemm   = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1306 >  TH1F *LcorrJZBeemm   = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutnegative&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1307 >  TH1F *RcorrJZBem     = allsamples.Draw("RcorrJZBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1308 >  TH1F *LcorrJZBem     = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutnegative&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1309  
1310    blankback->GetXaxis()->SetTitle(RcorrJZBeemm->GetXaxis()->GetTitle());
1311    blankback->GetYaxis()->SetTitle(RcorrJZBeemm->GetYaxis()->GetTitle());
# Line 1301 | Line 1320 | void do_prediction_plot(string jzb, TCan
1320    
1321    TH1F *RcorrJZBeemmNoS;
1322  
1323 <    //these are for the ratio
1324 <  
1325 <  TH1F *JRcorrJZBeemm   = allsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1326 <  TH1F *JLcorrJZBeemm   = allsamples.Draw("JLcorrJZBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1327 <  TH1F *JRcorrJZBem     = allsamples.Draw("JRcorrJZBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1309 <  TH1F *JLcorrJZBem     = allsamples.Draw("JLcorrJZBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1323 >  //these are for the ratio
1324 >  TH1F *JRcorrJZBeemm   = allsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1325 >  TH1F *JLcorrJZBeemm   = allsamples.Draw("JLcorrJZBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutnegative&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1326 >  TH1F *JRcorrJZBem     = allsamples.Draw("JRcorrJZBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1327 >  TH1F *JLcorrJZBem     = allsamples.Draw("JLcorrJZBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutnegative&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1328    
1329    TH1F *JRcorrJZBSBem;
1330    TH1F *JLcorrJZBSBem;
1331    TH1F *JRcorrJZBSBeemm;
1332    TH1F *JLcorrJZBSBeemm;
1333    
1334 <  if(use_data==2 || overlay_signal) RcorrJZBeemmNoS = allsamples.Draw("RcorrJZBeemmNoS",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,false);
1334 >  if(use_data==2 || overlay_signal) RcorrJZBeemmNoS = allsamples.Draw("RcorrJZBeemmNoS",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,false);
1335  
1336    
1337    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
1338 <    RcorrJZBSBem   = allsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1339 <    LcorrJZBSBem   = allsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1340 <    RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1341 <    LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1338 >    RcorrJZBSBem   = allsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1339 >    LcorrJZBSBem   = allsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutnegative&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1340 >    RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1341 >    LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutnegative&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1342      
1343      //these are for the ratio
1344 <    JRcorrJZBSBem   = allsamples.Draw("JRcorrJZBSBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1345 <    JLcorrJZBSBem   = allsamples.Draw("JLcorrJZBSBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1346 <    JRcorrJZBSBeemm = allsamples.Draw("JRcorrJZBSBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1347 <    JLcorrJZBSBeemm = allsamples.Draw("JLcorrJZBSBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1344 >    JRcorrJZBSBem   = allsamples.Draw("JRcorrJZBSBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutpositive&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1345 >    JLcorrJZBSBem   = allsamples.Draw("JLcorrJZBSBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutnegative&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1346 >    JRcorrJZBSBeemm = allsamples.Draw("JRcorrJZBSBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutpositive&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1347 >    JLcorrJZBSBeemm = allsamples.Draw("JLcorrJZBSBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutnegative&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1348    }
1349    
1350    TH1F *lm4RcorrJZBeemm;
1351 <  if(overlay_signal || use_data == 2 || use_data == 1) lm4RcorrJZBeemm = allsamples.Draw("lm4RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,allsamples.FindSample("LM"));
1351 >  if(overlay_signal || use_data == 2 || use_data == 1) lm4RcorrJZBeemm = allsamples.Draw("lm4RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,allsamples.FindSample("LM"));
1352    
1353    flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed.
1354    
# Line 1394 | Line 1412 | void do_prediction_plot(string jzb, TCan
1412    SQRT(BpredSys);
1413    BpredSys->Divide(JBpred);
1414  
1397  
1415    flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed
1416    TH1F *Tpred = (TH1F*)RcorrJZBem->Clone("Bpred");
1417    Tpred->Add(LcorrJZBem,-1.0);
# Line 1462 | Line 1479 | void do_prediction_plot(string jzb, TCan
1479      Bpred->SetLineWidth(2);
1480      predcomppad->cd();
1481      predcomppad->SetLogy(1);
1465    
1482      TH1F *jzbnegative = (TH1F*)LcorrJZBeemm->Clone("jzbnegative");
1483      TH1F *sidebandsemu = (TH1F*)Bpred->Clone("sidebandsemu");
1484      sidebandsemu->Add(jzbnegative,-1);
# Line 1581 | Line 1597 | void do_prediction_plot(string jzb, TCan
1597    //save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,Bpredsaveas,true,use_data!=1,ytitle);
1598    save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,subdir+Bpredsaveas,true,false,ytitle,BpredSys);//not extending the y range anymore up to 4
1599  
1600 +
1601    
1602    flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
1603    // The part below is meaningless for the offpeak analysis (it's a comparison of the different estimates but there is but one estimate!)
# Line 1675 | Line 1692 | void do_prediction_plot(string jzb, TCan
1692      delete JLcorrJZBSBeemm;
1693    }
1694    if(overlay_signal || use_data==2) delete lm4RcorrJZBeemm;
1678  switch_overunderflow(false);
1695   }
1696  
1697   void do_prediction_plots(string mcjzb, string datajzb, float DataSigma, float MCSigma, bool overlay_signal ) {
1698 +  switch_overunderflow(true);
1699    TCanvas *globalcanvas = new TCanvas("globalcanvas","Prediction Canvas");
1700    do_prediction_plot(datajzb,globalcanvas,jzbHigh ,data,overlay_signal);
1701    if ( !PlottingSetup::Approved ) {
# Line 1687 | Line 1704 | void do_prediction_plots(string mcjzb, s
1704    } else {
1705      write_info(__FUNCTION__,"You set approved to true, therefore not producing prediction/observation plots for MC with and without signal.");
1706    }
1707 < }
1708 <
1692 < void do_ratio_plot(int is_data,vector<float> binning, string jzb, TCanvas *can, float high=-9999) {
1693 <  bool do_data=0;
1694 <  bool dosignal=0;
1695 <  if(is_data==1) do_data=1;
1696 <  if(is_data==2) dosignal=1;
1697 <  TH1F *RcorrJZBeemm   = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,do_data, luminosity,dosignal);
1698 <  TH1F *LcorrJZBeemm   = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,do_data, luminosity,dosignal);
1699 <  TH1F *RcorrJZBem     = allsamples.Draw("RcorrJZBem",jzb.c_str(),binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,do_data, luminosity,dosignal);
1700 <  TH1F *LcorrJZBem     = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,do_data, luminosity,dosignal);
1701 <  
1702 <  TH1F *RcorrJZBSBem;
1703 <  TH1F *LcorrJZBSBem;
1704 <  TH1F *RcorrJZBSBeemm;
1705 <  TH1F *LcorrJZBSbeemm;
1706 <  
1707 <  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
1708 <    RcorrJZBSBem   = allsamples.Draw("RcorrJZBSbem",jzb.c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,do_data, luminosity,dosignal);
1709 <    LcorrJZBSBem   = allsamples.Draw("LcorrJZBSbem",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,do_data, luminosity,dosignal);
1710 <    RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSbeemm",jzb.c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,do_data, luminosity,dosignal);
1711 <    LcorrJZBSbeemm = allsamples.Draw("LcorrJZBSbeemm",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,do_data, luminosity,dosignal);
1712 <  }
1713 <  
1714 <
1715 <
1716 <
1717 <  flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
1718 <  TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred");
1719 <  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
1720 <    Bpred->Add(RcorrJZBem,1.0/3);
1721 <    Bpred->Add(LcorrJZBem,-1.0/3);
1722 <    Bpred->Add(RcorrJZBSBem,1.0/3);
1723 <    Bpred->Add(LcorrJZBSBem,-1.0/3);
1724 <    Bpred->Add(RcorrJZBSBeemm,1.0/3);
1725 <    Bpred->Add(LcorrJZBSbeemm,-1.0/3);
1726 <  } else {
1727 <    Bpred->Add(RcorrJZBem,1.0);
1728 <    Bpred->Add(LcorrJZBem,-1.0);
1729 <  }
1730 <
1731 <  can->cd();
1732 <  can->SetLogy(0);
1733 <  Bpred->SetLineColor(kRed);
1734 <  Bpred->SetStats(0);
1735 <  if(high>0) Bpred->GetXaxis()->SetRangeUser(0,high);
1736 <  TH1F *JZBratioforfitting=(TH1F*)RcorrJZBeemm->Clone("JZBratioforfitting");
1737 <  JZBratioforfitting->Divide(Bpred);
1738 <  TGraphAsymmErrors *JZBratio = histRatio(RcorrJZBeemm,Bpred,is_data,binning,false);
1739 <  
1740 <  
1741 <  JZBratio->SetTitle("");
1742 <  JZBratio->GetYaxis()->SetRangeUser(0.0,9.0);
1743 < //  if(is_data==1) JZBratio->GetXaxis()->SetRangeUser(0,jzbHigh );
1744 <  
1745 <  TF1 *pol0 = new TF1("pol0","[0]",0,1000);
1746 <  TF1 *pol0d = new TF1("pol0","[0]",0,1000);
1747 < //  straightline_fit->SetParameter(0,1);
1748 <  JZBratioforfitting->Fit(pol0,"Q0R","",0,30);
1749 <  pol0d->SetParameter(0,pol0->GetParameter(0));
1750 <  
1751 <  JZBratio->GetYaxis()->SetTitle("Observed/Predicted");
1752 <  JZBratio->GetXaxis()->SetTitle("JZB [GeV]");
1753 <  if ( high>0 ) JZBratio->GetXaxis()->SetRangeUser(0.0,high);
1754 <  JZBratio->GetYaxis()->SetNdivisions(519);
1755 <  JZBratio->GetYaxis()->SetRangeUser(0.0,4.0);
1756 <  JZBratio->GetYaxis()->CenterTitle();
1757 <  JZBratio->GetXaxis()->CenterTitle();
1758 <  JZBratio->SetMarkerSize(DataMarkerSize);
1759 <  JZBratio->Draw("AP");
1760 <  /////----------------------------
1761 <  TPaveText *writeresult = new TPaveText(0.15,0.78,0.49,0.91,"blNDC");
1762 <  writeresult->SetFillStyle(4000);
1763 <  writeresult->SetFillColor(kWhite);
1764 <  writeresult->SetTextFont(42);
1765 <  writeresult->SetTextSize(0.03);
1766 <  writeresult->SetTextAlign(12);
1767 <  ostringstream jzb_agreement_data_text;
1768 <  jzb_agreement_data_text<< setprecision(2) << "mean =" << pol0->GetParameter(0) << " #pm " << setprecision(1) <<  pol0->GetParError(0);
1769 <  if(is_data==1) fitresultconstdata=pol0->GetParameter(0);// data
1770 <  if(is_data==0) fitresultconstmc=pol0->GetParameter(0); // monte carlo, no signal
1771 < /*  if(is_data) writeresult->AddText("Data closure test");
1772 <  else writeresult->AddText("MC closure test");
1773 <  */
1774 <  writeresult->AddText(jzb_agreement_data_text.str().c_str());
1775 < //  writeresult->Draw("same");
1776 < //  pol0d->Draw("same");
1777 <  TF1 *topline =  new TF1("","1.5",0,1000);
1778 <  TF1 *bottomline =  new TF1("","0.5",0,1000);
1779 <  topline->SetLineColor(kBlue);
1780 <  topline->SetLineStyle(2);
1781 <  bottomline->SetLineColor(kBlue);
1782 <  bottomline->SetLineStyle(2);
1783 < //  topline->Draw("same");
1784 < //  bottomline->Draw("same");
1785 <  TF1 *oneline = new TF1("","1.0",0,1000);
1786 <  oneline->SetLineColor(kBlue);
1787 <  oneline->SetLineStyle(1);
1788 <  oneline->Draw("same");
1789 <  TLegend *phony_leg = make_legend("ratio",0.6,0.55,false);//this line is just to have the default CMS Preliminary (...) on the canvas as well.
1790 <  if(is_data==1) DrawPrelim();
1791 <  else DrawMCPrelim();
1792 <  TLegend *leg = new TLegend(0.55,0.75,0.89,0.89);
1793 <  leg->SetTextFont(42);
1794 <  leg->SetTextSize(0.04);
1795 < //   if(is_data==1) leg->SetHeader("Ratio (data)");
1796 < //   else leg->SetHeader("Ratio (MC)");
1797 <
1798 <  TString MCtitle("MC ");
1799 <  if (is_data==1) MCtitle = "";
1800 <
1801 <  leg->SetFillStyle(4000);
1802 <  leg->SetFillColor(kWhite);
1803 <  leg->SetTextFont(42);
1804 < //  leg->AddEntry(topline,"+20\% sys envelope","l");
1805 <  leg->AddEntry(JZBratio,MCtitle+"obs / "+MCtitle+"pred","p");
1806 <  leg->AddEntry(oneline,"ratio = 1","l");
1807 < //  leg->AddEntry(pol0d,"fit in [0,30] GeV","l");
1808 < //  leg->AddEntry(bottomline,"#pm50% envelope","l");
1809 <
1810 <
1811 <  //leg->Draw("same"); // no longer drawing legend
1812 <
1813 <  if(is_data==1) CompleteSave(can, "jzb_ratio_data");
1814 <  if(is_data==0) CompleteSave(can, "jzb_ratio_mc");
1815 <  if(is_data==2) CompleteSave(can, "jzb_ratio_mc_BandS");//special case, MC with signal!
1816 <  
1817 <  delete RcorrJZBeemm;
1818 <  delete LcorrJZBeemm;
1819 <  delete RcorrJZBem;
1820 <  delete LcorrJZBem;
1821 <  
1822 <  delete RcorrJZBSBem;
1823 <  delete LcorrJZBSBem;
1824 <  delete RcorrJZBSBeemm;
1825 <  delete LcorrJZBSbeemm;
1826 < }
1827 <
1828 < void do_ratio_plots(string mcjzb,string datajzb,vector<float> ratio_binning) {
1829 <  TCanvas *globalc = new TCanvas("globalc","Ratio Plot Canvas");
1830 <  globalc->SetLogy(0);
1831 <  
1832 <  do_ratio_plot(mc,ratio_binning,mcjzb,globalc, jzbHigh  );
1833 <  do_ratio_plot(data,ratio_binning,datajzb,globalc, jzbHigh  );
1834 <  do_ratio_plot(mcwithsignal,ratio_binning,mcjzb,globalc, jzbHigh  );
1707 >  delete globalcanvas;
1708 >  switch_overunderflow(false);
1709   }
1710  
1711   string give_jzb_expression(float peak, int type) {
# Line 2099 | Line 1973 | void produce_stretched_jzb_plots(string
1973    
1974  
1975   void diboson_plots(string mcjzb, string datajzb,vector<float> ratio_binning) {
1976 +  switch_overunderflow(true);
1977    vector<int> SamplesToBeModified = allsamples.FindSampleBySampleName("WW/WZ/ZZ");
1978    
1979    if(SamplesToBeModified.size()==0 || SamplesToBeModified[0]==-1) {
# Line 2138 | Line 2013 | void diboson_plots(string mcjzb, string
2013      dout << "     Reset xs for sample " << (allsamples.collection)[SamplesToBeModified[i]].samplename << " from " << Upxs << " to " << (allsamples.collection)[SamplesToBeModified[i]].xs << " (by a factor of " << stretchfactor << ") and reset the correct name (from " << Upname << ")" << endl;
2014      
2015    }
2016 <  
2016 > //   switch_overunderflow(false);
2017   }
2018  
2019  
# Line 2173 | Line 2048 | void draw_normalized_data_vs_data_histo(
2048  
2049  
2050   void jzb_plots(string mcjzb, string datajzb,vector<float> ratio_binning) {
2051 +  switch_overunderflow(true);
2052    TCanvas *can = new TCanvas("can","JZB Plots Canvas");
2053    float max=jzbHigh ;
2054    float min=-120;
# Line 2209 | Line 2085 | void jzb_plots(string mcjzb, string data
2085      if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning);
2086    }
2087    delete can;
2088 +  switch_overunderflow(false);
2089   }
2090  
2091  
# Line 2749 | Line 2626 | void ttbar_sidebands_comparison(string m
2626    //in the case of the on peak analysis, we compare the 3 control regions to the real value
2627    //in the case of the OFF peak analysis, we compare our control region to the real value
2628    TCut weightbackup=cutWeight;
2629 +  switch_overunderflow(true);
2630    
2631    bool doPURW=false;
2632    
# Line 2997 | Line 2875 | void ttbar_sidebands_comparison(string m
2875  
2876    delete tcan;
2877    cutWeight=weightbackup;
2878 +  switch_overunderflow(false);
2879   }
2880  
2881   void ttbar_sidebands_comparison(string mcjzb, vector<float> jzb_binning) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines