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.12 by buchmann, Wed Apr 18 09:20:36 2012 UTC vs.
Revision 1.19 by buchmann, Wed May 23 15:13:36 2012 UTC

# Line 102 | Line 102 | void make_special_obs_pred_mll_plot(stri
102    TH1F *RcorrJZBSBeemm;
103    TH1F *LcorrJZBSBeemm;
104    
105 <  TH1F *RcorrJZBeemmNoS;
105 > //  TH1F *RcorrJZBeemmNoS;
106  
107    if(PlottingSetup::RestrictToMassPeak) {
108      RcorrJZBSBem   = allsamples.Draw("RcorrJZBSBem",  "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&largerzero,data, luminosity);
# Line 189 | Line 189 | void make_special_mll_plot(int nbins, fl
189    TIter next(bgleg->GetListOfPrimitives());
190    TObject* obj;
191    // Copy the nice bkgd legend skipping the "data"
192 <  while ( obj = next() )
192 >  while ( (obj = next()) )
193      if ( strcmp(((TLegendEntry*)obj)->GetObject()->GetName(),"datahistoOSSF") )
194        kinleg->GetListOfPrimitives()->Add(obj);
195  
# Line 208 | Line 208 | void draw_ratio_plot(TH1* hdata, THStack
208    TIter next(hmc.GetHists());
209    TObject* obj;
210    TH1* hratio = NULL;
211 <  while ( obj = next() ) {
211 >  while ( (obj = next()) ) {
212      if ( !hratio ) {
213        hratio = (TH1*)obj->Clone();
214        hratio->SetName("hratio");
# Line 430 | Line 430 | void do_kinematic_plots(string mcjzb, st
430    bool dolog=true;
431    bool nolog=false;
432    if(doPF) write_warning(__FUNCTION__,"Please use caution when trying to produce PF plots; not all versions of the JZB trees have these variables!");
433 <  float mll_low=40;
433 >  float mll_low=50;
434    float mll_hi=160;
435    if(!PlottingSetup::RestrictToMassPeak) {
436 <        mll_low=10;
436 >        mll_low=20;
437          mll_hi=210;
438    }
439 <  /*
439 >  
440 >  make_kin_plot("met[4]","",40,0,200,dolog,"MET [GeV]","met",doPF,true);
441    make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll",doPF,true);
442    make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof",doPF,true,true);
443    make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_ee",doPF,true);
# Line 445 | Line 446 | void do_kinematic_plots(string mcjzb, st
446    make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true);
447    make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true);
448    make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true);
449 <  make_kin_plot("mll","",(int)((350-mll_low)),mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF);/*
449 >  make_kin_plot("mll","",(int)((350-mll_low)),mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF);
450    make_kin_plot("numVtx","",(int)(30.5-(-0.5)),-0.5,30.5,nolog,"N(Vtx)","numVtx",doPF);
451    make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF);
452    make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF);
# Line 455 | Line 456 | void do_kinematic_plots(string mcjzb, st
456    make_kin_plot("eta1","",40,-5,5,nolog,"#eta_{l}","eta",doPF);
457    make_kin_plot("jzb[1]","",100,-150,150,dolog,"JZB [GeV]","jzb_ossf",doPF);
458    make_kin_plot("pfJetGoodNum","",8,0.5,8.5,dolog,"nJets","nJets",doPF);
459 <  make_kin_plot("pfJetGoodNum","",8,0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF);*//*
459 >  make_kin_plot("pfJetGoodNum","",8,0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF);
460    if(!doPF) make_special_mll_plot((int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]");
461    stringstream jzbcut;
462    jzbcut << "((is_data&&("<<datajzb<<")>100)||(!is_data&&("<<mcjzb<<")>100))";
# Line 470 | Line 471 | void do_kinematic_plots(string mcjzb, st
471    stringstream jzbcut3;
472    jzbcut3 << "((is_data&&("<<datajzb<<")>50)||(!is_data&&("<<mcjzb<<")>50))";
473    make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB50",doPF,true);   make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof_aboveJZB50",doPF,true,true);
474 <  */
474 >  
475 >  make_special_obs_pred_mll_plot(mcjzb,0);
476    make_special_obs_pred_mll_plot(mcjzb,50);
477    make_special_obs_pred_mll_plot(mcjzb,100);
478    make_special_obs_pred_mll_plot(mcjzb,150);
# Line 547 | Line 549 | void region_comparison_plots(string mcjz
549      
550    
551      flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- the arguments changed
552 <  for(int ijzb=0;ijzb<jzb_cuts.size();ijzb++) {
552 >  for(int ijzb=0;ijzb<(int)jzb_cuts.size();ijzb++) {
553      float jzbcut=jzb_cuts[ijzb]; // Comparison plots are done for this JZB cut
554      float mll_low=50;float mll_high=170;
555      if(!PlottingSetup::RestrictToMassPeak) {
# Line 1009 | Line 1011 | void do_prediction_plot(string jzb, TCan
1011    blankback->Draw();
1012    if(use_data==1)
1013    {
1014 +    //Bpred->SetLineWidth(3); //paper style.overruled.
1015 +    //lm4RcorrJZBeemm->SetLineWidth(3); //paper style.overruled.
1016      analytical_function = do_extended_fit_to_plot(Bpred,Tpred,LcorrJZBeemm,LcorrJZBem,is_data);
1017      kinpad->cd();//necessary because the extended fit function creates its own canvas
1018      RcorrJZBeemm->Draw("e1x0,same");
1019  
1020      Bpred->Draw("hist,same");
1021 <    analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same");
1021 >    //analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same");
1022      RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP!
1023      lm4RcorrJZBeemm->Draw("hist,same");
1024      legBpred->AddEntry(RcorrJZBeemm,"observed","p");
# Line 1050 | Line 1054 | void do_prediction_plot(string jzb, TCan
1054      Bpred->Draw("hist,same");
1055   //    analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same");
1056      RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP!
1057 < //    TH1F *lm4RcorrJZBeemmC = (TH1F*)lm4RcorrJZBeemm->Clone("lm4RcorrJZBeemmC");
1054 < //    lm4RcorrJZBeemmC->SetLineColor(kOrange+1);
1055 <    lm4RcorrJZBeemm->SetLineColor(kOrange+1);
1056 < //    lm4RcorrJZBeemmC->Draw("histo,same");
1057 > //    lm4RcorrJZBeemm->SetLineColor(kOrange+1);
1058      lm4RcorrJZBeemm->SetLineWidth(2);
1059 +    //lm4RcorrJZBeemm->SetLineWidth(2); // paper style. overruled.
1060      lm4RcorrJZBeemm->Draw("histo,same");
1061      DrawPrelim();
1062      TLegend *speciallegBpred = make_legend("",0.45,0.55);
1063 +    //TLegend *speciallegBpred = make_legend("",0.35,0.55); // paper style. overruled.
1064      speciallegBpred->AddEntry(RcorrJZBeemm,"Data","pl");
1065      speciallegBpred->AddEntry(Bpred,"Total background","l");
1066      speciallegBpred->AddEntry(jzbnegative,"JZB<0 (data)","f");
# Line 1087 | Line 1090 | void do_prediction_plot(string jzb, TCan
1090    }
1091    if(use_data==0) {
1092      RcorrJZBeemm->Draw("e1x0,same");
1093 +    //Bpred->SetLineWidth(3); // paper style. overruled.
1094      Bpred->Draw("hist,same");
1095      RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP!
1096      legBpred->AddEntry(RcorrJZBeemm,"MC true","p");
1097 <    legBpred->AddEntry(Bpred,"MC predicted","l");
1097 >    legBpred->AddEntry(Bpred,"MC predicted","l");    
1098      if(versok) legBpred->AddEntry((TObject*)0,"",""); // Just for alignment // causes seg fault on root v5.18
1099      if(versok) legBpred->AddEntry((TObject*)0,"",""); // causes seg fault on root v5.18
1100      if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l");
# Line 1101 | Line 1105 | void do_prediction_plot(string jzb, TCan
1105    }
1106    if(use_data==2) {
1107      RcorrJZBeemm->Draw("e1x0,same");
1108 +    //Bpred->SetLineWidth(3); // paper style. overruled.
1109      Bpred->Draw("hist,same");
1110      RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP!
1111      legBpred->AddEntry(RcorrJZBeemm,"MC true","p");
# Line 1116 | Line 1121 | void do_prediction_plot(string jzb, TCan
1121   //      CompleteSave(globalcanvas,"Bpred_MCwithS"); // done below in save_with_ratio
1122      }
1123      {
1124 +      //lm4RcorrJZBeemm->SetLineWidth(3); //paper style. overruled.
1125 +      //RcorrJZBeemmNoS->SetLineWidth(3); //paper style. overruled.
1126 +      //lm4RcorrJZBeemm->SetLineStyle(2); //paper style. overruled.
1127 +      //RcorrJZBeemmNoS->SetLineStyle(3); //paper style. overruled.
1128 +      //lm4RcorrJZBeemm->SetLineColor(kOrange+1); //paper style. overruled.
1129 +      
1130        RcorrJZBeemmNoS->SetLineStyle(2);
1131        legBpred2->AddEntry(RcorrJZBeemmNoS,"MC B","l");
1132        legBpred2->AddEntry(lm4RcorrJZBeemm,"MC S","l");
# Line 1231 | Line 1242 | void do_prediction_plot(string jzb, TCan
1242   void do_prediction_plots(string mcjzb, string datajzb, float DataSigma, float MCSigma, bool overlay_signal ) {
1243    TCanvas *globalcanvas = new TCanvas("globalcanvas","Prediction Canvas");
1244    do_prediction_plot(datajzb,globalcanvas,DataSigma,jzbHigh ,data,overlay_signal);
1245 <  do_prediction_plot(mcjzb,globalcanvas,MCSigma,jzbHigh ,mc,overlay_signal);
1246 <  do_prediction_plot(mcjzb,globalcanvas,MCSigma,jzbHigh ,mcwithsignal,overlay_signal);
1245 >  if ( !PlottingSetup::Approved ) {
1246 >    do_prediction_plot(mcjzb,globalcanvas,MCSigma,jzbHigh ,mc,overlay_signal);
1247 >    do_prediction_plot(mcjzb,globalcanvas,MCSigma,jzbHigh ,mcwithsignal,overlay_signal);
1248 >  } else {
1249 >    write_info(__FUNCTION__,"You set approved to true, therefore not producing prediction/observation plots for MC with and without signal.");
1250 >  }
1251   }
1252  
1253   void do_ratio_plot(int is_data,vector<float> binning, string jzb, TCanvas *can, float high=-9999) {
# Line 1652 | Line 1667 | void diboson_plots(string mcjzb, string
1667    
1668    
1669    dout << "Going to increase the cross section for diboson samples ... " << endl;
1670 <  for(int i=0;i<SamplesToBeModified.size();i++) {
1670 >  for(int i=0;i<(int)SamplesToBeModified.size();i++) {
1671      float origxs=(allsamples.collection)[SamplesToBeModified[i]].xs;
1672      (allsamples.collection)[SamplesToBeModified[i]].xs=origxs*stretchfactor;
1673      dout << "     Increased xs for sample " << (allsamples.collection)[SamplesToBeModified[i]].filename << " from " << origxs << " to " << (allsamples.collection)[SamplesToBeModified[i]].xs << " (by a factor of " << stretchfactor << ")" << endl;
# Line 1662 | Line 1677 | void diboson_plots(string mcjzb, string
1677    }
1678    
1679    dout << "Going to produce JZB plots" << endl;
1680 < //  produce_stretched_jzb_plots(mcjzb,datajzb,ratio_binning);
1680 >  produce_stretched_jzb_plots(mcjzb,datajzb,ratio_binning);
1681    TCanvas *gloca = new TCanvas("gloca","gloca");
1682    float sigma=123456;
1683    
# Line 1672 | Line 1687 | void diboson_plots(string mcjzb, string
1687    delete gloca;
1688  
1689    dout << "Going to reset the cross section for diboson samples ... " << endl;
1690 <  for(int i=0;i<SamplesToBeModified.size();i++) {
1690 >  for(int i=0;i<(int)SamplesToBeModified.size();i++) {
1691      float Upxs=(allsamples.collection)[SamplesToBeModified[i]].xs;
1692      (allsamples.collection)[SamplesToBeModified[i]].xs=(allsamples.collection)[SamplesToBeModified[i]].xs*(1.0/stretchfactor);
1693      string Upname=(allsamples.collection)[SamplesToBeModified[i]].samplename;
# Line 1695 | Line 1710 | void jzb_plots(string mcjzb, string data
1710    for(int i=0;i<=coarserbins;i++)coarse_binning.push_back(min+i*(max-min)/((float)coarserbins));
1711    for(int i=0;i<=rebinnedbins;i++)coarsest_binning.push_back(min+i*(max-min)/((float)rebinnedbins));
1712  
1713 <  draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP",can,binning);
1714 <  draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP",can,binning);
1715 <  draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_SFZP",can,binning);
1716 <  draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_SFZP",can,binning);
1717 <  draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_OFZP",can,binning);
1718 <  draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_OFZP",can,binning);
1719 <  flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
1720 <  if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning);
1721 <  if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning);
1713 >  if ( !PlottingSetup::Approved ) {
1714 >    draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP",can,binning);
1715 >    draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP",can,binning);
1716 >    draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_SFZP",can,binning);
1717 >    draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_SFZP",can,binning);
1718 >    draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_OFZP",can,binning);
1719 >    draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_OFZP",can,binning);
1720 >    flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
1721 >    if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning);
1722 >    if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning);
1723 >  }
1724    
1725    draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP_coarse",can,coarse_binning);
1726 <  draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP_coarse",can,coarse_binning);
1727 <  flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
1728 <  if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarse",can,coarse_binning);
1729 <  if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning);
1730 <
1731 < //  draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP_coarsest",can,coarsest_binning);
1715 < //  draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP_coarsest",can,coarsest_binning);
1716 < //  flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
1717 < //  if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarsest",can,coarsest_binning);
1718 < //  if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarsest",can,coarsest_binning);
1726 >  if ( !PlottingSetup::Approved ) {
1727 >    draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP_coarse",can,coarse_binning);
1728 >    flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
1729 >    if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarse",can,coarse_binning);
1730 >    if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning);
1731 >  }
1732    delete can;
1733   }
1734  
# Line 1771 | Line 1784 | void compute_MC_yields(string mcjzb,vect
1784    string posneg[] = {"pos","neg"};
1785    TCut tkRegions[] = {cutOSSF&&cutnJets&&cutmass,cutOSOF&&cutnJets&&cutmass,cutOSSF&&cutnJets&&sidebandcut,cutOSOF&&cutnJets&&sidebandcut};
1786  
1787 <  for(int ijzb=0;ijzb<jzb_cuts.size();ijzb++) {
1787 >  for(int ijzb=0;ijzb<(int)jzb_cuts.size();ijzb++) {
1788      TCut jzbMC[]  = { give_jzb_expression(mcjzb,jzb_cuts[ijzb],"pos"), give_jzb_expression(mcjzb,jzb_cuts[ijzb],"neg") };
1789      dout << "_________________________________________________________" << endl;
1790      dout << "Table for JZB> " << jzb_cuts[ijzb] << endl;
1791 <    for(int isample=0;isample<(allsamples.collection).size();isample++) {
1791 >    for(int isample=0;isample<(int)(allsamples.collection).size();isample++) {
1792        if(!(allsamples.collection)[isample].is_data) dout << (allsamples.collection)[isample].samplename << "  &  ";
1793        else dout << "Sample & ";
1794        for(int iregion=0;iregion<nRegions;iregion++) {
# Line 2034 | Line 2047 | void draw_ttbar_and_zjets_shape_for_one_
2047  
2048   void draw_ttbar_and_zjets_shape(string mcjzb, string datajzb) {
2049    int all_leptons=-1;
2037  int electrons_only=0;
2038  int mu_only=1;
2039  int twojetswith50gev=1;
2050    int threejetswith30gev=0;
2051   /*  
2052 +  int twojetswith50gev=1;
2053 +  int electrons_only=0;
2054 +  int mu_only=1;
2055 +
2056    draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,twojetswith50gev);
2057    draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,threejetswith30gev);
2058    
# Line 2059 | Line 2073 | void find_correction_factors(string &jzb
2073    cancorr->SetRightMargin(0.13);
2074    flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
2075    TCut zptforresponsepresentation("pt<600"&&cutmass&&cutOSSF&&"((sumJetPt[1]/pt)<5.0)");
2076 +  if(PlottingSetup::DoBTag) zptforresponsepresentation=zptforresponsepresentation&&PlottingSetup::bTagRequirement;
2077    TH2F *niceresponseplotd = new TH2F("niceresponseplotd","",100,0,600,100,0,5);
2078    (allsamples.collection)[allsamples.FindSample("Data")[0]].events->Draw("sumJetPt[1]/pt:pt>>niceresponseplotd",zptforresponsepresentation);
2079    niceresponseplotd->SetStats(0);
# Line 2069 | Line 2084 | void find_correction_factors(string &jzb
2084    niceresponseplotd->Draw("COLZ");
2085    TProfile * profd = (TProfile*)niceresponseplotd->ProfileX();
2086    profd->SetMarkerSize(DataMarkerSize);
2087 <  profd->Fit("pol0","","same,e1",30,400);
2087 >  profd->Fit("pol0","","same,e1",100,400);
2088    DrawPrelim();
2089    TText* title = write_text(0.5,0.7,"Data");
2090    title->SetTextAlign(12);
# Line 2095 | Line 2110 | void find_correction_factors(string &jzb
2110    (allsamples.collection)[allsamples.FindSample("DY")[0]].events->Draw("sumJetPt[1]/pt:pt",zptforresponsepresentation,"PROF,same");
2111    TProfile * profm = (TProfile*)niceresponseplotm->ProfileX();
2112    profm->SetMarkerSize(DataMarkerSize);
2113 <  profm->Fit("pol0","","same,e1",30,400);
2113 >  profm->Fit("pol0","","same,e1",100,400);
2114    DrawMCPrelim();
2115    title = write_text(0.5,0.7,"MC simulation");
2116    title->SetTextAlign(12);
# Line 2131 | Line 2146 | void pick_up_events(string cut) {
2146    allsamples.PickUpEvents(cut);
2147   }
2148  
2149 < void save_template(string mcjzb, string datajzb,vector<float> jzb_cuts,float MCPeakError,float DataPeakError) {
2149 > void save_template(string mcjzb, string datajzb,vector<float> jzb_cuts,float MCPeakError,float DataPeakError, vector<float> jzb_shape_limit_bins) {
2150    dout << "Saving configuration template!" << endl;
2151    ofstream configfile;
2152    configfile.open("../DistributedModelCalculations/last_configuration.C");
# Line 2151 | Line 2166 | void save_template(string mcjzb, string
2166    configfile<<"string datajzb=\"datajzb_ERROR\";\n";
2167    configfile<<"string mcjzb=\"mcjzb_ERROR\";\n";
2168    configfile<<"vector<float>jzb_cuts;\n";
2169 +  configfile<<"vector<float>jzb_shape_limit_bins;\n";
2170    configfile<<"float MCPeakError=-999;\n";
2171    configfile<<"float DataPeakError=-999;\n";
2172    configfile<<"}\n\n";
# Line 2160 | Line 2176 | void save_template(string mcjzb, string
2176    configfile<<"mcjzb=\""<<mcjzb<<"\";\n\n";
2177    configfile<<"\n\nMCPeakError="<<MCPeakError<<";\n";
2178    configfile<<"DataPeakError="<<DataPeakError<<";\n\n";
2179 <  for(int i=0;i<jzb_cuts.size();i++) configfile<<"jzb_cuts.push_back("<<jzb_cuts[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
2179 >  for(int i=0;i<(int)jzb_cuts.size();i++) configfile<<"jzb_cuts.push_back("<<jzb_cuts[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
2180    configfile<<"\n\n";
2181 <  for(int i=0;i<Nobs.size();i++) configfile<<"Nobs.push_back("<<Nobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
2182 <  for(int i=0;i<Npred.size();i++) configfile<<"Npred.push_back("<<Npred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
2183 <  for(int i=0;i<Nprederr.size();i++) configfile<<"Nprederr.push_back("<<Nprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
2181 >  for(int i=0;i<(int)Nobs.size();i++) configfile<<"Nobs.push_back("<<Nobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
2182 >  for(int i=0;i<(int)Npred.size();i++) configfile<<"Npred.push_back("<<Npred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
2183 >  for(int i=0;i<(int)Nprederr.size();i++) configfile<<"Nprederr.push_back("<<Nprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
2184 >  configfile<<"\n\n";
2185 >  for(int i=0;i<(int)flippedNobs.size();i++) configfile<<"flippedNobs.push_back("<<flippedNobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
2186 >  for(int i=0;i<(int)flippedNpred.size();i++) configfile<<"flippedNpred.push_back("<<flippedNpred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
2187 >  for(int i=0;i<(int)flippedNprederr.size();i++) configfile<<"flippedNprederr.push_back("<<flippedNprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n\n";
2188 >  for(int i=0;i<(int)jzb_shape_limit_bins.size();i++) configfile<<"jzb_shape_limit_bins.push_back("<<jzb_shape_limit_bins[i]<<"); // JZB shape bin boundary at " << jzb_shape_limit_bins[i] << "\n";
2189    configfile<<"\n\n";
2169  for(int i=0;i<flippedNobs.size();i++) configfile<<"flippedNobs.push_back("<<flippedNobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
2170  for(int i=0;i<flippedNpred.size();i++) configfile<<"flippedNpred.push_back("<<flippedNpred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
2171  for(int i=0;i<flippedNprederr.size();i++) configfile<<"flippedNprederr.push_back("<<flippedNprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n";
2190    configfile<<"\n\n";
2191    configfile<<"luminosity="<<luminosity<<";\n";
2192    configfile<<"RestrictToMassPeak="<<RestrictToMassPeak<<";//defines the type of analysis we're running\n";
# Line 2194 | Line 2212 | void draw_all_ttbar_histos(TCanvas *can,
2212    float max=histos[0]->GetMaximum();
2213    if(manualmin>=0) min=manualmin;
2214    else {
2215 <    for(int i=1;i<histos.size();i++) {
2215 >    for(int i=1;i<(int)histos.size();i++) {
2216        float curmin=get_nonzero_minimum(histos[i]);
2217        float curmax=histos[i]->GetMaximum();
2218        if(curmin<min) min=curmin;
# Line 2205 | Line 2223 | void draw_all_ttbar_histos(TCanvas *can,
2223    histos[0]->Draw(drawoption.c_str());
2224    stringstream drawopt;
2225    drawopt << drawoption << ",same";
2226 <  for(int i=1;i<histos.size();i++) {
2226 >  for(int i=1;i<(int)histos.size();i++) {
2227      histos[i]->Draw(drawopt.str().c_str());
2228    }
2229   }
# Line 2499 | Line 2517 | void zjets_prediction_comparison() {
2517    hJZBpos->SetLineColor(kBlack);
2518    hJZBneg->SetLineColor(kRed);
2519    
2502  Int_t nbins = 5;
2503  Float_t xmax = 100.;
2504
2505  
2520    TCanvas *zcan = new TCanvas("zcan","zcan");  
2521    zcan->SetLogy(1);
2522  
# Line 2587 | Line 2601 | void make_table(samplecollection &coll,
2601    
2602    TCanvas *cannie = new TCanvas("cannie","cannie");
2603    
2604 <  for(int icut=0;icut<jzb_cuts.size();icut++) {
2604 >  for(int icut=0;icut<(int)jzb_cuts.size();icut++) {
2605      float currcut=jzb_cuts[icut];
2606      int nbins=1;float low=currcut;
2607      vector<int> mysample;
# Line 2646 | Line 2660 | void make_table(samplecollection &coll,
2660    //prediction part
2661    if(is_data) cout << "Data prediction & ";
2662    if(subselection!="none") cout << subselection << " prediction &";
2663 <  for(int ij=0;ij<jzb_cuts.size();ij++) cout << jzbcutprediction[ij] << " vs " << metcutprediction[ij] << " & ";
2663 >  for(int ij=0;ij<(int)jzb_cuts.size();ij++) cout << jzbcutprediction[ij] << " vs " << metcutprediction[ij] << " & ";
2664    
2665    cout << endl;
2666    //observation part
2667    if(is_data) cout << "Data observation & ";
2668    if(subselection!="none") cout << subselection << " observation &";
2669 <  for(int ij=0;ij<jzb_cuts.size();ij++) cout << jzbcutobservation[ij] << " vs " << metcutobservation[ij] << " & ";
2669 >  for(int ij=0;ij<(int)jzb_cuts.size();ij++) cout << jzbcutobservation[ij] << " vs " << metcutobservation[ij] << " & ";
2670    cout << endl;
2671    cout << "_________________________________________________________________" << endl;
2672    delete cannie;
# Line 2687 | Line 2701 | void JZBSelEff(string mcjzb, TTree* even
2701    int nbins = sizeof(xbins)/sizeof(float)-1;
2702    int markers[] = { 20, 26, 21, 24, 22, 25, 28 };
2703  
2704 <  TH1F* heff  = new TH1F("heff", "JZB eff ; generator-level JZB [GeV]; efficiency",nbins,xbins);
2705 <  TH1F* hgen  = new TH1F("hgen", "JZB gen ; generator-level JZB [GeV]; efficiency",nbins,xbins);
2706 <  TH1F* hreco = new TH1F("hreco","JZB reco ; generator-level JZB [GeV]; efficiency",nbins,xbins);
2704 >  
2705 >  TH1F* heff  = new TH1F("heff", "JZB eff ; generator JZB [GeV]; efficiency",nbins,xbins);
2706 >  TH1F* hgen  = new TH1F("hgen", "JZB gen ; generator JZB [GeV]; efficiency",nbins,xbins);
2707 >  TH1F* hreco = new TH1F("hreco","JZB reco ; generator JZB [GeV]; efficiency",nbins,xbins);
2708  
2709    TCut kgen(genMassCut&&"genZPt>0&&genNjets>2&&abs(genMID)==23"&&cutOSSF);
2710    TCut kreco(cutmass);
# Line 2705 | Line 2720 | void JZBSelEff(string mcjzb, TTree* even
2720    TCanvas *can = new TCanvas("can","Canvas for JZB Efficiency",600,600);
2721    can->SetGridx(1);
2722    can->SetGridy(1);
2723 +  can->SetLeftMargin(0.16);
2724 +  can->SetRightMargin(0.05);
2725    TLegend *leg = make_legend("",0.6,0.2,false,0.89,0.5);
2726 +  leg->SetBorderSize(1);
2727 +  leg->SetLineColor(kBlack);
2728 +  leg->SetTextFont(62);
2729  
2730 <  
2711 <
2712 <  for ( int icut=0; icut<jzb_bins.size(); ++icut ) {
2730 >  for ( int icut=0; icut<(int)jzb_bins.size(); ++icut ) {
2731  
2732      ostringstream selection;
2733      selection << mcjzb << ">" << jzb_bins[icut];
# Line 2725 | Line 2743 | void JZBSelEff(string mcjzb, TTree* even
2743      }
2744    
2745      heff->GetXaxis()->SetRangeUser(min, max);
2746 + //    heff->GetXaxis()->SetLabelSize(0.05); // paper style. overruled.
2747 + //    heff->GetYaxis()->SetLabelSize(0.05); // paper style. overruled.
2748 + //    heff->GetXaxis()->SetTitleSize(0.06); // paper style. overruled.
2749 + //    heff->GetYaxis()->SetTitleSize(0.06); // paper style. overruled.
2750      heff->SetMarkerStyle(markers[icut]);
2751      heff->Fit("func","Q+","same");
2752  
# Line 2736 | Line 2758 | void JZBSelEff(string mcjzb, TTree* even
2758  
2759      // Store plot
2760      TH1F* h = (TH1F*)heff->Clone(hname);
2761 +    h->SetNdivisions(505,"X");
2762      if ( icut) h->Draw("same");
2763      else h->Draw();
2764      char htitle[256]; sprintf(htitle,"JZB > %3.0f GeV", jzb_bins[icut]);
# Line 2756 | Line 2779 | void JZBSelEff(string mcjzb, TTree* even
2779   // Calls the above function for each signal sample
2780   void plot_jzb_sel_eff(string mcjzb, samplecollection &signalsamples, vector<float> bins )
2781   {  
2782 <  for (int isignal=0; isignal<signalsamples.collection.size();isignal++) {
2782 >  for (int isignal=0; isignal<(int)signalsamples.collection.size();isignal++) {
2783      dout << "JZB selection efficiency curve: " << std::endl;
2784      JZBSelEff(mcjzb,(signalsamples.collection)[isignal].events,(signalsamples.collection)[isignal].samplename,bins); // Only for some selected samples
2785    }
# Line 2799 | Line 2822 | void qcd_plots(string datajzb, string mc
2822    TH1F *RcorrJZBSBeemm;
2823    TH1F *LcorrJZBSBeemm;
2824    
2825 <  TH1F *RcorrJZBeemmNoS;
2825 > //  TH1F *RcorrJZBeemmNoS;
2826  
2827      //these are for the ratio
2828    TH1F *JRcorrJZBeemm   = qcdsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
# Line 2930 | Line 2953 | void qcd_plots(string datajzb, string mc
2953    dout << "    Observation increases by : " << RcorrJZBeemm->Integral() << endl;
2954    
2955    dout << endl;
2956 <  for(int i=0;i<bins.size();i++) {
2956 >  for(int i=0;i<(int)bins.size();i++) {
2957      dout << " JZB > " << bins[i] << " : " << endl;
2958      dout << "    Observation increases by : " << RcorrJZBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) << endl;
2959      if(PlottingSetup::RestrictToMassPeak) {
# Line 2978 | Line 3001 | void check_ptsanity() {
3001    leg->SetY2(1.0);
3002    
3003    
3004 <  for(int isample=0;isample<allsamples.collection.size();isample++) {
3004 >  for(int isample=0;isample<(int)allsamples.collection.size();isample++) {
3005      string nowname=(allsamples.collection)[isample].filename;
3006      cout << "Drawing: " << nowname << " (sample " << isample+1 << " / " << allsamples.collection.size() << ")" << endl;
3007      individualpt1histos[isample] = allsamples.Draw(GetNumericHistoName(),"pt1",50,0,50, "p_{T,1}", "events",cutOSSF&&cutnJets,mc,luminosity,allsamples.FindSample(nowname));
# Line 3002 | Line 3025 | void check_ptsanity() {
3025    ptsancan->cd(2);
3026    fpt2->Draw();
3027  
3028 <  for(int isample=0;isample<allsamples.collection.size();isample++) {
3028 >  for(int isample=0;isample<(int)allsamples.collection.size();isample++) {
3029      ptsancan->cd(1);
3030      individualpt1histos[isample]->DrawNormalized("same,histo");
3031      ptsancan->cd(2);
# Line 3018 | Line 3041 | void check_ptsanity() {
3041   void do_mlls_plot(string mcjzb) {
3042    cout << "At this point we'd plot the mll distribution" << endl;
3043    TCanvas *sigcan = new TCanvas("sigcan","sigcan");
3044 <  for(int isig=0;isig<(signalsamples.collection).size();isig++) {
3044 >  for(int isig=0;isig<(int)(signalsamples.collection).size();isig++) {
3045      if(!(signalsamples.collection)[isig].events) continue;
3046      string nowname=(signalsamples.collection)[isig].filename;
3047      TH1F *mll = signalsamples.Draw("mllhisto","mll",150,0,150, "m_{ll}", "events",cutOSSF&&cutnJets,mc,luminosity,signalsamples.FindSample(nowname));
# Line 3057 | Line 3080 | void met_vs_jzb_plots() {
3080    findme.push_back("TTJets");
3081    findme.push_back("LM");
3082    
3083 <  for(int ifind=0;ifind<findme.size();ifind++) {
3083 >  for(int ifind=0;ifind<(int)findme.size();ifind++) {
3084      vector<int> selsamples = allsamples.FindSample(findme[ifind]);
3085      TH2F *metvsjzb = new TH2F("metvsjzb","metvsjzb",200,0,100,400,-100,100);
3086 <    for(int isel=0;isel<selsamples.size();isel++) {
3086 >    for(int isel=0;isel<(int)selsamples.size();isel++) {
3087        cout << "Producing MET:JZB plot ... working on sample: " << allsamples.collection[selsamples[isel]].filename << endl;
3088        allsamples.collection[selsamples[isel]].events->Draw("jzb[1]:met[4]>>+metvsjzb",cutmass&&cutOSSF);
3089      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines