コード例 #1
0
void
plot (const string &file, const string &metTrigger, const string &metTriggerLabel = "", const bool effOnL1 = false, const bool effOnMu = true, const bool useCaloMET = true, const bool doFit = true)
{
  gStyle->SetOptStat (0);

  TFile *fin;
  map<string, TH1D *> triggerEfficiencyNumerator, triggerEfficiencyDenominator;
  string histName = (useCaloMET ? "pfMETNoMuPt" : "metPt");
  string  metNumeratorDir     =  (effOnL1  ?  "MuMETNoMETL1SeedPlotter"                    :  (effOnMu  ?  "MuMETNoMETMuSeedPlotter"             :  "MuMETNoMETPlotter"));
  string  metDenominatorDir   =  (effOnL1  ?  "MuMETNoMETPlotter/hltL1sL1ETM60ORETM70"     :  (effOnMu  ?  "MuMETNoMETPlotter/HLT_IsoMu20_v"     :  "MuMETNoMETNoTriggerPlotter"));
  string  muonNumeratorDir    =  (effOnL1  ?  "MuMETNoMuonPtL1SeedPlotter"                 :  (effOnMu  ?  "MuMETNoMuonPtMuSeedPlotter"          :  "MuMETNoMuonPtPlotter"));
  string  muonDenominatorDir  =  (effOnL1  ?  "MuMETNoMuonPtPlotter/hltL1sL1ETM60ORETM70"  :  (effOnMu  ?  "MuMETNoMuonPtPlotter/HLT_IsoMu20_v"  :  "MuMETNoMuonPtNoTriggerPlotter"));

  fin = TFile::Open ((file + ".root").c_str ());
  triggerEfficiencyNumerator["WJets_MET"] = (TH1D *) fin->Get (("TriggerEfficiency/" + metNumeratorDir + "/" + metTrigger + "/Met Plots/" + histName).c_str ());
  triggerEfficiencyNumerator.at ("WJets_MET")->SetDirectory (0);
  triggerEfficiencyDenominator["WJets_MET"] = (TH1D *) fin->Get (("TriggerEfficiency/" + metDenominatorDir + "/Met Plots/" + histName).c_str ());
  triggerEfficiencyDenominator.at ("WJets_MET")->SetDirectory (0);
  triggerEfficiencyNumerator["WJets_MuonPt"] = (TH1D *) fin->Get (("TriggerEfficiency/" + muonNumeratorDir + "/" + metTrigger + "/Muon Plots/muonPt").c_str ());
  triggerEfficiencyNumerator.at ("WJets_MuonPt")->SetDirectory (0);
  triggerEfficiencyDenominator["WJets_MuonPt"] = (TH1D *) fin->Get (("TriggerEfficiency/" + muonDenominatorDir + "/Muon Plots/muonPt").c_str ());
  triggerEfficiencyDenominator.at ("WJets_MuonPt")->SetDirectory (0);
  fin->Close ();

  map<string, TGraphAsymmErrors *> triggerEfficiency;
  for (map<string, TH1D *>::const_iterator design = triggerEfficiencyNumerator.begin (); design != triggerEfficiencyNumerator.end (); design++)
    {
      TH1D *numerator = NULL, *denominator = NULL;
      vector<double> bins;
      logSpace (NBINS, 1.0, 3.0, bins);
      numerator = (TH1D *) triggerEfficiencyNumerator.at (design->first)->Rebin (bins.size () - 1, "triggerEfficiencyNumerator", bins.data ());
      denominator = (TH1D *) triggerEfficiencyDenominator.at (design->first)->Rebin (bins.size () - 1, "triggerEfficiencyDenominator", bins.data ());
      triggerEfficiency[design->first] = new TGraphAsymmErrors (numerator, denominator, "cp");
      triggerEfficiency.at (design->first)->SetName ("triggerEfficiency");
      triggerEfficiency.at (design->first)->GetYaxis ()->SetTitle ((effOnL1 ? "trigger efficiency on L1 seed" : (metTrigger == "hltL1sL1ETM60ORETM70" ? "L1 seed efficiency" : "trigger efficiency")));
      if (design->first == "WJets_MET")
        {
          setStyle (triggerEfficiency.at (design->first), kBlack, 20);
          triggerEfficiency.at (design->first)->GetXaxis ()->SetTitle (useCaloMET ? "PF E_{T}^{miss} (no muons) [GeV]" : "PF E_{T}^{miss} [GeV]");
        }
      else if (design->first == "WJets_MuonPt")
        {
          setStyle (triggerEfficiency.at (design->first), kBlack, 20);
          triggerEfficiency.at (design->first)->GetXaxis ()->SetTitle ("muon p_{T} [GeV]");
        }
    }

  TPaveText *pt1 = NULL;
  if (file.find ("SingleMuon") == 0)
    pt1 = new TPaveText(0.132832,0.859453,0.486216,0.906716,"brNDC");
  else
    pt1 = new TPaveText(0.229323,0.859453,0.581454,0.906716,"brNDC");
  pt1->SetBorderSize(0);
  pt1->SetFillStyle(0);
  pt1->SetTextFont(62);
  pt1->SetTextSize(0.0374065);
  pt1->AddText(file.find ("SingleMuon") == 0 ? "CMS Preliminary" : "CMS Simulation Preliminary");

  TPaveText *pt2 = NULL;
  if (file.find ("SingleMuon") == 0)
    pt2 = new TPaveText(0.744361,0.92928,0.860902,0.977667,"brNDC");
  else
    pt2 = new TPaveText(0.827068,0.92928,0.942356,0.977667,"brNDC");
  pt2->SetBorderSize(0);
  pt2->SetFillStyle(0);
  pt2->SetTextFont(42);
  pt2->SetTextSize(0.0374065);
  pt2->AddText((file.find ("SingleMuon") == 0 ? (file == "SingleMuon_2015C" ? string ("16.34") : (file == "SingleMuon_2015D" ? string ("209.2") : string ("225.6"))) + " pb^{-1}, 13 TeV" : "13 TeV").c_str ());

  TPaveText *pt3 = new TPaveText(0.160401,0.768657,0.342105,0.863184,"brNDC");
  pt3->SetBorderSize(0);
  pt3->SetFillStyle(0);
  pt3->SetTextFont(42);
  pt3->SetTextSize(0.0349127);
  pt3->SetTextAlign(12);
  pt3->AddText((metTriggerLabel == "" ? metTrigger : metTriggerLabel).c_str ());
  pt3->AddText((file.find ("SingleMuon") == 0 ? string ("SingleMuon ") + (file == "SingleMuon_2015C" ? "2015C" : (file == "SingleMuon_2015D" ? "2015D" : "2015C+D")) + " data (25 ns)" : "W+jets MC").c_str ());

  TPaveText *pt4 = new TPaveText(0.159548,0.742537,0.341709,0.863184,"brNDC");
  pt4->SetBorderSize(0);
  pt4->SetFillStyle(0);
  pt4->SetTextFont(42);
  pt4->SetTextSize(0.0349127);
  pt4->SetTextAlign(12);
  if (file.find ("SingleMuon") == 0)
    {
      pt4->AddText(metTrigger == "hltMETClean75" ? "HLT_MET75_IsoTrk50_v2" : ("HLT_MET75_IsoTrk50_v2 OR " + (metTriggerLabel == "" ? metTrigger : metTriggerLabel)).c_str ());
      pt4->AddText((string ("SingleMuon ") + (file == "SingleMuon_2015C" ? "2015C" : (file == "SingleMuon_2015D" ? "2015D" : "2015C+D")) + " data (25 ns)").c_str ());
      pt4->AddText("hltMET75 applied");
    }
  else
    {
      pt4->AddText(metTrigger == "hltMET75" ? "HLT_MET75_IsoTrk50_v1" : ("HLT_MET75_IsoTrk50_v1 OR " + (metTriggerLabel == "" ? metTrigger : metTriggerLabel)).c_str ());
      pt4->AddText("W+jets MC");
      pt4->AddText("hltMETClean75 applied");
    }

  TCanvas *c1 = new TCanvas("c1", "c1",561,482,800,830);
  gStyle->SetOptFit(1);
  gStyle->SetOptStat(0);
  gStyle->SetOptTitle(0);
  c1->Range(0.644391,-0.1480839,3.167468,1.19299);
  c1->SetFillColor(0);
  c1->SetBorderMode(0);
  c1->SetBorderSize(2);
  c1->SetLogx();
  c1->SetTickx(1);
  c1->SetTicky(1);
  c1->SetLeftMargin(0.122807);
  c1->SetRightMargin(0.05012531);
  c1->SetTopMargin(0.06947891);
  c1->SetBottomMargin(0.1104218);
  c1->SetFrameFillStyle(0);
  c1->SetFrameBorderMode(0);
  c1->SetFrameFillStyle(0);
  c1->SetFrameBorderMode(0);

  TCanvas *c2 = new TCanvas("c2", "c2",561,482,800,830);
  gStyle->SetOptFit(1);
  gStyle->SetOptStat(0);
  gStyle->SetOptTitle(0);
  c2->Range(0.644391,-0.1480839,3.167468,1.19299);
  c2->SetFillColor(0);
  c2->SetBorderMode(0);
  c2->SetBorderSize(2);
  c2->SetLogx();
  c2->SetTickx(1);
  c2->SetTicky(1);
  c2->SetLeftMargin(0.122807);
  c2->SetRightMargin(0.05012531);
  c2->SetTopMargin(0.06947891);
  c2->SetBottomMargin(0.1104218);
  c2->SetFrameFillStyle(0);
  c2->SetFrameBorderMode(0);
  c2->SetFrameFillStyle(0);
  c2->SetFrameBorderMode(0);

  TGraphAsymmErrors *WJets_MET = NULL, *WJets_MuonPt = NULL;

  c1->cd ();
  (WJets_MET = (TGraphAsymmErrors *) triggerEfficiency.at ("WJets_MET")->Clone ())->Draw ("ap");
  pt1->Clone ()->Draw ("same");
  pt2->Clone ()->Draw ("same");
  pt3->Clone ()->Draw ("same");
  WJets_MET->GetYaxis ()->SetRangeUser (0.0, YMAX);

  c2->cd ();
  (WJets_MuonPt = (TGraphAsymmErrors *) triggerEfficiency.at ("WJets_MuonPt")->Clone ())->Draw ("ap");
  pt1->Clone ()->Draw ("same");
  pt2->Clone ()->Draw ("same");
  pt4->Clone ()->Draw ("same");
  WJets_MuonPt->GetYaxis ()->SetRangeUser (0.0, YMAX);

  TLine *l = new TLine (1.0e1, 1.0, 1.1e3, 1.0);
  l->SetLineWidth (3);
  l->SetLineStyle (2);

  c1->cd ();
  l->SetX1 (WJets_MET->GetXaxis ()->GetXmin ());
  l->SetX2 (WJets_MET->GetXaxis ()->GetXmax ());
  l->Clone ()->Draw ("same");

  c2->cd ();
  l->SetX1 (WJets_MuonPt->GetXaxis ()->GetXmin ());
  l->SetX2 (WJets_MuonPt->GetXaxis ()->GetXmax ());
  l->Clone ()->Draw ("same");

  if (!doFit)
    return;

  TF1 *f0 = new TF1 ("f0", normCDF, 1.0e1, 1.0e3, 4),
      *f1 = new TF1 ("f1", normCDF, 1.0e1, 1.0e3, 4);

  f0->SetParameter (0, 75.0);
  f0->SetParameter (1, 5.0);
  f0->FixParameter (2, 0.99);
  f0->FixParameter (3, 0.01);
  f1->SetParameter (0, 50.0);
  f1->SetParameter (1, 1.0);
  f1->FixParameter (2, 0.85);
  f1->FixParameter (3, 0.0);

  for (unsigned i = 0; i < 100; i++)
    triggerEfficiency.at ("WJets_MET")->Fit (f0, "emrq0");
  for (unsigned i = 0; i < 100; i++)
    triggerEfficiency.at ("WJets_MuonPt")->Fit (f1, "emrq0");

  f0->ReleaseParameter (2);
  f0->ReleaseParameter (3);
  f1->ReleaseParameter (2);
  f1->ReleaseParameter (3);

  for (unsigned i = 0; i < 100; i++)
    triggerEfficiency.at ("WJets_MET")->Fit (f0, "emrq0");
  triggerEfficiency.at ("WJets_MET")->Fit (f0, "emr0");
  for (unsigned i = 0; i < 100; i++)
    triggerEfficiency.at ("WJets_MuonPt")->Fit (f1, "emrq0");
  triggerEfficiency.at ("WJets_MuonPt")->Fit (f1, "emr0");

  stringstream ss0, ss1;

  TPaveText *pt5 = new TPaveText(0.159148,0.689055,0.342105,0.774876,"brNDC");
  pt5->SetBorderSize(0);
  pt5->SetFillStyle(0);
  pt5->SetTextFont(42);
  pt5->SetTextSize(0.0349127);
  pt5->SetTextAlign(12);
  ss0.str ("");
  ss0 << "#mu: (" << setprecision (3) << f0->GetParameter (0) << " #pm " << setprecision (2) << f0->GetParError (0) << ") GeV";
  pt5->AddText(ss0.str ().c_str ());
  ss0.str ("");
  ss0 << "#sigma: (" << setprecision (3) << f0->GetParameter (1) << " #pm " << setprecision (2) << f0->GetParError (1) << ") GeV";
  pt5->AddText(ss0.str ().c_str ());

  TPaveText *pt6 = new TPaveText(0.160804,0.665423,0.322864,0.746269,"brNDC");
  pt6->SetBorderSize(0);
  pt6->SetFillStyle(0);
  pt6->SetTextFont(42);
  pt6->SetTextSize(0.0349127);
  pt6->SetTextAlign(12);
  ss1.str ("");
  ss1 << "#mu: (" << setprecision (3) << f1->GetParameter (0) << " #pm " << setprecision (2) << f1->GetParError (0) << ") GeV";
  pt6->AddText(ss1.str ().c_str ());
  ss1.str ("");
  ss1 << "#sigma: (" << setprecision (3) << f1->GetParameter (1) << " #pm " << setprecision (2) << f1->GetParError (1) << ") GeV";
  pt6->AddText(ss1.str ().c_str ());

  f0->SetLineWidth (3);
  f1->SetLineWidth (3);

  c1->cd ();
  f0->Clone ()->Draw ("same");
  pt5->Clone ()->Draw ("same");
  c2->cd ();
  f1->Clone ()->Draw ("same");
  pt6->Clone ()->Draw ("same");
}
コード例 #2
0
ファイル: diphomva_inputs.C プロジェクト: ETHZ/h2gglobe
void diphomva_inputs(bool passMVAcut=false, bool equalArea=true) {

  gStyle->SetOptTitle(0);
  gStyle->SetOptStat(0);

  gStyle->SetCanvasColor(0);
  gStyle->SetFrameBorderMode(0);
  
  gStyle->SetPalette(1);
  gStyle->SetLineColor(1);

  TString preselNorm_str = "";
  if (!equalArea) preselNorm_str = "_preselNorm";

  TFile *file = TFile::Open("histograms_CMS-HGG_zeevalidation.root");
  file->cd();

  txt = new TLatex();
  txt->SetNDC();
  txt->SetTextSize(0.08);

  bdtout_cat0_DYJetsToLL->Rebin(2);
  bdtout_cat1_DYJetsToLL->Rebin(2);
  bdtout_cat2_DYJetsToLL->Rebin(2);
  bdtout_cat3_DYJetsToLL->Rebin(2);
  bdtout_cat4_DYJetsToLL->Rebin(2);
  bdtoutEB_cat0_DYJetsToLL->Rebin(2);
  bdtoutEBEE_cat0_DYJetsToLL->Rebin(2);
  bdtoutEE_cat0_DYJetsToLL->Rebin(2);
  bdtout_cat0_Data->Rebin(2);
  bdtout_cat1_Data->Rebin(2);
  bdtout_cat2_Data->Rebin(2);
  bdtout_cat3_Data->Rebin(2);
  bdtout_cat4_Data->Rebin(2);
  bdtoutEB_cat0_Data->Rebin(2);
  bdtoutEBEE_cat0_Data->Rebin(2);
  bdtoutEE_cat0_Data->Rebin(2);

  bdtout_cat0_Data->GetXaxis()->SetTitle("di-photon BDT output");
  bdtout_cat1_Data->GetXaxis()->SetTitle("di-photon BDT output, CiC cat0");
  bdtout_cat2_Data->GetXaxis()->SetTitle("di-photon BDT output, CiC cat1");
  bdtout_cat3_Data->GetXaxis()->SetTitle("di-photon BDT output, CiC cat2");
  bdtout_cat4_Data->GetXaxis()->SetTitle("di-photon BDT output, CiC cat3");
  bdtoutEB_cat0_Data->GetXaxis()->SetTitle("di-photon BDT output (both EB)");
  bdtoutEBEE_cat0_Data->GetXaxis()->SetTitle("di-photon BDT output (one EB, one EE)");
  bdtoutEE_cat0_Data->GetXaxis()->SetTitle("di-photon BDT output (both EE)");
  pho1_phoidMva_cat0_Data->GetXaxis()->SetTitle("lead photon ID MVA output");
  pho2_phoidMva_cat0_Data->GetXaxis()->SetTitle("sublead photon ID MVA output");
  sigmaMOverM_cat0_Data->GetXaxis()->SetTitle("#sigma_{M}/M_{#gamma#gamma} (right vertex)");
  sigmaMOverM_wrongVtx_cat0_Data->GetXaxis()->SetTitle("#sigma_{M}/M_{#gamma#gamma} (wrong vertex)");
  sigmaMOverM_EB_cat0_Data->GetXaxis()->SetTitle("#sigma_{M}/M_{#gamma#gamma} (right vertex, both EB)");
  sigmaMOverM_wrongVtx_EB_cat0_Data->GetXaxis()->SetTitle("#sigma_{M}/M_{#gamma#gamma} (wrong vertex, both EB)");
  sigmaMOverM_EE_cat0_Data->GetXaxis()->SetTitle("#sigma_{M}/M_{#gamma#gamma} (right vertex, both EE)");
  sigmaMOverM_wrongVtx_EE_cat0_Data->GetXaxis()->SetTitle("#sigma_{M}/M_{#gamma#gamma} (wrong vertex, both EE)");
  vtxProb_cat0_Data->GetXaxis()->SetTitle("Vertex probabilty");
  pho1_ptOverM_cat0_Data->GetXaxis()->SetTitle("lead p_{T}/M_{#gamma#gamma}");
  pho2_ptOverM_cat0_Data->GetXaxis()->SetTitle("sublead p_{T}/M_{#gamma#gamma}");
  pho1_eta_cat0_Data->GetXaxis()->SetTitle("lead #eta");
  pho2_eta_cat0_Data->GetXaxis()->SetTitle("sublead #eta");
  cosDeltaPhi_cat0_Data->GetXaxis()->SetTitle("cos(#Delta#phi)");

  bdtout_cat0_Data->GetYaxis()->SetTitle("");
  bdtout_cat1_Data->GetYaxis()->SetTitle("");
  bdtout_cat2_Data->GetYaxis()->SetTitle("");
  bdtout_cat3_Data->GetYaxis()->SetTitle("");
  bdtout_cat4_Data->GetYaxis()->SetTitle("");
  bdtoutEB_cat0_Data->GetYaxis()->SetTitle("");
  bdtoutEBEE_cat0_Data->GetYaxis()->SetTitle("");
  bdtoutEE_cat0_Data->GetYaxis()->SetTitle("");
  pho1_phoidMva_cat0_Data->GetYaxis()->SetTitle("");
  pho2_phoidMva_cat0_Data->GetYaxis()->SetTitle("");
  sigmaMOverM_cat0_Data->GetYaxis()->SetTitle("");
  sigmaMOverM_wrongVtx_cat0_Data->GetYaxis()->SetTitle("");
  sigmaMOverM_EB_cat0_Data->GetYaxis()->SetTitle("");
  sigmaMOverM_wrongVtx_EB_cat0_Data->GetYaxis()->SetTitle("");
  sigmaMOverM_EE_cat0_Data->GetYaxis()->SetTitle("");
  sigmaMOverM_wrongVtx_EE_cat0_Data->GetYaxis()->SetTitle("");
  vtxProb_cat0_Data->GetYaxis()->SetTitle("");
  pho1_ptOverM_cat0_Data->GetYaxis()->SetTitle("");
  pho2_ptOverM_cat0_Data->GetYaxis()->SetTitle("");
  pho1_eta_cat0_Data->GetYaxis()->SetTitle("");
  pho2_eta_cat0_Data->GetYaxis()->SetTitle("");
  cosDeltaPhi_cat0_Data->GetYaxis()->SetTitle("");

  bdtout_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  bdtout_cat1_Data->GetXaxis()->SetTitleSize(0.05);
  bdtout_cat2_Data->GetXaxis()->SetTitleSize(0.05);
  bdtout_cat3_Data->GetXaxis()->SetTitleSize(0.05);
  bdtout_cat4_Data->GetXaxis()->SetTitleSize(0.05);
  bdtoutEB_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  bdtoutEBEE_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  bdtoutEE_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  pho1_phoidMva_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  pho2_phoidMva_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  sigmaMOverM_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  sigmaMOverM_wrongVtx_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  sigmaMOverM_EB_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  sigmaMOverM_wrongVtx_EB_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  sigmaMOverM_EE_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  sigmaMOverM_wrongVtx_EE_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  vtxProb_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  pho1_ptOverM_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  pho2_ptOverM_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  pho1_eta_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  pho2_eta_cat0_Data->GetXaxis()->SetTitleSize(0.05);
  cosDeltaPhi_cat0_Data->GetXaxis()->SetTitleSize(0.05);

  bdtout_cat0_DYJetsToLL->SetFillColor(38);
  bdtout_cat1_DYJetsToLL->SetFillColor(38);
  bdtout_cat2_DYJetsToLL->SetFillColor(38);
  bdtout_cat3_DYJetsToLL->SetFillColor(38);
  bdtout_cat4_DYJetsToLL->SetFillColor(38);
  bdtoutEB_cat0_DYJetsToLL->SetFillColor(38);
  bdtoutEBEE_cat0_DYJetsToLL->SetFillColor(38);
  bdtoutEE_cat0_DYJetsToLL->SetFillColor(38);
  pho1_phoidMva_cat0_DYJetsToLL->SetFillColor(38);
  pho2_phoidMva_cat0_DYJetsToLL->SetFillColor(38);
  sigmaMOverM_cat0_DYJetsToLL->SetFillColor(38);
  sigmaMOverM_wrongVtx_cat0_DYJetsToLL->SetFillColor(38);
  sigmaMOverM_EB_cat0_DYJetsToLL->SetFillColor(38);
  sigmaMOverM_wrongVtx_EB_cat0_DYJetsToLL->SetFillColor(38);
  sigmaMOverM_EE_cat0_DYJetsToLL->SetFillColor(38);
  sigmaMOverM_wrongVtx_EE_cat0_DYJetsToLL->SetFillColor(38);
  vtxProb_cat0_DYJetsToLL->SetFillColor(38);
  pho1_ptOverM_cat0_DYJetsToLL->SetFillColor(38);
  pho2_ptOverM_cat0_DYJetsToLL->SetFillColor(38);
  pho1_eta_cat0_DYJetsToLL->SetFillColor(38);
  pho2_eta_cat0_DYJetsToLL->SetFillColor(38);
  cosDeltaPhi_cat0_DYJetsToLL->SetFillColor(38);

  bdtout_cat0_DYJetsToLL->SetLineColor(1);
  bdtoutEB_cat0_DYJetsToLL->SetLineColor(1);
  bdtoutEBEE_cat0_DYJetsToLL->SetLineColor(1);
  bdtoutEE_cat0_DYJetsToLL->SetLineColor(1);
  pho1_phoidMva_cat0_DYJetsToLL->SetLineColor(1);
  pho2_phoidMva_cat0_DYJetsToLL->SetLineColor(1);
  sigmaMOverM_cat0_DYJetsToLL->SetLineColor(1);
  sigmaMOverM_wrongVtx_cat0_DYJetsToLL->SetLineColor(1);
  sigmaMOverM_EB_cat0_DYJetsToLL->SetLineColor(1);
  sigmaMOverM_wrongVtx_EB_cat0_DYJetsToLL->SetLineColor(1);
  sigmaMOverM_EE_cat0_DYJetsToLL->SetLineColor(1);
  sigmaMOverM_wrongVtx_EE_cat0_DYJetsToLL->SetLineColor(1);
  vtxProb_cat0_DYJetsToLL->SetLineColor(1);
  pho1_ptOverM_cat0_DYJetsToLL->SetLineColor(1);
  pho2_ptOverM_cat0_DYJetsToLL->SetLineColor(1);
  pho1_eta_cat0_DYJetsToLL->SetLineColor(1);
  pho2_eta_cat0_DYJetsToLL->SetLineColor(1);
  cosDeltaPhi_cat0_DYJetsToLL->SetLineColor(1);

  bdtout_cat0_Data->SetMarkerStyle(20);
  bdtout_cat1_Data->SetMarkerStyle(20);
  bdtout_cat2_Data->SetMarkerStyle(20);
  bdtout_cat3_Data->SetMarkerStyle(20);
  bdtout_cat4_Data->SetMarkerStyle(20);
  bdtoutEB_cat0_Data->SetMarkerStyle(20);
  bdtoutEBEE_cat0_Data->SetMarkerStyle(20);
  bdtoutEE_cat0_Data->SetMarkerStyle(20);
  pho1_phoidMva_cat0_Data->SetMarkerStyle(20);
  pho2_phoidMva_cat0_Data->SetMarkerStyle(20);
  sigmaMOverM_cat0_Data->SetMarkerStyle(20);
  sigmaMOverM_wrongVtx_cat0_Data->SetMarkerStyle(20);
  sigmaMOverM_EB_cat0_Data->SetMarkerStyle(20);
  sigmaMOverM_wrongVtx_EB_cat0_Data->SetMarkerStyle(20);
  sigmaMOverM_EE_cat0_Data->SetMarkerStyle(20);
  sigmaMOverM_wrongVtx_EE_cat0_Data->SetMarkerStyle(20);
  vtxProb_cat0_Data->SetMarkerStyle(20);
  pho1_ptOverM_cat0_Data->SetMarkerStyle(20);
  pho2_ptOverM_cat0_Data->SetMarkerStyle(20);
  pho1_eta_cat0_Data->SetMarkerStyle(20);
  pho2_eta_cat0_Data->SetMarkerStyle(20);
  cosDeltaPhi_cat0_Data->SetMarkerStyle(20);

  bdtout_cat0_Data->SetMarkerSize(0.4);
  bdtout_cat1_Data->SetMarkerSize(0.4);
  bdtout_cat2_Data->SetMarkerSize(0.4);
  bdtout_cat3_Data->SetMarkerSize(0.4);
  bdtout_cat4_Data->SetMarkerSize(0.4);
  bdtoutEB_cat0_Data->SetMarkerSize(0.4);
  bdtoutEBEE_cat0_Data->SetMarkerSize(0.4);
  bdtoutEE_cat0_Data->SetMarkerSize(0.4);
  pho1_phoidMva_cat0_Data->SetMarkerSize(0.4);
  pho2_phoidMva_cat0_Data->SetMarkerSize(0.4);
  sigmaMOverM_cat0_Data->SetMarkerSize(0.4);
  sigmaMOverM_wrongVtx_cat0_Data->SetMarkerSize(0.4);
  sigmaMOverM_EB_cat0_Data->SetMarkerSize(0.4);
  sigmaMOverM_wrongVtx_EB_cat0_Data->SetMarkerSize(0.4);
  sigmaMOverM_EE_cat0_Data->SetMarkerSize(0.4);
  sigmaMOverM_wrongVtx_EE_cat0_Data->SetMarkerSize(0.4);
  vtxProb_cat0_Data->SetMarkerSize(0.4);
  pho1_ptOverM_cat0_Data->SetMarkerSize(0.4);
  pho2_ptOverM_cat0_Data->SetMarkerSize(0.4);
  pho1_eta_cat0_Data->SetMarkerSize(0.4);
  pho2_eta_cat0_Data->SetMarkerSize(0.4);
  cosDeltaPhi_cat0_Data->SetMarkerSize(0.4);

  bdtout_cat0_Data->SetLineColor(1);
  bdtout_cat1_Data->SetLineColor(1);
  bdtout_cat2_Data->SetLineColor(1);
  bdtout_cat3_Data->SetLineColor(1);
  bdtout_cat4_Data->SetLineColor(1);
  bdtoutEB_cat0_Data->SetLineColor(1);
  bdtoutEBEE_cat0_Data->SetLineColor(1);
  bdtoutEE_cat0_Data->SetLineColor(1);
  pho1_phoidMva_cat0_Data->SetLineColor(1);
  pho2_phoidMva_cat0_Data->SetLineColor(1);
  sigmaMOverM_cat0_Data->SetLineColor(1);
  sigmaMOverM_wrongVtx_cat0_Data->SetLineColor(1);
  sigmaMOverM_EB_cat0_Data->SetLineColor(1);
  sigmaMOverM_wrongVtx_EB_cat0_Data->SetLineColor(1);
  sigmaMOverM_EE_cat0_Data->SetLineColor(1);
  sigmaMOverM_wrongVtx_EE_cat0_Data->SetLineColor(1);
  vtxProb_cat0_Data->SetLineColor(1);
  pho1_ptOverM_cat0_Data->SetLineColor(1);
  pho2_ptOverM_cat0_Data->SetLineColor(1);
  pho1_eta_cat0_Data->SetLineColor(1);
  pho2_eta_cat0_Data->SetLineColor(1);
  cosDeltaPhi_cat0_Data->SetLineColor(1);

  if (passMVAcut) {
    bdtout_cat0_Data->GetXaxis()->SetRangeUser(-0.05,1.);
    bdtout_cat1_Data->GetXaxis()->SetRangeUser(-0.05,1.);
    bdtout_cat2_Data->GetXaxis()->SetRangeUser(-0.05,1.);
    bdtout_cat3_Data->GetXaxis()->SetRangeUser(-0.05,1.);
    bdtout_cat4_Data->GetXaxis()->SetRangeUser(-0.05,1.);
    bdtoutEB_cat0_Data->GetXaxis()->SetRangeUser(-0.05,1.);
    bdtoutEBEE_cat0_Data->GetXaxis()->SetRangeUser(-0.05,1.);
    bdtoutEE_cat0_Data->GetXaxis()->SetRangeUser(-0.05,1.);
  }

  TLegend *leg;
  leg = new TLegend(.6,.65,.87,.87);
  leg->SetBorderSize(0);
  leg->SetFillColor(10);
  leg->SetTextSize(.035);
  leg->AddEntry(vtxProb_cat0_Data,"Data (19.6fb^{-1})");
  leg->AddEntry(vtxProb_cat0_DYJetsToLL,"DYJetsToLL MC","F");

  TLegend *leg2;
  leg2 = new TLegend(.2,.65,.52,.87);
  leg2->SetBorderSize(0);
  leg2->SetFillColor(10);
  leg2->SetTextSize(.035);
  leg2->AddEntry(vtxProb_cat0_Data,"Data (19.6fb^{-1})");
  leg2->AddEntry(vtxProb_cat0_DYJetsToLL,"DYJetsToLL MC","F");

  float sf_presel = bdtout_cat0_Data->Integral()/bdtout_cat0_DYJetsToLL->Integral();
  cout << "sf_presel " << sf_presel << endl;

  //------------------------------------------------------------------------------

  TCanvas *c_bdtout = new TCanvas("c_bdtout","BDT output",2200,800);
  c_bdtout->Divide(4,2);

  c_bdtout->cd(1);
  float sf;
  if (passMVAcut) {
    sf = bdtout_cat0_Data->Integral(48,100)/bdtout_cat0_DYJetsToLL->Integral(48,100);
  } else {
    sf = bdtout_cat0_Data->Integral()/bdtout_cat0_DYJetsToLL->Integral();
  }
  bdtout_cat0_DYJetsToLL->Scale(sf);
  bdtout_cat0_Data->Draw("e");
  leg2->Draw();
  bdtout_cat0_DYJetsToLL->Draw("hist,same");
  bdtout_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();

  c_bdtout->cd(2);
  if (passMVAcut) {
    sf = bdtoutEB_cat0_Data->Integral(48,100)/bdtoutEB_cat0_DYJetsToLL->Integral(48,100);
  } else {
    sf = bdtoutEB_cat0_Data->Integral()/bdtoutEB_cat0_DYJetsToLL->Integral();
    if (!equalArea) sf = sf_presel;
  }
  bdtoutEB_cat0_DYJetsToLL->Scale(sf);
  bdtoutEB_cat0_Data->Draw("e");
  leg2->Draw();
  bdtoutEB_cat0_DYJetsToLL->Draw("hist,same");
  bdtoutEB_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();

  c_bdtout->cd(3);
  if (passMVAcut) {
    sf = bdtoutEBEE_cat0_Data->Integral(48,100)/bdtoutEBEE_cat0_DYJetsToLL->Integral(48,100);
  } else {
    sf = bdtoutEBEE_cat0_Data->Integral()/bdtoutEBEE_cat0_DYJetsToLL->Integral();
    if (!equalArea) sf = sf_presel;
  }
  bdtoutEBEE_cat0_DYJetsToLL->Scale(sf);
  bdtoutEBEE_cat0_Data->Draw("e");
  leg->Draw();
  bdtoutEBEE_cat0_DYJetsToLL->Draw("hist,same");
  bdtoutEBEE_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();

  c_bdtout->cd(4);
  if (passMVAcut) {
    sf = bdtoutEE_cat0_Data->Integral(48,100)/bdtoutEE_cat0_DYJetsToLL->Integral(48,100);
  } else {
    sf = bdtoutEE_cat0_Data->Integral()/bdtoutEE_cat0_DYJetsToLL->Integral();
    if (!equalArea) sf = sf_presel;
  }
  bdtoutEE_cat0_DYJetsToLL->Scale(sf);
  bdtoutEE_cat0_Data->Draw("e");
  leg->Draw();
  bdtoutEE_cat0_DYJetsToLL->Draw("hist,same");
  bdtoutEE_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();

  TLine *line;
  if (passMVAcut) {
    line = new TLine(-0.06,1.,1.,1.);
  } else {
    line = new TLine(-1.,1.,1.,1.);
  }
  line->SetLineColor(4);
  line->SetLineWidth(2);

  c_bdtout->cd(5);
  plotRatio(bdtout_cat0_Data,bdtout_cat0_DYJetsToLL);
  line->Draw();

  c_bdtout->cd(6);
  plotRatio(bdtoutEB_cat0_Data,bdtoutEB_cat0_DYJetsToLL);
  line->Draw();

  c_bdtout->cd(7);
  plotRatio(bdtoutEBEE_cat0_Data,bdtoutEBEE_cat0_DYJetsToLL);
  line->Draw();

  c_bdtout->cd(8);
  plotRatio(bdtoutEE_cat0_Data,bdtoutEE_cat0_DYJetsToLL);
  line->Draw();

  c_bdtout->SaveAs("bdtout"+preselNorm_str+".png");

  //------------------------------------------------------------------------------

  TCanvas *c_bdtout_basecat = new TCanvas("c_bdtout_basecat","BDT output in CiC categories",2200,800);
  c_bdtout_basecat->Divide(4,2);

  c_bdtout_basecat->cd(1);
  if (passMVAcut) {
    sf = bdtout_cat1_Data->Integral(48,100)/bdtout_cat1_DYJetsToLL->Integral(48,100);
  } else {
    sf = bdtout_cat1_Data->Integral()/bdtout_cat1_DYJetsToLL->Integral();
    if (!equalArea) sf = sf_presel;
  }
  bdtout_cat1_DYJetsToLL->Scale(sf);
  bdtout_cat1_Data->Draw("e");
  leg2->Draw();
  bdtout_cat1_DYJetsToLL->Draw("hist,same");
  bdtout_cat1_Data->Draw("e,same");
  gPad->RedrawAxis();

  c_bdtout_basecat->cd(2);
  if (passMVAcut) {
    sf = bdtout_cat2_Data->Integral(48,100)/bdtout_cat2_DYJetsToLL->Integral(48,100);
  } else {
    sf = bdtout_cat2_Data->Integral()/bdtout_cat2_DYJetsToLL->Integral();
    if (!equalArea) sf = sf_presel;
  }
  bdtout_cat2_DYJetsToLL->Scale(sf);
  bdtout_cat2_Data->Draw("e");
  leg2->Draw();
  bdtout_cat2_DYJetsToLL->Draw("hist,same");
  bdtout_cat2_Data->Draw("e,same");
  gPad->RedrawAxis();

  c_bdtout_basecat->cd(3);
  if (passMVAcut) {
    sf = bdtout_cat3_Data->Integral(48,100)/bdtout_cat3_DYJetsToLL->Integral(48,100);
  } else {
    sf = bdtout_cat3_Data->Integral()/bdtout_cat3_DYJetsToLL->Integral();
    if (!equalArea) sf = sf_presel;
  }
  bdtout_cat3_DYJetsToLL->Scale(sf);
  bdtout_cat3_Data->Draw("e");
  leg->Draw();
  bdtout_cat3_DYJetsToLL->Draw("hist,same");
  bdtout_cat3_Data->Draw("e,same");
  gPad->RedrawAxis();

  c_bdtout_basecat->cd(4);
  if (passMVAcut) {
    sf = bdtout_cat4_Data->Integral(48,100)/bdtout_cat4_DYJetsToLL->Integral(48,100);
  } else {
    sf = bdtout_cat4_Data->Integral()/bdtout_cat4_DYJetsToLL->Integral();
    if (!equalArea) sf = sf_presel;
  }
  bdtout_cat4_DYJetsToLL->Scale(sf);
  bdtout_cat4_Data->Draw("e");
  leg->Draw();
  bdtout_cat4_DYJetsToLL->Draw("hist,same");
  bdtout_cat4_Data->Draw("e,same");
  gPad->RedrawAxis();

  c_bdtout_basecat->cd(5);
  plotRatio(bdtout_cat1_Data,bdtout_cat1_DYJetsToLL);
  line->Draw();

  c_bdtout_basecat->cd(6);
  plotRatio(bdtout_cat2_Data,bdtout_cat2_DYJetsToLL);
  line->Draw();

  c_bdtout_basecat->cd(7);
  plotRatio(bdtout_cat3_Data,bdtout_cat3_DYJetsToLL);
  line->Draw();

  c_bdtout_basecat->cd(8);
  plotRatio(bdtout_cat4_Data,bdtout_cat4_DYJetsToLL);
  line->Draw();

  c_bdtout_basecat->SaveAs("bdtout_basecat"+preselNorm_str+".png");

  //------------------------------------------------------------------------------

  TCanvas *c_bdtin_1 = new TCanvas("c_bdtin_1","BDT input variables",1600,800);
  c_bdtin_1->Divide(4,2);

  c_bdtin_1->cd(1);
  sf = pho1_phoidMva_cat0_Data->Integral()/pho1_phoidMva_cat0_DYJetsToLL->Integral();
  pho1_phoidMva_cat0_DYJetsToLL->Scale(sf);
  pho1_phoidMva_cat0_Data->GetXaxis()->SetRangeUser(-0.3,0.6);
  pho1_phoidMva_cat0_Data->Draw("e");
  pho1_phoidMva_cat0_DYJetsToLL->Draw("hist,same");
  pho1_phoidMva_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg->Draw();

  c_bdtin_1->cd(2);
  sf = pho2_phoidMva_cat0_Data->Integral()/pho2_phoidMva_cat0_DYJetsToLL->Integral();
  pho2_phoidMva_cat0_DYJetsToLL->Scale(sf);
  pho2_phoidMva_cat0_Data->GetXaxis()->SetRangeUser(-0.3,0.6);
  pho2_phoidMva_cat0_Data->Draw("e");
  pho2_phoidMva_cat0_DYJetsToLL->Draw("hist,same");
  pho2_phoidMva_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg->Draw();

  c_bdtin_1->cd(3);
  gPad->SetLogy();
  sf = vtxProb_cat0_Data->Integral()/vtxProb_cat0_DYJetsToLL->Integral();
  vtxProb_cat0_DYJetsToLL->Scale(sf);
  //vtxProb_cat0_Data->GetXaxis()->SetRangeUser(0.2,1.);
  vtxProb_cat0_Data->Draw("e");
  vtxProb_cat0_DYJetsToLL->Draw("hist,same");
  vtxProb_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg2->Draw();

  c_bdtin_1->cd(4);
  gPad->SetLogy();
  sf = cosDeltaPhi_cat0_Data->Integral()/cosDeltaPhi_cat0_DYJetsToLL->Integral();
  cosDeltaPhi_cat0_DYJetsToLL->Scale(sf);
  cosDeltaPhi_cat0_Data->Draw("e");
  cosDeltaPhi_cat0_DYJetsToLL->Draw("hist,same");
  cosDeltaPhi_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg->Draw();

  c_bdtin_1->cd(5);
  plotRatio(pho1_phoidMva_cat0_Data,pho1_phoidMva_cat0_DYJetsToLL);
  line1 = (TLine*)line->Clone();
  line1->SetX1(-0.3);
  line1->SetX2(0.6);
  line1->Draw();

  c_bdtin_1->cd(6);
  plotRatio(pho2_phoidMva_cat0_Data,pho2_phoidMva_cat0_DYJetsToLL);
  line1->Draw();

  c_bdtin_1->cd(7);
  plotRatio(vtxProb_cat0_Data,vtxProb_cat0_DYJetsToLL);
  line->Draw();

  c_bdtin_1->cd(8);
  plotRatio(cosDeltaPhi_cat0_Data,cosDeltaPhi_cat0_DYJetsToLL);
  line->Draw();

  c_bdtin_1->SaveAs("bdtin_1.png");

  //------------------------------------------------------------------------------

  TCanvas *c_bdtin_2 = new TCanvas("c_bdtin_2","BDT input variables",1500,900);
  c_bdtin_2->Divide(4,3);
  c_bdtin_2->cd(1);

  sf = sigmaMOverM_cat0_Data->Integral()/sigmaMOverM_cat0_DYJetsToLL->Integral();
  sigmaMOverM_cat0_DYJetsToLL->Scale(sf);
  sigmaMOverM_cat0_Data->Draw("e");
  sigmaMOverM_cat0_DYJetsToLL->Draw("hist,same");
  sigmaMOverM_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg->Draw();

  c_bdtin_2->cd(2);
  sf = sigmaMOverM_wrongVtx_cat0_Data->Integral()/sigmaMOverM_wrongVtx_cat0_DYJetsToLL->Integral();
  sigmaMOverM_wrongVtx_cat0_DYJetsToLL->Scale(sf);
  sigmaMOverM_wrongVtx_cat0_Data->Draw("e");
  sigmaMOverM_wrongVtx_cat0_DYJetsToLL->Draw("hist,same");
  sigmaMOverM_wrongVtx_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg2->Draw();

  c_bdtin_2->cd(3);
  sf = pho1_ptOverM_cat0_Data->Integral()/pho1_ptOverM_cat0_DYJetsToLL->Integral();
  pho1_ptOverM_cat0_DYJetsToLL->Scale(sf);
  pho1_ptOverM_cat0_Data->GetXaxis()->SetRangeUser(0.2,1.2);
  pho1_ptOverM_cat0_Data->Draw("e");
  pho1_ptOverM_cat0_DYJetsToLL->Draw("hist,same");
  pho1_ptOverM_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg->Draw();

  c_bdtin_2->cd(4);
  sf = pho2_ptOverM_cat0_Data->Integral()/pho2_ptOverM_cat0_DYJetsToLL->Integral();
  pho2_ptOverM_cat0_DYJetsToLL->Scale(sf);
  pho2_ptOverM_cat0_Data->GetXaxis()->SetRangeUser(0.2,.9);
  pho2_ptOverM_cat0_Data->Draw("e");
  pho2_ptOverM_cat0_DYJetsToLL->Draw("hist,same");
  pho2_ptOverM_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg->Draw();

  c_bdtin_2->cd(5);
  gPad->SetLogy();
  sigmaMOverM_cat0_Data->Draw("e");
  sigmaMOverM_cat0_DYJetsToLL->Draw("hist,same");
  sigmaMOverM_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg->Draw();

  c_bdtin_2->cd(6);
  gPad->SetLogy();
  sigmaMOverM_wrongVtx_cat0_Data->Draw("e");
  sigmaMOverM_wrongVtx_cat0_DYJetsToLL->Draw("hist,same");
  sigmaMOverM_wrongVtx_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();

  c_bdtin_2->cd(7);
  gPad->SetLogy();
  pho1_ptOverM_cat0_Data->Draw("e");
  pho1_ptOverM_cat0_DYJetsToLL->Draw("hist,same");
  pho1_ptOverM_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg->Draw();

  c_bdtin_2->cd(8);
  gPad->SetLogy();
  pho2_ptOverM_cat0_Data->Draw("e");
  pho2_ptOverM_cat0_DYJetsToLL->Draw("hist,same");
  pho2_ptOverM_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg->Draw();

  c_bdtin_2->cd(9);
  plotRatio(sigmaMOverM_cat0_Data,sigmaMOverM_cat0_DYJetsToLL);
  line3 = (TLine*)line->Clone();
  line3->SetX1(0.);
  line3->SetX2(0.06);
  line3->Draw();

  c_bdtin_2->cd(10);
  plotRatio(sigmaMOverM_wrongVtx_cat0_Data,sigmaMOverM_wrongVtx_cat0_DYJetsToLL);
  line3->Draw();

  c_bdtin_2->cd(11);
  plotRatio(pho1_ptOverM_cat0_Data,pho1_ptOverM_cat0_DYJetsToLL);
  line4 = (TLine*)line->Clone();
  line4->SetX1(0.2);
  line4->SetX2(1.2);
  line4->Draw();

  c_bdtin_2->cd(12);
  plotRatio(pho2_ptOverM_cat0_Data,pho2_ptOverM_cat0_DYJetsToLL);
  line5 = (TLine*)line->Clone();
  line5->SetX1(0.2);
  line5->SetX2(0.9);
  line5->Draw();

  c_bdtin_2->SaveAs("bdtin_2.png");

  //------------------------------------------------------------------------------

  TCanvas *c_bdtin_3 = new TCanvas("c_bdtin_3","BDT input variables",1200,800);
  c_bdtin_3->Divide(2,2);
  c_bdtin_3->cd(1);

  c_bdtin_3->cd(1);
  sf = pho1_eta_cat0_Data->Integral()/pho1_eta_cat0_DYJetsToLL->Integral();
  pho1_eta_cat0_DYJetsToLL->Scale(sf);
  pho1_eta_cat0_Data->Draw("e");
  pho1_eta_cat0_DYJetsToLL->Draw("hist,same");
  pho1_eta_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();

  c_bdtin_3->cd(2);
  sf = pho2_eta_cat0_Data->Integral()/pho2_eta_cat0_DYJetsToLL->Integral();
  pho2_eta_cat0_DYJetsToLL->Scale(sf);
  pho2_eta_cat0_Data->Draw("e");
  pho2_eta_cat0_DYJetsToLL->Draw("hist,same");
  pho2_eta_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();

  c_bdtin_3->cd(3);
  plotRatio(pho1_eta_cat0_Data,pho1_eta_cat0_DYJetsToLL);
  line6 = (TLine*)line->Clone();
  line6->SetX1(-2.5);
  line6->SetX2(2.5);
  line6->Draw();

  c_bdtin_3->cd(4);
  plotRatio(pho2_eta_cat0_Data,pho2_eta_cat0_DYJetsToLL);
  line6->Draw();

  c_bdtin_3->SaveAs("bdtin_3.png");

  //------------------------------------------------------------------------------

  TCanvas *c_sigmam_ebee = new TCanvas("c_sigmam_ebee","BDT input variables",1500,900);
  c_sigmam_ebee->Divide(4,3);
  c_sigmam_ebee->cd(1);

  sf = sigmaMOverM_EB_cat0_Data->Integral()/sigmaMOverM_EB_cat0_DYJetsToLL->Integral();
  sigmaMOverM_EB_cat0_DYJetsToLL->Scale(sf);
  sigmaMOverM_EB_cat0_Data->Draw("e");
  sigmaMOverM_EB_cat0_DYJetsToLL->Draw("hist,same");
  sigmaMOverM_EB_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg->Draw();

  c_sigmam_ebee->cd(2);
  sf = sigmaMOverM_wrongVtx_EB_cat0_Data->Integral()/sigmaMOverM_wrongVtx_EB_cat0_DYJetsToLL->Integral();
  sigmaMOverM_wrongVtx_EB_cat0_DYJetsToLL->Scale(sf);
  sigmaMOverM_wrongVtx_EB_cat0_Data->Draw("e");
  sigmaMOverM_wrongVtx_EB_cat0_DYJetsToLL->Draw("hist,same");
  sigmaMOverM_wrongVtx_EB_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg->Draw();

  c_sigmam_ebee->cd(3);
  sf = sigmaMOverM_EE_cat0_Data->Integral()/sigmaMOverM_EE_cat0_DYJetsToLL->Integral();
  sigmaMOverM_EE_cat0_DYJetsToLL->Scale(sf);
  sigmaMOverM_EE_cat0_Data->Draw("e");
  sigmaMOverM_EE_cat0_DYJetsToLL->Draw("hist,same");
  sigmaMOverM_EE_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg->Draw();

  c_sigmam_ebee->cd(4);
  sf = sigmaMOverM_wrongVtx_EE_cat0_Data->Integral()/sigmaMOverM_wrongVtx_EE_cat0_DYJetsToLL->Integral();
  sigmaMOverM_wrongVtx_EE_cat0_DYJetsToLL->Scale(sf);
  sigmaMOverM_wrongVtx_EE_cat0_Data->Draw("e");
  sigmaMOverM_wrongVtx_EE_cat0_DYJetsToLL->Draw("hist,same");
  sigmaMOverM_wrongVtx_EE_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg2->Draw();

  c_sigmam_ebee->cd(5);
  gPad->SetLogy();
  sigmaMOverM_EB_cat0_Data->Draw("e");
  sigmaMOverM_EB_cat0_DYJetsToLL->Draw("hist,same");
  sigmaMOverM_EB_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg->Draw();

  c_sigmam_ebee->cd(6);
  gPad->SetLogy();
  sigmaMOverM_wrongVtx_EB_cat0_Data->Draw("e");
  sigmaMOverM_wrongVtx_EB_cat0_DYJetsToLL->Draw("hist,same");
  sigmaMOverM_wrongVtx_EB_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();

  c_sigmam_ebee->cd(7);
  gPad->SetLogy();
  sigmaMOverM_EE_cat0_Data->Draw("e");
  sigmaMOverM_EE_cat0_DYJetsToLL->Draw("hist,same");
  sigmaMOverM_EE_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();
  leg->Draw();

  c_sigmam_ebee->cd(8);
  gPad->SetLogy();
  sigmaMOverM_wrongVtx_EE_cat0_Data->Draw("e");
  sigmaMOverM_wrongVtx_EE_cat0_DYJetsToLL->Draw("hist,same");
  sigmaMOverM_wrongVtx_EE_cat0_Data->Draw("e,same");
  gPad->RedrawAxis();

  c_sigmam_ebee->cd(9);
  plotRatio(sigmaMOverM_EB_cat0_Data,
	    sigmaMOverM_EB_cat0_DYJetsToLL);
  line3->Draw();

  c_sigmam_ebee->cd(10);
  plotRatio(sigmaMOverM_wrongVtx_EB_cat0_Data,
	    sigmaMOverM_wrongVtx_EB_cat0_DYJetsToLL);
  line3->Draw();

  c_sigmam_ebee->cd(11);
  plotRatio(sigmaMOverM_EE_cat0_Data,
	    sigmaMOverM_EE_cat0_DYJetsToLL);
  line3->Draw();

  c_sigmam_ebee->cd(12);
  plotRatio(sigmaMOverM_wrongVtx_EE_cat0_Data,
	    sigmaMOverM_wrongVtx_EE_cat0_DYJetsToLL);
  line3->Draw();

  c_sigmam_ebee->SaveAs("sigmam_ebee.png");


}