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.65 by buchmann, Thu Sep 13 09:44:16 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 <  
159 >    MCPeak=mcpeak;
160 >    MCPeakError=mcpeakerr;
161 >    DataPeak=datapeak;
162 >    DataPeakError=datapeakerr;
163 >    
164   }
165  
166   void make_special_obs_pred_mll_plot(string datajzb, string mcjzb, float jzbthreshold, float binWidth = 5.0) {
# Line 188 | Line 200 | void make_special_obs_pred_mll_plot(stri
200    
201   //  TH1F *RcorrJZBeemmNoS;
202  
203 <  if(PlottingSetup::RestrictToMassPeak) {
203 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
204      RcorrJZBSBem   = allsamples.Draw("RcorrJZBSBem",  "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&largerzeroD,data, luminosity);
205      LcorrJZBSBem   = allsamples.Draw("LcorrJZBSBem",  "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&smallerzeroD,data, luminosity);
206      RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&largerzeroD,data, luminosity);
# Line 199 | Line 211 | void make_special_obs_pred_mll_plot(stri
211    TH1F* SFN = (TH1F*)LcorrJZBeemm->Clone("SFN");
212    TH1F* OFP = (TH1F*)RcorrJZBem->Clone("OFP");
213    TH1F* OFN = (TH1F*)LcorrJZBem->Clone("OFN");
214 <  if(PlottingSetup::RestrictToMassPeak) {
214 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
215      OFP->Scale(1.0/3.0);
216      OFP->Add(RcorrJZBSBem,1.0/3.);
217      OFP->Add(RcorrJZBSBeemm,1.0/3.);
# Line 264 | Line 276 | void make_special_obs_pred_mll_plot(stri
276    delete LcorrJZBeemm;
277    delete RcorrJZBem;
278    delete LcorrJZBem;
279 <  if(PlottingSetup::RestrictToMassPeak) {
279 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
280      delete RcorrJZBSBeemm;
281      delete LcorrJZBSBeemm;
282      delete RcorrJZBSBem;
# Line 358 | Line 370 | void draw_ratio_plot(TH1* hdata, THStack
370    oneline->Draw("same");
371   }
372  
373 < void make_OFSF_plot(string variable, string addcut, string legendTitle, int nbins, float min, float max, bool logscale,
374 <                   string xlabel, string filename, bool isPF=true, bool plotratio=true, bool loadlastminmax=false, float legendPosition=0.3) {
373 > float make_one_OFSF_plot(string variable, string addcut, string legendTitle, int nbins, float min, float max, float ymax, bool logscale,
374 >                        string xlabel, string filename, float legendPosition=0.55) {
375  
376    TCut ibasiccut=basiccut;
377    bool draw_separation_lines=false;
378  
367  if(isPF) ibasiccut=basiccut&&"pfjzb[0]>-998";
368
379    if(addcut != "") ibasiccut = ibasiccut && addcut.c_str();
380  
381    TCut cutSF;
382    TCut cutOF;
383  
384 <  cutOF=cutOSOF&&cutnJets&&ibasiccut;
385 <  cutSF=cutOSSF&&cutnJets&&ibasiccut;
376 <
384 >  cutOF = cutOSOF&&cutnJets&&ibasiccut;
385 >  cutSF = cutOSSF&&cutnJets&&ibasiccut;
386  
387    TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600);
388 <  ckin->SetLogy(logscale);
388 >  TPad* rcan = new TPad("rcan","rcan",0,0,1,1);
389 >  rcan->SetLogy(logscale);
390 >  rcan->cd();
391 >
392 >  std::cout << "OF/SF comparison: variable = " << variable << ", cut = " << cutSF.GetTitle() << std::endl;
393    TH1F *datahistoSF = allsamples.Draw("datahistoSF",variable,nbins,min,max, xlabel, "events",cutSF,data,luminosity);
394    TH1F *datahistoOF = allsamples.Draw("datahistoOF",variable,nbins,min,max, xlabel, "events",cutOF,data,luminosity);
395 <  string signal("LM3");
396 <  TH1F* signalhisto = new TH1F("signalhisto",signal.c_str(),nbins,min,max);
397 <  int idx = signalsamples.FindSample(signal)[0];
398 <  (signalsamples.collection)[idx].events->Project("signalhisto",variable.c_str(),cutSF);
399 <  signalhisto->Scale((signalsamples.collection)[idx].weight*luminosity);
400 <  signalhisto->SetLineColor((signalsamples.collection)[idx].samplecolor);
395 > //   string signal("LM3");
396 > //   TH1F* signalhisto = new TH1F("signalhisto",signal.c_str(),nbins,min,max);
397 > //   int idx = signalsamples.FindSample(signal)[0];
398 > //   (signalsamples.collection)[idx].events->Project("signalhisto",variable.c_str(),cutSF);
399 > //   signalhisto->Scale((signalsamples.collection)[idx].weight*luminosity);
400 > //   signalhisto->SetLineColor((signalsamples.collection)[idx].samplecolor);
401 > //   signalhisto->SetLineStyle(2);
402    datahistoSF->SetMarkerSize(DataMarkerSize);
403    datahistoOF->SetLineColor(kRed);
404  
405    if ( !logscale ) {
406      datahistoSF->SetMinimum(0); // Defaults
393    datahistoOF->SetMinimum(0); // Defaults
407    } else {
408      datahistoSF->SetMinimum(0.5);
396    datahistoOF->SetMinimum(0.5);
409    }
410 <  if (logscale) {
411 <    datahistoSF->SetMaximum(5.3*datahistoSF->GetMaximum());
412 <    datahistoOF->SetMaximum(5.3*datahistoSF->GetMaximum());
410 >  if (ymax<0) {
411 >    if ( logscale ) datahistoSF->SetMaximum(5.3*datahistoSF->GetMaximum());
412 >    else datahistoSF->SetMaximum(1.5*datahistoSF->GetMaximum());
413    } else {
414 <    datahistoSF->SetMaximum(2.0*datahistoSF->GetMaximum());
403 <    datahistoOF->SetMaximum(2.0*datahistoOF->GetMaximum());
414 >    datahistoSF->SetMaximum(ymax);
415    }
416  
417 +  float ymaxSet = datahistoSF->GetMaximum();
418 +
419    datahistoSF->GetXaxis()->SetTitle(xlabel.c_str());
420 <  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");
420 >  datahistoSF->GetYaxis()->SetTitle("Events");
421    datahistoSF->GetXaxis()->CenterTitle();
413  datahistoOF->GetXaxis()->CenterTitle();
414  signalhisto->GetXaxis()->CenterTitle();
422    datahistoSF->GetYaxis()->CenterTitle();
416  datahistoOF->GetYaxis()->CenterTitle();
417  signalhisto->GetYaxis()->CenterTitle();
423  
424 <  TLegend *mleg = new TLegend(0.2+legendPosition, 0.72, 0.55+legendPosition, 0.87, legendTitle.c_str());
425 <  mleg->SetFillColor(kWhite);
426 <  mleg->SetTextFont(42);
427 <  mleg->SetTextSize(0.048);
428 <  mleg->SetLineWidth(0);
429 <  mleg->SetBorderSize(0);
430 <  mleg->AddEntry(datahistoSF, "S. Flavor", "PL");
431 <  mleg->AddEntry(datahistoOF, "O. Flavor", "L");
427 <  mleg->AddEntry(signalhisto, "LM3", "L");
424 >  TLegend *mleg = make_legend(legendTitle.c_str(),legendPosition,0.7,false,legendPosition+0.2);
425 >  mleg->AddEntry(datahistoSF, "Same-flavor", "PL");
426 >  if (datahistoOF->Integral()>0) {
427 >    mleg->AddEntry(datahistoOF, "Opposite-flavor", "L");
428 >  } else {
429 >    mleg->AddEntry((TObject*)0, "", "");
430 >  }
431 >  //mleg->AddEntry(signalhisto, "LM3", "L");
432  
433    datahistoSF->Draw("E1");
434 <  datahistoOF->Draw("HIST,SAMES");
435 <  signalhisto->Draw("HIST,SAMES");
434 >  if (datahistoOF->Integral()>0) datahistoOF->Draw("HIST,SAMES");
435 >  //signalhisto->Draw("HIST,SAMES");
436    mleg->Draw();
437    DrawPrelim();
438 <  CompleteSave(ckin, "./SFOF/" + filename);
438 >  if (datahistoOF->Integral()>0) {
439 >    save_with_ratio( datahistoSF, datahistoOF, rcan, "SFOF/" + filename, false, false, "SF/OF" );
440 >  } else {
441 >    CompleteSave(rcan, "SFOF/" + filename);
442 >    delete rcan;
443 >  }
444  
445    datahistoSF->Delete();
446    datahistoOF->Delete();
447 <  signalhisto->Delete();
447 >  //signalhisto->Delete();
448    delete mleg;
449    delete ckin;
450  
451 +  return ymaxSet;
452 +
453   }
454  
455 + // Compare data to data
456 + float make_data_comparison_plot(string variable, TCut cut, int nbins, float min, float max, float ymax, bool logscale,
457 +                                string xlabel, string filename, float legendPosition=0.55) {
458 +
459 +  TCut ibasiccut=basiccut&&cut;
460 +
461 +  TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600);
462 +  TPad* rcan = new TPad("rcan","rcan",0,0,1,1);
463 +  rcan->SetLogy(logscale);
464 +  rcan->cd();
465 +
466 +  std::cout << "Data comparison: variable = " << variable << ", cut = " << ibasiccut.GetTitle() << std::endl;
467 +
468 +  TH1F *data1 = allsamples.Draw("data1",variable,nbins,min,max, xlabel, "events",ibasiccut,data,luminosity);
469 +  TH1F *data2 = comparesamples.Draw("data2",variable,nbins,min,max, xlabel, "events",ibasiccut,data,luminosity);
470 +
471 +  data1->SetMarkerSize(DataMarkerSize);
472 +  data2->SetLineColor(kRed);
473 +
474 +  if ( !logscale ) {
475 +    data1->SetMinimum(0); // Defaults
476 +  } else {
477 +    data1->SetMinimum(0.5);
478 +  }
479 +  if (ymax<0) {
480 +    if ( logscale ) data1->SetMaximum(5.3*data1->GetMaximum());
481 +    else data1->SetMaximum(1.5*data1->GetMaximum());
482 +  } else {
483 +    data1->SetMaximum(ymax);
484 +  }
485 +
486 +  float ymaxSet = data1->GetMaximum();
487 +
488 +  data1->GetXaxis()->SetTitle(xlabel.c_str());
489 +  data1->GetYaxis()->SetTitle("Events");
490 +  data1->GetXaxis()->CenterTitle();
491 +  data1->GetYaxis()->CenterTitle();
492 +
493 +  TLegend *mleg = make_legend("",legendPosition,0.7,false,legendPosition+0.2);
494 +  mleg->AddEntry(data1, "New 3.8/fb", "PL");
495 +  mleg->AddEntry(data2, "Old 5.1/fb", "L");
496 +
497 +  data1->Draw("E1");
498 +  data2->Draw("HIST,SAMES");
499 +  mleg->Draw();
500 +  DrawPrelim();
501 +  save_with_ratio( data1, data2, rcan, "compareData/" + filename, false, false, "old/new" );
502 +
503 +  data1->Delete();
504 +  data2->Delete();
505 +  delete mleg;
506 +  delete ckin;
507 +
508 + }
509 +
510 + void make_OFSF_plots(string variable, string addcut, int nbins, float min, float max, bool logscale,
511 +                     string xlabel, string filename, float legendPosition=0.55) {
512 +
513 +  string mllcuts[] = { "mll>15","mll>15&&mll<70", "mll>75&&mll<105", "mll>120" };
514 +  string mllcutname[] = { "m_{ll} > 15 GeV", "15 < m_{ll} < 70 GeV", "70 < m_{ll} < 110 GeV", "m_{ll} > 120 GeV" };
515 +  string plotname[] = {"_all","_low","_peak","_high"};
516 +  float ymax;
517 +
518 +  int start = 0;
519 +  if ( !PlottingSetup::openBox ) start = 3;
520 +
521 +  for ( int i=start; i<4; ++i ) {
522 +    if ( addcut != "" ) mllcuts[i] += "&&"+addcut;
523 +    if ( i==start ) {
524 +      ymax = make_one_OFSF_plot(variable, mllcuts[i], mllcutname[i], nbins, min, max, -1, logscale, xlabel,
525 +                         filename+plotname[i], legendPosition );
526 +    } else {
527 +      make_one_OFSF_plot(variable, mllcuts[i],        mllcutname[i], nbins, min, max, ymax, logscale, xlabel,
528 +                         filename+plotname[i], legendPosition );
529 +    }
530 +    make_one_OFSF_plot(variable, "id1==1&&id1==id2&&"+mllcuts[i], mllcutname[i], nbins, min, max, ymax, logscale, xlabel,
531 +                       filename+plotname[i]+"_mm", legendPosition );
532 +    make_one_OFSF_plot(variable, "id1==0&&id1==id2&&"+mllcuts[i], mllcutname[i], nbins, min, max, ymax, logscale, xlabel,
533 +                       filename+plotname[i]+"_ee", legendPosition );
534 +  }
535 +
536 + }
537  
538  
539   float lastrange_min=0;
# Line 472 | Line 565 | void make_kin_plot(string variable, stri
565    //Step 2: Refine the cut
566    TCut cut;
567    cut=cutmass&&cutOSSF&&cutnJets&&ibasiccut;
568 <  if(filename=="nJets") cut=cutmass&&cutOSSF&&ibasiccut;
569 <  if(filename=="nJets_osof") cut=cutmass&&cutOSOF&&ibasiccut;
568 >  if(filename=="nJets" || filename=="nJets_inclusive") cut=cutmass&&cutOSSF&&ibasiccut;
569 >  if(filename=="nJets_osof" || filename=="nJets_osof_inclusive") cut=cutmass&&cutOSOF&&ibasiccut;
570    if(filename=="nJets_nocuts_except_mll_ossf") cut=cutmass&&cutOSSF;
571    if(filename=="mll") {
572          cut=cutOSSF&&cutnJets&&ibasiccut;
573          draw_separation_lines=true;
574    }
575    if(filename=="mll_ee") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==0";
576 +  if(filename=="mll_mm") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==1";
577    if(filename=="mll_osof") {
578          cut=cutOSOF&&cutnJets&&ibasiccut;
579          draw_separation_lines=true;
580    }
487  if(filename=="mll_mm") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==1";
581    if(Contains(filename,"aboveJZB")) cut=cutOSSF&&cutnJets&&ibasiccut;
582    if(Contains(filename,"mll_ee_above")) cut=cut&&"id1==0";
583    if(Contains(filename,"mll_mm_above")) cut=cut&&"id1==1";
584    if(Contains(filename,"mll_osof_aboveJZB")) cut=cutOSOF&&cutnJets&&ibasiccut;
585 <  if(filename=="mll_inclusive"||filename=="mll_inclusive_highrange") cut=cutOSSF;
586 <  if(filename=="mll_inclusive_osof") cut=cutOSOF;
587 <  if(filename=="mll_inclusive_ee") cut=cutOSSF&&"id1==0";
588 <  if(filename=="mll_inclusive_mm") cut=cutOSSF&&"id1==1";
585 >  if(filename=="mll_inclusive"||filename=="mll_inclusive_highrange") cut=cutmass&&cutOSSF;
586 >  if(filename=="mll_inclusive_osof") cut=cutmass&&cutOSOF;
587 >  if(filename=="mll_inclusive_ee") cut=cutmass&&cutOSSF&&"id1==0";
588 >  if(filename=="mll_inclusive_mm") cut=cutmass&&cutOSSF&&"id1==1";
589    if(filename=="pfJetGoodEta_0") cut=cutOSSF&&cutmass&&ibasiccut&&cutnJets;
590    if(filename=="pfJetGoodPt_0") cut=cutOSSF&&cutmass&&ibasiccut&&cutnJets;
591 +  if(filename=="numVtx") cut=cutmass&&ibasiccut;
592  
593    TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600);
594    ckin->SetLogy(logscale);
# Line 650 | Line 744 | void make_JES_plot(TCut cut, string name
744  
745   void do_kinematic_plots(string mcjzb, string datajzb, bool doPF=false)
746   {
747 +  switch_overunderflow(true);
748    bool dolog=true;
749    bool nolog=false;
750 +
751 +  bool doOFSF = true;
752 +  bool doKin  = true;
753 +  bool doDataComp = true;
754 +  
755 +
756    if(doPF) write_warning(__FUNCTION__,"Please use caution when trying to produce PF plots; not all versions of the JZB trees have these variables!");
757    float mll_low=50;
758    float mll_hi=160;
759    if(!PlottingSetup::RestrictToMassPeak) {
760          mll_low=20;
761 <        mll_hi=300;
761 >        mll_hi=320;
762    }
763  
764 <  /*
765 <  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);
766 <  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);
767 <  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);
768 <  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);
769 <  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);
770 <  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);
771 <  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);
772 <  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);
773 <  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);
774 <  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);
775 <  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);
776 <  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);
777 <  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);
778 <  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);
779 <  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);
780 <  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);
781 <  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);
782 <  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);
783 <  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);
784 <  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);
785 <
786 <
787 <  make_kin_plot("met[4]","",70,0,350,dolog,"MET [GeV]","met",doPF,true);
788 <
789 <  make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll",doPF,true);
790 <  make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof",doPF,true,true);
791 <  make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_ee",doPF,true);
792 <  make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_mm",doPF,true);
793 <  make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive",doPF,true);
794 <  make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true);
795 <  make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true);
796 <  make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true);
797 <  make_kin_plot("mll","",(int)((350-mll_low))/5,mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF);
798 <  if(!doPF) make_special_mll_plot((int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]");
799 <
800 <  make_kin_plot("pfJetGoodPt[0]/pfJetGoodPt[1]","",45,1,10,dolog,"pt_{j}^{1}/pt_{j}^{2}","j1j2ratio",doPF,true);
801 <  make_kin_plot("TMath::Abs(pfJetDphiMet[0])","",32,0,3.2,nolog,"|#Delta#phi(jet1,MET)|","dphiJ1MET",doPF,true);
802 <
803 <  make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets",doPF);
804 <  make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_osof",doPF);
805 <  make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF);
806 <
807 <  make_kin_plot("numVtx","",(int)(30.5-(-0.5)),-0.5,30.5,nolog,"N(Vtx)","numVtx",doPF);
808 < //  make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF);
809 < //  make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF);
810 <  make_kin_plot("pt","",50,0,500,dolog,"Z p_{T} [GeV]","Zpt",doPF);
811 <  make_kin_plot("pt1","",50,0,200,nolog,"p_{T} [GeV]","pt1",doPF);
812 <  make_kin_plot("pt2","",50,0,200,nolog,"p_{T} [GeV]","pt2",doPF);
813 <  make_kin_plot("eta1","",40,-3,3,nolog,"#eta_{l}","eta",doPF);
814 <  make_kin_plot("jzb[1]","",100,-150,200,dolog,"JZB [GeV]","jzb_ossf",doPF);
815 <  stringstream jzbcut;
816 <  jzbcut << "((is_data&&("<<datajzb<<")>100)||(!is_data&&("<<mcjzb<<")>100))";
817 <  make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true);
818 <  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);
819 <  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);
820 <  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);
821 <  stringstream jzbcut2;
822 <  jzbcut2 << "((is_data&&("<<datajzb<<")>150)||(!is_data&&("<<mcjzb<<")>150))";
823 <  make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB150",doPF,true);
824 <  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);
825 <  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);
826 <  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);
827 <  stringstream jzbcut3;
828 <  jzbcut3 << "((is_data&&("<<datajzb<<")>50)||(!is_data&&("<<mcjzb<<")>50))";
829 <  make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB50",doPF,true);  
830 <  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);
831 <  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);  
832 <  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);  
833 <
834 <  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);
835 <
836 <  make_special_obs_pred_mll_plot(datajzb,mcjzb,0);
837 <  make_special_obs_pred_mll_plot(datajzb,mcjzb,50);
838 <  make_special_obs_pred_mll_plot(datajzb,mcjzb,80);
839 <  make_special_obs_pred_mll_plot(datajzb,mcjzb,100);
764 >  if ( doOFSF ) {
765 >    make_OFSF_plots("mll", "met[4]>100", 60, 20., 320., false, "m_{ll}", "mll");
766 >
767 >    make_OFSF_plots("pfJetGoodNum40", "met[4]>100",                        7, 3, 10, true, "#(jets)", "njets");
768 >    make_OFSF_plots("pfJetGoodNum40", "met[4]>100&&pfJetGoodNumBtag30==0", 7, 3, 10, true, "#(jets)", "njets_btagVeto");
769 >    make_OFSF_plots("pfJetGoodNum40", "met[4]>100&&pfJetGoodNumBtag30>0",  7, 3, 10, true, "#(jets)", "njets_AtLeastOneBJet30");
770 >
771 >    make_OFSF_plots("pfJetGoodNumBtag30", "met[4]>100", 5, 0, 5, true, "#(b-jets)", "nbjets");
772 >    make_OFSF_plots("pfJetGoodPtBtag[0]", "met[4]>100&&pfJetGoodNumBtag30>0", 20, 0, 400, true, "p_{T}(leading b-jet)", "ptb1");
773 >
774 >    make_OFSF_plots("iso1", "met[4]>100", 20, 0, 0.3, true, "lepton 1 isolation", "iso1");
775 >    make_OFSF_plots("iso2", "met[4]>100", 20, 0, 0.3, true, "lepton 2 isolation", "iso2");
776 >    //  make_OFSF_plots("pt1",  "met[4]>100", 30, 0., 300., true, "p_{T,1}", "pt1");
777 >    //  make_OFSF_plots("pt2",  "met[4]>100", 22, 0., 220., true, "p_{T,2}", "pt2");
778 >    make_OFSF_plots("eta1", "met[4]>100", 10, -2.5, 2.5, false, "#eta_{1}", "eta1", 0.15);
779 >    make_OFSF_plots("eta2", "met[4]>100", 10, -2.5, 2.5, false, "#eta_{2}", "eta2", 0.15);
780 >    //  make_OFSF_plots("phi1", "met[4]>100", 10, -TMath::Pi(), TMath::Pi(), false, "#phi_{1}", "phi1", 0.2);
781 >    //  make_OFSF_plots("phi2", "met[4]>100", 10, -TMath::Pi(), TMath::Pi(), false, "#phi_{2}", "phi2", 0.2);
782 >    //  make_OFSF_plots("pfJetGoodPt[0]/pfJetGoodPt[1]", "met[4]>100", 20, 1, 10, true, "pt_{j}^{1}/pt_{j}^{2}", "jpt1pt2", 0.2);
783 >    make_OFSF_plots("TMath::Abs(pfJetDphiMet[0])", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(jet1,MET)|", "dphij1met", 0.2);
784 >    make_OFSF_plots("TMath::Abs(dphi)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l1,l2)|", "dphi", 0.2);
785 >    //  make_OFSF_plots("TMath::Abs(dphiMet1)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l1,MET)|", "dphiMet1", 0.2);
786 >    //  make_OFSF_plots("TMath::Abs(dphiMet2)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l2,MET)|", "dphiMet2", 0.2);
787 >    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");
788 >    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");
789 >    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");
790 >    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");
791 >  }
792 >
793 >  if ( doDataComp && !PlottingSetup::openBox ) {
794 >    TCut mllCut("");
795 >    float massmin = 15.;
796 >    float massmax = 315;
797 >    int massnbins = 60;
798 >    if ( !PlottingSetup::openBox ) {
799 >      mllCut = "mll>120";
800 >      massmin = 120;
801 >      massmax = 360;
802 >      massnbins = 14;
803 >    }
804 >
805 >    TCut cutSignal = cutmass&&cutnJets&&"met[4]>100";
806 >    make_data_comparison_plot("mll", cutOSSF,60, 15., 315.,-1., true, "m_{ll}", "mll_SF_inclusive");
807 >    make_data_comparison_plot("mll", cutOSOF,60, 15., 315.,-1., true, "m_{ll}", "mll_OF_inclusive");
808 >
809 >    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut,           massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig");
810 >    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30==0", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig_btagVeto");
811 >    make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30>0",  massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig_AtLeastOneBJet");
812 >
813 >    make_data_comparison_plot("mll", mllCut&&cutOSOF&&cutSignal, massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig");
814 >    make_data_comparison_plot("mll", cutmass&&cutOSSF&&"met[4]>100&&met[4]<150&&pfJetGoodNum40==2", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_CR");
815 >    make_data_comparison_plot("mll", cutmass&&cutOSOF&&"met[4]>100&&met[4]<150&&pfJetGoodNum40==2", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_CR");
816 >
817 >    make_data_comparison_plot("pfJetGoodNum40", cutOSSF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(jets)", "njets_SF_sig");
818 >    make_data_comparison_plot("pfJetGoodNum40", cutOSOF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(jets)", "njets_OF_sig");
819 >    make_data_comparison_plot("pfJetGoodNumBtag30", cutOSSF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(b-jets)", "nbjets_SF_sig");
820 >    make_data_comparison_plot("pfJetGoodNumBtag30", cutOSOF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(b-jets)", "nbjets_OF_sig");
821 >  }
822 >
823 >
824 >  if ( doKin ) {
825 >    string mllCut("");
826 >    if ( !PlottingSetup::openBox ) mllCut = "&&mll>120";
827 >
828 >    // Plots in signal region
829 >    make_kin_plot("met[4]","",70,0,350,dolog,"MET [GeV]","met",doPF,true);
830 >    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);
831 >    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);
832 >    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);
833 >    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);
834 >    
835 >    make_kin_plot("pfJetGoodNum40","met[4]>100"+mllCut,9,-0.5,8.5,dolog,"nJets","nJets",doPF);
836 >    make_kin_plot("pfJetGoodNum40","met[4]>100",9,-0.5,8.5,dolog,"nJets","nJets_osof",doPF);
837 >
838 >    // Further inclusive invariant mass plots
839 >    make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive",doPF,true);
840 >    make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true);
841 >    make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true);
842 >    make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true);
843 >    
844 >    //make_kin_plot("mll","",(int)((350-mll_low))/5,mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF);
845 >    //if(!doPF) make_special_mll_plot((int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]");
846 >    
847 >    //make_kin_plot("pfJetGoodPt[0]/pfJetGoodPt[1]","",45,1,10,dolog,"pt_{j}^{1}/pt_{j}^{2}","j1j2ratio",doPF,true);
848 >    //make_kin_plot("TMath::Abs(pfJetDphiMet[0])","",32,0,3.2,nolog,"|#Delta#phi(jet1,MET)|","dphiJ1MET",doPF,true);
849 >    
850 >    // Number of jets
851 >    make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_inclusive",doPF);
852 >    make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_osof_inclusive",doPF);
853 >    //make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF);
854 >    
855 >    // Others
856 >    make_kin_plot("numVtx","",(int)(30.5-(-0.5)),-0.5,30.5,nolog,"N(Vtx)","numVtx",doPF);
857 >    //  make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF);
858 >    //  make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF);
859 >    make_kin_plot("pt","",50,0,500,dolog,"Z p_{T} [GeV]","Zpt",doPF);
860 >    make_kin_plot("pt1","",50,0,200,nolog,"p_{T} [GeV]","pt1",doPF);
861 >    make_kin_plot("pt2","",50,0,200,nolog,"p_{T} [GeV]","pt2",doPF);
862 >    make_kin_plot("eta1","",40,-3,3,nolog,"#eta_{l}","eta",doPF);
863 >    make_kin_plot("jzb[1]","",100,-150,200,dolog,"JZB [GeV]","jzb_ossf",doPF);
864 >    //   stringstream jzbcut;
865 >    //   jzbcut << "((is_data&&("<<datajzb<<")>100)||(!is_data&&("<<mcjzb<<")>100))";
866 >    //   make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true);
867 >    //   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);
868 >    //   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);
869 >    //   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);
870 >    //   stringstream jzbcut2;
871 >    //   jzbcut2 << "((is_data&&("<<datajzb<<")>150)||(!is_data&&("<<mcjzb<<")>150))";
872 >    //   make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB150",doPF,true);
873 >    //   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);
874 >    //   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);
875 >    //   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);
876 >    //   stringstream jzbcut3;
877 >    //   jzbcut3 << "((is_data&&("<<datajzb<<")>50)||(!is_data&&("<<mcjzb<<")>50))";
878 >    //   make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB50",doPF,true);  
879 >    //   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);
880 >    //   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);  
881 >    //   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);  
882 >    
883 >    //   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);
884 >    //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);
885 >    //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);
886 >  }
887 >    
888 > //   make_special_obs_pred_mll_plot(datajzb,mcjzb,0);
889 > //   make_special_obs_pred_mll_plot(datajzb,mcjzb,50);
890 > //   make_special_obs_pred_mll_plot(datajzb,mcjzb,80);
891 > //   make_special_obs_pred_mll_plot(datajzb,mcjzb,100);
892   //   make_special_obs_pred_mll_plot(datajzb,mcjzb,150);
893   //   make_special_obs_pred_mll_plot(datajzb,mcjzb,200);
894   //   make_special_obs_pred_mll_plot(datajzb,mcjzb,250);
895  
896 <  make_JES_plot(cutmass&&cutOSSF&&basiccut,"_ossf");
897 <  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 <  }
896 > //   make_JES_plot(cutmass&&cutOSSF&&basiccut,"_ossf");
897 > //   make_JES_plot(cutmass&&cutOSOF&&basiccut,"_osof");
898  
899 +  switch_overunderflow(false);
900   }
901  
902   void make_comp_plot( string var, string xlabel, string filename, float jzbcut, string mcjzb, string datajzb,
# Line 794 | Line 912 | void make_comp_plot( string var, string
912  
913    flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- below: the next ~20 lines changed!
914    int nRegions=4;
915 <  if(!PlottingSetup::RestrictToMassPeak) {
915 >  if(!PlottingSetup::RestrictToMassPeak||!PlottingSetup::UseSidebandsForcJZB) {
916      nRegions=2;
917    }
918    
# Line 848 | Line 966 | void region_comparison_plots(string mcjz
966  
967   //  switch_overunderflow(true);  // switching overflow/underflow bins on
968      
969 <  
969 >  switch_overunderflow(true);
970      flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- the arguments changed
971    for(int ijzb=0;ijzb<(int)jzb_cuts.size();ijzb++) {
972      float jzbcut=jzb_cuts[ijzb]; // Comparison plots are done for this JZB cut
# Line 1068 | Line 1186 | vector<TF1*> do_extended_fit_to_plot(TH1
1186   //      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)
1187    TF1 *ttbarlogpar = do_logpar_fit_to_plot(Tprediction);
1188    flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
1189 <  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);
1189 >  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);
1190  
1191  
1192    TF1 *ttbarlogparP = new TF1("ttbarlogparP",LogParabolaP,0,(prediction->GetXaxis()->GetBinLowEdge(prediction->GetNbinsX())+prediction->GetXaxis()->GetBinWidth(prediction->GetNbinsX())),8);
# Line 1165 | Line 1283 | if you want to start from scratch (witho
1283  
1284   void do_prediction_plot(string jzb, TCanvas *globalcanvas, float high, int use_data, bool overlay_signal = false,string subdir="" )
1285   {
1286 < //  switch_overunderflow(true);
1286 >  
1287    bool is_data=false;
1288    bool use_signal=false;
1289    if(use_data==1) is_data=true;
1290    if(use_data==2) use_signal=true;
1291 <  int nbins=50;//100;
1292 <  if(is_data) nbins=50;
1291 >  int nbins=int(high/10);//100;
1292 >  if(is_data) nbins=int(high/10);
1293    float low=0;
1294 <  float hi=500;
1294 >  float hi=high;
1295 >  
1296 >  stringstream cutpositiveS;
1297 >  cutpositiveS << "(" << jzb << ">0)";
1298 >  TCut cutpositive(cutpositiveS.str().c_str());
1299 >  stringstream cutnegativeS;
1300 >  cutnegativeS << "(" << jzb << "<0)";
1301 >  TCut cutnegative(cutnegativeS.str().c_str());
1302 >  
1303    
1304    TH1F *blankback = new TH1F("blankback","blankback",int(high/10),0,high);
1305 <  TH1F *RcorrJZBeemm   = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1306 <  TH1F *LcorrJZBeemm   = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1307 <  TH1F *RcorrJZBem     = allsamples.Draw("RcorrJZBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1308 <  TH1F *LcorrJZBem     = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1305 >  TH1F *RcorrJZBeemm   = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1306 >  TH1F *LcorrJZBeemm   = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutnegative&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1307 >  TH1F *RcorrJZBem     = allsamples.Draw("RcorrJZBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1308 >  TH1F *LcorrJZBem     = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutnegative&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1309  
1310    blankback->GetXaxis()->SetTitle(RcorrJZBeemm->GetXaxis()->GetTitle());
1311    blankback->GetYaxis()->SetTitle(RcorrJZBeemm->GetYaxis()->GetTitle());
# Line 1194 | Line 1320 | void do_prediction_plot(string jzb, TCan
1320    
1321    TH1F *RcorrJZBeemmNoS;
1322  
1323 <    //these are for the ratio
1324 <  
1325 <  TH1F *JRcorrJZBeemm   = allsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1326 <  TH1F *JLcorrJZBeemm   = allsamples.Draw("JLcorrJZBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1327 <  TH1F *JRcorrJZBem     = allsamples.Draw("JRcorrJZBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1202 <  TH1F *JLcorrJZBem     = allsamples.Draw("JLcorrJZBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1323 >  //these are for the ratio
1324 >  TH1F *JRcorrJZBeemm   = allsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1325 >  TH1F *JLcorrJZBeemm   = allsamples.Draw("JLcorrJZBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutnegative&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1326 >  TH1F *JRcorrJZBem     = allsamples.Draw("JRcorrJZBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1327 >  TH1F *JLcorrJZBem     = allsamples.Draw("JLcorrJZBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutnegative&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1328    
1329    TH1F *JRcorrJZBSBem;
1330    TH1F *JLcorrJZBSBem;
1331    TH1F *JRcorrJZBSBeemm;
1332    TH1F *JLcorrJZBSBeemm;
1333    
1334 <  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);
1334 >  if(use_data==2 || overlay_signal) RcorrJZBeemmNoS = allsamples.Draw("RcorrJZBeemmNoS",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,false);
1335  
1336    
1337 <  if(PlottingSetup::RestrictToMassPeak) {
1338 <    RcorrJZBSBem   = allsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1339 <    LcorrJZBSBem   = allsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1340 <    RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1341 <    LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1337 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
1338 >    RcorrJZBSBem   = allsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1339 >    LcorrJZBSBem   = allsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutnegative&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1340 >    RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1341 >    LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutnegative&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1342      
1343      //these are for the ratio
1344 <    JRcorrJZBSBem   = allsamples.Draw("JRcorrJZBSBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1345 <    JLcorrJZBSBem   = allsamples.Draw("JLcorrJZBSBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1346 <    JRcorrJZBSBeemm = allsamples.Draw("JRcorrJZBSBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1347 <    JLcorrJZBSBeemm = allsamples.Draw("JLcorrJZBSBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1344 >    JRcorrJZBSBem   = allsamples.Draw("JRcorrJZBSBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutpositive&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1345 >    JLcorrJZBSBem   = allsamples.Draw("JLcorrJZBSBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutnegative&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
1346 >    JRcorrJZBSBeemm = allsamples.Draw("JRcorrJZBSBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutpositive&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1347 >    JLcorrJZBSBeemm = allsamples.Draw("JLcorrJZBSBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutnegative&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
1348    }
1349    
1350    TH1F *lm4RcorrJZBeemm;
1351 <  if(overlay_signal || use_data == 2 || use_data == 1) lm4RcorrJZBeemm = allsamples.Draw("lm4RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,allsamples.FindSample("LM"));
1351 >  if(overlay_signal || use_data == 2 || use_data == 1) lm4RcorrJZBeemm = allsamples.Draw("lm4RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,allsamples.FindSample("LM"));
1352    
1353    flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed.
1354    
# Line 1236 | Line 1361 | void do_prediction_plot(string jzb, TCan
1361    TH1F *BpredSys = new TH1F("Bpredsys","Bpredsys",PlottingSetup::global_ratio_binning.size()-1,&PlottingSetup::global_ratio_binning[0]);
1362    ClearHisto(BpredSys);
1363      
1364 <  if(PlottingSetup::RestrictToMassPeak) {
1364 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
1365      Bpred->Add(RcorrJZBem,1.0/3.);
1366      Bpred->Add(LcorrJZBem,-1.0/3.);
1367      Bpred->Add(RcorrJZBSBem,1.0/3.);
# Line 1287 | Line 1412 | void do_prediction_plot(string jzb, TCan
1412    SQRT(BpredSys);
1413    BpredSys->Divide(JBpred);
1414  
1290  
1415    flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed
1416    TH1F *Tpred = (TH1F*)RcorrJZBem->Clone("Bpred");
1417    Tpred->Add(LcorrJZBem,-1.0);
1418 <  if(PlottingSetup::RestrictToMassPeak) {
1418 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
1419      Tpred->Add(RcorrJZBSBem,1.0);
1420      Tpred->Add(LcorrJZBSBem,-1.0);
1421      Tpred->Add(RcorrJZBSBeemm,1.0);
# Line 1355 | Line 1479 | void do_prediction_plot(string jzb, TCan
1479      Bpred->SetLineWidth(2);
1480      predcomppad->cd();
1481      predcomppad->SetLogy(1);
1358    
1482      TH1F *jzbnegative = (TH1F*)LcorrJZBeemm->Clone("jzbnegative");
1483      TH1F *sidebandsemu = (TH1F*)Bpred->Clone("sidebandsemu");
1484      sidebandsemu->Add(jzbnegative,-1);
# Line 1384 | Line 1507 | void do_prediction_plot(string jzb, TCan
1507      speciallegBpred->AddEntry(RcorrJZBeemm,"Data","pl");
1508      speciallegBpred->AddEntry(Bpred,"Total background","l");
1509      speciallegBpred->AddEntry(jzbnegative,"JZB<0 (data)","f");
1510 <    if(PlottingSetup::RestrictToMassPeak) speciallegBpred->AddEntry(sidebandsemu,"Sidebands/e#mu (data)","f");
1510 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) speciallegBpred->AddEntry(sidebandsemu,"Sidebands/e#mu (data)","f");
1511      else speciallegBpred->AddEntry(sidebandsemu,"e#mu (data)","f");
1512   //    speciallegBpred->AddEntry(lm4RcorrJZBeemmC,"LM4","l");
1513      speciallegBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l");
# Line 1474 | Line 1597 | void do_prediction_plot(string jzb, TCan
1597    //save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,Bpredsaveas,true,use_data!=1,ytitle);
1598    save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,subdir+Bpredsaveas,true,false,ytitle,BpredSys);//not extending the y range anymore up to 4
1599  
1600 +
1601    
1602    flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
1603    // The part below is meaningless for the offpeak analysis (it's a comparison of the different estimates but there is but one estimate!)
1604 <  if(PlottingSetup::RestrictToMassPeak) {
1604 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
1605      TH1F *Bpredem = (TH1F*)LcorrJZBeemm->Clone("Bpredem");
1606      Bpredem->Add(RcorrJZBem);
1607      Bpredem->Add(LcorrJZBem,-1);
# Line 1556 | Line 1680 | void do_prediction_plot(string jzb, TCan
1680    delete blankback;
1681    
1682    delete BpredSys;
1683 <  if(PlottingSetup::RestrictToMassPeak) {
1683 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
1684      delete RcorrJZBSBem;
1685      delete LcorrJZBSBem;
1686      delete RcorrJZBSBeemm;
# Line 1568 | Line 1692 | void do_prediction_plot(string jzb, TCan
1692      delete JLcorrJZBSBeemm;
1693    }
1694    if(overlay_signal || use_data==2) delete lm4RcorrJZBeemm;
1571  switch_overunderflow(false);
1695   }
1696  
1697   void do_prediction_plots(string mcjzb, string datajzb, float DataSigma, float MCSigma, bool overlay_signal ) {
1698 +  switch_overunderflow(true);
1699    TCanvas *globalcanvas = new TCanvas("globalcanvas","Prediction Canvas");
1700    do_prediction_plot(datajzb,globalcanvas,jzbHigh ,data,overlay_signal);
1701    if ( !PlottingSetup::Approved ) {
# Line 1580 | Line 1704 | void do_prediction_plots(string mcjzb, s
1704    } else {
1705      write_info(__FUNCTION__,"You set approved to true, therefore not producing prediction/observation plots for MC with and without signal.");
1706    }
1707 < }
1708 <
1585 < void do_ratio_plot(int is_data,vector<float> binning, string jzb, TCanvas *can, float high=-9999) {
1586 <  bool do_data=0;
1587 <  bool dosignal=0;
1588 <  if(is_data==1) do_data=1;
1589 <  if(is_data==2) dosignal=1;
1590 <  TH1F *RcorrJZBeemm   = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,do_data, luminosity,dosignal);
1591 <  TH1F *LcorrJZBeemm   = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,do_data, luminosity,dosignal);
1592 <  TH1F *RcorrJZBem     = allsamples.Draw("RcorrJZBem",jzb.c_str(),binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,do_data, luminosity,dosignal);
1593 <  TH1F *LcorrJZBem     = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,do_data, luminosity,dosignal);
1594 <  
1595 <  TH1F *RcorrJZBSBem;
1596 <  TH1F *LcorrJZBSBem;
1597 <  TH1F *RcorrJZBSBeemm;
1598 <  TH1F *LcorrJZBSbeemm;
1599 <  
1600 <  if(PlottingSetup::RestrictToMassPeak) {
1601 <    RcorrJZBSBem   = allsamples.Draw("RcorrJZBSbem",jzb.c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,do_data, luminosity,dosignal);
1602 <    LcorrJZBSBem   = allsamples.Draw("LcorrJZBSbem",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,do_data, luminosity,dosignal);
1603 <    RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSbeemm",jzb.c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,do_data, luminosity,dosignal);
1604 <    LcorrJZBSbeemm = allsamples.Draw("LcorrJZBSbeemm",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,do_data, luminosity,dosignal);
1605 <  }
1606 <  
1607 <
1608 <
1609 <
1610 <  flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
1611 <  TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred");
1612 <  if(PlottingSetup::RestrictToMassPeak) {
1613 <    Bpred->Add(RcorrJZBem,1.0/3);
1614 <    Bpred->Add(LcorrJZBem,-1.0/3);
1615 <    Bpred->Add(RcorrJZBSBem,1.0/3);
1616 <    Bpred->Add(LcorrJZBSBem,-1.0/3);
1617 <    Bpred->Add(RcorrJZBSBeemm,1.0/3);
1618 <    Bpred->Add(LcorrJZBSbeemm,-1.0/3);
1619 <  } else {
1620 <    Bpred->Add(RcorrJZBem,1.0);
1621 <    Bpred->Add(LcorrJZBem,-1.0);
1622 <  }
1623 <
1624 <  can->cd();
1625 <  can->SetLogy(0);
1626 <  Bpred->SetLineColor(kRed);
1627 <  Bpred->SetStats(0);
1628 <  if(high>0) Bpred->GetXaxis()->SetRangeUser(0,high);
1629 <  TH1F *JZBratioforfitting=(TH1F*)RcorrJZBeemm->Clone("JZBratioforfitting");
1630 <  JZBratioforfitting->Divide(Bpred);
1631 <  TGraphAsymmErrors *JZBratio = histRatio(RcorrJZBeemm,Bpred,is_data,binning,false);
1632 <  
1633 <  
1634 <  JZBratio->SetTitle("");
1635 <  JZBratio->GetYaxis()->SetRangeUser(0.0,9.0);
1636 < //  if(is_data==1) JZBratio->GetXaxis()->SetRangeUser(0,jzbHigh );
1637 <  
1638 <  TF1 *pol0 = new TF1("pol0","[0]",0,1000);
1639 <  TF1 *pol0d = new TF1("pol0","[0]",0,1000);
1640 < //  straightline_fit->SetParameter(0,1);
1641 <  JZBratioforfitting->Fit(pol0,"Q0R","",0,30);
1642 <  pol0d->SetParameter(0,pol0->GetParameter(0));
1643 <  
1644 <  JZBratio->GetYaxis()->SetTitle("Observed/Predicted");
1645 <  JZBratio->GetXaxis()->SetTitle("JZB [GeV]");
1646 <  if ( high>0 ) JZBratio->GetXaxis()->SetRangeUser(0.0,high);
1647 <  JZBratio->GetYaxis()->SetNdivisions(519);
1648 <  JZBratio->GetYaxis()->SetRangeUser(0.0,4.0);
1649 <  JZBratio->GetYaxis()->CenterTitle();
1650 <  JZBratio->GetXaxis()->CenterTitle();
1651 <  JZBratio->SetMarkerSize(DataMarkerSize);
1652 <  JZBratio->Draw("AP");
1653 <  /////----------------------------
1654 <  TPaveText *writeresult = new TPaveText(0.15,0.78,0.49,0.91,"blNDC");
1655 <  writeresult->SetFillStyle(4000);
1656 <  writeresult->SetFillColor(kWhite);
1657 <  writeresult->SetTextFont(42);
1658 <  writeresult->SetTextSize(0.03);
1659 <  writeresult->SetTextAlign(12);
1660 <  ostringstream jzb_agreement_data_text;
1661 <  jzb_agreement_data_text<< setprecision(2) << "mean =" << pol0->GetParameter(0) << " #pm " << setprecision(1) <<  pol0->GetParError(0);
1662 <  if(is_data==1) fitresultconstdata=pol0->GetParameter(0);// data
1663 <  if(is_data==0) fitresultconstmc=pol0->GetParameter(0); // monte carlo, no signal
1664 < /*  if(is_data) writeresult->AddText("Data closure test");
1665 <  else writeresult->AddText("MC closure test");
1666 <  */
1667 <  writeresult->AddText(jzb_agreement_data_text.str().c_str());
1668 < //  writeresult->Draw("same");
1669 < //  pol0d->Draw("same");
1670 <  TF1 *topline =  new TF1("","1.5",0,1000);
1671 <  TF1 *bottomline =  new TF1("","0.5",0,1000);
1672 <  topline->SetLineColor(kBlue);
1673 <  topline->SetLineStyle(2);
1674 <  bottomline->SetLineColor(kBlue);
1675 <  bottomline->SetLineStyle(2);
1676 < //  topline->Draw("same");
1677 < //  bottomline->Draw("same");
1678 <  TF1 *oneline = new TF1("","1.0",0,1000);
1679 <  oneline->SetLineColor(kBlue);
1680 <  oneline->SetLineStyle(1);
1681 <  oneline->Draw("same");
1682 <  TLegend *phony_leg = make_legend("ratio",0.6,0.55,false);//this line is just to have the default CMS Preliminary (...) on the canvas as well.
1683 <  if(is_data==1) DrawPrelim();
1684 <  else DrawMCPrelim();
1685 <  TLegend *leg = new TLegend(0.55,0.75,0.89,0.89);
1686 <  leg->SetTextFont(42);
1687 <  leg->SetTextSize(0.04);
1688 < //   if(is_data==1) leg->SetHeader("Ratio (data)");
1689 < //   else leg->SetHeader("Ratio (MC)");
1690 <
1691 <  TString MCtitle("MC ");
1692 <  if (is_data==1) MCtitle = "";
1693 <
1694 <  leg->SetFillStyle(4000);
1695 <  leg->SetFillColor(kWhite);
1696 <  leg->SetTextFont(42);
1697 < //  leg->AddEntry(topline,"+20\% sys envelope","l");
1698 <  leg->AddEntry(JZBratio,MCtitle+"obs / "+MCtitle+"pred","p");
1699 <  leg->AddEntry(oneline,"ratio = 1","l");
1700 < //  leg->AddEntry(pol0d,"fit in [0,30] GeV","l");
1701 < //  leg->AddEntry(bottomline,"#pm50% envelope","l");
1702 <
1703 <
1704 <  //leg->Draw("same"); // no longer drawing legend
1705 <
1706 <  if(is_data==1) CompleteSave(can, "jzb_ratio_data");
1707 <  if(is_data==0) CompleteSave(can, "jzb_ratio_mc");
1708 <  if(is_data==2) CompleteSave(can, "jzb_ratio_mc_BandS");//special case, MC with signal!
1709 <  
1710 <  delete RcorrJZBeemm;
1711 <  delete LcorrJZBeemm;
1712 <  delete RcorrJZBem;
1713 <  delete LcorrJZBem;
1714 <  
1715 <  delete RcorrJZBSBem;
1716 <  delete LcorrJZBSBem;
1717 <  delete RcorrJZBSBeemm;
1718 <  delete LcorrJZBSbeemm;
1719 < }
1720 <
1721 < void do_ratio_plots(string mcjzb,string datajzb,vector<float> ratio_binning) {
1722 <  TCanvas *globalc = new TCanvas("globalc","Ratio Plot Canvas");
1723 <  globalc->SetLogy(0);
1724 <  
1725 <  do_ratio_plot(mc,ratio_binning,mcjzb,globalc, jzbHigh  );
1726 <  do_ratio_plot(data,ratio_binning,datajzb,globalc, jzbHigh  );
1727 <  do_ratio_plot(mcwithsignal,ratio_binning,mcjzb,globalc, jzbHigh  );
1707 >  delete globalcanvas;
1708 >  switch_overunderflow(false);
1709   }
1710  
1711   string give_jzb_expression(float peak, int type) {
# Line 1916 | Line 1897 | void draw_pure_jzb_histo(TCut cut,string
1897    datahisto->Draw("same,e1");
1898    
1899    TLegend *leg;
1900 <  if (!PlottingSetup::RestrictToMassPeak) {
1900 >  if (!PlottingSetup::RestrictToMassPeak||!PlottingSetup::UseSidebandsForcJZB) {
1901      if(is_OF(cut)) leg = allsamples.allbglegend("Opposite flavor",datahisto);
1902      else leg = allsamples.allbglegend("Same flavor",datahisto);
1903    } else {
# Line 1979 | Line 1960 | void produce_stretched_jzb_plots(string
1960    draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"Dibosons/mm/jzb_OS_SFZP",dican,binning);
1961    draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"Dibosons/ee/jzb_OS_OFZP",dican,binning);
1962    draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"Dibosons/mm/jzb_OS_OFZP",dican,binning);
1963 <  if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB",dican,binning);
1964 <  if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB",dican,binning);
1963 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB",dican,binning);
1964 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB",dican,binning);
1965    
1966    draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_SFZP_coarse",dican,coarse_binning);
1967    draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_OFZP_coarse",dican,coarse_binning);
1968 <  if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB_coarse",dican,coarse_binning);
1969 <  if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB_coarse",dican,coarse_binning);
1968 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB_coarse",dican,coarse_binning);
1969 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB_coarse",dican,coarse_binning);
1970    
1971    delete dican;
1972   }
1973    
1974  
1975   void diboson_plots(string mcjzb, string datajzb,vector<float> ratio_binning) {
1976 +  switch_overunderflow(true);
1977    vector<int> SamplesToBeModified = allsamples.FindSampleBySampleName("WW/WZ/ZZ");
1978    
1979    if(SamplesToBeModified.size()==0 || SamplesToBeModified[0]==-1) {
# Line 2031 | Line 2013 | void diboson_plots(string mcjzb, string
2013      dout << "     Reset xs for sample " << (allsamples.collection)[SamplesToBeModified[i]].samplename << " from " << Upxs << " to " << (allsamples.collection)[SamplesToBeModified[i]].xs << " (by a factor of " << stretchfactor << ") and reset the correct name (from " << Upname << ")" << endl;
2014      
2015    }
2016 <  
2016 > //   switch_overunderflow(false);
2017   }
2018  
2019  
# Line 2066 | Line 2048 | void draw_normalized_data_vs_data_histo(
2048  
2049  
2050   void jzb_plots(string mcjzb, string datajzb,vector<float> ratio_binning) {
2051 +  switch_overunderflow(true);
2052    TCanvas *can = new TCanvas("can","JZB Plots Canvas");
2053    float max=jzbHigh ;
2054    float min=-120;
# Line 2086 | Line 2069 | void jzb_plots(string mcjzb, string data
2069      draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_OFZP",can,binning);
2070      draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_OFZP",can,binning);
2071      flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
2072 <    if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning);
2073 <    if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning);
2072 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning);
2073 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning);
2074      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);
2075      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);
2076      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 2081 | void jzb_plots(string mcjzb, string data
2081    if ( !PlottingSetup::Approved ) {
2082      draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP_coarse",can,coarse_binning);
2083      flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak
2084 <    if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarse",can,coarse_binning);
2085 <    if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning);
2084 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarse",can,coarse_binning);
2085 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning);
2086    }
2087    delete can;
2088 +  switch_overunderflow(false);
2089   }
2090  
2091  
# Line 2151 | Line 2135 | void compute_MC_yields(string mcjzb,vect
2135    TCanvas *yica = new TCanvas("yica","yield canvas");
2136    
2137    int nRegions=4;
2138 <  if(!PlottingSetup::RestrictToMassPeak) nRegions=2;
2138 >  if(!PlottingSetup::RestrictToMassPeak||!PlottingSetup::UseSidebandsForcJZB) nRegions=2;
2139    string tsRegions[] = {"SFZP","OFZP","SFSB","OFSB"};
2140    string posneg[] = {"pos","neg"};
2141    TCut tkRegions[] = {cutOSSF&&cutnJets&&cutmass,cutOSOF&&cutnJets&&cutmass,cutOSSF&&cutnJets&&sidebandcut,cutOSOF&&cutnJets&&sidebandcut};
# Line 2599 | Line 2583 | void save_template(string mcjzb, string
2583    configfile<<"\n\n";
2584    configfile<<"luminosity="<<luminosity<<";\n";
2585    configfile<<"RestrictToMassPeak="<<RestrictToMassPeak<<";//defines the type of analysis we're running\n";
2586 +  configfile<<"UseSidebandsForcJZB="<<UseSidebandsForcJZB<<";//tells us whether to use the sidebands or not\n";
2587    
2588    configfile<<"\n\ncout << \"Configuration successfully loaded!\" << endl; \n \n } \n \n";
2589    
# Line 2641 | Line 2626 | void ttbar_sidebands_comparison(string m
2626    //in the case of the on peak analysis, we compare the 3 control regions to the real value
2627    //in the case of the OFF peak analysis, we compare our control region to the real value
2628    TCut weightbackup=cutWeight;
2629 +  switch_overunderflow(true);
2630    
2631    bool doPURW=false;
2632    
# Line 2671 | Line 2657 | void ttbar_sidebands_comparison(string m
2657    TH1F *TSeemm;
2658    TH1F *nTSeemm;
2659    
2660 <  if(PlottingSetup::RestrictToMassPeak) {
2660 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2661      TSem    = systsamples.Draw("TSem",       mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
2662      nTSem   = systsamples.Draw("nTSem",  "-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
2663      TSeemm  = systsamples.Draw("TSeemm",     mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets"));
# Line 2687 | Line 2673 | void ttbar_sidebands_comparison(string m
2673    TZem->SetMarkerColor(kRed);
2674  
2675  
2676 <  if(PlottingSetup::RestrictToMassPeak) {
2676 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2677          TSem->SetLineColor(TColor::GetColor("#00A616"));
2678          TSeemm->SetLineColor(kMagenta+2);
2679          TSem->SetMarkerColor(TColor::GetColor("#00A616"));
# Line 2701 | Line 2687 | void ttbar_sidebands_comparison(string m
2687    TZeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]);
2688    histos.push_back(TZem);
2689    histos.push_back(TZeemm);
2690 <  if(PlottingSetup::RestrictToMassPeak) {
2690 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2691      TSeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]);
2692      TSem->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]);
2693      histos.push_back(TSem);
# Line 2712 | Line 2698 | void ttbar_sidebands_comparison(string m
2698    TLegend *leg = make_legend("MC t#bar{t}",0.6,0.65,false);
2699    leg->AddEntry(TZeemm,"SFZP","l");
2700    leg->AddEntry(TZem,"OFZP","l");
2701 <  if(PlottingSetup::RestrictToMassPeak) {
2701 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2702      leg->AddEntry(TSeemm,"SFSB","l");
2703      leg->AddEntry(TSem,"OFSB","l");
2704    }
# Line 2723 | Line 2709 | void ttbar_sidebands_comparison(string m
2709    TH1F *TZeemmcopy = (TH1F*)TZeemm->Clone("TZeemmcopy");
2710    TH1F *TSeemmcopy;
2711    TH1F *TSemcopy;
2712 <  if(PlottingSetup::RestrictToMassPeak) {
2712 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2713      TSeemmcopy = (TH1F*)TSeemm->Clone("TSeemmcopy");
2714      TSemcopy = (TH1F*)TSem->Clone("TSemcopy");
2715    }
2716  
2717    TZem->Divide(TZeemm);
2718    TZem->SetMarkerStyle(21);
2719 <  if(PlottingSetup::RestrictToMassPeak) {
2719 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2720      TSem->Divide(TZeemm);
2721      TSeemm->Divide(TZeemm);
2722      TSem->SetMarkerStyle(24);
# Line 2741 | Line 2727 | void ttbar_sidebands_comparison(string m
2727    TZem->GetYaxis()->SetRangeUser(0,2.5);
2728    TZem->GetYaxis()->SetTitle("ratio");
2729    TZem->Draw();
2730 <  if(PlottingSetup::RestrictToMassPeak) {
2730 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2731      TSem->Draw("same");
2732      TSeemm->Draw("same");
2733    }
# Line 2771 | Line 2757 | void ttbar_sidebands_comparison(string m
2757    
2758    TLegend *leg2 = make_legend("MC t#bar{t}",0.55,0.75,false);
2759    leg2->AddEntry(TZem,"OFZP / SFZP","ple");
2760 <  if(PlottingSetup::RestrictToMassPeak) {
2760 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2761      leg2->AddEntry(TSeemm,"SFSB / SFZP","ple");
2762      leg2->AddEntry(TSem,"OFSB / SFZP","ple");
2763    }
# Line 2797 | Line 2783 | void ttbar_sidebands_comparison(string m
2783      TH1F *rightofsb;
2784      TH1F *leftsfsb;
2785      TH1F *rightsfsb;
2786 <    if(PlottingSetup::RestrictToMassPeak) {
2786 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2787        leftofsb  = (TH1F*)nTSem->Clone("leftofsb");
2788        rightofsb = (TH1F*)TSemcopy->Clone("rightofsb");
2789        rightofsb->Add(leftofsb,-1);
# Line 2811 | Line 2797 | void ttbar_sidebands_comparison(string m
2797      rightsfzp->GetYaxis()->SetTitle("#deltaJZB / 25 GeV");
2798      rightsfzp->Draw("histo");
2799      rightofzp->Draw("histo,same");
2800 <    if(PlottingSetup::RestrictToMassPeak) {
2800 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2801        rightofsb->Draw("histo,same");
2802        rightsfsb->Draw("histo,same");
2803      }
# Line 2820 | Line 2806 | void ttbar_sidebands_comparison(string m
2806      TLegend *legA = make_legend("MC t#bar{t}",0.6,0.65,false);
2807      legA->AddEntry(rightsfzp,"SFZP","l");
2808      legA->AddEntry(rightofzp,"OFZP","l");
2809 <    if(PlottingSetup::RestrictToMassPeak) {
2809 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2810        legA->AddEntry(rightofsb,"SFSB","l");
2811        legA->AddEntry(rightsfsb,"OFSB","l");
2812      }
# Line 2834 | Line 2820 | void ttbar_sidebands_comparison(string m
2820      rightofzp->GetYaxis()->SetRangeUser(0.0,2.5);
2821      rightofzp->GetYaxis()->SetTitle("#deltaJZB ratio");
2822      rightofzp->Draw();
2823 <    if(PlottingSetup::RestrictToMassPeak) {
2823 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2824        rightofsb->Divide(rightsfzp);
2825        rightsfsb->Divide(rightsfzp);
2826        rightofsb->Draw("same");
# Line 2854 | Line 2840 | void ttbar_sidebands_comparison(string m
2840      bottom2->Draw("same");
2841  
2842      rightofzp->SetMarkerStyle(21);
2843 <    if(PlottingSetup::RestrictToMassPeak) {
2843 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2844        rightofsb->SetMarkerStyle(24);
2845        rightsfsb->SetMarkerStyle(32);
2846      }
2847  
2848      TLegend *leg3 = make_legend("MC t#bar{t}",0.55,0.75,false);
2849      leg3->AddEntry(rightofzp,"OFZP / SFZP","ple");
2850 <    if(PlottingSetup::RestrictToMassPeak) {
2850 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2851        leg3->AddEntry(rightsfsb,"SFSB / SFZP","ple");
2852        leg3->AddEntry(rightofsb,"OFSB / SFZP","ple");
2853      }
# Line 2880 | Line 2866 | void ttbar_sidebands_comparison(string m
2866    delete nTZem;
2867    delete TZeemm;
2868    delete nTZeemm;
2869 <  if(PlottingSetup::RestrictToMassPeak) {
2869 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
2870          delete TSem;
2871          delete nTSem;
2872          delete TSeemm;
# Line 2889 | Line 2875 | void ttbar_sidebands_comparison(string m
2875  
2876    delete tcan;
2877    cutWeight=weightbackup;
2878 +  switch_overunderflow(false);
2879   }
2880  
2881   void ttbar_sidebands_comparison(string mcjzb, vector<float> jzb_binning) {
# Line 3043 | Line 3030 | void zjets_prediction_comparison(string
3030    TH1F *RcorrJZBSBeemm;
3031    TH1F *LcorrJZBSBeemm;
3032  
3033 <  if(PlottingSetup::RestrictToMassPeak) {
3033 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3034      RcorrJZBSBem   = systsamples.Draw("RcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY"));
3035      LcorrJZBSBem   = systsamples.Draw("LcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY"));
3036      RcorrJZBSBeemm = systsamples.Draw("RcorrJZBSBeemm",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY"));
# Line 3051 | Line 3038 | void zjets_prediction_comparison(string
3038    }
3039    
3040    TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred");
3041 <  if(PlottingSetup::RestrictToMassPeak) {
3041 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3042      Bpred->Add(RcorrJZBem,1.0/3.);
3043      Bpred->Add(LcorrJZBem,-1.0/3.);
3044      Bpred->Add(RcorrJZBSBem,1.0/3.);
# Line 3109 | Line 3096 | void zjets_prediction_comparison(string
3096    delete RcorrJZBem;
3097    delete LcorrJZBem;
3098    
3099 <  if(PlottingSetup::RestrictToMassPeak) {
3099 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3100      delete RcorrJZBSBem;
3101      delete LcorrJZBSBem;
3102      delete RcorrJZBSBeemm;
# Line 3174 | Line 3161 | void make_table(samplecollection &coll,
3161      TH1F *RcorrJZBSBeemm;
3162      TH1F *LcorrJZBSBeemm;
3163      
3164 <    if(PlottingSetup::RestrictToMassPeak) {
3164 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3165        RcorrJZBSBem   = coll.Draw("RcorrJZBSBem",jzbexpr.c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity, mysample);
3166        LcorrJZBSBem   = coll.Draw("LcorrJZBSBem",("-("+jzbexpr+")").c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity, mysample);
3167        RcorrJZBSBeemm = coll.Draw("RcorrJZBSBeemm",jzbexpr.c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity, mysample);
# Line 3182 | Line 3169 | void make_table(samplecollection &coll,
3169      }
3170      
3171      TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred");
3172 <    if(PlottingSetup::RestrictToMassPeak) {
3172 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3173        Bpred->Add(RcorrJZBem,1.0/3.);
3174        Bpred->Add(LcorrJZBem,-1.0/3.);
3175        Bpred->Add(RcorrJZBSBem,1.0/3.);
# Line 3393 | Line 3380 | void qcd_plots(string datajzb, string mc
3380    TH1F *JRcorrJZBSBeemm;
3381    TH1F *JLcorrJZBSBeemm;
3382    
3383 <  if(PlottingSetup::RestrictToMassPeak) {
3383 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3384      RcorrJZBSBem   = qcdsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
3385      LcorrJZBSBem   = qcdsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal);
3386      RcorrJZBSBeemm = qcdsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal);
# Line 3414 | Line 3401 | void qcd_plots(string datajzb, string mc
3401      
3402    TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred");
3403    TH1F *JBpred = (TH1F*)JLcorrJZBeemm->Clone("Bpred");
3404 <  if(PlottingSetup::RestrictToMassPeak) {
3404 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3405      Bpred->Add(RcorrJZBem,1.0/3.);
3406      Bpred->Add(LcorrJZBem,-1.0/3.);
3407      Bpred->Add(RcorrJZBSBem,1.0/3.);
# Line 3484 | Line 3471 | void qcd_plots(string datajzb, string mc
3471    dout << "______________________________________________" << endl;
3472    dout << "How QCD shows up in the different regions: " << endl;
3473    dout << "OSSF: " << endl;
3474 <  if(PlottingSetup::RestrictToMassPeak) {
3474 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3475      dout << "     Z window: \t" << RcorrJZBeemm->Integral() << " (JZB>0) , " << LcorrJZBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBeemm->Integral() + LcorrJZBeemm->Integral() << endl;
3476      dout << "     sideband: \t" << RcorrJZBSBeemm->Integral() << " (JZB>0) , " << LcorrJZBSBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBSBeemm->Integral() + LcorrJZBSBeemm->Integral() << endl;
3477    } else {
3478      dout << "     " << RcorrJZBeemm->Integral() << " (JZB>0) , " << LcorrJZBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBeemm->Integral() + LcorrJZBeemm->Integral() << endl;
3479    }
3480    dout << "OSOF: " << endl;
3481 <  if(PlottingSetup::RestrictToMassPeak) {
3481 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3482      dout << "     Z window: \t" << RcorrJZBem->Integral() << " (JZB>0) , " << LcorrJZBem->Integral() << " (JZB<0) --> total: " << RcorrJZBem->Integral() + LcorrJZBem->Integral() << endl;
3483      dout << "     sideband: \t" << RcorrJZBSBem->Integral() << " (JZB>0) , " << LcorrJZBSBem->Integral() << " (JZB<0) --> total: " << RcorrJZBSBem->Integral() + LcorrJZBSBem->Integral() << endl;
3484    } else {
3485      dout << "     Z window: \t" << RcorrJZBem->Integral() << " (JZB>0) , " << LcorrJZBem->Integral() << " (JZB<0) --> total: " << RcorrJZBem->Integral() + LcorrJZBem->Integral() << endl;
3486    }
3487    dout << "Therefore: " << endl;
3488 <  if(PlottingSetup::RestrictToMassPeak) {
3488 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3489      dout << "    Prediction increases by : " << LcorrJZBeemm->Integral() << " + (1.0/3)*(" << RcorrJZBSBeemm->Integral() <<"-"<< LcorrJZBSBeemm->Integral() << ") (SFSB) ";
3490      dout << " + (1.0/3)*(" << RcorrJZBem->Integral() <<"-"<< LcorrJZBem->Integral() << ") (OFZP) ";
3491      dout << " + (1.0/3)*(" << RcorrJZBSBem->Integral() <<"-"<< LcorrJZBSBem->Integral() << ") (OFSB) ";
# Line 3514 | Line 3501 | void qcd_plots(string datajzb, string mc
3501    for(int i=0;i<(int)bins.size();i++) {
3502      dout << " JZB > " << bins[i] << " : " << endl;
3503      dout << "    Observation increases by : " << RcorrJZBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) << endl;
3504 <    if(PlottingSetup::RestrictToMassPeak) {
3504 >    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
3505          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;
3506      } else {
3507          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 3515 | void qcd_plots(string datajzb, string mc
3515    if(LcorrJZBem) delete LcorrJZBem;
3516    if(RcorrJZBeemm) delete RcorrJZBeemm;
3517    if(LcorrJZBeemm) delete LcorrJZBeemm;
3518 <  if(PlottingSetup::RestrictToMassPeak&&RcorrJZBSBem) delete RcorrJZBSBem;
3519 <  if(PlottingSetup::RestrictToMassPeak&&LcorrJZBSBem) delete LcorrJZBSBem;
3520 <  if(PlottingSetup::RestrictToMassPeak&&RcorrJZBSBeemm) delete RcorrJZBSBeemm;
3521 <  if(PlottingSetup::RestrictToMassPeak&&LcorrJZBSBeemm) delete LcorrJZBSBeemm;
3518 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&RcorrJZBSBem) delete RcorrJZBSBem;
3519 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&LcorrJZBSBem) delete LcorrJZBSBem;
3520 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&RcorrJZBSBeemm) delete RcorrJZBSBeemm;
3521 >  if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&LcorrJZBSBeemm) delete LcorrJZBSBeemm;
3522   }
3523  
3524   void check_ptsanity() {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines