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.55 by fronga, Wed Sep 5 16:32:51 2012 UTC vs.
Revision 1.71 by buchmann, Wed Nov 7 10:54:34 2012 UTC

# Line 33 | Line 33 | void todo() {
33  
34  
35  
36 < void find_one_peak_combination(TCut specialcut, float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, float &MCSigma, float &MCSigmaError, float &DataSigma, float& DataSigmaError, stringstream &result, bool doPUreweighting = true, string saveas="")
36 > void find_one_peak_combination(TCut specialcut, bool SwitchOffNJetsCut, float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, float &MCSigma, float &MCSigmaError, float &DataSigma, float& DataSigmaError, stringstream &result, bool doPUreweighting = true, string saveas="")
37   {
38    // Temporarily switch off PU reweighting, if asked
39    TCut weightbackup=cutWeight;
# Line 42 | Line 42 | void find_one_peak_combination(TCut spec
42    int nbins=100;
43    if(PlottingSetup::DoBTag) nbins=25;
44    
45 +  TCut nJetsCut(cutnJets);
46 +  if(SwitchOffNJetsCut) nJetsCut=specialcut;
47 +  
48    TCanvas *tempcan = new TCanvas("tempcan","Temporary canvas for peak finding preparations");
49 <  TH1F *rawJZBeemmMC      = allsamples.Draw("rawJZBeemmMC",jzbvariablemc,nbins,-50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&specialcut,mc, luminosity);
50 <  TH1F *rawJZBeemmData    = allsamples.Draw("rawJZBeemmData",jzbvariabledata,nbins, -50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&specialcut,data, luminosity);
51 <  TH1F *rawJZBemMC      = allsamples.Draw("rawJZBemMC",jzbvariablemc,nbins,-50,50, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&specialcut,mc, luminosity);
52 <  TH1F *rawJZBemData    = allsamples.Draw("rawJZBemData",jzbvariabledata,nbins, -50,50, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&specialcut,data, luminosity);
49 >  TH1F *rawJZBeemmMC      = allsamples.Draw("rawJZBeemmMC",jzbvariablemc,nbins,-50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&nJetsCut&&specialcut,mc, luminosity);
50 >  TH1F *rawJZBeemmData    = allsamples.Draw("rawJZBeemmData",jzbvariabledata,nbins, -50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&nJetsCut&&specialcut,data, luminosity);
51 >  TH1F *rawJZBemMC      = allsamples.Draw("rawJZBemMC",jzbvariablemc,nbins,-50,50, "JZB [GeV]", "events", cutmass&&cutOSOF&&nJetsCut&&specialcut,mc, luminosity);
52 >  TH1F *rawJZBemData    = allsamples.Draw("rawJZBemData",jzbvariabledata,nbins, -50,50, "JZB [GeV]", "events", cutmass&&cutOSOF&&nJetsCut&&specialcut,data, luminosity);
53    TH1F *rawttbarjzbeemmMC;
54  
55    if(method==doKM) {
56      //we only need this histo for the KM fitting...
57 <    rawttbarjzbeemmMC = allsamples.Draw("rawttbarjzbeemmMC",jzbvariablemc,nbins, -50,50, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&&specialcut,mc,luminosity,allsamples.FindSample("TTJet"));
57 >    rawttbarjzbeemmMC = allsamples.Draw("rawttbarjzbeemmMC",jzbvariablemc,nbins, -50,50, "JZB [GeV]", "events",cutmass&&cutOSSF&&nJetsCut&&specialcut,mc,luminosity,allsamples.FindSample("TTJet"));
58      MCPeak=find_peak(rawJZBeemmMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,MCSigmaError,method,saveas);
59      DataPeak=find_peak(rawJZBeemmData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,DataSigmaError,method,saveas);
60      delete rawttbarjzbeemmMC;
# Line 84 | Line 87 | void find_one_peak_combination(TCut spec
87    delete tempcan;
88   }
89  
90 < void find_peaks(float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, stringstream &result, bool doPUreweighting, stringstream &datajzb, stringstream &mcjzb)
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 <
94 >  
95 >  TCut SpecialCut("mll>=0");
96 >  if(sSpecialCut!="") SpecialCut=TCut(sSpecialCut.c_str());
97 >  
98    bool DoInvidualeemmPeaks=false;
99    
100    float mcpeak, datapeak;
# Line 102 | Line 109 | void find_peaks(float &MCPeak,float &MCP
109    float mcSigma,mcSigmaError, dataSigma, dataSigmaError;
110    
111    dout << "Finding global peak : " << endl;
112 <  find_one_peak_combination(TCut(""),mcpeak,mcpeakerr, datapeak,datapeakerr,mcSigma,mcSigmaError, dataSigma,dataSigmaError,result,doPUreweighting,"");
112 >  find_one_peak_combination(SpecialCut,SwitchOffNJetsCut,mcpeak,mcpeakerr, datapeak,datapeakerr,mcSigma,mcSigmaError, dataSigma,dataSigmaError,result,doPUreweighting,"");
113    
114    if(DoInvidualeemmPeaks) {
115      dout << "Finding peak for electrons : " << endl;
116 <    find_one_peak_combination(TCut("id1==0"),mceepeak,mceepeakerr,dataeepeak,dataeepeakerr,mcSigma,mcSigmaError,dataSigma,dataSigmaError,result,doPUreweighting,"_ele");
116 >    find_one_peak_combination(SpecialCut&&TCut("id1==0"),SwitchOffNJetsCut,mceepeak,mceepeakerr,dataeepeak,dataeepeakerr,mcSigma,mcSigmaError,dataSigma,dataSigmaError,result,doPUreweighting,"_ele");
117      dout << "Finding peak for muons : " << endl;
118 <    find_one_peak_combination(TCut("id1==1"),mcmmpeak,mcmmpeakerr,datammpeak,datammpeakerr,mcSigma,mcSigmaError,dataSigma,dataSigmaError,result,doPUreweighting,"_mu");
118 >    find_one_peak_combination(SpecialCut&&TCut("id1==1"),SwitchOffNJetsCut,mcmmpeak,mcmmpeakerr,datammpeak,datammpeakerr,mcSigma,mcSigmaError,dataSigma,dataSigmaError,result,doPUreweighting,"_mu");
119      
120      datajzb << "(" << jzbvariabledata;
121      mcjzb << "(" << jzbvariablemc;
# Line 134 | Line 141 | void find_peaks(float &MCPeak,float &MCP
141      else mcjzb << "+ (id1!=id2)*" << TMath::Abs(mcpeak) << " ";
142      
143      mcjzb << ")";
144 +    
145    } else {
146      datajzb << "(" << jzbvariabledata;
147        mcjzb << "(" << jzbvariablemc;
# Line 149 | Line 157 | void find_peaks(float &MCPeak,float &MCP
157      mcjzb << ")";
158    }
159    
160 <  switch_overunderflow(true);
161 <  
160 >    MCPeak=mcpeak;
161 >    MCPeakError=mcpeakerr;
162 >    DataPeak=datapeak;
163 >    DataPeakError=datapeakerr;
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 361 | Line 372 | void draw_ratio_plot(TH1* hdata, THStack
372   }
373  
374   float make_one_OFSF_plot(string variable, string addcut, string legendTitle, int nbins, float min, float max, float ymax, bool logscale,
375 <                        string xlabel, string filename, bool plotratio=true, bool loadlastminmax=false, float legendPosition=0.55) {
375 >                        string xlabel, string filename, float legendPosition=0.55) {
376  
377    TCut ibasiccut=basiccut;
378    bool draw_separation_lines=false;
# Line 379 | Line 390 | float make_one_OFSF_plot(string variable
390    rcan->SetLogy(logscale);
391    rcan->cd();
392  
393 +  std::cout << "OF/SF comparison: variable = " << variable << ", cut = " << cutSF.GetTitle() << std::endl;
394    TH1F *datahistoSF = allsamples.Draw("datahistoSF",variable,nbins,min,max, xlabel, "events",cutSF,data,luminosity);
395    TH1F *datahistoOF = allsamples.Draw("datahistoOF",variable,nbins,min,max, xlabel, "events",cutOF,data,luminosity);
396 <  string signal("LM3");
397 <  TH1F* signalhisto = new TH1F("signalhisto",signal.c_str(),nbins,min,max);
398 <  int idx = signalsamples.FindSample(signal)[0];
399 <  (signalsamples.collection)[idx].events->Project("signalhisto",variable.c_str(),cutSF);
400 <  signalhisto->Scale((signalsamples.collection)[idx].weight*luminosity);
401 <  signalhisto->SetLineColor((signalsamples.collection)[idx].samplecolor);
402 <  signalhisto->SetLineStyle(2);
396 > //   string signal("LM3");
397 > //   TH1F* signalhisto = new TH1F("signalhisto",signal.c_str(),nbins,min,max);
398 > //   int idx = signalsamples.FindSample(signal)[0];
399 > //   (signalsamples.collection)[idx].events->Project("signalhisto",variable.c_str(),cutSF);
400 > //   signalhisto->Scale((signalsamples.collection)[idx].weight*luminosity);
401 > //   signalhisto->SetLineColor((signalsamples.collection)[idx].samplecolor);
402 > //   signalhisto->SetLineStyle(2);
403    datahistoSF->SetMarkerSize(DataMarkerSize);
404    datahistoOF->SetLineColor(kRed);
405  
# Line 398 | 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 417 | Line 429 | float make_one_OFSF_plot(string variable
429    } else {
430      mleg->AddEntry((TObject*)0, "", "");
431    }
432 <  mleg->AddEntry(signalhisto, "LM3", "L");
432 >  //mleg->AddEntry(signalhisto, "LM3", "L");
433  
434    datahistoSF->Draw("E1");
435    if (datahistoOF->Integral()>0) datahistoOF->Draw("HIST,SAMES");
436 <  signalhisto->Draw("HIST,SAMES");
436 >  //signalhisto->Draw("HIST,SAMES");
437    mleg->Draw();
438    DrawPrelim();
439 <  if (datahistoOF->Integral()>0) save_with_ratio( datahistoSF, datahistoOF, rcan, "SFOF/" + filename, false, false, "SF/OF" );
440 <  else CompleteSave(ckin, "SFOF/" + filename);
439 >  if (datahistoOF->Integral()>0) {
440 >    save_with_ratio( datahistoSF, datahistoOF, rcan, "SFOF/" + filename, false, false, "SF/OF" );
441 >  } else {
442 >    CompleteSave(rcan, "SFOF/" + filename);
443 >    delete rcan;
444 >  }
445  
446    datahistoSF->Delete();
447    datahistoOF->Delete();
448 <  signalhisto->Delete();
448 >  //signalhisto->Delete();
449    delete mleg;
450    delete ckin;
451  
# Line 452 | 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 476 | 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, "Old 5/fb", "PL");
497 <  mleg->AddEntry(data2, "New x/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 495 | 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>20","mll>20&&mll<70", "mll>75&&mll<105", "mll>120" };
516 <  string mllcutname[] = { "m_{ll} > 20 GeV", "20 < m_{ll} < 70 GeV", "75 < m_{ll} < 105 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 506 | Line 523 | void make_OFSF_plots(string variable, st
523    for ( int i=start; i<4; ++i ) {
524      if ( addcut != "" ) mllcuts[i] += "&&"+addcut;
525      if ( i==start ) {
526 <      ymax = make_one_OFSF_plot(variable, mllcuts[i],            mllcutname[i], nbins, min, max, -1, logscale, xlabel,
526 >      ymax = make_one_OFSF_plot(variable, mllcuts[i], mllcutname[i], nbins, min, max, -1, logscale, xlabel,
527                           filename+plotname[i], legendPosition );
528      } else {
529 <      make_one_OFSF_plot(variable, mllcuts[i],            mllcutname[i], nbins, min, max, ymax, logscale, xlabel,
529 >      make_one_OFSF_plot(variable, mllcuts[i],        mllcutname[i], nbins, min, max, ymax, logscale, xlabel,
530                           filename+plotname[i], legendPosition );
531      }
532      make_one_OFSF_plot(variable, "id1==1&&id1==id2&&"+mllcuts[i], mllcutname[i], nbins, min, max, ymax, logscale, xlabel,
# Line 529 | Line 546 | void make_kin_plot(string variable, stri
546   //  TCut basiccut("(pfJetGoodNum>=2&&pfJetGoodID[0])&&(pfJetGoodNum>=2&&pfJetGoodID[1])&&(passed_triggers||!is_data)");
547    TCut ibasiccut=basiccut;
548    bool draw_separation_lines=false;
549 +  bool drawsignal = false;
550    
551    if(isPF) ibasiccut=basiccut&&"pfjzb[0]>-998";
552  
# Line 550 | Line 568 | void make_kin_plot(string variable, stri
568    //Step 2: Refine the cut
569    TCut cut;
570    cut=cutmass&&cutOSSF&&cutnJets&&ibasiccut;
571 <  if(filename=="nJets" || filename=="nJets_inclusive") cut=cutmass&&cutOSSF&&ibasiccut;
572 <  if(filename=="nJets_osof" || filename=="nJets_osof_inclusive") cut=cutmass&&cutOSOF&&ibasiccut;
571 >  if(filename=="nJets" || filename=="nJets_inclusive" || filename=="nJets_met100" || filename=="nJets_inclusive_met100") cut=cutmass&&cutOSSF&&ibasiccut;
572 >  if(filename=="nJets_osof" || filename=="nJets_osof_inclusive" || filename=="nJets_osof_met100" || filename=="nJets_osof_inclusive_met100") cut=cutmass&&cutOSOF&&ibasiccut;
573    if(filename=="nJets_nocuts_except_mll_ossf") cut=cutmass&&cutOSSF;
574 <  if(filename=="mll") {
574 >  if(filename=="mll"||filename=="mll_met100") {
575          cut=cutOSSF&&cutnJets&&ibasiccut;
576          draw_separation_lines=true;
577    }
578 <  if(filename=="mll_ee") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==0";
579 <  if(filename=="mll_mm") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==1";
580 <  if(filename=="mll_osof") {
578 >  if(filename=="mll_ee"||filename=="mll_ee_met100") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==0";
579 >  if(filename=="mll_mm"||filename=="mll_mm_met100") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==1";
580 >  if(filename=="mll_osof"||filename=="mll_osof_met100") {
581          cut=cutOSOF&&cutnJets&&ibasiccut;
582          draw_separation_lines=true;
583    }
# Line 567 | Line 585 | void make_kin_plot(string variable, stri
585    if(Contains(filename,"mll_ee_above")) cut=cut&&"id1==0";
586    if(Contains(filename,"mll_mm_above")) cut=cut&&"id1==1";
587    if(Contains(filename,"mll_osof_aboveJZB")) cut=cutOSOF&&cutnJets&&ibasiccut;
588 <  if(filename=="mll_inclusive"||filename=="mll_inclusive_highrange") cut=cutmass&&cutOSSF;
589 <  if(filename=="mll_inclusive_osof") cut=cutmass&&cutOSOF;
590 <  if(filename=="mll_inclusive_ee") cut=cutmass&&cutOSSF&&"id1==0";
591 <  if(filename=="mll_inclusive_mm") cut=cutmass&&cutOSSF&&"id1==1";
588 >  if(filename=="mll_inclusive"||filename=="mll_inclusive_highrange") cut=cutOSSF;
589 >  if(filename=="mll_inclusive_osof") cut=cutOSOF;
590 >  if(filename=="mll_inclusive_ee") cut=cutOSSF&&"id1==0";
591 >  if(filename=="mll_inclusive_mm") cut=cutOSSF&&"id1==1";
592    if(filename=="pfJetGoodEta_0") cut=cutOSSF&&cutmass&&ibasiccut&&cutnJets;
593    if(filename=="pfJetGoodPt_0") cut=cutOSSF&&cutmass&&ibasiccut&&cutnJets;
594    if(filename=="numVtx") cut=cutmass&&ibasiccut;
# Line 591 | Line 609 | void make_kin_plot(string variable, stri
609    if (logscale) datahisto->SetMaximum(5.3*datahisto->GetMaximum());
610    else datahisto->SetMaximum(1.3*datahisto->GetMaximum());
611  
612 <  cout << "******** Cut used : " << (const char*) cut << endl;
612 >  cout << "******** Cut used : " << (const char*) cut << " for plot " << filename << endl;
613    if(loadlastminmax) {
614          datahisto->SetMinimum(lastrange_min);
615          datahisto->SetMaximum(lastrange_max);
# Line 605 | Line 623 | void make_kin_plot(string variable, stri
623    string signal("LM3");
624    TH1F* signalhisto = new TH1F("signalhisto",signal.c_str(),nbins,min,max);
625    int idx = signalsamples.FindSample(signal)[0];
626 <  (signalsamples.collection)[idx].events->Project("signalhisto",variable.c_str(),cut);
627 <  signalhisto->Scale((signalsamples.collection)[idx].weight*luminosity);
628 <  signalhisto->SetLineColor(kOrange);
626 >  if(drawsignal) (signalsamples.collection)[idx].events->Project("signalhisto",variable.c_str(),cut);
627 >  if(drawsignal) signalhisto->Scale((signalsamples.collection)[idx].weight*luminosity);
628 >  if(drawsignal) signalhisto->SetLineColor(kOrange);
629  
630    THStack mcstack   = allsamples.DrawStack("mcstack",  variable,nbins,min,max,xlabel,"events",cut,mc,luminosity);
631    datahisto->Draw("e1");
# Line 656 | Line 674 | void make_kin_plot(string variable, stri
674          kinpad->SetLogy(logscale);
675          datahisto->Draw("e1");
676          mcstack.Draw("same");
677 <        signalhisto->Draw("same");
677 >        if(drawsignal) signalhisto->Draw("same");
678          datahisto->Draw("same,e1");
679          datahisto->Draw("same,axis");
680          if(RestrictToMassPeak&&draw_separation_lines) {
# Line 664 | Line 682 | void make_kin_plot(string variable, stri
682            upperboundary->Draw("same");
683          }
684            
685 <        kinleg->AddEntry("signalhisto",signal.c_str(),"l");
685 >        if(drawsignal) kinleg->AddEntry("signalhisto",signal.c_str(),"l");
686          kinleg->Draw();
687          write_cut->Draw();
688          DrawPrelim();
# Line 679 | Line 697 | void make_kin_plot(string variable, stri
697          else CompleteSave(ckin,"kin/"+filename);
698    }
699    datahisto->Delete();
700 +  delete signalhisto;
701    delete ckin;
702   }
703  
# Line 729 | Line 748 | void make_JES_plot(TCut cut, string name
748  
749   void do_kinematic_plots(string mcjzb, string datajzb, bool doPF=false)
750   {
751 + //  switch_overunderflow(true);
752    bool dolog=true;
753    bool nolog=false;
754  
755    bool doOFSF = false;
756 <  bool doKin  = false;
757 <  bool doDataComp = true;
756 >  bool doKin  = true;
757 >  bool doDataComp = false;
758    
759  
760    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 746 | Line 766 | void do_kinematic_plots(string mcjzb, st
766    }
767  
768    if ( doOFSF ) {
769 <    make_OFSF_plots("mll", "met[4]>100", 60, 20., 320., false, "m_{ll}", "mll");
769 >     make_OFSF_plots("mll", "met[4]>100", 60, 20., 320., false, "m_{ll}", "mll");
770 >
771 > //      make_OFSF_plots("pfJetGoodNum40", "met[4]>100",                        7, 3, 10, true, "#(jets)", "njets");
772 > //      make_OFSF_plots("pfJetGoodNum40", "met[4]>100&&pfJetGoodNumBtag30==0", 7, 3, 10, true, "#(jets)", "njets_btagVeto");
773 > //      make_OFSF_plots("pfJetGoodNum40", "met[4]>100&&pfJetGoodNumBtag30>0",  7, 3, 10, true, "#(jets)", "njets_AtLeastOneBJet30");
774 >
775 > //      make_OFSF_plots("pfJetGoodNumBtag30", "met[4]>100", 5, 0, 5, true, "#(b-jets)", "nbjets");
776 > //      make_OFSF_plots("pfJetGoodPtBtag[0]", "met[4]>100&&pfJetGoodNumBtag30>0", 20, 0, 400, true, "p_{T}(leading b-jet)", "ptb1");
777  
778 <    make_OFSF_plots("pfJetGoodNum40",     "met[4]>100", 7, 3, 10, true, "#(jets)", "njets");
779 <    make_OFSF_plots("pfJetGoodNum40",     "met[4]>100&&pfJetGoodNumBtag30==0", 7, 3, 10, true, "#(jets)", "njets_btagVeto");
753 <    make_OFSF_plots("pfJetGoodNum40",     "met[4]>100&&pfJetGoodNumBtag30>0", 7, 3, 10, true, "#(jets)", "njets_AtLeastOneBJet30");
754 <
755 <    make_OFSF_plots("pfJetGoodNumBtag30", "met[4]>100", 5, 0, 5, true, "#(b-jets)", "nbjets");
756 <    make_OFSF_plots("iso1", "met[4]>100", 20, 0, 0.3, true, "lepton 1 isolation", "iso1");
757 <    make_OFSF_plots("iso2", "met[4]>100", 20, 0, 0.3, true, "lepton 2 isolation", "iso2");
778 > //     make_OFSF_plots("iso1", "met[4]>100", 20, 0, 0.3, true, "lepton 1 isolation", "iso1");
779 > //     make_OFSF_plots("iso2", "met[4]>100", 20, 0, 0.3, true, "lepton 2 isolation", "iso2");
780      //  make_OFSF_plots("pt1",  "met[4]>100", 30, 0., 300., true, "p_{T,1}", "pt1");
781      //  make_OFSF_plots("pt2",  "met[4]>100", 22, 0., 220., true, "p_{T,2}", "pt2");
782 <    make_OFSF_plots("eta1", "met[4]>100", 10, -2.5, 2.5, false, "#eta_{1}", "eta1", 0.15);
783 <    make_OFSF_plots("eta2", "met[4]>100", 10, -2.5, 2.5, false, "#eta_{2}", "eta2", 0.15);
782 > //     make_OFSF_plots("eta1", "met[4]>100", 10, -2.5, 2.5, false, "#eta_{1}", "eta1", 0.15);
783 > //     make_OFSF_plots("eta2", "met[4]>100", 10, -2.5, 2.5, false, "#eta_{2}", "eta2", 0.15);
784      //  make_OFSF_plots("phi1", "met[4]>100", 10, -TMath::Pi(), TMath::Pi(), false, "#phi_{1}", "phi1", 0.2);
785      //  make_OFSF_plots("phi2", "met[4]>100", 10, -TMath::Pi(), TMath::Pi(), false, "#phi_{2}", "phi2", 0.2);
786 <    //  make_OFSF_plots("pfJetGoodPt[0]/pfJetGoodPt[1]", "met[4]>100", 20, 1, 10, true, "pt_{j}^{1}/pt_{j}^{2}", "jpt1pt2", 0.2);
786 > //     make_OFSF_plots("pfJetGoodPt[0]/pfJetGoodPt[1]", "met[4]>100", 20, 1, 10, true, "pt_{j}^{1}/pt_{j}^{2}", "jpt1pt2", 0.2);
787      make_OFSF_plots("TMath::Abs(pfJetDphiMet[0])", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(jet1,MET)|", "dphij1met", 0.2);
788 <    make_OFSF_plots("TMath::Abs(dphi)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l1,l2)|", "dphi", 0.2);
789 <    //  make_OFSF_plots("TMath::Abs(dphiMet1)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l1,MET)|", "dphiMet1", 0.2);
790 <    //  make_OFSF_plots("TMath::Abs(dphiMet2)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l2,MET)|", "dphiMet2", 0.2);
791 <    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");
792 <    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");
793 <    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");
794 <    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");
788 > //    make_OFSF_plots("TMath::Abs(dphi)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l1,l2)|", "dphi", 0.2);
789 > //    make_OFSF_plots("TMath::Abs(dphiMet1)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l1,MET)|", "dphiMet1", 0.2);
790 > //    make_OFSF_plots("TMath::Abs(dphiMet2)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l2,MET)|", "dphiMet2", 0.2);
791 > //    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");
792 > //    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");
793 > //    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");
794 > //    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");
795    }
796  
797 <  if ( doDataComp && !PlottingSetup::openBox ) {
797 >  if ( doDataComp) {
798      TCut mllCut("");
799 <    if ( !PlottingSetup::openBox ) mllCut = "mll>120";
799 >    float massmin = 15.;
800 >    float massmax = 315;
801 >    int massnbins = 60;
802 > /*    if ( !PlottingSetup::openBox ) {
803 >      mllCut = "mll>70";
804 >      massmin = 120;
805 >      massmax = 360;
806 >      massnbins = 14;
807 >    }*/
808  
809      TCut cutSignal = cutmass&&cutnJets&&"met[4]>100";
810 <    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut,           60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig");
811 <    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"id1==0", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_ee");
812 <    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"id1==1", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_mm");
813 <
814 <    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30==0",           60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_btagVeto");
815 <    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"id1==0&&pfJetGoodNumBtag30==0", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_ee_btagVeto");
816 <    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"id1==1&&pfJetGoodNumBtag30==0", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_mm_btagVeto");
817 <
818 <    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30>0",           60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_AtLeastOneBJet");
819 <    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"id1==0&&pfJetGoodNumBtag30>0", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_ee_AtLeastOneBJet");
820 <    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"id1==1&&pfJetGoodNumBtag30>0", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_mm_AtLeastOneBJet");
810 >    
811 > /*    make_data_comparison_plot("numVtx", "",40, -0.5, 39.5,-1., true, "N(Vertices)", "numVtx");
812 >    make_data_comparison_plot("pfJetGoodEta[0]", "",50, -3.0, 3.0,-1., true, "N(Jets)", "pfJetGoodEta0");
813 >    
814 >    
815 >    make_data_comparison_plot("pfJetGoodNum40", cutOSOF,10, -0.5, 9.5,-1., true, "N(Jets)", "njets_OF");
816 >    make_data_comparison_plot("met[4]", cutOSSF,60, 0., 300.,-1., true, "pfMET", "met_SF_inclusive");
817 >    make_data_comparison_plot("met[1]", cutOSSF,60, 0., 300.,-1., true, "type 1 corrected pfMET", "mett1_SF_inclusive");
818 >    make_data_comparison_plot("met[4]", cutOSOF,60, 0., 300.,-1., true, "pfMET", "met_OF_inclusive");
819 >    make_data_comparison_plot("met[1]", cutOSOF,60, 0., 300.,-1., true, "type 1 corrected pfMET", "mett1_OF_inclusive");
820 >    
821 >    make_data_comparison_plot("met[4]", cutnJets&&cutOSSF,60, 0., 300.,-1., true, "pfMET", "met_SF_exclusive");
822 > //    make_data_comparison_plot("met[1]", cutnJets&&cutOSSF,60, 0., 300.,-1., true, "type 1 corrected pfMET", "mett1_SF_exclusive");
823 >    make_data_comparison_plot("met[4]", cutnJets&&cutOSOF,60, 0., 300.,-1., true, "pfMET", "met_OF_exclusive");
824 > //    make_data_comparison_plot("met[1]", cutnJets&&cutOSOF,60, 0., 300.,-1., true, "type 1 corrected pfMET", "mett1_OF_exclusive");
825 > */
826 >  
827 >    string basiccutsaved = (const char*)basiccut;
828 >    
829 >    string newbasiccut=basiccutsaved;
830 >    
831 >    size_t found;
832 >    found = newbasiccut.find( "pt2>20" );
833 >    while (found!=string::npos){
834 >      newbasiccut.replace( found, string( "pt2>20" ).length(), "pt2>10" );
835 >      found = newbasiccut.find( "pt2>20" );
836 >    }
837 > //    basiccut=TCut(newbasiccut.c_str());
838 > //    make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=2&&met[4]>150")&&cutOSSF,60, 0., 300.,-1., false, "mll", "mll_SF_Aachen_pt2010_met");
839 > //    make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=2&&met[4]>150")&&cutOSOF,60, 0., 300.,-1., false, "mll", "mll_OF_Aachen_pt2010_met");
840 > //    make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=2&&met[1]>150")&&cutOSSF,60, 0., 300.,-1., true, "mll", "mll_SF_Aachen_pt2010_t1cpfmet");
841 > //    make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=2&&met[1]>150")&&cutOSOF,60, 0., 300.,-1., true, "mll", "mll_OF_Aachen_pt2010_t1cpfmet");
842 > //    basiccut=TCut(basiccutsaved.c_str());
843 >    
844 > //     make_data_comparison_plot("pfJetGoodNum40", cutOSSF, 8, 0., 8.,-1., true, "#(jets)", "njets_SF");
845 > //     make_data_comparison_plot("pfJetGoodNum40", cutOSOF, 8, 0., 8.,-1., true, "#(jets)", "njets_OF");
846 >    
847 > //     make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=3&&met[4]>100")&&cutOSSF,60, 0., 300.,-1., true, "mll", "mll_SF_ETH_met");
848 > //     make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=3&&met[4]>100")&&cutOSOF,60, 0., 300.,-1., true, "mll", "mll_OF_ETH_met");
849 > //     make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=3&&met[1]>100")&&cutOSSF,60, 0., 300.,-1., true, "mll", "mll_SF_ETH_t1cpfmet");
850 > //     make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=3&&met[1]>100")&&cutOSOF,60, 0., 300.,-1., true, "mll", "mll_OF_ETH_t1cpfmet");
851 >
852 >    
853 > /*     make_data_comparison_plot("mll", cutOSSF,60, 15., 315.,-1., true, "m_{ll}", "mll_SF_inclusive");
854 >     make_data_comparison_plot("mll", cutOSSF&&TCut("id1==0"),60, 15., 315.,-1., true, "m_{ll}", "mll_SF_inclusive_ee");
855 >     make_data_comparison_plot("mll", cutOSSF&&TCut("id1==1"),60, 15., 315.,-1., true, "m_{ll}", "mll_SF_inclusive_mm");
856 >     make_data_comparison_plot("mll", cutOSOF,60, 15., 315.,-1., true, "m_{ll}", "mll_OF_inclusive");
857 >    make_data_comparison_plot("mll", cutnJets&&cutOSSF&&TCut("id1==0"),60, 15., 315.,-1., true, "m_{ll}", "mll_SF_exclusive_ee");
858 >    make_data_comparison_plot("mll", cutnJets&&cutOSSF&&TCut("id1==1"),60, 15., 315.,-1., true, "m_{ll}", "mll_SF_exclusive_mm");
859 >    make_data_comparison_plot("mll", cutnJets&&cutOSSF,60, 15., 315.,-1., true, "m_{ll}", "mll_SF_exclusive");
860 >    make_data_comparison_plot("mll", cutnJets&&cutOSOF,60, 15., 315.,-1., true, "m_{ll}", "mll_OF_exclusive");
861 > */
862 >    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut,           massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig");
863 >    make_data_comparison_plot("mll", cutOSOF&&cutSignal&&mllCut,           massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig");
864 >    
865 >    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");
866 >    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");
867 >    
868 >    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30==0", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig_btagVeto");
869 >    make_data_comparison_plot("mll", cutOSOF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30==0", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig_btagVeto");
870 >    
871 >    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30>0",  massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig_AtLeastOneBJet");
872 >    make_data_comparison_plot("mll", cutOSOF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30>0",  massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig_AtLeastOneBJet");
873  
874 <    make_data_comparison_plot("mll", cutOSOF&&cutSignal, 60, 20., 320.,-1., false, "m_{ll}", "mll_OF_sig");
875 <    make_data_comparison_plot("mll", cutmass&&"met[4]>100&&met[4]<150&&pfJetGoodNum40<3", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_CR");
874 > /*
875 >    make_data_comparison_plot("mll", mllCut&&cutOSOF&&cutSignal, massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig");
876 >    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");
877 >    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");
878 >
879 >    make_data_comparison_plot("pfJetGoodNum40", cutOSSF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(jets)", "njets_SF_sig");
880 >    make_data_comparison_plot("pfJetGoodNum40", cutOSOF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(jets)", "njets_OF_sig");
881 >    make_data_comparison_plot("pfJetGoodNumBtag30", cutOSSF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(b-jets)", "nbjets_SF_sig");
882 >    make_data_comparison_plot("pfJetGoodNumBtag30", cutOSOF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(b-jets)", "nbjets_OF_sig");
883 >  */
884    }
885  
886  
887    if ( doKin ) {
888      string mllCut("");
799    if ( !PlottingSetup::openBox ) mllCut = "&&mll>120";
889  
890 +     make_kin_plot("pfJetGoodPt[0]/pfJetGoodPt[1]","",45,1,10,dolog,"pt_{j}^{1}/pt_{j}^{2}","j1j2ratio",doPF,true);
891 +     make_kin_plot("TMath::Abs(pfJetDphiMet[0])","",32,0,3.2,nolog,"|#Delta#phi(jet1,MET)|","dphiJ1MET",doPF,true);
892      // Plots in signal region
893 <    make_kin_plot("met[4]","",70,0,350,dolog,"MET [GeV]","met",doPF,true);
894 <    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);
895 <    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);
896 <    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);
897 <    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);
893 > //     make_kin_plot("met[4]","",70,0,350,dolog,"MET [GeV]","met",doPF,true);
894 >     make_kin_plot("mll","mll>20"+mllCut,(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll",doPF,true);
895 >     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);
896 >     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);
897 >     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);
898 >    
899 >     make_kin_plot("pfJetGoodNum40",mllCut,9,-0.5,8.5,dolog,"nJets","nJets",doPF);
900 >     make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_osof",doPF);
901 >    
902 > //     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);
903 > //     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);
904 > //     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);
905 > //     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);
906      
907 <    make_kin_plot("pfJetGoodNum40","met[4]>100"+mllCut,9,-0.5,8.5,dolog,"nJets","nJets",doPF);
908 <    make_kin_plot("pfJetGoodNum40","met[4]>100",9,-0.5,8.5,dolog,"nJets","nJets_osof",doPF);
907 >    
908 > //     make_kin_plot("pfJetGoodNum40","met[4]>100"+mllCut,9,-0.5,8.5,dolog,"nJets","nJets_met100",doPF);
909 > //     make_kin_plot("pfJetGoodNum40","met[4]>100",9,-0.5,8.5,dolog,"nJets","nJets_osof_met100",doPF);
910  
911      // Further inclusive invariant mass plots
912 <    make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive",doPF,true);
913 <    make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true);
914 <    make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true);
915 <    make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true);
912 >    make_kin_plot("mll",mllCut,(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive",doPF,true);
913 > //     make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true);
914 > //     make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true);
915 >    make_kin_plot("mll",mllCut,(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true);
916      
917      //make_kin_plot("mll","",(int)((350-mll_low))/5,mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF);
918      //if(!doPF) make_special_mll_plot((int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]");
919      
820    //make_kin_plot("pfJetGoodPt[0]/pfJetGoodPt[1]","",45,1,10,dolog,"pt_{j}^{1}/pt_{j}^{2}","j1j2ratio",doPF,true);
821    //make_kin_plot("TMath::Abs(pfJetDphiMet[0])","",32,0,3.2,nolog,"|#Delta#phi(jet1,MET)|","dphiJ1MET",doPF,true);
920      
921      // Number of jets
922      make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_inclusive",doPF);
# Line 861 | Line 959 | void do_kinematic_plots(string mcjzb, st
959   //   make_special_obs_pred_mll_plot(datajzb,mcjzb,0);
960   //   make_special_obs_pred_mll_plot(datajzb,mcjzb,50);
961   //   make_special_obs_pred_mll_plot(datajzb,mcjzb,80);
962 < //   make_special_obs_pred_mll_plot(datajzb,mcjzb,100);
962 >   make_special_obs_pred_mll_plot(datajzb,mcjzb,100);
963   //   make_special_obs_pred_mll_plot(datajzb,mcjzb,150);
964   //   make_special_obs_pred_mll_plot(datajzb,mcjzb,200);
965   //   make_special_obs_pred_mll_plot(datajzb,mcjzb,250);
# Line 869 | Line 967 | void do_kinematic_plots(string mcjzb, st
967   //   make_JES_plot(cutmass&&cutOSSF&&basiccut,"_ossf");
968   //   make_JES_plot(cutmass&&cutOSOF&&basiccut,"_osof");
969  
970 +  switch_overunderflow(false);
971   }
972  
973   void make_comp_plot( string var, string xlabel, string filename, float jzbcut, string mcjzb, string datajzb,
# Line 938 | Line 1037 | void region_comparison_plots(string mcjz
1037  
1038   //  switch_overunderflow(true);  // switching overflow/underflow bins on
1039      
1040 <  
1040 >  switch_overunderflow(true);
1041      flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- the arguments changed
1042    for(int ijzb=0;ijzb<(int)jzb_cuts.size();ijzb++) {
1043      float jzbcut=jzb_cuts[ijzb]; // Comparison plots are done for this JZB cut
# Line 1255 | Line 1354 | if you want to start from scratch (witho
1354  
1355   void do_prediction_plot(string jzb, TCanvas *globalcanvas, float high, int use_data, bool overlay_signal = false,string subdir="" )
1356   {
1357 < //  switch_overunderflow(true);
1357 >  
1358    bool is_data=false;
1359    bool use_signal=false;
1360    if(use_data==1) is_data=true;
1361    if(use_data==2) use_signal=true;
1362 <  int nbins=50;//100;
1363 <  if(is_data) nbins=50;
1362 >  int nbins=int(high/10);//100;
1363 >  if(is_data) nbins=int(high/10);
1364    float low=0;
1365 <  float hi=500;
1365 >  float hi=high;
1366 >  
1367 >  stringstream cutpositiveS;
1368 >  cutpositiveS << "(" << jzb << ">0)";
1369 >  TCut cutpositive(cutpositiveS.str().c_str());
1370 >  stringstream cutnegativeS;
1371 >  cutnegativeS << "(" << jzb << "<0)";
1372 >  TCut cutnegative(cutnegativeS.str().c_str());
1373 >  
1374    
1375    TH1F *blankback = new TH1F("blankback","blankback",int(high/10),0,high);
1376 <  TH1F *RcorrJZBeemm   = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1377 <  TH1F *LcorrJZBeemm   = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1378 <  TH1F *RcorrJZBem     = allsamples.Draw("RcorrJZBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1379 <  TH1F *LcorrJZBem     = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1376 >  TH1F *RcorrJZBeemm   = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1377 >  TH1F *LcorrJZBeemm   = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutnegative&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1378 >  TH1F *RcorrJZBem     = allsamples.Draw("RcorrJZBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1379 >  TH1F *LcorrJZBem     = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutnegative&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1380  
1381    blankback->GetXaxis()->SetTitle(RcorrJZBeemm->GetXaxis()->GetTitle());
1382    blankback->GetYaxis()->SetTitle(RcorrJZBeemm->GetYaxis()->GetTitle());
# Line 1284 | Line 1391 | void do_prediction_plot(string jzb, TCan
1391    
1392    TH1F *RcorrJZBeemmNoS;
1393  
1394 <    //these are for the ratio
1395 <  
1396 <  TH1F *JRcorrJZBeemm   = allsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1397 <  TH1F *JLcorrJZBeemm   = allsamples.Draw("JLcorrJZBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1398 <  TH1F *JRcorrJZBem     = allsamples.Draw("JRcorrJZBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1292 <  TH1F *JLcorrJZBem     = allsamples.Draw("JLcorrJZBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1394 >  //these are for the ratio
1395 >  TH1F *JRcorrJZBeemm   = allsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1396 >  TH1F *JLcorrJZBeemm   = allsamples.Draw("JLcorrJZBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutnegative&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1397 >  TH1F *JRcorrJZBem     = allsamples.Draw("JRcorrJZBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1398 >  TH1F *JLcorrJZBem     = allsamples.Draw("JLcorrJZBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutnegative&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1399    
1400    TH1F *JRcorrJZBSBem;
1401    TH1F *JLcorrJZBSBem;
1402    TH1F *JRcorrJZBSBeemm;
1403    TH1F *JLcorrJZBSBeemm;
1404    
1405 <  if(use_data==2 || overlay_signal) RcorrJZBeemmNoS = allsamples.Draw("RcorrJZBeemmNoS",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,false);
1405 >  if(use_data==2 || overlay_signal) RcorrJZBeemmNoS = allsamples.Draw("RcorrJZBeemmNoS",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,false);
1406  
1407    
1408    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
1409 <    RcorrJZBSBem   = allsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1410 <    LcorrJZBSBem   = allsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1411 <    RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1412 <    LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1409 >    RcorrJZBSBem   = allsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1410 >    LcorrJZBSBem   = allsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutnegative&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1411 >    RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1412 >    LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutnegative&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1413      
1414      //these are for the ratio
1415 <    JRcorrJZBSBem   = allsamples.Draw("JRcorrJZBSBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1416 <    JLcorrJZBSBem   = allsamples.Draw("JLcorrJZBSBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1417 <    JRcorrJZBSBeemm = allsamples.Draw("JRcorrJZBSBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1418 <    JLcorrJZBSBeemm = allsamples.Draw("JLcorrJZBSBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1415 >    JRcorrJZBSBem   = allsamples.Draw("JRcorrJZBSBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutpositive&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1416 >    JLcorrJZBSBem   = allsamples.Draw("JLcorrJZBSBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutnegative&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1417 >    JRcorrJZBSBeemm = allsamples.Draw("JRcorrJZBSBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutpositive&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1418 >    JLcorrJZBSBeemm = allsamples.Draw("JLcorrJZBSBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutnegative&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1419    }
1420    
1421    TH1F *lm4RcorrJZBeemm;
1422 <  if(overlay_signal || use_data == 2 || use_data == 1) lm4RcorrJZBeemm = allsamples.Draw("lm4RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,allsamples.FindSample("LM"));
1422 >  if(overlay_signal || use_data == 2 || use_data == 1) lm4RcorrJZBeemm = allsamples.Draw("lm4RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,allsamples.FindSample("LM"));
1423    
1424    flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed.
1425    
# Line 1377 | Line 1483 | void do_prediction_plot(string jzb, TCan
1483    SQRT(BpredSys);
1484    BpredSys->Divide(JBpred);
1485  
1380  
1486    flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed
1487    TH1F *Tpred = (TH1F*)RcorrJZBem->Clone("Bpred");
1488    Tpred->Add(LcorrJZBem,-1.0);
# Line 1430 | Line 1535 | void do_prediction_plot(string jzb, TCan
1535      Bpred->Draw("hist,same");
1536      //analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same");
1537      RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP!
1538 <    lm4RcorrJZBeemm->Draw("hist,same");
1538 >    //lm4RcorrJZBeemm->Draw("hist,same");
1539      legBpred->AddEntry(RcorrJZBeemm,"observed","p");
1540      legBpred->AddEntry(Bpred,"predicted","l");
1541   //    legBpred->AddEntry(analytical_function[1],"predicted fit","l");
1542   //    legBpred->AddEntry(analytical_function[2],"stat. uncert.","l");
1543 <    legBpred->AddEntry(lm4RcorrJZBeemm,(allsamples.collection[allsamples.FindSample("LM")[0]].samplename).c_str(),"l");
1543 > //     legBpred->AddEntry(lm4RcorrJZBeemm,(allsamples.collection[allsamples.FindSample("LM")[0]].samplename).c_str(),"l");
1544      legBpred->Draw();
1545      DrawPrelim();
1546  
# Line 1445 | Line 1550 | void do_prediction_plot(string jzb, TCan
1550      Bpred->SetLineWidth(2);
1551      predcomppad->cd();
1552      predcomppad->SetLogy(1);
1448    
1553      TH1F *jzbnegative = (TH1F*)LcorrJZBeemm->Clone("jzbnegative");
1554      TH1F *sidebandsemu = (TH1F*)Bpred->Clone("sidebandsemu");
1555      sidebandsemu->Add(jzbnegative,-1);
# Line 1467 | Line 1571 | void do_prediction_plot(string jzb, TCan
1571   //    lm4RcorrJZBeemm->SetLineColor(kOrange+1);
1572      lm4RcorrJZBeemm->SetLineWidth(2);
1573      //lm4RcorrJZBeemm->SetLineWidth(2); // paper style. overruled.
1574 <    lm4RcorrJZBeemm->Draw("histo,same");
1574 > //     lm4RcorrJZBeemm->Draw("histo,same");
1575      DrawPrelim();
1576      TLegend *speciallegBpred = make_legend("",0.45,0.55);
1577      //TLegend *speciallegBpred = make_legend("",0.35,0.55); // paper style. overruled.
# Line 1477 | Line 1581 | void do_prediction_plot(string jzb, TCan
1581      if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) speciallegBpred->AddEntry(sidebandsemu,"Sidebands/e#mu (data)","f");
1582      else speciallegBpred->AddEntry(sidebandsemu,"e#mu (data)","f");
1583   //    speciallegBpred->AddEntry(lm4RcorrJZBeemmC,"LM4","l");
1584 <    speciallegBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l");
1584 > //     speciallegBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l");
1585      speciallegBpred->Draw();
1586      save_with_ratio(JRcorrJZBeemm,JBpred,predcomppad,subdir+"Bpred_Data_____PredictionComposition",true,true,"data/pred",BpredSys);
1587      
# Line 1513 | Line 1617 | void do_prediction_plot(string jzb, TCan
1617      legBpred->AddEntry(Bpred,"MC predicted","l");    
1618      if(versok) legBpred->AddEntry((TObject*)0,"",""); // Just for alignment // causes seg fault on root v5.18
1619      if(versok) legBpred->AddEntry((TObject*)0,"",""); // causes seg fault on root v5.18
1620 <    if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l");
1620 > //     if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l");
1621      legBpred->Draw();
1622      DrawMCPrelim();
1623      Bpredsaveas="Bpred_MC";
# Line 1545 | Line 1649 | void do_prediction_plot(string jzb, TCan
1649        
1650        RcorrJZBeemmNoS->SetLineStyle(2);
1651        legBpred2->AddEntry(RcorrJZBeemmNoS,"MC B","l");
1652 <      legBpred2->AddEntry(lm4RcorrJZBeemm,"MC S","l");
1652 > //       legBpred2->AddEntry(lm4RcorrJZBeemm,"MC S","l");
1653        legBpred2->Draw();
1654        RcorrJZBeemmNoS->SetLineColor(TColor::GetColor("#61210B"));
1655        RcorrJZBeemmNoS->Draw("histo,same");
# Line 1564 | Line 1668 | void do_prediction_plot(string jzb, TCan
1668    //save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,Bpredsaveas,true,use_data!=1,ytitle);
1669    save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,subdir+Bpredsaveas,true,false,ytitle,BpredSys);//not extending the y range anymore up to 4
1670  
1671 +
1672    
1673    flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
1674    // The part below is meaningless for the offpeak analysis (it's a comparison of the different estimates but there is but one estimate!)
# Line 1622 | Line 1727 | void do_prediction_plot(string jzb, TCan
1727        legBpredc->AddEntry(Bpredem,"MC OFZP","l");
1728        legBpredc->AddEntry(BpredSBem,"MC OFSB","l");
1729        legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l");
1730 <      if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l");
1730 > //       if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l");
1731        legBpredc->Draw();
1732        CompleteSave(globalcanvas,subdir+"Bpred_MCwithS_comparison");
1733      }
# Line 1658 | Line 1763 | void do_prediction_plot(string jzb, TCan
1763      delete JLcorrJZBSBeemm;
1764    }
1765    if(overlay_signal || use_data==2) delete lm4RcorrJZBeemm;
1661  switch_overunderflow(false);
1766   }
1767  
1768   void do_prediction_plots(string mcjzb, string datajzb, float DataSigma, float MCSigma, bool overlay_signal ) {
1769 +  switch_overunderflow(true);
1770    TCanvas *globalcanvas = new TCanvas("globalcanvas","Prediction Canvas");
1771    do_prediction_plot(datajzb,globalcanvas,jzbHigh ,data,overlay_signal);
1772    if ( !PlottingSetup::Approved ) {
# Line 1670 | Line 1775 | void do_prediction_plots(string mcjzb, s
1775    } else {
1776      write_info(__FUNCTION__,"You set approved to true, therefore not producing prediction/observation plots for MC with and without signal.");
1777    }
1778 < }
1779 <
1675 < void do_ratio_plot(int is_data,vector<float> binning, string jzb, TCanvas *can, float high=-9999) {
1676 <  bool do_data=0;
1677 <  bool dosignal=0;
1678 <  if(is_data==1) do_data=1;
1679 <  if(is_data==2) dosignal=1;
1680 <  TH1F *RcorrJZBeemm   = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,do_data, luminosity,dosignal);
1681 <  TH1F *LcorrJZBeemm   = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,do_data, luminosity,dosignal);
1682 <  TH1F *RcorrJZBem     = allsamples.Draw("RcorrJZBem",jzb.c_str(),binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,do_data, luminosity,dosignal);
1683 <  TH1F *LcorrJZBem     = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,do_data, luminosity,dosignal);
1684 <  
1685 <  TH1F *RcorrJZBSBem;
1686 <  TH1F *LcorrJZBSBem;
1687 <  TH1F *RcorrJZBSBeemm;
1688 <  TH1F *LcorrJZBSbeemm;
1689 <  
1690 <  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
1691 <    RcorrJZBSBem   = allsamples.Draw("RcorrJZBSbem",jzb.c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,do_data, luminosity,dosignal);
1692 <    LcorrJZBSBem   = allsamples.Draw("LcorrJZBSbem",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,do_data, luminosity,dosignal);
1693 <    RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSbeemm",jzb.c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,do_data, luminosity,dosignal);
1694 <    LcorrJZBSbeemm = allsamples.Draw("LcorrJZBSbeemm",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,do_data, luminosity,dosignal);
1695 <  }
1696 <  
1697 <
1698 <
1699 <
1700 <  flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
1701 <  TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred");
1702 <  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
1703 <    Bpred->Add(RcorrJZBem,1.0/3);
1704 <    Bpred->Add(LcorrJZBem,-1.0/3);
1705 <    Bpred->Add(RcorrJZBSBem,1.0/3);
1706 <    Bpred->Add(LcorrJZBSBem,-1.0/3);
1707 <    Bpred->Add(RcorrJZBSBeemm,1.0/3);
1708 <    Bpred->Add(LcorrJZBSbeemm,-1.0/3);
1709 <  } else {
1710 <    Bpred->Add(RcorrJZBem,1.0);
1711 <    Bpred->Add(LcorrJZBem,-1.0);
1712 <  }
1713 <
1714 <  can->cd();
1715 <  can->SetLogy(0);
1716 <  Bpred->SetLineColor(kRed);
1717 <  Bpred->SetStats(0);
1718 <  if(high>0) Bpred->GetXaxis()->SetRangeUser(0,high);
1719 <  TH1F *JZBratioforfitting=(TH1F*)RcorrJZBeemm->Clone("JZBratioforfitting");
1720 <  JZBratioforfitting->Divide(Bpred);
1721 <  TGraphAsymmErrors *JZBratio = histRatio(RcorrJZBeemm,Bpred,is_data,binning,false);
1722 <  
1723 <  
1724 <  JZBratio->SetTitle("");
1725 <  JZBratio->GetYaxis()->SetRangeUser(0.0,9.0);
1726 < //  if(is_data==1) JZBratio->GetXaxis()->SetRangeUser(0,jzbHigh );
1727 <  
1728 <  TF1 *pol0 = new TF1("pol0","[0]",0,1000);
1729 <  TF1 *pol0d = new TF1("pol0","[0]",0,1000);
1730 < //  straightline_fit->SetParameter(0,1);
1731 <  JZBratioforfitting->Fit(pol0,"Q0R","",0,30);
1732 <  pol0d->SetParameter(0,pol0->GetParameter(0));
1733 <  
1734 <  JZBratio->GetYaxis()->SetTitle("Observed/Predicted");
1735 <  JZBratio->GetXaxis()->SetTitle("JZB [GeV]");
1736 <  if ( high>0 ) JZBratio->GetXaxis()->SetRangeUser(0.0,high);
1737 <  JZBratio->GetYaxis()->SetNdivisions(519);
1738 <  JZBratio->GetYaxis()->SetRangeUser(0.0,4.0);
1739 <  JZBratio->GetYaxis()->CenterTitle();
1740 <  JZBratio->GetXaxis()->CenterTitle();
1741 <  JZBratio->SetMarkerSize(DataMarkerSize);
1742 <  JZBratio->Draw("AP");
1743 <  /////----------------------------
1744 <  TPaveText *writeresult = new TPaveText(0.15,0.78,0.49,0.91,"blNDC");
1745 <  writeresult->SetFillStyle(4000);
1746 <  writeresult->SetFillColor(kWhite);
1747 <  writeresult->SetTextFont(42);
1748 <  writeresult->SetTextSize(0.03);
1749 <  writeresult->SetTextAlign(12);
1750 <  ostringstream jzb_agreement_data_text;
1751 <  jzb_agreement_data_text<< setprecision(2) << "mean =" << pol0->GetParameter(0) << " #pm " << setprecision(1) <<  pol0->GetParError(0);
1752 <  if(is_data==1) fitresultconstdata=pol0->GetParameter(0);// data
1753 <  if(is_data==0) fitresultconstmc=pol0->GetParameter(0); // monte carlo, no signal
1754 < /*  if(is_data) writeresult->AddText("Data closure test");
1755 <  else writeresult->AddText("MC closure test");
1756 <  */
1757 <  writeresult->AddText(jzb_agreement_data_text.str().c_str());
1758 < //  writeresult->Draw("same");
1759 < //  pol0d->Draw("same");
1760 <  TF1 *topline =  new TF1("","1.5",0,1000);
1761 <  TF1 *bottomline =  new TF1("","0.5",0,1000);
1762 <  topline->SetLineColor(kBlue);
1763 <  topline->SetLineStyle(2);
1764 <  bottomline->SetLineColor(kBlue);
1765 <  bottomline->SetLineStyle(2);
1766 < //  topline->Draw("same");
1767 < //  bottomline->Draw("same");
1768 <  TF1 *oneline = new TF1("","1.0",0,1000);
1769 <  oneline->SetLineColor(kBlue);
1770 <  oneline->SetLineStyle(1);
1771 <  oneline->Draw("same");
1772 <  TLegend *phony_leg = make_legend("ratio",0.6,0.55,false);//this line is just to have the default CMS Preliminary (...) on the canvas as well.
1773 <  if(is_data==1) DrawPrelim();
1774 <  else DrawMCPrelim();
1775 <  TLegend *leg = new TLegend(0.55,0.75,0.89,0.89);
1776 <  leg->SetTextFont(42);
1777 <  leg->SetTextSize(0.04);
1778 < //   if(is_data==1) leg->SetHeader("Ratio (data)");
1779 < //   else leg->SetHeader("Ratio (MC)");
1780 <
1781 <  TString MCtitle("MC ");
1782 <  if (is_data==1) MCtitle = "";
1783 <
1784 <  leg->SetFillStyle(4000);
1785 <  leg->SetFillColor(kWhite);
1786 <  leg->SetTextFont(42);
1787 < //  leg->AddEntry(topline,"+20\% sys envelope","l");
1788 <  leg->AddEntry(JZBratio,MCtitle+"obs / "+MCtitle+"pred","p");
1789 <  leg->AddEntry(oneline,"ratio = 1","l");
1790 < //  leg->AddEntry(pol0d,"fit in [0,30] GeV","l");
1791 < //  leg->AddEntry(bottomline,"#pm50% envelope","l");
1792 <
1793 <
1794 <  //leg->Draw("same"); // no longer drawing legend
1795 <
1796 <  if(is_data==1) CompleteSave(can, "jzb_ratio_data");
1797 <  if(is_data==0) CompleteSave(can, "jzb_ratio_mc");
1798 <  if(is_data==2) CompleteSave(can, "jzb_ratio_mc_BandS");//special case, MC with signal!
1799 <  
1800 <  delete RcorrJZBeemm;
1801 <  delete LcorrJZBeemm;
1802 <  delete RcorrJZBem;
1803 <  delete LcorrJZBem;
1804 <  
1805 <  delete RcorrJZBSBem;
1806 <  delete LcorrJZBSBem;
1807 <  delete RcorrJZBSBeemm;
1808 <  delete LcorrJZBSbeemm;
1809 < }
1810 <
1811 < void do_ratio_plots(string mcjzb,string datajzb,vector<float> ratio_binning) {
1812 <  TCanvas *globalc = new TCanvas("globalc","Ratio Plot Canvas");
1813 <  globalc->SetLogy(0);
1814 <  
1815 <  do_ratio_plot(mc,ratio_binning,mcjzb,globalc, jzbHigh  );
1816 <  do_ratio_plot(data,ratio_binning,datajzb,globalc, jzbHigh  );
1817 <  do_ratio_plot(mcwithsignal,ratio_binning,mcjzb,globalc, jzbHigh  );
1778 >  delete globalcanvas;
1779 >  switch_overunderflow(false);
1780   }
1781  
1782   string give_jzb_expression(float peak, int type) {
# Line 2082 | Line 2044 | void produce_stretched_jzb_plots(string
2044    
2045  
2046   void diboson_plots(string mcjzb, string datajzb,vector<float> ratio_binning) {
2047 +  switch_overunderflow(true);
2048    vector<int> SamplesToBeModified = allsamples.FindSampleBySampleName("WW/WZ/ZZ");
2049    
2050    if(SamplesToBeModified.size()==0 || SamplesToBeModified[0]==-1) {
# Line 2121 | Line 2084 | void diboson_plots(string mcjzb, string
2084      dout << "     Reset xs for sample " << (allsamples.collection)[SamplesToBeModified[i]].samplename << " from " << Upxs << " to " << (allsamples.collection)[SamplesToBeModified[i]].xs << " (by a factor of " << stretchfactor << ") and reset the correct name (from " << Upname << ")" << endl;
2085      
2086    }
2087 <  
2087 > //   switch_overunderflow(false);
2088   }
2089  
2090  
# Line 2156 | Line 2119 | void draw_normalized_data_vs_data_histo(
2119  
2120  
2121   void jzb_plots(string mcjzb, string datajzb,vector<float> ratio_binning) {
2122 +  switch_overunderflow(true);
2123    TCanvas *can = new TCanvas("can","JZB Plots Canvas");
2124    float max=jzbHigh ;
2125    float min=-120;
# Line 2192 | Line 2156 | void jzb_plots(string mcjzb, string data
2156      if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning);
2157    }
2158    delete can;
2159 +  switch_overunderflow(false);
2160   }
2161  
2162  
# Line 2732 | Line 2697 | void ttbar_sidebands_comparison(string m
2697    //in the case of the on peak analysis, we compare the 3 control regions to the real value
2698    //in the case of the OFF peak analysis, we compare our control region to the real value
2699    TCut weightbackup=cutWeight;
2700 +  switch_overunderflow(true);
2701    
2702    bool doPURW=false;
2703    
# Line 2753 | Line 2719 | void ttbar_sidebands_comparison(string m
2719        
2720    float simulatedlumi = luminosity; //in pb please - adjust to your likings
2721  
2722 <  TH1F *TZem  = systsamples.Draw("TZem",     mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
2723 <  TH1F *nTZem = systsamples.Draw("nTZem","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
2722 >  TH1F *TZem  = systsamples.Draw("TZem",     mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
2723 >  TH1F *nTZem = systsamples.Draw("nTZem","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
2724    TH1F *TSem;
2725    TH1F *nTSem;
2726 <  TH1F *TZeemm  = systsamples.Draw("TZeemm",     mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
2727 <  TH1F *nTZeemm = systsamples.Draw("nTZeemm","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
2726 >  TH1F *TZeemm  = systsamples.Draw("TZeemm",     mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
2727 >  TH1F *nTZeemm = systsamples.Draw("nTZeemm","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
2728    TH1F *TSeemm;
2729    TH1F *nTSeemm;
2730    
2731    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2732 <    TSem    = systsamples.Draw("TSem",       mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
2733 <    nTSem   = systsamples.Draw("nTSem",  "-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
2734 <    TSeemm  = systsamples.Draw("TSeemm",     mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
2735 <    nTSeemm = systsamples.Draw("nTSeemm","-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
2732 >    TSem    = systsamples.Draw("TSem",       mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
2733 >    nTSem   = systsamples.Draw("nTSem",  "-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
2734 >    TSeemm  = systsamples.Draw("TSeemm",     mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
2735 >    nTSeemm = systsamples.Draw("nTSeemm","-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
2736    }
2737  
2738    TCanvas *tcan = new TCanvas("tcan","tcan");
# Line 2798 | Line 2764 | void ttbar_sidebands_comparison(string m
2764      histos.push_back(TSem);
2765      histos.push_back(TSeemm);
2766    }
2767 <  draw_all_ttbar_histos(tcan,histos,"histo",1);
2767 >  draw_all_ttbar_histos(tcan,histos,"histo",8);
2768    
2769    TLegend *leg = make_legend("MC t#bar{t}",0.6,0.65,false);
2770    leg->AddEntry(TZeemm,"SFZP","l");
# Line 2810 | Line 2776 | void ttbar_sidebands_comparison(string m
2776    leg->Draw("same");
2777    DrawMCPrelim(simulatedlumi);
2778    CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_shape_comparison");
2779 +  
2780    TH1F *TZemcopy = (TH1F*)TZem->Clone("TZemcopy");
2781    TH1F *TZeemmcopy = (TH1F*)TZeemm->Clone("TZeemmcopy");
2782    TH1F *TSeemmcopy;
# Line 2875 | Line 2842 | void ttbar_sidebands_comparison(string m
2842    DrawMCPrelim(simulatedlumi);
2843    CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_shape_comparison_ratio");
2844    
2845 +  
2846    if (0) { // Turn this off: we don't need this
2847  
2848      ///-------------- second part: only look at the quantity we actually care about!
# Line 2980 | Line 2948 | void ttbar_sidebands_comparison(string m
2948  
2949    delete tcan;
2950    cutWeight=weightbackup;
2951 +  switch_overunderflow(false);
2952   }
2953  
2954   void ttbar_sidebands_comparison(string mcjzb, vector<float> jzb_binning) {
# Line 3014 | Line 2983 | void ttbar_sidebands_comparison(string m
2983    nicer_binning.push_back(150);
2984    //nicer_binning.push_back(175);
2985    nicer_binning.push_back(200);
2986 <  nicer_binning.push_back(250);
2987 <  nicer_binning.push_back(300);
2988 <  nicer_binning.push_back(400);
2986 > //  nicer_binning.push_back(250);
2987 > //  nicer_binning.push_back(300);
2988 > //  nicer_binning.push_back(400);
2989    
2990    ttbar_sidebands_comparison(mcjzb,nicer_binning, "ttbar/");
2991   }
2992  
2993  
2994 < void zjets_prediction_comparison(string mcjzbWithPUa) {
2994 > void zjets_prediction_comparison(string mcjzbWithPUa, TCut massregioncut, string massregionname) {
2995 >  cout << "****************************************************************************************************************************************************************" << endl;
2996    TCanvas *zcan = new TCanvas("zcan","zcan");  
2997   //  zcan->SetLogy(1);
2998    TCut weightbackup=cutWeight;
2999    
3000 <  bool UsePURW=false;
3000 >  bool UsePURW=true;
3001    
3002    
3003    string mcjzb;
3004    if(UsePURW) {
3005      mcjzb=mcjzbWithPUa;
3006 +    cout << "Using PURW peak positions" << endl;
3007    } else {
3008      // Do it without PU re-weighting
3009 +    cutWeight="1.0";
3010      float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0;
3011      stringstream resultsNoPU;
3012      stringstream noPUdatajzb;
# Line 3045 | Line 3017 | void zjets_prediction_comparison(string
3017      
3018      mcjzb = noPUmcjzb.str();
3019      
3048    cutWeight="1.0";
3020    }
3021  
3022    
# Line 3069 | Line 3040 | void zjets_prediction_comparison(string
3040    string var( "abs("+mcjzb+")" );
3041    
3042    TCut notTau("abs(genMID1)!=15");
3043 <  TCut ONLYTau("mll>20");
3043 >  TCut ee_mm_tautau("mll>0");
3044    
3045  
3046 <  TH1F *hJZBpos = systsamples.Draw("hJZBpos",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&&notTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY"));
3047 <  TH1F *hJZBneg = systsamples.Draw("hJZBneg",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&&notTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY"));
3046 >  TH1F *hJZBpos = systsamples.Draw("hJZBpos",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&&notTau&&kPos&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY"));
3047 >  TH1F *hJZBneg = systsamples.Draw("hJZBneg",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&&notTau&&kNeg&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY"));
3048    
3049    hJZBpos->SetLineColor(kBlack);
3050    hJZBneg->SetLineColor(kRed);
# Line 3088 | Line 3059 | void zjets_prediction_comparison(string
3059    leg->AddEntry(hJZBneg,"Predicted","l");
3060    leg->Draw("same");
3061    DrawMCPrelim(simulatedlumi);
3062 <  CompleteSave(zcan,"Systematics/ZJets/zjets_eemm_prediction");
3062 >  CompleteSave(zcan,"Systematics/ZJets/zjets_eemm_prediction"+any2string(massregionname));
3063    
3064    TH1F* hratio = (TH1F*)hJZBpos->Clone("hratio");
3065    hratio->Divide(hJZBneg);
# Line 3097 | Line 3068 | void zjets_prediction_comparison(string
3068      cout << "Positive: " << hJZBpos->GetBinContent(i) << "   vs    Negative : " << hJZBneg->GetBinContent(i) << "   (ratio : " << hJZBpos->GetBinContent(i) / hJZBneg->GetBinContent(i) << endl;
3069    }
3070    
3071 <  zcan->SetLogy(0);
3072 <  hratio->GetYaxis()->SetRangeUser(0,2.0);
3071 > //  zcan->SetLogy(0);
3072 >  hratio->GetYaxis()->SetRangeUser(0,2.5);
3073    hratio->GetYaxis()->SetTitle("Observed/Predicted");
3074    hratio->Draw("e1");
3075    
# Line 3107 | Line 3078 | void zjets_prediction_comparison(string
3078    TLine *bottom = new TLine(binning[0],0.75,binning[binning.size()-1],0.75);
3079    
3080  
3081 +  cout << __LINE__ << endl;
3082    top->SetLineColor(kBlue);top->SetLineStyle(2);
3083    bottom->SetLineColor(kBlue);bottom->SetLineStyle(2);
3084    center->SetLineColor(kBlue);
# Line 3120 | Line 3092 | void zjets_prediction_comparison(string
3092    leg2->AddEntry(bottom,"syst. envelope","l");
3093    leg2->Draw("same");
3094    DrawMCPrelim(simulatedlumi);
3095 <  CompleteSave(zcan,"Systematics/ZJets/zjets_eemm_prediction_ratio");
3095 >  CompleteSave(zcan,"Systematics/ZJets/zjets_eemm_prediction_ratio"+any2string(massregionname));
3096    
3097    TCut reducedNJets(cutnJets);
3098    
3099 <  TH1F *TAUhJZBpos = systsamples.Draw("TAUhJZBpos",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY"));
3100 <  TH1F *LcorrJZBeemm     = systsamples.Draw("LcorrJZBeemm",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY"));
3101 <  TH1F *RcorrJZBem       = systsamples.Draw("RcorrJZBem",var,binning, "JZB [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY"));
3102 <  TH1F *LcorrJZBem       = systsamples.Draw("LcorrJZBem",var,binning, "JZB [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY"));
3099 >  TH1F *TAUhJZBpos       = systsamples.Draw("TAUhJZBpos",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&&ee_mm_tautau&&kPos&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY"));
3100 >  TH1F *LcorrJZBeemm     = systsamples.Draw("LcorrJZBeemm",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&&ee_mm_tautau&&kNeg&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY"));
3101 >  TH1F *RcorrJZBem       = systsamples.Draw("RcorrJZBem",var,binning, "JZB [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&&ee_mm_tautau&&kPos&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY"));
3102 >  TH1F *LcorrJZBem       = systsamples.Draw("LcorrJZBem",var,binning, "JZB [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&&ee_mm_tautau&&kNeg&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY"));
3103  
3104 +  cout << __LINE__ << endl;
3105    TH1F *RcorrJZBSBem;
3106    TH1F *LcorrJZBSBem;
3107    TH1F *RcorrJZBSBeemm;
3108    TH1F *LcorrJZBSBeemm;
3109  
3110 +  cout << __LINE__ << endl;
3111    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3112 <    RcorrJZBSBem   = systsamples.Draw("RcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY"));
3113 <    LcorrJZBSBem   = systsamples.Draw("LcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY"));
3114 <    RcorrJZBSBeemm = systsamples.Draw("RcorrJZBSBeemm",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY"));
3115 <    LcorrJZBSBeemm = systsamples.Draw("LcorrJZBSBeemm",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY"));
3112 >    RcorrJZBSBem   = systsamples.Draw("RcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ee_mm_tautau&&kPos&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY"));
3113 >    LcorrJZBSBem   = systsamples.Draw("LcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ee_mm_tautau&&kNeg&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY"));
3114 >    RcorrJZBSBeemm = systsamples.Draw("RcorrJZBSBeemm",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&&ee_mm_tautau&&kPos&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY"));
3115 >    LcorrJZBSBeemm = systsamples.Draw("LcorrJZBSBeemm",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&&ee_mm_tautau&&kNeg&&massregioncut,mc,simulatedlumi,systsamples.FindSample("/DY"));
3116    }
3117    
3118    TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred");
# Line 3156 | Line 3130 | void zjets_prediction_comparison(string
3130    
3131    Bpred->SetLineColor(kRed);
3132  
3133 +  cout << __LINE__ << endl;
3134    TAUhJZBpos->SetLineColor(kBlack);
3135    Bpred->SetLineColor(kRed);
3136    
# Line 3169 | Line 3144 | void zjets_prediction_comparison(string
3144    TAUleg->AddEntry(Bpred,"Predicted","l");
3145    TAUleg->Draw("same");
3146    DrawMCPrelim(simulatedlumi);
3147 <  CompleteSave(zcan,"Systematics/ZJets/zjets_eemumutautau_prediction");
3147 >  CompleteSave(zcan,"Systematics/ZJets/zjets_eemumutautau_prediction__"+any2string(massregionname));
3148    
3149    TH1F* TAUhratio = (TH1F*)TAUhJZBpos->Clone("TAUhratio");
3150    TAUhratio->Divide(Bpred);
# Line 3187 | Line 3162 | void zjets_prediction_comparison(string
3162    center->Draw("same");
3163    bottom->Draw("same");
3164    
3165 <  TLegend *TAUleg2 = make_legend("MC Z+jets #rightarrow #tau#tau",0.25,0.75,false);
3165 >  TLegend *TAUleg2 = make_legend("MC Z+jets #rightarrow ee,#mu#mu",0.25,0.75,false);
3166    TAUleg2->AddEntry(TAUhratio,"obs / pred","pe");
3167    TAUleg2->AddEntry(bottom,"syst. envelope","l");
3168    TAUleg2->Draw("same");
3169    DrawMCPrelim(simulatedlumi);
3170 <  CompleteSave(zcan,"Systematics/ZJets/zjets_eemumutautau_prediction_ratio");
3170 >  CompleteSave(zcan,"Systematics/ZJets/zjets_eemumutautau_prediction_ratio"+any2string(massregionname));
3171    
3172    delete Bpred;
3173    delete TAUhJZBpos;
3174    delete LcorrJZBeemm;
3175    delete RcorrJZBem;
3176    delete LcorrJZBem;
3177 +  delete hJZBpos;
3178 +  delete hJZBneg;
3179    
3180    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3181      delete RcorrJZBSBem;
# Line 3211 | Line 3188 | void zjets_prediction_comparison(string
3188    delete zcan;
3189    cutWeight=weightbackup;
3190  
3191 +  cout << __LINE__ << endl;
3192   }
3193  
3194  
3195 <
3195 > void zjets_prediction_comparison(string mcjzbWithPUa) {
3196 >  zjets_prediction_comparison(mcjzbWithPUa, TCut(""), "nomasscut");
3197 >  zjets_prediction_comparison(mcjzbWithPUa, TCut("abs(mll-91)<20"), "Zwindow_20");
3198 >  zjets_prediction_comparison(mcjzbWithPUa, TCut("mll>20&&mll<70"), "LowMassRegion2070");
3199 >  zjets_prediction_comparison(mcjzbWithPUa, TCut("mll>110"), "HighMassRegion110");
3200 > }
3201 >  
3202   void sideband_assessment(string datajzb, float min=30.0, float max=50.0) {
3203    tout << endl << endl;
3204    stringstream bordercut;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines