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.48 by buchmann, Wed Aug 15 09:18:07 2012 UTC vs.
Revision 1.56 by buchmann, Wed Sep 5 20:16:25 2012 UTC

# Line 86 | Line 86 | void find_one_peak_combination(TCut spec
86  
87   void find_peaks(float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, stringstream &result, bool doPUreweighting, stringstream &datajzb, stringstream &mcjzb)
88   {
89 <  
89 >  switch_overunderflow(false);
90 >
91    bool DoInvidualeemmPeaks=false;
92    
93    float mcpeak, datapeak;
# Line 133 | Line 134 | void find_peaks(float &MCPeak,float &MCP
134      else mcjzb << "+ (id1!=id2)*" << TMath::Abs(mcpeak) << " ";
135      
136      mcjzb << ")";
137 +    
138    } else {
139      datajzb << "(" << jzbvariabledata;
140        mcjzb << "(" << jzbvariablemc;
# Line 148 | Line 150 | void find_peaks(float &MCPeak,float &MCP
150      mcjzb << ")";
151    }
152    
153 +    MCPeak=mcpeak;
154 +    MCPeakError=mcpeakerr;
155 +    DataPeak=datapeak;
156 +    DataPeakError=datapeakerr;
157 +    
158 +    switch_overunderflow(true);
159    
160   }
161  
# Line 188 | Line 196 | void make_special_obs_pred_mll_plot(stri
196    
197   //  TH1F *RcorrJZBeemmNoS;
198  
199 <  if(PlottingSetup::RestrictToMassPeak) {
199 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
200      RcorrJZBSBem   = allsamples.Draw("RcorrJZBSBem",  "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&largerzeroD,data, luminosity);
201      LcorrJZBSBem   = allsamples.Draw("LcorrJZBSBem",  "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&smallerzeroD,data, luminosity);
202      RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&largerzeroD,data, luminosity);
# Line 199 | Line 207 | void make_special_obs_pred_mll_plot(stri
207    TH1F* SFN = (TH1F*)LcorrJZBeemm->Clone("SFN");
208    TH1F* OFP = (TH1F*)RcorrJZBem->Clone("OFP");
209    TH1F* OFN = (TH1F*)LcorrJZBem->Clone("OFN");
210 <  if(PlottingSetup::RestrictToMassPeak) {
210 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
211      OFP->Scale(1.0/3.0);
212      OFP->Add(RcorrJZBSBem,1.0/3.);
213      OFP->Add(RcorrJZBSBeemm,1.0/3.);
# Line 264 | Line 272 | void make_special_obs_pred_mll_plot(stri
272    delete LcorrJZBeemm;
273    delete RcorrJZBem;
274    delete LcorrJZBem;
275 <  if(PlottingSetup::RestrictToMassPeak) {
275 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
276      delete RcorrJZBSBeemm;
277      delete LcorrJZBSBeemm;
278      delete RcorrJZBSBem;
# Line 358 | Line 366 | void draw_ratio_plot(TH1* hdata, THStack
366    oneline->Draw("same");
367   }
368  
369 < void make_OFSF_plot(string variable, string addcut, string legendTitle, int nbins, float min, float max, bool logscale,
370 <                   string xlabel, string filename, bool isPF=true, bool plotratio=true, bool loadlastminmax=false, float legendPosition=0.3) {
369 > float make_one_OFSF_plot(string variable, string addcut, string legendTitle, int nbins, float min, float max, float ymax, bool logscale,
370 >                        string xlabel, string filename, bool plotratio=true, bool loadlastminmax=false, float legendPosition=0.55) {
371  
372    TCut ibasiccut=basiccut;
373    bool draw_separation_lines=false;
374  
367  if(isPF) ibasiccut=basiccut&&"pfjzb[0]>-998";
368
375    if(addcut != "") ibasiccut = ibasiccut && addcut.c_str();
376  
377    TCut cutSF;
378    TCut cutOF;
379  
380 <  cutOF=cutOSOF&&cutnJets&&ibasiccut;
381 <  cutSF=cutOSSF&&cutnJets&&ibasiccut;
376 <
380 >  cutOF = cutOSOF&&cutnJets&&ibasiccut;
381 >  cutSF = cutOSSF&&cutnJets&&ibasiccut;
382  
383    TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600);
384 <  ckin->SetLogy(logscale);
384 >  TPad* rcan = new TPad("rcan","rcan",0,0,1,1);
385 >  rcan->SetLogy(logscale);
386 >  rcan->cd();
387 >
388    TH1F *datahistoSF = allsamples.Draw("datahistoSF",variable,nbins,min,max, xlabel, "events",cutSF,data,luminosity);
389    TH1F *datahistoOF = allsamples.Draw("datahistoOF",variable,nbins,min,max, xlabel, "events",cutOF,data,luminosity);
390    string signal("LM3");
# Line 385 | Line 393 | void make_OFSF_plot(string variable, str
393    (signalsamples.collection)[idx].events->Project("signalhisto",variable.c_str(),cutSF);
394    signalhisto->Scale((signalsamples.collection)[idx].weight*luminosity);
395    signalhisto->SetLineColor((signalsamples.collection)[idx].samplecolor);
396 +  signalhisto->SetLineStyle(2);
397    datahistoSF->SetMarkerSize(DataMarkerSize);
398    datahistoOF->SetLineColor(kRed);
399  
400    if ( !logscale ) {
401      datahistoSF->SetMinimum(0); // Defaults
393    datahistoOF->SetMinimum(0); // Defaults
402    } else {
403      datahistoSF->SetMinimum(0.5);
396    datahistoOF->SetMinimum(0.5);
404    }
405 <  if (logscale) {
406 <    datahistoSF->SetMaximum(5.3*datahistoSF->GetMaximum());
407 <    datahistoOF->SetMaximum(5.3*datahistoSF->GetMaximum());
405 >  if (ymax<0) {
406 >    if ( logscale ) datahistoSF->SetMaximum(5.3*datahistoSF->GetMaximum());
407 >    else datahistoSF->SetMaximum(1.5*datahistoSF->GetMaximum());
408    } else {
409 <    datahistoSF->SetMaximum(2.0*datahistoSF->GetMaximum());
403 <    datahistoOF->SetMaximum(2.0*datahistoOF->GetMaximum());
409 >    datahistoSF->SetMaximum(ymax);
410    }
411  
412 +  float ymaxSet = datahistoSF->GetMaximum();
413 +
414    datahistoSF->GetXaxis()->SetTitle(xlabel.c_str());
415 <  datahistoOF->GetXaxis()->SetTitle(xlabel.c_str());
408 <  signalhisto->GetXaxis()->SetTitle(xlabel.c_str());
409 <  datahistoSF->GetYaxis()->SetTitle("N. Events");
410 <  datahistoOF->GetYaxis()->SetTitle("N. Events");
411 <  signalhisto->GetYaxis()->SetTitle("N. Events");
415 >  datahistoSF->GetYaxis()->SetTitle("Events");
416    datahistoSF->GetXaxis()->CenterTitle();
413  datahistoOF->GetXaxis()->CenterTitle();
414  signalhisto->GetXaxis()->CenterTitle();
417    datahistoSF->GetYaxis()->CenterTitle();
416  datahistoOF->GetYaxis()->CenterTitle();
417  signalhisto->GetYaxis()->CenterTitle();
418  
419 <  TLegend *mleg = new TLegend(0.2+legendPosition, 0.72, 0.55+legendPosition, 0.87, legendTitle.c_str());
420 <  mleg->SetFillColor(kWhite);
421 <  mleg->SetTextFont(42);
422 <  mleg->SetTextSize(0.048);
423 <  mleg->SetLineWidth(0);
424 <  mleg->SetBorderSize(0);
425 <  mleg->AddEntry(datahistoSF, "S. Flavor", "PL");
426 <  mleg->AddEntry(datahistoOF, "O. Flavor", "L");
419 >  TLegend *mleg = make_legend(legendTitle.c_str(),legendPosition,0.7,false,legendPosition+0.2);
420 >  mleg->AddEntry(datahistoSF, "Same-flavor", "PL");
421 >  if (datahistoOF->Integral()>0) {
422 >    mleg->AddEntry(datahistoOF, "Opposite-flavor", "L");
423 >  } else {
424 >    mleg->AddEntry((TObject*)0, "", "");
425 >  }
426    mleg->AddEntry(signalhisto, "LM3", "L");
427  
428    datahistoSF->Draw("E1");
429 <  datahistoOF->Draw("HIST,SAMES");
429 >  if (datahistoOF->Integral()>0) datahistoOF->Draw("HIST,SAMES");
430    signalhisto->Draw("HIST,SAMES");
431    mleg->Draw();
432    DrawPrelim();
433 <  CompleteSave(ckin, "./SFOF/" + filename);
433 >  if (datahistoOF->Integral()>0) save_with_ratio( datahistoSF, datahistoOF, rcan, "SFOF/" + filename, false, false, "SF/OF" );
434 >  else CompleteSave(ckin, "SFOF/" + filename);
435  
436    datahistoSF->Delete();
437    datahistoOF->Delete();
# Line 439 | Line 439 | void make_OFSF_plot(string variable, str
439    delete mleg;
440    delete ckin;
441  
442 +  return ymaxSet;
443 +
444   }
445  
446 + // Compare data to data
447 + float make_data_comparison_plot(string variable, TCut cut, int nbins, float min, float max, float ymax, bool logscale,
448 +                                string xlabel, string filename, float legendPosition=0.55) {
449 +
450 +  TCut ibasiccut=basiccut&&cut;
451 +
452 +  TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600);
453 +  TPad* rcan = new TPad("rcan","rcan",0,0,1,1);
454 +  rcan->SetLogy(logscale);
455 +  rcan->cd();
456 +
457 +  std::cout << "Data comparison: variable = " << variable << ", cut = " << ibasiccut.GetTitle() << std::endl;
458 +
459 +  TH1F *data1 = allsamples.Draw("data1",variable,nbins,min,max, xlabel, "events",ibasiccut,data,luminosity);
460 +  TH1F *data2 = comparesamples.Draw("data2",variable,nbins,min,max, xlabel, "events",ibasiccut,data,luminosity);
461 +
462 +  data1->SetMarkerSize(DataMarkerSize);
463 +  data2->SetLineColor(kRed);
464 +
465 +  if ( !logscale ) {
466 +    data1->SetMinimum(0); // Defaults
467 +  } else {
468 +    data1->SetMinimum(0.5);
469 +  }
470 +  if (ymax<0) {
471 +    if ( logscale ) data1->SetMaximum(5.3*data1->GetMaximum());
472 +    else data1->SetMaximum(1.5*data1->GetMaximum());
473 +  } else {
474 +    data1->SetMaximum(ymax);
475 +  }
476 +
477 +  float ymaxSet = data1->GetMaximum();
478 +
479 +  data1->GetXaxis()->SetTitle(xlabel.c_str());
480 +  data1->GetYaxis()->SetTitle("Events");
481 +  data1->GetXaxis()->CenterTitle();
482 +  data1->GetYaxis()->CenterTitle();
483 +
484 +  TLegend *mleg = make_legend("",legendPosition,0.7,false,legendPosition+0.2);
485 +  mleg->AddEntry(data1, "Old 5/fb", "PL");
486 +  mleg->AddEntry(data2, "New x/fb", "L");
487 +
488 +  data1->Draw("E1");
489 +  data2->Draw("HIST,SAMES");
490 +  mleg->Draw();
491 +  DrawPrelim();
492 +  save_with_ratio( data1, data2, rcan, "compareData/" + filename, false, false, "old/new" );
493 +
494 +  data1->Delete();
495 +  data2->Delete();
496 +  delete mleg;
497 +  delete ckin;
498 +
499 + }
500 +
501 + void make_OFSF_plots(string variable, string addcut, int nbins, float min, float max, bool logscale,
502 +                     string xlabel, string filename, float legendPosition=0.55) {
503 +
504 +  string mllcuts[] = { "mll>20","mll>20&&mll<70", "mll>75&&mll<105", "mll>120" };
505 +  string mllcutname[] = { "m_{ll} > 20 GeV", "20 < m_{ll} < 70 GeV", "75 < m_{ll} < 105 GeV", "m_{ll} > 120 GeV" };
506 +  string plotname[] = {"_all","_low","_peak","_high"};
507 +  float ymax;
508 +
509 +  int start = 0;
510 +  if ( !PlottingSetup::openBox ) start = 3;
511 +
512 +  for ( int i=start; i<4; ++i ) {
513 +    if ( addcut != "" ) mllcuts[i] += "&&"+addcut;
514 +    if ( i==start ) {
515 +      ymax = make_one_OFSF_plot(variable, mllcuts[i],            mllcutname[i], nbins, min, max, -1, logscale, xlabel,
516 +                         filename+plotname[i], legendPosition );
517 +    } else {
518 +      make_one_OFSF_plot(variable, mllcuts[i],            mllcutname[i], nbins, min, max, ymax, logscale, xlabel,
519 +                         filename+plotname[i], legendPosition );
520 +    }
521 +    make_one_OFSF_plot(variable, "id1==1&&id1==id2&&"+mllcuts[i], mllcutname[i], nbins, min, max, ymax, logscale, xlabel,
522 +                       filename+plotname[i]+"_mm", legendPosition );
523 +    make_one_OFSF_plot(variable, "id1==0&&id1==id2&&"+mllcuts[i], mllcutname[i], nbins, min, max, ymax, logscale, xlabel,
524 +                       filename+plotname[i]+"_ee", legendPosition );
525 +  }
526 +
527 + }
528  
529  
530   float lastrange_min=0;
# Line 472 | Line 556 | void make_kin_plot(string variable, stri
556    //Step 2: Refine the cut
557    TCut cut;
558    cut=cutmass&&cutOSSF&&cutnJets&&ibasiccut;
559 <  if(filename=="nJets") cut=cutmass&&cutOSSF&&ibasiccut;
560 <  if(filename=="nJets_osof") cut=cutmass&&cutOSOF&&ibasiccut;
559 >  if(filename=="nJets" || filename=="nJets_inclusive") cut=cutmass&&cutOSSF&&ibasiccut;
560 >  if(filename=="nJets_osof" || filename=="nJets_osof_inclusive") cut=cutmass&&cutOSOF&&ibasiccut;
561    if(filename=="nJets_nocuts_except_mll_ossf") cut=cutmass&&cutOSSF;
562    if(filename=="mll") {
563          cut=cutOSSF&&cutnJets&&ibasiccut;
564          draw_separation_lines=true;
565    }
566    if(filename=="mll_ee") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==0";
567 +  if(filename=="mll_mm") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==1";
568    if(filename=="mll_osof") {
569          cut=cutOSOF&&cutnJets&&ibasiccut;
570          draw_separation_lines=true;
571    }
487  if(filename=="mll_mm") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==1";
572    if(Contains(filename,"aboveJZB")) cut=cutOSSF&&cutnJets&&ibasiccut;
573    if(Contains(filename,"mll_ee_above")) cut=cut&&"id1==0";
574    if(Contains(filename,"mll_mm_above")) cut=cut&&"id1==1";
575    if(Contains(filename,"mll_osof_aboveJZB")) cut=cutOSOF&&cutnJets&&ibasiccut;
576 <  if(filename=="mll_inclusive"||filename=="mll_inclusive_highrange") cut=cutOSSF;
577 <  if(filename=="mll_inclusive_osof") cut=cutOSOF;
578 <  if(filename=="mll_inclusive_ee") cut=cutOSSF&&"id1==0";
579 <  if(filename=="mll_inclusive_mm") cut=cutOSSF&&"id1==1";
576 >  if(filename=="mll_inclusive"||filename=="mll_inclusive_highrange") cut=cutmass&&cutOSSF;
577 >  if(filename=="mll_inclusive_osof") cut=cutmass&&cutOSOF;
578 >  if(filename=="mll_inclusive_ee") cut=cutmass&&cutOSSF&&"id1==0";
579 >  if(filename=="mll_inclusive_mm") cut=cutmass&&cutOSSF&&"id1==1";
580    if(filename=="pfJetGoodEta_0") cut=cutOSSF&&cutmass&&ibasiccut&&cutnJets;
581    if(filename=="pfJetGoodPt_0") cut=cutOSSF&&cutmass&&ibasiccut&&cutnJets;
582 +  if(filename=="numVtx") cut=cutmass&&ibasiccut;
583  
584    TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600);
585    ckin->SetLogy(logscale);
# Line 652 | Line 737 | void do_kinematic_plots(string mcjzb, st
737   {
738    bool dolog=true;
739    bool nolog=false;
740 +
741 +  bool doOFSF = false;
742 +  bool doKin  = false;
743 +  bool doDataComp = true;
744 +  
745 +
746    if(doPF) write_warning(__FUNCTION__,"Please use caution when trying to produce PF plots; not all versions of the JZB trees have these variables!");
747    float mll_low=50;
748    float mll_hi=160;
749    if(!PlottingSetup::RestrictToMassPeak) {
750          mll_low=20;
751 <        mll_hi=300;
751 >        mll_hi=320;
752    }
753  
754 <  /*
755 <  make_OFSF_plot("pfJetGoodNum40", "mll>20&&mll<40&&met[4]>100", "20 GeV < mll < 40 GeV", 5, 3, 8, true, "N. jets", "njetsLow", false, false, false, 0.2);
756 <  make_OFSF_plot("pfJetGoodNum40", "mll>40&&mll<70&&met[4]>100", "40 GeV < mll < 70 GeV", 5, 3, 8, true, "N. jets", "njetsMed", false, false, false, 0.2);
757 <  make_OFSF_plot("pfJetGoodPt[0]/pfJetGoodPt[1]", "mll>20&&mll<40&&met[4]>100", "20 GeV < mll < 40 GeV", 20, 1, 10, true, "pt_{j}^{1}/pt_{j}^{2}", "jpt1pt2Low", false, false, false, 0.2);
758 <  make_OFSF_plot("pfJetGoodPt[0]/pfJetGoodPt[1]", "mll>40&&mll<70&&met[4]>100", "40 GeV < mll < 70 GeV", 20, 1, 10, true, "pt_{j}^{1}/pt_{j}^{2}", "jpt1pt2Med", false, false, false, 0.2);
759 <  make_OFSF_plot("TMath::Abs(pfJetDphiMet[0])", "mll>20&&mll<40&&met[4]>100", "20 GeV < mll < 40 GeV", 16, 0, 3.2, false, "|#Delta#phi(jet1,MET)|", "dphijetmetLow", false, false, false, 0.0);
760 <  make_OFSF_plot("TMath::Abs(pfJetDphiMet[0])", "mll>40&&mll<70&&met[4]>100", "40 GeV < mll < 70 GeV", 16, 0, 3.2, false, "|#Delta#phi(jet1,MET)|", "dphijetmetMed", false, false, false, 0.0);
761 <  make_OFSF_plot("TMath::Abs(dphi)", "mll>20&&mll<40&&met[4]>100", "20 GeV < mll < 40 GeV", 16, 0, 3.2, false, "|#Delta#phi(l1,l2)|", "dphiLow", false, false, false, 0.2);
762 <  make_OFSF_plot("TMath::Abs(dphi)", "mll>40&&mll<70&&met[4]>100", "40 GeV < mll < 70 GeV", 16, 0, 3.2, false, "|#Delta#phi(l1,l2)|", "dphiMed", false, false, false, 0.2);
763 <  make_OFSF_plot("TMath::Abs(dphiMet1)", "mll>20&&mll<40&&met[4]>100", "20 GeV < mll < 40 GeV", 16, 0, 3.2, false, "|#Delta#phi(l1,MET)|", "dphiMet1Low", false, false, false, 0.2);
764 <  make_OFSF_plot("TMath::Abs(dphiMet1)", "mll>40&&mll<70&&met[4]>100", "40 GeV < mll < 70 GeV", 16, 0, 3.2, false, "|#Delta#phi(l1,MET)|", "dphiMet1Med", false, false, false, 0.2);
765 <  make_OFSF_plot("TMath::Abs(dphiMet2)", "mll>20&&mll<40&&met[4]>100", "20 GeV < mll < 40 GeV", 16, 0, 3.2, false, "|#Delta#phi(l2,MET)|", "dphiMet2Low", false, false, false, 0.2);
766 <  make_OFSF_plot("TMath::Abs(dphiMet2)", "mll>40&&mll<70&&met[4]>100", "40 GeV < mll < 70 GeV", 16, 0, 3.2, false, "|#Delta#phi(l2,MET)|", "dphiMet2Med", false, false, false, 0.2);
767 <  make_OFSF_plot("TMath::Min(TMath::Abs(dphiMet1), TMath::Abs(dphiMet2))", "mll>20&&mll<40&&met[4]>100", "20 GeV < mll < 40 GeV", 16, 0, 3.2, false, "Min(|#Delta#phi(l,MET)|)", "dphilcLow", false, false, false, 0.2);
768 <  make_OFSF_plot("TMath::Min(TMath::Abs(dphiMet1), TMath::Abs(dphiMet2))", "mll>40&&mll<70&&met[4]>100", "40 GeV < mll < 70 GeV", 16, 0, 3.2, false, "Min(|#Delta#phi(l,MET)|)", "dphilcMed", false, false, false, 0.2);
769 <  make_OFSF_plot("TMath::Min(TMath::Abs(pfJetDphiMet[0]), TMath::Min(TMath::Abs(pfJetDphiMet[1]), TMath::Abs(pfJetDphiMet[2])))", "mll>20&&mll<40&&met[4]>100", "20 GeV < mll < 40 GeV", 16, 0, 3.2, false, "Min(|#Delta#phi(jet,MET)|)", "dphijcLow", false, false, false, 0.2);
770 <  make_OFSF_plot("TMath::Min(TMath::Abs(pfJetDphiMet[0]), TMath::Min(TMath::Abs(pfJetDphiMet[1]), TMath::Abs(pfJetDphiMet[2])))", "mll>20&&mll<40&&met[4]>100", "40 GeV < mll < 70 GeV", 16, 0, 3.2, false, "Min(|#Delta#phi(jet,MET)|)", "dphijcMed", false, false, false, 0.2);
771 <  make_OFSF_plot("TMath::Min((TMath::Pi()-TMath::Abs(dphiMet1)), (TMath::Pi() - TMath::Abs(dphiMet2)))", "mll>20&&mll<40&&met[4]>100", "20 GeV < mll < 40 GeV", 16, 0, 3.2, false, "Min(#Pi - |#Delta#phi(l,MET)|)", "dphilcoLow", false, false, false, 0.2);
772 <  make_OFSF_plot("TMath::Min((TMath::Pi()-TMath::Abs(dphiMet1)), (TMath::Pi() - TMath::Abs(dphiMet2)))", "mll>20&&mll<40&&met[4]>100", "40 GeV < mll < 70 GeV", 16, 0, 3.2, false, "Min(#Pi - |#Delta#phi(l,MET)|)", "dphilcoMed", false, false, false, 0.2);
773 <  make_OFSF_plot("TMath::Min((TMath::Pi()-TMath::Abs(pfJetDphiMet[0])), TMath::Min( (TMath::Pi()-TMath::Abs(pfJetDphiMet[1])), (TMath::Pi() - TMath::Abs(pfJetDphiMet[2]))))", "mll>20&&mll<40&&met[4]>100", "20 GeV < mll < 40 GeV", 16, 0, 3.2, false, "Min(#Pi - |#Delta#phi(jet,MET)|)", "dphijcoLow", false, false, false, 0.2);
774 <  make_OFSF_plot("TMath::Min((TMath::Pi()-TMath::Abs(pfJetDphiMet[0])), TMath::Min( (TMath::Pi()-TMath::Abs(pfJetDphiMet[1])), (TMath::Pi() - TMath::Abs(pfJetDphiMet[2]))))", "mll>20&&mll<40&&met[4]>100", "40 GeV < mll < 70 GeV", 16, 0, 3.2, false, "Min(#Pi - |#Delta#phi(jet,MET)|)", "dphijcoMed", false, false, false, 0.2);
775 <
776 <
777 <  make_kin_plot("met[4]","",70,0,350,dolog,"MET [GeV]","met",doPF,true);
778 <
779 <  make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll",doPF,true);
780 <  make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof",doPF,true,true);
781 <  make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_ee",doPF,true);
782 <  make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_mm",doPF,true);
783 <  make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive",doPF,true);
784 <  make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true);
785 <  make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true);
786 <  make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true);
787 <  make_kin_plot("mll","",(int)((350-mll_low))/5,mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF);
788 <  if(!doPF) make_special_mll_plot((int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]");
789 <
790 <  make_kin_plot("pfJetGoodPt[0]/pfJetGoodPt[1]","",45,1,10,dolog,"pt_{j}^{1}/pt_{j}^{2}","j1j2ratio",doPF,true);
791 <  make_kin_plot("TMath::Abs(pfJetDphiMet[0])","",32,0,3.2,nolog,"|#Delta#phi(jet1,MET)|","dphiJ1MET",doPF,true);
792 <
793 <  make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets",doPF);
794 <  make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_osof",doPF);
795 <  make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF);
796 <
797 <  make_kin_plot("numVtx","",(int)(30.5-(-0.5)),-0.5,30.5,nolog,"N(Vtx)","numVtx",doPF);
798 < //  make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF);
799 < //  make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF);
800 <  make_kin_plot("pt","",50,0,500,dolog,"Z p_{T} [GeV]","Zpt",doPF);
801 <  make_kin_plot("pt1","",50,0,200,nolog,"p_{T} [GeV]","pt1",doPF);
802 <  make_kin_plot("pt2","",50,0,200,nolog,"p_{T} [GeV]","pt2",doPF);
803 <  make_kin_plot("eta1","",40,-3,3,nolog,"#eta_{l}","eta",doPF);
804 <  make_kin_plot("jzb[1]","",100,-150,200,dolog,"JZB [GeV]","jzb_ossf",doPF);
805 <  stringstream jzbcut;
806 <  jzbcut << "((is_data&&("<<datajzb<<")>100)||(!is_data&&("<<mcjzb<<")>100))";
807 <  make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true);
808 <  make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_osof_aboveJZB100",doPF,true);
809 <  make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_ee_aboveJZB100",doPF,true);
810 <  make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_mm_aboveJZB100",doPF,true);
811 <  stringstream jzbcut2;
812 <  jzbcut2 << "((is_data&&("<<datajzb<<")>150)||(!is_data&&("<<mcjzb<<")>150))";
813 <  make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB150",doPF,true);
814 <  make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_osof_aboveJZB150",doPF,true);
815 <  make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_ee_aboveJZB150",doPF,true);
816 <  make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_mm_aboveJZB150",doPF,true);
817 <  stringstream jzbcut3;
818 <  jzbcut3 << "((is_data&&("<<datajzb<<")>50)||(!is_data&&("<<mcjzb<<")>50))";
819 <  make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB50",doPF,true);  
820 <  make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_osof_aboveJZB50",doPF,true,true);
821 <  make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_ee_aboveJZB50",doPF,true);  
822 <  make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_mm_aboveJZB50",doPF,true);  
823 <
824 <  make_kin_plot("mll","met[4]>100",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV] (MET>100GeV)","mll_met100",doPF,true);
825 <
826 <  make_special_obs_pred_mll_plot(datajzb,mcjzb,0);
827 <  make_special_obs_pred_mll_plot(datajzb,mcjzb,50);
828 <  make_special_obs_pred_mll_plot(datajzb,mcjzb,80);
829 <  make_special_obs_pred_mll_plot(datajzb,mcjzb,100);
754 >  if ( doOFSF ) {
755 >    make_OFSF_plots("mll", "met[4]>100", 60, 20., 320., false, "m_{ll}", "mll");
756 >
757 >    make_OFSF_plots("pfJetGoodNum40",     "met[4]>100", 7, 3, 10, true, "#(jets)", "njets");
758 >    make_OFSF_plots("pfJetGoodNum40",     "met[4]>100&&pfJetGoodNumBtag30==0", 7, 3, 10, true, "#(jets)", "njets_btagVeto");
759 >    make_OFSF_plots("pfJetGoodNum40",     "met[4]>100&&pfJetGoodNumBtag30>0", 7, 3, 10, true, "#(jets)", "njets_AtLeastOneBJet30");
760 >
761 >    make_OFSF_plots("pfJetGoodNumBtag30", "met[4]>100", 5, 0, 5, true, "#(b-jets)", "nbjets");
762 >    make_OFSF_plots("iso1", "met[4]>100", 20, 0, 0.3, true, "lepton 1 isolation", "iso1");
763 >    make_OFSF_plots("iso2", "met[4]>100", 20, 0, 0.3, true, "lepton 2 isolation", "iso2");
764 >    //  make_OFSF_plots("pt1",  "met[4]>100", 30, 0., 300., true, "p_{T,1}", "pt1");
765 >    //  make_OFSF_plots("pt2",  "met[4]>100", 22, 0., 220., true, "p_{T,2}", "pt2");
766 >    make_OFSF_plots("eta1", "met[4]>100", 10, -2.5, 2.5, false, "#eta_{1}", "eta1", 0.15);
767 >    make_OFSF_plots("eta2", "met[4]>100", 10, -2.5, 2.5, false, "#eta_{2}", "eta2", 0.15);
768 >    //  make_OFSF_plots("phi1", "met[4]>100", 10, -TMath::Pi(), TMath::Pi(), false, "#phi_{1}", "phi1", 0.2);
769 >    //  make_OFSF_plots("phi2", "met[4]>100", 10, -TMath::Pi(), TMath::Pi(), false, "#phi_{2}", "phi2", 0.2);
770 >    //  make_OFSF_plots("pfJetGoodPt[0]/pfJetGoodPt[1]", "met[4]>100", 20, 1, 10, true, "pt_{j}^{1}/pt_{j}^{2}", "jpt1pt2", 0.2);
771 >    make_OFSF_plots("TMath::Abs(pfJetDphiMet[0])", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(jet1,MET)|", "dphij1met", 0.2);
772 >    make_OFSF_plots("TMath::Abs(dphi)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l1,l2)|", "dphi", 0.2);
773 >    //  make_OFSF_plots("TMath::Abs(dphiMet1)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l1,MET)|", "dphiMet1", 0.2);
774 >    //  make_OFSF_plots("TMath::Abs(dphiMet2)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l2,MET)|", "dphiMet2", 0.2);
775 >    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");
776 >    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");
777 >    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");
778 >    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");
779 >  }
780 >
781 >  if ( doDataComp && !PlottingSetup::openBox ) {
782 >    TCut mllCut("");
783 >    if ( !PlottingSetup::openBox ) mllCut = "mll>120";
784 >
785 >    TCut cutSignal = cutmass&&cutnJets&&"met[4]>100";
786 >    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut,           60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig");
787 >    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"id1==0", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_ee");
788 >    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"id1==1", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_mm");
789 >
790 >    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30==0",           60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_btagVeto");
791 >    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"id1==0&&pfJetGoodNumBtag30==0", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_ee_btagVeto");
792 >    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"id1==1&&pfJetGoodNumBtag30==0", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_mm_btagVeto");
793 >
794 >    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30>0",           60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_AtLeastOneBJet");
795 >    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"id1==0&&pfJetGoodNumBtag30>0", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_ee_AtLeastOneBJet");
796 >    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"id1==1&&pfJetGoodNumBtag30>0", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_mm_AtLeastOneBJet");
797 >
798 >    make_data_comparison_plot("mll", cutOSOF&&cutSignal, 60, 20., 320.,-1., false, "m_{ll}", "mll_OF_sig");
799 >    make_data_comparison_plot("mll", cutmass&&"met[4]>100&&met[4]<150&&pfJetGoodNum40<3", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_CR");
800 >  }
801 >
802 >
803 >  if ( doKin ) {
804 >    string mllCut("");
805 >    if ( !PlottingSetup::openBox ) mllCut = "&&mll>120";
806 >
807 >    // Plots in signal region
808 >    make_kin_plot("met[4]","",70,0,350,dolog,"MET [GeV]","met",doPF,true);
809 >    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);
810 >    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);
811 >    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);
812 >    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);
813 >    
814 >    make_kin_plot("pfJetGoodNum40","met[4]>100"+mllCut,9,-0.5,8.5,dolog,"nJets","nJets",doPF);
815 >    make_kin_plot("pfJetGoodNum40","met[4]>100",9,-0.5,8.5,dolog,"nJets","nJets_osof",doPF);
816 >
817 >    // Further inclusive invariant mass plots
818 >    make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive",doPF,true);
819 >    make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true);
820 >    make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true);
821 >    make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true);
822 >    
823 >    //make_kin_plot("mll","",(int)((350-mll_low))/5,mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF);
824 >    //if(!doPF) make_special_mll_plot((int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]");
825 >    
826 >    //make_kin_plot("pfJetGoodPt[0]/pfJetGoodPt[1]","",45,1,10,dolog,"pt_{j}^{1}/pt_{j}^{2}","j1j2ratio",doPF,true);
827 >    //make_kin_plot("TMath::Abs(pfJetDphiMet[0])","",32,0,3.2,nolog,"|#Delta#phi(jet1,MET)|","dphiJ1MET",doPF,true);
828 >    
829 >    // Number of jets
830 >    make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_inclusive",doPF);
831 >    make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_osof_inclusive",doPF);
832 >    //make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF);
833 >    
834 >    // Others
835 >    make_kin_plot("numVtx","",(int)(30.5-(-0.5)),-0.5,30.5,nolog,"N(Vtx)","numVtx",doPF);
836 >    //  make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF);
837 >    //  make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF);
838 >    make_kin_plot("pt","",50,0,500,dolog,"Z p_{T} [GeV]","Zpt",doPF);
839 >    make_kin_plot("pt1","",50,0,200,nolog,"p_{T} [GeV]","pt1",doPF);
840 >    make_kin_plot("pt2","",50,0,200,nolog,"p_{T} [GeV]","pt2",doPF);
841 >    make_kin_plot("eta1","",40,-3,3,nolog,"#eta_{l}","eta",doPF);
842 >    make_kin_plot("jzb[1]","",100,-150,200,dolog,"JZB [GeV]","jzb_ossf",doPF);
843 >    //   stringstream jzbcut;
844 >    //   jzbcut << "((is_data&&("<<datajzb<<")>100)||(!is_data&&("<<mcjzb<<")>100))";
845 >    //   make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true);
846 >    //   make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_osof_aboveJZB100",doPF,true);
847 >    //   make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_ee_aboveJZB100",doPF,true);
848 >    //   make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_mm_aboveJZB100",doPF,true);
849 >    //   stringstream jzbcut2;
850 >    //   jzbcut2 << "((is_data&&("<<datajzb<<")>150)||(!is_data&&("<<mcjzb<<")>150))";
851 >    //   make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB150",doPF,true);
852 >    //   make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_osof_aboveJZB150",doPF,true);
853 >    //   make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_ee_aboveJZB150",doPF,true);
854 >    //   make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_mm_aboveJZB150",doPF,true);
855 >    //   stringstream jzbcut3;
856 >    //   jzbcut3 << "((is_data&&("<<datajzb<<")>50)||(!is_data&&("<<mcjzb<<")>50))";
857 >    //   make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB50",doPF,true);  
858 >    //   make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_osof_aboveJZB50",doPF,true,true);
859 >    //   make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_ee_aboveJZB50",doPF,true);  
860 >    //   make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_mm_aboveJZB50",doPF,true);  
861 >    
862 >    //   make_kin_plot("mll","met[4]>100",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV] (MET>100GeV)","mll_met100_ll",doPF,true);
863 >    //make_kin_plot("mll","met[4]>150&&id1==0",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ee} [GeV] (MET>150GeV)","mll_met150_ee",doPF,true);
864 >    //make_kin_plot("mll","met[4]>150&&id1==1",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{#mu#mu} [GeV] (MET>150GeV)","mll_met150_mm",doPF,true);
865 >  }
866 >    
867 > //   make_special_obs_pred_mll_plot(datajzb,mcjzb,0);
868 > //   make_special_obs_pred_mll_plot(datajzb,mcjzb,50);
869 > //   make_special_obs_pred_mll_plot(datajzb,mcjzb,80);
870 > //   make_special_obs_pred_mll_plot(datajzb,mcjzb,100);
871   //   make_special_obs_pred_mll_plot(datajzb,mcjzb,150);
872   //   make_special_obs_pred_mll_plot(datajzb,mcjzb,200);
873   //   make_special_obs_pred_mll_plot(datajzb,mcjzb,250);
874  
875 <  make_JES_plot(cutmass&&cutOSSF&&basiccut,"_ossf");
876 <  make_JES_plot(cutmass&&cutOSOF&&basiccut,"_osof");
745 <  */
746 <  
747 <  string regioncut[4] =    {"mll>0&&","mll>20&&mll<70&&","mll>70&&mll<110&&","mll>110&&"};
748 <  string regionname[4] = {"global","lowmass","Zregion","highmass"};
749 <  bool StoreRatioPlots=false;
750 <  for(int iregion=0;iregion<4;iregion++) {
751 <    cout << regionname[iregion] << " : " << regioncut[iregion] << endl;
752 <
753 <    //Z properties
754 <    make_kin_plot("pt","met[4]>100&&id1==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutOSSF&&cutnJets),40,0,200,dolog,"p_{T}^{ee} [GeV] (MET>100GeV)","Z/ZPT_ee_met100_"+regionname[iregion],doPF,StoreRatioPlots);
755 <    make_kin_plot("pt","met[4]>100&&id1==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutOSSF&&cutnJets),40,0,200,dolog,"p_{T}^{#mu#mu} [GeV] (MET>100GeV)","Z/ZPT_mm_met100_"+regionname[iregion],doPF,StoreRatioPlots);
756 <    
757 <    make_kin_plot("phi","met[4]>100&&id1==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutOSSF&&cutnJets),32,-3.2,3.2,nolog,"#phi^{ee} (MET>100GeV)","Z/ZPhi_ee_met100_"+regionname[iregion],doPF,StoreRatioPlots);
758 <    make_kin_plot("phi","met[4]>100&&id1==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutOSSF&&cutnJets),32,-3.2,3.2,nolog,"#phi^{#mu#mu} (MET>100GeV)","Z/ZPhi_mm_met100_"+regionname[iregion],doPF,StoreRatioPlots);
759 <    
760 <    make_kin_plot("eta","met[4]>100&&id1==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutOSSF&&cutnJets),30,-3.0,3.0,nolog,"#eta^{ee} (MET>100GeV)","Z/ZEta_ee_met100_"+regionname[iregion],doPF,StoreRatioPlots);
761 <    make_kin_plot("eta","met[4]>100&&id1==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutOSSF&&cutnJets),30,-3.0,3.0,nolog,"#eta^{#mu#mu} (MET>100GeV)","Z/ZEta_mm_met100_"+regionname[iregion],doPF,StoreRatioPlots);
762 <    
763 <    // lepton properties
764 <    make_kin_plot("pt1","met[4]>100&&id1==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),40,0,200,dolog,"p_{T}^{e1} [GeV] (MET>100GeV)","Lepton/LeadingElectronPt_met100_"+regionname[iregion],doPF,StoreRatioPlots);
765 <    make_kin_plot("pt1","met[4]>100&&id1==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),40,0,200,dolog,"p_{T}^{#mu1} [GeV] (MET>100GeV)","Lepton/LeadingMuonPt_met100_"+regionname[iregion],doPF,StoreRatioPlots);
766 <    make_kin_plot("pt2","met[4]>100&&id2==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),40,0,200,dolog,"p_{T}^{e2} [GeV] (MET>100GeV)","Lepton/SubLeadingElectronPt_met100_"+regionname[iregion],doPF,StoreRatioPlots);
767 <    make_kin_plot("pt2","met[4]>100&&id2==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),40,0,200,dolog,"p_{T}^{#mu2} [GeV] (MET>100GeV)","Lepton/SubLeadingMuonPt_met100_"+regionname[iregion],doPF,StoreRatioPlots);
768 <    
769 <    make_kin_plot("phi1","met[4]>100&&id1==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),32,-3.2,3.2,nolog,"#phi^{e1} (MET>100GeV)","Lepton/LeadingElectronPhi_met100_"+regionname[iregion],doPF,StoreRatioPlots);
770 <    make_kin_plot("phi1","met[4]>100&&id1==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),32,-3.2,3.2,nolog,"#phi^{#mu1} (MET>100GeV)","Lepton/LeadingMuonPhi_met100_"+regionname[iregion],doPF,StoreRatioPlots);
771 <    make_kin_plot("phi2","met[4]>100&&id2==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),32,-3.2,3.2,nolog,"#phi^{e2} (MET>100GeV)","Lepton/SubLeadingElectronPhi_met100_"+regionname[iregion],doPF,StoreRatioPlots);
772 <    make_kin_plot("phi2","met[4]>100&&id2==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),32,-3.2,3.2,nolog,"#phi^{#mu2} (MET>100GeV)","Lepton/SubLeadingMuonPhi_met100_"+regionname[iregion],doPF,StoreRatioPlots);
773 <    
774 <    make_kin_plot("eta1","met[4]>100&&id1==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),30,-3.0,3.0,nolog,"#eta^{e1} (MET>100GeV)","Lepton/LeadingElectronEta_met100_"+regionname[iregion],doPF,StoreRatioPlots);
775 <    make_kin_plot("eta1","met[4]>100&&id1==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),30,-3.0,3.0,nolog,"#eta^{#mu1} (MET>100GeV)","Lepton/LeadingMuonEta_met100_"+regionname[iregion],doPF,StoreRatioPlots);
776 <    make_kin_plot("eta2","met[4]>100&&id2==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),30,-3.0,3.0,nolog,"#eta^{e2} (MET>100GeV)","Lepton/SubLeadingElectronEta_met100_"+regionname[iregion],doPF,StoreRatioPlots);
777 <    make_kin_plot("eta2","met[4]>100&&id2==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),30,-3.0,3.0,nolog,"#eta^{#mu2} (MET>100GeV)","Lepton/SubLeadingMuonEta_met100_"+regionname[iregion],doPF,StoreRatioPlots);
778 <    
779 <    
780 <  }
875 > //   make_JES_plot(cutmass&&cutOSSF&&basiccut,"_ossf");
876 > //   make_JES_plot(cutmass&&cutOSOF&&basiccut,"_osof");
877  
878   }
879  
# Line 794 | Line 890 | void make_comp_plot( string var, string
890  
891    flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- below: the next ~20 lines changed!
892    int nRegions=4;
893 <  if(!PlottingSetup::RestrictToMassPeak) {
893 >  if(!PlottingSetup::RestrictToMassPeak||!PlottingSetup::UseSidebandsForcJZB) {
894      nRegions=2;
895    }
896    
# Line 1068 | Line 1164 | vector<TF1*> do_extended_fit_to_plot(TH1
1164   //      the line above is not necessary anymore as we're now looking at a prediction without Z+Jets, and not multiplied with (1.0/3)
1165    TF1 *ttbarlogpar = do_logpar_fit_to_plot(Tprediction);
1166    flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
1167 <  if(PlottingSetup::RestrictToMassPeak) ttbarlogpar->SetParameter(0,1.0/3*ttbarlogpar->GetParameter(0));//correcting for the fact that we didn't multiply with (1.0/3);
1167 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) ttbarlogpar->SetParameter(0,1.0/3*ttbarlogpar->GetParameter(0));//correcting for the fact that we didn't multiply with (1.0/3);
1168  
1169  
1170    TF1 *ttbarlogparP = new TF1("ttbarlogparP",LogParabolaP,0,(prediction->GetXaxis()->GetBinLowEdge(prediction->GetNbinsX())+prediction->GetXaxis()->GetBinWidth(prediction->GetNbinsX())),8);
# Line 1209 | Line 1305 | void do_prediction_plot(string jzb, TCan
1305    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);
1306  
1307    
1308 <  if(PlottingSetup::RestrictToMassPeak) {
1308 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
1309      RcorrJZBSBem   = allsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1310      LcorrJZBSBem   = allsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1311      RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
# Line 1236 | Line 1332 | void do_prediction_plot(string jzb, TCan
1332    TH1F *BpredSys = new TH1F("Bpredsys","Bpredsys",PlottingSetup::global_ratio_binning.size()-1,&PlottingSetup::global_ratio_binning[0]);
1333    ClearHisto(BpredSys);
1334      
1335 <  if(PlottingSetup::RestrictToMassPeak) {
1335 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
1336      Bpred->Add(RcorrJZBem,1.0/3.);
1337      Bpred->Add(LcorrJZBem,-1.0/3.);
1338      Bpred->Add(RcorrJZBSBem,1.0/3.);
# Line 1291 | Line 1387 | void do_prediction_plot(string jzb, TCan
1387    flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed
1388    TH1F *Tpred = (TH1F*)RcorrJZBem->Clone("Bpred");
1389    Tpred->Add(LcorrJZBem,-1.0);
1390 <  if(PlottingSetup::RestrictToMassPeak) {
1390 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
1391      Tpred->Add(RcorrJZBSBem,1.0);
1392      Tpred->Add(LcorrJZBSBem,-1.0);
1393      Tpred->Add(RcorrJZBSBeemm,1.0);
# Line 1384 | Line 1480 | void do_prediction_plot(string jzb, TCan
1480      speciallegBpred->AddEntry(RcorrJZBeemm,"Data","pl");
1481      speciallegBpred->AddEntry(Bpred,"Total background","l");
1482      speciallegBpred->AddEntry(jzbnegative,"JZB<0 (data)","f");
1483 <    if(PlottingSetup::RestrictToMassPeak) speciallegBpred->AddEntry(sidebandsemu,"Sidebands/e#mu (data)","f");
1483 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) speciallegBpred->AddEntry(sidebandsemu,"Sidebands/e#mu (data)","f");
1484      else speciallegBpred->AddEntry(sidebandsemu,"e#mu (data)","f");
1485   //    speciallegBpred->AddEntry(lm4RcorrJZBeemmC,"LM4","l");
1486      speciallegBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l");
# Line 1477 | Line 1573 | void do_prediction_plot(string jzb, TCan
1573    
1574    flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
1575    // The part below is meaningless for the offpeak analysis (it's a comparison of the different estimates but there is but one estimate!)
1576 <  if(PlottingSetup::RestrictToMassPeak) {
1576 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
1577      TH1F *Bpredem = (TH1F*)LcorrJZBeemm->Clone("Bpredem");
1578      Bpredem->Add(RcorrJZBem);
1579      Bpredem->Add(LcorrJZBem,-1);
# Line 1556 | Line 1652 | void do_prediction_plot(string jzb, TCan
1652    delete blankback;
1653    
1654    delete BpredSys;
1655 <  if(PlottingSetup::RestrictToMassPeak) {
1655 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
1656      delete RcorrJZBSBem;
1657      delete LcorrJZBSBem;
1658      delete RcorrJZBSBeemm;
# Line 1597 | Line 1693 | void do_ratio_plot(int is_data,vector<fl
1693    TH1F *RcorrJZBSBeemm;
1694    TH1F *LcorrJZBSbeemm;
1695    
1696 <  if(PlottingSetup::RestrictToMassPeak) {
1696 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
1697      RcorrJZBSBem   = allsamples.Draw("RcorrJZBSbem",jzb.c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,do_data, luminosity,dosignal);
1698      LcorrJZBSBem   = allsamples.Draw("LcorrJZBSbem",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,do_data, luminosity,dosignal);
1699      RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSbeemm",jzb.c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,do_data, luminosity,dosignal);
# Line 1609 | Line 1705 | void do_ratio_plot(int is_data,vector<fl
1705  
1706    flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
1707    TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred");
1708 <  if(PlottingSetup::RestrictToMassPeak) {
1708 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
1709      Bpred->Add(RcorrJZBem,1.0/3);
1710      Bpred->Add(LcorrJZBem,-1.0/3);
1711      Bpred->Add(RcorrJZBSBem,1.0/3);
# Line 1916 | Line 2012 | void draw_pure_jzb_histo(TCut cut,string
2012    datahisto->Draw("same,e1");
2013    
2014    TLegend *leg;
2015 <  if (!PlottingSetup::RestrictToMassPeak) {
2015 >  if (!PlottingSetup::RestrictToMassPeak||!PlottingSetup::UseSidebandsForcJZB) {
2016      if(is_OF(cut)) leg = allsamples.allbglegend("Opposite flavor",datahisto);
2017      else leg = allsamples.allbglegend("Same flavor",datahisto);
2018    } else {
# Line 1979 | Line 2075 | void produce_stretched_jzb_plots(string
2075    draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"Dibosons/mm/jzb_OS_SFZP",dican,binning);
2076    draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"Dibosons/ee/jzb_OS_OFZP",dican,binning);
2077    draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"Dibosons/mm/jzb_OS_OFZP",dican,binning);
2078 <  if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB",dican,binning);
2079 <  if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB",dican,binning);
2078 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB",dican,binning);
2079 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB",dican,binning);
2080    
2081    draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_SFZP_coarse",dican,coarse_binning);
2082    draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_OFZP_coarse",dican,coarse_binning);
2083 <  if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB_coarse",dican,coarse_binning);
2084 <  if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB_coarse",dican,coarse_binning);
2083 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB_coarse",dican,coarse_binning);
2084 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB_coarse",dican,coarse_binning);
2085    
2086    delete dican;
2087   }
# Line 2086 | Line 2182 | void jzb_plots(string mcjzb, string data
2182      draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_OFZP",can,binning);
2183      draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_OFZP",can,binning);
2184      flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
2185 <    if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning);
2186 <    if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning);
2185 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning);
2186 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning);
2187      draw_normalized_data_vs_data_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,"ee","mm","jzb_ee_vs_mm",can,binning);
2188      draw_normalized_data_vs_data_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,"ee","mm","jzb_ee_vs_mm_coarse",can,coarse_binning);
2189      draw_normalized_data_vs_data_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,"ee","mm","jzb_ee_vs_mm_coarsest",can,coarsest_binning);
# Line 2098 | Line 2194 | void jzb_plots(string mcjzb, string data
2194    if ( !PlottingSetup::Approved ) {
2195      draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP_coarse",can,coarse_binning);
2196      flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
2197 <    if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarse",can,coarse_binning);
2198 <    if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning);
2197 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarse",can,coarse_binning);
2198 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning);
2199    }
2200    delete can;
2201   }
# Line 2151 | Line 2247 | void compute_MC_yields(string mcjzb,vect
2247    TCanvas *yica = new TCanvas("yica","yield canvas");
2248    
2249    int nRegions=4;
2250 <  if(!PlottingSetup::RestrictToMassPeak) nRegions=2;
2250 >  if(!PlottingSetup::RestrictToMassPeak||!PlottingSetup::UseSidebandsForcJZB) nRegions=2;
2251    string tsRegions[] = {"SFZP","OFZP","SFSB","OFSB"};
2252    string posneg[] = {"pos","neg"};
2253    TCut tkRegions[] = {cutOSSF&&cutnJets&&cutmass,cutOSOF&&cutnJets&&cutmass,cutOSSF&&cutnJets&&sidebandcut,cutOSOF&&cutnJets&&sidebandcut};
# Line 2599 | Line 2695 | void save_template(string mcjzb, string
2695    configfile<<"\n\n";
2696    configfile<<"luminosity="<<luminosity<<";\n";
2697    configfile<<"RestrictToMassPeak="<<RestrictToMassPeak<<";//defines the type of analysis we're running\n";
2698 +  configfile<<"UseSidebandsForcJZB="<<UseSidebandsForcJZB<<";//tells us whether to use the sidebands or not\n";
2699    
2700    configfile<<"\n\ncout << \"Configuration successfully loaded!\" << endl; \n \n } \n \n";
2701    
# Line 2671 | Line 2768 | void ttbar_sidebands_comparison(string m
2768    TH1F *TSeemm;
2769    TH1F *nTSeemm;
2770    
2771 <  if(PlottingSetup::RestrictToMassPeak) {
2771 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2772      TSem    = systsamples.Draw("TSem",       mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
2773      nTSem   = systsamples.Draw("nTSem",  "-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
2774      TSeemm  = systsamples.Draw("TSeemm",     mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
# Line 2687 | Line 2784 | void ttbar_sidebands_comparison(string m
2784    TZem->SetMarkerColor(kRed);
2785  
2786  
2787 <  if(PlottingSetup::RestrictToMassPeak) {
2787 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2788          TSem->SetLineColor(TColor::GetColor("#00A616"));
2789          TSeemm->SetLineColor(kMagenta+2);
2790          TSem->SetMarkerColor(TColor::GetColor("#00A616"));
# Line 2701 | Line 2798 | void ttbar_sidebands_comparison(string m
2798    TZeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]);
2799    histos.push_back(TZem);
2800    histos.push_back(TZeemm);
2801 <  if(PlottingSetup::RestrictToMassPeak) {
2801 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2802      TSeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]);
2803      TSem->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]);
2804      histos.push_back(TSem);
# Line 2712 | Line 2809 | void ttbar_sidebands_comparison(string m
2809    TLegend *leg = make_legend("MC t#bar{t}",0.6,0.65,false);
2810    leg->AddEntry(TZeemm,"SFZP","l");
2811    leg->AddEntry(TZem,"OFZP","l");
2812 <  if(PlottingSetup::RestrictToMassPeak) {
2812 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2813      leg->AddEntry(TSeemm,"SFSB","l");
2814      leg->AddEntry(TSem,"OFSB","l");
2815    }
# Line 2723 | Line 2820 | void ttbar_sidebands_comparison(string m
2820    TH1F *TZeemmcopy = (TH1F*)TZeemm->Clone("TZeemmcopy");
2821    TH1F *TSeemmcopy;
2822    TH1F *TSemcopy;
2823 <  if(PlottingSetup::RestrictToMassPeak) {
2823 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2824      TSeemmcopy = (TH1F*)TSeemm->Clone("TSeemmcopy");
2825      TSemcopy = (TH1F*)TSem->Clone("TSemcopy");
2826    }
2827  
2828    TZem->Divide(TZeemm);
2829    TZem->SetMarkerStyle(21);
2830 <  if(PlottingSetup::RestrictToMassPeak) {
2830 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2831      TSem->Divide(TZeemm);
2832      TSeemm->Divide(TZeemm);
2833      TSem->SetMarkerStyle(24);
# Line 2741 | Line 2838 | void ttbar_sidebands_comparison(string m
2838    TZem->GetYaxis()->SetRangeUser(0,2.5);
2839    TZem->GetYaxis()->SetTitle("ratio");
2840    TZem->Draw();
2841 <  if(PlottingSetup::RestrictToMassPeak) {
2841 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2842      TSem->Draw("same");
2843      TSeemm->Draw("same");
2844    }
# Line 2771 | Line 2868 | void ttbar_sidebands_comparison(string m
2868    
2869    TLegend *leg2 = make_legend("MC t#bar{t}",0.55,0.75,false);
2870    leg2->AddEntry(TZem,"OFZP / SFZP","ple");
2871 <  if(PlottingSetup::RestrictToMassPeak) {
2871 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2872      leg2->AddEntry(TSeemm,"SFSB / SFZP","ple");
2873      leg2->AddEntry(TSem,"OFSB / SFZP","ple");
2874    }
# Line 2797 | Line 2894 | void ttbar_sidebands_comparison(string m
2894      TH1F *rightofsb;
2895      TH1F *leftsfsb;
2896      TH1F *rightsfsb;
2897 <    if(PlottingSetup::RestrictToMassPeak) {
2897 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2898        leftofsb  = (TH1F*)nTSem->Clone("leftofsb");
2899        rightofsb = (TH1F*)TSemcopy->Clone("rightofsb");
2900        rightofsb->Add(leftofsb,-1);
# Line 2811 | Line 2908 | void ttbar_sidebands_comparison(string m
2908      rightsfzp->GetYaxis()->SetTitle("#deltaJZB / 25 GeV");
2909      rightsfzp->Draw("histo");
2910      rightofzp->Draw("histo,same");
2911 <    if(PlottingSetup::RestrictToMassPeak) {
2911 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2912        rightofsb->Draw("histo,same");
2913        rightsfsb->Draw("histo,same");
2914      }
# Line 2820 | Line 2917 | void ttbar_sidebands_comparison(string m
2917      TLegend *legA = make_legend("MC t#bar{t}",0.6,0.65,false);
2918      legA->AddEntry(rightsfzp,"SFZP","l");
2919      legA->AddEntry(rightofzp,"OFZP","l");
2920 <    if(PlottingSetup::RestrictToMassPeak) {
2920 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2921        legA->AddEntry(rightofsb,"SFSB","l");
2922        legA->AddEntry(rightsfsb,"OFSB","l");
2923      }
# Line 2834 | Line 2931 | void ttbar_sidebands_comparison(string m
2931      rightofzp->GetYaxis()->SetRangeUser(0.0,2.5);
2932      rightofzp->GetYaxis()->SetTitle("#deltaJZB ratio");
2933      rightofzp->Draw();
2934 <    if(PlottingSetup::RestrictToMassPeak) {
2934 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2935        rightofsb->Divide(rightsfzp);
2936        rightsfsb->Divide(rightsfzp);
2937        rightofsb->Draw("same");
# Line 2854 | Line 2951 | void ttbar_sidebands_comparison(string m
2951      bottom2->Draw("same");
2952  
2953      rightofzp->SetMarkerStyle(21);
2954 <    if(PlottingSetup::RestrictToMassPeak) {
2954 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2955        rightofsb->SetMarkerStyle(24);
2956        rightsfsb->SetMarkerStyle(32);
2957      }
2958  
2959      TLegend *leg3 = make_legend("MC t#bar{t}",0.55,0.75,false);
2960      leg3->AddEntry(rightofzp,"OFZP / SFZP","ple");
2961 <    if(PlottingSetup::RestrictToMassPeak) {
2961 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2962        leg3->AddEntry(rightsfsb,"SFSB / SFZP","ple");
2963        leg3->AddEntry(rightofsb,"OFSB / SFZP","ple");
2964      }
# Line 2880 | Line 2977 | void ttbar_sidebands_comparison(string m
2977    delete nTZem;
2978    delete TZeemm;
2979    delete nTZeemm;
2980 <  if(PlottingSetup::RestrictToMassPeak) {
2980 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2981          delete TSem;
2982          delete nTSem;
2983          delete TSeemm;
# Line 3043 | Line 3140 | void zjets_prediction_comparison(string
3140    TH1F *RcorrJZBSBeemm;
3141    TH1F *LcorrJZBSBeemm;
3142  
3143 <  if(PlottingSetup::RestrictToMassPeak) {
3143 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3144      RcorrJZBSBem   = systsamples.Draw("RcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY"));
3145      LcorrJZBSBem   = systsamples.Draw("LcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY"));
3146      RcorrJZBSBeemm = systsamples.Draw("RcorrJZBSBeemm",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY"));
# Line 3051 | Line 3148 | void zjets_prediction_comparison(string
3148    }
3149    
3150    TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred");
3151 <  if(PlottingSetup::RestrictToMassPeak) {
3151 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3152      Bpred->Add(RcorrJZBem,1.0/3.);
3153      Bpred->Add(LcorrJZBem,-1.0/3.);
3154      Bpred->Add(RcorrJZBSBem,1.0/3.);
# Line 3109 | Line 3206 | void zjets_prediction_comparison(string
3206    delete RcorrJZBem;
3207    delete LcorrJZBem;
3208    
3209 <  if(PlottingSetup::RestrictToMassPeak) {
3209 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3210      delete RcorrJZBSBem;
3211      delete LcorrJZBSBem;
3212      delete RcorrJZBSBeemm;
# Line 3174 | Line 3271 | void make_table(samplecollection &coll,
3271      TH1F *RcorrJZBSBeemm;
3272      TH1F *LcorrJZBSBeemm;
3273      
3274 <    if(PlottingSetup::RestrictToMassPeak) {
3274 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3275        RcorrJZBSBem   = coll.Draw("RcorrJZBSBem",jzbexpr.c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity, mysample);
3276        LcorrJZBSBem   = coll.Draw("LcorrJZBSBem",("-("+jzbexpr+")").c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity, mysample);
3277        RcorrJZBSBeemm = coll.Draw("RcorrJZBSBeemm",jzbexpr.c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity, mysample);
# Line 3182 | Line 3279 | void make_table(samplecollection &coll,
3279      }
3280      
3281      TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred");
3282 <    if(PlottingSetup::RestrictToMassPeak) {
3282 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3283        Bpred->Add(RcorrJZBem,1.0/3.);
3284        Bpred->Add(LcorrJZBem,-1.0/3.);
3285        Bpred->Add(RcorrJZBSBem,1.0/3.);
# Line 3393 | Line 3490 | void qcd_plots(string datajzb, string mc
3490    TH1F *JRcorrJZBSBeemm;
3491    TH1F *JLcorrJZBSBeemm;
3492    
3493 <  if(PlottingSetup::RestrictToMassPeak) {
3493 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3494      RcorrJZBSBem   = qcdsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
3495      LcorrJZBSBem   = qcdsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
3496      RcorrJZBSBeemm = qcdsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
# Line 3414 | Line 3511 | void qcd_plots(string datajzb, string mc
3511      
3512    TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred");
3513    TH1F *JBpred = (TH1F*)JLcorrJZBeemm->Clone("Bpred");
3514 <  if(PlottingSetup::RestrictToMassPeak) {
3514 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3515      Bpred->Add(RcorrJZBem,1.0/3.);
3516      Bpred->Add(LcorrJZBem,-1.0/3.);
3517      Bpred->Add(RcorrJZBSBem,1.0/3.);
# Line 3484 | Line 3581 | void qcd_plots(string datajzb, string mc
3581    dout << "______________________________________________" << endl;
3582    dout << "How QCD shows up in the different regions: " << endl;
3583    dout << "OSSF: " << endl;
3584 <  if(PlottingSetup::RestrictToMassPeak) {
3584 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3585      dout << "     Z window: \t" << RcorrJZBeemm->Integral() << " (JZB>0) , " << LcorrJZBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBeemm->Integral() + LcorrJZBeemm->Integral() << endl;
3586      dout << "     sideband: \t" << RcorrJZBSBeemm->Integral() << " (JZB>0) , " << LcorrJZBSBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBSBeemm->Integral() + LcorrJZBSBeemm->Integral() << endl;
3587    } else {
3588      dout << "     " << RcorrJZBeemm->Integral() << " (JZB>0) , " << LcorrJZBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBeemm->Integral() + LcorrJZBeemm->Integral() << endl;
3589    }
3590    dout << "OSOF: " << endl;
3591 <  if(PlottingSetup::RestrictToMassPeak) {
3591 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3592      dout << "     Z window: \t" << RcorrJZBem->Integral() << " (JZB>0) , " << LcorrJZBem->Integral() << " (JZB<0) --> total: " << RcorrJZBem->Integral() + LcorrJZBem->Integral() << endl;
3593      dout << "     sideband: \t" << RcorrJZBSBem->Integral() << " (JZB>0) , " << LcorrJZBSBem->Integral() << " (JZB<0) --> total: " << RcorrJZBSBem->Integral() + LcorrJZBSBem->Integral() << endl;
3594    } else {
3595      dout << "     Z window: \t" << RcorrJZBem->Integral() << " (JZB>0) , " << LcorrJZBem->Integral() << " (JZB<0) --> total: " << RcorrJZBem->Integral() + LcorrJZBem->Integral() << endl;
3596    }
3597    dout << "Therefore: " << endl;
3598 <  if(PlottingSetup::RestrictToMassPeak) {
3598 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3599      dout << "    Prediction increases by : " << LcorrJZBeemm->Integral() << " + (1.0/3)*(" << RcorrJZBSBeemm->Integral() <<"-"<< LcorrJZBSBeemm->Integral() << ") (SFSB) ";
3600      dout << " + (1.0/3)*(" << RcorrJZBem->Integral() <<"-"<< LcorrJZBem->Integral() << ") (OFZP) ";
3601      dout << " + (1.0/3)*(" << RcorrJZBSBem->Integral() <<"-"<< LcorrJZBSBem->Integral() << ") (OFSB) ";
# Line 3514 | Line 3611 | void qcd_plots(string datajzb, string mc
3611    for(int i=0;i<(int)bins.size();i++) {
3612      dout << " JZB > " << bins[i] << " : " << endl;
3613      dout << "    Observation increases by : " << RcorrJZBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) << endl;
3614 <    if(PlottingSetup::RestrictToMassPeak) {
3614 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3615          dout << "    Prediction increases by : " << LcorrJZBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) + (1.0/3)*(RcorrJZBSBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) - LcorrJZBSBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) + RcorrJZBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) - LcorrJZBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) + RcorrJZBSBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) - LcorrJZBSBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX())) << endl;
3616      } else {
3617          dout << "    Prediction increases by : " << LcorrJZBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) + RcorrJZBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) - LcorrJZBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) << endl;
# Line 3528 | Line 3625 | void qcd_plots(string datajzb, string mc
3625    if(LcorrJZBem) delete LcorrJZBem;
3626    if(RcorrJZBeemm) delete RcorrJZBeemm;
3627    if(LcorrJZBeemm) delete LcorrJZBeemm;
3628 <  if(PlottingSetup::RestrictToMassPeak&&RcorrJZBSBem) delete RcorrJZBSBem;
3629 <  if(PlottingSetup::RestrictToMassPeak&&LcorrJZBSBem) delete LcorrJZBSBem;
3630 <  if(PlottingSetup::RestrictToMassPeak&&RcorrJZBSBeemm) delete RcorrJZBSBeemm;
3631 <  if(PlottingSetup::RestrictToMassPeak&&LcorrJZBSBeemm) delete LcorrJZBSBeemm;
3628 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&RcorrJZBSBem) delete RcorrJZBSBem;
3629 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&LcorrJZBSBem) delete LcorrJZBSBem;
3630 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&RcorrJZBSBeemm) delete RcorrJZBSBeemm;
3631 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&LcorrJZBSBeemm) delete LcorrJZBSBeemm;
3632   }
3633  
3634   void check_ptsanity() {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines