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.87 by buchmann, Mon Feb 25 18:00:09 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 +  
98 +  TCanvas *can = new TCanvas("can","can");
99 +  float mcSigma,mcSigmaError,dataSigma,dataSigmaError;
100 +  
101 +  float NumVtxBin[6] = {0,5,10,15,20,30};
102 +  
103 +  stringstream NowCut;
104 +  
105 +  TGraphErrors *gMCPeak = new TGraphErrors();
106 +  gMCPeak->SetTitle("gMCPeak");
107 +  gMCPeak->SetName("gMCPeak");
108 +  TGraphErrors *gDataPeak = new TGraphErrors();
109 +  gDataPeak->SetTitle("gDataPeak");
110 +  gDataPeak->SetName("gDataPeak");
111 +  TGraphErrors *gMCWidth = new TGraphErrors();
112 +  gMCWidth->SetTitle("gMCWidth");
113 +  gMCWidth->SetName("gMCWidth");
114 +  TGraphErrors *gDataWidth = new TGraphErrors();
115 +  gDataWidth->SetTitle("gDataWidth");
116 +  gDataWidth->SetName("gDataWidth");
117 +  
118 +  for(int i=0;i<5;i++) {
119 +    NowCut.str("");
120 +    NowCut << "numVtx>=" << NumVtxBin[i] << "&&numVtx<" << NumVtxBin[i+1];
121 +    find_one_peak_combination(TCut(NowCut.str().c_str()),SwitchOffNJetsCut,MCPeak,MCPeakError, DataPeak,DataPeakError,mcSigma,mcSigmaError, dataSigma,dataSigmaError,result,doPUreweighting,"");
122 +    cout << "    " << MCPeak << " +/- " << MCPeakError << endl;
123 +    cout << "    " << DataPeak << " +/- " << DataPeakError << endl;
124 +    
125 +    gMCPeak->SetPoint(i,0.5*(NumVtxBin[i]+NumVtxBin[i+1]),MCPeak);
126 +    gMCPeak->SetPointError(i,0.5*(NumVtxBin[i+1]-NumVtxBin[i]),MCPeakError);
127 +    
128 +    gDataPeak->SetPoint(i,0.5*(NumVtxBin[i]+NumVtxBin[i+1]),DataPeak);
129 +    gDataPeak->SetPointError(i,0.5*(NumVtxBin[i+1]-NumVtxBin[i]),DataPeakError);
130 +    
131 +    gMCWidth->SetPoint(i,0.5*(NumVtxBin[i]+NumVtxBin[i+1]),mcSigma);
132 +    gMCWidth->SetPointError(i,0.5*(NumVtxBin[i+1]-NumVtxBin[i]),mcSigmaError);
133 +    
134 +    gDataWidth->SetPoint(i,0.5*(NumVtxBin[i]+NumVtxBin[i+1]),dataSigma);
135 +    gDataWidth->SetPointError(i,0.5*(NumVtxBin[i+1]-NumVtxBin[i]),dataSigmaError);
136 +  }
137 +  
138 +  can->cd();
139 +  gMCPeak->GetXaxis()->SetTitle("N(Vertices)");
140 +  gMCPeak->GetYaxis()->SetTitle("Peak position");
141 +  gMCPeak->GetXaxis()->CenterTitle();
142 +  gMCPeak->GetYaxis()->CenterTitle();
143 +  gDataPeak->GetXaxis()->SetTitle("N(Vertices)");
144 +  gDataPeak->GetYaxis()->SetTitle("Peak position");
145 +  gDataPeak->GetXaxis()->CenterTitle();
146 +  gDataPeak->GetYaxis()->CenterTitle();
147 +  
148 +  gDataWidth->GetXaxis()->SetTitle("N(Vertices)");
149 +  gDataWidth->GetYaxis()->SetTitle("#sigma_{JZB}");
150 +  gDataWidth->GetXaxis()->CenterTitle();
151 +  gDataWidth->GetYaxis()->CenterTitle();
152 +  gMCWidth->GetXaxis()->SetTitle("N(Vertices)");
153 +  gMCWidth->GetYaxis()->SetTitle("#sigma_{JZB}");
154 +  gMCWidth->GetXaxis()->CenterTitle();
155 +  gMCWidth->GetYaxis()->CenterTitle();
156 +  
157 +  gMCPeak->SetFillColor(TColor::GetColor("#2E9AFE"));
158 +  gDataPeak->SetFillColor(TColor::GetColor("#2E9AFE"));
159 +  gDataWidth->SetFillColor(TColor::GetColor("#2E9AFE"));
160 +  gMCWidth->SetFillColor(TColor::GetColor("#2E9AFE"));
161 +  
162 +  gMCPeak->Draw("A2");
163 +  DrawMCPrelim();
164 +  CompleteSave(can,"PUStudy/MCPeak");
165 +  can->cd();
166 +  gMCWidth->Draw("A2");
167 +  DrawMCPrelim();
168 +  CompleteSave(can,"PUStudy/MCWidth");
169 +  can->cd();
170 +  
171 +  gDataPeak->Draw("A2");
172 +  DrawPrelim();
173 +  CompleteSave(can,"PUStudy/DataPeak");
174 +  can->cd();
175 +  gDataWidth->Draw("A2");
176 +  DrawPrelim();
177 +  CompleteSave(can,"PUStudy/DataWidth");
178 +  
179 +  
180 +  
181 +  delete can;
182 +  
183 + }
184 +
185   void find_peaks(float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, stringstream &result, bool doPUreweighting, stringstream &datajzb, stringstream &mcjzb, string sSpecialCut="", bool SwitchOffNJetsCut=false)
186   {
187    bool overunderflowstatus=addoverunderflowbins;
# Line 285 | Line 380 | void make_special_obs_pred_mll_plot(stri
380    }
381    delete Bpred;
382    delete ckin;
383 +  CleanLegends();
384   }
385  
386   void make_special_mll_plot(int nbins, float min, float max, bool logscale,string xlabel) {
# Line 331 | Line 427 | void make_special_mll_plot(int nbins, fl
427    delete datahistoOSOF;
428    delete datahistoOSSF;
429    delete ckin;
430 +  CleanLegends();
431   }
432    
433  
# Line 384 | Line 481 | float make_one_OFSF_plot(string variable
481  
482    cutOF = cutOSOF&&cutnJets&&ibasiccut;
483    cutSF = cutOSSF&&cutnJets&&ibasiccut;
484 +  
485 +  TCanvas *ofsf_can = new TCanvas("ofsf_can","ofsf_can");
486  
487    TPad* rcan = new TPad("rcan","rcan",0,0,1,1);
488    rcan->SetLogy(logscale);
# Line 409 | Line 508 | float make_one_OFSF_plot(string variable
508    }
509    if (ymax<0) {
510      if ( logscale ) datahistoSF->SetMaximum(5.3*datahistoSF->GetMaximum());
511 <    else datahistoSF->SetMaximum(1.8*datahistoSF->GetMaximum());
511 >    else datahistoSF->SetMaximum(0.8*datahistoSF->GetMaximum());
512    } else {
513      datahistoSF->SetMaximum(ymax);
514    }
# Line 446 | Line 545 | float make_one_OFSF_plot(string variable
545    //signalhisto->Delete();
546    delete mleg;
547    delete rcan;
548 +  delete ofsf_can;
549  
550    return ymaxSet;
551  
# Line 924 | Line 1024 | void make_JES_plot(TCut cut, string name
1024    CompleteSave(ckin,"Systematics/JES"+name);
1025    datahisto->Delete();
1026    delete ckin;
1027 <
1027 >  delete JESunc;
1028 >  delete JESup;
1029 >  delete JESdn;
1030 >  CleanLegends();
1031   }
1032  
1033   string Cut2Str(TCut cut) {
# Line 1050 | Line 1153 | void make_ttbar_comparison(string datava
1153    
1154    TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600);
1155    ckin->SetLogy(dolog);
1156 <  cout << "\r Creating " << filename << " : data   (1/11)" << std::flush;
1156 >  cout << "\r Creating " << filename << " : data   (1/7)" << std::flush;
1157    TH1F *datahisto = allsamples.Draw("datahisto",datavariable,nbins,min,max, xlabel, "events",cut,data,luminosity);
1158    datahisto->SetMarkerSize(DataMarkerSize);
1159    if ( !dolog ) datahisto->SetMinimum(0); // Defaults
1160    else datahisto->SetMinimum(0.5);
1161    if (dolog) datahisto->SetMaximum(5.3*datahisto->GetMaximum());
1162    else datahisto->SetMaximum(1.3*datahisto->GetMaximum());
1163 <  cout << "\r Creating " << filename << " : MC central  (stack) (2/11)" << std::flush;
1163 >  cout << "\r Creating " << filename << " : MC central  (stack) (2/7)" << std::flush;
1164    THStack mcstack   = allsamples.DrawStack("mcstack",  mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity);
1165    TH1F *MCcentral = CollapseStack(mcstack);
1166  
1167 <  cout << "\r Creating " << filename << " : MC central (histo)   (3/11)" << std::flush;
1167 >  cout << "\r Creating " << filename << " : MC central (histo)   (3/7)" << std::flush;
1168    TH1F *TCentral        = allsamples.Draw ("TCentral",     mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,allsamples.FindSample("TTJets_"));
1169    TH1F *RCentral        = ProduceTTbarRatio(datahisto,MCcentral,TCentral,TCentral);
1170    
1171 <  cout << "\r Creating " << filename << " : MC Matching up   (4/11)" << std::flush;
1171 >  cout << "\r Creating " << filename << " : MC Matching up   (4/7)" << std::flush;
1172    TH1F *TMatchingUp     = systsamples.Draw("TMatchingUp",  mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,systsamples.FindSample("TTJets_matchingup"));
1173    TH1F *RMatchingUp     = ProduceTTbarRatio(datahisto,MCcentral,TCentral,TMatchingUp);
1174    
1175 <  cout << "\r Creating " << filename << " : MC Matching down   (5/11)" << std::flush;
1175 >  cout << "\r Creating " << filename << " : MC Matching down   (5/7)" << std::flush;
1176    TH1F *TMatchingDown   = systsamples.Draw("TMatchingDown",mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,systsamples.FindSample("TTJets_matchingdown"));
1177    TH1F *RMatchingDown   = ProduceTTbarRatio(datahisto,MCcentral,TCentral,TMatchingDown);
1178    
1179 <  cout << "\r Creating " << filename << " : MC Scale up   (6/11)" << std::flush;
1179 >  cout << "\r Creating " << filename << " : MC Scale up   (6/7)" << std::flush;
1180    TH1F *TScaleUp        = systsamples.Draw("TScaleUp",     mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,systsamples.FindSample("TTJets_scaleup"));
1181    TH1F *RScaleUp        = ProduceTTbarRatio(datahisto,MCcentral,TCentral,TScaleUp);
1182    
1183 <  cout << "\r Creating " << filename << " : MC Scale down   (7/11)" << std::flush;
1183 >  cout << "\r Creating " << filename << " : MC Scale down   (7/7)" << std::flush;
1184    TH1F *TScaleDown      = systsamples.Draw("TScaleDown",   mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,systsamples.FindSample("TTJets_scaledown"));
1185    TH1F *RScaleDown      = ProduceTTbarRatio(datahisto,MCcentral,TCentral,TScaleDown);
1186    
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  
1187    datahisto->Draw("e1");
1188    ckin->Update();
1189    mcstack.Draw("histo,same");
# Line 1135 | Line 1221 | void make_ttbar_comparison(string datava
1221    TScaleDown->SetLineColor(TColor::GetColor("#FF8500"));
1222    TScaleDown->SetLineStyle(3);//dotted
1223    
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  
1224    MCcentral->SetLineStyle(3);
1225    MCcentral->SetLineColor(kRed);
1226    
# Line 1158 | Line 1230 | void make_ttbar_comparison(string datava
1230    TMatchingDown->Draw("histo,same");
1231    TScaleUp->Draw("histo,same");
1232    TScaleDown->Draw("histo,same");
1161  Ttmass166->Draw("histo,same");
1162  Ttmass169->Draw("histo,same");
1163  Ttmass175->Draw("histo,same");
1164  Ttmass178->Draw("histo,same");
1233    
1234    TLegend *sleg = make_legend();
1235    sleg->AddEntry(TCentral,"Central","L");
# Line 1169 | Line 1237 | void make_ttbar_comparison(string datava
1237    sleg->AddEntry(TMatchingDown,"matching down","L");
1238    sleg->AddEntry(TScaleUp,"scale up","L");
1239    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");
1240    sleg->Draw();
1241    
1242    CompleteSave(ckin,saveas+"___AllLines");
# Line 1191 | Line 1255 | void make_ttbar_comparison(string datava
1255    RScaleDown->SetLineColor(TColor::GetColor("#FF8500"));
1256    RScaleDown->SetLineStyle(3);//dotted
1257    
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  
1258    RCentral->GetYaxis()->SetRangeUser(0,2);
1259    RCentral->Draw("e1");
1260    RMatchingUp->Draw("histo,same");
1261    RMatchingDown->Draw("histo,same");
1262    RScaleUp->Draw("histo,same");
1263    RScaleDown->Draw("histo,same");
1212  Rtmass166->Draw("histo,same");
1213  Rtmass169->Draw("histo,same");
1214  Rtmass175->Draw("histo,same");
1215  Rtmass178->Draw("histo,same");
1264    
1265    CompleteSave(ckin,saveas+"___AllRatios");
1266  
1267 <  TCanvas *multicanvas = new TCanvas("multicanvas","multicanvas",1000,1000);
1268 <  multicanvas->Divide(2,2);
1267 >  TCanvas *multicanvas = new TCanvas("multicanvas","multicanvas",1400,700);
1268 >  multicanvas->Divide(2,1);
1269    PresentRange(RMatchingUp,RMatchingDown,RCentral,multicanvas->cd(1),"Matching");
1270    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)");
1271    CompleteSave(multicanvas,saveas+"___RangeIllustration");
1272    
1273    
# Line 1231 | Line 1277 | void make_ttbar_comparison(string datava
1277    delete   TMatchingDown;
1278    delete   TScaleUp;
1279    delete   TScaleDown;
1280 <  delete   Ttmass166;
1281 <  delete   Ttmass169;
1282 <  delete   Ttmass175;
1283 <  delete   Ttmass178;
1280 > //   delete   Ttmass166;
1281 > //   delete   Ttmass169;
1282 > //   delete   Ttmass175;
1283 > //   delete   Ttmass178;
1284    
1285    delete ckin;
1286    
# Line 1273 | Line 1319 | void ProduceJanPlots() {
1319    delete c1;
1320   }
1321  
1322 < THStack MakeOneSystematicsPlot(TCut cut, string saveas, string variation, TH1F *hdata, string variable, int nbins, float bmin, float bmax, string label) {
1322 > THStack MakeOneSystematicsPlot(TCut cut, string saveas, string variation, TH1F *hdata, string variable, int nbins, float bmin, float bmax, string label, TH1F* &thisto) {
1323    THStack SystPlot = allsamples.DrawStack(variation,variable,nbins,bmin,bmax,label,"events",cut,mc,PlottingSetup::luminosity);
1324    
1325    //now need to process the plot (calculate the variation and set the member of thstack accordingly!)
# Line 1294 | Line 1340 | THStack MakeOneSystematicsPlot(TCut cut,
1340            h->SetBinContent(i,varttbar->GetBinContent(i));
1341            h->SetBinError(i,varttbar->GetBinError(i));
1342          }
1343 +        thisto=(TH1F*)varttbar->Clone(variation.c_str());
1344          SystPlot.Modified();
1345        }
1346      }
1347      delete varttbar;
1348 +  } else {
1349 +    TIter nextHisto(SystPlot.GetHists());
1350 +    TH1F* h;
1351 +    while ( h = (TH1F*)nextHisto() ) {
1352 +      if(Contains(h->GetName(),"t_bar_t")) thisto=(TH1F*)h->Clone(variation.c_str());
1353 +    }
1354    }
1355 <  
1355 >    
1356    TLegend *fullleg = allsamples.allbglegend();
1357    fullleg->SetHeader(variation.c_str());
1358    TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1);
# Line 1323 | Line 1376 | THStack MakeOneSystematicsPlot(TCut cut,
1376  
1377   void ProduceMCSystematicPlot(string variable, int nbins, float bmin, float bmax, string label, TCut thiscut, string saveas) {
1378    TCanvas *ca = new TCanvas("ca","ca");
1326
1379    TH1F *hdata = allsamples.Draw("hdata",variable,nbins,bmin,bmax,label,"events",thiscut,data,luminosity);
1380    
1381 <  THStack ScaleUp      = MakeOneSystematicsPlot(thiscut,saveas,"ScaleUp",hdata,variable, nbins, bmin, bmax, label);
1382 <  THStack ScaleDown    = MakeOneSystematicsPlot(thiscut,saveas,"ScaleDown",hdata,variable, nbins, bmin, bmax, label);
1383 <  THStack MatchingUp   = MakeOneSystematicsPlot(thiscut,saveas,"MatchingUp",hdata,variable, nbins, bmin, bmax, label);
1384 <  THStack MatchingDown = MakeOneSystematicsPlot(thiscut,saveas,"MatchingDown",hdata,variable, nbins, bmin, bmax, label);
1381 >  TH1F *tScaleUp,*tScaleDown,*tMatchingUp,*tMatchingDown,*tCentral;
1382 >  
1383 >  THStack ScaleUp      = MakeOneSystematicsPlot(thiscut,saveas,"ScaleUp",hdata,variable, nbins, bmin, bmax, label,tScaleUp);
1384 >  THStack ScaleDown    = MakeOneSystematicsPlot(thiscut,saveas,"ScaleDown",hdata,variable, nbins, bmin, bmax, label,tScaleDown);
1385 >  THStack MatchingUp   = MakeOneSystematicsPlot(thiscut,saveas,"MatchingUp",hdata,variable, nbins, bmin, bmax, label,tMatchingUp);
1386 >  THStack MatchingDown = MakeOneSystematicsPlot(thiscut,saveas,"MatchingDown",hdata,variable, nbins, bmin, bmax, label,tMatchingDown);
1387    
1388    TH1F *HScaleUp = CollapseStack(ScaleUp);
1389    TH1F *HScaleDown = CollapseStack(ScaleDown);
1390    TH1F *HMatchingUp = CollapseStack(MatchingUp);
1391    TH1F *HMatchingDown = CollapseStack(MatchingDown);
1392    
1393 <  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);
1393 >  THStack Central = MakeOneSystematicsPlot(thiscut,saveas,"Central",hdata,variable, nbins, bmin, bmax, label,tCentral);
1394    TH1F *HCentral = CollapseStack(Central);
1395    
1396    TH1F *Systematic = (TH1F*)hdata->Clone("Systematic");
# Line 1363 | Line 1412 | void ProduceMCSystematicPlot(string vari
1412    TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1);
1413    kinpad->SetLogy(1);
1414    kinpad->cd();
1415 <  hdata->Draw("e1");
1416 <  Central.Draw("histo,same");
1417 <  hdata->Draw("e1,same");
1415 >  if(variable=="genMET") {
1416 >    Central.Draw("histo");
1417 >  } else {
1418 >    hdata->Draw("e1");
1419 >    Central.Draw("histo,same");
1420 >    hdata->Draw("e1,same");
1421 >  }
1422 >  
1423    DrawPrelim();
1424 <
1424 >  
1425    save_with_ratio_and_sys_band( hdata, HCentral, kinpad->cd(), saveas, false, false, "data/mc",Systematic );
1426    
1427 +  kinpad->cd();
1428 +  tCentral->SetFillColor(kWhite);
1429 +  tCentral->SetLineColor(kBlack);
1430 +  tScaleUp->SetLineColor(kRed);
1431 +  tScaleDown->SetLineColor(kRed);
1432 +  tMatchingUp->SetLineColor(kBlue);
1433 +  tMatchingDown->SetLineColor(kBlue);
1434 +  tScaleUp->SetLineStyle(2);
1435 +  tScaleDown->SetLineStyle(3);
1436 +  tMatchingUp->SetLineStyle(2);
1437 +  tMatchingDown->SetLineStyle(3);
1438 +  
1439 +  TLegend *leg2 = make_legend();
1440 +  leg2->AddEntry(hdata,"Data","p");
1441 +  leg2->AddEntry(tCentral,"Central (ttbar)","l");
1442 +  leg2->AddEntry(tScaleUp,"ScaleUp (ttbar)","l");
1443 +  leg2->AddEntry(tScaleDown,"ScaleDown (ttbar)","l");
1444 +  leg2->AddEntry(tMatchingUp,"MatchingUp (ttbar)","l");
1445 +  leg2->AddEntry(tMatchingDown,"MatchingDown (ttbar)","l");
1446 +  if(variable=="genMET") {
1447 +    Central.Draw("histo");
1448 +  }else {
1449 +    hdata->Draw("e1");
1450 +    Central.Draw("histo,same");
1451 +    hdata->Draw("e1,same");
1452 +  }
1453 +  tCentral->Draw("histo,same");
1454 +  tScaleUp->Draw("histo,same");
1455 +  tScaleDown->Draw("histo,same");
1456 +  tMatchingUp->Draw("histo,same");
1457 +  tMatchingDown->Draw("histo,same");
1458 +  leg2->Draw();
1459 +  
1460 +  CompleteSave(kinpad,saveas+"__TTbarComparison");
1461 +  
1462 +  gStyle->SetOptFit(0);
1463 +  
1464 +  kinpad->cd();
1465 +  kinpad->SetLogy(0);
1466 +  TH1F *MatchingRatio = (TH1F*)tMatchingUp->Clone("MatchingRatio");
1467 +  MatchingRatio->Divide(tMatchingDown);
1468 +  TLine *lone = new TLine(tScaleUp->GetBinLowEdge(1),1,tScaleUp->GetBinLowEdge(tScaleUp->GetNbinsX())+tScaleUp->GetBinWidth(tScaleUp->GetNbinsX()),1);
1469 +  lone->SetLineColor(TColor::GetColor("#01DF01"));
1470 +  lone->SetLineStyle(2);
1471 +  TH1F *ScaleRatio = (TH1F*)tScaleUp->Clone("ScaleRatio");
1472 +  ScaleRatio->Divide(tScaleDown);
1473 +  MatchingRatio->GetYaxis()->SetRangeUser(0,3);
1474 +  MatchingRatio->Draw("e1");
1475 +  TF1 *QP1 = new TF1("QP1","[0]+[1]*x",50,200);//simple linear function ranging from 50 to 200
1476 +  MatchingRatio->Fit("QP1","R");
1477 +  lone->Draw();
1478 +  stringstream summary;
1479 +  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);
1480 +  summary << " +/- " << DigitsAfterComma(QP1->GetParError(1),4) << "}}";
1481 +  TText *infobox = write_title(summary.str());
1482 +  infobox->SetX(0.75);
1483 +  infobox->SetTextSize(0.03);
1484 +  infobox->SetY(0.75);
1485 +  infobox->Draw();
1486 +  CompleteSave(kinpad,saveas+"__TTbarComparison_MatchingUpDividedMatchingDown");
1487 +  kinpad->cd();
1488 +  ScaleRatio->GetYaxis()->SetRangeUser(0,3);
1489 +  ScaleRatio->Draw("e1");
1490 +  ScaleRatio->Fit("QP1","R");
1491 +  summary.str("");
1492 +  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);
1493 +  summary << " +/- " << DigitsAfterComma(QP1->GetParError(1),4) << "}}";
1494 +  TText *infobox2 = write_title(summary.str());
1495 +  infobox2->SetX(0.75);
1496 +  infobox2->SetTextSize(0.03);
1497 +  infobox2->SetY(0.75);
1498 +  infobox2->Draw();
1499 +
1500 +  lone->Draw();
1501 +  CompleteSave(kinpad,saveas+"__TTbarComparison_ScaleUpDividedScaleDown");
1502 +  
1503 +  
1504 +  delete QP1;
1505 +  delete infobox;
1506 +  delete infobox2;
1507 +  delete MatchingRatio;
1508 +  delete ScaleRatio;
1509 +  DeleteStack(ScaleUp);
1510 +  DeleteStack(ScaleDown);
1511 +  DeleteStack(MatchingUp);
1512 +  DeleteStack(MatchingDown);
1513 +  delete leg2;
1514    CleanLegends();
1515    DeleteStack(Central);
1516    delete Systematic;
# Line 1382 | Line 1523 | void ProduceMCSystematicPlot(string vari
1523    delete ca;
1524   }
1525  
1526 + TH1F* ImposeBinning(TH1F *binninghisto, TH1F* histo) {
1527 +  float val=0,err=0;
1528 +  vector<float> bins;
1529 +  vector<float> vals;
1530 +  vector<float> errs;
1531 +  
1532 +  bins.push_back(binninghisto->GetBinLowEdge(1));
1533 +  int iBin=1;
1534 +  
1535 +  for(unsigned int i=1;i<histo->GetNbinsX();i++) {//going to second last one on purpose!
1536 +    if((histo->GetBinLowEdge(i)+0.00001>=binninghisto->GetBinLowEdge(iBin)+binninghisto->GetBinWidth(iBin))) {
1537 +      bins.push_back(histo->GetBinLowEdge(i));
1538 +      vals.push_back(val);val=0;
1539 +      errs.push_back(err);err=0;
1540 +      iBin++;
1541 +    }
1542 +    val+=histo->GetBinContent(i);
1543 +    err=sqrt(err*err+histo->GetBinError(i)*histo->GetBinError(i));
1544 +  }
1545 +  bins.push_back(histo->GetBinLowEdge(histo->GetNbinsX())+histo->GetBinWidth(histo->GetNbinsX()));
1546 +  vals.push_back(val);val=0;
1547 +  errs.push_back(err);err=0;
1548 +  
1549 +  TH1F *h = new TH1F(("r"+(string)histo->GetName()).c_str(),("r"+(string)histo->GetName()).c_str(),bins.size()-1,&bins[0]);
1550 +  for(unsigned int i=0;i<vals.size();i++) {
1551 +    h->SetBinContent(i+1,vals[i]);
1552 +    h->SetBinError(i+1,errs[i]);
1553 +  }
1554 +  
1555 +  h->GetXaxis()->SetTitle(histo->GetXaxis()->GetTitle());
1556 +  h->GetYaxis()->SetTitle(histo->GetYaxis()->GetTitle());
1557 +  
1558 +  h->GetXaxis()->CenterTitle();
1559 +  h->GetYaxis()->CenterTitle();
1560 +
1561 +  return h;
1562 + }
1563 +
1564 +
1565 + TH1F* ReBinOptimizingStats(int nbins, TH1F *histo) {
1566 +  float statsperbin = (1/(float)nbins) * histo->Integral();
1567 +  float val=0,err=0;
1568 +  vector<float> bins;
1569 +  vector<float> vals;
1570 +  vector<float> errs;
1571 +  
1572 +  bins.push_back(histo->GetBinLowEdge(1));
1573 +  for(unsigned int i=1;i<=histo->GetNbinsX();i++) {
1574 +    val+=histo->GetBinContent(i);
1575 +    err=sqrt(err*err+histo->GetBinError(i)*histo->GetBinError(i));
1576 +    if( val/statsperbin > 0.85) {
1577 +      if(bins.size()<nbins) {
1578 +        bins.push_back(histo->GetBinLowEdge(i)+histo->GetBinWidth(i));
1579 +        vals.push_back(val);val=0;
1580 +        errs.push_back(err);err=0;
1581 +      }
1582 +    }
1583 +    if(i==histo->GetNbinsX()) {
1584 +      bins.push_back(histo->GetBinLowEdge(i)+histo->GetBinWidth(i));
1585 +      vals.push_back(val);val=0;
1586 +      errs.push_back(err);err=0;
1587 +    }
1588 +  }
1589 +  TH1F *h = new TH1F(("r"+(string)histo->GetName()).c_str(),("r"+(string)histo->GetName()).c_str(),bins.size()-1,&bins[0]);
1590 +  
1591 +  h->GetXaxis()->SetTitle(histo->GetXaxis()->GetTitle());
1592 +  h->GetYaxis()->SetTitle(histo->GetYaxis()->GetTitle());
1593 +  
1594 +  h->GetXaxis()->CenterTitle();
1595 +  h->GetYaxis()->CenterTitle();
1596 +  
1597 +  for(unsigned int i=0;i<vals.size();i++) {
1598 +    h->SetBinContent(i+1,vals[i]);
1599 +    h->SetBinError(i+1,errs[i]);
1600 +  }
1601 +  
1602 +  return h;
1603 + }
1604 +
1605 +
1606 +  
1607 + void ShowBinning(TH1F *histo) {
1608 +  cout << "Showing binning for " << histo->GetName() << " (\" " << histo->GetTitle() << "\")" << endl;
1609 +  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;
1610 + }
1611 +  
1612 + void QuickProduceMCSystematicPlot(string variable, int nbins, float bmin, float bmax, string label, TCut thiscut, string saveas) {
1613 +  TCanvas *ca = new TCanvas("ca","ca");
1614 +  TH1F *tScaleUp = systsamples.Draw("tScaleUp",variable,nbins,bmin,bmax,label,"events",thiscut,mc,luminosity,systsamples.FindSample("scaleup"));
1615 +  TH1F *tScaleDown = systsamples.Draw("tScaleDown",variable,nbins,bmin,bmax,label,"events",thiscut,mc,luminosity,systsamples.FindSample("scaledown"));
1616 +  TH1F *tMatchingUp = systsamples.Draw("tMatchingUp",variable,nbins,bmin,bmax,label,"events",thiscut,mc,luminosity,systsamples.FindSample("matchingup"));
1617 +  TH1F *tMatchingDown = systsamples.Draw("tMatchingDown",variable,nbins,bmin,bmax,label,"events",thiscut,mc,luminosity,systsamples.FindSample("matchingdown"));
1618 +  TH1F *tCentral = systsamples.Draw("tCentral",variable,nbins,bmin,bmax,label,"events",thiscut,mc,luminosity,systsamples.FindSample("TTJets_MassiveBinDECAY_TuneZ2sta"));
1619 +  
1620 +  tScaleUp->Scale(1.0/tScaleUp->Integral());
1621 +  tScaleDown->Scale(1.0/tScaleDown->Integral());
1622 +  tMatchingDown->Scale(1.0/tMatchingDown->Integral());
1623 +  tMatchingUp->Scale(1.0/tMatchingUp->Integral());
1624 +  tCentral->Scale(1.0/tCentral->Integral());
1625 +  
1626 +  cout << "At this point we want to rebin the scale/matching histograms so we get decent stats!" << endl;
1627 +  
1628 +  
1629 +  TH1F *rtScaleUp = ReBinOptimizingStats(7,tScaleUp); // using the scale up sample to get the binning (shouldn't use the central one for obvious reasons)
1630 +  TH1F *rtScaleDown = ImposeBinning(rtScaleUp,tScaleDown);
1631 +  TH1F *rtMatchingDown = ImposeBinning(rtScaleUp,tMatchingDown);
1632 +  TH1F *rtMatchingUp = ImposeBinning(rtScaleUp,tMatchingUp);
1633 +  TH1F *rtCentral = ImposeBinning(rtScaleUp,tCentral);
1634 +  
1635 +  float min=rtScaleUp->GetMinimum();
1636 +  float max=rtScaleUp->GetMaximum();
1637 +  
1638 +  if(rtScaleDown->GetMinimum()<min) min=rtScaleDown->GetMinimum();
1639 +  if(rtMatchingDown->GetMinimum()<min) min=rtMatchingDown->GetMinimum();
1640 +  if(rtMatchingDown->GetMinimum()<min) min=rtMatchingDown->GetMinimum();
1641 +  if(rtMatchingUp->GetMinimum()<min) min=rtMatchingUp->GetMinimum();
1642 +  if(rtCentral->GetMinimum()<min) min=rtCentral->GetMinimum();
1643 +  
1644 +  if(rtScaleDown->GetMaximum()<min) max=rtScaleDown->GetMaximum();
1645 +  if(rtMatchingDown->GetMaximum()<min) max=rtMatchingDown->GetMaximum();
1646 +  if(rtMatchingDown->GetMaximum()<min) max=rtMatchingDown->GetMaximum();
1647 +  if(rtMatchingUp->GetMaximum()<min) max=rtMatchingUp->GetMaximum();
1648 +  if(rtCentral->GetMaximum()<min) max=rtCentral->GetMaximum();
1649 +  
1650 +  rtCentral->SetMaximum(1.2*max);
1651 +  rtCentral->SetMinimum(0.8*min);
1652 +  
1653 + /*  tScaleUp->Rebin(40);
1654 +  tScaleDown->Rebin(40);
1655 +  tMatchingDown->Rebin(40);
1656 +  tMatchingUp->Rebin(40);
1657 +  tCentral->Rebin(40);*/
1658 +  
1659 +  TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1);
1660 +  kinpad->SetLogy(1);
1661 +  kinpad->cd();
1662 +  tCentral->SetFillColor(kWhite);
1663 +  tCentral->SetLineColor(kBlack);
1664 +  tScaleUp->SetLineColor(kRed);
1665 +  tScaleDown->SetLineColor(kRed);
1666 +  tMatchingUp->SetLineColor(kBlue);
1667 +  tMatchingDown->SetLineColor(kBlue);
1668 +  tScaleUp->SetLineStyle(2);
1669 +  tScaleDown->SetLineStyle(3);
1670 +  tMatchingUp->SetLineStyle(2);
1671 +  tMatchingDown->SetLineStyle(3);
1672 +  
1673 +  rtScaleDown->SetLineColor(kRed);
1674 +  rtMatchingUp->SetLineColor(kBlue);
1675 +  rtMatchingDown->SetLineColor(kBlue);
1676 +  rtScaleUp->SetLineStyle(2);
1677 +  rtScaleDown->SetLineStyle(3);
1678 +  rtMatchingUp->SetLineStyle(2);
1679 +  rtMatchingDown->SetLineStyle(3);
1680 +  
1681 +  TLegend *leg2 = make_legend();
1682 +  leg2->AddEntry(tCentral,"Central (ttbar)","l");
1683 +  leg2->AddEntry(tScaleUp,"ScaleUp (ttbar)","l");
1684 +  leg2->AddEntry(tScaleDown,"ScaleDown (ttbar)","l");
1685 +  leg2->AddEntry(tMatchingUp,"MatchingUp (ttbar)","l");
1686 +  leg2->AddEntry(tMatchingDown,"MatchingDown (ttbar)","l");
1687 +  
1688 +  tCentral->Draw("histo");
1689 +  tScaleUp->Draw("histo,same");
1690 +  tScaleDown->Draw("histo,same");
1691 +  tMatchingUp->Draw("histo,same");
1692 +  tMatchingDown->Draw("histo,same");
1693 +  leg2->Draw();
1694 +  DrawMCPrelim();
1695 +  CompleteSave(kinpad,saveas+"__TTbarComparison");
1696 +  kinpad->cd();
1697 +  kinpad->SetLogy(0);
1698 +  rtCentral->Draw("histo");
1699 +  rtScaleUp->Draw("histo,same");
1700 +  rtScaleDown->Draw("histo,same");
1701 +  rtMatchingUp->Draw("histo,same");
1702 +  rtMatchingDown->Draw("histo,same");
1703 +  leg2->Draw();
1704 +  DrawMCPrelim();
1705 +  CompleteSave(kinpad,saveas+"__TTbarComparison__REBINNED");
1706 +  
1707 +  
1708 +  gStyle->SetOptFit(0);
1709 +
1710 +  kinpad->cd();
1711 +  kinpad->SetLogy(0);
1712 +  TH1F *MatchingRatio = (TH1F*)rtMatchingUp->Clone("MatchingRatio");
1713 +  MatchingRatio->Divide(rtMatchingDown);
1714 +  TLine *lone = new TLine(tScaleUp->GetBinLowEdge(1),1,tScaleUp->GetBinLowEdge(tScaleUp->GetNbinsX())+tScaleUp->GetBinWidth(tScaleUp->GetNbinsX()),1);
1715 +  lone->SetLineColor(TColor::GetColor("#01DF01"));
1716 +  lone->SetLineStyle(2);
1717 +  TH1F *ScaleRatio = (TH1F*)rtScaleUp->Clone("ScaleRatio");
1718 +  ScaleRatio->Divide(rtScaleDown);
1719 +  MatchingRatio->GetYaxis()->SetRangeUser(0,3);
1720 +  MatchingRatio->Draw("e1");
1721 +  TF1 *QP1 = new TF1("QP1","[0]+[1]*x",50,200);//simple linear function ranging from 50 to 200
1722 +  if(variable=="genMET" || variable=="met[4]" || variable=="met[1]") MatchingRatio->Fit("QP1","RQ");
1723 +  lone->Draw();
1724 +  stringstream summary;
1725 +  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);
1726 +  summary << " +/- " << DigitsAfterComma(QP1->GetParError(1),4) << "}}";
1727 +  TText *infobox = write_title(summary.str());
1728 +  infobox->SetX(0.75);
1729 +  infobox->SetTextSize(0.03);
1730 +  infobox->SetY(0.75);
1731 +  if(variable=="genMET" || variable=="met[4]" || variable=="met[1]") infobox->Draw();
1732 +  DrawMCPrelim();
1733 +  CompleteSave(kinpad,saveas+"__TTbarComparison_MatchingUpDividedMatchingDown");
1734 +  kinpad->cd();
1735 +  ScaleRatio->GetYaxis()->SetRangeUser(0,3);
1736 +  ScaleRatio->Draw("e1");
1737 +  if(variable=="genMET" || variable=="met[4]" || variable=="met[1]") ScaleRatio->Fit("QP1","RQ");
1738 +  summary.str("");
1739 +  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);
1740 +  summary << " +/- " << DigitsAfterComma(QP1->GetParError(1),4) << "}}";
1741 +  TText *infobox2 = write_title(summary.str());
1742 +  infobox2->SetX(0.75);
1743 +  infobox2->SetTextSize(0.03);
1744 +  infobox2->SetY(0.75);
1745 +  if(variable=="genMET" || variable=="met[4]" || variable=="met[1]") infobox2->Draw();
1746 +
1747 +  lone->Draw();
1748 +  DrawMCPrelim();
1749 +  CompleteSave(kinpad,saveas+"__TTbarComparison_ScaleUpDividedScaleDown");
1750 +  
1751 +  kinpad->cd();
1752 +  TH1F *SysMatching = (TH1F*)rtMatchingDown->Clone("SysMatching");
1753 +  TH1F *SysScale = (TH1F*)rtScaleDown->Clone("SysMatching");
1754 +  TH1F *SysHisto = (TH1F*)rtScaleDown->Clone("SysHisto");
1755 +  
1756 +  for(int i=1;i<=SysScale->GetNbinsX();i++) {
1757 +    float matching, scale;
1758 +    bool AssumeFactor=false;
1759 +    if(AssumeFactor) {
1760 +      // assume that an upward/downward variation means a change by a constant factor, i.e. f(up) = alpha * f(central)
1761 +      matching=0.;
1762 +      scale=0.;
1763 +    } else {
1764 +      // assume that the central value is exactly between up & down, i.e. central = (up-down)/2
1765 +      matching = fabs(    ( rtMatchingUp->GetBinContent(i) - rtMatchingDown->GetBinContent(i)) / (rtMatchingUp->GetBinContent(i) + rtMatchingDown->GetBinContent(i)) );
1766 +      scale    = fabs(    ( rtScaleUp->GetBinContent(i) - rtScaleDown->GetBinContent(i)) / (rtScaleUp->GetBinContent(i) + rtScaleDown->GetBinContent(i)) );
1767 +    }
1768 +    
1769 +    SysMatching->SetBinContent(i,1+matching);
1770 +    SysScale->SetBinContent(i,1+scale);
1771 +    SysHisto->SetBinContent(i,sqrt(matching*matching+scale*scale)+1);
1772 +  }
1773 +  
1774 +  SysHisto->SetLineColor(kGreen);
1775 +  
1776 +  SysMatching->SetMaximum(3.0);
1777 +  SysMatching->SetMinimum(0.0);
1778 +  SysMatching->Draw("histo");
1779 +  SysScale->Draw("histo,same");
1780 +  SysHisto->Draw("histo,same");
1781 +  CompleteSave(kinpad,saveas+"__TTbarComparison_DerivedSystematic");
1782 +  
1783 +  delete SysMatching;
1784 +  delete SysScale;
1785 +  
1786 +  if(!Contains(variable,"gen")) {
1787 +    TH1F *hdata  = allsamples.Draw("hdata",   variable,nbins,bmin,bmax,label,"events",thiscut,data,luminosity);
1788 +    THStack smc = allsamples.DrawStack("smc",variable,nbins,bmin,bmax,label,"events",thiscut,mc,luminosity);
1789 +    
1790 +    TH1F *Systematic = (TH1F*)hdata->Clone("Systematic");
1791 +    
1792 +    for(int i=1;i<=Systematic->GetNbinsX();i++) {
1793 +      int iBin=SysHisto->FindBin(Systematic->GetBinCenter(i));
1794 +      if(iBin>SysHisto->GetNbinsX()) --iBin; // if we're over the end of the histo, use the last bin
1795 +      float sys = SysHisto->GetBinContent(iBin)-1;
1796 +      Systematic->SetBinContent(i,sys);
1797 +    }
1798 +    
1799 +    kinpad->cd();
1800 +    TLegend *leg = allsamples.allbglegend();
1801 +    hdata->Draw();
1802 +    smc.Draw("histo,same");
1803 +    hdata->Draw("same");
1804 +    leg->Draw();
1805 +    DrawPrelim();
1806 +    save_with_ratio_and_sys_band( hdata, CollapseStack(smc), kinpad->cd(), saveas+"__DataVsMC", false, false, "data/mc",Systematic );
1807 +    
1808 +    delete Systematic;
1809 +    delete hdata;
1810 +  }
1811 +  
1812 +  
1813 +  delete SysHisto;
1814 +  delete tScaleUp;
1815 +  delete tScaleDown;
1816 +  delete tCentral;
1817 +  delete tMatchingUp;
1818 +  delete tMatchingDown;
1819 +  delete rtScaleUp;
1820 +  delete rtScaleDown;
1821 +  delete rtCentral;
1822 +  delete rtMatchingUp;
1823 +  delete rtMatchingDown;
1824 +  delete QP1;
1825 +  delete infobox;
1826 +  delete infobox2;
1827 +  delete MatchingRatio;
1828 +  delete ScaleRatio;
1829 +  delete leg2;
1830 +  CleanLegends();
1831 +  delete ca;
1832 + }
1833 +
1834   void ProduceMCSystematicPlots() {
1835 +  cout << "Getting ready to produce systematic plots " << endl;
1836    TCut cutweightBKP = cutWeight;
1837    
1838 <  ProduceMCSystematicPlot("met[4]",80,0,400,"PFMET [GeV]",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_SameFlavor");
1839 <  ProduceMCSystematicPlot("met[4]",80,0,400,"PFMET [GeV]",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_OppositeFlavor");
1840 <  ProduceMCSystematicPlot("pfJetGoodNum40",8,-0.5,7.5,"NJets",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70&&met[4]>100"),"MCSystPlots/NJets/ETH_SameFlavor");
1841 <  ProduceMCSystematicPlot("pfJetGoodNum40",8,-0.5,7.5,"NJets",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70&&met[4]>100"),"MCSystPlots/NJets/ETH_OppositeFlavor");
1838 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/ETH_SameFlavor");
1839 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/ETH_OppositeFlavor");
1840 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_SameFlavor");
1841 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_OppositeFlavor");
1842 >  
1843 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/ETH_SameFlavor_INCLUSIVE");
1844 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/ETH_OppositeFlavor_INCLUSIVE");  
1845 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/genMET/ETH_SameFlavor_INCLUSIVE_HighMass");
1846 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/genMET/ETH_OppositeFlavor_INCLUSIVE_HighMass");  
1847 >  
1848 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_SameFlavor_INCLUSIVE");
1849 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_OppositeFlavor_INCLUSIVE");
1850 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/MET/ETH_SameFlavor_INCLUSIVE_HighMass");
1851 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/MET/ETH_OppositeFlavor_INCLUSIVE_HighMass");
1852 >  QuickProduceMCSystematicPlot("pfJetGoodNum40",8,-0.5,7.5,"NJets",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70&&met[4]>100"),"MCSystPlots/NJets/ETH_SameFlavor");
1853 >  QuickProduceMCSystematicPlot("pfJetGoodNum40",8,-0.5,7.5,"NJets",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70&&met[4]>100"),"MCSystPlots/NJets/ETH_OppositeFlavor");
1854 >  
1855 >  
1856 >  
1857 >  cout << "Kicking cutWeight  " << (const char*) cutWeight << endl;
1858 >  cout << "Keeping OSSF cut " << (const char*)cutOSSF << endl;
1859 >  cutWeight="1.0";
1860 >  
1861 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/ETH_SameFlavor_INCLUSIVE__NOPURW");
1862 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/ETH_OppositeFlavor_INCLUSIVE__NOPURW");  
1863 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/genMET/ETH_SameFlavor_INCLUSIVE_HighMass__NOPURW");
1864 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/genMET/ETH_OppositeFlavor_INCLUSIVE_HighMass__NOPURW");  
1865 >  
1866 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_SameFlavor_INCLUSIVE__NOPURW");
1867 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_OppositeFlavor_INCLUSIVE__NOPURW");
1868 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/MET/ETH_SameFlavor_INCLUSIVE_HighMass__NOPURW");
1869 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/MET/ETH_OppositeFlavor_INCLUSIVE_HighMass__NOPURW");
1870 >  
1871 >  
1872 >  // --------------------------------------    ***** AACHEN *****      --------------------------------------    
1873 >  
1874 >  /*
1875 >  cutWeight=cutweightBKP;
1876 >  TCut essentialcutBKP = essentialcut;
1877 >  cout << (const char*) essentialcut << endl;
1878 >  
1879 >  essentialcut = TCut((ReplaceAll((const char*)essentialcut,"pt2>20","pt2>10")).c_str());
1880 >  essentialcut = TCut((ReplaceAll((const char*)essentialcut,"abs(eta1)<1.4","abs(eta1)<2.4")).c_str());
1881 >  essentialcut = TCut((ReplaceAll((const char*)essentialcut,"abs(eta2)<1.4","abs(eta2)<2.4")).c_str());
1882    
1883    TCut cutnJetsBKP = cutnJets;
1884    cutnJets = TCut((ReplaceAll((const char*)cutnJets,"pt2>20","pt2>10")).c_str());
# Line 1396 | Line 1886 | void ProduceMCSystematicPlots() {
1886    cutnJets = TCut((ReplaceAll((const char*)cutnJets,"abs(eta2)<1.4","abs(eta2)<2.4")).c_str());
1887    cutnJets = TCut((ReplaceAll((const char*)cutnJets,"abs(eta1)<1.4","abs(eta1)<2.4")).c_str());
1888    
1889 <  ProduceMCSystematicPlot("met[4]",80,0,400,"PFMET [GeV]",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_SameFlavor");
1890 <  ProduceMCSystematicPlot("met[4]",80,0,400,"PFMET [GeV]",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_OppositeFlavor");
1891 <  ProduceMCSystematicPlot("pfJetGoodNum40",8,-0.5,7.5,"NJets",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70&&met[4]>150"),"MCSystPlots/NJets/Aachen_SameFlavor");
1892 <  ProduceMCSystematicPlot("pfJetGoodNum40",8,-0.5,7.5,"NJets",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70&&met[4]>150"),"MCSystPlots/NJets/Aachen_OppositeFlavor");
1889 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/Aachen_SameFlavor");
1890 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/Aachen_OppositeFlavor");  
1891 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_SameFlavor");
1892 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_OppositeFlavor");
1893 >  
1894 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/Aachen_SameFlavor_INCLUSIVE");
1895 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/Aachen_OppositeFlavor_INCLUSIVE");  
1896 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/genMET/Aachen_SameFlavor_INCLUSIVE_HighMass");
1897 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/genMET/Aachen_OppositeFlavor_INCLUSIVE_HighMass");  
1898 >  
1899 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_SameFlavor_INCLUSIVE");
1900 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_OppositeFlavor_INCLUSIVE");
1901 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/MET/Aachen_SameFlavor_INCLUSIVE_HighMass");
1902 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/MET/Aachen_OppositeFlavor_INCLUSIVE_HighMass");
1903 >  QuickProduceMCSystematicPlot("pfJetGoodNum40",8,-0.5,7.5,"NJets",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70&&met[4]>100"),"MCSystPlots/NJets/Aachen_SameFlavor");
1904 >  QuickProduceMCSystematicPlot("pfJetGoodNum40",8,-0.5,7.5,"NJets",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70&&met[4]>100"),"MCSystPlots/NJets/Aachen_OppositeFlavor");
1905 >  
1906 >  
1907 >  
1908 >  cout << "Kicking cutWeight  " << (const char*) cutWeight << endl;
1909 >  cout << "Keeping OSSF cut " << (const char*)cutOSSF << endl;
1910 >  cutWeight="1.0";
1911 >  
1912 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/Aachen_SameFlavor_INCLUSIVE__NOPURW");
1913 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/Aachen_OppositeFlavor_INCLUSIVE__NOPURW");  
1914 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/genMET/Aachen_SameFlavor_INCLUSIVE_HighMass__NOPURW");
1915 >  QuickProduceMCSystematicPlot("genMET",20,0,200,"genMET [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/genMET/Aachen_OppositeFlavor_INCLUSIVE_HighMass__NOPURW");  
1916 >  
1917 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_SameFlavor_INCLUSIVE__NOPURW");
1918 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_OppositeFlavor_INCLUSIVE__NOPURW");
1919 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/MET/Aachen_SameFlavor_INCLUSIVE_HighMass__NOPURW");
1920 >  QuickProduceMCSystematicPlot("met[4]",20,0,200,"PFMET [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/MET/Aachen_OppositeFlavor_INCLUSIVE_HighMass__NOPURW");
1921 >  
1922    cutnJets  = cutnJetsBKP;
1923    cutWeight = cutweightBKP;
1924 +  essentialcut = essentialcutBKP;
1925 +  */
1926 +  write_error(__FUNCTION__,"Still need to add systematic shape");assert(0);
1927 + }
1928 +
1929 + void MakeTauPlot(string label, TCut pcut, string filename, bool TauOnly) {
1930 +  TCut cut=pcut&&basiccut;
1931 +  string variable="mll";
1932 +  string xlabel="m_{ll} [GeV]";
1933 +  int nbins=40;
1934 +  float min=0;
1935 +  float max=200;
1936 +
1937 +  TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600);
1938 +  TH1F *datahistoSF = allsamples.Draw("datahistoSF",variable,nbins,min,max, xlabel, "events",cut&&cutOSSF,data,luminosity);
1939 +  TH1F *datahistoOF = allsamples.Draw("datahistoOF",variable,nbins,min,max, xlabel, "events",cut&&cutOSOF,data,luminosity);
1940 +  TH1F *tauSF = allsamples.Draw("tauSF",variable,nbins,min,max, xlabel, "events",cut&&cutOSSF,data,luminosity,systsamples.FindSample("DYToTauTau"));
1941 +  TH1F *tauOF = allsamples.Draw("tauOF",variable,nbins,min,max, xlabel, "events",cut&&cutOSOF,data,luminosity,systsamples.FindSample("DYToTauTau"));
1942 +  datahistoSF->SetMarkerSize(DataMarkerSize);
1943 +  datahistoSF->SetMaximum(1.3*datahistoSF->GetMaximum());
1944 +  datahistoOF->SetMarkerSize(DataMarkerSize);
1945 +  datahistoOF->SetMaximum(1.3*datahistoOF->GetMaximum());
1946 +
1947 +  THStack mcstackSF   = allsamples.DrawStack("mcstackSF",  variable,nbins,min,max,xlabel,"events",cut&&cutOSSF,mc,luminosity);
1948 +  THStack mcstackOF   = allsamples.DrawStack("mcstackOF",  variable,nbins,min,max,xlabel,"events",cut&&cutOSOF,mc,luminosity);
1949 +  datahistoSF->Draw("e1");
1950 +  ckin->Update();
1951 +  mcstackSF.Draw("histo,same");
1952 +  
1953 +  datahistoSF->Draw("same,e1");
1954 +  TLegend *kinleg = allsamples.allbglegend();
1955 +  kinleg->Draw();
1956 +  
1957 +  TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1);
1958 +  kinpad->cd();
1959 +  datahistoSF->Draw("e1");
1960 +  mcstackSF.Draw("histo,same");
1961 +  datahistoSF->Draw("same,e1");
1962 +  datahistoSF->Draw("same,axis");
1963 +  kinleg->Draw();
1964 +  DrawPrelim();
1965 +  Save_With_Ratio(datahistoSF,mcstackSF,kinpad->cd(),filename+"__SF_mc");
1966 +  
1967 +  kinpad->cd();
1968 +  datahistoOF->Draw("e1");
1969 +  mcstackOF.Draw("histo,same");
1970 +  datahistoOF->Draw("same,e1");
1971 +  datahistoOF->Draw("same,axis");
1972 +  kinleg->Draw();
1973 +  DrawPrelim();
1974 +  Save_With_Ratio(datahistoOF,mcstackOF,kinpad->cd(),filename+"__OF_mc");
1975 +  
1976 +  kinpad->cd();
1977 +  tauSF->Draw("e1");
1978 +  tauOF->Draw("histo,same");
1979 +  tauSF->Draw("e1,same");
1980 +  TLegend *legtau = make_legend();
1981 +  legtau->AddEntry(tauSF,"DY->#tau#tau, SF","p");
1982 +  legtau->AddEntry(tauSF,"DY->#tau#tau, OF","l");
1983 +  legtau->Draw();
1984 +  DrawPrelim();
1985 +  Save_With_Ratio(tauSF,tauOF,kinpad->cd(),filename+"__Tau_SF_vs_OF");
1986 +  
1987 +  delete datahistoSF;
1988 +  delete datahistoOF;
1989 +  delete tauSF;
1990 +  delete tauOF;
1991 +  delete kinpad;
1992 +  delete ckin;
1993 +  CleanLegends();
1994 + }
1995 +  
1996 +
1997 + void TauQuestion() {
1998 + //   MakeTauPlot("MET>100 GeV, #geq 3 jets",cutnJets&&TCut("met[4]>100"),"TauQ/MET100_3Jets",true);
1999 + //   MakeTauPlot("MET>100 GeV",TCut("met[4]>100"),"TauQ/MET100",true);
2000 + //   MakeTauPlot("MET>0 GeV",TCut("met[4]>0"),"TauQ/MET0",true);
2001 +  MakeTauPlot("b-tag veto, 50<MET<100",TCut("pfJetGoodNumBtag30==0&&met[4]>50&&met[4]<100"),"TauQ/ControlPlots",false);
2002   }
2003  
2004   void do_kinematic_plots(string mcjzb, string datajzb, bool doPF=false)
# Line 1410 | Line 2007 | void do_kinematic_plots(string mcjzb, st
2007    bool dolog=true;
2008    bool nolog=false;
2009  
2010 <  bool doOFSF = true;
2010 >  bool doOFSF = false;
2011    bool doKin  = true;
2012 <  bool doDataComp = true;
2013 <  bool MakeTwoThreeJetComparison = true;
2012 >  bool doDataComp = false;
2013 >  bool MakeTwoThreeJetComparison = false;
2014    
2015  
2016    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 2022 | void do_kinematic_plots(string mcjzb, st
2022    }
2023    
2024    if(MakeTwoThreeJetComparison) MakeElegantTwoThreeComparisons();
2025 +  
2026 +  //TauQuestion();
2027  
2028    //ProduceJanPlots();
2029 < //   ProduceMCSystematicPlots();
2030 <  make_plain_kin_plot("pt",Cut2Str(cutOSSF&&TCut("mll>20&&pfJetGoodNumBtag30>=2")),40,0,200,nolog,"Z p_{T}","PlotForKostas",doPF,true);
2029 >  ProduceMCSystematicPlots();
2030 >  assert(0);
2031 > //  make_plain_kin_plot("pt",Cut2Str(cutOSSF&&TCut("mll>20&&pfJetGoodNumBtag30>=2")),40,0,200,nolog,"Z p_{T}","PlotForKostas",doPF,true);
2032    
2033    if ( doOFSF ) {
2034       make_OFSF_plots("mll", "met[4]>100", 60, 20., 320., false, "m_{ll}", "mll");
2035 +     make_OFSF_plots("met[4]", "met[4]>100", 30, 100., 400., false, "PFMET", "met");
2036 +     make_OFSF_plots("leptonNum", "met[4]>100", 3, 2, 5., false, "N(leptons)", "NLeptons");
2037  
2038       make_OFSF_plots("pfJetGoodNum40", "met[4]>100",                        7, 3, 10, true, "#(jets)", "njets");
2039       make_OFSF_plots("pfJetGoodNum40", "met[4]>100&&pfJetGoodNumBtag30==0", 7, 3, 10, true, "#(jets)", "njets_btagVeto");
# Line 1603 | Line 2205 | void do_kinematic_plots(string mcjzb, st
2205      make_kin_plot("MetFactor","",20,0,2,nolog,"MetFactor","MetFactor",doPF,true);
2206      
2207      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");
2208 <    
2208 >    /*
2209      DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==0")),dolog,"PFMET","Debunking/MET_OF_30to70_0j");
2210      DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==1")),dolog,"PFMET","Debunking/MET_OF_30to70_1j");
2211      DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==2")),dolog,"PFMET","Debunking/MET_OF_30to70_2j");
2212      DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==3")),dolog,"PFMET","Debunking/MET_OF_30to70_3j");
2213  
2214 +    DoMCSystPlot("met[4]",40,0,400,(cutOSSF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==0")),dolog,"PFMET","Debunking/MET_SF_30to70_0j");
2215 +    DoMCSystPlot("met[4]",40,0,400,(cutOSSF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==1")),dolog,"PFMET","Debunking/MET_SF_30to70_1j");
2216 +    DoMCSystPlot("met[4]",40,0,400,(cutOSSF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==2")),dolog,"PFMET","Debunking/MET_SF_30to70_2j");
2217 +    DoMCSystPlot("met[4]",40,0,400,(cutOSSF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==3")),dolog,"PFMET","Debunking/MET_SF_30to70_3j");
2218 +
2219      DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>80&&mll<100&&pfJetGoodNum40==0")),dolog,"PFMET","Debunking/MET_OF_Z_0j");
2220      DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>80&&mll<100&&pfJetGoodNum40==1")),dolog,"PFMET","Debunking/MET_OF_Z_1j");
2221      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 2300 | void do_kinematic_plots(string mcjzb, st
2300      
2301      //   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);
2302      //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);
2303 <    //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);
2303 >    //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);*/
2304    }
2305 <    
2305 >    /*
2306     make_special_obs_pred_mll_plot(datajzb,mcjzb,0);
2307     make_special_obs_pred_mll_plot(datajzb,mcjzb,50);
2308     make_special_obs_pred_mll_plot(datajzb,mcjzb,80);
# Line 1706 | Line 2313 | void do_kinematic_plots(string mcjzb, st
2313  
2314     make_JES_plot(cutmass&&cutOSSF&&basiccut,"_ossf");
2315     make_JES_plot(cutmass&&cutOSOF&&basiccut,"_osof");
2316 <
2316 > */
2317    switch_overunderflow(false);
2318   }
2319  
# Line 3348 | Line 3955 | void find_correction_factors(string &jzb
3955    
3956   }
3957  
3958 < void pick_up_events(string cut) {
3959 <  dout << "Picking up events with cut " << cut << endl;
3353 <  allsamples.PickUpEvents(cut);
3958 > void pick_up_events(string cut, string filename) {
3959 >  allsamples.PickUpEvents(cut,filename);
3960   }
3961  
3962   void save_template(string mcjzb, string datajzb,vector<float> jzb_cuts,float MCPeakError,float DataPeakError, vector<float> jzb_shape_limit_bins) {
# Line 3462 | Line 4068 | void ttbar_sidebands_comparison(string m
4068        
4069    float simulatedlumi = luminosity; //in pb please - adjust to your likings
4070  
4071 <  TH1F *TZem  = systsamples.Draw("TZem",     mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
4072 <  TH1F *nTZem = systsamples.Draw("nTZem","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
4071 >  TH1F *TZem  = allsamples.Draw("TZem",     mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT"));
4072 >  TH1F *nTZem = allsamples.Draw("nTZem","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT"));
4073    TH1F *TSem;
4074    TH1F *nTSem;
4075 <  TH1F *TZeemm  = systsamples.Draw("TZeemm",     mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
4076 <  TH1F *nTZeemm = systsamples.Draw("nTZeemm","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
4075 >  TH1F *TZeemm  = allsamples.Draw("TZeemm",     mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT"));
4076 >  TH1F *nTZeemm = allsamples.Draw("nTZeemm","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT"));
4077    TH1F *TSeemm;
4078    TH1F *nTSeemm;
4079    
4080    if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) {
4081 <    TSem    = systsamples.Draw("TSem",       mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
4082 <    nTSem   = systsamples.Draw("nTSem",  "-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
4083 <    TSeemm  = systsamples.Draw("TSeemm",     mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
4084 <    nTSeemm = systsamples.Draw("nTSeemm","-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTT"));
4081 >    TSem    = allsamples.Draw("TSem",       mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT"));
4082 >    nTSem   = allsamples.Draw("nTSem",  "-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT"));
4083 >    TSeemm  = allsamples.Draw("TSeemm",     mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT"));
4084 >    nTSeemm = allsamples.Draw("nTSeemm","-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT"));
4085    }
4086  
4087    TCanvas *tcan = new TCanvas("tcan","tcan");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines