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.42 by fronga, Thu Jul 26 11:18:37 2012 UTC vs.
Revision 1.60 by fronga, Fri Sep 7 10:26:46 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 +  switch_overunderflow(false);
93 +  
94 +  TCut SpecialCut("mll>=0");
95 +  if(sSpecialCut!="") SpecialCut=TCut(sSpecialCut.c_str());
96    
97    bool DoInvidualeemmPeaks=false;
98    
# Line 101 | Line 108 | void find_peaks(float &MCPeak,float &MCP
108    float mcSigma,mcSigmaError, dataSigma, dataSigmaError;
109    
110    dout << "Finding global peak : " << endl;
111 <  find_one_peak_combination(TCut(""),mcpeak,mcpeakerr, datapeak,datapeakerr,mcSigma,mcSigmaError, dataSigma,dataSigmaError,result,doPUreweighting,"");
111 >  find_one_peak_combination(SpecialCut,SwitchOffNJetsCut,mcpeak,mcpeakerr, datapeak,datapeakerr,mcSigma,mcSigmaError, dataSigma,dataSigmaError,result,doPUreweighting,"");
112    
113    if(DoInvidualeemmPeaks) {
114      dout << "Finding peak for electrons : " << endl;
115 <    find_one_peak_combination(TCut("id1==0"),mceepeak,mceepeakerr,dataeepeak,dataeepeakerr,mcSigma,mcSigmaError,dataSigma,dataSigmaError,result,doPUreweighting,"_ele");
115 >    find_one_peak_combination(SpecialCut&&TCut("id1==0"),SwitchOffNJetsCut,mceepeak,mceepeakerr,dataeepeak,dataeepeakerr,mcSigma,mcSigmaError,dataSigma,dataSigmaError,result,doPUreweighting,"_ele");
116      dout << "Finding peak for muons : " << endl;
117 <    find_one_peak_combination(TCut("id1==1"),mcmmpeak,mcmmpeakerr,datammpeak,datammpeakerr,mcSigma,mcSigmaError,dataSigma,dataSigmaError,result,doPUreweighting,"_mu");
117 >    find_one_peak_combination(SpecialCut&&TCut("id1==1"),SwitchOffNJetsCut,mcmmpeak,mcmmpeakerr,datammpeak,datammpeakerr,mcSigma,mcSigmaError,dataSigma,dataSigmaError,result,doPUreweighting,"_mu");
118      
119      datajzb << "(" << jzbvariabledata;
120      mcjzb << "(" << jzbvariablemc;
# Line 133 | Line 140 | void find_peaks(float &MCPeak,float &MCP
140      else mcjzb << "+ (id1!=id2)*" << TMath::Abs(mcpeak) << " ";
141      
142      mcjzb << ")";
143 +    
144    } else {
145      datajzb << "(" << jzbvariabledata;
146        mcjzb << "(" << jzbvariablemc;
# Line 148 | Line 156 | void find_peaks(float &MCPeak,float &MCP
156      mcjzb << ")";
157    }
158    
159 +    MCPeak=mcpeak;
160 +    MCPeakError=mcpeakerr;
161 +    DataPeak=datapeak;
162 +    DataPeakError=datapeakerr;
163 +    
164 +    switch_overunderflow(true);
165    
166   }
167  
# Line 188 | Line 202 | void make_special_obs_pred_mll_plot(stri
202    
203   //  TH1F *RcorrJZBeemmNoS;
204  
205 <  if(PlottingSetup::RestrictToMassPeak) {
205 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
206      RcorrJZBSBem   = allsamples.Draw("RcorrJZBSBem",  "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&largerzeroD,data, luminosity);
207      LcorrJZBSBem   = allsamples.Draw("LcorrJZBSBem",  "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&smallerzeroD,data, luminosity);
208      RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&largerzeroD,data, luminosity);
# Line 196 | Line 210 | void make_special_obs_pred_mll_plot(stri
210    }
211    
212    // Separate predictions
213 <  TH1F* Zpred = (TH1F*)LcorrJZBeemm->Clone("Zpred");
214 <  TH1F* OSpred = (TH1F*)RcorrJZBem->Clone("OSpred");
215 <  if(PlottingSetup::RestrictToMassPeak) {
216 <    OSpred->Scale(1.0/3.0);
217 <    OSpred->Add(RcorrJZBSBem,1.0/3.);
218 <    OSpred->Add(RcorrJZBSBeemm,1.0/3.);
219 <    Zpred->Add(LcorrJZBem,-1.0/3.);
220 <    Zpred->Add(LcorrJZBSBem,-1.0/3.);
221 <    Zpred->Add(LcorrJZBSBeemm,-1.0/3.);
222 <  } else {
223 <    Zpred->Add(LcorrJZBem,-1.0);
224 <  }
225 <
226 <  TH1F* Bpred = (TH1F*)Zpred->Clone("Bpred");
227 <  Bpred->Add(OSpred);
213 >  TH1F* SFN = (TH1F*)LcorrJZBeemm->Clone("SFN");
214 >  TH1F* OFP = (TH1F*)RcorrJZBem->Clone("OFP");
215 >  TH1F* OFN = (TH1F*)LcorrJZBem->Clone("OFN");
216 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
217 >    OFP->Scale(1.0/3.0);
218 >    OFP->Add(RcorrJZBSBem,1.0/3.);
219 >    OFP->Add(RcorrJZBSBeemm,1.0/3.);
220 >    OFN->Scale(1.0/3.0);
221 >    OFN->Add(LcorrJZBSBem,1.0/3.);
222 >    OFN->Add(LcorrJZBSBeemm,1.0/3.);
223 >  }
224 >
225 >  TH1F* Bpred = (TH1F*)SFN->Clone("Bpred");
226 >  Bpred->Add(OFP);
227 >  Bpred->Add(OFN,-1);
228    Bpred->SetLineColor(kRed);
229    
216  // Problem with negative bins: add contents to OSpred
217  for ( unsigned int i=0; i<=Zpred->GetNbinsX(); ++i ) {
218    if ( Zpred->GetBinContent(i)<0 ) {
219      OSpred->SetBinContent(i,OSpred->GetBinContent(i)+Zpred->GetBinContent(i));
220      Zpred->SetBinContent(i,0);
221    }
222  }
223
230    RcorrJZBeemm->SetTitleOffset(1.3,"y");
231    RcorrJZBeemm->Draw();
232    mcRcorrJZBeemm.Draw("same");
# Line 238 | Line 244 | void make_special_obs_pred_mll_plot(stri
244    CompleteSave(ckin,saveas.str());
245    
246    // Draw all predictions overlayed
247 <  Zpred->SetLineColor(kGreen+1);
248 <  Zpred->SetLineStyle(2);
249 <  OSpred->SetLineColor(kBlue-2);
250 <  OSpred->SetLineStyle(3);
247 >  unsigned int w = gStyle->GetHistLineWidth()+1; // Make line a bit wider, since we dash it
248 >  SFN->SetLineColor(kGreen+2);
249 >  SFN->SetLineStyle(2);
250 >  SFN->SetLineWidth(w);
251 >  OFP->SetLineColor(kBlue+2);
252 >  OFP->SetLineStyle(2);
253 >  OFP->SetLineWidth(w);
254 >  OFN->SetLineColor(kMagenta+2);
255 >  OFN->SetLineStyle(3);
256 >  OFN->SetLineWidth(w);
257    
258    RcorrJZBeemm->Draw();
259 <  OSpred->Draw("histo,same");
260 <  Zpred->Draw("histo,same");
259 >  SFN->Draw("histo,same");
260 >  OFP->Draw("histo,same");
261 >  OFN->Draw("histo,same");
262    Bpred->Draw("histo,same");
263    RcorrJZBeemm->Draw("same");
264    
265    TLegend *leg2 = make_legend("",0.52,0.7);
266    leg2->AddEntry(RcorrJZBeemm,"observed (data)","lp");
267    leg2->AddEntry(Bpred,"predicted (data)","l");
268 <  leg2->AddEntry(Zpred, "  bkgd w/Z (data)","l");
269 <  leg2->AddEntry(OSpred,"  bkgd w/o Z (data)","l");
268 >  leg2->AddEntry(SFN,  "  SF JZB<0","l");
269 >  leg2->AddEntry(OFN,  "  OF JZB<0","l");
270 >  leg2->AddEntry(OFP,  "  OF JZB>0","l");
271    leg2->Draw("same");
272    
273    saveas.str("");
274    saveas << "kin/Mll_After_Cut/Cut_At" << jzbthreshold << "_nomc";
275    CompleteSave(ckin,saveas.str());
276    
263  
264
277    delete RcorrJZBeemm;
278    delete LcorrJZBeemm;
279    delete RcorrJZBem;
280    delete LcorrJZBem;
281 <  if(PlottingSetup::RestrictToMassPeak) {
281 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
282      delete RcorrJZBSBeemm;
283      delete LcorrJZBSBeemm;
284      delete RcorrJZBSBem;
# Line 360 | Line 372 | void draw_ratio_plot(TH1* hdata, THStack
372    oneline->Draw("same");
373   }
374  
375 + float make_one_OFSF_plot(string variable, string addcut, string legendTitle, int nbins, float min, float max, float ymax, bool logscale,
376 +                        string xlabel, string filename, float legendPosition=0.55) {
377 +
378 +  TCut ibasiccut=basiccut;
379 +  bool draw_separation_lines=false;
380 +
381 +  if(addcut != "") ibasiccut = ibasiccut && addcut.c_str();
382 +
383 +  TCut cutSF;
384 +  TCut cutOF;
385 +
386 +  cutOF = cutOSOF&&cutnJets&&ibasiccut;
387 +  cutSF = cutOSSF&&cutnJets&&ibasiccut;
388 +
389 +  TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600);
390 +  TPad* rcan = new TPad("rcan","rcan",0,0,1,1);
391 +  rcan->SetLogy(logscale);
392 +  rcan->cd();
393 +
394 +  std::cout << "OF/SF comparison: variable = " << variable << ", cut = " << cutSF.GetTitle() << std::endl;
395 +  TH1F *datahistoSF = allsamples.Draw("datahistoSF",variable,nbins,min,max, xlabel, "events",cutSF,data,luminosity);
396 +  TH1F *datahistoOF = allsamples.Draw("datahistoOF",variable,nbins,min,max, xlabel, "events",cutOF,data,luminosity);
397 + //   string signal("LM3");
398 + //   TH1F* signalhisto = new TH1F("signalhisto",signal.c_str(),nbins,min,max);
399 + //   int idx = signalsamples.FindSample(signal)[0];
400 + //   (signalsamples.collection)[idx].events->Project("signalhisto",variable.c_str(),cutSF);
401 + //   signalhisto->Scale((signalsamples.collection)[idx].weight*luminosity);
402 + //   signalhisto->SetLineColor((signalsamples.collection)[idx].samplecolor);
403 + //   signalhisto->SetLineStyle(2);
404 +  datahistoSF->SetMarkerSize(DataMarkerSize);
405 +  datahistoOF->SetLineColor(kRed);
406 +
407 +  if ( !logscale ) {
408 +    datahistoSF->SetMinimum(0); // Defaults
409 +  } else {
410 +    datahistoSF->SetMinimum(0.5);
411 +  }
412 +  if (ymax<0) {
413 +    if ( logscale ) datahistoSF->SetMaximum(5.3*datahistoSF->GetMaximum());
414 +    else datahistoSF->SetMaximum(1.5*datahistoSF->GetMaximum());
415 +  } else {
416 +    datahistoSF->SetMaximum(ymax);
417 +  }
418 +
419 +  float ymaxSet = datahistoSF->GetMaximum();
420 +
421 +  datahistoSF->GetXaxis()->SetTitle(xlabel.c_str());
422 +  datahistoSF->GetYaxis()->SetTitle("Events");
423 +  datahistoSF->GetXaxis()->CenterTitle();
424 +  datahistoSF->GetYaxis()->CenterTitle();
425 +
426 +  TLegend *mleg = make_legend(legendTitle.c_str(),legendPosition,0.7,false,legendPosition+0.2);
427 +  mleg->AddEntry(datahistoSF, "Same-flavor", "PL");
428 +  if (datahistoOF->Integral()>0) {
429 +    mleg->AddEntry(datahistoOF, "Opposite-flavor", "L");
430 +  } else {
431 +    mleg->AddEntry((TObject*)0, "", "");
432 +  }
433 +  //mleg->AddEntry(signalhisto, "LM3", "L");
434 +
435 +  datahistoSF->Draw("E1");
436 +  if (datahistoOF->Integral()>0) datahistoOF->Draw("HIST,SAMES");
437 +  //signalhisto->Draw("HIST,SAMES");
438 +  mleg->Draw();
439 +  DrawPrelim();
440 +  if (datahistoOF->Integral()>0) {
441 +    save_with_ratio( datahistoSF, datahistoOF, rcan, "SFOF/" + filename, false, false, "SF/OF" );
442 +  } else {
443 +    CompleteSave(rcan, "SFOF/" + filename);
444 +    delete rcan;
445 +  }
446 +
447 +  datahistoSF->Delete();
448 +  datahistoOF->Delete();
449 +  //signalhisto->Delete();
450 +  delete mleg;
451 +  delete ckin;
452 +
453 +  return ymaxSet;
454 +
455 + }
456 +
457 + // Compare data to data
458 + float make_data_comparison_plot(string variable, TCut cut, int nbins, float min, float max, float ymax, bool logscale,
459 +                                string xlabel, string filename, float legendPosition=0.55) {
460 +
461 +  TCut ibasiccut=basiccut&&cut;
462 +
463 +  TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600);
464 +  TPad* rcan = new TPad("rcan","rcan",0,0,1,1);
465 +  rcan->SetLogy(logscale);
466 +  rcan->cd();
467 +
468 +  std::cout << "Data comparison: variable = " << variable << ", cut = " << ibasiccut.GetTitle() << std::endl;
469 +
470 +  TH1F *data1 = allsamples.Draw("data1",variable,nbins,min,max, xlabel, "events",ibasiccut,data,luminosity);
471 +  TH1F *data2 = comparesamples.Draw("data2",variable,nbins,min,max, xlabel, "events",ibasiccut,data,luminosity);
472 +
473 +  data1->SetMarkerSize(DataMarkerSize);
474 +  data2->SetLineColor(kRed);
475 +
476 +  if ( !logscale ) {
477 +    data1->SetMinimum(0); // Defaults
478 +  } else {
479 +    data1->SetMinimum(0.5);
480 +  }
481 +  if (ymax<0) {
482 +    if ( logscale ) data1->SetMaximum(5.3*data1->GetMaximum());
483 +    else data1->SetMaximum(1.5*data1->GetMaximum());
484 +  } else {
485 +    data1->SetMaximum(ymax);
486 +  }
487 +
488 +  float ymaxSet = data1->GetMaximum();
489 +
490 +  data1->GetXaxis()->SetTitle(xlabel.c_str());
491 +  data1->GetYaxis()->SetTitle("Events");
492 +  data1->GetXaxis()->CenterTitle();
493 +  data1->GetYaxis()->CenterTitle();
494 +
495 +  TLegend *mleg = make_legend("",legendPosition,0.7,false,legendPosition+0.2);
496 +  mleg->AddEntry(data1, "New 2.4/fb", "PL");
497 +  mleg->AddEntry(data2, "Old 5.1/fb", "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" );
504 +
505 +  data1->Delete();
506 +  data2->Delete();
507 +  delete mleg;
508 +  delete ckin;
509 +
510 + }
511 +
512 + void make_OFSF_plots(string variable, string addcut, int nbins, float min, float max, bool logscale,
513 +                     string xlabel, string filename, float legendPosition=0.55) {
514 +
515 +  string mllcuts[] = { "mll>15","mll>15&&mll<70", "mll>75&&mll<105", "mll>120" };
516 +  string mllcutname[] = { "m_{ll} > 15 GeV", "15 < m_{ll} < 70 GeV", "70 < m_{ll} < 110 GeV", "m_{ll} > 120 GeV" };
517 +  string plotname[] = {"_all","_low","_peak","_high"};
518 +  float ymax;
519 +
520 +  int start = 0;
521 +  if ( !PlottingSetup::openBox ) start = 3;
522 +
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,
527 +                         filename+plotname[i], legendPosition );
528 +    } else {
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,
533 +                       filename+plotname[i]+"_mm", legendPosition );
534 +    make_one_OFSF_plot(variable, "id1==0&&id1==id2&&"+mllcuts[i], mllcutname[i], nbins, min, max, ymax, logscale, xlabel,
535 +                       filename+plotname[i]+"_ee", legendPosition );
536 +  }
537 +
538 + }
539 +
540 +
541   float lastrange_min=0;
542   float lastrange_max=0;
543  
# Line 389 | Line 567 | void make_kin_plot(string variable, stri
567    //Step 2: Refine the cut
568    TCut cut;
569    cut=cutmass&&cutOSSF&&cutnJets&&ibasiccut;
570 <  if(filename=="nJets") cut=cutmass&&cutOSSF&&ibasiccut;
571 <  if(filename=="nJets_osof") cut=cutmass&&cutOSOF&&ibasiccut;
570 >  if(filename=="nJets" || filename=="nJets_inclusive") cut=cutmass&&cutOSSF&&ibasiccut;
571 >  if(filename=="nJets_osof" || filename=="nJets_osof_inclusive") cut=cutmass&&cutOSOF&&ibasiccut;
572    if(filename=="nJets_nocuts_except_mll_ossf") cut=cutmass&&cutOSSF;
573    if(filename=="mll") {
574          cut=cutOSSF&&cutnJets&&ibasiccut;
575          draw_separation_lines=true;
576    }
577    if(filename=="mll_ee") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==0";
578 +  if(filename=="mll_mm") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==1";
579    if(filename=="mll_osof") {
580          cut=cutOSOF&&cutnJets&&ibasiccut;
581          draw_separation_lines=true;
582    }
404  if(filename=="mll_mm") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==1";
583    if(Contains(filename,"aboveJZB")) cut=cutOSSF&&cutnJets&&ibasiccut;
584    if(Contains(filename,"mll_ee_above")) cut=cut&&"id1==0";
585    if(Contains(filename,"mll_mm_above")) cut=cut&&"id1==1";
586    if(Contains(filename,"mll_osof_aboveJZB")) cut=cutOSOF&&cutnJets&&ibasiccut;
587 <  if(filename=="mll_inclusive"||filename=="mll_inclusive_highrange") cut=cutOSSF;
588 <  if(filename=="mll_inclusive_osof") cut=cutOSOF;
589 <  if(filename=="mll_inclusive_ee") cut=cutOSSF&&"id1==0";
590 <  if(filename=="mll_inclusive_mm") cut=cutOSSF&&"id1==1";
587 >  if(filename=="mll_inclusive"||filename=="mll_inclusive_highrange") cut=cutmass&&cutOSSF;
588 >  if(filename=="mll_inclusive_osof") cut=cutmass&&cutOSOF;
589 >  if(filename=="mll_inclusive_ee") cut=cutmass&&cutOSSF&&"id1==0";
590 >  if(filename=="mll_inclusive_mm") cut=cutmass&&cutOSSF&&"id1==1";
591    if(filename=="pfJetGoodEta_0") cut=cutOSSF&&cutmass&&ibasiccut&&cutnJets;
592    if(filename=="pfJetGoodPt_0") cut=cutOSSF&&cutmass&&ibasiccut&&cutnJets;
593 +  if(filename=="numVtx") cut=cutmass&&ibasiccut;
594  
595    TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600);
596    ckin->SetLogy(logscale);
# Line 429 | Line 608 | void make_kin_plot(string variable, stri
608    if (logscale) datahisto->SetMaximum(5.3*datahisto->GetMaximum());
609    else datahisto->SetMaximum(1.3*datahisto->GetMaximum());
610  
611 +  cout << "******** Cut used : " << (const char*) cut << endl;
612    if(loadlastminmax) {
613          datahisto->SetMinimum(lastrange_min);
614          datahisto->SetMaximum(lastrange_max);
# Line 568 | Line 748 | void do_kinematic_plots(string mcjzb, st
748   {
749    bool dolog=true;
750    bool nolog=false;
751 +
752 +  bool doOFSF = true;
753 +  bool doKin  = false;
754 +  bool doDataComp = true;
755 +  
756 +
757    if(doPF) write_warning(__FUNCTION__,"Please use caution when trying to produce PF plots; not all versions of the JZB trees have these variables!");
758    float mll_low=50;
759    float mll_hi=160;
760    if(!PlottingSetup::RestrictToMassPeak) {
761          mll_low=20;
762 <        mll_hi=300;
762 >        mll_hi=320;
763    }
764  
765 <  make_kin_plot("met[4]","",70,0,350,dolog,"MET [GeV]","met",doPF,true);
765 >  if ( doOFSF ) {
766 >    make_OFSF_plots("mll", "met[4]>100", 60, 20., 320., false, "m_{ll}", "mll");
767  
768 <  make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll",doPF,true);
769 <  make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof",doPF,true,true);
770 <  make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_ee",doPF,true);
771 <  make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_mm",doPF,true);
772 <  make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive",doPF,true);
773 <  make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true);
774 <  make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true);
775 <  make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true);
776 <  make_kin_plot("mll","",(int)((350-mll_low))/5,mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF);
777 <  if(!doPF) make_special_mll_plot((int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]");
778 <
779 <  make_kin_plot("pfJetGoodPt[0]/pfJetGoodPt[1]","",45,1,10,dolog,"pt_{j}^{1}/pt_{j}^{2}","j1j2ratio",doPF,true);
780 <  make_kin_plot("TMath::Abs(pfJetDphiMet[0])","",32,0,3.2,nolog,"|#Delta#phi(jet1,MET)|","dphiJ1MET",doPF,true);
781 <
782 <  make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets",doPF);
783 <  make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_osof",doPF);
784 <  make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF);
785 <
786 <  make_kin_plot("numVtx","",(int)(30.5-(-0.5)),-0.5,30.5,nolog,"N(Vtx)","numVtx",doPF);
787 < //  make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF);
788 < //  make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF);
789 <  make_kin_plot("pt","",50,0,500,dolog,"Z p_{T} [GeV]","Zpt",doPF);
790 <  make_kin_plot("pt1","",50,0,200,nolog,"p_{T} [GeV]","pt1",doPF);
791 <  make_kin_plot("pt2","",50,0,200,nolog,"p_{T} [GeV]","pt2",doPF);
792 <  make_kin_plot("eta1","",40,-3,3,nolog,"#eta_{l}","eta",doPF);
793 <  make_kin_plot("jzb[1]","",100,-150,200,dolog,"JZB [GeV]","jzb_ossf",doPF);
794 <  stringstream jzbcut;
795 <  jzbcut << "((is_data&&("<<datajzb<<")>100)||(!is_data&&("<<mcjzb<<")>100))";
796 <  make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true);
797 <  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);
798 <  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);
799 <  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);
800 <  stringstream jzbcut2;
801 <  jzbcut2 << "((is_data&&("<<datajzb<<")>150)||(!is_data&&("<<mcjzb<<")>150))";
802 <  make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB150",doPF,true);
803 <  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);
804 <  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);
805 <  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);
806 <  stringstream jzbcut3;
807 <  jzbcut3 << "((is_data&&("<<datajzb<<")>50)||(!is_data&&("<<mcjzb<<")>50))";
808 <  make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB50",doPF,true);  
809 <  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);
810 <  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);  
811 <  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);  
812 <
813 <  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);
814 <
815 <  make_special_obs_pred_mll_plot(datajzb,mcjzb,0);
816 <  make_special_obs_pred_mll_plot(datajzb,mcjzb,50);
817 <  make_special_obs_pred_mll_plot(datajzb,mcjzb,80);
818 <  make_special_obs_pred_mll_plot(datajzb,mcjzb,100);
768 >    make_OFSF_plots("pfJetGoodNum40", "met[4]>100",                        7, 3, 10, true, "#(jets)", "njets");
769 >    make_OFSF_plots("pfJetGoodNum40", "met[4]>100&&pfJetGoodNumBtag30==0", 7, 3, 10, true, "#(jets)", "njets_btagVeto");
770 >    make_OFSF_plots("pfJetGoodNum40", "met[4]>100&&pfJetGoodNumBtag30>0",  7, 3, 10, true, "#(jets)", "njets_AtLeastOneBJet30");
771 >
772 >    make_OFSF_plots("pfJetGoodNumBtag30", "met[4]>100", 5, 0, 5, true, "#(b-jets)", "nbjets");
773 >    make_OFSF_plots("iso1", "met[4]>100", 20, 0, 0.3, true, "lepton 1 isolation", "iso1");
774 >    make_OFSF_plots("iso2", "met[4]>100", 20, 0, 0.3, true, "lepton 2 isolation", "iso2");
775 >    //  make_OFSF_plots("pt1",  "met[4]>100", 30, 0., 300., true, "p_{T,1}", "pt1");
776 >    //  make_OFSF_plots("pt2",  "met[4]>100", 22, 0., 220., true, "p_{T,2}", "pt2");
777 >    make_OFSF_plots("eta1", "met[4]>100", 10, -2.5, 2.5, false, "#eta_{1}", "eta1", 0.15);
778 >    make_OFSF_plots("eta2", "met[4]>100", 10, -2.5, 2.5, false, "#eta_{2}", "eta2", 0.15);
779 >    //  make_OFSF_plots("phi1", "met[4]>100", 10, -TMath::Pi(), TMath::Pi(), false, "#phi_{1}", "phi1", 0.2);
780 >    //  make_OFSF_plots("phi2", "met[4]>100", 10, -TMath::Pi(), TMath::Pi(), false, "#phi_{2}", "phi2", 0.2);
781 >    //  make_OFSF_plots("pfJetGoodPt[0]/pfJetGoodPt[1]", "met[4]>100", 20, 1, 10, true, "pt_{j}^{1}/pt_{j}^{2}", "jpt1pt2", 0.2);
782 >    make_OFSF_plots("TMath::Abs(pfJetDphiMet[0])", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(jet1,MET)|", "dphij1met", 0.2);
783 >    make_OFSF_plots("TMath::Abs(dphi)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l1,l2)|", "dphi", 0.2);
784 >    //  make_OFSF_plots("TMath::Abs(dphiMet1)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l1,MET)|", "dphiMet1", 0.2);
785 >    //  make_OFSF_plots("TMath::Abs(dphiMet2)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l2,MET)|", "dphiMet2", 0.2);
786 >    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");
787 >    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");
788 >    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");
789 >    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");
790 >  }
791 >
792 >  if ( doDataComp && !PlottingSetup::openBox ) {
793 >    TCut mllCut("");
794 >    if ( !PlottingSetup::openBox ) mllCut = "mll>120";
795 >
796 >    TCut cutSignal = cutmass&&cutnJets&&"met[4]>100";
797 >    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut,           60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig");
798 >    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"id1==0", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_ee");
799 >    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"id1==1", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_mm");
800 >
801 >    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30==0",           60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_btagVeto");
802 >    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"id1==0&&pfJetGoodNumBtag30==0", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_ee_btagVeto");
803 >    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"id1==1&&pfJetGoodNumBtag30==0", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_mm_btagVeto");
804 >
805 >    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30>0",           60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_AtLeastOneBJet");
806 >    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"id1==0&&pfJetGoodNumBtag30>0", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_ee_AtLeastOneBJet");
807 >    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"id1==1&&pfJetGoodNumBtag30>0", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_sig_mm_AtLeastOneBJet");
808 >
809 >    make_data_comparison_plot("mll", cutOSOF&&cutSignal, 60, 20., 320.,-1., false, "m_{ll}", "mll_OF_sig");
810 >    make_data_comparison_plot("mll", cutmass&&"met[4]>100&&met[4]<150&&pfJetGoodNum40==2", 60, 20., 320.,-1., false, "m_{ll}", "mll_SF_CR");
811 >
812 >    make_data_comparison_plot("pfJetGoodNum40", cutOSSF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(jets)", "njets_SF_sig");
813 >    make_data_comparison_plot("pfJetGoodNum40", cutOSOF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(jets)", "njets_OF_sig");
814 >    make_data_comparison_plot("pfJetGoodNumBtag30", cutOSSF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(b-jets)", "nbjets_SF_sig");
815 >    make_data_comparison_plot("pfJetGoodNumBtag30", cutOSOF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(b-jets)", "nbjets_OF_sig");
816 >  }
817 >
818 >
819 >  if ( doKin ) {
820 >    string mllCut("");
821 >    if ( !PlottingSetup::openBox ) mllCut = "&&mll>120";
822 >
823 >    // Plots in signal region
824 >    make_kin_plot("met[4]","",70,0,350,dolog,"MET [GeV]","met",doPF,true);
825 >    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);
826 >    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);
827 >    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);
828 >    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);
829 >    
830 >    make_kin_plot("pfJetGoodNum40","met[4]>100"+mllCut,9,-0.5,8.5,dolog,"nJets","nJets",doPF);
831 >    make_kin_plot("pfJetGoodNum40","met[4]>100",9,-0.5,8.5,dolog,"nJets","nJets_osof",doPF);
832 >
833 >    // Further inclusive invariant mass plots
834 >    make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive",doPF,true);
835 >    make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true);
836 >    make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true);
837 >    make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true);
838 >    
839 >    //make_kin_plot("mll","",(int)((350-mll_low))/5,mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF);
840 >    //if(!doPF) make_special_mll_plot((int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]");
841 >    
842 >    //make_kin_plot("pfJetGoodPt[0]/pfJetGoodPt[1]","",45,1,10,dolog,"pt_{j}^{1}/pt_{j}^{2}","j1j2ratio",doPF,true);
843 >    //make_kin_plot("TMath::Abs(pfJetDphiMet[0])","",32,0,3.2,nolog,"|#Delta#phi(jet1,MET)|","dphiJ1MET",doPF,true);
844 >    
845 >    // Number of jets
846 >    make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_inclusive",doPF);
847 >    make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_osof_inclusive",doPF);
848 >    //make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF);
849 >    
850 >    // Others
851 >    make_kin_plot("numVtx","",(int)(30.5-(-0.5)),-0.5,30.5,nolog,"N(Vtx)","numVtx",doPF);
852 >    //  make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF);
853 >    //  make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF);
854 >    make_kin_plot("pt","",50,0,500,dolog,"Z p_{T} [GeV]","Zpt",doPF);
855 >    make_kin_plot("pt1","",50,0,200,nolog,"p_{T} [GeV]","pt1",doPF);
856 >    make_kin_plot("pt2","",50,0,200,nolog,"p_{T} [GeV]","pt2",doPF);
857 >    make_kin_plot("eta1","",40,-3,3,nolog,"#eta_{l}","eta",doPF);
858 >    make_kin_plot("jzb[1]","",100,-150,200,dolog,"JZB [GeV]","jzb_ossf",doPF);
859 >    //   stringstream jzbcut;
860 >    //   jzbcut << "((is_data&&("<<datajzb<<")>100)||(!is_data&&("<<mcjzb<<")>100))";
861 >    //   make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true);
862 >    //   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);
863 >    //   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);
864 >    //   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);
865 >    //   stringstream jzbcut2;
866 >    //   jzbcut2 << "((is_data&&("<<datajzb<<")>150)||(!is_data&&("<<mcjzb<<")>150))";
867 >    //   make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB150",doPF,true);
868 >    //   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);
869 >    //   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);
870 >    //   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);
871 >    //   stringstream jzbcut3;
872 >    //   jzbcut3 << "((is_data&&("<<datajzb<<")>50)||(!is_data&&("<<mcjzb<<")>50))";
873 >    //   make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB50",doPF,true);  
874 >    //   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);
875 >    //   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);  
876 >    //   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);  
877 >    
878 >    //   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);
879 >    //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);
880 >    //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);
881 >  }
882 >    
883 > //   make_special_obs_pred_mll_plot(datajzb,mcjzb,0);
884 > //   make_special_obs_pred_mll_plot(datajzb,mcjzb,50);
885 > //   make_special_obs_pred_mll_plot(datajzb,mcjzb,80);
886 > //   make_special_obs_pred_mll_plot(datajzb,mcjzb,100);
887   //   make_special_obs_pred_mll_plot(datajzb,mcjzb,150);
888   //   make_special_obs_pred_mll_plot(datajzb,mcjzb,200);
889   //   make_special_obs_pred_mll_plot(datajzb,mcjzb,250);
890  
891 <  make_JES_plot(cutmass&&cutOSSF&&basiccut,"_ossf");
892 <  make_JES_plot(cutmass&&cutOSOF&&basiccut,"_osof");
638 <
891 > //   make_JES_plot(cutmass&&cutOSSF&&basiccut,"_ossf");
892 > //   make_JES_plot(cutmass&&cutOSOF&&basiccut,"_osof");
893  
894   }
895  
# Line 652 | Line 906 | void make_comp_plot( string var, string
906  
907    flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- below: the next ~20 lines changed!
908    int nRegions=4;
909 <  if(!PlottingSetup::RestrictToMassPeak) {
909 >  if(!PlottingSetup::RestrictToMassPeak||!PlottingSetup::UseSidebandsForcJZB) {
910      nRegions=2;
911    }
912    
# Line 926 | Line 1180 | vector<TF1*> do_extended_fit_to_plot(TH1
1180   //      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)
1181    TF1 *ttbarlogpar = do_logpar_fit_to_plot(Tprediction);
1182    flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
1183 <  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);
1183 >  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);
1184  
1185  
1186    TF1 *ttbarlogparP = new TF1("ttbarlogparP",LogParabolaP,0,(prediction->GetXaxis()->GetBinLowEdge(prediction->GetNbinsX())+prediction->GetXaxis()->GetBinWidth(prediction->GetNbinsX())),8);
# Line 1067 | Line 1321 | void do_prediction_plot(string jzb, TCan
1321    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);
1322  
1323    
1324 <  if(PlottingSetup::RestrictToMassPeak) {
1324 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
1325      RcorrJZBSBem   = allsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1326      LcorrJZBSBem   = allsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1327      RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
# Line 1094 | Line 1348 | void do_prediction_plot(string jzb, TCan
1348    TH1F *BpredSys = new TH1F("Bpredsys","Bpredsys",PlottingSetup::global_ratio_binning.size()-1,&PlottingSetup::global_ratio_binning[0]);
1349    ClearHisto(BpredSys);
1350      
1351 <  if(PlottingSetup::RestrictToMassPeak) {
1351 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
1352      Bpred->Add(RcorrJZBem,1.0/3.);
1353      Bpred->Add(LcorrJZBem,-1.0/3.);
1354      Bpred->Add(RcorrJZBSBem,1.0/3.);
# Line 1149 | Line 1403 | void do_prediction_plot(string jzb, TCan
1403    flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed
1404    TH1F *Tpred = (TH1F*)RcorrJZBem->Clone("Bpred");
1405    Tpred->Add(LcorrJZBem,-1.0);
1406 <  if(PlottingSetup::RestrictToMassPeak) {
1406 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
1407      Tpred->Add(RcorrJZBSBem,1.0);
1408      Tpred->Add(LcorrJZBSBem,-1.0);
1409      Tpred->Add(RcorrJZBSBeemm,1.0);
# Line 1242 | Line 1496 | void do_prediction_plot(string jzb, TCan
1496      speciallegBpred->AddEntry(RcorrJZBeemm,"Data","pl");
1497      speciallegBpred->AddEntry(Bpred,"Total background","l");
1498      speciallegBpred->AddEntry(jzbnegative,"JZB<0 (data)","f");
1499 <    if(PlottingSetup::RestrictToMassPeak) speciallegBpred->AddEntry(sidebandsemu,"Sidebands/e#mu (data)","f");
1499 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) speciallegBpred->AddEntry(sidebandsemu,"Sidebands/e#mu (data)","f");
1500      else speciallegBpred->AddEntry(sidebandsemu,"e#mu (data)","f");
1501   //    speciallegBpred->AddEntry(lm4RcorrJZBeemmC,"LM4","l");
1502      speciallegBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l");
# Line 1335 | Line 1589 | void do_prediction_plot(string jzb, TCan
1589    
1590    flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
1591    // The part below is meaningless for the offpeak analysis (it's a comparison of the different estimates but there is but one estimate!)
1592 <  if(PlottingSetup::RestrictToMassPeak) {
1592 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
1593      TH1F *Bpredem = (TH1F*)LcorrJZBeemm->Clone("Bpredem");
1594      Bpredem->Add(RcorrJZBem);
1595      Bpredem->Add(LcorrJZBem,-1);
# Line 1414 | Line 1668 | void do_prediction_plot(string jzb, TCan
1668    delete blankback;
1669    
1670    delete BpredSys;
1671 <  if(PlottingSetup::RestrictToMassPeak) {
1671 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
1672      delete RcorrJZBSBem;
1673      delete LcorrJZBSBem;
1674      delete RcorrJZBSBeemm;
# Line 1455 | Line 1709 | void do_ratio_plot(int is_data,vector<fl
1709    TH1F *RcorrJZBSBeemm;
1710    TH1F *LcorrJZBSbeemm;
1711    
1712 <  if(PlottingSetup::RestrictToMassPeak) {
1712 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
1713      RcorrJZBSBem   = allsamples.Draw("RcorrJZBSbem",jzb.c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,do_data, luminosity,dosignal);
1714      LcorrJZBSBem   = allsamples.Draw("LcorrJZBSbem",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,do_data, luminosity,dosignal);
1715      RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSbeemm",jzb.c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,do_data, luminosity,dosignal);
# Line 1467 | Line 1721 | void do_ratio_plot(int is_data,vector<fl
1721  
1722    flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
1723    TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred");
1724 <  if(PlottingSetup::RestrictToMassPeak) {
1724 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
1725      Bpred->Add(RcorrJZBem,1.0/3);
1726      Bpred->Add(LcorrJZBem,-1.0/3);
1727      Bpred->Add(RcorrJZBSBem,1.0/3);
# Line 1774 | Line 2028 | void draw_pure_jzb_histo(TCut cut,string
2028    datahisto->Draw("same,e1");
2029    
2030    TLegend *leg;
2031 <  if (!PlottingSetup::RestrictToMassPeak) {
2031 >  if (!PlottingSetup::RestrictToMassPeak||!PlottingSetup::UseSidebandsForcJZB) {
2032      if(is_OF(cut)) leg = allsamples.allbglegend("Opposite flavor",datahisto);
2033      else leg = allsamples.allbglegend("Same flavor",datahisto);
2034    } else {
# Line 1837 | Line 2091 | void produce_stretched_jzb_plots(string
2091    draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"Dibosons/mm/jzb_OS_SFZP",dican,binning);
2092    draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"Dibosons/ee/jzb_OS_OFZP",dican,binning);
2093    draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"Dibosons/mm/jzb_OS_OFZP",dican,binning);
2094 <  if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB",dican,binning);
2095 <  if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB",dican,binning);
2094 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB",dican,binning);
2095 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB",dican,binning);
2096    
2097    draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_SFZP_coarse",dican,coarse_binning);
2098    draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_OFZP_coarse",dican,coarse_binning);
2099 <  if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB_coarse",dican,coarse_binning);
2100 <  if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB_coarse",dican,coarse_binning);
2099 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB_coarse",dican,coarse_binning);
2100 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB_coarse",dican,coarse_binning);
2101    
2102    delete dican;
2103   }
# Line 1944 | Line 2198 | void jzb_plots(string mcjzb, string data
2198      draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_OFZP",can,binning);
2199      draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_OFZP",can,binning);
2200      flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
2201 <    if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning);
2202 <    if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning);
2201 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning);
2202 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning);
2203      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);
2204      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);
2205      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 1956 | Line 2210 | void jzb_plots(string mcjzb, string data
2210    if ( !PlottingSetup::Approved ) {
2211      draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP_coarse",can,coarse_binning);
2212      flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
2213 <    if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarse",can,coarse_binning);
2214 <    if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning);
2213 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarse",can,coarse_binning);
2214 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning);
2215    }
2216    delete can;
2217   }
# Line 2009 | Line 2263 | void compute_MC_yields(string mcjzb,vect
2263    TCanvas *yica = new TCanvas("yica","yield canvas");
2264    
2265    int nRegions=4;
2266 <  if(!PlottingSetup::RestrictToMassPeak) nRegions=2;
2266 >  if(!PlottingSetup::RestrictToMassPeak||!PlottingSetup::UseSidebandsForcJZB) nRegions=2;
2267    string tsRegions[] = {"SFZP","OFZP","SFSB","OFSB"};
2268    string posneg[] = {"pos","neg"};
2269    TCut tkRegions[] = {cutOSSF&&cutnJets&&cutmass,cutOSOF&&cutnJets&&cutmass,cutOSSF&&cutnJets&&sidebandcut,cutOSOF&&cutnJets&&sidebandcut};
# Line 2457 | Line 2711 | void save_template(string mcjzb, string
2711    configfile<<"\n\n";
2712    configfile<<"luminosity="<<luminosity<<";\n";
2713    configfile<<"RestrictToMassPeak="<<RestrictToMassPeak<<";//defines the type of analysis we're running\n";
2714 +  configfile<<"UseSidebandsForcJZB="<<UseSidebandsForcJZB<<";//tells us whether to use the sidebands or not\n";
2715    
2716    configfile<<"\n\ncout << \"Configuration successfully loaded!\" << endl; \n \n } \n \n";
2717    
# Line 2529 | Line 2784 | void ttbar_sidebands_comparison(string m
2784    TH1F *TSeemm;
2785    TH1F *nTSeemm;
2786    
2787 <  if(PlottingSetup::RestrictToMassPeak) {
2787 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2788      TSem    = systsamples.Draw("TSem",       mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
2789      nTSem   = systsamples.Draw("nTSem",  "-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
2790      TSeemm  = systsamples.Draw("TSeemm",     mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
# Line 2545 | Line 2800 | void ttbar_sidebands_comparison(string m
2800    TZem->SetMarkerColor(kRed);
2801  
2802  
2803 <  if(PlottingSetup::RestrictToMassPeak) {
2803 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2804          TSem->SetLineColor(TColor::GetColor("#00A616"));
2805          TSeemm->SetLineColor(kMagenta+2);
2806          TSem->SetMarkerColor(TColor::GetColor("#00A616"));
# Line 2559 | Line 2814 | void ttbar_sidebands_comparison(string m
2814    TZeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]);
2815    histos.push_back(TZem);
2816    histos.push_back(TZeemm);
2817 <  if(PlottingSetup::RestrictToMassPeak) {
2817 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2818      TSeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]);
2819      TSem->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]);
2820      histos.push_back(TSem);
# Line 2570 | Line 2825 | void ttbar_sidebands_comparison(string m
2825    TLegend *leg = make_legend("MC t#bar{t}",0.6,0.65,false);
2826    leg->AddEntry(TZeemm,"SFZP","l");
2827    leg->AddEntry(TZem,"OFZP","l");
2828 <  if(PlottingSetup::RestrictToMassPeak) {
2828 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2829      leg->AddEntry(TSeemm,"SFSB","l");
2830      leg->AddEntry(TSem,"OFSB","l");
2831    }
# Line 2581 | Line 2836 | void ttbar_sidebands_comparison(string m
2836    TH1F *TZeemmcopy = (TH1F*)TZeemm->Clone("TZeemmcopy");
2837    TH1F *TSeemmcopy;
2838    TH1F *TSemcopy;
2839 <  if(PlottingSetup::RestrictToMassPeak) {
2839 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2840      TSeemmcopy = (TH1F*)TSeemm->Clone("TSeemmcopy");
2841      TSemcopy = (TH1F*)TSem->Clone("TSemcopy");
2842    }
2843  
2844    TZem->Divide(TZeemm);
2845    TZem->SetMarkerStyle(21);
2846 <  if(PlottingSetup::RestrictToMassPeak) {
2846 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2847      TSem->Divide(TZeemm);
2848      TSeemm->Divide(TZeemm);
2849      TSem->SetMarkerStyle(24);
# Line 2599 | Line 2854 | void ttbar_sidebands_comparison(string m
2854    TZem->GetYaxis()->SetRangeUser(0,2.5);
2855    TZem->GetYaxis()->SetTitle("ratio");
2856    TZem->Draw();
2857 <  if(PlottingSetup::RestrictToMassPeak) {
2857 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2858      TSem->Draw("same");
2859      TSeemm->Draw("same");
2860    }
# Line 2629 | Line 2884 | void ttbar_sidebands_comparison(string m
2884    
2885    TLegend *leg2 = make_legend("MC t#bar{t}",0.55,0.75,false);
2886    leg2->AddEntry(TZem,"OFZP / SFZP","ple");
2887 <  if(PlottingSetup::RestrictToMassPeak) {
2887 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2888      leg2->AddEntry(TSeemm,"SFSB / SFZP","ple");
2889      leg2->AddEntry(TSem,"OFSB / SFZP","ple");
2890    }
# Line 2655 | Line 2910 | void ttbar_sidebands_comparison(string m
2910      TH1F *rightofsb;
2911      TH1F *leftsfsb;
2912      TH1F *rightsfsb;
2913 <    if(PlottingSetup::RestrictToMassPeak) {
2913 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2914        leftofsb  = (TH1F*)nTSem->Clone("leftofsb");
2915        rightofsb = (TH1F*)TSemcopy->Clone("rightofsb");
2916        rightofsb->Add(leftofsb,-1);
# Line 2669 | Line 2924 | void ttbar_sidebands_comparison(string m
2924      rightsfzp->GetYaxis()->SetTitle("#deltaJZB / 25 GeV");
2925      rightsfzp->Draw("histo");
2926      rightofzp->Draw("histo,same");
2927 <    if(PlottingSetup::RestrictToMassPeak) {
2927 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2928        rightofsb->Draw("histo,same");
2929        rightsfsb->Draw("histo,same");
2930      }
# Line 2678 | Line 2933 | void ttbar_sidebands_comparison(string m
2933      TLegend *legA = make_legend("MC t#bar{t}",0.6,0.65,false);
2934      legA->AddEntry(rightsfzp,"SFZP","l");
2935      legA->AddEntry(rightofzp,"OFZP","l");
2936 <    if(PlottingSetup::RestrictToMassPeak) {
2936 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2937        legA->AddEntry(rightofsb,"SFSB","l");
2938        legA->AddEntry(rightsfsb,"OFSB","l");
2939      }
# Line 2692 | Line 2947 | void ttbar_sidebands_comparison(string m
2947      rightofzp->GetYaxis()->SetRangeUser(0.0,2.5);
2948      rightofzp->GetYaxis()->SetTitle("#deltaJZB ratio");
2949      rightofzp->Draw();
2950 <    if(PlottingSetup::RestrictToMassPeak) {
2950 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2951        rightofsb->Divide(rightsfzp);
2952        rightsfsb->Divide(rightsfzp);
2953        rightofsb->Draw("same");
# Line 2712 | Line 2967 | void ttbar_sidebands_comparison(string m
2967      bottom2->Draw("same");
2968  
2969      rightofzp->SetMarkerStyle(21);
2970 <    if(PlottingSetup::RestrictToMassPeak) {
2970 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2971        rightofsb->SetMarkerStyle(24);
2972        rightsfsb->SetMarkerStyle(32);
2973      }
2974  
2975      TLegend *leg3 = make_legend("MC t#bar{t}",0.55,0.75,false);
2976      leg3->AddEntry(rightofzp,"OFZP / SFZP","ple");
2977 <    if(PlottingSetup::RestrictToMassPeak) {
2977 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2978        leg3->AddEntry(rightsfsb,"SFSB / SFZP","ple");
2979        leg3->AddEntry(rightofsb,"OFSB / SFZP","ple");
2980      }
# Line 2738 | Line 2993 | void ttbar_sidebands_comparison(string m
2993    delete nTZem;
2994    delete TZeemm;
2995    delete nTZeemm;
2996 <  if(PlottingSetup::RestrictToMassPeak) {
2996 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2997          delete TSem;
2998          delete nTSem;
2999          delete TSeemm;
# Line 2901 | Line 3156 | void zjets_prediction_comparison(string
3156    TH1F *RcorrJZBSBeemm;
3157    TH1F *LcorrJZBSBeemm;
3158  
3159 <  if(PlottingSetup::RestrictToMassPeak) {
3159 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3160      RcorrJZBSBem   = systsamples.Draw("RcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY"));
3161      LcorrJZBSBem   = systsamples.Draw("LcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY"));
3162      RcorrJZBSBeemm = systsamples.Draw("RcorrJZBSBeemm",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY"));
# Line 2909 | Line 3164 | void zjets_prediction_comparison(string
3164    }
3165    
3166    TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred");
3167 <  if(PlottingSetup::RestrictToMassPeak) {
3167 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3168      Bpred->Add(RcorrJZBem,1.0/3.);
3169      Bpred->Add(LcorrJZBem,-1.0/3.);
3170      Bpred->Add(RcorrJZBSBem,1.0/3.);
# Line 2967 | Line 3222 | void zjets_prediction_comparison(string
3222    delete RcorrJZBem;
3223    delete LcorrJZBem;
3224    
3225 <  if(PlottingSetup::RestrictToMassPeak) {
3225 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3226      delete RcorrJZBSBem;
3227      delete LcorrJZBSBem;
3228      delete RcorrJZBSBeemm;
# Line 3032 | Line 3287 | void make_table(samplecollection &coll,
3287      TH1F *RcorrJZBSBeemm;
3288      TH1F *LcorrJZBSBeemm;
3289      
3290 <    if(PlottingSetup::RestrictToMassPeak) {
3290 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3291        RcorrJZBSBem   = coll.Draw("RcorrJZBSBem",jzbexpr.c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity, mysample);
3292        LcorrJZBSBem   = coll.Draw("LcorrJZBSBem",("-("+jzbexpr+")").c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity, mysample);
3293        RcorrJZBSBeemm = coll.Draw("RcorrJZBSBeemm",jzbexpr.c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity, mysample);
# Line 3040 | Line 3295 | void make_table(samplecollection &coll,
3295      }
3296      
3297      TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred");
3298 <    if(PlottingSetup::RestrictToMassPeak) {
3298 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3299        Bpred->Add(RcorrJZBem,1.0/3.);
3300        Bpred->Add(LcorrJZBem,-1.0/3.);
3301        Bpred->Add(RcorrJZBSBem,1.0/3.);
# Line 3251 | Line 3506 | void qcd_plots(string datajzb, string mc
3506    TH1F *JRcorrJZBSBeemm;
3507    TH1F *JLcorrJZBSBeemm;
3508    
3509 <  if(PlottingSetup::RestrictToMassPeak) {
3509 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3510      RcorrJZBSBem   = qcdsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
3511      LcorrJZBSBem   = qcdsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
3512      RcorrJZBSBeemm = qcdsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
# Line 3272 | Line 3527 | void qcd_plots(string datajzb, string mc
3527      
3528    TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred");
3529    TH1F *JBpred = (TH1F*)JLcorrJZBeemm->Clone("Bpred");
3530 <  if(PlottingSetup::RestrictToMassPeak) {
3530 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3531      Bpred->Add(RcorrJZBem,1.0/3.);
3532      Bpred->Add(LcorrJZBem,-1.0/3.);
3533      Bpred->Add(RcorrJZBSBem,1.0/3.);
# Line 3342 | Line 3597 | void qcd_plots(string datajzb, string mc
3597    dout << "______________________________________________" << endl;
3598    dout << "How QCD shows up in the different regions: " << endl;
3599    dout << "OSSF: " << endl;
3600 <  if(PlottingSetup::RestrictToMassPeak) {
3600 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3601      dout << "     Z window: \t" << RcorrJZBeemm->Integral() << " (JZB>0) , " << LcorrJZBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBeemm->Integral() + LcorrJZBeemm->Integral() << endl;
3602      dout << "     sideband: \t" << RcorrJZBSBeemm->Integral() << " (JZB>0) , " << LcorrJZBSBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBSBeemm->Integral() + LcorrJZBSBeemm->Integral() << endl;
3603    } else {
3604      dout << "     " << RcorrJZBeemm->Integral() << " (JZB>0) , " << LcorrJZBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBeemm->Integral() + LcorrJZBeemm->Integral() << endl;
3605    }
3606    dout << "OSOF: " << endl;
3607 <  if(PlottingSetup::RestrictToMassPeak) {
3607 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3608      dout << "     Z window: \t" << RcorrJZBem->Integral() << " (JZB>0) , " << LcorrJZBem->Integral() << " (JZB<0) --> total: " << RcorrJZBem->Integral() + LcorrJZBem->Integral() << endl;
3609      dout << "     sideband: \t" << RcorrJZBSBem->Integral() << " (JZB>0) , " << LcorrJZBSBem->Integral() << " (JZB<0) --> total: " << RcorrJZBSBem->Integral() + LcorrJZBSBem->Integral() << endl;
3610    } else {
3611      dout << "     Z window: \t" << RcorrJZBem->Integral() << " (JZB>0) , " << LcorrJZBem->Integral() << " (JZB<0) --> total: " << RcorrJZBem->Integral() + LcorrJZBem->Integral() << endl;
3612    }
3613    dout << "Therefore: " << endl;
3614 <  if(PlottingSetup::RestrictToMassPeak) {
3614 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3615      dout << "    Prediction increases by : " << LcorrJZBeemm->Integral() << " + (1.0/3)*(" << RcorrJZBSBeemm->Integral() <<"-"<< LcorrJZBSBeemm->Integral() << ") (SFSB) ";
3616      dout << " + (1.0/3)*(" << RcorrJZBem->Integral() <<"-"<< LcorrJZBem->Integral() << ") (OFZP) ";
3617      dout << " + (1.0/3)*(" << RcorrJZBSBem->Integral() <<"-"<< LcorrJZBSBem->Integral() << ") (OFSB) ";
# Line 3372 | Line 3627 | void qcd_plots(string datajzb, string mc
3627    for(int i=0;i<(int)bins.size();i++) {
3628      dout << " JZB > " << bins[i] << " : " << endl;
3629      dout << "    Observation increases by : " << RcorrJZBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) << endl;
3630 <    if(PlottingSetup::RestrictToMassPeak) {
3630 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3631          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;
3632      } else {
3633          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 3386 | Line 3641 | void qcd_plots(string datajzb, string mc
3641    if(LcorrJZBem) delete LcorrJZBem;
3642    if(RcorrJZBeemm) delete RcorrJZBeemm;
3643    if(LcorrJZBeemm) delete LcorrJZBeemm;
3644 <  if(PlottingSetup::RestrictToMassPeak&&RcorrJZBSBem) delete RcorrJZBSBem;
3645 <  if(PlottingSetup::RestrictToMassPeak&&LcorrJZBSBem) delete LcorrJZBSBem;
3646 <  if(PlottingSetup::RestrictToMassPeak&&RcorrJZBSBeemm) delete RcorrJZBSBeemm;
3647 <  if(PlottingSetup::RestrictToMassPeak&&LcorrJZBSBeemm) delete LcorrJZBSBeemm;
3644 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&RcorrJZBSBem) delete RcorrJZBSBem;
3645 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&LcorrJZBSBem) delete LcorrJZBSBem;
3646 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&RcorrJZBSBeemm) delete RcorrJZBSBeemm;
3647 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&LcorrJZBSBeemm) delete LcorrJZBSBeemm;
3648   }
3649  
3650   void check_ptsanity() {
# Line 3486 | Line 3741 | void do_mlls_plot(string mcjzb) {
3741    }
3742   }
3743  
3744 < void met_vs_jzb_plots() {
3744 > void met_vs_jzb_plots(string datajzb, string mcjzb) {
3745    
3746    TCanvas *canmetjzb = new TCanvas("canmet","MET vs JZB canvas");
3747    canmetjzb->SetRightMargin(0.16);
# Line 3495 | Line 3750 | void met_vs_jzb_plots() {
3750    findme.push_back("DY");
3751    findme.push_back("TTJets");
3752    findme.push_back("LM");
3753 <  
3753 >  /*
3754    for(int ifind=0;ifind<(int)findme.size();ifind++) {
3755      vector<int> selsamples = allsamples.FindSample(findme[ifind]);
3756      TH2F *metvsjzb = new TH2F("metvsjzb","metvsjzb",200,0,100,400,-100,100);
3757      for(int isel=0;isel<(int)selsamples.size();isel++) {
3758 <      cout << "Producing MET:JZB plot ... working on sample: " << allsamples.collection[selsamples[isel]].filename << endl;
3759 <      allsamples.collection[selsamples[isel]].events->Draw("jzb[1]:met[4]>>+metvsjzb",cutmass&&cutOSSF);
3758 >      dout << "Producing MET:JZB plot ... working on sample: " << allsamples.collection[selsamples[isel]].filename << endl;
3759 >      allsamples.collection[selsamples[isel]].events->Draw("jzb[1]:met[4]>>+metvsjzb",cutmass&&cutOSSF&&cutnJets);
3760      }
3761      metvsjzb->Scale(allsamples.collection[selsamples[0]].weight);
3762      metvsjzb->SetStats(0);
# Line 3515 | Line 3770 | void met_vs_jzb_plots() {
3770      title->Draw();
3771      CompleteSave(canmetjzb,(string)"METvsJZBplots/"+findme[ifind]);
3772    }
3773 +  */
3774 +  
3775 +  dout << "About to produce MET plot for DY split up by JZB" << endl;
3776 +  
3777 +  int nbins=14;
3778 +  float low=0;
3779 +  float high=140;
3780 +  
3781 +  stringstream sLEFT;
3782 +  sLEFT << "((" << mcjzb << ")<0)";
3783 +  TCut LEFT(sLEFT.str().c_str());
3784 +  stringstream sRIGHT;
3785 +  sRIGHT << "((" << mcjzb << ")>0)";
3786 +  TCut RIGHT(sRIGHT.str().c_str());
3787 +  
3788 +  TH1F *metleft   = allsamples.Draw("metleft","met[4]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets"));
3789 +  TH1F *metleftO  = allsamples.Draw("metleftO","met[4]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets"));
3790 +  TH1F *metright  = allsamples.Draw("metright","met[4]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets"));
3791 +  TH1F *metrightO = allsamples.Draw("metrightO","met[4]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets"));
3792 +  
3793 +  
3794 +  TH1F *Bpred =  (TH1F*)metleft->Clone("Bpred");
3795 +  Bpred->Add(metleftO,-1);
3796 +  Bpred->Add(metrightO);
3797 +  TH1F *obs = (TH1F*)metright->Clone("obs");
3798 +  
3799 +  metleft->Add(metleftO,-1);
3800 +  metright->Add(metrightO,-1);
3801 +  
3802 +  metleft->SetLineColor(kRed);
3803 +  metright->SetLineColor(kBlack);
3804 +  TPad *metpad = new TPad("metpad","metpad",0,0,1,1);
3805 +  metpad->cd();
3806 +  metpad->SetLogy(1);
3807 +  metleft->Draw("histo");
3808 +  metright->Draw("same");
3809 +  TLegend *lg = make_legend();
3810 +  lg->SetX1(0.5);
3811 +  lg->SetY1(0.7);
3812 +  lg->AddEntry(metright,"JZB>0 (OSOF corrected)","P");
3813 +  lg->AddEntry(metleft,"JZB<0 (OSOF corrected)","L");
3814 +  lg->SetHeader("DY");
3815 +  
3816 +  lg->Draw();
3817 +  save_with_ratio(metright,metleft,metpad->cd(),"METvsJZBplots/ComparingLeftToRightinMETspectrum");
3818 +  
3819 +  TPad *metpad3 = new TPad("metpad3","metpad3",0,0,1,1);
3820 +  metpad3->cd();
3821 +  metpad3->SetLogy(1);
3822 +  Bpred->SetLineColor(kRed);
3823 +  Bpred->Draw("histo");
3824 +  obs->SetLineColor(kBlack);
3825 +  obs->Draw("same");
3826 +  TLegend *lg2 = make_legend();
3827 +  lg2->SetX1(0.5);
3828 +  lg2->SetY1(0.7);
3829 +  lg2->AddEntry(obs,"observed","P");
3830 +  lg2->AddEntry(Bpred,"predicted","L");
3831 +  lg2->SetHeader("DY");
3832 +
3833 +  lg2->Draw();
3834 +  
3835 +  save_with_ratio(obs,Bpred,metpad3->cd(),"METvsJZBplots/ComparingPredObsinMET");
3836 +  
3837 +  TPad *metpad2 = new TPad("metpad2","metpad2",0,0,1,1);
3838 +  metpad2->cd();
3839 +  metpad2->SetLogy(1);
3840 +  
3841 +  TH1F *metlefta   = allsamples.Draw("metlefta","met[2]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets"));
3842 +  TH1F *metleftOa  = allsamples.Draw("metleftOa","met[2]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets"));
3843 +  TH1F *metrighta  = allsamples.Draw("metrighta","met[2]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets"));
3844 +  TH1F *metrightOa = allsamples.Draw("metrightOa","met[2]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets"));
3845 +  
3846 +  metlefta->Add(metleftOa,-1);
3847 +  metrighta->Add(metrightOa,-1);
3848 +  
3849 +  metlefta->SetLineColor(kRed);
3850 +  metpad2->cd();
3851 +  metlefta->Draw("histo");
3852 +  metrighta->Draw("same");
3853 +  lg->Draw();
3854 +  save_with_ratio(metrighta,metlefta,metpad2->cd(),"METvsJZBplots/ComparingLeftToRightinMET_type1_spectrum");
3855 +  
3856 +  delete Bpred;
3857 +  delete obs;
3858 +  
3859 +  float newhigh=300;
3860 +  int newNBins=30;
3861 +  
3862 +  TPad *metpad4 = new TPad("metpad4","metpad4",0,0,1,1);
3863 +  TH1F *Ametleft   = allsamples.Draw("Ametleft","met[4]",newNBins,low,newhigh, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&LEFT,mc, luminosity);
3864 +  TH1F *AmetleftO  = allsamples.Draw("AmetleftO","met[4]",newNBins,low,newhigh, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&LEFT,mc, luminosity);
3865 +  TH1F *Ametright  = allsamples.Draw("Ametright","met[4]",newNBins,low,newhigh, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&RIGHT,mc, luminosity);
3866 +  TH1F *AmetrightO = allsamples.Draw("AmetrightO","met[4]",newNBins,low,newhigh, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&RIGHT,mc, luminosity);
3867 +  
3868 +  TH1F *aBpred = (TH1F*)Ametleft->Clone("aBpred");
3869 +  aBpred->Add(AmetleftO,-1);
3870 +  aBpred->Add(AmetrightO);
3871 +  aBpred->SetLineColor(kRed);
3872 +  
3873 +  TH1F *aobs = (TH1F*)Ametright->Clone("aobs");
3874 +  metpad4->cd();
3875 +  metpad4->SetLogy(1);
3876 +  aobs->Draw();
3877 +  aBpred->Draw("histo,same");
3878 +  aobs->Draw("same");
3879 +  lg->SetHeader("All MC");
3880 +  lg->Draw();
3881 +  save_with_ratio(aobs,aBpred,metpad4->cd(),"METvsJZBplots/ComparingPredObsinMET_ALLSAMPLES");
3882 +  
3883 +  
3884 +  delete lg;
3885 +  delete canmetjzb;
3886 +  delete metleft;
3887 +  delete metleftO;
3888 +  delete metright;
3889 +  delete metrightO;
3890   }
3891      
3892  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines