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.65 by buchmann, Thu Sep 13 09:44:16 2012 UTC vs.
Revision 1.76 by buchmann, Wed Dec 12 14:29:00 2012 UTC

# Line 89 | Line 89 | void find_one_peak_combination(TCut spec
89  
90   void find_peaks(float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, stringstream &result, bool doPUreweighting, stringstream &datajzb, stringstream &mcjzb, string sSpecialCut="", bool SwitchOffNJetsCut=false)
91   {
92 +  bool overunderflowstatus=addoverunderflowbins;
93    switch_overunderflow(false);
94    
95    TCut SpecialCut("mll>=0");
# Line 160 | Line 161 | void find_peaks(float &MCPeak,float &MCP
161      MCPeakError=mcpeakerr;
162      DataPeak=datapeak;
163      DataPeakError=datapeakerr;
164 <    
164 >    switch_overunderflow(overunderflowstatus);
165   }
166  
167   void make_special_obs_pred_mll_plot(string datajzb, string mcjzb, float jzbthreshold, float binWidth = 5.0) {
# Line 304 | Line 305 | void make_special_mll_plot(int nbins, fl
305    datahistoOSSF->SetMarkerSize(DataMarkerSize);
306    datahistoOSSF->Draw();
307  
308 <  mcstackOSSF.Draw("same");
308 >  mcstackOSSF.Draw("histo,same");
309    datahistoOSSF->Draw("same");
310  
311    datahistoOSOF->SetMarkerColor(TColor::GetColor("#FE642E"));
# Line 409 | Line 410 | float make_one_OFSF_plot(string variable
410    }
411    if (ymax<0) {
412      if ( logscale ) datahistoSF->SetMaximum(5.3*datahistoSF->GetMaximum());
413 <    else datahistoSF->SetMaximum(1.5*datahistoSF->GetMaximum());
413 >    else datahistoSF->SetMaximum(1.8*datahistoSF->GetMaximum());
414    } else {
415      datahistoSF->SetMaximum(ymax);
416    }
# Line 467 | Line 468 | float make_data_comparison_plot(string v
468  
469    TH1F *data1 = allsamples.Draw("data1",variable,nbins,min,max, xlabel, "events",ibasiccut,data,luminosity);
470    TH1F *data2 = comparesamples.Draw("data2",variable,nbins,min,max, xlabel, "events",ibasiccut,data,luminosity);
471 +  data1->Scale(5.0/9.2);
472  
473    data1->SetMarkerSize(DataMarkerSize);
474    data2->SetLineColor(kRed);
# Line 491 | Line 493 | float make_data_comparison_plot(string v
493    data1->GetYaxis()->CenterTitle();
494  
495    TLegend *mleg = make_legend("",legendPosition,0.7,false,legendPosition+0.2);
496 <  mleg->AddEntry(data1, "New 3.8/fb", "PL");
497 <  mleg->AddEntry(data2, "Old 5.1/fb", "L");
496 >  mleg->AddEntry(data1, "2012 data (scaled)", "PL");
497 >  mleg->AddEntry(data2, "2011 data", "L");
498  
499    data1->Draw("E1");
500    data2->Draw("HIST,SAMES");
501    mleg->Draw();
502    DrawPrelim();
503 <  save_with_ratio( data1, data2, rcan, "compareData/" + filename, false, false, "old/new" );
503 >  save_with_ratio( data1, data2, rcan, "compareData/" + filename, false, false, "new/old" );
504  
505    data1->Delete();
506    data2->Delete();
# Line 510 | Line 512 | float make_data_comparison_plot(string v
512   void make_OFSF_plots(string variable, string addcut, int nbins, float min, float max, bool logscale,
513                       string xlabel, string filename, float legendPosition=0.55) {
514  
515 <  string mllcuts[] = { "mll>15","mll>15&&mll<70", "mll>75&&mll<105", "mll>120" };
516 <  string mllcutname[] = { "m_{ll} > 15 GeV", "15 < m_{ll} < 70 GeV", "70 < m_{ll} < 110 GeV", "m_{ll} > 120 GeV" };
515 >  string mllcuts[] = { "mll>20","mll>15&&mll<70", "mll>75&&mll<105", "mll>120" };
516 >  string mllcutname[] = { "m_{ll} > 20 GeV", "20 < m_{ll} < 70 GeV", "70 < m_{ll} < 110 GeV", "m_{ll} > 120 GeV" };
517    string plotname[] = {"_all","_low","_peak","_high"};
518    float ymax;
519  
# Line 535 | Line 537 | void make_OFSF_plots(string variable, st
537  
538   }
539  
540 + TCut ReplaceInCut(TCut cut, string replacethis, string withthis) {
541 +  string scut=(string)(const char*)cut;
542 +  string acut=ReplaceAll(scut,replacethis,withthis);
543 +  return TCut(acut.c_str());
544 + }
545 +
546 + void DoMCSystPlot(string variable, int nbins, float min, float max, TCut addcut, bool dolog, string xlabel, string filename) {
547 +  TCut cut=addcut&&basiccut;
548 +
549 +  TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600);
550 +  ckin->SetLogy(dolog);
551 +  cout << "\r Creating " << filename << " : data   (1/6)" << std::flush;
552 +  TH1F *datahisto = allsamples.Draw("datahisto",variable,nbins,min,max, xlabel, "events",cut,data,luminosity);
553 +  datahisto->SetMarkerSize(DataMarkerSize);
554 +  if ( !dolog ) datahisto->SetMinimum(0); // Defaults
555 +  else datahisto->SetMinimum(0.5);
556 +  if (dolog) datahisto->SetMaximum(5.3*datahisto->GetMaximum());
557 +  else datahisto->SetMaximum(1.3*datahisto->GetMaximum());
558 +  cout << "\r Creating " << filename << " : MC central   (2/6)" << std::flush;
559 +  THStack mcstack   = allsamples.DrawStack("mcstack",  variable,nbins,min,max,xlabel,"events",cut,mc,luminosity);
560 +  TH1F *MCcentral = CollapseStack(mcstack);
561 +
562 +  TCut bkpcut = cut;
563 +  cut = ReplaceInCut(cut,"pfJetGoodNum40","pfJetGoodNum40p1sigma");
564 +  cout << "\r Creating " << filename << " : MC JES up   (3/6)" << std::flush;
565 +  TH1F *MCJESup   = allsamples.Draw("MCJESup",  variable,nbins,min,max,xlabel,"events",cut,mc,luminosity);
566 +
567 +  cut = ReplaceInCut(cut,"pfJetGoodNum40p1sigma","pfJetGoodNum40n1sigma");
568 +  cout << "\r Creating " << filename << " : MC JES down   (4/6)" << std::flush;
569 +  TH1F *MCJESdn   = allsamples.Draw("MCJESdn",  variable,nbins,min,max,xlabel,"events",cut,mc,luminosity);
570 +  
571 +  cut=bkpcut;
572 +  TCut bkpweight = cutWeight;
573 +  cutWeight= ReplaceInCut(cutWeight,"weight","PUweightUP");
574 +  cout << "\r Creating " << filename << " : MC PU up   (5/6)" << std::flush;
575 +  TH1F *MCPUup    = allsamples.Draw("MCPUup",   variable,nbins,min,max,xlabel,"events",cut,mc,luminosity);
576 +  
577 +  cutWeight= ReplaceInCut(cutWeight,"PUweightUP","PUweightDOWN");
578 +  cout << "\r Creating " << filename << " : MC PU down   (6/6)" << std::flush;
579 +  TH1F *MCPUdn    = allsamples.Draw("MCPUdn",   variable,nbins,min,max,xlabel,"events",cut,mc,luminosity);
580 +  cutWeight=bkpweight;
581 +  cout << "\r Creating " << filename << " : Processing systematics ..." << std::flush;
582 +  TH1F *Systematic = (TH1F*)MCPUdn->Clone("Systematic");
583 +  for(int i=1;i<=Systematic->GetNbinsX();i++) {
584 +    float jesdn = abs(MCcentral->GetBinContent(i)-MCJESdn->GetBinContent(i));
585 +    float jesup = abs(MCcentral->GetBinContent(i)-MCJESup->GetBinContent(i));
586 +    float jes   = jesdn>jesup?jesdn:jesup;
587 +    
588 +    float PUup = abs(MCcentral->GetBinContent(i)-MCPUup->GetBinContent(i));
589 +    float PUdn = abs(MCcentral->GetBinContent(i)-MCPUdn->GetBinContent(i));
590 +    float pu   = PUdn>PUup?PUdn:PUup;
591 +    
592 +    float sys=sqrt(jes*jes+pu*pu);
593 +    sys/=MCcentral->GetBinContent(i);
594 +    if(MCcentral->GetBinContent(i)==0) sys=0;
595 +    Systematic->SetBinContent(i,sys);
596 +  }
597 +  
598 +  datahisto->Draw("e1");
599 +  ckin->Update();
600 +  mcstack.Draw("histo,same");
601 +  
602 +  datahisto->Draw("same,e1");
603 +  TLegend *kinleg = allsamples.allbglegend();
604 +  kinleg->Draw();
605 +
606 +  TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1);
607 +  kinpad->cd();
608 +  datahisto->Draw("e1");
609 +  mcstack.Draw("histo,same");
610 +  datahisto->Draw("same,e1");
611 +  datahisto->Draw("same,axis");
612 +  
613 +  kinleg->Draw("same");
614 +  DrawPrelim();
615 +  string saveas="kin/"+filename;
616 +  
617 +  cout << "Passing filename to be saved : " << filename << " as " << saveas << endl;
618 +  save_with_ratio_and_sys_band( datahisto, CollapseStack(mcstack), kinpad->cd(), saveas, false, false, "data/mc",Systematic );
619 +  
620 +  ckin->cd();
621 +  MCcentral->SetFillColor(kWhite);
622 +  MCcentral->SetLineColor(kBlack);
623 +  MCPUdn->SetLineColor(kRed);
624 +  MCPUup->SetLineColor(kYellow);
625 +  MCJESdn->SetLineColor(kBlue);
626 +  MCJESup->SetLineColor(kGreen);
627 +  
628 +  TLegend *legsmall = new TLegend(0.2,0.5,0.5,0.89);
629 +  legsmall->AddEntry(MCcentral,"central","L");
630 +  legsmall->AddEntry(MCPUdn,"PU down","L");
631 +  legsmall->AddEntry(MCPUup,"PU up","L");
632 +  legsmall->AddEntry(MCJESdn,"JES down","L");
633 +  legsmall->AddEntry(MCJESup,"JES up","L");
634 +  
635 +  MCcentral->Draw("histo");
636 +  MCPUdn->Draw("histo,same");
637 +  MCPUup->Draw("histo,same");
638 +  MCJESdn->Draw("histo,same");
639 +  MCJESup->Draw("histo,same");
640 +  datahisto->Draw("e1,same");
641 +  legsmall->Draw();
642 +  CompleteSave(ckin,"kin/AllLines");
643 +  
644 +  datahisto->Delete();
645 +  delete ckin;
646 + }
647 +
648  
649   float lastrange_min=0;
650   float lastrange_max=0;
# Line 544 | Line 654 | void make_kin_plot(string variable, stri
654   //  TCut basiccut("(pfJetGoodNum>=2&&pfJetGoodID[0])&&(pfJetGoodNum>=2&&pfJetGoodID[1])&&(passed_triggers||!is_data)");
655    TCut ibasiccut=basiccut;
656    bool draw_separation_lines=false;
657 +  bool drawsignal = false;
658    
659    if(isPF) ibasiccut=basiccut&&"pfjzb[0]>-998";
660  
# Line 565 | Line 676 | void make_kin_plot(string variable, stri
676    //Step 2: Refine the cut
677    TCut cut;
678    cut=cutmass&&cutOSSF&&cutnJets&&ibasiccut;
679 <  if(filename=="nJets" || filename=="nJets_inclusive") cut=cutmass&&cutOSSF&&ibasiccut;
680 <  if(filename=="nJets_osof" || filename=="nJets_osof_inclusive") cut=cutmass&&cutOSOF&&ibasiccut;
679 >  if(filename=="nJets" || filename=="nJets_inclusive" || filename=="nJets_met100" || filename=="nJets_inclusive_met100") cut=cutmass&&cutOSSF&&ibasiccut;
680 >  if(filename=="nJets_osof" || filename=="nJets_osof_inclusive" || filename=="nJets_osof_met100" || filename=="nJets_osof_inclusive_met100") cut=cutmass&&cutOSOF&&ibasiccut;
681    if(filename=="nJets_nocuts_except_mll_ossf") cut=cutmass&&cutOSSF;
682 <  if(filename=="mll") {
682 >  if(filename=="mll"||filename=="mll_met100") {
683          cut=cutOSSF&&cutnJets&&ibasiccut;
684          draw_separation_lines=true;
685    }
686 <  if(filename=="mll_ee") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==0";
687 <  if(filename=="mll_mm") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==1";
688 <  if(filename=="mll_osof") {
686 >  if(filename=="mll_ee"||filename=="mll_ee_met100") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==0";
687 >  if(filename=="mll_mm"||filename=="mll_mm_met100") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==1";
688 >  if(filename=="mll_osof"||filename=="mll_osof_met100") {
689          cut=cutOSOF&&cutnJets&&ibasiccut;
690          draw_separation_lines=true;
691    }
# Line 582 | Line 693 | void make_kin_plot(string variable, stri
693    if(Contains(filename,"mll_ee_above")) cut=cut&&"id1==0";
694    if(Contains(filename,"mll_mm_above")) cut=cut&&"id1==1";
695    if(Contains(filename,"mll_osof_aboveJZB")) cut=cutOSOF&&cutnJets&&ibasiccut;
696 <  if(filename=="mll_inclusive"||filename=="mll_inclusive_highrange") cut=cutmass&&cutOSSF;
697 <  if(filename=="mll_inclusive_osof") cut=cutmass&&cutOSOF;
698 <  if(filename=="mll_inclusive_ee") cut=cutmass&&cutOSSF&&"id1==0";
699 <  if(filename=="mll_inclusive_mm") cut=cutmass&&cutOSSF&&"id1==1";
696 >  if(filename=="mll_inclusive"||filename=="mll_inclusive_highrange") cut=cutOSSF;
697 >  if(filename=="mll_inclusive_osof") cut=cutOSOF;
698 >  if(filename=="mll_inclusive_ee") cut=cutOSSF&&"id1==0";
699 >  if(filename=="mll_inclusive_mm") cut=cutOSSF&&"id1==1";
700    if(filename=="pfJetGoodEta_0") cut=cutOSSF&&cutmass&&ibasiccut&&cutnJets;
701    if(filename=="pfJetGoodPt_0") cut=cutOSSF&&cutmass&&ibasiccut&&cutnJets;
702    if(filename=="numVtx") cut=cutmass&&ibasiccut;
# Line 606 | Line 717 | void make_kin_plot(string variable, stri
717    if (logscale) datahisto->SetMaximum(5.3*datahisto->GetMaximum());
718    else datahisto->SetMaximum(1.3*datahisto->GetMaximum());
719  
720 <  cout << "******** Cut used : " << (const char*) cut << endl;
720 >  cout << "******** Cut used : " << (const char*) cut << " for plot " << filename << endl;
721    if(loadlastminmax) {
722          datahisto->SetMinimum(lastrange_min);
723          datahisto->SetMaximum(lastrange_max);
# Line 620 | Line 731 | void make_kin_plot(string variable, stri
731    string signal("LM3");
732    TH1F* signalhisto = new TH1F("signalhisto",signal.c_str(),nbins,min,max);
733    int idx = signalsamples.FindSample(signal)[0];
734 <  (signalsamples.collection)[idx].events->Project("signalhisto",variable.c_str(),cut);
735 <  signalhisto->Scale((signalsamples.collection)[idx].weight*luminosity);
736 <  signalhisto->SetLineColor(kOrange);
734 >  if(drawsignal) (signalsamples.collection)[idx].events->Project("signalhisto",variable.c_str(),cut);
735 >  if(drawsignal) signalhisto->Scale((signalsamples.collection)[idx].weight*luminosity);
736 >  if(drawsignal) signalhisto->SetLineColor(kOrange);
737  
738    THStack mcstack   = allsamples.DrawStack("mcstack",  variable,nbins,min,max,xlabel,"events",cut,mc,luminosity);
739    datahisto->Draw("e1");
740    ckin->Update();
741 <  mcstack.Draw("same");
741 >  mcstack.Draw("histo,same");
742    
743    datahisto->Draw("same,e1");
744    TLegend *kinleg = allsamples.allbglegend();
# Line 670 | Line 781 | void make_kin_plot(string variable, stri
781          kinpad->cd();
782          kinpad->SetLogy(logscale);
783          datahisto->Draw("e1");
784 <        mcstack.Draw("same");
785 <        signalhisto->Draw("same");
784 >        mcstack.Draw("histo,same");
785 >        if(drawsignal) signalhisto->Draw("same");
786          datahisto->Draw("same,e1");
787          datahisto->Draw("same,axis");
788          if(RestrictToMassPeak&&draw_separation_lines) {
# Line 679 | Line 790 | void make_kin_plot(string variable, stri
790            upperboundary->Draw("same");
791          }
792            
793 <        kinleg->AddEntry("signalhisto",signal.c_str(),"l");
793 >        if(drawsignal) kinleg->AddEntry("signalhisto",signal.c_str(),"l");
794          kinleg->Draw();
795          write_cut->Draw();
796          DrawPrelim();
# Line 694 | Line 805 | void make_kin_plot(string variable, stri
805          else CompleteSave(ckin,"kin/"+filename);
806    }
807    datahisto->Delete();
808 +  delete signalhisto;
809 +  delete ckin;
810 + }
811 +
812 +
813 + void make_plain_kin_plot(string variable, string addcut, int nbins, float min, float max, bool logscale,
814 +                   string xlabel, string filename, bool isPF=true, bool plotratio=true, bool loadlastminmax=false ) {
815 +  TCut cut=TCut(addcut.c_str())&&basiccut;
816 +
817 +  TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600);
818 +  ckin->SetLogy(logscale);
819 +  TH1F *datahisto = allsamples.Draw("datahisto",variable,nbins,min,max, xlabel, "events",cut,data,luminosity);
820 +  datahisto->SetMarkerSize(DataMarkerSize);
821 +  if ( !logscale ) datahisto->SetMinimum(0); // Defaults
822 +  else datahisto->SetMinimum(0.5);
823 +  // Custom max.
824 +  if (logscale) datahisto->SetMaximum(5.3*datahisto->GetMaximum());
825 +  else datahisto->SetMaximum(1.3*datahisto->GetMaximum());
826 +
827 +  cout << "******** Cut used : " << (const char*) cut << " for plot " << filename << endl;
828 +  if(loadlastminmax) {
829 +        datahisto->SetMinimum(lastrange_min);
830 +        datahisto->SetMaximum(lastrange_max);
831 +        if(logscale) {
832 +                datahisto->SetMinimum(pow(10,lastrange_min));
833 +                datahisto->SetMaximum(pow(10,lastrange_max));
834 +        }              
835 +  }
836 +
837 +  THStack mcstack   = allsamples.DrawStack("mcstack",  variable,nbins,min,max,xlabel,"events",cut,mc,luminosity);
838 +  datahisto->Draw("e1");
839 +  ckin->Update();
840 +  mcstack.Draw("histo,same");
841 +  
842 +  datahisto->Draw("same,e1");
843 +  TLegend *kinleg = allsamples.allbglegend();
844 +  kinleg->Draw();
845 +
846 +  lastrange_min=ckin->GetUymin();
847 +  lastrange_max=ckin->GetUymax();
848 +
849 +  if ( plotratio ) {
850 +        TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1);
851 +        kinpad->cd();
852 +        kinpad->SetLogy(logscale);
853 +        datahisto->Draw("e1");
854 +        mcstack.Draw("histo,same");
855 +        datahisto->Draw("same,e1");
856 +        datahisto->Draw("same,axis");
857 +          
858 +        kinleg->Draw();
859 +        DrawPrelim();
860 +        string saveas="kin/"+filename;
861 +        if(isPF) saveas="kin/"+filename+"__PF";
862 +        save_with_ratio(datahisto,mcstack,kinpad->cd(),saveas);
863 +  } else {
864 +        if(isPF) CompleteSave(ckin,"kin/"+filename+"__PF");
865 +        else CompleteSave(ckin,"kin/"+filename);
866 +  }
867 +  datahisto->Delete();
868    delete ckin;
869   }
870  
871 +
872   void make_JES_plot(TCut cut, string name) {
873  
874    int nbins=10;
# Line 730 | Line 902 | void make_JES_plot(TCut cut, string name
902    JESunc->SetFillColor(TColor::GetColor("#00ADE1"));
903    JESunc->SetFillStyle(3002);
904    datahisto->Draw("e1");
905 <  mcstack.Draw("same");
905 >  mcstack.Draw("histo,same");
906    JESunc->Draw("2");
907    datahisto->Draw("same,e1");
908    TLegend *kinleg = allsamples.allbglegend();
# Line 742 | Line 914 | void make_JES_plot(TCut cut, string name
914  
915   }
916  
917 + string Cut2Str(TCut cut) {
918 +  return ((string)(const char*)cut);
919 + }
920 +
921 + void MakeElegantTwoThreeComparisons() {
922 +    
923 +    TCut signal("met[4]>100&&met[4]<150&&mll>20"&&PlottingSetup::basicqualitycut);
924 +    TCut TwoJets("pfJetGoodNum40==2");
925 +    TCut ThreeJets("pfJetGoodNum40>=3");
926 +    
927 +    float min=20;
928 +    float max=300;
929 +    int nbins=int((max-min)/5.0);
930 +    string xlabel="m_{ll} [GeV]";
931 +    
932 +    TCanvas *can2 = new TCanvas("can2","can2");
933 +    TH1F *TwoOF = allsamples.Draw("TwoOF","mll",nbins,min,max, xlabel, "events",cutOSOF&&signal&&TwoJets,mc,luminosity,allsamples.FindSample("TTJets_"));
934 +    TH1F *TwoSF = allsamples.Draw("TwoSF","mll",nbins,min,max, xlabel, "events",cutOSSF&&signal&&TwoJets,mc,luminosity,allsamples.FindSample("TTJets_"));
935 +    TH1F *ThreeOF = allsamples.Draw("ThreeOF","mll",nbins,min,max, xlabel, "events",cutOSOF&&signal&&ThreeJets,mc,luminosity,allsamples.FindSample("TTJets_"));
936 +    TH1F *ThreeSF = allsamples.Draw("ThreeSF","mll",nbins,min,max, xlabel, "events",cutOSSF&&signal&&ThreeJets,mc,luminosity,allsamples.FindSample("TTJets_"));
937 +    
938 +    can2->cd(1);
939 +    
940 +    TwoSF->SetFillColor(kWhite);
941 +    TwoOF->SetFillColor(kWhite);
942 +    ThreeSF->SetFillColor(kWhite);
943 +    ThreeOF->SetFillColor(kWhite);
944 +    
945 +    TPad *kin3 = new TPad("kin3","kin3",0,0,1,1);
946 +    kin3->cd();
947 +    TwoOF->Draw("histo");
948 +    TwoSF->Draw("e1,same");
949 +    TLegend *leg_SFOF_Two = make_legend();
950 +    leg_SFOF_Two->SetHeader("t#bar{t} MC:");
951 +    leg_SFOF_Two->AddEntry(TwoOF,"OF, nJets==2","l");
952 +    leg_SFOF_Two->AddEntry(TwoSF,"SF, nJets==2","lp");
953 +    leg_SFOF_Two->Draw();
954 +    save_with_ratio(TwoSF,TwoOF,kin3->cd(),"DoubleRatios/SFOF_Two");
955 +    
956 +    TPad *kin4 = new TPad("kin4","kin4",0,0,1,1);
957 +    kin4->cd();
958 +    ThreeOF->Draw("histo");
959 +    ThreeSF->Draw("e1,same");
960 +    TLegend *leg_SFOF_Three = make_legend();
961 +    leg_SFOF_Three->SetHeader("t#bar{t} MC:");
962 +    leg_SFOF_Three->AddEntry(TwoOF,"OF, nJet#geq3","l");
963 +    leg_SFOF_Three->AddEntry(TwoSF,"SF, nJets#geq3","lp");
964 +    leg_SFOF_Three->Draw();
965 +    save_with_ratio(ThreeSF,ThreeOF,kin4->cd(),"DoubleRatios/SFOF_Three");
966 +    
967 +    
968 +    TwoSF->Scale(ThreeSF->Integral()/TwoSF->Integral());
969 +    TPad *kin = new TPad("kin","kin",0,0,1,1);
970 +    kin->cd();
971 +    TwoSF->Draw("histo");
972 +    ThreeSF->Draw("e1,same");
973 +    TLegend *leg_SF_Two_Three = make_legend();
974 +    leg_SF_Two_Three->SetHeader("t#bar{t} MC:");
975 +    leg_SF_Two_Three->AddEntry(TwoSF,"#splitline{SF, nJets==2}{ (scaled)}","l");
976 +    leg_SF_Two_Three->AddEntry(ThreeSF,"SF, nJets#geq3","lp");
977 +    leg_SF_Two_Three->Draw();
978 +    save_with_ratio(TwoSF,ThreeSF,kin->cd(),"DoubleRatios/SF_Two_Three");
979 +    
980 +    TwoOF->Scale(ThreeOF->Integral()/TwoOF->Integral());
981 +    TPad *kin2 = new TPad("kin2","kin2",0,0,1,1);
982 +    kin2->cd();
983 +    TwoOF->Draw("histo");
984 +    ThreeOF->Draw("e1,same");
985 +    TLegend *leg_OF_Two_Three = make_legend();
986 +    leg_OF_Two_Three->SetHeader("t#bar{t} MC:");
987 +    leg_OF_Two_Three->AddEntry(TwoSF,"#splitline{OF, nJets==2}{ (scaled)}","l");
988 +    leg_OF_Two_Three->AddEntry(ThreeSF,"OF, nJets#geq3","lp");
989 +    leg_OF_Two_Three->Draw();
990 +    save_with_ratio(TwoOF,ThreeOF,kin2->cd(),"DoubleRatios/OF_Two_Three");
991 +    
992 + }
993 +
994 +
995   void do_kinematic_plots(string mcjzb, string datajzb, bool doPF=false)
996   {
997 <  switch_overunderflow(true);
997 > //  switch_overunderflow(true);
998    bool dolog=true;
999    bool nolog=false;
1000  
1001 <  bool doOFSF = true;
1002 <  bool doKin  = true;
1003 <  bool doDataComp = true;
1001 >  bool doOFSF = false;
1002 >  bool doKin  = false;
1003 >  bool doDataComp = false;
1004 >  bool MakeTwoThreeJetComparison = false;
1005    
1006  
1007    if(doPF) write_warning(__FUNCTION__,"Please use caution when trying to produce PF plots; not all versions of the JZB trees have these variables!");
# Line 760 | Line 1011 | void do_kinematic_plots(string mcjzb, st
1011          mll_low=20;
1012          mll_hi=320;
1013    }
1014 +  
1015 +  if(MakeTwoThreeJetComparison) MakeElegantTwoThreeComparisons();
1016  
1017    if ( doOFSF ) {
1018 <    make_OFSF_plots("mll", "met[4]>100", 60, 20., 320., false, "m_{ll}", "mll");
1018 >     make_OFSF_plots("mll", "met[4]>100", 60, 20., 320., false, "m_{ll}", "mll");
1019  
1020 <    make_OFSF_plots("pfJetGoodNum40", "met[4]>100",                        7, 3, 10, true, "#(jets)", "njets");
1021 <    make_OFSF_plots("pfJetGoodNum40", "met[4]>100&&pfJetGoodNumBtag30==0", 7, 3, 10, true, "#(jets)", "njets_btagVeto");
1022 <    make_OFSF_plots("pfJetGoodNum40", "met[4]>100&&pfJetGoodNumBtag30>0",  7, 3, 10, true, "#(jets)", "njets_AtLeastOneBJet30");
1020 > //      make_OFSF_plots("pfJetGoodNum40", "met[4]>100",                        7, 3, 10, true, "#(jets)", "njets");
1021 > //      make_OFSF_plots("pfJetGoodNum40", "met[4]>100&&pfJetGoodNumBtag30==0", 7, 3, 10, true, "#(jets)", "njets_btagVeto");
1022 > //      make_OFSF_plots("pfJetGoodNum40", "met[4]>100&&pfJetGoodNumBtag30>0",  7, 3, 10, true, "#(jets)", "njets_AtLeastOneBJet30");
1023  
1024 <    make_OFSF_plots("pfJetGoodNumBtag30", "met[4]>100", 5, 0, 5, true, "#(b-jets)", "nbjets");
1025 <    make_OFSF_plots("pfJetGoodPtBtag[0]", "met[4]>100&&pfJetGoodNumBtag30>0", 20, 0, 400, true, "p_{T}(leading b-jet)", "ptb1");
1024 > //      make_OFSF_plots("pfJetGoodNumBtag30", "met[4]>100", 5, 0, 5, true, "#(b-jets)", "nbjets");
1025 > //      make_OFSF_plots("pfJetGoodPtBtag[0]", "met[4]>100&&pfJetGoodNumBtag30>0", 20, 0, 400, true, "p_{T}(leading b-jet)", "ptb1");
1026  
1027 <    make_OFSF_plots("iso1", "met[4]>100", 20, 0, 0.3, true, "lepton 1 isolation", "iso1");
1028 <    make_OFSF_plots("iso2", "met[4]>100", 20, 0, 0.3, true, "lepton 2 isolation", "iso2");
1027 > //     make_OFSF_plots("iso1", "met[4]>100", 20, 0, 0.3, true, "lepton 1 isolation", "iso1");
1028 > //     make_OFSF_plots("iso2", "met[4]>100", 20, 0, 0.3, true, "lepton 2 isolation", "iso2");
1029      //  make_OFSF_plots("pt1",  "met[4]>100", 30, 0., 300., true, "p_{T,1}", "pt1");
1030      //  make_OFSF_plots("pt2",  "met[4]>100", 22, 0., 220., true, "p_{T,2}", "pt2");
1031 <    make_OFSF_plots("eta1", "met[4]>100", 10, -2.5, 2.5, false, "#eta_{1}", "eta1", 0.15);
1032 <    make_OFSF_plots("eta2", "met[4]>100", 10, -2.5, 2.5, false, "#eta_{2}", "eta2", 0.15);
1031 > //     make_OFSF_plots("eta1", "met[4]>100", 10, -2.5, 2.5, false, "#eta_{1}", "eta1", 0.15);
1032 > //     make_OFSF_plots("eta2", "met[4]>100", 10, -2.5, 2.5, false, "#eta_{2}", "eta2", 0.15);
1033      //  make_OFSF_plots("phi1", "met[4]>100", 10, -TMath::Pi(), TMath::Pi(), false, "#phi_{1}", "phi1", 0.2);
1034      //  make_OFSF_plots("phi2", "met[4]>100", 10, -TMath::Pi(), TMath::Pi(), false, "#phi_{2}", "phi2", 0.2);
1035 <    //  make_OFSF_plots("pfJetGoodPt[0]/pfJetGoodPt[1]", "met[4]>100", 20, 1, 10, true, "pt_{j}^{1}/pt_{j}^{2}", "jpt1pt2", 0.2);
1035 > //     make_OFSF_plots("pfJetGoodPt[0]/pfJetGoodPt[1]", "met[4]>100", 20, 1, 10, true, "pt_{j}^{1}/pt_{j}^{2}", "jpt1pt2", 0.2);
1036      make_OFSF_plots("TMath::Abs(pfJetDphiMet[0])", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(jet1,MET)|", "dphij1met", 0.2);
1037 <    make_OFSF_plots("TMath::Abs(dphi)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l1,l2)|", "dphi", 0.2);
1038 <    //  make_OFSF_plots("TMath::Abs(dphiMet1)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l1,MET)|", "dphiMet1", 0.2);
1039 <    //  make_OFSF_plots("TMath::Abs(dphiMet2)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l2,MET)|", "dphiMet2", 0.2);
1040 <    make_OFSF_plots("TMath::Min(TMath::Abs(dphiMet1), TMath::Abs(dphiMet2))", "met[4]>100", 16, 0, 3.2, false, "Min(|#Delta#phi(l,MET)|)", "dphilc");
1041 <    make_OFSF_plots("TMath::Min(TMath::Abs(pfJetDphiMet[0]), TMath::Min(TMath::Abs(pfJetDphiMet[1]), TMath::Abs(pfJetDphiMet[2])))", "met[4]>100", 16, 0, 3.2, false, "Min(|#Delta#phi(jet,MET)|)", "dphijc");
1042 <    make_OFSF_plots("TMath::Min((TMath::Pi()-TMath::Abs(dphiMet1)), (TMath::Pi() - TMath::Abs(dphiMet2)))", "met[4]>100", 16, 0, 3.2, false, "Min(#pi - |#Delta#phi(l,MET)|)", "dphilco");
1043 <    make_OFSF_plots("TMath::Min((TMath::Pi()-TMath::Abs(pfJetDphiMet[0])), TMath::Min( (TMath::Pi()-TMath::Abs(pfJetDphiMet[1])), (TMath::Pi() - TMath::Abs(pfJetDphiMet[2]))))", "met[4]>100", 16, 0, 3.2, false, "Min(#pi - |#Delta#phi(jet,MET)|)", "dphijco");
1037 > //    make_OFSF_plots("TMath::Abs(dphi)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l1,l2)|", "dphi", 0.2);
1038 > //    make_OFSF_plots("TMath::Abs(dphiMet1)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l1,MET)|", "dphiMet1", 0.2);
1039 > //    make_OFSF_plots("TMath::Abs(dphiMet2)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l2,MET)|", "dphiMet2", 0.2);
1040 > //    make_OFSF_plots("TMath::Min(TMath::Abs(dphiMet1), TMath::Abs(dphiMet2))", "met[4]>100", 16, 0, 3.2, false, "Min(|#Delta#phi(l,MET)|)", "dphilc");
1041 > //    make_OFSF_plots("TMath::Min(TMath::Abs(pfJetDphiMet[0]), TMath::Min(TMath::Abs(pfJetDphiMet[1]), TMath::Abs(pfJetDphiMet[2])))", "met[4]>100", 16, 0, 3.2, false, "Min(|#Delta#phi(jet,MET)|)", "dphijc");
1042 > //    make_OFSF_plots("TMath::Min((TMath::Pi()-TMath::Abs(dphiMet1)), (TMath::Pi() - TMath::Abs(dphiMet2)))", "met[4]>100", 16, 0, 3.2, false, "Min(#pi - |#Delta#phi(l,MET)|)", "dphilco");
1043 > //    make_OFSF_plots("TMath::Min((TMath::Pi()-TMath::Abs(pfJetDphiMet[0])), TMath::Min( (TMath::Pi()-TMath::Abs(pfJetDphiMet[1])), (TMath::Pi() - TMath::Abs(pfJetDphiMet[2]))))", "met[4]>100", 16, 0, 3.2, false, "Min(#pi - |#Delta#phi(jet,MET)|)", "dphijco");
1044    }
1045  
1046 <  if ( doDataComp && !PlottingSetup::openBox ) {
1046 >  if ( doDataComp) {
1047      TCut mllCut("");
1048      float massmin = 15.;
1049      float massmax = 315;
1050      int massnbins = 60;
1051 <    if ( !PlottingSetup::openBox ) {
1052 <      mllCut = "mll>120";
1051 > /*    if ( !PlottingSetup::openBox ) {
1052 >      mllCut = "mll>70";
1053        massmin = 120;
1054        massmax = 360;
1055        massnbins = 14;
1056 <    }
1056 >    }*/
1057  
1058      TCut cutSignal = cutmass&&cutnJets&&"met[4]>100";
1059 <    make_data_comparison_plot("mll", cutOSSF,60, 15., 315.,-1., true, "m_{ll}", "mll_SF_inclusive");
1060 <    make_data_comparison_plot("mll", cutOSOF,60, 15., 315.,-1., true, "m_{ll}", "mll_OF_inclusive");
1061 <
1059 >    
1060 > /*    make_data_comparison_plot("numVtx", "",40, -0.5, 39.5,-1., true, "N(Vertices)", "numVtx");
1061 >    make_data_comparison_plot("pfJetGoodEta[0]", "",50, -3.0, 3.0,-1., true, "N(Jets)", "pfJetGoodEta0");
1062 >    
1063 >    
1064 >    make_data_comparison_plot("pfJetGoodNum40", cutOSOF,10, -0.5, 9.5,-1., true, "N(Jets)", "njets_OF");
1065 >    make_data_comparison_plot("met[4]", cutOSSF,60, 0., 300.,-1., true, "pfMET", "met_SF_inclusive");
1066 >    make_data_comparison_plot("met[1]", cutOSSF,60, 0., 300.,-1., true, "type 1 corrected pfMET", "mett1_SF_inclusive");
1067 >    make_data_comparison_plot("met[4]", cutOSOF,60, 0., 300.,-1., true, "pfMET", "met_OF_inclusive");
1068 >    make_data_comparison_plot("met[1]", cutOSOF,60, 0., 300.,-1., true, "type 1 corrected pfMET", "mett1_OF_inclusive");
1069 >    
1070 >    make_data_comparison_plot("met[4]", cutnJets&&cutOSSF,60, 0., 300.,-1., true, "pfMET", "met_SF_exclusive");
1071 > //    make_data_comparison_plot("met[1]", cutnJets&&cutOSSF,60, 0., 300.,-1., true, "type 1 corrected pfMET", "mett1_SF_exclusive");
1072 >    make_data_comparison_plot("met[4]", cutnJets&&cutOSOF,60, 0., 300.,-1., true, "pfMET", "met_OF_exclusive");
1073 > //    make_data_comparison_plot("met[1]", cutnJets&&cutOSOF,60, 0., 300.,-1., true, "type 1 corrected pfMET", "mett1_OF_exclusive");
1074 > */
1075 >  
1076 >    string basiccutsaved = (const char*)basiccut;
1077 >    
1078 >    string newbasiccut=basiccutsaved;
1079 >    
1080 >    size_t found;
1081 >    found = newbasiccut.find( "pt2>20" );
1082 >    while (found!=string::npos){
1083 >      newbasiccut.replace( found, string( "pt2>20" ).length(), "pt2>10" );
1084 >      found = newbasiccut.find( "pt2>20" );
1085 >    }
1086 > //    basiccut=TCut(newbasiccut.c_str());
1087 > //    make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=2&&met[4]>150")&&cutOSSF,60, 0., 300.,-1., false, "mll", "mll_SF_Aachen_pt2010_met");
1088 > //    make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=2&&met[4]>150")&&cutOSOF,60, 0., 300.,-1., false, "mll", "mll_OF_Aachen_pt2010_met");
1089 > //    make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=2&&met[1]>150")&&cutOSSF,60, 0., 300.,-1., true, "mll", "mll_SF_Aachen_pt2010_t1cpfmet");
1090 > //    make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=2&&met[1]>150")&&cutOSOF,60, 0., 300.,-1., true, "mll", "mll_OF_Aachen_pt2010_t1cpfmet");
1091 > //    basiccut=TCut(basiccutsaved.c_str());
1092 >    
1093 > //     make_data_comparison_plot("pfJetGoodNum40", cutOSSF, 8, 0., 8.,-1., true, "#(jets)", "njets_SF");
1094 > //     make_data_comparison_plot("pfJetGoodNum40", cutOSOF, 8, 0., 8.,-1., true, "#(jets)", "njets_OF");
1095 >    
1096 > //     make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=3&&met[4]>100")&&cutOSSF,60, 0., 300.,-1., true, "mll", "mll_SF_ETH_met");
1097 > //     make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=3&&met[4]>100")&&cutOSOF,60, 0., 300.,-1., true, "mll", "mll_OF_ETH_met");
1098 > //     make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=3&&met[1]>100")&&cutOSSF,60, 0., 300.,-1., true, "mll", "mll_SF_ETH_t1cpfmet");
1099 > //     make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=3&&met[1]>100")&&cutOSOF,60, 0., 300.,-1., true, "mll", "mll_OF_ETH_t1cpfmet");
1100 >
1101 >    
1102 > /*     make_data_comparison_plot("mll", cutOSSF,60, 15., 315.,-1., true, "m_{ll}", "mll_SF_inclusive");
1103 >     make_data_comparison_plot("mll", cutOSSF&&TCut("id1==0"),60, 15., 315.,-1., true, "m_{ll}", "mll_SF_inclusive_ee");
1104 >     make_data_comparison_plot("mll", cutOSSF&&TCut("id1==1"),60, 15., 315.,-1., true, "m_{ll}", "mll_SF_inclusive_mm");
1105 >     make_data_comparison_plot("mll", cutOSOF,60, 15., 315.,-1., true, "m_{ll}", "mll_OF_inclusive");
1106 >    make_data_comparison_plot("mll", cutnJets&&cutOSSF&&TCut("id1==0"),60, 15., 315.,-1., true, "m_{ll}", "mll_SF_exclusive_ee");
1107 >    make_data_comparison_plot("mll", cutnJets&&cutOSSF&&TCut("id1==1"),60, 15., 315.,-1., true, "m_{ll}", "mll_SF_exclusive_mm");
1108 >    make_data_comparison_plot("mll", cutnJets&&cutOSSF,60, 15., 315.,-1., true, "m_{ll}", "mll_SF_exclusive");
1109 >    make_data_comparison_plot("mll", cutnJets&&cutOSOF,60, 15., 315.,-1., true, "m_{ll}", "mll_OF_exclusive");
1110 > */
1111      make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut,           massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig");
1112 +    make_data_comparison_plot("mll", cutOSOF&&cutSignal&&mllCut,           massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig");
1113 +    
1114 +    make_data_comparison_plot("mll", TCut("abs(eta1)<1.4&&abs(eta2)<1.4") && cutOSSF&&cutSignal&&mllCut,           massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig_central");
1115 +    make_data_comparison_plot("mll", TCut("abs(eta1)<1.4&&abs(eta2)<1.4") && cutOSOF&&cutSignal&&mllCut,           massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig_central");
1116 +    
1117      make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30==0", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig_btagVeto");
1118 +    make_data_comparison_plot("mll", cutOSOF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30==0", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig_btagVeto");
1119 +    
1120      make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30>0",  massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig_AtLeastOneBJet");
1121 +    make_data_comparison_plot("mll", cutOSOF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30>0",  massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig_AtLeastOneBJet");
1122  
1123 + /*
1124      make_data_comparison_plot("mll", mllCut&&cutOSOF&&cutSignal, massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig");
1125      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");
1126      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");
# Line 818 | Line 1129 | void do_kinematic_plots(string mcjzb, st
1129      make_data_comparison_plot("pfJetGoodNum40", cutOSOF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(jets)", "njets_OF_sig");
1130      make_data_comparison_plot("pfJetGoodNumBtag30", cutOSSF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(b-jets)", "nbjets_SF_sig");
1131      make_data_comparison_plot("pfJetGoodNumBtag30", cutOSOF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(b-jets)", "nbjets_OF_sig");
1132 +  */
1133    }
1134  
1135  
1136    if ( doKin ) {
1137      string mllCut("");
1138 <    if ( !PlottingSetup::openBox ) mllCut = "&&mll>120";
1139 <
1138 > /*  
1139 >    make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==0")),40,0,400,dolog,"PFMET","Debunking/MET_OF_30to70_0j",doPF,true);
1140 >    make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==1")),40,0,400,dolog,"PFMET","Debunking/MET_OF_30to70_1j",doPF,true);
1141 >    make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==2")),40,0,400,dolog,"PFMET","Debunking/MET_OF_30to70_2j",doPF,true);
1142 >    make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==3")),40,0,400,dolog,"PFMET","Debunking/MET_OF_30to70_3j",doPF,true);
1143 >
1144 >    make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfJetGoodNum40==0")),40,0,400,dolog,"PFMET","Debunking/MET_OF_Z_0j",doPF,true);
1145 >    make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfJetGoodNum40==1")),40,0,400,dolog,"PFMET","Debunking/MET_OF_Z_1j",doPF,true);
1146 >    make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfTightHT>100&&pfJetGoodNum40==2")),40,0,400,dolog,"PFMET","Debunking/MET_OF_Z_2j",doPF,true);
1147 >    make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfTightHT>100&&pfJetGoodNum40==3")),40,0,400,dolog,"PFMET","Debunking/MET_OF_Z_3j",doPF,true);
1148 > */
1149 >
1150 >    make_plain_kin_plot("pfTightHT",Cut2Str(cutOSOF&&cutnJets),120,0,1200,dolog,"H_{T}","HT_3jets_OF",doPF,true);
1151 >    make_plain_kin_plot("pfTightHT",Cut2Str(cutOSSF&&cutnJets) ,120,0,1200,dolog,"H_{T}","HT_3jets_SF",doPF,true);
1152 >    make_plain_kin_plot("pfTightHT",Cut2Str(cutOSOF&&cutnJets&&TCut("met[4]>100")),120,0,1200,dolog,"H_{T}","HT_3jets_OF_MET100",doPF,true);
1153 >    make_plain_kin_plot("pfTightHT",Cut2Str(cutOSSF&&cutnJets&&TCut("met[4]>100")) ,120,0,1200,dolog,"H_{T}","HT_3jets_SF_MET100",doPF,true);
1154 >
1155 >    
1156 >    make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==0")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_30to70_0j",doPF,true);
1157 >    make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==1")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_30to70_1j",doPF,true);
1158 >    make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==2")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_30to70_2j",doPF,true);
1159 >    make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==3")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_30to70_3j",doPF,true);
1160 >
1161 >    make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfJetGoodNum40==0")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_Z_0j",doPF,true);
1162 >    make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfJetGoodNum40==1")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_Z_1j",doPF,true);
1163 >    make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfTightHT>100&&pfJetGoodNum40==2")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_Z_2j",doPF,true);
1164 >    make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfTightHT>100&&pfJetGoodNum40==3")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_Z_3j",doPF,true);
1165 >
1166 >     /*make_plain_kin_plot("met[4]",Cut2Str(cutOSSF&&cutnJets&&TCut("mll>20&&mll<70")),50,0,300,dolog,"PFMET","MET_SF_20to70",doPF,true);
1167 >     make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&cutnJets&&TCut("mll>20&&mll<70")),50,0,300,dolog,"PFMET","MET_OF_20to70",doPF,true);
1168 >    
1169 >     make_plain_kin_plot("met[4]",Cut2Str(cutOSSF&&cutnJets&&TCut("mll>120")),50,0,300,dolog,"PFMET","MET_SF_above120",doPF,true);
1170 >     make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&cutnJets&&TCut("mll>120")),50,0,300,dolog,"PFMET","MET_OF_above120",doPF,true);*/
1171 >    
1172 > /*     make_plain_kin_plot("met[4]",Cut2Str(cutOSSF&&TCut("pfJetGoodNum40==2")&&TCut("mll>20&&mll<70")),50,0,300,dolog,"PFMET","MET_SF_20to70___2jetsonly",doPF,true);
1173 >     make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("pfJetGoodNum40==2")&&TCut("mll>20&&mll<70")),50,0,300,dolog,"PFMET","MET_OF_20to70___2jetsonly",doPF,true);
1174 >    
1175 >     make_plain_kin_plot("met[4]",Cut2Str(cutOSSF&&TCut("pfJetGoodNum40==2")&&TCut("mll>120")),50,0,300,dolog,"PFMET","MET_SF_above120___2jetsonly",doPF,true);
1176 >     make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("pfJetGoodNum40==2")&&TCut("mll>120")),50,0,300,dolog,"PFMET","MET_OF_above120___2jetsonly",doPF,true);
1177 > */
1178 >    write_info(__FUNCTION__,"Last plot");
1179 >    
1180 >    
1181 >    
1182 >    
1183 >    
1184 >    
1185 >    
1186 >    
1187 >    
1188 >     make_kin_plot("pfJetGoodPt[0]/pfJetGoodPt[1]","",45,1,10,dolog,"pt_{j}^{1}/pt_{j}^{2}","j1j2ratio",doPF,true);
1189 >     make_kin_plot("TMath::Abs(pfJetDphiMet[0])","",32,0,3.2,nolog,"|#Delta#phi(jet1,MET)|","dphiJ1MET",doPF,true);
1190      // Plots in signal region
1191 <    make_kin_plot("met[4]","",70,0,350,dolog,"MET [GeV]","met",doPF,true);
1192 <    make_kin_plot("mll","mll>20&&met[4]>100"+mllCut,(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll",doPF,true);
1193 <    make_kin_plot("mll","mll>20&&met[4]>100",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof",doPF,true,true);
1194 <    make_kin_plot("mll","mll>20&&met[4]>100"+mllCut,(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_ee",doPF,true);
1195 <    make_kin_plot("mll","mll>20&&met[4]>100"+mllCut,(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_mm",doPF,true);
1191 > //     make_kin_plot("met[4]","",70,0,350,dolog,"MET [GeV]","met",doPF,true);
1192 >     make_kin_plot("mll","mll>20"+mllCut,(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll",doPF,true);
1193 >     make_kin_plot("mll","mll>20",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof",doPF,true,true);
1194 >     make_kin_plot("mll","mll>20"+mllCut,(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_ee",doPF,true);
1195 >     make_kin_plot("mll","mll>20"+mllCut,(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_mm",doPF,true);
1196 >    
1197 >     make_kin_plot("pfJetGoodNum40",mllCut,9,-0.5,8.5,dolog,"nJets","nJets",doPF);
1198 >     make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_osof",doPF);
1199 >    
1200 > //     make_kin_plot("mll","mll>20&&met[4]>100"+mllCut,(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_met100",doPF,true);
1201 > //     make_kin_plot("mll","mll>20&&met[4]>100",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof_met100",doPF,true,true);
1202 > //     make_kin_plot("mll","mll>20&&met[4]>100"+mllCut,(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_ee_met100",doPF,true);
1203 > //     make_kin_plot("mll","mll>20&&met[4]>100"+mllCut,(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_mm_met100",doPF,true);
1204 >    
1205      
1206 <    make_kin_plot("pfJetGoodNum40","met[4]>100"+mllCut,9,-0.5,8.5,dolog,"nJets","nJets",doPF);
1207 <    make_kin_plot("pfJetGoodNum40","met[4]>100",9,-0.5,8.5,dolog,"nJets","nJets_osof",doPF);
1206 > //     make_kin_plot("pfJetGoodNum40","met[4]>100"+mllCut,9,-0.5,8.5,dolog,"nJets","nJets_met100",doPF);
1207 > //     make_kin_plot("pfJetGoodNum40","met[4]>100",9,-0.5,8.5,dolog,"nJets","nJets_osof_met100",doPF);
1208  
1209      // Further inclusive invariant mass plots
1210 <    make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive",doPF,true);
1211 <    make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true);
1212 <    make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true);
1213 <    make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true);
1210 >    make_kin_plot("mll",mllCut,(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive",doPF,true);
1211 > //     make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true);
1212 > //     make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true);
1213 >    make_kin_plot("mll",mllCut,(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true);
1214      
1215      //make_kin_plot("mll","",(int)((350-mll_low))/5,mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF);
1216      //if(!doPF) make_special_mll_plot((int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]");
1217      
847    //make_kin_plot("pfJetGoodPt[0]/pfJetGoodPt[1]","",45,1,10,dolog,"pt_{j}^{1}/pt_{j}^{2}","j1j2ratio",doPF,true);
848    //make_kin_plot("TMath::Abs(pfJetDphiMet[0])","",32,0,3.2,nolog,"|#Delta#phi(jet1,MET)|","dphiJ1MET",doPF,true);
1218      
1219      // Number of jets
1220      make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_inclusive",doPF);
# Line 888 | Line 1257 | void do_kinematic_plots(string mcjzb, st
1257   //   make_special_obs_pred_mll_plot(datajzb,mcjzb,0);
1258   //   make_special_obs_pred_mll_plot(datajzb,mcjzb,50);
1259   //   make_special_obs_pred_mll_plot(datajzb,mcjzb,80);
1260 < //   make_special_obs_pred_mll_plot(datajzb,mcjzb,100);
1260 >   make_special_obs_pred_mll_plot(datajzb,mcjzb,100);
1261   //   make_special_obs_pred_mll_plot(datajzb,mcjzb,150);
1262   //   make_special_obs_pred_mll_plot(datajzb,mcjzb,200);
1263   //   make_special_obs_pred_mll_plot(datajzb,mcjzb,250);
# Line 936 | Line 1305 | void make_comp_plot( string var, string
1305        if (ymax>ymin) datahisto->SetMaximum(ymax);
1306        lm3histo->SetLineStyle(2);
1307        datahisto->Draw("e1");
1308 <      mcstack.Draw("same");
1308 >      mcstack.Draw("histo,same");
1309        datahisto->Draw("same,e1");
1310        lm3histo->Draw("hist,same");
1311        TLegend *kinleg = allsamples.allbglegend((sRegions[iregion]+(ijzb?"neg":"pos")).c_str());
# Line 1464 | Line 1833 | void do_prediction_plot(string jzb, TCan
1833      Bpred->Draw("hist,same");
1834      //analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same");
1835      RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP!
1836 <    lm4RcorrJZBeemm->Draw("hist,same");
1836 >    //lm4RcorrJZBeemm->Draw("hist,same");
1837      legBpred->AddEntry(RcorrJZBeemm,"observed","p");
1838      legBpred->AddEntry(Bpred,"predicted","l");
1839   //    legBpred->AddEntry(analytical_function[1],"predicted fit","l");
1840   //    legBpred->AddEntry(analytical_function[2],"stat. uncert.","l");
1841 <    legBpred->AddEntry(lm4RcorrJZBeemm,(allsamples.collection[allsamples.FindSample("LM")[0]].samplename).c_str(),"l");
1841 > //     legBpred->AddEntry(lm4RcorrJZBeemm,(allsamples.collection[allsamples.FindSample("LM")[0]].samplename).c_str(),"l");
1842      legBpred->Draw();
1843      DrawPrelim();
1844  
# Line 1500 | Line 1869 | void do_prediction_plot(string jzb, TCan
1869   //    lm4RcorrJZBeemm->SetLineColor(kOrange+1);
1870      lm4RcorrJZBeemm->SetLineWidth(2);
1871      //lm4RcorrJZBeemm->SetLineWidth(2); // paper style. overruled.
1872 <    lm4RcorrJZBeemm->Draw("histo,same");
1872 > //     lm4RcorrJZBeemm->Draw("histo,same");
1873      DrawPrelim();
1874      TLegend *speciallegBpred = make_legend("",0.45,0.55);
1875      //TLegend *speciallegBpred = make_legend("",0.35,0.55); // paper style. overruled.
# Line 1510 | Line 1879 | void do_prediction_plot(string jzb, TCan
1879      if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) speciallegBpred->AddEntry(sidebandsemu,"Sidebands/e#mu (data)","f");
1880      else speciallegBpred->AddEntry(sidebandsemu,"e#mu (data)","f");
1881   //    speciallegBpred->AddEntry(lm4RcorrJZBeemmC,"LM4","l");
1882 <    speciallegBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l");
1882 > //     speciallegBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l");
1883      speciallegBpred->Draw();
1884      save_with_ratio(JRcorrJZBeemm,JBpred,predcomppad,subdir+"Bpred_Data_____PredictionComposition",true,true,"data/pred",BpredSys);
1885      
# Line 1519 | Line 1888 | void do_prediction_plot(string jzb, TCan
1888   //    THStack kostack = allsamples.DrawStack("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,!is_data, luminosity,use_signal);
1889      blankback->Draw();
1890   //    kostack.Draw("same");
1891 <    predcomposition.Draw();
1891 >    predcomposition.Draw("hist");
1892      Bpred->Draw("hist,same");
1893      //analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same");
1894      RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP!
# Line 1546 | Line 1915 | void do_prediction_plot(string jzb, TCan
1915      legBpred->AddEntry(Bpred,"MC predicted","l");    
1916      if(versok) legBpred->AddEntry((TObject*)0,"",""); // Just for alignment // causes seg fault on root v5.18
1917      if(versok) legBpred->AddEntry((TObject*)0,"",""); // causes seg fault on root v5.18
1918 <    if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l");
1918 > //     if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l");
1919      legBpred->Draw();
1920      DrawMCPrelim();
1921      Bpredsaveas="Bpred_MC";
# Line 1578 | Line 1947 | void do_prediction_plot(string jzb, TCan
1947        
1948        RcorrJZBeemmNoS->SetLineStyle(2);
1949        legBpred2->AddEntry(RcorrJZBeemmNoS,"MC B","l");
1950 <      legBpred2->AddEntry(lm4RcorrJZBeemm,"MC S","l");
1950 > //       legBpred2->AddEntry(lm4RcorrJZBeemm,"MC S","l");
1951        legBpred2->Draw();
1952        RcorrJZBeemmNoS->SetLineColor(TColor::GetColor("#61210B"));
1953        RcorrJZBeemmNoS->Draw("histo,same");
# Line 1656 | Line 2025 | void do_prediction_plot(string jzb, TCan
2025        legBpredc->AddEntry(Bpredem,"MC OFZP","l");
2026        legBpredc->AddEntry(BpredSBem,"MC OFSB","l");
2027        legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l");
2028 <      if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l");
2028 > //       if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l");
2029        legBpredc->Draw();
2030        CompleteSave(globalcanvas,subdir+"Bpred_MCwithS_comparison");
2031      }
# Line 1893 | Line 2262 | void draw_pure_jzb_histo(TCut cut,string
2262    datahisto->SetMinimum(0.1);
2263    datahisto->SetMarkerSize(DataMarkerSize);
2264    datahisto->Draw("e1");
2265 <  mcstack.Draw("same");
2265 >  mcstack.Draw("histo,same");
2266    datahisto->Draw("same,e1");
2267    
2268    TLegend *leg;
# Line 1924 | Line 2293 | void draw_pure_jzb_histo(TCut cut,string
2293    datahisto->SetMinimum(0.1);
2294    datahisto->SetMarkerSize(DataMarkerSize);
2295    datahisto->Draw("e1");
2296 <  mcstack.Draw("same");
2296 >  mcstack.Draw("histo,same");
2297    datahisto->Draw("same,e1");
2298    leg->SetHeader("");
2299    leg->Draw();
# Line 2648 | Line 3017 | void ttbar_sidebands_comparison(string m
3017        
3018    float simulatedlumi = luminosity; //in pb please - adjust to your likings
3019  
3020 <  TH1F *TZem  = systsamples.Draw("TZem",     mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
3021 <  TH1F *nTZem = systsamples.Draw("nTZem","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
3020 >  TH1F *TZem  = systsamples.Draw("TZem",     mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
3021 >  TH1F *nTZem = systsamples.Draw("nTZem","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
3022    TH1F *TSem;
3023    TH1F *nTSem;
3024 <  TH1F *TZeemm  = systsamples.Draw("TZeemm",     mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
3025 <  TH1F *nTZeemm = systsamples.Draw("nTZeemm","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
3024 >  TH1F *TZeemm  = systsamples.Draw("TZeemm",     mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
3025 >  TH1F *nTZeemm = systsamples.Draw("nTZeemm","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
3026    TH1F *TSeemm;
3027    TH1F *nTSeemm;
3028    
3029    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3030 <    TSem    = systsamples.Draw("TSem",       mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
3031 <    nTSem   = systsamples.Draw("nTSem",  "-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
3032 <    TSeemm  = systsamples.Draw("TSeemm",     mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
3033 <    nTSeemm = systsamples.Draw("nTSeemm","-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
3030 >    TSem    = systsamples.Draw("TSem",       mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
3031 >    nTSem   = systsamples.Draw("nTSem",  "-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
3032 >    TSeemm  = systsamples.Draw("TSeemm",     mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
3033 >    nTSeemm = systsamples.Draw("nTSeemm","-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
3034    }
3035  
3036    TCanvas *tcan = new TCanvas("tcan","tcan");
# Line 2693 | Line 3062 | void ttbar_sidebands_comparison(string m
3062      histos.push_back(TSem);
3063      histos.push_back(TSeemm);
3064    }
3065 <  draw_all_ttbar_histos(tcan,histos,"histo",1);
3065 >  draw_all_ttbar_histos(tcan,histos,"histo",8);
3066    
3067    TLegend *leg = make_legend("MC t#bar{t}",0.6,0.65,false);
3068    leg->AddEntry(TZeemm,"SFZP","l");
# Line 2705 | Line 3074 | void ttbar_sidebands_comparison(string m
3074    leg->Draw("same");
3075    DrawMCPrelim(simulatedlumi);
3076    CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_shape_comparison");
3077 +  
3078    TH1F *TZemcopy = (TH1F*)TZem->Clone("TZemcopy");
3079    TH1F *TZeemmcopy = (TH1F*)TZeemm->Clone("TZeemmcopy");
3080    TH1F *TSeemmcopy;
# Line 2770 | Line 3140 | void ttbar_sidebands_comparison(string m
3140    DrawMCPrelim(simulatedlumi);
3141    CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_shape_comparison_ratio");
3142    
3143 +  
3144    if (0) { // Turn this off: we don't need this
3145  
3146      ///-------------- second part: only look at the quantity we actually care about!
# Line 2910 | Line 3281 | void ttbar_sidebands_comparison(string m
3281    nicer_binning.push_back(150);
3282    //nicer_binning.push_back(175);
3283    nicer_binning.push_back(200);
3284 <  nicer_binning.push_back(250);
3285 <  nicer_binning.push_back(300);
3286 <  nicer_binning.push_back(400);
3284 > //  nicer_binning.push_back(250);
3285 > //  nicer_binning.push_back(300);
3286 > //  nicer_binning.push_back(400);
3287    
3288    ttbar_sidebands_comparison(mcjzb,nicer_binning, "ttbar/");
3289   }
3290  
3291  
3292 < void zjets_prediction_comparison(string mcjzbWithPUa) {
3292 > void zjets_prediction_comparison(string mcjzbWithPUa, TCut massregioncut, string massregionname) {
3293 >  cout << "****************************************************************************************************************************************************************" << endl;
3294    TCanvas *zcan = new TCanvas("zcan","zcan");  
3295   //  zcan->SetLogy(1);
3296    TCut weightbackup=cutWeight;
3297    
3298 <  bool UsePURW=false;
3298 >  bool UsePURW=true;
3299    
3300    
3301    string mcjzb;
3302    if(UsePURW) {
3303      mcjzb=mcjzbWithPUa;
3304 +    cout << "Using PURW peak positions" << endl;
3305    } else {
3306      // Do it without PU re-weighting
3307 +    cutWeight="1.0";
3308      float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0;
3309      stringstream resultsNoPU;
3310      stringstream noPUdatajzb;
# Line 2941 | Line 3315 | void zjets_prediction_comparison(string
3315      
3316      mcjzb = noPUmcjzb.str();
3317      
2944    cutWeight="1.0";
3318    }
3319  
3320    
# Line 2965 | Line 3338 | void zjets_prediction_comparison(string
3338    string var( "abs("+mcjzb+")" );
3339    
3340    TCut notTau("abs(genMID1)!=15");
3341 <  TCut ONLYTau("mll>20");
3341 >  TCut ee_mm_tautau("mll>0");
3342    
3343  
3344 <  TH1F *hJZBpos = systsamples.Draw("hJZBpos",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&&notTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY"));
3345 <  TH1F *hJZBneg = systsamples.Draw("hJZBneg",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&&notTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY"));
3344 >  TH1F *hJZBpos = systsamples.Draw("hJZBpos",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&&notTau&&kPos&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY"));
3345 >  TH1F *hJZBneg = systsamples.Draw("hJZBneg",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&&notTau&&kNeg&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY"));
3346    
3347    hJZBpos->SetLineColor(kBlack);
3348    hJZBneg->SetLineColor(kRed);
# Line 2984 | Line 3357 | void zjets_prediction_comparison(string
3357    leg->AddEntry(hJZBneg,"Predicted","l");
3358    leg->Draw("same");
3359    DrawMCPrelim(simulatedlumi);
3360 <  CompleteSave(zcan,"Systematics/ZJets/zjets_eemm_prediction");
3360 >  CompleteSave(zcan,"Systematics/ZJets/zjets_eemm_prediction"+any2string(massregionname));
3361    
3362    TH1F* hratio = (TH1F*)hJZBpos->Clone("hratio");
3363    hratio->Divide(hJZBneg);
# Line 2993 | Line 3366 | void zjets_prediction_comparison(string
3366      cout << "Positive: " << hJZBpos->GetBinContent(i) << "   vs    Negative : " << hJZBneg->GetBinContent(i) << "   (ratio : " << hJZBpos->GetBinContent(i) / hJZBneg->GetBinContent(i) << endl;
3367    }
3368    
3369 <  zcan->SetLogy(0);
3370 <  hratio->GetYaxis()->SetRangeUser(0,2.0);
3369 > //  zcan->SetLogy(0);
3370 >  hratio->GetYaxis()->SetRangeUser(0,2.5);
3371    hratio->GetYaxis()->SetTitle("Observed/Predicted");
3372    hratio->Draw("e1");
3373    
# Line 3003 | Line 3376 | void zjets_prediction_comparison(string
3376    TLine *bottom = new TLine(binning[0],0.75,binning[binning.size()-1],0.75);
3377    
3378  
3379 +  cout << __LINE__ << endl;
3380    top->SetLineColor(kBlue);top->SetLineStyle(2);
3381    bottom->SetLineColor(kBlue);bottom->SetLineStyle(2);
3382    center->SetLineColor(kBlue);
# Line 3016 | Line 3390 | void zjets_prediction_comparison(string
3390    leg2->AddEntry(bottom,"syst. envelope","l");
3391    leg2->Draw("same");
3392    DrawMCPrelim(simulatedlumi);
3393 <  CompleteSave(zcan,"Systematics/ZJets/zjets_eemm_prediction_ratio");
3393 >  CompleteSave(zcan,"Systematics/ZJets/zjets_eemm_prediction_ratio"+any2string(massregionname));
3394    
3395    TCut reducedNJets(cutnJets);
3396    
3397 <  TH1F *TAUhJZBpos = systsamples.Draw("TAUhJZBpos",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY"));
3398 <  TH1F *LcorrJZBeemm     = systsamples.Draw("LcorrJZBeemm",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY"));
3399 <  TH1F *RcorrJZBem       = systsamples.Draw("RcorrJZBem",var,binning, "JZB [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY"));
3400 <  TH1F *LcorrJZBem       = systsamples.Draw("LcorrJZBem",var,binning, "JZB [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY"));
3397 >  TH1F *TAUhJZBpos       = systsamples.Draw("TAUhJZBpos",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&&ee_mm_tautau&&kPos&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY"));
3398 >  TH1F *LcorrJZBeemm     = systsamples.Draw("LcorrJZBeemm",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&&ee_mm_tautau&&kNeg&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY"));
3399 >  TH1F *RcorrJZBem       = systsamples.Draw("RcorrJZBem",var,binning, "JZB [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&&ee_mm_tautau&&kPos&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY"));
3400 >  TH1F *LcorrJZBem       = systsamples.Draw("LcorrJZBem",var,binning, "JZB [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&&ee_mm_tautau&&kNeg&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY"));
3401  
3402 +  cout << __LINE__ << endl;
3403    TH1F *RcorrJZBSBem;
3404    TH1F *LcorrJZBSBem;
3405    TH1F *RcorrJZBSBeemm;
3406    TH1F *LcorrJZBSBeemm;
3407  
3408 +  cout << __LINE__ << endl;
3409    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3410 <    RcorrJZBSBem   = systsamples.Draw("RcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY"));
3411 <    LcorrJZBSBem   = systsamples.Draw("LcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY"));
3412 <    RcorrJZBSBeemm = systsamples.Draw("RcorrJZBSBeemm",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY"));
3413 <    LcorrJZBSBeemm = systsamples.Draw("LcorrJZBSBeemm",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY"));
3410 >    RcorrJZBSBem   = systsamples.Draw("RcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ee_mm_tautau&&kPos&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY"));
3411 >    LcorrJZBSBem   = systsamples.Draw("LcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ee_mm_tautau&&kNeg&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY"));
3412 >    RcorrJZBSBeemm = systsamples.Draw("RcorrJZBSBeemm",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&&ee_mm_tautau&&kPos&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY"));
3413 >    LcorrJZBSBeemm = systsamples.Draw("LcorrJZBSBeemm",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&&ee_mm_tautau&&kNeg&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY"));
3414    }
3415    
3416    TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred");
# Line 3052 | Line 3428 | void zjets_prediction_comparison(string
3428    
3429    Bpred->SetLineColor(kRed);
3430  
3431 +  cout << __LINE__ << endl;
3432    TAUhJZBpos->SetLineColor(kBlack);
3433    Bpred->SetLineColor(kRed);
3434    
# Line 3065 | Line 3442 | void zjets_prediction_comparison(string
3442    TAUleg->AddEntry(Bpred,"Predicted","l");
3443    TAUleg->Draw("same");
3444    DrawMCPrelim(simulatedlumi);
3445 <  CompleteSave(zcan,"Systematics/ZJets/zjets_eemumutautau_prediction");
3445 >  CompleteSave(zcan,"Systematics/ZJets/zjets_eemumutautau_prediction__"+any2string(massregionname));
3446    
3447    TH1F* TAUhratio = (TH1F*)TAUhJZBpos->Clone("TAUhratio");
3448    TAUhratio->Divide(Bpred);
# Line 3083 | Line 3460 | void zjets_prediction_comparison(string
3460    center->Draw("same");
3461    bottom->Draw("same");
3462    
3463 <  TLegend *TAUleg2 = make_legend("MC Z+jets #rightarrow #tau#tau",0.25,0.75,false);
3463 >  TLegend *TAUleg2 = make_legend("MC Z+jets #rightarrow ee,#mu#mu",0.25,0.75,false);
3464    TAUleg2->AddEntry(TAUhratio,"obs / pred","pe");
3465    TAUleg2->AddEntry(bottom,"syst. envelope","l");
3466    TAUleg2->Draw("same");
3467    DrawMCPrelim(simulatedlumi);
3468 <  CompleteSave(zcan,"Systematics/ZJets/zjets_eemumutautau_prediction_ratio");
3468 >  CompleteSave(zcan,"Systematics/ZJets/zjets_eemumutautau_prediction_ratio"+any2string(massregionname));
3469    
3470    delete Bpred;
3471    delete TAUhJZBpos;
3472    delete LcorrJZBeemm;
3473    delete RcorrJZBem;
3474    delete LcorrJZBem;
3475 +  delete hJZBpos;
3476 +  delete hJZBneg;
3477    
3478    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3479      delete RcorrJZBSBem;
# Line 3107 | Line 3486 | void zjets_prediction_comparison(string
3486    delete zcan;
3487    cutWeight=weightbackup;
3488  
3489 +  cout << __LINE__ << endl;
3490   }
3491  
3492  
3493 <
3493 > void zjets_prediction_comparison(string mcjzbWithPUa) {
3494 >  zjets_prediction_comparison(mcjzbWithPUa, TCut(""), "nomasscut");
3495 >  zjets_prediction_comparison(mcjzbWithPUa, TCut("abs(mll-91)<20"), "Zwindow_20");
3496 >  zjets_prediction_comparison(mcjzbWithPUa, TCut("mll>20&&mll<70"), "LowMassRegion2070");
3497 >  zjets_prediction_comparison(mcjzbWithPUa, TCut("mll>110"), "HighMassRegion110");
3498 > }
3499 >  
3500   void sideband_assessment(string datajzb, float min=30.0, float max=50.0) {
3501    tout << endl << endl;
3502    stringstream bordercut;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines