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.80 by buchmann, Thu Jan 24 08:16:17 2013 UTC vs.
Revision 1.86 by buchmann, Mon Feb 25 15:39:12 2013 UTC

# Line 87 | Line 87 | void find_one_peak_combination(TCut spec
87    delete tempcan;
88   }
89  
90 + void DoPeakVsPU() {
91 +  cout << "Trying to find peak position as a function of PU" << endl;
92 +  float MCPeak, MCPeakError, DataPeak, DataPeakError;
93 +  stringstream result, datajzb, mcjzb;
94 +  bool doPUreweighting=true;
95 +  bool SwitchOffNJetsCut=false;
96 +  
97 +  float mcSigma,mcSigmaError,dataSigma,dataSigmaError;
98 +  
99 +  float NumVtxBin[6] = {0,5,10,15,20,100};
100 +  
101 +  stringstream NowCut;
102 +  
103 +  TGraphErrors *gMCPeak = new TGraphErrors();
104 +  gMCPeak->SetTitle("gMCPeak");
105 +  TGraphErrors *gDataPeak = new TGraphErrors();
106 +  gDataPeak->SetTitle("gDataPeak");
107 +  TGraphErrors *gMCWidth = new TGraphErrors();
108 +  gMCWidth->SetTitle("gMCWidth");
109 +  TGraphErrors *gDataWidth = new TGraphErrors();
110 +  gDataWidth->SetTitle("gDataWidth");
111 +  
112 +  
113 +  for(int i=0;i<5;i++) {
114 +    NowCut.str("");
115 +    NowCut << "numVtx>=" << NumVtxBin[i] << "&&numVtx<" << NumVtxBin[i+1];
116 +    find_one_peak_combination(TCut(NowCut.str().c_str()),SwitchOffNJetsCut,MCPeak,MCPeakError, DataPeak,DataPeakError,mcSigma,mcSigmaError, dataSigma,dataSigmaError,result,doPUreweighting,"");
117 +    cout << "    " << MCPeak << " +/- " << MCPeakError << endl;
118 +    cout << "    " << DataPeak << " +/- " << DataPeakError << endl;
119 +    
120 +    gMCPeak->SetPoint(i,0.5*(NumVtxBin[i]+NumVtxBin[i+1]),MCPeak);
121 +    gMCPeak->SetPointError(i,0.5*(NumVtxBin[i+1]-NumVtxBin[i]),MCPeakError);
122 +    
123 +    gDataPeak->SetPoint(i,0.5*(NumVtxBin[i]+NumVtxBin[i+1]),DataPeak);
124 +    gDataPeak->SetPointError(i,0.5*(NumVtxBin[i+1]-NumVtxBin[i]),DataPeakError);
125 +    
126 +    gMCWidth->SetPoint(i,0.5*(NumVtxBin[i]+NumVtxBin[i+1]),mcSigma);
127 +    gMCWidth->SetPointError(i,0.5*(NumVtxBin[i+1]-NumVtxBin[i]),mcSigmaError);
128 +    
129 +    gDataWidth->SetPoint(i,0.5*(NumVtxBin[i]+NumVtxBin[i+1]),dataSigma);
130 +    gDataWidth->SetPointError(i,0.5*(NumVtxBin[i+1]-NumVtxBin[i]),dataSigmaError);
131 +  }
132 +  
133 +  TFile *fo = new TFile("fout.root","RECREATE");
134 +  gMCPeak->Write();
135 +  gDataPeak->Write();
136 +  gMCWidth->Write();
137 +  gDataWidth->Write();
138 +  fo->Close();
139 +  
140 + }
141 +
142   void find_peaks(float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, stringstream &result, bool doPUreweighting, stringstream &datajzb, stringstream &mcjzb, string sSpecialCut="", bool SwitchOffNJetsCut=false)
143   {
144    bool overunderflowstatus=addoverunderflowbins;
# Line 285 | Line 337 | void make_special_obs_pred_mll_plot(stri
337    }
338    delete Bpred;
339    delete ckin;
340 +  CleanLegends();
341   }
342  
343   void make_special_mll_plot(int nbins, float min, float max, bool logscale,string xlabel) {
# Line 331 | Line 384 | void make_special_mll_plot(int nbins, fl
384    delete datahistoOSOF;
385    delete datahistoOSSF;
386    delete ckin;
387 +  CleanLegends();
388   }
389    
390  
# Line 384 | Line 438 | float make_one_OFSF_plot(string variable
438  
439    cutOF = cutOSOF&&cutnJets&&ibasiccut;
440    cutSF = cutOSSF&&cutnJets&&ibasiccut;
441 +  
442 +  TCanvas *ofsf_can = new TCanvas("ofsf_can","ofsf_can");
443  
444    TPad* rcan = new TPad("rcan","rcan",0,0,1,1);
445    rcan->SetLogy(logscale);
# Line 409 | Line 465 | float make_one_OFSF_plot(string variable
465    }
466    if (ymax<0) {
467      if ( logscale ) datahistoSF->SetMaximum(5.3*datahistoSF->GetMaximum());
468 <    else datahistoSF->SetMaximum(1.8*datahistoSF->GetMaximum());
468 >    else datahistoSF->SetMaximum(0.8*datahistoSF->GetMaximum());
469    } else {
470      datahistoSF->SetMaximum(ymax);
471    }
# Line 446 | Line 502 | float make_one_OFSF_plot(string variable
502    //signalhisto->Delete();
503    delete mleg;
504    delete rcan;
505 +  delete ofsf_can;
506  
507    return ymaxSet;
508  
# Line 924 | Line 981 | void make_JES_plot(TCut cut, string name
981    CompleteSave(ckin,"Systematics/JES"+name);
982    datahisto->Delete();
983    delete ckin;
984 <
984 >  delete JESunc;
985 >  delete JESup;
986 >  delete JESdn;
987 >  CleanLegends();
988   }
989  
990   string Cut2Str(TCut cut) {
# Line 1050 | Line 1110 | void make_ttbar_comparison(string datava
1110    
1111    TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600);
1112    ckin->SetLogy(dolog);
1113 <  cout << "\r Creating " << filename << " : data   (1/11)" << std::flush;
1113 >  cout << "\r Creating " << filename << " : data   (1/7)" << std::flush;
1114    TH1F *datahisto = allsamples.Draw("datahisto",datavariable,nbins,min,max, xlabel, "events",cut,data,luminosity);
1115    datahisto->SetMarkerSize(DataMarkerSize);
1116    if ( !dolog ) datahisto->SetMinimum(0); // Defaults
1117    else datahisto->SetMinimum(0.5);
1118    if (dolog) datahisto->SetMaximum(5.3*datahisto->GetMaximum());
1119    else datahisto->SetMaximum(1.3*datahisto->GetMaximum());
1120 <  cout << "\r Creating " << filename << " : MC central  (stack) (2/11)" << std::flush;
1120 >  cout << "\r Creating " << filename << " : MC central  (stack) (2/7)" << std::flush;
1121    THStack mcstack   = allsamples.DrawStack("mcstack",  mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity);
1122    TH1F *MCcentral = CollapseStack(mcstack);
1123  
1124 <  cout << "\r Creating " << filename << " : MC central (histo)   (3/11)" << std::flush;
1124 >  cout << "\r Creating " << filename << " : MC central (histo)   (3/7)" << std::flush;
1125    TH1F *TCentral        = allsamples.Draw ("TCentral",     mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,allsamples.FindSample("TTJets_"));
1126    TH1F *RCentral        = ProduceTTbarRatio(datahisto,MCcentral,TCentral,TCentral);
1127    
1128 <  cout << "\r Creating " << filename << " : MC Matching up   (4/11)" << std::flush;
1128 >  cout << "\r Creating " << filename << " : MC Matching up   (4/7)" << std::flush;
1129    TH1F *TMatchingUp     = systsamples.Draw("TMatchingUp",  mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,systsamples.FindSample("TTJets_matchingup"));
1130    TH1F *RMatchingUp     = ProduceTTbarRatio(datahisto,MCcentral,TCentral,TMatchingUp);
1131    
1132 <  cout << "\r Creating " << filename << " : MC Matching down   (5/11)" << std::flush;
1132 >  cout << "\r Creating " << filename << " : MC Matching down   (5/7)" << std::flush;
1133    TH1F *TMatchingDown   = systsamples.Draw("TMatchingDown",mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,systsamples.FindSample("TTJets_matchingdown"));
1134    TH1F *RMatchingDown   = ProduceTTbarRatio(datahisto,MCcentral,TCentral,TMatchingDown);
1135    
1136 <  cout << "\r Creating " << filename << " : MC Scale up   (6/11)" << std::flush;
1136 >  cout << "\r Creating " << filename << " : MC Scale up   (6/7)" << std::flush;
1137    TH1F *TScaleUp        = systsamples.Draw("TScaleUp",     mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,systsamples.FindSample("TTJets_scaleup"));
1138    TH1F *RScaleUp        = ProduceTTbarRatio(datahisto,MCcentral,TCentral,TScaleUp);
1139    
1140 <  cout << "\r Creating " << filename << " : MC Scale down   (7/11)" << std::flush;
1140 >  cout << "\r Creating " << filename << " : MC Scale down   (7/7)" << std::flush;
1141    TH1F *TScaleDown      = systsamples.Draw("TScaleDown",   mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,systsamples.FindSample("TTJets_scaledown"));
1142    TH1F *RScaleDown      = ProduceTTbarRatio(datahisto,MCcentral,TCentral,TScaleDown);
1143    
1084  cout << "\r Creating " << filename << " : MC mass=166   (8/11)" << std::flush;
1085  TH1F *Ttmass166       = systsamples.Draw("Ttmass166",    mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,systsamples.FindSample("TTJets_mass166"));
1086  TH1F *Rtmass166       = ProduceTTbarRatio(datahisto,MCcentral,TCentral,Ttmass166);
1087  
1088  cout << "\r Creating " << filename << " : MC mass=169   (9/11)" << std::flush;
1089  TH1F *Ttmass169       = systsamples.Draw("Ttmass169",    mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,systsamples.FindSample("TTJets_mass169"));
1090  TH1F *Rtmass169       = ProduceTTbarRatio(datahisto,MCcentral,TCentral,Ttmass169);
1091  
1092  cout << "\r Creating " << filename << " : MC mass=175   (10/11)" << std::flush;
1093  TH1F *Ttmass175       = systsamples.Draw("Ttmass175",    mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,systsamples.FindSample("TTJets_mass175"));
1094  TH1F *Rtmass175       = ProduceTTbarRatio(datahisto,MCcentral,TCentral,Ttmass175);
1095  
1096  cout << "\r Creating " << filename << " : MC mass=178   (11/11)" << std::flush;
1097  TH1F *Ttmass178       = systsamples.Draw("Ttmass178",    mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,systsamples.FindSample("TTJets_mass178"));
1098  TH1F *Rtmass178       = ProduceTTbarRatio(datahisto,MCcentral,TCentral,Ttmass178);
1099  
1100  
1144    datahisto->Draw("e1");
1145    ckin->Update();
1146    mcstack.Draw("histo,same");
# Line 1135 | Line 1178 | void make_ttbar_comparison(string datava
1178    TScaleDown->SetLineColor(TColor::GetColor("#FF8500"));
1179    TScaleDown->SetLineStyle(3);//dotted
1180    
1138  Ttmass166->SetLineColor(TColor::GetColor("#0acf00"));//green
1139  Ttmass166->SetLineStyle(3);//dotted
1140  Ttmass178->SetLineColor(TColor::GetColor("#0acf00"));
1141  Ttmass178->SetLineStyle(2);//dashed
1142  
1143  
1144  Ttmass169->SetLineColor(TColor::GetColor("#FF52F1"));//purple
1145  Ttmass169->SetLineStyle(3);//dotted
1146  Ttmass175->SetLineColor(TColor::GetColor("#FF52F1"));
1147  Ttmass175->SetLineStyle(2);//dashed
1148  
1149  
1150  
1151  
1181    MCcentral->SetLineStyle(3);
1182    MCcentral->SetLineColor(kRed);
1183    
# Line 1158 | Line 1187 | void make_ttbar_comparison(string datava
1187    TMatchingDown->Draw("histo,same");
1188    TScaleUp->Draw("histo,same");
1189    TScaleDown->Draw("histo,same");
1161  Ttmass166->Draw("histo,same");
1162  Ttmass169->Draw("histo,same");
1163  Ttmass175->Draw("histo,same");
1164  Ttmass178->Draw("histo,same");
1190    
1191    TLegend *sleg = make_legend();
1192    sleg->AddEntry(TCentral,"Central","L");
# Line 1169 | Line 1194 | void make_ttbar_comparison(string datava
1194    sleg->AddEntry(TMatchingDown,"matching down","L");
1195    sleg->AddEntry(TScaleUp,"scale up","L");
1196    sleg->AddEntry(TScaleDown,"scale down","L");
1172  sleg->AddEntry(Ttmass166,"m_{t}=166","L");
1173  sleg->AddEntry(Ttmass169,"m_{t}=169","L");
1174  sleg->AddEntry(Ttmass175,"m_{t}=175","L");
1175  sleg->AddEntry(Ttmass178,"m_{t}=178","L");
1197    sleg->Draw();
1198    
1199    CompleteSave(ckin,saveas+"___AllLines");
# Line 1191 | Line 1212 | void make_ttbar_comparison(string datava
1212    RScaleDown->SetLineColor(TColor::GetColor("#FF8500"));
1213    RScaleDown->SetLineStyle(3);//dotted
1214    
1194  Rtmass166->SetLineColor(TColor::GetColor("#0acf00"));//green
1195  Rtmass166->SetLineStyle(3);//dotted
1196  Rtmass178->SetLineColor(TColor::GetColor("#0acf00"));
1197  Rtmass178->SetLineStyle(2);//dashed
1198  
1199  
1200  Rtmass169->SetLineColor(TColor::GetColor("#FF52F1"));//purple
1201  Rtmass169->SetLineStyle(3);//dotted
1202  Rtmass175->SetLineColor(TColor::GetColor("#FF52F1"));
1203  Rtmass175->SetLineStyle(2);//dashed
1204
1205  
1215    RCentral->GetYaxis()->SetRangeUser(0,2);
1216    RCentral->Draw("e1");
1217    RMatchingUp->Draw("histo,same");
1218    RMatchingDown->Draw("histo,same");
1219    RScaleUp->Draw("histo,same");
1220    RScaleDown->Draw("histo,same");
1212  Rtmass166->Draw("histo,same");
1213  Rtmass169->Draw("histo,same");
1214  Rtmass175->Draw("histo,same");
1215  Rtmass178->Draw("histo,same");
1221    
1222    CompleteSave(ckin,saveas+"___AllRatios");
1223  
1224 <  TCanvas *multicanvas = new TCanvas("multicanvas","multicanvas",1000,1000);
1225 <  multicanvas->Divide(2,2);
1224 >  TCanvas *multicanvas = new TCanvas("multicanvas","multicanvas",1400,700);
1225 >  multicanvas->Divide(2,1);
1226    PresentRange(RMatchingUp,RMatchingDown,RCentral,multicanvas->cd(1),"Matching");
1227    PresentRange(RScaleUp,RScaleDown,RCentral,multicanvas->cd(2),"Scale");
1223  PresentRange(Rtmass166,Rtmass178,RCentral,multicanvas->cd(3),"m_{t} (2#sigma)");
1224  PresentRange(Rtmass169,Rtmass175,RCentral,multicanvas->cd(4),"m_{t} (1#sigma)");
1228    CompleteSave(multicanvas,saveas+"___RangeIllustration");
1229    
1230    
# Line 1231 | Line 1234 | void make_ttbar_comparison(string datava
1234    delete   TMatchingDown;
1235    delete   TScaleUp;
1236    delete   TScaleDown;
1237 <  delete   Ttmass166;
1238 <  delete   Ttmass169;
1239 <  delete   Ttmass175;
1240 <  delete   Ttmass178;
1237 > //   delete   Ttmass166;
1238 > //   delete   Ttmass169;
1239 > //   delete   Ttmass175;
1240 > //   delete   Ttmass178;
1241    
1242    delete ckin;
1243    
# Line 1273 | Line 1276 | void ProduceJanPlots() {
1276    delete c1;
1277   }
1278  
1279 < THStack MakeOneSystematicsPlot(TCut cut, string saveas, string variation, TH1F *hdata, string variable, int nbins, float bmin, float bmax, string label) {
1279 > THStack MakeOneSystematicsPlot(TCut cut, string saveas, string variation, TH1F *hdata, string variable, int nbins, float bmin, float bmax, string label, TH1F* &thisto) {
1280    THStack SystPlot = allsamples.DrawStack(variation,variable,nbins,bmin,bmax,label,"events",cut,mc,PlottingSetup::luminosity);
1281    
1282    //now need to process the plot (calculate the variation and set the member of thstack accordingly!)
# Line 1294 | Line 1297 | THStack MakeOneSystematicsPlot(TCut cut,
1297            h->SetBinContent(i,varttbar->GetBinContent(i));
1298            h->SetBinError(i,varttbar->GetBinError(i));
1299          }
1300 +        thisto=(TH1F*)varttbar->Clone(variation.c_str());
1301          SystPlot.Modified();
1302        }
1303      }
1304      delete varttbar;
1305 +  } else {
1306 +    TIter nextHisto(SystPlot.GetHists());
1307 +    TH1F* h;
1308 +    while ( h = (TH1F*)nextHisto() ) {
1309 +      if(Contains(h->GetName(),"t_bar_t")) thisto=(TH1F*)h->Clone(variation.c_str());
1310 +    }
1311    }
1312 <  
1312 >    
1313    TLegend *fullleg = allsamples.allbglegend();
1314    fullleg->SetHeader(variation.c_str());
1315    TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1);
# Line 1323 | Line 1333 | THStack MakeOneSystematicsPlot(TCut cut,
1333  
1334   void ProduceMCSystematicPlot(string variable, int nbins, float bmin, float bmax, string label, TCut thiscut, string saveas) {
1335    TCanvas *ca = new TCanvas("ca","ca");
1326
1336    TH1F *hdata = allsamples.Draw("hdata",variable,nbins,bmin,bmax,label,"events",thiscut,data,luminosity);
1337    
1338 <  THStack ScaleUp      = MakeOneSystematicsPlot(thiscut,saveas,"ScaleUp",hdata,variable, nbins, bmin, bmax, label);
1339 <  THStack ScaleDown    = MakeOneSystematicsPlot(thiscut,saveas,"ScaleDown",hdata,variable, nbins, bmin, bmax, label);
1340 <  THStack MatchingUp   = MakeOneSystematicsPlot(thiscut,saveas,"MatchingUp",hdata,variable, nbins, bmin, bmax, label);
1341 <  THStack MatchingDown = MakeOneSystematicsPlot(thiscut,saveas,"MatchingDown",hdata,variable, nbins, bmin, bmax, label);
1338 >  TH1F *tScaleUp,*tScaleDown,*tMatchingUp,*tMatchingDown,*tCentral;
1339 >  
1340 >  THStack ScaleUp      = MakeOneSystematicsPlot(thiscut,saveas,"ScaleUp",hdata,variable, nbins, bmin, bmax, label,tScaleUp);
1341 >  THStack ScaleDown    = MakeOneSystematicsPlot(thiscut,saveas,"ScaleDown",hdata,variable, nbins, bmin, bmax, label,tScaleDown);
1342 >  THStack MatchingUp   = MakeOneSystematicsPlot(thiscut,saveas,"MatchingUp",hdata,variable, nbins, bmin, bmax, label,tMatchingUp);
1343 >  THStack MatchingDown = MakeOneSystematicsPlot(thiscut,saveas,"MatchingDown",hdata,variable, nbins, bmin, bmax, label,tMatchingDown);
1344    
1345    TH1F *HScaleUp = CollapseStack(ScaleUp);
1346    TH1F *HScaleDown = CollapseStack(ScaleDown);
1347    TH1F *HMatchingUp = CollapseStack(MatchingUp);
1348    TH1F *HMatchingDown = CollapseStack(MatchingDown);
1349    
1350 <  DeleteStack(ScaleUp);
1340 <  DeleteStack(ScaleDown);
1341 <  DeleteStack(MatchingUp);
1342 <  DeleteStack(MatchingDown);
1343 <  
1344 <  THStack Central = MakeOneSystematicsPlot(thiscut,saveas,"Central",hdata,variable, nbins, bmin, bmax, label);
1350 >  THStack Central = MakeOneSystematicsPlot(thiscut,saveas,"Central",hdata,variable, nbins, bmin, bmax, label,tCentral);
1351    TH1F *HCentral = CollapseStack(Central);
1352    
1353    TH1F *Systematic = (TH1F*)hdata->Clone("Systematic");
# Line 1363 | Line 1369 | void ProduceMCSystematicPlot(string vari
1369    TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1);
1370    kinpad->SetLogy(1);
1371    kinpad->cd();
1372 <  hdata->Draw("e1");
1373 <  Central.Draw("histo,same");
1374 <  hdata->Draw("e1,same");
1372 >  if(variable=="genMET") {
1373 >    Central.Draw("histo");
1374 >  } else {
1375 >    hdata->Draw("e1");
1376 >    Central.Draw("histo,same");
1377 >    hdata->Draw("e1,same");
1378 >  }
1379 >  
1380    DrawPrelim();
1381 <
1381 >  
1382    save_with_ratio_and_sys_band( hdata, HCentral, kinpad->cd(), saveas, false, false, "data/mc",Systematic );
1383    
1384 +  kinpad->cd();
1385 +  tCentral->SetFillColor(kWhite);
1386 +  tCentral->SetLineColor(kBlack);
1387 +  tScaleUp->SetLineColor(kRed);
1388 +  tScaleDown->SetLineColor(kRed);
1389 +  tMatchingUp->SetLineColor(kBlue);
1390 +  tMatchingDown->SetLineColor(kBlue);
1391 +  tScaleUp->SetLineStyle(2);
1392 +  tScaleDown->SetLineStyle(3);
1393 +  tMatchingUp->SetLineStyle(2);
1394 +  tMatchingDown->SetLineStyle(3);
1395 +  
1396 +  TLegend *leg2 = make_legend();
1397 +  leg2->AddEntry(hdata,"Data","p");
1398 +  leg2->AddEntry(tCentral,"Central (ttbar)","l");
1399 +  leg2->AddEntry(tScaleUp,"ScaleUp (ttbar)","l");
1400 +  leg2->AddEntry(tScaleDown,"ScaleDown (ttbar)","l");
1401 +  leg2->AddEntry(tMatchingUp,"MatchingUp (ttbar)","l");
1402 +  leg2->AddEntry(tMatchingDown,"MatchingDown (ttbar)","l");
1403 +  if(variable=="genMET") {
1404 +    Central.Draw("histo");
1405 +  }else {
1406 +    hdata->Draw("e1");
1407 +    Central.Draw("histo,same");
1408 +    hdata->Draw("e1,same");
1409 +  }
1410 +  tCentral->Draw("histo,same");
1411 +  tScaleUp->Draw("histo,same");
1412 +  tScaleDown->Draw("histo,same");
1413 +  tMatchingUp->Draw("histo,same");
1414 +  tMatchingDown->Draw("histo,same");
1415 +  leg2->Draw();
1416 +  
1417 +  CompleteSave(kinpad,saveas+"__TTbarComparison");
1418 +  
1419 +  gStyle->SetOptFit(0);
1420 +  
1421 +  kinpad->cd();
1422 +  kinpad->SetLogy(0);
1423 +  TH1F *MatchingRatio = (TH1F*)tMatchingUp->Clone("MatchingRatio");
1424 +  MatchingRatio->Divide(tMatchingDown);
1425 +  TLine *lone = new TLine(tScaleUp->GetBinLowEdge(1),1,tScaleUp->GetBinLowEdge(tScaleUp->GetNbinsX())+tScaleUp->GetBinWidth(tScaleUp->GetNbinsX()),1);
1426 +  lone->SetLineColor(TColor::GetColor("#01DF01"));
1427 +  lone->SetLineStyle(2);
1428 +  TH1F *ScaleRatio = (TH1F*)tScaleUp->Clone("ScaleRatio");
1429 +  ScaleRatio->Divide(tScaleDown);
1430 +  MatchingRatio->GetYaxis()->SetRangeUser(0,3);
1431 +  MatchingRatio->Draw("e1");
1432 +  TF1 *QP1 = new TF1("QP1","[0]+[1]*x",50,200);//simple linear function ranging from 50 to 200
1433 +  MatchingRatio->Fit("QP1","R");
1434 +  lone->Draw();
1435 +  stringstream summary;
1436 +  summary << " #splitline{Fit result for f(x) = a+bx :}{#splitline{a=" << DigitsAfterComma(QP1->GetParameter(0),4) << " +/- " << DigitsAfterComma(QP1->GetParError(0),4) << "}{b=" << DigitsAfterComma(QP1->GetParameter(1),4);
1437 +  summary << " +/- " << DigitsAfterComma(QP1->GetParError(1),4) << "}}";
1438 +  TText *infobox = write_title(summary.str());
1439 +  infobox->SetX(0.75);
1440 +  infobox->SetTextSize(0.03);
1441 +  infobox->SetY(0.75);
1442 +  infobox->Draw();
1443 +  CompleteSave(kinpad,saveas+"__TTbarComparison_MatchingUpDividedMatchingDown");
1444 +  kinpad->cd();
1445 +  ScaleRatio->GetYaxis()->SetRangeUser(0,3);
1446 +  ScaleRatio->Draw("e1");
1447 +  ScaleRatio->Fit("QP1","R");
1448 +  summary.str("");
1449 +  summary << " #splitline{Fit result for f(x) = a+bx :}{#splitline{a=" << DigitsAfterComma(QP1->GetParameter(0),4) << " +/- " << DigitsAfterComma(QP1->GetParError(0),4) << "}{b=" << DigitsAfterComma(QP1->GetParameter(1),4);
1450 +  summary << " +/- " << DigitsAfterComma(QP1->GetParError(1),4) << "}}";
1451 +  TText *infobox2 = write_title(summary.str());
1452 +  infobox2->SetX(0.75);
1453 +  infobox2->SetTextSize(0.03);
1454 +  infobox2->SetY(0.75);
1455 +  infobox2->Draw();
1456 +
1457 +  lone->Draw();
1458 +  CompleteSave(kinpad,saveas+"__TTbarComparison_ScaleUpDividedScaleDown");
1459 +  
1460 +  
1461 +  delete QP1;
1462 +  delete infobox;
1463 +  delete infobox2;
1464 +  delete MatchingRatio;
1465 +  delete ScaleRatio;
1466 +  DeleteStack(ScaleUp);
1467 +  DeleteStack(ScaleDown);
1468 +  DeleteStack(MatchingUp);
1469 +  DeleteStack(MatchingDown);
1470 +  delete leg2;
1471    CleanLegends();
1472    DeleteStack(Central);
1473    delete Systematic;
# Line 1382 | Line 1480 | void ProduceMCSystematicPlot(string vari
1480    delete ca;
1481   }
1482  
1483 + TH1F* ImposeBinning(TH1F *binninghisto, TH1F* histo) {
1484 +  float val=0,err=0;
1485 +  vector<float> bins;
1486 +  vector<float> vals;
1487 +  vector<float> errs;
1488 +  
1489 +  bins.push_back(binninghisto->GetBinLowEdge(1));
1490 +  int iBin=1;
1491 +  
1492 +  for(unsigned int i=1;i<histo->GetNbinsX();i++) {//going to second last one on purpose!
1493 +    if((histo->GetBinLowEdge(i)+0.00001>=binninghisto->GetBinLowEdge(iBin)+binninghisto->GetBinWidth(iBin))) {
1494 +      bins.push_back(histo->GetBinLowEdge(i));
1495 +      vals.push_back(val);val=0;
1496 +      errs.push_back(err);err=0;
1497 +      iBin++;
1498 +    }
1499 +    val+=histo->GetBinContent(i);
1500 +    err=sqrt(err*err+histo->GetBinError(i)*histo->GetBinError(i));
1501 +  }
1502 +  bins.push_back(histo->GetBinLowEdge(histo->GetNbinsX())+histo->GetBinWidth(histo->GetNbinsX()));
1503 +  vals.push_back(val);val=0;
1504 +  errs.push_back(err);err=0;
1505 +  
1506 +  TH1F *h = new TH1F(("r"+(string)histo->GetName()).c_str(),("r"+(string)histo->GetName()).c_str(),bins.size()-1,&bins[0]);
1507 +  for(unsigned int i=0;i<vals.size();i++) {
1508 +    h->SetBinContent(i+1,vals[i]);
1509 +    h->SetBinError(i+1,errs[i]);
1510 +  }
1511 +  
1512 +  h->GetXaxis()->SetTitle(histo->GetXaxis()->GetTitle());
1513 +  h->GetYaxis()->SetTitle(histo->GetYaxis()->GetTitle());
1514 +  
1515 +  h->GetXaxis()->CenterTitle();
1516 +  h->GetYaxis()->CenterTitle();
1517 +
1518 +  return h;
1519 + }
1520 +
1521 +
1522 + TH1F* ReBinOptimizingStats(int nbins, TH1F *histo) {
1523 +  float statsperbin = (1/(float)nbins) * histo->Integral();
1524 +  float val=0,err=0;
1525 +  vector<float> bins;
1526 +  vector<float> vals;
1527 +  vector<float> errs;
1528 +  
1529 +  bins.push_back(histo->GetBinLowEdge(1));
1530 +  for(unsigned int i=1;i<=histo->GetNbinsX();i++) {
1531 +    val+=histo->GetBinContent(i);
1532 +    err=sqrt(err*err+histo->GetBinError(i)*histo->GetBinError(i));
1533 +    if( val/statsperbin > 0.85) {
1534 +      if(bins.size()<nbins) {
1535 +        bins.push_back(histo->GetBinLowEdge(i)+histo->GetBinWidth(i));
1536 +        vals.push_back(val);val=0;
1537 +        errs.push_back(err);err=0;
1538 +      }
1539 +    }
1540 +    if(i==histo->GetNbinsX()) {
1541 +      bins.push_back(histo->GetBinLowEdge(i)+histo->GetBinWidth(i));
1542 +      vals.push_back(val);val=0;
1543 +      errs.push_back(err);err=0;
1544 +    }
1545 +  }
1546 +  TH1F *h = new TH1F(("r"+(string)histo->GetName()).c_str(),("r"+(string)histo->GetName()).c_str(),bins.size()-1,&bins[0]);
1547 +  
1548 +  h->GetXaxis()->SetTitle(histo->GetXaxis()->GetTitle());
1549 +  h->GetYaxis()->SetTitle(histo->GetYaxis()->GetTitle());
1550 +  
1551 +  h->GetXaxis()->CenterTitle();
1552 +  h->GetYaxis()->CenterTitle();
1553 +  
1554 +  for(unsigned int i=0;i<vals.size();i++) {
1555 +    h->SetBinContent(i+1,vals[i]);
1556 +    h->SetBinError(i+1,errs[i]);
1557 +  }
1558 +  
1559 +  return h;
1560 + }
1561 +
1562 +
1563 +  
1564 + void ShowBinning(TH1F *histo) {
1565 +  cout << "Showing binning for " << histo->GetName() << " (\" " << histo->GetTitle() << "\")" << endl;
1566 +  for(unsigned int i=1;i<=histo->GetNbinsX();i++) cout << "   Bin " << i << " : " << histo->GetBinLowEdge(i) << " , " << histo->GetBinLowEdge(i) + histo->GetBinWidth(i) << "  : " << histo->GetBinContent(i) << endl;
1567 + }
1568 +  
1569 + void QuickProduceMCSystematicPlot(string variable, int nbins, float bmin, float bmax, string label, TCut thiscut, string saveas) {
1570 +  TCanvas *ca = new TCanvas("ca","ca");
1571 +  TH1F *tScaleUp = systsamples.Draw("tScaleUp",variable,nbins,bmin,bmax,label,"events",thiscut,mc,luminosity,systsamples.FindSample("scaleup"));
1572 +  TH1F *tScaleDown = systsamples.Draw("tScaleDown",variable,nbins,bmin,bmax,label,"events",thiscut,mc,luminosity,systsamples.FindSample("scaledown"));
1573 +  TH1F *tMatchingUp = systsamples.Draw("tMatchingUp",variable,nbins,bmin,bmax,label,"events",thiscut,mc,luminosity,systsamples.FindSample("matchingup"));
1574 +  TH1F *tMatchingDown = systsamples.Draw("tMatchingDown",variable,nbins,bmin,bmax,label,"events",thiscut,mc,luminosity,systsamples.FindSample("matchingdown"));
1575 +  TH1F *tCentral = systsamples.Draw("tCentral",variable,nbins,bmin,bmax,label,"events",thiscut,mc,luminosity,systsamples.FindSample("TTJets_MassiveBinDECAY_TuneZ2sta"));
1576 +  
1577 +  tScaleUp->Scale(1.0/tScaleUp->Integral());
1578 +  tScaleDown->Scale(1.0/tScaleDown->Integral());
1579 +  tMatchingDown->Scale(1.0/tMatchingDown->Integral());
1580 +  tMatchingUp->Scale(1.0/tMatchingUp->Integral());
1581 +  tCentral->Scale(1.0/tCentral->Integral());
1582 +  
1583 +  cout << "At this point we want to rebin the scale/matching histograms so we get decent stats!" << endl;
1584 +  
1585 +  
1586 +  TH1F *rtScaleUp = ReBinOptimizingStats(7,tScaleUp); // using the scale up sample to get the binning (shouldn't use the central one for obvious reasons)
1587 +  TH1F *rtScaleDown = ImposeBinning(rtScaleUp,tScaleDown);
1588 +  TH1F *rtMatchingDown = ImposeBinning(rtScaleUp,tMatchingDown);
1589 +  TH1F *rtMatchingUp = ImposeBinning(rtScaleUp,tMatchingUp);
1590 +  TH1F *rtCentral = ImposeBinning(rtScaleUp,tCentral);
1591 +  
1592 +  float min=rtScaleUp->GetMinimum();
1593 +  float max=rtScaleUp->GetMaximum();
1594 +  
1595 +  if(rtScaleDown->GetMinimum()<min) min=rtScaleDown->GetMinimum();
1596 +  if(rtMatchingDown->GetMinimum()<min) min=rtMatchingDown->GetMinimum();
1597 +  if(rtMatchingDown->GetMinimum()<min) min=rtMatchingDown->GetMinimum();
1598 +  if(rtMatchingUp->GetMinimum()<min) min=rtMatchingUp->GetMinimum();
1599 +  if(rtCentral->GetMinimum()<min) min=rtCentral->GetMinimum();
1600 +  
1601 +  if(rtScaleDown->GetMaximum()<min) max=rtScaleDown->GetMaximum();
1602 +  if(rtMatchingDown->GetMaximum()<min) max=rtMatchingDown->GetMaximum();
1603 +  if(rtMatchingDown->GetMaximum()<min) max=rtMatchingDown->GetMaximum();
1604 +  if(rtMatchingUp->GetMaximum()<min) max=rtMatchingUp->GetMaximum();
1605 +  if(rtCentral->GetMaximum()<min) max=rtCentral->GetMaximum();
1606 +  
1607 +  rtCentral->SetMaximum(1.2*max);
1608 +  rtCentral->SetMinimum(0.8*min);
1609 +  
1610 + /*  tScaleUp->Rebin(40);
1611 +  tScaleDown->Rebin(40);
1612 +  tMatchingDown->Rebin(40);
1613 +  tMatchingUp->Rebin(40);
1614 +  tCentral->Rebin(40);*/
1615 +  
1616 +  TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1);
1617 +  kinpad->SetLogy(1);
1618 +  kinpad->cd();
1619 +  tCentral->SetFillColor(kWhite);
1620 +  tCentral->SetLineColor(kBlack);
1621 +  tScaleUp->SetLineColor(kRed);
1622 +  tScaleDown->SetLineColor(kRed);
1623 +  tMatchingUp->SetLineColor(kBlue);
1624 +  tMatchingDown->SetLineColor(kBlue);
1625 +  tScaleUp->SetLineStyle(2);
1626 +  tScaleDown->SetLineStyle(3);
1627 +  tMatchingUp->SetLineStyle(2);
1628 +  tMatchingDown->SetLineStyle(3);
1629 +  
1630 +  rtScaleDown->SetLineColor(kRed);
1631 +  rtMatchingUp->SetLineColor(kBlue);
1632 +  rtMatchingDown->SetLineColor(kBlue);
1633 +  rtScaleUp->SetLineStyle(2);
1634 +  rtScaleDown->SetLineStyle(3);
1635 +  rtMatchingUp->SetLineStyle(2);
1636 +  rtMatchingDown->SetLineStyle(3);
1637 +  
1638 +  TLegend *leg2 = make_legend();
1639 +  leg2->AddEntry(tCentral,"Central (ttbar)","l");
1640 +  leg2->AddEntry(tScaleUp,"ScaleUp (ttbar)","l");
1641 +  leg2->AddEntry(tScaleDown,"ScaleDown (ttbar)","l");
1642 +  leg2->AddEntry(tMatchingUp,"MatchingUp (ttbar)","l");
1643 +  leg2->AddEntry(tMatchingDown,"MatchingDown (ttbar)","l");
1644 +  
1645 +  tCentral->Draw("histo");
1646 +  tScaleUp->Draw("histo,same");
1647 +  tScaleDown->Draw("histo,same");
1648 +  tMatchingUp->Draw("histo,same");
1649 +  tMatchingDown->Draw("histo,same");
1650 +  leg2->Draw();
1651 +  DrawMCPrelim();
1652 +  CompleteSave(kinpad,saveas+"__TTbarComparison");
1653 +  kinpad->cd();
1654 +  kinpad->SetLogy(0);
1655 +  rtCentral->Draw("histo");
1656 +  rtScaleUp->Draw("histo,same");
1657 +  rtScaleDown->Draw("histo,same");
1658 +  rtMatchingUp->Draw("histo,same");
1659 +  rtMatchingDown->Draw("histo,same");
1660 +  leg2->Draw();
1661 +  DrawMCPrelim();
1662 +  CompleteSave(kinpad,saveas+"__TTbarComparison__REBINNED");
1663 +  
1664 +  
1665 +  gStyle->SetOptFit(0);
1666 +
1667 +  kinpad->cd();
1668 +  kinpad->SetLogy(0);
1669 +  TH1F *MatchingRatio = (TH1F*)rtMatchingUp->Clone("MatchingRatio");
1670 +  MatchingRatio->Divide(rtMatchingDown);
1671 +  TLine *lone = new TLine(tScaleUp->GetBinLowEdge(1),1,tScaleUp->GetBinLowEdge(tScaleUp->GetNbinsX())+tScaleUp->GetBinWidth(tScaleUp->GetNbinsX()),1);
1672 +  lone->SetLineColor(TColor::GetColor("#01DF01"));
1673 +  lone->SetLineStyle(2);
1674 +  TH1F *ScaleRatio = (TH1F*)rtScaleUp->Clone("ScaleRatio");
1675 +  ScaleRatio->Divide(rtScaleDown);
1676 +  MatchingRatio->GetYaxis()->SetRangeUser(0,3);
1677 +  MatchingRatio->Draw("e1");
1678 +  TF1 *QP1 = new TF1("QP1","[0]+[1]*x",50,200);//simple linear function ranging from 50 to 200
1679 +  if(variable=="genMET" || variable=="met[4]" || variable=="met[1]") MatchingRatio->Fit("QP1","RQ");
1680 +  lone->Draw();
1681 +  stringstream summary;
1682 +  summary << " #splitline{Fit result for f(x) = a+bx :}{#splitline{a=" << DigitsAfterComma(QP1->GetParameter(0),4) << " +/- " << DigitsAfterComma(QP1->GetParError(0),4) << "}{b=" << DigitsAfterComma(QP1->GetParameter(1),4);
1683 +  summary << " +/- " << DigitsAfterComma(QP1->GetParError(1),4) << "}}";
1684 +  TText *infobox = write_title(summary.str());
1685 +  infobox->SetX(0.75);
1686 +  infobox->SetTextSize(0.03);
1687 +  infobox->SetY(0.75);
1688 +  if(variable=="genMET" || variable=="met[4]" || variable=="met[1]") infobox->Draw();
1689 +  DrawMCPrelim();
1690 +  CompleteSave(kinpad,saveas+"__TTbarComparison_MatchingUpDividedMatchingDown");
1691 +  kinpad->cd();
1692 +  ScaleRatio->GetYaxis()->SetRangeUser(0,3);
1693 +  ScaleRatio->Draw("e1");
1694 +  if(variable=="genMET" || variable=="met[4]" || variable=="met[1]") ScaleRatio->Fit("QP1","RQ");
1695 +  summary.str("");
1696 +  summary << " #splitline{Fit result for f(x) = a+bx :}{#splitline{a=" << DigitsAfterComma(QP1->GetParameter(0),4) << " +/- " << DigitsAfterComma(QP1->GetParError(0),4) << "}{b=" << DigitsAfterComma(QP1->GetParameter(1),4);
1697 +  summary << " +/- " << DigitsAfterComma(QP1->GetParError(1),4) << "}}";
1698 +  TText *infobox2 = write_title(summary.str());
1699 +  infobox2->SetX(0.75);
1700 +  infobox2->SetTextSize(0.03);
1701 +  infobox2->SetY(0.75);
1702 +  if(variable=="genMET" || variable=="met[4]" || variable=="met[1]") infobox2->Draw();
1703 +
1704 +  lone->Draw();
1705 +  DrawMCPrelim();
1706 +  CompleteSave(kinpad,saveas+"__TTbarComparison_ScaleUpDividedScaleDown");
1707 +  
1708 +  kinpad->cd();
1709 +  TH1F *SysMatching = (TH1F*)rtMatchingDown->Clone("SysMatching");
1710 +  TH1F *SysScale = (TH1F*)rtScaleDown->Clone("SysMatching");
1711 +  TH1F *SysHisto = (TH1F*)rtScaleDown->Clone("SysHisto");
1712 +  
1713 +  for(int i=1;i<=SysScale->GetNbinsX();i++) {
1714 +    float matching, scale;
1715 +    bool AssumeFactor=false;
1716 +    if(AssumeFactor) {
1717 +      // assume that an upward/downward variation means a change by a constant factor, i.e. f(up) = alpha * f(central)
1718 +      matching=0.;
1719 +      scale=0.;
1720 +    } else {
1721 +      // assume that the central value is exactly between up & down, i.e. central = (up-down)/2
1722 +      matching = fabs(    ( rtMatchingUp->GetBinContent(i) - rtMatchingDown->GetBinContent(i)) / (rtMatchingUp->GetBinContent(i) + rtMatchingDown->GetBinContent(i)) );
1723 +      scale    = fabs(    ( rtScaleUp->GetBinContent(i) - rtScaleDown->GetBinContent(i)) / (rtScaleUp->GetBinContent(i) + rtScaleDown->GetBinContent(i)) );
1724 +    }
1725 +    
1726 +    SysMatching->SetBinContent(i,1+matching);
1727 +    SysScale->SetBinContent(i,1+scale);
1728 +    SysHisto->SetBinContent(i,sqrt(matching*matching+scale*scale)+1);
1729 +  }
1730 +  
1731 +  SysHisto->SetLineColor(kGreen);
1732 +  
1733 +  SysMatching->SetMaximum(3.0);
1734 +  SysMatching->SetMinimum(0.0);
1735 +  SysMatching->Draw("histo");
1736 +  SysScale->Draw("histo,same");
1737 +  SysHisto->Draw("histo,same");
1738 +  CompleteSave(kinpad,saveas+"__TTbarComparison_DerivedSystematic");
1739 +  
1740 +  delete SysMatching;
1741 +  delete SysScale;
1742 +  
1743 +  if(!Contains(variable,"gen")) {
1744 +    TH1F *hdata  = allsamples.Draw("hdata",   variable,nbins,bmin,bmax,label,"events",thiscut,data,luminosity);
1745 +    THStack smc = allsamples.DrawStack("smc",variable,nbins,bmin,bmax,label,"events",thiscut,mc,luminosity);
1746 +    
1747 +    TH1F *Systematic = (TH1F*)hdata->Clone("Systematic");
1748 +    
1749 +    for(int i=1;i<=Systematic->GetNbinsX();i++) {
1750 +      int iBin=SysHisto->FindBin(Systematic->GetBinCenter(i));
1751 +      if(iBin>SysHisto->GetNbinsX()) --iBin; // if we're over the end of the histo, use the last bin
1752 +      float sys = SysHisto->GetBinContent(iBin)-1;
1753 +      Systematic->SetBinContent(i,sys);
1754 +    }
1755 +    
1756 +    kinpad->cd();
1757 +    TLegend *leg = allsamples.allbglegend();
1758 +    hdata->Draw();
1759 +    smc.Draw("histo,same");
1760 +    hdata->Draw("same");
1761 +    leg->Draw();
1762 +    DrawPrelim();
1763 +    save_with_ratio_and_sys_band( hdata, CollapseStack(smc), kinpad->cd(), saveas+"__DataVsMC", false, false, "data/mc",Systematic );
1764 +    
1765 +    delete Systematic;
1766 +    delete hdata;
1767 +  }
1768 +  
1769 +  
1770 +  delete SysHisto;
1771 +  delete tScaleUp;
1772 +  delete tScaleDown;
1773 +  delete tCentral;
1774 +  delete tMatchingUp;
1775 +  delete tMatchingDown;
1776 +  delete rtScaleUp;
1777 +  delete rtScaleDown;
1778 +  delete rtCentral;
1779 +  delete rtMatchingUp;
1780 +  delete rtMatchingDown;
1781 +  delete QP1;
1782 +  delete infobox;
1783 +  delete infobox2;
1784 +  delete MatchingRatio;
1785 +  delete ScaleRatio;
1786 +  delete leg2;
1787 +  CleanLegends();
1788 +  delete ca;
1789 + }
1790 +
1791   void ProduceMCSystematicPlots() {
1792 +  cout << "Getting ready to produce systematic plots " << endl;
1793    TCut cutweightBKP = cutWeight;
1794    
1795 <  ProduceMCSystematicPlot("met[4]",80,0,400,"PFMET [GeV]",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_SameFlavor");
1796 <  ProduceMCSystematicPlot("met[4]",80,0,400,"PFMET [GeV]",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_OppositeFlavor");
1797 <  ProduceMCSystematicPlot("pfJetGoodNum40",8,-0.5,7.5,"NJets",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70&&met[4]>100"),"MCSystPlots/NJets/ETH_SameFlavor");
1798 <  ProduceMCSystematicPlot("pfJetGoodNum40",8,-0.5,7.5,"NJets",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70&&met[4]>100"),"MCSystPlots/NJets/ETH_OppositeFlavor");
1795 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/ETH_SameFlavor");
1796 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/ETH_OppositeFlavor");
1797 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_SameFlavor");
1798 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_OppositeFlavor");
1799 >  
1800 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/ETH_SameFlavor_INCLUSIVE");
1801 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/ETH_OppositeFlavor_INCLUSIVE");  
1802 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/genMET/ETH_SameFlavor_INCLUSIVE_HighMass");
1803 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/genMET/ETH_OppositeFlavor_INCLUSIVE_HighMass");  
1804 >  
1805 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_SameFlavor_INCLUSIVE");
1806 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_OppositeFlavor_INCLUSIVE");
1807 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/MET/ETH_SameFlavor_INCLUSIVE_HighMass");
1808 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/MET/ETH_OppositeFlavor_INCLUSIVE_HighMass");
1809 >  QuickProduceMCSystematicPlot("pfJetGoodNum40",8,-0.5,7.5,"NJets",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70&&met[4]>100"),"MCSystPlots/NJets/ETH_SameFlavor");
1810 >  QuickProduceMCSystematicPlot("pfJetGoodNum40",8,-0.5,7.5,"NJets",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70&&met[4]>100"),"MCSystPlots/NJets/ETH_OppositeFlavor");
1811 >  
1812 >  
1813 >  
1814 >  cout << "Kicking cutWeight  " << (const char*) cutWeight << endl;
1815 >  cout << "Keeping OSSF cut " << (const char*)cutOSSF << endl;
1816 >  cutWeight="1.0";
1817 >  
1818 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/ETH_SameFlavor_INCLUSIVE__NOPURW");
1819 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/ETH_OppositeFlavor_INCLUSIVE__NOPURW");  
1820 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/genMET/ETH_SameFlavor_INCLUSIVE_HighMass__NOPURW");
1821 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/genMET/ETH_OppositeFlavor_INCLUSIVE_HighMass__NOPURW");  
1822 >  
1823 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_SameFlavor_INCLUSIVE__NOPURW");
1824 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_OppositeFlavor_INCLUSIVE__NOPURW");
1825 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/MET/ETH_SameFlavor_INCLUSIVE_HighMass__NOPURW");
1826 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/MET/ETH_OppositeFlavor_INCLUSIVE_HighMass__NOPURW");
1827 >  
1828 >  
1829 >  // --------------------------------------    ***** AACHEN *****      --------------------------------------    
1830 >  
1831 >  /*
1832 >  cutWeight=cutweightBKP;
1833 >  TCut essentialcutBKP = essentialcut;
1834 >  cout << (const char*) essentialcut << endl;
1835 >  
1836 >  essentialcut = TCut((ReplaceAll((const char*)essentialcut,"pt2>20","pt2>10")).c_str());
1837 >  essentialcut = TCut((ReplaceAll((const char*)essentialcut,"abs(eta1)<1.4","abs(eta1)<2.4")).c_str());
1838 >  essentialcut = TCut((ReplaceAll((const char*)essentialcut,"abs(eta2)<1.4","abs(eta2)<2.4")).c_str());
1839    
1840    TCut cutnJetsBKP = cutnJets;
1841    cutnJets = TCut((ReplaceAll((const char*)cutnJets,"pt2>20","pt2>10")).c_str());
# Line 1396 | Line 1843 | void ProduceMCSystematicPlots() {
1843    cutnJets = TCut((ReplaceAll((const char*)cutnJets,"abs(eta2)<1.4","abs(eta2)<2.4")).c_str());
1844    cutnJets = TCut((ReplaceAll((const char*)cutnJets,"abs(eta1)<1.4","abs(eta1)<2.4")).c_str());
1845    
1846 <  ProduceMCSystematicPlot("met[4]",80,0,400,"PFMET [GeV]",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_SameFlavor");
1847 <  ProduceMCSystematicPlot("met[4]",80,0,400,"PFMET [GeV]",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_OppositeFlavor");
1848 <  ProduceMCSystematicPlot("pfJetGoodNum40",8,-0.5,7.5,"NJets",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70&&met[4]>150"),"MCSystPlots/NJets/Aachen_SameFlavor");
1849 <  ProduceMCSystematicPlot("pfJetGoodNum40",8,-0.5,7.5,"NJets",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70&&met[4]>150"),"MCSystPlots/NJets/Aachen_OppositeFlavor");
1846 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/Aachen_SameFlavor");
1847 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/Aachen_OppositeFlavor");  
1848 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_SameFlavor");
1849 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_OppositeFlavor");
1850 >  
1851 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/Aachen_SameFlavor_INCLUSIVE");
1852 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/Aachen_OppositeFlavor_INCLUSIVE");  
1853 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/genMET/Aachen_SameFlavor_INCLUSIVE_HighMass");
1854 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/genMET/Aachen_OppositeFlavor_INCLUSIVE_HighMass");  
1855 >  
1856 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_SameFlavor_INCLUSIVE");
1857 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_OppositeFlavor_INCLUSIVE");
1858 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/MET/Aachen_SameFlavor_INCLUSIVE_HighMass");
1859 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/MET/Aachen_OppositeFlavor_INCLUSIVE_HighMass");
1860 >  QuickProduceMCSystematicPlot("pfJetGoodNum40",8,-0.5,7.5,"NJets",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70&&met[4]>100"),"MCSystPlots/NJets/Aachen_SameFlavor");
1861 >  QuickProduceMCSystematicPlot("pfJetGoodNum40",8,-0.5,7.5,"NJets",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70&&met[4]>100"),"MCSystPlots/NJets/Aachen_OppositeFlavor");
1862 >  
1863 >  
1864 >  
1865 >  cout << "Kicking cutWeight  " << (const char*) cutWeight << endl;
1866 >  cout << "Keeping OSSF cut " << (const char*)cutOSSF << endl;
1867 >  cutWeight="1.0";
1868 >  
1869 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/Aachen_SameFlavor_INCLUSIVE__NOPURW");
1870 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/Aachen_OppositeFlavor_INCLUSIVE__NOPURW");  
1871 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/genMET/Aachen_SameFlavor_INCLUSIVE_HighMass__NOPURW");
1872 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/genMET/Aachen_OppositeFlavor_INCLUSIVE_HighMass__NOPURW");  
1873 >  
1874 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_SameFlavor_INCLUSIVE__NOPURW");
1875 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_OppositeFlavor_INCLUSIVE__NOPURW");
1876 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/MET/Aachen_SameFlavor_INCLUSIVE_HighMass__NOPURW");
1877 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/MET/Aachen_OppositeFlavor_INCLUSIVE_HighMass__NOPURW");
1878 >  
1879    cutnJets  = cutnJetsBKP;
1880    cutWeight = cutweightBKP;
1881 +  essentialcut = essentialcutBKP;
1882 +  */
1883 +  write_error(__FUNCTION__,"Still need to add systematic shape");assert(0);
1884 + }
1885 +
1886 + void MakeTauPlot(string label, TCut pcut, string filename, bool TauOnly) {
1887 +  TCut cut=pcut&&basiccut;
1888 +  string variable="mll";
1889 +  string xlabel="m_{ll} [GeV]";
1890 +  int nbins=40;
1891 +  float min=0;
1892 +  float max=200;
1893 +
1894 +  TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600);
1895 +  TH1F *datahistoSF = allsamples.Draw("datahistoSF",variable,nbins,min,max, xlabel, "events",cut&&cutOSSF,data,luminosity);
1896 +  TH1F *datahistoOF = allsamples.Draw("datahistoOF",variable,nbins,min,max, xlabel, "events",cut&&cutOSOF,data,luminosity);
1897 +  TH1F *tauSF = allsamples.Draw("tauSF",variable,nbins,min,max, xlabel, "events",cut&&cutOSSF,data,luminosity,systsamples.FindSample("DYToTauTau"));
1898 +  TH1F *tauOF = allsamples.Draw("tauOF",variable,nbins,min,max, xlabel, "events",cut&&cutOSOF,data,luminosity,systsamples.FindSample("DYToTauTau"));
1899 +  datahistoSF->SetMarkerSize(DataMarkerSize);
1900 +  datahistoSF->SetMaximum(1.3*datahistoSF->GetMaximum());
1901 +  datahistoOF->SetMarkerSize(DataMarkerSize);
1902 +  datahistoOF->SetMaximum(1.3*datahistoOF->GetMaximum());
1903 +
1904 +  THStack mcstackSF   = allsamples.DrawStack("mcstackSF",  variable,nbins,min,max,xlabel,"events",cut&&cutOSSF,mc,luminosity);
1905 +  THStack mcstackOF   = allsamples.DrawStack("mcstackOF",  variable,nbins,min,max,xlabel,"events",cut&&cutOSOF,mc,luminosity);
1906 +  datahistoSF->Draw("e1");
1907 +  ckin->Update();
1908 +  mcstackSF.Draw("histo,same");
1909 +  
1910 +  datahistoSF->Draw("same,e1");
1911 +  TLegend *kinleg = allsamples.allbglegend();
1912 +  kinleg->Draw();
1913 +  
1914 +  TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1);
1915 +  kinpad->cd();
1916 +  datahistoSF->Draw("e1");
1917 +  mcstackSF.Draw("histo,same");
1918 +  datahistoSF->Draw("same,e1");
1919 +  datahistoSF->Draw("same,axis");
1920 +  kinleg->Draw();
1921 +  DrawPrelim();
1922 +  Save_With_Ratio(datahistoSF,mcstackSF,kinpad->cd(),filename+"__SF_mc");
1923 +  
1924 +  kinpad->cd();
1925 +  datahistoOF->Draw("e1");
1926 +  mcstackOF.Draw("histo,same");
1927 +  datahistoOF->Draw("same,e1");
1928 +  datahistoOF->Draw("same,axis");
1929 +  kinleg->Draw();
1930 +  DrawPrelim();
1931 +  Save_With_Ratio(datahistoOF,mcstackOF,kinpad->cd(),filename+"__OF_mc");
1932 +  
1933 +  kinpad->cd();
1934 +  tauSF->Draw("e1");
1935 +  tauOF->Draw("histo,same");
1936 +  tauSF->Draw("e1,same");
1937 +  TLegend *legtau = make_legend();
1938 +  legtau->AddEntry(tauSF,"DY->#tau#tau, SF","p");
1939 +  legtau->AddEntry(tauSF,"DY->#tau#tau, OF","l");
1940 +  legtau->Draw();
1941 +  DrawPrelim();
1942 +  Save_With_Ratio(tauSF,tauOF,kinpad->cd(),filename+"__Tau_SF_vs_OF");
1943 +  
1944 +  delete datahistoSF;
1945 +  delete datahistoOF;
1946 +  delete tauSF;
1947 +  delete tauOF;
1948 +  delete kinpad;
1949 +  delete ckin;
1950 +  CleanLegends();
1951 + }
1952 +  
1953 +
1954 + void TauQuestion() {
1955 + //   MakeTauPlot("MET>100 GeV, #geq 3 jets",cutnJets&&TCut("met[4]>100"),"TauQ/MET100_3Jets",true);
1956 + //   MakeTauPlot("MET>100 GeV",TCut("met[4]>100"),"TauQ/MET100",true);
1957 + //   MakeTauPlot("MET>0 GeV",TCut("met[4]>0"),"TauQ/MET0",true);
1958 +  MakeTauPlot("b-tag veto, 50<MET<100",TCut("pfJetGoodNumBtag30==0&&met[4]>50&&met[4]<100"),"TauQ/ControlPlots",false);
1959   }
1960  
1961   void do_kinematic_plots(string mcjzb, string datajzb, bool doPF=false)
# Line 1410 | Line 1964 | void do_kinematic_plots(string mcjzb, st
1964    bool dolog=true;
1965    bool nolog=false;
1966  
1967 <  bool doOFSF = true;
1967 >  bool doOFSF = false;
1968    bool doKin  = true;
1969 <  bool doDataComp = true;
1970 <  bool MakeTwoThreeJetComparison = true;
1969 >  bool doDataComp = false;
1970 >  bool MakeTwoThreeJetComparison = false;
1971    
1972  
1973    if(doPF) write_warning(__FUNCTION__,"Please use caution when trying to produce PF plots; not all versions of the JZB trees have these variables!");
# Line 1425 | Line 1979 | void do_kinematic_plots(string mcjzb, st
1979    }
1980    
1981    if(MakeTwoThreeJetComparison) MakeElegantTwoThreeComparisons();
1982 +  
1983 +  //TauQuestion();
1984  
1985    //ProduceJanPlots();
1986 < //   ProduceMCSystematicPlots();
1987 <  make_plain_kin_plot("pt",Cut2Str(cutOSSF&&TCut("mll>20&&pfJetGoodNumBtag30>=2")),40,0,200,nolog,"Z p_{T}","PlotForKostas",doPF,true);
1986 >  ProduceMCSystematicPlots();
1987 >  assert(0);
1988 > //  make_plain_kin_plot("pt",Cut2Str(cutOSSF&&TCut("mll>20&&pfJetGoodNumBtag30>=2")),40,0,200,nolog,"Z p_{T}","PlotForKostas",doPF,true);
1989    
1990    if ( doOFSF ) {
1991       make_OFSF_plots("mll", "met[4]>100", 60, 20., 320., false, "m_{ll}", "mll");
1992 +     make_OFSF_plots("met[4]", "met[4]>100", 30, 100., 400., false, "PFMET", "met");
1993 +     make_OFSF_plots("leptonNum", "met[4]>100", 3, 2, 5., false, "N(leptons)", "NLeptons");
1994  
1995       make_OFSF_plots("pfJetGoodNum40", "met[4]>100",                        7, 3, 10, true, "#(jets)", "njets");
1996       make_OFSF_plots("pfJetGoodNum40", "met[4]>100&&pfJetGoodNumBtag30==0", 7, 3, 10, true, "#(jets)", "njets_btagVeto");
# Line 1603 | Line 2162 | void do_kinematic_plots(string mcjzb, st
2162      make_kin_plot("MetFactor","",20,0,2,nolog,"MetFactor","MetFactor",doPF,true);
2163      
2164      make_ttbar_comparison("met[4]",40,0,400,(cutOSOF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==2")),dolog,"PFMET","Debunking/MET_OF_30to70_2j__ALLMCSAMPLES");
2165 <    
2165 >    /*
2166      DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==0")),dolog,"PFMET","Debunking/MET_OF_30to70_0j");
2167      DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==1")),dolog,"PFMET","Debunking/MET_OF_30to70_1j");
2168      DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==2")),dolog,"PFMET","Debunking/MET_OF_30to70_2j");
2169      DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==3")),dolog,"PFMET","Debunking/MET_OF_30to70_3j");
2170  
2171 +    DoMCSystPlot("met[4]",40,0,400,(cutOSSF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==0")),dolog,"PFMET","Debunking/MET_SF_30to70_0j");
2172 +    DoMCSystPlot("met[4]",40,0,400,(cutOSSF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==1")),dolog,"PFMET","Debunking/MET_SF_30to70_1j");
2173 +    DoMCSystPlot("met[4]",40,0,400,(cutOSSF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==2")),dolog,"PFMET","Debunking/MET_SF_30to70_2j");
2174 +    DoMCSystPlot("met[4]",40,0,400,(cutOSSF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==3")),dolog,"PFMET","Debunking/MET_SF_30to70_3j");
2175 +
2176      DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>80&&mll<100&&pfJetGoodNum40==0")),dolog,"PFMET","Debunking/MET_OF_Z_0j");
2177      DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>80&&mll<100&&pfJetGoodNum40==1")),dolog,"PFMET","Debunking/MET_OF_Z_1j");
2178      DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>80&&mll<100&&pfTightHT>100&&pfJetGoodNum40==2")),dolog,"PFMET","Debunking/MET_OF_Z_2j");
# Line 1693 | Line 2257 | void do_kinematic_plots(string mcjzb, st
2257      
2258      //   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);
2259      //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);
2260 <    //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);
2260 >    //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);*/
2261    }
2262 <    
2262 >    /*
2263     make_special_obs_pred_mll_plot(datajzb,mcjzb,0);
2264     make_special_obs_pred_mll_plot(datajzb,mcjzb,50);
2265     make_special_obs_pred_mll_plot(datajzb,mcjzb,80);
# Line 1706 | Line 2270 | void do_kinematic_plots(string mcjzb, st
2270  
2271     make_JES_plot(cutmass&&cutOSSF&&basiccut,"_ossf");
2272     make_JES_plot(cutmass&&cutOSOF&&basiccut,"_osof");
2273 <
2273 > */
2274    switch_overunderflow(false);
2275   }
2276  
# Line 3348 | Line 3912 | void find_correction_factors(string &jzb
3912    
3913   }
3914  
3915 < void pick_up_events(string cut) {
3916 <  dout << "Picking up events with cut " << cut << endl;
3353 <  allsamples.PickUpEvents(cut);
3915 > void pick_up_events(string cut, string filename) {
3916 >  allsamples.PickUpEvents(cut,filename);
3917   }
3918  
3919   void save_template(string mcjzb, string datajzb,vector<float> jzb_cuts,float MCPeakError,float DataPeakError, vector<float> jzb_shape_limit_bins) {
# Line 3462 | Line 4025 | void ttbar_sidebands_comparison(string m
4025        
4026    float simulatedlumi = luminosity; //in pb please - adjust to your likings
4027  
4028 <  TH1F *TZem  = systsamples.Draw("TZem",     mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
4029 <  TH1F *nTZem = systsamples.Draw("nTZem","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
4028 >  TH1F *TZem  = allsamples.Draw("TZem",     mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT"));
4029 >  TH1F *nTZem = allsamples.Draw("nTZem","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT"));
4030    TH1F *TSem;
4031    TH1F *nTSem;
4032 <  TH1F *TZeemm  = systsamples.Draw("TZeemm",     mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
4033 <  TH1F *nTZeemm = systsamples.Draw("nTZeemm","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
4032 >  TH1F *TZeemm  = allsamples.Draw("TZeemm",     mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT"));
4033 >  TH1F *nTZeemm = allsamples.Draw("nTZeemm","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT"));
4034    TH1F *TSeemm;
4035    TH1F *nTSeemm;
4036    
4037    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
4038 <    TSem    = systsamples.Draw("TSem",       mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
4039 <    nTSem   = systsamples.Draw("nTSem",  "-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
4040 <    TSeemm  = systsamples.Draw("TSeemm",     mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
4041 <    nTSeemm = systsamples.Draw("nTSeemm","-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
4038 >    TSem    = allsamples.Draw("TSem",       mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT"));
4039 >    nTSem   = allsamples.Draw("nTSem",  "-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT"));
4040 >    TSeemm  = allsamples.Draw("TSeemm",     mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT"));
4041 >    nTSeemm = allsamples.Draw("nTSeemm","-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT"));
4042    }
4043  
4044    TCanvas *tcan = new TCanvas("tcan","tcan");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines