Ejemplo n.º 1
0
void
PlotYields() {
  TFile* yieldsFile = new TFile(outputFolder + "yields.root", "recreate");
  // Start the pdf file
  TCanvas * c = new TCanvas("Yields", "Yields", 900, 700);
  c->SetLogy();
  c->Print(outputFolder + "yields.pdf[");
  TLegend* legend = new TLegend(0.7, 0.8, 0.9, 0.7);
  SetAtlasStyle();

  PlotYields("resolved", gd.resolvedYield, legend);
  //PlotYields("boosted 0.8", gd.boostedLowYield);
  //PlotYields("boosted 1.2", gd.boostedHighYield);
  PlotYields("resolved+boosted 0.8", rbLow, legend);
  PlotYields("resolved+boosted 1.2", rbHigh, legend);
  
  legend->Draw("ACp");
  c->Print(outputFolder + "yields.pdf");
  
  // Finish the pdf file
  TCanvas * c2 = new TCanvas("Yields", "Yields", 900, 700);
  c2->Print(outputFolder + "yields.pdf]");
  yieldsFile->Write();
  yieldsFile->Close();
}
////////////////////////////////////////////////////////////////////////////////////////
// Example main app 
////////////////////////////////////////////////////////////////////////////////////////
void PlotExample_v3()
{
  // !!!!!!!!!!!!!!!!!!!!
  // Load Macros and SetStyle
  gROOT->LoadMacro("ATLASStyle/AtlasUtils.C"); 
  gROOT->LoadMacro("ATLASStyle/AtlasStyle.C"); 
  gROOT->LoadMacro("ATLASStyle/AtlasLabels.C"); 
  SetAtlasStyle();

  // !!!!!!!!!!!!!!!!!!!!
  // Create Dummy nominal histograms and fill them
  TH1F* histoData    = new TH1F("histoData"   ,"histoData"   ,1,0,1);   histoData ->SetBinContent(1, 30.0);  histoData ->SetBinError(1, sqrt(30.)); 
  TH1F* histoWW      = new TH1F("histoWW"     ,"histoWW"     ,1,0,1);   histoWW   ->SetBinContent(1, 15.0);  histoWW   ->SetBinError(1,      2.0); 
  TH1F* histoTop     = new TH1F("histoTop"    ,"histoTop"    ,1,0,1);   histoTop  ->SetBinContent(1,  6.0);  histoTop  ->SetBinError(1,      2.0);
  TH1F* histoZV      = new TH1F("histoZV"     ,"histoZV"     ,1,0,1);   histoZV   ->SetBinContent(1,  4.0);  histoZV   ->SetBinError(1,      1.2);
  TH1F* histoZjets   = new TH1F("histoZjets"  ,"histoZjets"  ,1,0,1);   histoZjets->SetBinContent(1,  1.0);  histoZjets->SetBinError(1,      1.0);
  TH1F* histoFakes   = new TH1F("histoFakes"  ,"histoFakes"  ,1,0,1);   histoFakes->SetBinContent(1,  0.5);  histoFakes->SetBinError(1,      0.5);
  TH1F* histoHiggs   = new TH1F("histoHiggs"  ,"histoHiggs"  ,1,0,1);   histoHiggs->SetBinContent(1,  2.5);  histoHiggs->SetBinError(1,      1.0);
  TH1F* histoSignal1 = new TH1F("histoSignal1","histoSignal1",1,0,1); histoSignal1->SetBinContent(1,  1.0);  histoSignal1->SetBinError(1,    0.2);
  TH1F* histoSignal2 = new TH1F("histoSignal2","histoSignal2",1,0,1); histoSignal2->SetBinContent(1,  0.2);  histoSignal2->SetBinError(1,    0.0);

  // !!!!!!!!!!!!!!!!!!!!
  // RESPECT THE ORDER!!!
  TH1F* inputHistograms[9] = { histoData   ,
                               histoZjets  ,
                               histoWW     ,
                               histoTop    ,
                               histoZV     ,
                               histoFakes  ,
                               histoHiggs  , 
                               histoSignal1, 
                               histoSignal2 };

  // Here build you error bands that's internal to your code
  // Now we're using dummy ones ==> Doesn't seem to show correctly needs to debugged
  Double_t x[1] = {0.5}, y[1] = {29.0}, exl[1] = {0.5}, exh[1] = {0.5}, eyl[1] = {4.0}, eyh[1] = {5.0};
  TGraphAsymmErrors* upperPadError = new TGraphAsymmErrors(1,x,y,exl,exh,eyl,eyh); 
  Double_t xx[1] = {0.5}, yy[1] = { 1.0}, exxl[1] = {0.5}, exxh[1] = {0.5}, eyyl[1] = {0.3}, eyyh[1] = {0.4};
  TGraphAsymmErrors* lowerPadError = new TGraphAsymmErrors(1,xx,yy,exxl,exxh,eyyl,eyyh); 

  // Call the plotter  
  PlotUnifier( inputHistograms, upperPadError, lowerPadError );
}
Ejemplo n.º 3
0
void
PlotSignificance() {
  TFile* signFile = new TFile(outputFolder + "sign.root", "recreate");
  TCanvas* c = new TCanvas("Significance", "Significance", 900, 700);
  c->SetLogy();
  c->Print(outputFolder + "sign.pdf[");
  TLegend* legend = new TLegend(0.7, 0.8, 0.9, 0.7);
  SetAtlasStyle();

  PlotYields("resolved", signResolved, legend);
  PlotYields("resolved+boosted 0.8", signLow, legend);
  PlotYields("resolved+boosted 1.2", signHigh, legend);

  legend->Draw("ACp");
  c->Print(outputFolder + "sign.pdf");
  
  TCanvas* c2 = new TCanvas("Significance", "Significance", 900, 700);
  c2->Print(outputFolder + "sign.pdf]");
  signFile->Write();
  signFile->Close();
}
Ejemplo n.º 4
0
void
PlotYields(const std::string& name, std::map<double, double> yields, TLegend* legend) {
  static int pass = 0;
  int colors[] = {kBlue, kRed, kGreen, kOrange, kBlack};
  int lastColor = sizeof(colors)/sizeof(colors[0])-1;
  double miny = std::min_element(yields.begin(), yields.end(), [](std::pair<double, double> p, std::pair<double, double> q) { return p.second < q.second; })->second;
  double maxy = std::max_element(yields.begin(), yields.end(), [](std::pair<double, double> p, std::pair<double, double> q) { return p.second < q.second; })->second;

  std::string canvasName = "Yields " + name;
  //  TCanvas * c = new TCanvas(canvasName.c_str(), canvasName.c_str(), 900, 700);
  SetAtlasStyle();
  //c->SetLogy();

  TH2F* hist = new TH2F(canvasName.c_str(), canvasName.c_str(), 20, 200, 1100, 200, miny * 0.9, maxy * 1.1);
  hist->SetMarkerStyle(21+pass);
  hist->SetMarkerColor(pass > lastColor ? lastColor : colors[pass]);
  for (const std::pair<double, double>& p : yields) {
    // don't plot background yields
    if (p.first < 100) {
      continue;
    }
    
    hist->Fill(p.first, p.second);
  }
  
  if (pass == 0) {
    hist->Draw("p");
  } else {
    hist->Draw("same");
  }

  legend->AddEntry(hist, name.c_str(), "lp");

  //c->Print(outputFolder + "yields.pdf");
  ++pass;
}
Ejemplo n.º 5
0
void plot_pll(TString fname="monoh_withsm_SRCR_bg11.7_bgslop-0.0_nsig0.0.root")
{
  SetAtlasStyle();



  TFile* file =  TFile::Open(fname);
  RooWorkspace* wspace = (RooWorkspace*) file->Get("wspace");

  cout << "\n\ncheck that eff and reco terms included in BSM component to make fiducial cross-section" <<endl;
  wspace->function("nsig")->Print();
  RooRealVar* reco = wspace->var("reco");
  if(  wspace->function("nsig")->dependsOn(*reco) ) {
    cout << "all good." <<endl;
  } else {
    cout << "need to rerun fit_withsm using DO_FIDUCIAL_LIMIT true" <<endl;
    return;
  }

  /*
  // DANGER
  // TEST WITH EXAGGERATED UNCERTAINTY
  wspace->var("unc_theory")->setMax(1);
  wspace->var("unc_theory")->setVal(1);
  wspace->var("unc_theory")->Print();
  */

  // this was for making plot about decoupling/recoupling approach
  TCanvas* tc = new TCanvas("tc","",400,400);
  RooPlot *frame = wspace->var("xsec_bsm")->frame();
  RooAbsPdf* pdfc = wspace->pdf("jointModeld");
  RooAbsData* data = wspace->data("data");
  RooAbsReal *nllJoint = pdfc->createNLL(*data, RooFit::Constrained()); // slice with fixed xsec_bsm
  RooAbsReal *profileJoint = nllJoint->createProfile(*wspace->var("xsec_bsm"));

  wspace->allVars().Print("v");
  pdfc->fitTo(*data);
  wspace->allVars().Print("v");
  wspace->var("xsec_bsm")->Print();
  double nllmin = 2*nllJoint->getVal();
  wspace->var("xsec_bsm")->setVal(0);
  double nll0 = 2*nllJoint->getVal();
  cout << Form("nllmin = %f, nll0 = %f, Z=%f", nllmin, nll0, sqrt(nll0-nllmin)) << endl;
  nllJoint->plotOn(frame, RooFit::LineColor(kGreen), RooFit::LineStyle(kDotted), RooFit::ShiftToZero(), RooFit::Name("nll_statonly")); // no error
  profileJoint->plotOn(frame,RooFit::Name("pll") );
  wspace->var("xsec_sm")->Print();
  wspace->var("theory")->Print();
  wspace->var("theory")->setConstant();
  profileJoint->plotOn(frame, RooFit::LineColor(kRed), RooFit::LineStyle(kDashed), RooFit::Name("pll_smfixed") );

  frame->GetXaxis()->SetTitle("#sigma_{BSM, fid} [fb]");
  frame->GetYaxis()->SetTitle("-log #lambda  ( #sigma_{BSM, fid} )");
  double temp = frame->GetYaxis()->GetTitleOffset();
  frame->GetYaxis()->SetTitleOffset( 1.1* temp );

  frame->SetMinimum(1e-7);
  frame->SetMaximum(4);


  // Legend
  double x1,y1,x2,y2;
  GetX1Y1X2Y2(tc,x1,y1,x2,y2);
  TLegend *legend_sr=FastLegend(x2-0.75,y2-0.3,x2-0.25,y2-0.5,0.045);
  legend_sr->AddEntry(frame->findObject("pll"),"with #sigma_{SM} uncertainty","L");
  legend_sr->AddEntry(frame->findObject("pll_smfixed"),"with #sigma_{SM} constant","L");
  legend_sr->AddEntry(frame->findObject("nll_statonly"),"no systematics","L");
  frame->Draw();
  legend_sr->Draw("SAME");



  // descriptive text
  vector<TString> pavetext11;
  pavetext11.push_back("#bf{#it{ATLAS Internal}}");
  pavetext11.push_back("#sqrt{#it{s}} = 8 TeV #scale[0.6]{#int}Ldt = 20.3 fb^{-1}");
  pavetext11.push_back("#it{H}+#it{E}_{T}^{miss} , #it{H #rightarrow #gamma#gamma}, #it{m}_{#it{H}} = 125.4 GeV");

  TPaveText* text11=CreatePaveText(x2-0.75,y2-0.25,x2-0.25,y2-0.05,pavetext11,0.045);
  text11->Draw();

  tc->SaveAs("pll.pdf");



  /*
  wspace->var("xsec_bsm")->setConstant(true);
  wspace->var("eff"     )->setConstant(true);
  wspace->var("mh"      )->setConstant(true);
  wspace->var("sigma_h" )->setConstant(true);
  wspace->var("lumi"    )->setConstant(true);
  wspace->var("xsec_sm" )->setVal(v_xsec_sm);
  wspace->var("eff"     )->setVal(1.0);
  wspace->var("lumi"    )->setVal(v_lumi);
  TH1* nllHist = profileJoint->createHistogram("xsec_bsm",100);
  TFile* out = new TFile("nllHist.root","REPLACE");
  nllHist->Write()
  out->Write();
  out->Close();
  */

}
Ejemplo n.º 6
0
void paper_fit_plot()
{
  SetAtlasStyle();

  // get the stuff from the file
  char fname_postfit[200] = "monoh_withsm_SRCR_bg11.7_bgslop-0.0_nsig0.0.root";
  TFile *tf = new TFile(fname_postfit);
  RooWorkspace *ws_post = (RooWorkspace*)tf->Get("wspace");

  // data and pdf
  RooAbsData *data = ws_post->data("data");
  RooAbsPdf *pdfc = ws_post->pdf("jointModeld");
  
  // variables to be constrained
  RooRealVar *mh = ws_post->var("mh");
  RooRealVar *sigma_h = ws_post->var("sigma_h");
  RooRealVar *eff = ws_post->var("eff");
  RooRealVar *theory = ws_post->var("theory");
  RooRealVar *lumi = ws_post->var("lumi");
  RooRealVar *x_mgg = ws_post->var("mgg");
  RooArgSet cas(*mh,*sigma_h,*eff,*theory,*lumi);  

  // redo the fit
  RooFitResult *r = pdfc->fitTo(*data,RooFit::Constrain(cas),RooFit::Save(true));

  // make the frame
  RooPlot *frame = x_mgg->frame();
  TCanvas *tc = new TCanvas("tc","",700,500);
  frame->GetXaxis()->SetTitle("m_{#gamma#gamma} [GeV]");
  frame->GetYaxis()->SetTitle("Events / 1 GeV");

  // add the data
  data->plotOn(frame,RooFit::Binning(55),RooFit::Name("xdata"),RooFit::DataError(RooAbsData::Poisson));
  //data->plotOn(frame,RooFit::Binning(11),RooFit::Name("xdata"),RooFit::DataError(RooAbsData::Poisson));


  ///  PDFs
  pdfc->plotOn(frame, RooFit::Components("E"), RooFit::LineColor(kRed),   RooFit::Name("xbackground"));
  pdfc->plotOn(frame, RooFit::Components("S"), RooFit::LineColor(kBlue),RooFit::LineStyle(kDotted),   RooFit::Name("xsm"));
  pdfc->plotOn(frame, RooFit::Components("G"), RooFit::LineColor(kGreen),RooFit::LineStyle(kDotted),   RooFit::Name("xbsm"));
  pdfc->plotOn(frame, RooFit::LineColor(kRed), RooFit::LineStyle(kDashed),RooFit::Name("xtotal"));

  frame->SetMinimum(1e-7);
  frame->SetMaximum(9);

  // Legend
  double x1,y1,x2,y2;
  GetX1Y1X2Y2(tc,x1,y1,x2,y2);
  TLegend *legend_sr=FastLegend(x1+0.02,y2-0.3,x1+0.35,y2-0.02,0.045);
  legend_sr->AddEntry(frame->findObject("xdata"),"Data","LEP");
  legend_sr->AddEntry(frame->findObject("xbackground"),"Background fit","L");
  legend_sr->AddEntry(frame->findObject("xsm"),"SM H","L");
  legend_sr->AddEntry(frame->findObject("xbsm"),"Best-fit BSM H","L");
  legend_sr->AddEntry(frame->findObject("xtotal"),"Total","L");
  frame->Draw();
  legend_sr->Draw("SAME");

  // descriptive text
  vector<TString> pavetext11;
  pavetext11.push_back("#bf{#it{ATLAS Internal}}");
  pavetext11.push_back("#sqrt{#it{s}} = 8 TeV #scale[0.6]{#int}#it{L} dt = 20.3 fb^{-1}");
  pavetext11.push_back("#it{H + E}_{T}^{miss} , #it{H #rightarrow #gamma#gamma}, #it{m}_{#it{H}} = 125.4 GeV");

  TPaveText* text11=CreatePaveText(x2-0.47,y2-0.25,x2-0.05,y2-0.05,pavetext11,0.045);
  text11->Draw();
  tc->Print("paper_fit_plot.pdf");
 }
Ejemplo n.º 7
0
void plot_pdf(string name="g", double q2=1.9, string dir="output/Graphs.root",
              string name2=" ",string dir2=" ")
{
    SetAtlasStyle();
    TFile t(dir.c_str());
    TGraphAsymmErrors *p;
    TString nn;
    nn.Form("%s_vs_x_for_Q^{2}=%g",name.c_str(),q2);
    gDirectory->GetObject(nn,p);
//    gDirectory->ls();


    if (p == NULL) {
        cout << "Can not find graph "<< nn.Data()<<endl;
        return;
    }
//    p->Print();


    TGraphAsymmErrors *p2 = NULL;
    TGraphAsymmErrors *r2 = NULL;

    if (name2 != " ") {
        if (dir2 != " ") {
            TFile t(dir2.c_str());
        }
        nn.Form("%s_vs_x_for_Q^{2}=%g",name2.c_str(),q2);
        gDirectory->GetObject(nn,p2);
        p2->SetFillStyle(3001);
        p2->SetFillColor(kBlue);
        r2 = (TGraphAsymmErrors*)p2->Clone();
    }

    TGraphAsymmErrors *r = (TGraphAsymmErrors*)p->Clone();

    for(Int_t i=0; i<p->GetN(); i++) {
        r->SetPoint(i, p->GetX()[i], 1.);

        Double_t err =  p->GetErrorY(i);
        Double_t val =  p->GetY()[i];
        Double_t rat = ( val != 0 )? err/val : 0;
        r->SetPointError(i, 0, 0, rat, rat);

        if ( p2 != NULL) {
//        r2->SetPoint(i, p2->GetX()[i],  p2->GetY()[i]/ p->GetY()[i]);
            r2->SetPoint(i, p2->GetX()[i],  1.);



            Double_t err =  p2->GetErrorY(i);

            Double_t val =  p2->GetY()[i];

            Double_t rat = ( val != 0 )? err/val : 0;

            r2->SetPointError(i, 0, 0, rat, rat);


        }

    }

    Double_t ratsize = 0.3;

    TCanvas *c = new TCanvas("PDF","pdf",600,600);
    TPad *pad1 = new TPad("pad1","pad1",0.,ratsize,1.,1.);
    pad1->SetLogx();
    pad1->Draw();
    pad1->cd();
    p->GetXaxis()->Set(101,0.0001,1.);
    p->SetFillColor(kRed-10);
    p->SetFillStyle(1001);
    p->SetLineWidth(1);
    p->SetLineColor(kRed-2);
    p->GetYaxis()->SetTitle(name.c_str());

    p->GetYaxis()->SetTitleSize(0.06);
    p->GetYaxis()->SetTitleOffset(1.);
    p->GetXaxis()->Set(101,0.0001,1.);

    p->Draw("ACE3");

    if (p2 != NULL) {
        p2->SetLineColor(kBlue);
        p2->Draw("CE3");
    }

    c->cd();
    TPad *pad2 = new TPad("pad1","pad1",0.,0.,1.,ratsize);
    pad1->SetBottomMargin(0.);
    pad2->SetTopMargin(0.);
    pad2->SetBottomMargin(0.3);
    pad2->SetLogx();
    pad2->Draw();
    pad2->cd();
    r->SetMaximum(1.35);
    r->SetMinimum(0.65);
    r->GetYaxis()->SetNdivisions(504);
    r->GetYaxis()->SetLabelSize(0.12);
    r->GetXaxis()->SetLabelSize(0.12);
    r->GetXaxis()->SetLabelOffset(0.03);
    r->GetXaxis()->Set(101,0.0001,1.);
    r->GetXaxis()->SetTitle("x  ");
    r->GetXaxis()->SetTitleSize(0.12);
    r->GetXaxis()->SetTitleOffset(1.);

    //r->GetXaxis()->SetTitleOffset(0.5);
    //  r->GetXaxis()->SetTitleSize(.15);
    r->SetFillColor(2);
    r->SetFillStyle(1001);

    r->SetFillColor(kRed-10);
    r->SetLineStyle(1);
    r->SetLineWidth(1);


    r->Draw("ALE3");

    if (r2 != NULL) {
        r2->SetFillColor(kBlue);
        r2->SetFillStyle(3001);
        r2->Draw("E3");
    }


}
Ejemplo n.º 8
0
// *************************************** //
// this is a function that takes a set of  //
// histograms and draws them on a canvas   //
// in a stack, returning the canvas        //
// just for MC- no ratio and no data.      //
// This one includes syst and stat or just //
// stat errors                             //
// *************************************** //
TCanvas* drawPlots::plot_MC_noRatio_wError(std::vector<TH1D*> histos, std::vector<std::string> names, std::string axisName, TH1D* signal, TH1D* errDown, TH1D* errUp){

   const unsigned int MAINPLOT_WIDTH  = 800;
   const unsigned int MAINPLOT_HEIGHT = 600;
   
   
   TCanvas* canvas = new TCanvas("canvas","canvas",0,0,MAINPLOT_WIDTH,MAINPLOT_HEIGHT);
   
   canvas->SetMargin(0.,0.,0.,0.);
   canvas->cd();
   
   double main_y_max = -99;
   double main_y_min = -99;
   double main_x_max = -99;
   double main_x_min = -99;
   for(int a=0; a<histos.size(); a++){
      GetAxisLimits(histos[a], main_x_min, main_x_max, main_y_min, main_y_max);
   }
   
   // create main pad
   TPad* mainPad = new TPad("main","main",0.,0.,1.,1.);
   mainPad->SetMargin(0.15,0.05,0.15,.05); // left, right, bottom, top
   mainPad->Draw();
   mainPad->cd();
   
   SetAtlasStyle();

   THStack* Stack = new THStack();
   std::string title = std::string(";") + axisName + ";Events";
   Stack->SetTitle(title.c_str());
   
   for(int b=0; b<histos.size(); b++){
      histos[b]->SetLineColor(1);
      histos[b]->SetFillColor(tools::setColor(names[b]));
      Stack->Add(histos[b]);
   }
   
   main_y_max = main_y_max*1.5;
   Stack->SetMaximum(main_y_max);
   Stack->Draw("hist");
   
   errDown->Draw("E2same");
   errUp->Draw("E2Same");
   
   signal->SetLineStyle(2);
   signal->SetLineColor(kRed);
   signal->Draw("hist same");
   
   TLegend* leg = new TLegend(0.7,0.7,0.93,0.9);
   leg->SetFillStyle(0);
   leg->SetBorderSize(0);
   leg->AddEntry(signal, "Signal", "f");
   for(int q=0; q<histos.size(); q++){
      leg->AddEntry(histos[q], names[q].c_str(), "f");
   }
   leg->Draw("lpe");
   
   ATLAS_LABEL(0.2,0.85,1);
   char text[]="#sqrt{s}=8 TeV";
   myText(0.2,0.7,1,text);
   
   return canvas;
}
Ejemplo n.º 9
0
// *************************************** //
// this is a function that takes a set of  //
// histograms and draws them on a canvas   //
// in a stack, returning the canvas.       //
// It also plots the signal as a dashed    //
// line and the data with a ratio at the   //
// the bottom of data/allBackgrounds       //
//                                         //
// This one is supposed to make plots for  //
// the paper draft                         //
// *************************************** //
TCanvas* drawPlots::plotAll_VLQ_paperStyle(std::vector<TH1D*> histos, std::vector<std::string> names, std::string axisName, std::vector<TH1D*> signal, TH1D* data, TGraphAsymmErrors* err, bool doLogAxis, std::string extraTag){

   const unsigned int CANVAS_WIDTH  = 720;
   const unsigned int CANVAS_HEIGHT = 750;
   const double RATIOPLOT_YAXIS_TITLE_OFFSET = 0.75;
   const double RATIOPLOT_YAXIS_TITLE_SIZE   = 0.11;
   const double RATIOPLOT_YAXIS_LABEL_SIZE   = 0.09;  
   const double RATIOPLOT_XAXIS_TITLE_OFFSET = 1.6;
   const double RATIOPLOT_XAXIS_TITLE_SIZE   = 0.11;
   const double RATIOPLOT_XAXIS_LABEL_SIZE   = 0.09;
   
   TCanvas* canvas = new TCanvas("canvas","canvas",0,0,CANVAS_WIDTH,CANVAS_HEIGHT);
   
   canvas->SetMargin(0.,0.,0.,0.);
   canvas->Clear();
   //canvas->cd();
   
   SetAtlasStyle();
   gStyle->SetHistLineWidth(1.);
   gStyle->SetErrorX(0);

   err->SetLineColor(kWhite);
   err->SetLineWidth(0);

   // create histogram to store all backgrounds
   TH1D* allBackgrounds;
   bool gotSomething=false;
   for(int c=0; c<signal.size(); c++){
     if(signal[c]){
       allBackgrounds = (TH1D*)signal[c]->Clone("all_backgrounds");
       gotSomething=true;
     }
   }

   if(!gotSomething && data){
     allBackgrounds = (TH1D*)data->Clone("all_backgrounds");
     gotSomething=true;
   }
   if(!gotSomething){
     for(int b=0; b<histos.size(); b++){
       if(histos[b] && !gotSomething){
	 allBackgrounds = (TH1D*)histos[b]->Clone("all_backgrounds");
	 gotSomething=true;
       }
     }
   }

   if(!gotSomething){
     std::cout << "Error: could not find any background, data, or signal for this plot" << std::endl;
     return canvas;
   }
   
   // set all bins to zero
   for(int i=0; i<=allBackgrounds->GetNbinsX()+1; i++)
     allBackgrounds->SetBinContent(i,0);

   // go through histos and combine the histograms that need to be combined
   // WZ stays separate, ttV stays separate, all others become "Other bkg"
   TH1D* otherBkgs=0; TH1D* ttbarX=0; TH1D* WZ_Sherpa=0;
   for(int cc=0; cc<histos.size(); cc++){
     if(histos[cc]){
       for(int j=0; j<=allBackgrounds->GetNbinsX()+1; j++){
	 double binContent=allBackgrounds->GetBinContent(j)+histos[cc]->GetBinContent(j);
	 allBackgrounds->SetBinContent(j,binContent);
       }
       
       if(names[cc]=="ttbarX")
	 ttbarX=(TH1D*)histos[cc]->Clone("ttbarX_new");
       else if(names[cc]=="WZ_Sherpa")
	 WZ_Sherpa=(TH1D*)histos[cc]->Clone("WZ_new");
       else{

	 if(!otherBkgs)
	   otherBkgs=(TH1D*)histos[cc]->Clone("other_bkg_new");
	 else
	   otherBkgs->Add(histos[cc]);
       }
     }
   }

   // make stack of backgrounds, fill backgrounds histogram
   THStack* Stack = new THStack();
   if(ttbarX){
     ttbarX->SetLineColor(kGray);
     ttbarX->SetFillColor(kGray);
     Stack->Add(ttbarX);
   }
   if(WZ_Sherpa){
     WZ_Sherpa->SetLineColor(kBlue-9);
     WZ_Sherpa->SetFillColor(kBlue-9);
     Stack->Add(WZ_Sherpa);
   }
   if(otherBkgs){
     otherBkgs->SetLineColor(kOrange-2);
     otherBkgs->SetFillColor(kOrange-2);
     Stack->Add(otherBkgs);
   }

   TH1D* backgroundsForRatio = (TH1D*)allBackgrounds->Clone("bkgds_for_ratio");

   // create main pad
   const double mainPad_ylow  = 0.3;
   const double mainPad_yhigh = 0.95;
   const double mainPad_xlow = 0.;
   const double mainPad_xhigh = 0.95;
   const double pad_margin_left = 0.2;
   const double pad_margin_right  = 0.02;
   double main_y_max = -99;
   double main_y_min = -99;

   TPad* mainPad = new TPad("main","main",mainPad_xlow,mainPad_ylow,mainPad_xhigh,mainPad_yhigh);
   mainPad->SetMargin(pad_margin_left,pad_margin_right,0.,.05); // left, right, bottom, top
   mainPad->Draw();
   mainPad->cd();

   // find max y
   if(allBackgrounds){
     int maxBinBkg = allBackgrounds->GetMaximumBin();
     double bkgYmax = allBackgrounds->GetBinContent(maxBinBkg);
     main_y_max = bkgYmax;
   }
   if(data){
     int maxBinData = data->GetMaximumBin();
     double dataYmax = data->GetBinContent(maxBinData);
     if(dataYmax > main_y_max) main_y_max = dataYmax;
   }
   if(main_y_max < .002) main_y_max = .1;

   if(doLogAxis){
     mainPad->SetLogy();
     main_y_min = 0.07;
     main_y_max*=60;
   }else{
     main_y_min = 0.001;
     main_y_max*=1.6;
   }

   // draw axis
   allBackgrounds->SetMaximum(main_y_max);
   allBackgrounds->SetMinimum(main_y_min);
   std::string title = std::string(";") + axisName + ";Events";
   std::stringstream binw; 
   
   binw<<allBackgrounds->GetBinWidth(1);
   std::string width = binw.str();
   if (axisName.find("GeV") != std::string::npos){
     width += " GeV";
     title += " / "+width;
   }
   allBackgrounds->SetTitle(title.c_str());   
   allBackgrounds->GetYaxis()->SetTitleOffset(1.4);
   allBackgrounds->GetYaxis()->SetTitleSize(0.06);
   allBackgrounds->GetXaxis()->SetTitleOffset(1.2);
   allBackgrounds->GetYaxis()->SetLabelSize(0.04);
   allBackgrounds->GetXaxis()->SetLabelSize(0.04);
   allBackgrounds->Draw("hist");

   // draw stack with error
   Stack->Draw("hist same");
   if(err){
     err->Draw("E2 same");
   }

   // make error histograms for the ratio plot
   TGraphAsymmErrors* ratioErr = tools::getRatio(err, backgroundsForRatio);

   // draw data
   if(data)
      data->Draw("e same");

   // draw signal
   if(signal[0]){
     signal[0]->SetLineStyle(2);
     signal[0]->SetLineColor(kRed+2);//kGreen+3 before
     signal[0]->SetLineWidth(5);
     signal[0]->Draw("hist same");
   }
   if(signal.size() > 1){
     if(signal[1]){
       //signal[1]->SetLineStyle(2);
       signal[1]->SetLineColor(kRed+2);
       signal[1]->SetLineWidth(4);
       signal[1]->Draw("hist same");
     }
     if(signal.size() > 2){
       if(signal[2]){
	 //signal[2]->SetLineStyle(2);
	 signal[2]->SetLineColor(kBlue+2);
	 signal[2]->SetLineWidth(4);
	 signal[2]->Draw("hist same");
       }
     }
   }
   allBackgrounds->Draw("axis same");

   // draw legend
   float leg_height = 0.3;
   float leg_width = 0.2;
   float leg_xoffset = 0.74;
   float leg_yoffset = 0.77;
   
   TLegend* leg = new TLegend(leg_xoffset,leg_yoffset-leg_height/2,leg_xoffset+leg_width,leg_yoffset+leg_height/2);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   leg->SetBorderSize(0);
   leg->SetTextFont(52);
   leg->SetTextSize(0.033);
   
   // currently assuming first signal is Tbq (single T production), second is TTS, third is BBS
   leg->AddEntry(data, "data 2012");
   leg->AddEntry(otherBkgs, "Other bkg.", "f");
   leg->AddEntry(WZ_Sherpa, "WZ", "f");
   leg->AddEntry(ttbarX, "t#bar{t}+X", "f");
   if(signal.size()>1){
     if(signal[2])
       leg->AddEntry(signal[2], "B#bar{B} (650 GeV)", "l");
     if(signal[1])
       leg->AddEntry(signal[1], "T#bar{T} (650 GeV)", "l");
   }   
   if(signal[0])
     leg->AddEntry(signal[0], "T#bar{b}q (650 GeV)", "l");
   
   
   leg->AddEntry( err, "Uncertainty", "f");


   leg->Draw("lpe");
   
   ATLAS_LABEL(0.24,0.86,1);
   myText(0.36, 0.86, 1, .05, "Internal");
   char text[]="#sqrt{s}=8 TeV";
   myText(0.55,0.77,1,.04, text);
   char text_L[]="#int L dt = 20.3 fb^{-1}";
   myText(0.5, 0.84,1, .04, text_L);
   if(extraTag!=""){
     char tag_txt[extraTag.size()];
     strcpy(tag_txt, extraTag.c_str());
     if(extraTag.size()>15)
       myText(0.7, 0.56, 1, .04, tag_txt);
     else
       myText(0.75, 0.56, 1, .04, tag_txt);
   }
   char text_tri[]="Trilepton";
   myText(0.55, 0.70, 1, .04, text_tri);

   /*
   double back_int = allBackgrounds->Integral(0,allBackgrounds->GetNbinsX()+1);
   int t;
   char inText[100];
   if(back_int > 10000.)
     t=sprintf(inText, "N_{B} = %.3e", back_int);
   else
     t=sprintf(inText, "N_{B} = %.1f", back_int);
   myText(0.24, 0.6, 1, .04, inText);
   if(data)
     t=sprintf(inText, "N_{D} = %.0f", data->Integral(0,data->GetNbinsX()+1));
   else
     t=sprintf(inText, "N_{D} = %.0f", 0.);
   myText(0.24, 0.7, 1, .04, inText);
   */
   canvas->cd();
   
   // Draw Ratio plot
   // 1.6 and .4 are the normal ones
   double ratio_max = 3.2;
   double ratio_min = -.9;
  
   double pad_xlow = 0.;
   double pad_xhigh = 0.95;
   double pad_ylow = 0.0;
   double pad_yhigh = 0.3;
   
   const char* pad_name = "pad";
   TPad* pad4ratio = new TPad(pad_name,pad_name,pad_xlow,pad_ylow,pad_xhigh,pad_yhigh);

   pad4ratio->SetMargin(pad_margin_left,pad_margin_right,0.46,0.);
   pad4ratio->Draw();
   pad4ratio->cd();

   TH1D* ratioPlot;
   if(data)
     ratioPlot = (TH1D*)data->Clone("ratio");
   else if (signal[0]) 
     ratioPlot = (TH1D*)signal[0]->Clone("ratio"); // just for getting the axis
   else if (signal[1])
     ratioPlot = (TH1D*)signal[1]->Clone("ratio");
   else
     return canvas;

   ratioPlot->SetTitle("");
   ratioPlot->Divide(allBackgrounds);
   ratioPlot->GetYaxis()->SetTitle("Data / bkg");
   ratioPlot->GetXaxis()->SetTitle(axisName.c_str());

   if (data){
     
     // here change ratio_min and ratio_max if the ratio plot is quite flat
     double maxDeviation=0;
     double minDeviation=10.;
     double tempDev=0;
     for(int ibin=1; ibin<=allBackgrounds->GetNbinsX(); ibin++){
       double binContent = ratioPlot->GetBinContent(ibin);
       tempDev=0;
       if(binContent>0 && binContent < 10) tempDev = std::abs(binContent-1.);
       if(tempDev > maxDeviation) maxDeviation = tempDev;
       if(tempDev < minDeviation) minDeviation = tempDev;
     }
     if(maxDeviation < 0.6){
       ratio_max = 1.6;
       ratio_min = 0.4;
     }
     else if(maxDeviation < 0.1){
       ratio_max = 1.12;
       ratio_min = 0.88;
     }
     else if(maxDeviation < 0.2){
       ratio_max = 1.25;
       ratio_min = .75;
     }
     if(minDeviation > 1.5){
       if(minDeviation > 2.)
	 ratio_max = 2.7;
       else
	 ratio_max = 2.2;
     }
     ratioPlot->SetMinimum(ratio_min);
     ratioPlot->SetMaximum(ratio_max);
   }     

   if(ratioPlot->GetXaxis()->GetNdivisions() > ratioPlot->GetNbinsX())
     ratioPlot->GetXaxis()->SetNdivisions(ratioPlot->GetNbinsX());
   if(ratioPlot->GetXaxis()->GetNdivisions() > 11)
     ratioPlot->GetXaxis()->SetNdivisions(11);
   ratioPlot->GetXaxis()->SetLabelSize(RATIOPLOT_XAXIS_LABEL_SIZE);
   ratioPlot->GetYaxis()->SetLabelSize(RATIOPLOT_YAXIS_LABEL_SIZE);
   ratioPlot->GetYaxis()->SetNdivisions(3);
   ratioPlot->GetYaxis()->SetTitleSize(RATIOPLOT_YAXIS_TITLE_SIZE);
   ratioPlot->GetYaxis()->SetTitleOffset(RATIOPLOT_YAXIS_TITLE_OFFSET);
   ratioPlot->GetXaxis()->SetTitleSize(RATIOPLOT_XAXIS_TITLE_SIZE);
   ratioPlot->GetXaxis()->SetTitleOffset(RATIOPLOT_XAXIS_TITLE_OFFSET);
   
   if(data){
     ratioPlot->Draw();
     // plot horizontal line at y=1
     TF1* horizontal = new TF1("horizontal","pol1",-10000,10000);
     horizontal->SetParameter(0,1.);
     horizontal->SetParameter(1,0.);
     horizontal->SetLineColor(kBlack);
     horizontal->SetLineStyle(2);
     horizontal->SetLineWidth(1);
     horizontal->Draw("same");
     ratioErr->Draw("E2 same");
   }else{ // there is no data
     ratioPlot->Draw("axis");
     char text[]="NO DATA";
     myText(0.4,0.6,1,.15,text);
   }
   
   return canvas;
}
void E1E2_mc15c_GEO_s2984(std::string ext_infilelist_data="DEFAULT", std::string ext_infilelist_mc="DEFAULT", std::string ext_infilelist_s2984="DEFAULT"){

  SetAtlasStyle();

  gStyle->SetOptStat(0);
  gStyle->SetOptTitle(0);
  TH1::SetDefaultSumw2(kTRUE);
  gROOT->SetBatch(kTRUE);

  TFile* file_nominal;
  TFile* file_data;
  TFile* file_geo;

  //mc file
  if (ext_infilelist_mc.compare("DEFAULT") == 0) {
    //file_nominal = TFile::Open("~/ZeeInvariantMassPeak/SavedWork/GridJobs/user.ahupe.nov07.mc15_13TeV.DAOD_EGAM1_INC/user.ahupe.nov07.mc15_13TeV.DAOD_EGAM1_INC.root");
    //file_nominal = TFile::Open("~/ZeeInvariantMassPeak/SavedWork/GridJobs/user.ahupe.2017.april19.mc15_13TeV.DAOD_EGAM1.e3601_s2576_s2132_r7725_r7676_p3012/inc_user.ahupe.2017.april19.mc15_13TeV.DAOD_EGAM1.e3601_s2576_s2132_r7725_r7676_p3012_COMBINED.root");
    //file_nominal = TFile::Open("user.ahupe.2017.may18.mc15_13TeV.2016MODE.DAOD_EGAM1.e3601_s2576_s2132_r7725_r7676_p3012_COMBINED.root");
    file_nominal = TFile::Open("user.ahupe.TheRush.may26.mc15_13TeV.2016MODE.DAOD_EGAM1.e3601_s2576_s2132_r7725_r7676_p3012_COMBINED.root");
  } else {
    file_nominal = TFile::Open(ext_infilelist_mc.c_str());
  }
  
  //data file
  if (ext_infilelist_data.compare("DEFAULT") == 0) {
    //file_data = TFile::Open("~/ZeeInvariantMassPeak/SavedWork/GridJobs/user.ahupe.nov07.data15_13TeV.DAOD_EGAM1_INC/user.ahupe.nov07.data15_13TeV.DAOD_EGAM1_INC.root");
    //file_data = TFile::Open("~/ZeeInvariantMassPeak/SavedWork/GridJobs/user.ahupe.2017.april19.NO_TRIGMATCH.data15_13TeV.DAOD_EGAM1.r7562_p2521_p3013/user.ahupe.2017.april19.NO_TRIGMATCH.data15_13TeV.DAOD_EGAM1.r7562_p2521_p3013_COMBINED.root");
    file_data = TFile::Open("user.ahupe.Final.may26.WITH_K.dataCOMBINED_13TeV.DAOD_EGAM1.grp16_v01_p2950_hist_COMBINED.root");
  } else {
    file_data = TFile::Open(ext_infilelist_data.c_str());
  }
  
  //altgeo file
  if (ext_infilelist_s2984.compare("DEFAULT") == 0) {
    file_geo = TFile::Open("user.ahupe.TheRush.jun05.mc15_13TeV.s2984GEO.2016MODE.DAOD_EGAM1.e3601_s2984_r8585_r7676_p2666_tid10296884_00_hist_COMBINED.root");
  } else {
    file_geo = TFile::Open(ext_infilelist_s2984.c_str());
  }

  TFile* outputfile;
  outputfile = TFile::Open("E1E2_mc2015_s2984_Diff.root","RECREATE");

  //TProfile* mc_hist1 = (TProfile*)(file_nominal->Get("h_matvar_E1E2_corr_A_etaCALO_PROFILE"));
  TProfile* mc_hist1 = (TProfile*)(file_nominal->Get("h_matvar_E1E2_corr_run2_A_etaCALO_PROFILE")); //Hack to make this work with an old mc file
  TProfile* data_hist1 = (TProfile*)(file_data->Get("h_matvar_E1E2_corr_A_etaCALO_PROFILE"));
  TProfile* geo_hist1 = (TProfile*)(file_geo->Get("h_matvar_E1E2_corr_run2_A_etaCALO_PROFILE")); //Hack to make this work with an old mc file
  std::string nametag1 = "";
  MakeRelDiffPlots(mc_hist1, data_hist1, geo_hist1, nametag1, outputfile);

  TProfile* mc_hist2 = (TProfile*)(file_nominal->Get("h_matvar_E1E2_corr_run2_A_etaCALO_PROFILE")); 
  TProfile* data_hist2 = (TProfile*)(file_data->Get("h_matvar_E1E2_corr_run2_A_etaCALO_PROFILE"));
  TProfile* geo_hist2 = (TProfile*)(file_geo->Get("h_matvar_E1E2_corr_run2_A_etaCALO_PROFILE")); 
  std::string nametag2 = "_run2";
  MakeRelDiffPlots(mc_hist2, data_hist2, geo_hist2, nametag2, outputfile);

  //TProfile* mc_hist3 = (TProfile*)(file_nominal->Get("h_matvar_E1E2_raw_A_etaCALO_PROFILE"));
  TProfile* mc_hist3 = (TProfile*)(file_nominal->Get("h_matvar_E1E2_corr_run2_A_etaCALO_PROFILE")); //Hack to make this work with an old mc file
  TProfile* data_hist3 = (TProfile*)(file_data->Get("h_matvar_E1E2_raw_A_etaCALO_PROFILE"));
  TProfile* geo_hist3 = (TProfile*)(file_geo->Get("h_matvar_E1E2_corr_run2_A_etaCALO_PROFILE")); //Hack to make this work with an old mc file
  std::string nametag3 = "_raw";
  MakeRelDiffPlots(mc_hist3, data_hist3, geo_hist3, nametag3, outputfile);
}
Ejemplo n.º 11
0
void isoEfficiency(){

  gROOT->LoadMacro("../../include/atlasstyle-00-03-04/AtlasStyle.C");
  SetAtlasStyle();
  gROOT->LoadMacro("../../include/atlasstyle-00-03-04/AtlasUtils.C");
  gROOT->LoadMacro("../../include/atlasstyle-00-03-04/AtlasLabels.C");
  
  gROOT->SetBatch();
  
  cout<<endl;
  cout<<"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"<<endl;
  cout<<"In cutFlowElec.C"<<endl;


  TFile* data_sel_plots =
    (TFile*) TFile::Open("../../plots/selection_plots/merged/sel.data.selection.root");
  TFile* mc_bkgd_sel_plots = 
      (TFile*) TFile::Open("../../plots/selection_plots/merged/sel.bkgd.selection.root");

  TDirectory* dir_data_elec = (TDirectory*) data_sel_plots->GetDirectory("elec");
  TDirectory* dir_bkgd_elec = (TDirectory*) mc_bkgd_sel_plots->GetDirectory("elec");

  //data

  TH1F* h_data_pre_d0_sig_lep_pt = (TH1F*) dir_data_elec->Get("h_elec_pt_lep_pt");
  h_data_pre_d0_sig_lep_pt->Rebin(2);
  //d0_sig
  TH1F* h_data_d0_sig_lep_pt = (TH1F*) dir_data_elec->Get("h_elec_d0_sig_lep_pt");
  h_data_d0_sig_lep_pt->Rebin(2);
  TH1F* h_data_pre_abs_z0_lep_pt = (TH1F*) h_data_d0_sig_lep_pt->Clone();
  
  //abs_z0
  TH1F* h_data_abs_z0_lep_pt = (TH1F*) dir_data_elec->Get("h_elec_abs_z0_lep_pt");
  h_data_abs_z0_lep_pt->Rebin(2);
  TH1F* h_data_pre_tight_lep_pt = (TH1F*) h_data_abs_z0_lep_pt->Clone();
  
  //tight
  TH1F* h_data_tight_lep_pt = (TH1F*) dir_data_elec->Get("h_elec_tight_lep_pt");
  h_data_tight_lep_pt->Rebin(2);
  TH1F* h_data_pre_etiso30_lep_pt = (TH1F*) h_data_tight_lep_pt->Clone();
  TH1F* h_data_pre_ptiso20_lep_pt = (TH1F*) h_data_tight_lep_pt->Clone();

  //etiso30
  TH1F* h_data_etiso30_lep_pt = (TH1F*) dir_data_elec->Get("h_elec_rel_etiso30_lep_pt");
  h_data_etiso30_lep_pt->Rebin(2);
  TH1F* h_data_pre_ptiso30_lep_pt = (TH1F*) h_data_etiso30_lep_pt->Clone();


  //ptiso30
  TH1F* h_data_ptiso30_lep_pt = (TH1F*) dir_data_elec->Get("h_elec_rel_ptiso30_lep_pt");
  h_data_ptiso30_lep_pt->Rebin(2);
  
  //ptiso20
  TH1F* h_data_ptiso20_lep_pt = (TH1F*) dir_data_elec->Get("h_elec_rel_ptiso20_lep_pt");
  h_data_ptiso20_lep_pt->Rebin(2);
  
  
  //bkgd
  //d0_sig
  TH1F* h_bkgd_pre_d0_sig_lep_pt = (TH1F*) dir_bkgd_elec->Get("h_elec_pt_lep_pt");
  h_bkgd_pre_d0_sig_lep_pt->Rebin(2);
  TH1F* h_bkgd_d0_sig_lep_pt = (TH1F*) dir_bkgd_elec->Get("h_elec_d0_sig_lep_pt");
  h_bkgd_d0_sig_lep_pt->Rebin(2);
  TH1F* h_bkgd_pre_abs_z0_lep_pt = (TH1F*) h_bkgd_d0_sig_lep_pt->Clone();

  //abs_z0
  TH1F* h_bkgd_abs_z0_lep_pt = (TH1F*) dir_bkgd_elec->Get("h_elec_abs_z0_lep_pt");
  h_bkgd_abs_z0_lep_pt->Rebin(2);
  TH1F* h_bkgd_pre_tight_lep_pt = (TH1F*) h_bkgd_abs_z0_lep_pt->Clone();

  //tight
  TH1F* h_bkgd_tight_lep_pt = (TH1F*) dir_bkgd_elec->Get("h_elec_tight_lep_pt");
  h_bkgd_tight_lep_pt->Rebin(2);
  TH1F* h_bkgd_pre_etiso30_lep_pt = (TH1F*) h_bkgd_tight_lep_pt->Clone();
  TH1F* h_bkgd_pre_ptiso20_lep_pt = (TH1F*) h_bkgd_tight_lep_pt->Clone();

  //etiso30
  TH1F* h_bkgd_etiso30_lep_pt = (TH1F*) dir_bkgd_elec->Get("h_elec_rel_etiso30_lep_pt");
  h_bkgd_etiso30_lep_pt->Rebin(2);
  TH1F* h_bkgd_pre_ptiso30_lep_pt = (TH1F*) h_bkgd_etiso30_lep_pt->Clone();

  //ptiso30
  TH1F* h_bkgd_ptiso30_lep_pt = (TH1F*) dir_bkgd_elec->Get("h_elec_rel_ptiso30_lep_pt");
  h_bkgd_ptiso30_lep_pt->Rebin(2);

  //ptiso20
  TH1F* h_bkgd_ptiso20_lep_pt = (TH1F*) dir_bkgd_elec->Get("h_elec_rel_ptiso20_lep_pt");
  h_bkgd_ptiso20_lep_pt->Rebin(2);

  
  //d0_sig
  h_data_d0_sig_lep_pt->Divide(h_data_d0_sig_lep_pt,h_data_pre_d0_sig_lep_pt,1,1,"B");
  h_bkgd_d0_sig_lep_pt->Divide(h_bkgd_d0_sig_lep_pt,h_bkgd_pre_d0_sig_lep_pt,1,1,"B");
  TH1F* h_d0_sig_lep_pt_ratio = (TH1F*) h_data_d0_sig_lep_pt->Clone();
  h_d0_sig_lep_pt_ratio->Divide(h_d0_sig_lep_pt_ratio,h_bkgd_d0_sig_lep_pt,1,1,"B");
  
  //abs_z0
  h_data_abs_z0_lep_pt->Divide(h_data_abs_z0_lep_pt,h_data_pre_abs_z0_lep_pt,1,1,"B");
  h_bkgd_abs_z0_lep_pt->Divide(h_bkgd_abs_z0_lep_pt,h_bkgd_pre_abs_z0_lep_pt,1,1,"B");
  TH1F* h_abs_z0_lep_pt_ratio = (TH1F*) h_data_abs_z0_lep_pt->Clone();
  h_abs_z0_lep_pt_ratio->Divide(h_abs_z0_lep_pt_ratio,h_bkgd_abs_z0_lep_pt,1,1,"B");
  
  //tight
  h_data_tight_lep_pt->Divide(h_data_tight_lep_pt,h_data_pre_tight_lep_pt,1,1,"B");
  h_bkgd_tight_lep_pt->Divide(h_bkgd_tight_lep_pt,h_bkgd_pre_tight_lep_pt,1,1,"B");
  TH1F* h_tight_lep_pt_ratio = (TH1F*) h_data_tight_lep_pt->Clone();
  h_tight_lep_pt_ratio->Divide(h_tight_lep_pt_ratio,h_bkgd_tight_lep_pt,1,1,"B");
  
  //etiso30
  h_data_etiso30_lep_pt->Divide(h_data_etiso30_lep_pt,h_data_pre_etiso30_lep_pt,1,1,"B");
  h_bkgd_etiso30_lep_pt->Divide(h_bkgd_etiso30_lep_pt,h_bkgd_pre_etiso30_lep_pt,1,1,"B");
  TH1F* h_etiso30_lep_pt_ratio = (TH1F*) h_data_etiso30_lep_pt->Clone();
  h_etiso30_lep_pt_ratio->Divide(h_etiso30_lep_pt_ratio,h_bkgd_etiso30_lep_pt,1,1,"B");

  //ptiso30
  h_data_ptiso30_lep_pt->Divide(h_data_ptiso30_lep_pt,h_data_pre_ptiso30_lep_pt,1,1,"B");
  h_bkgd_ptiso30_lep_pt->Divide(h_bkgd_ptiso30_lep_pt,h_bkgd_pre_ptiso30_lep_pt,1,1,"B");
  TH1F* h_ptiso30_lep_pt_ratio = (TH1F*) h_data_ptiso30_lep_pt->Clone();
  h_ptiso30_lep_pt_ratio->Divide(h_ptiso30_lep_pt_ratio,h_bkgd_ptiso30_lep_pt,1,1,"B");

  //ptiso20
  h_data_ptiso20_lep_pt->Divide(h_data_ptiso20_lep_pt,h_data_pre_ptiso20_lep_pt,1,1,"B");
  h_bkgd_ptiso20_lep_pt->Divide(h_bkgd_ptiso20_lep_pt,h_bkgd_pre_ptiso20_lep_pt,1,1,"B");
  TH1F* h_ptiso20_lep_pt_ratio = (TH1F*) h_data_ptiso20_lep_pt->Clone();
  h_ptiso20_lep_pt_ratio->Divide(h_ptiso20_lep_pt_ratio,h_bkgd_ptiso20_lep_pt,1,1,"B");


  //d0_sig
  TCanvas* tc_elec_d0_sig_eff_lep_pt = new TCanvas("tc_elec_d0_sig_eff_lep_pt","tc_elec_d0_sig_eff_lep_pt",0,0,1920,1200);
  tc_elec_d0_sig_eff_lep_pt->cd();
  
  rp_elec_d0_sig_eff_lep_pt =
    new TPad("rp_elec_d0_sig_eff_lep_pt","rp_elec_d0_sig_eff_lep_pt",0.01,0.01,0.99,ratio_split);
  rp_elec_d0_sig_eff_lep_pt->SetTopMargin(0.05);
  rp_elec_d0_sig_eff_lep_pt->SetBottomMargin(0.31);
  rp_elec_d0_sig_eff_lep_pt->SetGrid();
  rp_elec_d0_sig_eff_lep_pt->Draw();

  pp_elec_d0_sig_eff_lep_pt =
    new TPad("pp_elec_d0_sig_eff_lep_pt","pp_elec_d0_sig_eff_lep_pt",0.01,ratio_split,0.99,0.99);
  pp_elec_d0_sig_eff_lep_pt->SetBottomMargin(0);
  pp_elec_d0_sig_eff_lep_pt->Draw();
  pp_elec_d0_sig_eff_lep_pt->cd();
  pp_elec_d0_sig_eff_lep_pt->SetGrid();
  pp_elec_d0_sig_eff_lep_pt->Update();  
    
  h_bkgd_d0_sig_lep_pt->GetYaxis()->SetRangeUser(0,1.2);
  h_bkgd_d0_sig_lep_pt->GetYaxis()->SetTitle("Efficiency of corr_etcone30 electron cut");
  h_bkgd_d0_sig_lep_pt->GetYaxis()->SetTitleOffset(0.75);
  h_bkgd_d0_sig_lep_pt->GetXaxis()->SetLabelSize(0);
  h_bkgd_d0_sig_lep_pt->SetLineColor(kBlue);
  h_bkgd_d0_sig_lep_pt->SetMarkerStyle(3);
  h_bkgd_d0_sig_lep_pt->SetMarkerSize(2);
  h_bkgd_d0_sig_lep_pt->Draw("P");

  h_data_d0_sig_lep_pt->SetLineColor(kRed);
  h_data_d0_sig_lep_pt->SetMarkerStyle(3);
  h_data_d0_sig_lep_pt->SetMarkerSize(2);
  h_data_d0_sig_lep_pt->Draw("P same");

  TLegend* lgnd_elec_d0_sig_eff_lep_pt = new TLegend(0.72,0.83,0.9,0.95);
  lgnd_elec_d0_sig_eff_lep_pt->SetFillColor(0);
  lgnd_elec_d0_sig_eff_lep_pt->SetTextSize(0.03);
  lgnd_elec_d0_sig_eff_lep_pt->AddEntry(h_data_d0_sig_lep_pt,"Data","L");
  lgnd_elec_d0_sig_eff_lep_pt->AddEntry(h_bkgd_d0_sig_lep_pt,"Backgrounds","L");
  lgnd_elec_d0_sig_eff_lep_pt->Draw();

  rp_elec_d0_sig_eff_lep_pt->cd();  
  h_d0_sig_lep_pt_ratio->GetXaxis()->SetTitle("Electron pt [GeV]");
  h_d0_sig_lep_pt_ratio->GetXaxis()->SetTitleSize(0.16);
  h_d0_sig_lep_pt_ratio->GetXaxis()->SetTitleOffset(0.7);
  h_d0_sig_lep_pt_ratio->GetYaxis()->SetNdivisions(4,4,4);
  h_d0_sig_lep_pt_ratio->GetYaxis()->SetTitle("Data/Bkgd");
  h_d0_sig_lep_pt_ratio->GetYaxis()->SetTitleSize(0.07);
  h_d0_sig_lep_pt_ratio->GetYaxis()->SetTitleOffset(0.36);
  h_d0_sig_lep_pt_ratio->GetYaxis()->SetRangeUser(0.5,1.5);
  h_d0_sig_lep_pt_ratio->SetMarkerStyle(20);
  h_d0_sig_lep_pt_ratio->SetMarkerSize(2);
  h_d0_sig_lep_pt_ratio->SetLineWidth(1);
  h_d0_sig_lep_pt_ratio->Draw("HIST PE");
  
  tc_elec_d0_sig_eff_lep_pt->Update();
  tc_elec_d0_sig_eff_lep_pt->RedrawAxis();
  tc_elec_d0_sig_eff_lep_pt->SaveAs("../canvases/latest/h_elec_d0_sig_eff_lep_pt.png");



  //abs_z0
  TCanvas* tc_elec_abs_z0_eff_lep_pt = new TCanvas("tc_elec_abs_z0_eff_lep_pt","tc_elec_abs_z0_eff_lep_pt",0,0,1920,1200);
  tc_elec_abs_z0_eff_lep_pt->cd();
  
  rp_elec_abs_z0_eff_lep_pt =
    new TPad("rp_elec_abs_z0_eff_lep_pt","rp_elec_abs_z0_eff_lep_pt",0.01,0.01,0.99,ratio_split);
  rp_elec_abs_z0_eff_lep_pt->SetTopMargin(0.05);
  rp_elec_abs_z0_eff_lep_pt->SetBottomMargin(0.31);
  rp_elec_abs_z0_eff_lep_pt->SetGrid();
  rp_elec_abs_z0_eff_lep_pt->Draw();

  pp_elec_abs_z0_eff_lep_pt =
    new TPad("pp_elec_abs_z0_eff_lep_pt","pp_elec_abs_z0_eff_lep_pt",0.01,ratio_split,0.99,0.99);
  pp_elec_abs_z0_eff_lep_pt->SetBottomMargin(0);
  pp_elec_abs_z0_eff_lep_pt->Draw();
  pp_elec_abs_z0_eff_lep_pt->cd();
  pp_elec_abs_z0_eff_lep_pt->SetGrid();
  pp_elec_abs_z0_eff_lep_pt->Update();  
    
  h_bkgd_abs_z0_lep_pt->GetYaxis()->SetRangeUser(0,1.2);
  h_bkgd_abs_z0_lep_pt->GetYaxis()->SetTitle("Efficiency of corr_etcone30 electron cut");
  h_bkgd_abs_z0_lep_pt->GetYaxis()->SetTitleOffset(0.75);
  h_bkgd_abs_z0_lep_pt->GetXaxis()->SetLabelSize(0);
  h_bkgd_abs_z0_lep_pt->SetLineColor(kBlue);
  h_bkgd_abs_z0_lep_pt->SetMarkerStyle(3);
  h_bkgd_abs_z0_lep_pt->SetMarkerSize(2);
  h_bkgd_abs_z0_lep_pt->Draw("P");

  h_data_abs_z0_lep_pt->SetLineColor(kRed);
  h_data_abs_z0_lep_pt->SetMarkerStyle(3);
  h_data_abs_z0_lep_pt->SetMarkerSize(2);
  h_data_abs_z0_lep_pt->Draw("P same");

  TLegend* lgnd_elec_abs_z0_eff_lep_pt = new TLegend(0.72,0.83,0.9,0.95);
  lgnd_elec_abs_z0_eff_lep_pt->SetFillColor(0);
  lgnd_elec_abs_z0_eff_lep_pt->SetTextSize(0.03);
  lgnd_elec_abs_z0_eff_lep_pt->AddEntry(h_data_abs_z0_lep_pt,"Data","L");
  lgnd_elec_abs_z0_eff_lep_pt->AddEntry(h_bkgd_abs_z0_lep_pt,"Backgrounds","L");
  lgnd_elec_abs_z0_eff_lep_pt->Draw();

  rp_elec_abs_z0_eff_lep_pt->cd();  
  h_abs_z0_lep_pt_ratio->GetXaxis()->SetTitle("Electron pt [GeV]");
  h_abs_z0_lep_pt_ratio->GetXaxis()->SetTitleSize(0.16);
  h_abs_z0_lep_pt_ratio->GetXaxis()->SetTitleOffset(0.7);
  h_abs_z0_lep_pt_ratio->GetYaxis()->SetNdivisions(4,4,4);
  h_abs_z0_lep_pt_ratio->GetYaxis()->SetTitle("Data/Bkgd");
  h_abs_z0_lep_pt_ratio->GetYaxis()->SetTitleSize(0.07);
  h_abs_z0_lep_pt_ratio->GetYaxis()->SetTitleOffset(0.36);
  h_abs_z0_lep_pt_ratio->GetYaxis()->SetRangeUser(0.5,1.5);
  h_abs_z0_lep_pt_ratio->SetMarkerStyle(20);
  h_abs_z0_lep_pt_ratio->SetMarkerSize(2);
  h_abs_z0_lep_pt_ratio->SetLineWidth(1);
  h_abs_z0_lep_pt_ratio->Draw("HIST PE");
  
  tc_elec_abs_z0_eff_lep_pt->Update();
  tc_elec_abs_z0_eff_lep_pt->RedrawAxis();
  tc_elec_abs_z0_eff_lep_pt->SaveAs("../canvases/latest/h_elec_abs_z0_eff_lep_pt.png");


  //tight
  TCanvas* tc_elec_tight_eff_lep_pt = new TCanvas("tc_elec_tight_eff_lep_pt","tc_elec_tight_eff_lep_pt",0,0,1920,1200);
  tc_elec_tight_eff_lep_pt->cd();
  
  rp_elec_tight_eff_lep_pt =
    new TPad("rp_elec_tight_eff_lep_pt","rp_elec_tight_eff_lep_pt",0.01,0.01,0.99,ratio_split);
  rp_elec_tight_eff_lep_pt->SetTopMargin(0.05);
  rp_elec_tight_eff_lep_pt->SetBottomMargin(0.31);
  rp_elec_tight_eff_lep_pt->SetGrid();
  rp_elec_tight_eff_lep_pt->Draw();

  pp_elec_tight_eff_lep_pt =
    new TPad("pp_elec_tight_eff_lep_pt","pp_elec_tight_eff_lep_pt",0.01,ratio_split,0.99,0.99);
  pp_elec_tight_eff_lep_pt->SetBottomMargin(0);
  pp_elec_tight_eff_lep_pt->Draw();
  pp_elec_tight_eff_lep_pt->cd();
  pp_elec_tight_eff_lep_pt->SetGrid();
  pp_elec_tight_eff_lep_pt->Update();  
    
  h_bkgd_tight_lep_pt->GetYaxis()->SetRangeUser(0,1.2);
  h_bkgd_tight_lep_pt->GetYaxis()->SetTitle("Efficiency of corr_etcone30 electron cut");
  h_bkgd_tight_lep_pt->GetYaxis()->SetTitleOffset(0.75);
  h_bkgd_tight_lep_pt->GetXaxis()->SetLabelSize(0);
  h_bkgd_tight_lep_pt->SetLineColor(kBlue);
  h_bkgd_tight_lep_pt->SetMarkerStyle(3);
  h_bkgd_tight_lep_pt->SetMarkerSize(2);
  h_bkgd_tight_lep_pt->Draw("P");

  h_data_tight_lep_pt->SetLineColor(kRed);
  h_data_tight_lep_pt->SetMarkerStyle(3);
  h_data_tight_lep_pt->SetMarkerSize(2);
  h_data_tight_lep_pt->Draw("P same");

  TLegend* lgnd_elec_tight_eff_lep_pt = new TLegend(0.72,0.83,0.9,0.95);
  lgnd_elec_tight_eff_lep_pt->SetFillColor(0);
  lgnd_elec_tight_eff_lep_pt->SetTextSize(0.03);
  lgnd_elec_tight_eff_lep_pt->AddEntry(h_data_tight_lep_pt,"Data","L");
  lgnd_elec_tight_eff_lep_pt->AddEntry(h_bkgd_tight_lep_pt,"Backgrounds","L");
  lgnd_elec_tight_eff_lep_pt->Draw();

  rp_elec_tight_eff_lep_pt->cd();  
  h_tight_lep_pt_ratio->GetXaxis()->SetTitle("Electron pt [GeV]");
  h_tight_lep_pt_ratio->GetXaxis()->SetTitleSize(0.16);
  h_tight_lep_pt_ratio->GetXaxis()->SetTitleOffset(0.7);
  h_tight_lep_pt_ratio->GetYaxis()->SetNdivisions(4,4,4);
  h_tight_lep_pt_ratio->GetYaxis()->SetTitle("Data/Bkgd");
  h_tight_lep_pt_ratio->GetYaxis()->SetTitleSize(0.07);
  h_tight_lep_pt_ratio->GetYaxis()->SetTitleOffset(0.36);
  h_tight_lep_pt_ratio->GetYaxis()->SetRangeUser(0.5,1.5);
  h_tight_lep_pt_ratio->SetMarkerStyle(20);
  h_tight_lep_pt_ratio->SetMarkerSize(2);
  h_tight_lep_pt_ratio->SetLineWidth(1);
  h_tight_lep_pt_ratio->Draw("HIST PE");
  
  tc_elec_tight_eff_lep_pt->Update();
  tc_elec_tight_eff_lep_pt->RedrawAxis();
  tc_elec_tight_eff_lep_pt->SaveAs("../canvases/latest/h_elec_tight_eff_lep_pt.png");


  //etiso30
  TCanvas* tc_elec_etiso30_eff_lep_pt = new TCanvas("tc_elec_etiso30_eff_lep_pt","tc_elec_etiso30_eff_lep_pt",0,0,1920,1200);
  tc_elec_etiso30_eff_lep_pt->cd();
  
  rp_elec_etiso30_eff_lep_pt =
    new TPad("rp_elec_etiso30_eff_lep_pt","rp_elec_etiso30_eff_lep_pt",0.01,0.01,0.99,ratio_split);
  rp_elec_etiso30_eff_lep_pt->SetTopMargin(0.05);
  rp_elec_etiso30_eff_lep_pt->SetBottomMargin(0.31);
  rp_elec_etiso30_eff_lep_pt->SetGrid();
  rp_elec_etiso30_eff_lep_pt->Draw();

  pp_elec_etiso30_eff_lep_pt =
    new TPad("pp_elec_etiso30_eff_lep_pt","pp_elec_etiso30_eff_lep_pt",0.01,ratio_split,0.99,0.99);
  pp_elec_etiso30_eff_lep_pt->SetBottomMargin(0);
  pp_elec_etiso30_eff_lep_pt->Draw();
  pp_elec_etiso30_eff_lep_pt->cd();
  pp_elec_etiso30_eff_lep_pt->SetGrid();
  pp_elec_etiso30_eff_lep_pt->Update();  
    
  h_bkgd_etiso30_lep_pt->GetYaxis()->SetRangeUser(0,1.2);
  h_bkgd_etiso30_lep_pt->GetYaxis()->SetTitle("Efficiency of corr_etcone30 electron cut");
  h_bkgd_etiso30_lep_pt->GetYaxis()->SetTitleOffset(0.75);
  h_bkgd_etiso30_lep_pt->GetXaxis()->SetLabelSize(0);
  h_bkgd_etiso30_lep_pt->SetLineColor(kBlue);
  h_bkgd_etiso30_lep_pt->SetMarkerStyle(3);
  h_bkgd_etiso30_lep_pt->SetMarkerSize(2);
  h_bkgd_etiso30_lep_pt->Draw("P");

  h_data_etiso30_lep_pt->SetLineColor(kRed);
  h_data_etiso30_lep_pt->SetMarkerStyle(3);
  h_data_etiso30_lep_pt->SetMarkerSize(2);
  h_data_etiso30_lep_pt->Draw("P same");

  TLegend* lgnd_elec_etiso30_eff_lep_pt = new TLegend(0.72,0.83,0.9,0.95);
  lgnd_elec_etiso30_eff_lep_pt->SetFillColor(0);
  lgnd_elec_etiso30_eff_lep_pt->SetTextSize(0.03);
  lgnd_elec_etiso30_eff_lep_pt->AddEntry(h_data_etiso30_lep_pt,"Data","L");
  lgnd_elec_etiso30_eff_lep_pt->AddEntry(h_bkgd_etiso30_lep_pt,"Backgrounds","L");
  lgnd_elec_etiso30_eff_lep_pt->Draw();

  rp_elec_etiso30_eff_lep_pt->cd();  
  h_etiso30_lep_pt_ratio->GetXaxis()->SetTitle("Electron pt [GeV]");
  h_etiso30_lep_pt_ratio->GetXaxis()->SetTitleSize(0.16);
  h_etiso30_lep_pt_ratio->GetXaxis()->SetTitleOffset(0.7);
  h_etiso30_lep_pt_ratio->GetYaxis()->SetNdivisions(4,4,4);
  h_etiso30_lep_pt_ratio->GetYaxis()->SetTitle("Data/Bkgd");
  h_etiso30_lep_pt_ratio->GetYaxis()->SetTitleSize(0.07);
  h_etiso30_lep_pt_ratio->GetYaxis()->SetTitleOffset(0.36);
  h_etiso30_lep_pt_ratio->GetYaxis()->SetRangeUser(0.5,1.5);
  h_etiso30_lep_pt_ratio->SetMarkerStyle(20);
  h_etiso30_lep_pt_ratio->SetMarkerSize(2);
  h_etiso30_lep_pt_ratio->SetLineWidth(1);
  h_etiso30_lep_pt_ratio->Draw("HIST PE");
  
  tc_elec_etiso30_eff_lep_pt->Update();
  tc_elec_etiso30_eff_lep_pt->RedrawAxis();
  tc_elec_etiso30_eff_lep_pt->SaveAs("../canvases/latest/h_elec_etiso30_eff_lep_pt.png");


  //ptiso30
  TCanvas* tc_elec_ptiso30_eff_lep_pt = new TCanvas("tc_elec_ptiso30_eff_lep_pt","tc_elec_ptiso30_eff_lep_pt",0,0,1920,1200);
  tc_elec_ptiso30_eff_lep_pt->cd();
  
  rp_elec_ptiso30_eff_lep_pt =
    new TPad("rp_elec_ptiso30_eff_lep_pt","rp_elec_ptiso30_eff_lep_pt",0.01,0.01,0.99,ratio_split);
  rp_elec_ptiso30_eff_lep_pt->SetTopMargin(0.05);
  rp_elec_ptiso30_eff_lep_pt->SetBottomMargin(0.31);
  rp_elec_ptiso30_eff_lep_pt->SetGrid();
  rp_elec_ptiso30_eff_lep_pt->Draw();

  pp_elec_ptiso30_eff_lep_pt =
    new TPad("pp_elec_ptiso30_eff_lep_pt","pp_elec_ptiso30_eff_lep_pt",0.01,ratio_split,0.99,0.99);
  pp_elec_ptiso30_eff_lep_pt->SetBottomMargin(0);
  pp_elec_ptiso30_eff_lep_pt->Draw();
  pp_elec_ptiso30_eff_lep_pt->cd();
  pp_elec_ptiso30_eff_lep_pt->SetGrid();
  pp_elec_ptiso30_eff_lep_pt->Update();  
    
  h_bkgd_ptiso30_lep_pt->GetYaxis()->SetRangeUser(0,1.2);
  h_bkgd_ptiso30_lep_pt->GetYaxis()->SetTitle("Efficiency of corr_etcone30 electron cut");
  h_bkgd_ptiso30_lep_pt->GetYaxis()->SetTitleOffset(0.75);
  h_bkgd_ptiso30_lep_pt->GetXaxis()->SetLabelSize(0);
  h_bkgd_ptiso30_lep_pt->SetLineColor(kBlue);
  h_bkgd_ptiso30_lep_pt->SetMarkerStyle(3);
  h_bkgd_ptiso30_lep_pt->SetMarkerSize(2);
  h_bkgd_ptiso30_lep_pt->Draw("P");

  h_data_ptiso30_lep_pt->SetLineColor(kRed);
  h_data_ptiso30_lep_pt->SetMarkerStyle(3);
  h_data_ptiso30_lep_pt->SetMarkerSize(2);
  h_data_ptiso30_lep_pt->Draw("P same");

  TLegend* lgnd_elec_ptiso30_eff_lep_pt = new TLegend(0.72,0.83,0.9,0.95);
  lgnd_elec_ptiso30_eff_lep_pt->SetFillColor(0);
  lgnd_elec_ptiso30_eff_lep_pt->SetTextSize(0.03);
  lgnd_elec_ptiso30_eff_lep_pt->AddEntry(h_data_ptiso30_lep_pt,"Data","L");
  lgnd_elec_ptiso30_eff_lep_pt->AddEntry(h_bkgd_ptiso30_lep_pt,"Backgrounds","L");
  lgnd_elec_ptiso30_eff_lep_pt->Draw();

  rp_elec_ptiso30_eff_lep_pt->cd();  
  h_ptiso30_lep_pt_ratio->GetXaxis()->SetTitle("Electron pt [GeV]");
  h_ptiso30_lep_pt_ratio->GetXaxis()->SetTitleSize(0.16);
  h_ptiso30_lep_pt_ratio->GetXaxis()->SetTitleOffset(0.7);
  h_ptiso30_lep_pt_ratio->GetYaxis()->SetNdivisions(4,4,4);
  h_ptiso30_lep_pt_ratio->GetYaxis()->SetTitle("Data/Bkgd");
  h_ptiso30_lep_pt_ratio->GetYaxis()->SetTitleSize(0.07);
  h_ptiso30_lep_pt_ratio->GetYaxis()->SetTitleOffset(0.36);
  h_ptiso30_lep_pt_ratio->GetYaxis()->SetRangeUser(0.5,1.5);
  h_ptiso30_lep_pt_ratio->SetMarkerStyle(20);
  h_ptiso30_lep_pt_ratio->SetMarkerSize(2);
  h_ptiso30_lep_pt_ratio->SetLineWidth(1);
  h_ptiso30_lep_pt_ratio->Draw("HIST PE");
  
  tc_elec_ptiso30_eff_lep_pt->Update();
  tc_elec_ptiso30_eff_lep_pt->RedrawAxis();
  tc_elec_ptiso30_eff_lep_pt->SaveAs("../canvases/latest/h_elec_ptiso30_eff_lep_pt.png");


  //ptiso20
  TCanvas* tc_elec_ptiso20_eff_lep_pt = new TCanvas("tc_elec_ptiso20_eff_lep_pt","tc_elec_ptiso20_eff_lep_pt",0,0,1920,1200);
  tc_elec_ptiso20_eff_lep_pt->cd();
  
  rp_elec_ptiso20_eff_lep_pt =
    new TPad("rp_elec_ptiso20_eff_lep_pt","rp_elec_ptiso20_eff_lep_pt",0.01,0.01,0.99,ratio_split);
  rp_elec_ptiso20_eff_lep_pt->SetTopMargin(0.05);
  rp_elec_ptiso20_eff_lep_pt->SetBottomMargin(0.31);
  rp_elec_ptiso20_eff_lep_pt->SetGrid();
  rp_elec_ptiso20_eff_lep_pt->Draw();

  pp_elec_ptiso20_eff_lep_pt =
    new TPad("pp_elec_ptiso20_eff_lep_pt","pp_elec_ptiso20_eff_lep_pt",0.01,ratio_split,0.99,0.99);
  pp_elec_ptiso20_eff_lep_pt->SetBottomMargin(0);
  pp_elec_ptiso20_eff_lep_pt->Draw();
  pp_elec_ptiso20_eff_lep_pt->cd();
  pp_elec_ptiso20_eff_lep_pt->SetGrid();
  pp_elec_ptiso20_eff_lep_pt->Update();  
    
  h_bkgd_ptiso20_lep_pt->GetYaxis()->SetRangeUser(0,1.2);
  h_bkgd_ptiso20_lep_pt->GetYaxis()->SetTitle("Efficiency of corr_etcone30 electron cut");
  h_bkgd_ptiso20_lep_pt->GetYaxis()->SetTitleOffset(0.75);
  h_bkgd_ptiso20_lep_pt->GetXaxis()->SetLabelSize(0);
  h_bkgd_ptiso20_lep_pt->SetLineColor(kBlue);
  h_bkgd_ptiso20_lep_pt->SetMarkerStyle(3);
  h_bkgd_ptiso20_lep_pt->SetMarkerSize(2);
  h_bkgd_ptiso20_lep_pt->Draw("P");

  h_data_ptiso20_lep_pt->SetLineColor(kRed);
  h_data_ptiso20_lep_pt->SetMarkerStyle(3);
  h_data_ptiso20_lep_pt->SetMarkerSize(2);
  h_data_ptiso20_lep_pt->Draw("P same");

  TLegend* lgnd_elec_ptiso20_eff_lep_pt = new TLegend(0.72,0.83,0.9,0.95);
  lgnd_elec_ptiso20_eff_lep_pt->SetFillColor(0);
  lgnd_elec_ptiso20_eff_lep_pt->SetTextSize(0.03);
  lgnd_elec_ptiso20_eff_lep_pt->AddEntry(h_data_ptiso20_lep_pt,"Data","L");
  lgnd_elec_ptiso20_eff_lep_pt->AddEntry(h_bkgd_ptiso20_lep_pt,"Backgrounds","L");
  lgnd_elec_ptiso20_eff_lep_pt->Draw();

  rp_elec_ptiso20_eff_lep_pt->cd();  
  h_ptiso20_lep_pt_ratio->GetXaxis()->SetTitle("Electron pt [GeV]");
  h_ptiso20_lep_pt_ratio->GetXaxis()->SetTitleSize(0.16);
  h_ptiso20_lep_pt_ratio->GetXaxis()->SetTitleOffset(0.7);
  h_ptiso20_lep_pt_ratio->GetYaxis()->SetNdivisions(4,4,4);
  h_ptiso20_lep_pt_ratio->GetYaxis()->SetTitle("Data/Bkgd");
  h_ptiso20_lep_pt_ratio->GetYaxis()->SetTitleSize(0.07);
  h_ptiso20_lep_pt_ratio->GetYaxis()->SetTitleOffset(0.36);
  h_ptiso20_lep_pt_ratio->GetYaxis()->SetRangeUser(0.5,1.5);
  h_ptiso20_lep_pt_ratio->SetMarkerStyle(20);
  h_ptiso20_lep_pt_ratio->SetMarkerSize(2);
  h_ptiso20_lep_pt_ratio->SetLineWidth(1);
  h_ptiso20_lep_pt_ratio->Draw("HIST PE");
  
  tc_elec_ptiso20_eff_lep_pt->Update();
  tc_elec_ptiso20_eff_lep_pt->RedrawAxis();
  tc_elec_ptiso20_eff_lep_pt->SaveAs("../canvases/latest/h_elec_ptiso20_eff_lep_pt.png");



  gROOT->ProcessLine(".q");
  return;
}
Ejemplo n.º 12
0
// *************************************** //
// this is a function that draws all       //
// backrounds as a grey area, and compares //
// the shape of the backgrounds to that of //
// the signal                              //
// This one is supposed to match the plots //
// make by JP (Fig 3 of CONF note)         //
// *************************************** //
TCanvas* drawPlots::plotShape_VLQ(TH1D* bkgd, std::string axisName, std::vector<TH1D*> signal, bool doLogAxis, std::string channel){

  // only drawing shapes so normalize histograms
  std::cout << "background integral: " << bkgd->Integral() << std::endl;
  bkgd->Scale(1./bkgd->Integral());
  for(int ahist=0; ahist<signal.size(); ahist++){
    if(signal[ahist]){
      std::cout << "scaling signal: " << ahist << " with integral: " << signal[ahist]->Integral() << std::endl;
      signal[ahist]->Scale(1./signal[ahist]->Integral());
    }
  }

   const unsigned int CANVAS_WIDTH  = 720;
   const unsigned int CANVAS_HEIGHT = 750;
   TCanvas* canvas = new TCanvas("canvas","canvas",0,0,CANVAS_WIDTH,CANVAS_HEIGHT);
   
   canvas->SetMargin(0.,0.,0.,0.);
   canvas->Clear();
   canvas->cd();

   SetAtlasStyle();
   gStyle->SetHistLineWidth(1.);

   
   // create main pad
   const double mainPad_ylow  = 0.;
   const double mainPad_yhigh = 1.;
   const double mainPad_xlow = 0.;
   const double mainPad_xhigh = 1.;
   const double pad_margin_left = 0.16;
   const double pad_margin_right  = 0.035;
   
   double main_y_max = -99;
   double main_y_min = -99;

   TPad* mainPad = new TPad("main","main",mainPad_xlow,mainPad_ylow,mainPad_xhigh,mainPad_yhigh);
   mainPad->SetMargin(pad_margin_left,pad_margin_right,0.16,.05); // left, right, bottom, top
   mainPad->Draw();
   mainPad->cd();

   // find max y
   int maxBinBkg = bkgd->GetMaximumBin();
   double bkgYmax = bkgd->GetBinContent(maxBinBkg);
   main_y_max = bkgYmax;
   //   std::cout << "background maximum: " << bkgYmax << std::endl;
   if(main_y_max < .002) main_y_max = .1;
   
   if(doLogAxis){
     mainPad->SetLogy();
     main_y_min = 0.0001;
     main_y_max*=500;
   }else{
     main_y_min = 0.00001;
     main_y_max*=1.6;
   }

   // draw axis
   bkgd->SetMaximum(main_y_max);
   bkgd->SetMinimum(main_y_min);
   std::string title = std::string(";") + axisName + ";Fraction of events";
   std::stringstream binw; 
   binw<<bkgd->GetBinWidth(1);
   std::string width = binw.str();
   if (axisName.find("GeV") != std::string::npos) width += " GeV";
   if(bkgd->GetBinWidth(1) != 1) title += " / "+width;
   bkgd->SetTitle(title.c_str());   
   bkgd->GetYaxis()->SetTitleOffset(1.6);
   bkgd->GetXaxis()->SetTitleOffset(1.2);
   bkgd->GetYaxis()->SetLabelSize(0.03);
   bkgd->GetYaxis()->SetTitleSize(0.045);
   bkgd->GetXaxis()->SetTitleSize(0.045);
   bkgd->GetXaxis()->SetLabelSize(0.03);
   bkgd->SetFillStyle(3354);
   bkgd->SetFillColor(kGray+2);
   bkgd->SetLineColor(kGray+2);
   bkgd->Draw("histf");

   // draw signal
   if(signal[0]){
     std::cout << "printing Tbq" << std::endl;
     signal[0]->SetLineStyle(2);
     signal[0]->SetLineColor(kRed+2); // kGreen+3 was being used before
     signal[0]->SetLineWidth(5);
     signal[0]->Draw("hist same");
   }
   if(signal.size() > 1){
     if(signal[1]){
       std::cout << "printing TTS" << std::endl;
       //   signal[1]->SetLineStyle(2);
       signal[1]->SetLineColor(kRed+2);
       signal[1]->SetLineWidth(4);
       signal[1]->Draw("hist same");
     }
     if(signal.size() > 2){
       if(signal[2]){
	 std::cout << "printing BBS" << std::endl;
	 //	 signal[2]->SetLineStyle(2);
	 signal[2]->SetLineColor(kBlue+2);
	 signal[2]->SetLineWidth(4);
	 signal[2]->Draw("hist same");
       }
     }
   }
   bkgd->Draw("axis same");

   // draw legend
   float leg_height = 0.2;
   float leg_width = 0.4;
   float leg_xoffset = 0.65;
   float leg_yoffset = 0.8;
   
   TLegend* leg = new TLegend(leg_xoffset,leg_yoffset-leg_height/2,leg_xoffset+leg_width,leg_yoffset+leg_height/2);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   leg->SetBorderSize(0);
   leg->SetTextFont(72);
   leg->SetTextSize(0.026);
   
   // currently assuming first signal is single T, second is TTS
   leg->AddEntry(bkgd,"Background", "f");
   if(signal.size()>1){
     if(signal.size()>2){
       if(signal[2])
	 leg->AddEntry(signal[2], "B#bar{B} (650 GeV)", "l");
     }
     if(signal[1])
       leg->AddEntry(signal[1], "T#bar{T} (650 GeV)", "l");
   }  
   if(signal[0])
     leg->AddEntry(signal[0], "T#bar{b}q (650 GeV)", "l");
   
   leg->Draw("lpe");
   
   ATLAS_LABEL(0.24,0.86,1);
   myText(0.26, 0.81, 1, .04, "Internal");
   char text[]="#sqrt{s}=8 TeV";
   myText(0.48,0.82,1,.03, text);
   char text_L[]="Simulation";
   myText(0.47, 0.87,1, .03, text_L);
   char text_tri[]="Trilepton";
   myText(0.485, 0.77, 1, .03, text_tri);
   if(channel!=""){
     char chan_txt[channel.size()-1];
     strcpy(chan_txt, (channel.substr(1)).c_str());
     if(channel.size()>10)
       myText(0.55, 0.56, 1, .03, chan_txt);
     else
       myText(0.65, 0.56, 1, .03, chan_txt);
   }
   canvas->cd();
   
   return canvas;
}
Ejemplo n.º 13
0
void writeRobin() {

  std::cout << "lumi " << lumi <<" nb-1"<< std::endl;  
  std::cout << "Opening files " << prefix << std::endl;  
     
  gROOT->SetStyle("ATLAS");
  SetAtlasStyle();
  gROOT->ForceStyle();

  myfile.open("./robin.h");
  
  grid_cs    = new TH2D("grid_cs", "grid_cs",       gridXbins, gridStartX, gridStopX, gridYbins, gridStartY, gridStopY);
  grid_gq    = new TH2D("grid_gq", "grid_gq",       gridXbins, gridStartX, gridStopX, gridYbins, gridStartY, gridStopY);
  grid_gg    = new TH2D("grid_gg", "grid_gg",       gridXbins, gridStartX, gridStopX, gridYbins, gridStartY, gridStopY);
  grid_qq    = new TH2D("grid_qq", "grid_qq",       gridXbins, gridStartX, gridStopX, gridYbins, gridStartY, gridStopY);
  grid_qaq   = new TH2D("grid_qaq", "grid_qaq",     gridXbins, gridStartX, gridStopX, gridYbins, gridStartY, gridStopY);
  grid_tt    = new TH2D("grid_tt", "grid_tt",       gridXbins, gridStartX, gridStopX, gridYbins, gridStartY, gridStopY);
  grid_bb    = new TH2D("grid_bb", "grid_bb",       gridXbins, gridStartX, gridStopX, gridYbins, gridStartY, gridStopY);
  grid_gchi  = new TH2D("grid_gchi", "grid_gchi",     gridXbins, gridStartX, gridStopX, gridYbins, gridStartY, gridStopY);
  grid_qqchi = new TH2D("grid_qqchi", "grid_qqchi", gridXbins, gridStartX, gridStopX, gridYbins, gridStartY, gridStopY);

  myfile << "void get_cs(double run,  double *xsection , double *xsection_process, int channel){"<<endl;

  Get_m0_m12_robin(file_123290);  
  Get_m0_m12_robin(file_123291);  
  Get_m0_m12_robin(file_123292);  
  Get_m0_m12_robin(file_123293);  
  Get_m0_m12_robin(file_123294);  
  Get_m0_m12_robin(file_123295);  
  Get_m0_m12_robin(file_123296);  
  Get_m0_m12_robin(file_123297);  
  Get_m0_m12_robin(file_123298);  
  Get_m0_m12_robin(file_123299);  
  Get_m0_m12_robin(file_123300);  
  Get_m0_m12_robin(file_123301);  
  Get_m0_m12_robin(file_123302);  
  Get_m0_m12_robin(file_123303);  
  Get_m0_m12_robin(file_123304);  
  Get_m0_m12_robin(file_123305);  
  Get_m0_m12_robin(file_123306);  
  Get_m0_m12_robin(file_123307);  
  Get_m0_m12_robin(file_123308);  
  Get_m0_m12_robin(file_123309);  
  Get_m0_m12_robin(file_123310);  
  Get_m0_m12_robin(file_123311);  
  Get_m0_m12_robin(file_123312);  
  Get_m0_m12_robin(file_123313);  
  Get_m0_m12_robin(file_123314);  
  Get_m0_m12_robin(file_123315);  
  Get_m0_m12_robin(file_123316);  
  Get_m0_m12_robin(file_123317);  
  Get_m0_m12_robin(file_123320);  
  Get_m0_m12_robin(file_123321);  
  Get_m0_m12_robin(file_123322);  
  Get_m0_m12_robin(file_123323);  
  Get_m0_m12_robin(file_123324);  
  Get_m0_m12_robin(file_123325);  
  Get_m0_m12_robin(file_123326);  
  Get_m0_m12_robin(file_123327);  
  Get_m0_m12_robin(file_123328);  
  Get_m0_m12_robin(file_123329);  
  Get_m0_m12_robin(file_123330);  
  Get_m0_m12_robin(file_123331);  
  Get_m0_m12_robin(file_123332);  
  Get_m0_m12_robin(file_123333);  
  Get_m0_m12_robin(file_123334);  
  Get_m0_m12_robin(file_123335);  
  Get_m0_m12_robin(file_123336);  
  Get_m0_m12_robin(file_123337);  
  Get_m0_m12_robin(file_123338);  
  Get_m0_m12_robin(file_123339);  
  Get_m0_m12_robin(file_123340);  
  Get_m0_m12_robin(file_123341);  
  Get_m0_m12_robin(file_123342);  
  Get_m0_m12_robin(file_123343);  
  Get_m0_m12_robin(file_123344);  
  Get_m0_m12_robin(file_123345);  
  Get_m0_m12_robin(file_123346);  
  Get_m0_m12_robin(file_123347);  
  Get_m0_m12_robin(file_123348);  
  Get_m0_m12_robin(file_123349);  
  Get_m0_m12_robin(file_123350);  
  Get_m0_m12_robin(file_123351);  
  Get_m0_m12_robin(file_123352);  
  Get_m0_m12_robin(file_123353);  
  Get_m0_m12_robin(file_123354);  
  Get_m0_m12_robin(file_123355);  
  Get_m0_m12_robin(file_123356);  
  Get_m0_m12_robin(file_123357);  
  Get_m0_m12_robin(file_123358);  
  Get_m0_m12_robin(file_123359);  
  Get_m0_m12_robin(file_123360);  
  Get_m0_m12_robin(file_123361);  
  Get_m0_m12_robin(file_123362);  
  Get_m0_m12_robin(file_123363);  
  Get_m0_m12_robin(file_123364);  
  Get_m0_m12_robin(file_123365);  
  Get_m0_m12_robin(file_123366);  
  Get_m0_m12_robin(file_123367);  
  Get_m0_m12_robin(file_123368);  
  Get_m0_m12_robin(file_123369);  
  Get_m0_m12_robin(file_123370);  
  Get_m0_m12_robin(file_123371);  
  Get_m0_m12_robin(file_123372);  
  Get_m0_m12_robin(file_123373);  
  Get_m0_m12_robin(file_123374);  
  Get_m0_m12_robin(file_123375);  
  Get_m0_m12_robin(file_123376);  
  Get_m0_m12_robin(file_123377);  
  Get_m0_m12_robin(file_123378);  
  Get_m0_m12_robin(file_123379);  
  Get_m0_m12_robin(file_123380);  
  Get_m0_m12_robin(file_123381);  
  Get_m0_m12_robin(file_123383);  
  Get_m0_m12_robin(file_123384);  
  Get_m0_m12_robin(file_123385);  
  Get_m0_m12_robin(file_123386);  
  Get_m0_m12_robin(file_123387);  
  Get_m0_m12_robin(file_123388);  
  Get_m0_m12_robin(file_123389);  
  Get_m0_m12_robin(file_123390);  
  Get_m0_m12_robin(file_123391);  
  Get_m0_m12_robin(file_123392);  
  Get_m0_m12_robin(file_123393);  
  Get_m0_m12_robin(file_123394);  
  Get_m0_m12_robin(file_123396);  
  Get_m0_m12_robin(file_123397);  
  Get_m0_m12_robin(file_123398);  
  Get_m0_m12_robin(file_123399);  
  Get_m0_m12_robin(file_123400);  
  Get_m0_m12_robin(file_123401);  
  Get_m0_m12_robin(file_123402);  
  Get_m0_m12_robin(file_123403);  
  Get_m0_m12_robin(file_123404);  
  Get_m0_m12_robin(file_123405);  
  Get_m0_m12_robin(file_123406);  
  Get_m0_m12_robin(file_123407);  
  Get_m0_m12_robin(file_123408);  
  Get_m0_m12_robin(file_123409);  
  Get_m0_m12_robin(file_123410);  
  Get_m0_m12_robin(file_123411);  
  Get_m0_m12_robin(file_123412);  
  Get_m0_m12_robin(file_123413);  
  Get_m0_m12_robin(file_123414);  
  Get_m0_m12_robin(file_123415);  
  Get_m0_m12_robin(file_123416);  
  Get_m0_m12_robin(file_123417);  
  Get_m0_m12_robin(file_123418);  
  Get_m0_m12_robin(file_123419);  
  Get_m0_m12_robin(file_123420);  
  Get_m0_m12_robin(file_123422);  
  Get_m0_m12_robin(file_123423);  
  Get_m0_m12_robin(file_123424);  
  Get_m0_m12_robin(file_123425);  
  Get_m0_m12_robin(file_123426);  
  Get_m0_m12_robin(file_123427);  
  Get_m0_m12_robin(file_123428);  
  Get_m0_m12_robin(file_123430);  
  Get_m0_m12_robin(file_123431);  
  Get_m0_m12_robin(file_123432);  
  Get_m0_m12_robin(file_123433);  
  Get_m0_m12_robin(file_123434);  
  Get_m0_m12_robin(file_123435);  
  Get_m0_m12_robin(file_123436);  
  Get_m0_m12_robin(file_123437);  
  Get_m0_m12_robin(file_123438);  
  Get_m0_m12_robin(file_123439);  
  Get_m0_m12_robin(file_123440);  
  Get_m0_m12_robin(file_123441);  
  Get_m0_m12_robin(file_123442);  
  Get_m0_m12_robin(file_123443);  
  Get_m0_m12_robin(file_123444);  
  Get_m0_m12_robin(file_123445);  
  Get_m0_m12_robin(file_123447);  
  Get_m0_m12_robin(file_123448);  
  Get_m0_m12_robin(file_123449);  
  Get_m0_m12_robin(file_123450);  
  Get_m0_m12_robin(file_123451);  
  Get_m0_m12_robin(file_123452);  
  Get_m0_m12_robin(file_123453);  
  Get_m0_m12_robin(file_123454);  
  Get_m0_m12_robin(file_123455);  
  Get_m0_m12_robin(file_123456);  
  Get_m0_m12_robin(file_123457);  
  Get_m0_m12_robin(file_123458);  
  Get_m0_m12_robin(file_123460);  
  Get_m0_m12_robin(file_123461);  
  Get_m0_m12_robin(file_123462);  
  Get_m0_m12_robin(file_123463);  
  Get_m0_m12_robin(file_123464);  
  Get_m0_m12_robin(file_123465);  
  Get_m0_m12_robin(file_123466);  
  Get_m0_m12_robin(file_123467);  
  Get_m0_m12_robin(file_123468);  
  Get_m0_m12_robin(file_123469);  
  Get_m0_m12_robin(file_123470);  
  Get_m0_m12_robin(file_123471);  
  Get_m0_m12_robin(file_123472);  
  Get_m0_m12_robin(file_123473);  
  Get_m0_m12_robin(file_123474);  
  Get_m0_m12_robin(file_123475);  
  Get_m0_m12_robin(file_123476);  
  Get_m0_m12_robin(file_123477);  
  Get_m0_m12_robin(file_123478);  
  Get_m0_m12_robin(file_123479);  
  Get_m0_m12_robin(file_123480);  
  Get_m0_m12_robin(file_123481);  
  Get_m0_m12_robin(file_123482);  
  Get_m0_m12_robin(file_123483);  
  Get_m0_m12_robin(file_123484);  
  Get_m0_m12_robin(file_123485);  
  Get_m0_m12_robin(file_123486);  
  Get_m0_m12_robin(file_123487);  
  Get_m0_m12_robin(file_123488);  
  Get_m0_m12_robin(file_123489);  
  Get_m0_m12_robin(file_123490);  
  Get_m0_m12_robin(file_123491);  
  Get_m0_m12_robin(file_123492);  
  Get_m0_m12_robin(file_123493);  
  Get_m0_m12_robin(file_123494);  
  Get_m0_m12_robin(file_123495);  
  Get_m0_m12_robin(file_123496);  
  Get_m0_m12_robin(file_123497);  
  Get_m0_m12_robin(file_123498);  
  Get_m0_m12_robin(file_123499);  
  Get_m0_m12_robin(file_123501);  
  Get_m0_m12_robin(file_123502);  
  Get_m0_m12_robin(file_123503);  
  Get_m0_m12_robin(file_123504);  
  Get_m0_m12_robin(file_123505);  
  Get_m0_m12_robin(file_123506);  
  Get_m0_m12_robin(file_123507);  
  Get_m0_m12_robin(file_123508);  
  Get_m0_m12_robin(file_123509);  
  Get_m0_m12_robin(file_123510);  
  Get_m0_m12_robin(file_123511);  
  Get_m0_m12_robin(file_123512);  
  Get_m0_m12_robin(file_123513);  
  Get_m0_m12_robin(file_123514);  
  Get_m0_m12_robin(file_123516);  
  Get_m0_m12_robin(file_123517);  
  Get_m0_m12_robin(file_123518);  
  Get_m0_m12_robin(file_123519);  
  Get_m0_m12_robin(file_123520);  
  Get_m0_m12_robin(file_123521);  
  Get_m0_m12_robin(file_123522);  
  Get_m0_m12_robin(file_123523);  
  Get_m0_m12_robin(file_123524);  
  Get_m0_m12_robin(file_123526);  
  Get_m0_m12_robin(file_123527);  
  Get_m0_m12_robin(file_123528);  
  Get_m0_m12_robin(file_123529);  
  Get_m0_m12_robin(file_123530);  
  Get_m0_m12_robin(file_123531);  
  Get_m0_m12_robin(file_123533);  
  Get_m0_m12_robin(file_123534);  
  Get_m0_m12_robin(file_123535);  
  Get_m0_m12_robin(file_123536);  
  Get_m0_m12_robin(file_123537);  
  Get_m0_m12_robin(file_123538);  
  Get_m0_m12_robin(file_123539);  
  Get_m0_m12_robin(file_123540);  
  Get_m0_m12_robin(file_123541);  
  Get_m0_m12_robin(file_123542);  
  Get_m0_m12_robin(file_123543);  
  Get_m0_m12_robin(file_123544);  
  Get_m0_m12_robin(file_123545);  
  Get_m0_m12_robin(file_123546);  
  Get_m0_m12_robin(file_123547);  
  Get_m0_m12_robin(file_123548);  
  Get_m0_m12_robin(file_123549);  
  Get_m0_m12_robin(file_123550);  
  Get_m0_m12_robin(file_123551);  
  Get_m0_m12_robin(file_123552);  
  Get_m0_m12_robin(file_123553);  
  Get_m0_m12_robin(file_123554);  
  Get_m0_m12_robin(file_123555);  
  Get_m0_m12_robin(file_123556);  
  Get_m0_m12_robin(file_123557);  
  Get_m0_m12_robin(file_123558);  
  Get_m0_m12_robin(file_123559);  
  Get_m0_m12_robin(file_123560);  
  Get_m0_m12_robin(file_123561);  
  Get_m0_m12_robin(file_123562);  
  Get_m0_m12_robin(file_123563);  
  Get_m0_m12_robin(file_123564);  
  Get_m0_m12_robin(file_123565);  
  Get_m0_m12_robin(file_123566);  
  Get_m0_m12_robin(file_123567);  
  Get_m0_m12_robin(file_123568);  
  Get_m0_m12_robin(file_123569);  
  Get_m0_m12_robin(file_123570);  
  Get_m0_m12_robin(file_123571);  
  Get_m0_m12_robin(file_123572);  
  Get_m0_m12_robin(file_123573);  
  Get_m0_m12_robin(file_123574);  
  Get_m0_m12_robin(file_123575);  
  Get_m0_m12_robin(file_123576);  
  Get_m0_m12_robin(file_123577);  
  Get_m0_m12_robin(file_123578);  
  Get_m0_m12_robin(file_123579);  
  Get_m0_m12_robin(file_123580);  
  Get_m0_m12_robin(file_123581);  
  Get_m0_m12_robin(file_123582);  
  Get_m0_m12_robin(file_123583);  
  Get_m0_m12_robin(file_123584);  
  Get_m0_m12_robin(file_123585);  
  Get_m0_m12_robin(file_123586);  
  Get_m0_m12_robin(file_123587);  
  Get_m0_m12_robin(file_123588);  
  Get_m0_m12_robin(file_123589);  
  Get_m0_m12_robin(file_123590);  
  Get_m0_m12_robin(file_123591);  
  Get_m0_m12_robin(file_123592);  
  Get_m0_m12_robin(file_123593);  
  Get_m0_m12_robin(file_123594);  
  Get_m0_m12_robin(file_123595);  
  Get_m0_m12_robin(file_123597);  
  Get_m0_m12_robin(file_123598);  
  Get_m0_m12_robin(file_123599);  
  Get_m0_m12_robin(file_123600);  
  Get_m0_m12_robin(file_123601);  
  Get_m0_m12_robin(file_123602);  
  Get_m0_m12_robin(file_123603);  
  Get_m0_m12_robin(file_123604);  
  Get_m0_m12_robin(file_123605);  
  Get_m0_m12_robin(file_123606);  
  Get_m0_m12_robin(file_123607);  
  Get_m0_m12_robin(file_123609);  
  Get_m0_m12_robin(file_123611);  
  Get_m0_m12_robin(file_123612);  
  Get_m0_m12_robin(file_123613);  
  Get_m0_m12_robin(file_123614);  
  Get_m0_m12_robin(file_123615);  
  Get_m0_m12_robin(file_123616);  
  Get_m0_m12_robin(file_123617);  
  Get_m0_m12_robin(file_123618);  
  Get_m0_m12_robin(file_123619);  
  Get_m0_m12_robin(file_123620);  
  Get_m0_m12_robin(file_123621);  
  Get_m0_m12_robin(file_123622);  
  Get_m0_m12_robin(file_123623);  
  Get_m0_m12_robin(file_123624);  
  Get_m0_m12_robin(file_123625);  
  Get_m0_m12_robin(file_123626);  
  Get_m0_m12_robin(file_123628);  
  Get_m0_m12_robin(file_123629);  
  Get_m0_m12_robin(file_123630);  
  Get_m0_m12_robin(file_123631);  
  Get_m0_m12_robin(file_123632);  
  Get_m0_m12_robin(file_123633);  
  Get_m0_m12_robin(file_123634);  
  Get_m0_m12_robin(file_123635);  
  Get_m0_m12_robin(file_123636);  
  Get_m0_m12_robin(file_123637);  
  Get_m0_m12_robin(file_123638);  
  Get_m0_m12_robin(file_123640);  
  Get_m0_m12_robin(file_123641);  
  Get_m0_m12_robin(file_123642);  
  Get_m0_m12_robin(file_123643);  
  Get_m0_m12_robin(file_123644);  
  Get_m0_m12_robin(file_123645);  
  Get_m0_m12_robin(file_123646);  
  Get_m0_m12_robin(file_123647);  
  Get_m0_m12_robin(file_123648);  
  Get_m0_m12_robin(file_123649);  
  Get_m0_m12_robin(file_123650);  
  Get_m0_m12_robin(file_123651);  
  Get_m0_m12_robin(file_123652);  
  Get_m0_m12_robin(file_123653);  
  Get_m0_m12_robin(file_123654);  
  Get_m0_m12_robin(file_123655);  
  Get_m0_m12_robin(file_123656);  
  Get_m0_m12_robin(file_123657);  
  Get_m0_m12_robin(file_123658);  
  Get_m0_m12_robin(file_123659);  
  Get_m0_m12_robin(file_123660);  
  Get_m0_m12_robin(file_123661);  
  Get_m0_m12_robin(file_123662);  
  Get_m0_m12_robin(file_123663);  
  Get_m0_m12_robin(file_123664);  
  Get_m0_m12_robin(file_123665);  
  Get_m0_m12_robin(file_123666);  
  Get_m0_m12_robin(file_123667);  
  Get_m0_m12_robin(file_123668);  
  Get_m0_m12_robin(file_123669);  
  Get_m0_m12_robin(file_123670);  
  Get_m0_m12_robin(file_123671);  
  Get_m0_m12_robin(file_123672);  
  Get_m0_m12_robin(file_123673);  
  Get_m0_m12_robin(file_123674);  
  Get_m0_m12_robin(file_123675);  
  Get_m0_m12_robin(file_123676);  
  Get_m0_m12_robin(file_123677);  
  Get_m0_m12_robin(file_123678);  
  Get_m0_m12_robin(file_123679);  
  Get_m0_m12_robin(file_123680);  
  Get_m0_m12_robin(file_123682);  
  Get_m0_m12_robin(file_123683);  
  Get_m0_m12_robin(file_123684);  
  Get_m0_m12_robin(file_123686);  
  Get_m0_m12_robin(file_123687);  
  Get_m0_m12_robin(file_123688);  
  Get_m0_m12_robin(file_123689);  
  Get_m0_m12_robin(file_123690);  
    

  TString filename = "plots/";
  
  filename+= "NLO_xsection";
  float max = .5;

// ALL PROCESSES

  TCanvas *c2 = new TCanvas("canvas2","canvas2", 200,10,1500,1000);  // 1D histo
  TCanvas *c3 = new TCanvas("canvas3","canvas3", 200,10,1500,1000);  // 1D histo
  TCanvas *c4 = new TCanvas("canvas4","canvas4", 200,10,1500,1000);  // 1D histo
  TCanvas *c5 = new TCanvas("canvas5","canvas5", 200,10,1500,1000);  // 1D histo
  TCanvas *c6 = new TCanvas("canvas6","canvas6", 200,10,1500,1000);  // 1D histo
  TCanvas *c7 = new TCanvas("canvas7","canvas7", 200,10,1500,1000);  // 1D histo
  TCanvas *c8 = new TCanvas("canvas8","canvas8", 200,10,1500,1000);  // 1D histo
  TCanvas *c9 = new TCanvas("canvas9","canvas9", 200,10,1500,1000);  // 1D histo
  TCanvas *c1 = new TCanvas("canvas1","canvas1", 200,10,1500,1000);  // 1D histo
  
  c2->SetLogz();
  c1->SetLogz();
  c3->SetLogz();
  c4->SetLogz();
  c5->SetLogz();
  c6->SetLogz();
  c7->SetLogz();
  c8->SetLogz();
  c9->SetLogz();

  c2->cd(); 
  draw(grid_gq, max, "#sigma_{NLO} #tilde{g}#tilde{q}"); // 1 gluino + 1 squark
 
  c3->cd(); 
  draw(grid_gg, max, "#sigma_{NLO} #tilde{g}#tilde{g}"); // 2 gluinos

  c4->cd(); 
  draw(grid_qq, max, "#sigma_{NLO} #tilde{q}#tilde{q}"); // 2 squarks

  c5->cd();
  draw(grid_qaq, max, "#sigma_{NLO} #tilde{q}#bar{#tilde{q}}"); // 1 squark 1 antisquark

  c6->cd();
  draw(grid_tt, max, "#sigma_{NLO} #tilde{t}#bar{#tilde{t}}"); // 1 stop antistop

  c7->cd();
  draw(grid_bb, max, "#sigma_{NLO} #tilde{b}#bar{#tilde{b}}"); // 1 sbottom antisbottom

  c8->cd();
  draw(grid_gchi, max, "#sigma_{NLO} #tilde{g}#chi"); // 1 gluino + chi

  c9->cd();
  draw(grid_qqchi, max, "#sigma_{NLO} #tilde{q}#bar{#tilde{q}}#chi"); // 1 squark 1 antisquark + chi

  c1->cd();
  draw(grid_cs, max, "#sigma_{NLO} All"); 

  c1->Print(filename+".pdf");
  c1->Print(filename+".eps"); 
  c2->Print(filename+"_gq.eps"); 
  c3->Print(filename+"_gg.eps"); 
  c4->Print(filename+"_qq.eps"); 
  c5->Print(filename+"_qaq.eps"); 
  c6->Print(filename+"_tt.eps"); 
  c7->Print(filename+"_bb.eps"); 
  c8->Print(filename+"_gchi.eps"); 
  c9->Print(filename+"_qaqchi.eps"); 
  
  myfile << "  return;"<<endl;
  myfile << "}"<<endl;
  myfile.close();
   
}
Ejemplo n.º 14
0
void wjetsPrint(string type="ps"){

  

  const int nProcs = 2;
  string procs[nProcs] = {"elec", "muon"};

  string event_type = type;

  // ctrl_highm
  if(event_type.find("ps")!=string::npos){

    string vars[] = {"lep_met_pt","dijet_pt","dijet_m","jet_n","met","lep_met_mt","lep_pt","lead_jet_pt","lep_met_dijet_mt","avg_int_per_xing"};
    int tmpVars = sizeof(vars)/sizeof(vars[0]);
    const int nVars = tmpVars;  
    string plot_vars[nVars] = {"Pt(lep,MET)","Dijet Pt","Dijet M","Jet N","MET_RefFinal","MT(lep,met)","Lepton Pt","Leading jet pt","Mt(lep,MET,dijet)","Average Interactions per Xing"};

  }else if(event_type.find("ctrl_ewk")!=string::npos){

    string vars[] = {"mt_dijet_pt","mt_njets","mt_met","mt_lep_met_mt","mt_lep_pt"};
    int tmpVars = sizeof(vars)/sizeof(vars[0]);
    const int nVars = tmpVars;  
    string plot_vars[nVars] = {"Dijet Pt","Jet N","MET_RefFinal","MT(lep,met)","Lepton Pt"};

  }else if(event_type.find("ctrl_highm")!=string::npos){

    string vars[] = {"dijet_m_lep_met_pt","dijet_m_dijet_pt","dijet_m_jet_n","dijet_m_met","dijet_m_lep_met_mt","dijet_m_lep_pt","dijet_m_lead_jet_pt","dijet_m_lep_met_dijet_mt"};
    
    int tmpVars = sizeof(vars)/sizeof(vars[0]);
    const int nVars = tmpVars;  
    string plot_vars[nVars] = {"Pt(lep,MET)","Dijet Pt","Jet N","MET_RefFinal","MT(lep,met)","Lepton Pt","Leading jet pt","Mt(lep,MET,dijet)"};

  }  // // ps


  // string regions[] = {"all"}
  // int tmpRegions = sizeof(regions)/sizeof(regions[0]);
  // const int nRegions = tmpRegions;
    
  gROOT->LoadMacro("../include/atlasstyle-00-03-04/AtlasStyle.C");
  SetAtlasStyle();
  gROOT->LoadMacro("../include/atlasstyle-00-03-04/AtlasUtils.C");
  gROOT->LoadMacro("../include/atlasstyle-00-03-04/AtlasLabels.C");
  
  gROOT->SetBatch();
  
  cout<<endl;
  cout<<"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"<<endl;
  cout<<"In wjetsPrint.C"<<endl;

  //string file_loc = "/Users/elw/analy/lvjj/plots/ctrl_plots/";

  string file_loc;
  if(event_type.find("ps")!=string::npos){
    file_loc="/Users/elw/Dropbox/eMacs/analy/lvjj/plots/gww_plots/";
  }else if(event_type.find("ctrl")!=string::npos){
    file_loc="/Users/elw/Dropbox/eMacs/analy/lvjj/plots/ctrl_plots/";
  }else{
    cout<<"Unknown plot source type: "<<event_type<<endl;
    exit(1);
  }

  //////////////////////////////////////////////////
  // Load Data
  ////////////////////////////////////////////////// 
  string file_end;
  if(event_type.find("ps")!=string::npos){
    file_end=".plot.root";
  }else if(event_type.find("ctrl")!=string::npos){
    file_end=".ctrl.plot.root";
  }else{
    cout<<"Unknown plot source type: "<<event_type<<endl;
    exit(1);
  }
  
  string data_loc = file_loc+"merged/data.lnuj"+file_end;
  TFile* data = (TFile*) TFile::Open(data_loc.c_str());
  //////////////////////////////////////////////////
  // Load Scaled Backgrounds
  //////////////////////////////////////////////////
  
  string sherpa_wjets_loc = file_loc+"merged/mc.sherpa.wjets"+file_end;
  string alpgen_wjets_loc = file_loc+"merged/mc.alpgen.wjets"+file_end;
  string vv_loc = file_loc+"merged/mc.herwig.vv"+file_end;
  string alpgen_qcd_loc = file_loc+"merged/qcd.alpgen"+file_end;
  string sherpa_qcd_loc = file_loc+"merged/qcd.sherpa"+file_end;
  string top_loc = file_loc+"merged/mc.mcatnlo.top"+file_end;  
  string alpgen_zjets_loc = file_loc+"merged/mc.alpgen.zjets"+file_end;
  string sherpa_zjets_loc = file_loc+"merged/mc.sherpa.zjets"+file_end;

  TFile* sherpa_wjets = (TFile*) TFile::Open(sherpa_wjets_loc.c_str(),"READ");  
  TFile* alpgen_wjets = (TFile*) TFile::Open(alpgen_wjets_loc.c_str(),"READ");
  TFile* top = (TFile*) TFile::Open(top_loc.c_str(),"READ");
  TFile* alpgen_qcd = (TFile*) TFile::Open(alpgen_qcd_loc.c_str(),"READ");
  TFile* vv = (TFile*) TFile::Open(vv_loc.c_str(),"READ");
  TFile* sherpa_qcd = (TFile*) TFile::Open(sherpa_qcd_loc.c_str(),"READ");
  TFile* sherpa_zjets = (TFile*) TFile::Open(sherpa_zjets_loc.c_str(),"READ");
  TFile* alpgen_zjets = (TFile*) TFile::Open(alpgen_zjets_loc.c_str(),"READ");


  const int nBkgds = 2;
  TFile* bkgd_files[nBkgds] = {vv,top};

  //////////////////////////////////////////////////
  // Histogram selection
  ////////////////////////////////////////////////// 

  
  TH1F* h_data[nProcs][nVars];
  TH1F* h_sherpa_bkgd[nProcs][nVars];
  TH1F* h_alpgen_bkgd[nProcs][nVars];
  THStack* stk_alpgen_bkgd[nProcs][nVars];
  TH1F* h_sherpa_ratio[nProcs][nVars];
  TH1F* h_alpgen_ratio[nProcs][nVars];
  
  for(int p=0;p<nProcs;p++){// e.g. elec,muon
    string proc = procs[p];

    for(int v=0;v<nVars;v++){// e.g. nocut_dijet_pt, dijet_m_lep_met_mt
      string var = vars[v];

      string hist_name;
      if(event_type.find("ps")!=string::npos){
	hist_name = "ps/h_"+proc+"_"+var;
      }else if(event_type.find("ctrl")!=string::npos){
	hist_name = "h_"+event_type+"_"+proc+"_"+var;
	}else{
	cout<<"Unknown plot source type: "<<event_type<<endl;
	exit(1);
      }

      //////////////////////////////////////////////////
      // Load data
      //////////////////////////////////////////////////
      //h_data[p][v] = (TH1F*) data->Get(hist_name.c_str())->Clone();
      h_data[p][v] = (TH1F*) data->Get(hist_name.c_str());

      //////////////////////////////////////////////////
      // Load backgrounds
      //////////////////////////////////////////////////
      // h_sherpa/alpgen for ratios
      //TH1F* cur_sherpa_wjets_hist = (TH1F*) sherpa_wjets->Get(hist_name.c_str())->Clone();
      TH1F* cur_sherpa_wjets_hist = (TH1F*) sherpa_wjets->Get(hist_name.c_str());
      h_sherpa_bkgd[p][v] = cur_sherpa_wjets_hist;

      TH1F* cur_sherpa_zjets_hist = (TH1F*) sherpa_zjets->Get(hist_name.c_str());
      ((TH1F*) h_sherpa_bkgd[p][v])->Add(cur_sherpa_zjets_hist);
      h_sherpa_bkgd[p][v]->SetLineColor(sherpa_color);

      TH1F* cur_sherpa_qcd_hist = (TH1F*) sherpa_qcd->Get(hist_name.c_str());
      ((TH1F*) h_sherpa_bkgd[p][v])->Add(cur_sherpa_qcd_hist);

      //alpgen
      //TH1F* cur_alpgen_wjets_hist = (TH1F*) alpgen_wjets->Get(hist_name.c_str())->Clone();
      TH1F* cur_alpgen_wjets_hist = (TH1F*) alpgen_wjets->Get(hist_name.c_str());
      h_alpgen_bkgd[p][v] = cur_alpgen_wjets_hist;

      TH1F* cur_alpgen_zjets_hist = (TH1F*) alpgen_zjets->Get(hist_name.c_str());
      ((TH1F*) h_alpgen_bkgd[p][v])->Add(cur_alpgen_zjets_hist);
      h_alpgen_bkgd[p][v]->SetLineColor(alpgen_color);

      //TH1F* cur_alpgen_qcd_hist = (TH1F*) alpgen_qcd->Get(hist_name.c_str())->Clone();
      TH1F* cur_alpgen_qcd_hist = (TH1F*) alpgen_qcd->Get(hist_name.c_str());
      ((TH1F*) h_alpgen_bkgd[p][v])->Add(cur_alpgen_qcd_hist);
      h_alpgen_bkgd[p][v]->SetLineWidth(1);
      
      // h_alpgen_bkgd[p][v] = (TH1F*) alpgen_wjets->Get(hist_name.c_str())->Clone();
      // ((TH1F*) h_alpgen_bkgd[p][v])->Add((TH1F*) alpgen_qcd->Get(hist_name.c_str())->Clone());
      // ((TH1F*) h_alpgen_bkgd[p][v])->Add((TH1F*) alpgen_zjets->Get(hist_name.c_str())->Clone());
      // h_alpgen_bkgd[p][v]->SetLineColor(alpgen_color);
      //

	
      string stack_name = "stk_"+event_type+"_"+proc+"_"+var;
      stk_alpgen_bkgd[p][v] = new THStack(stack_name.c_str(),hist_name.c_str());

      TH1F* vv_hist = (TH1F*) vv->Get(hist_name.c_str())->Clone();
      //vv_hist->SetFillStyle(3013);
      vv_hist->SetFillColor(kYellow-4);
      vv_hist->SetLineWidth(1);
      ((THStack*) stk_alpgen_bkgd[p][v])->Add(vv_hist,"hist");
      // TH1F* alpgen_qcd_hist = (TH1F*) alpgen_qcd->Get(hist_name.c_str())->Clone();
      // alpgen_qcd_hist->SetFillStyle(3003);
      // alpgen_qcd_hist->SetFillColor(kRed);
      // alpgen_qcd_hist->SetLineWidth(1);
      // ((THStack*) stk_alpgen_bkgd[p][v])->Add(alpgen_qcd_hist);
      // TH1F* alpgen_zjets_hist = (TH1F*) alpgen_zjets->Get(hist_name.c_str())->Clone();
      // alpgen_zjets_hist->SetFillStyle(3018);
      // alpgen_zjets_hist->SetFillColor(kYellow);
      // alpgen_zjets_hist->SetLineWidth(1);
      // ((THStack*) stk_alpgen_bkgd[p][v])->Add(alpgen_zjets_hist);
      TH1F* top_hist = (TH1F*) top->Get(hist_name.c_str())->Clone();
      //top_hist->SetFillStyle(3017);
      top_hist->SetFillColor(kAzure+1);
      top_hist->SetLineWidth(1);
      ((THStack*) stk_alpgen_bkgd[p][v])->Add(top_hist,"hist");
      // TH1F* alpgen_wjets_hist = (TH1F*) alpgen_wjets->Get(hist_name.c_str())->Clone();
      // //top_hist->SetF(3003);
      // alpgen_wjets_hist->SetLineColor(6);
      // alpgen_wjets_hist->SetLineWidth(2);
      // ((THStack*) stk_alpgen_bkgd[p][v])->Add(alpgen_wjets_hist);
      ((THStack*) stk_alpgen_bkgd[p][v])->Add((TH1F*) ((TH1F*) h_alpgen_bkgd[p][v])->Clone(),"hist");

	

      //////////////////////////////////////////////////
      // Alpgen printed as stack, to see other backgrounds
      // Sherpa background added
      ////////////////////////////////////////////////// 

	
      for(int b=0;b<nBkgds;b++){

	TH1F* bkgd_hist = (TH1F*) ((TFile*) bkgd_files[b])->Get(hist_name.c_str());
	((TH1F*) h_sherpa_bkgd[p][v])->Add(bkgd_hist);
	((TH1F*) h_alpgen_bkgd[p][v])->Add(bkgd_hist);
      }// bkds

      //////////////////////////////////////////////////
      // make ratio histogram
      //////////////////////////////////////////////////
	
      int n_bins = ((TAxis*) h_data[p][v]->GetXaxis())->GetNbins();
      float x_min = ((TAxis*) h_data[p][v]->GetXaxis())->GetXmin();
      float x_max = ((TAxis*) h_data[p][v]->GetXaxis())->GetXmax();

      string alpgen_ratio_name = "h_alpgen_ratio_"+event_type+"_"+proc+"_"+var;
      TH1F* alpgen_ratio = new TH1F(alpgen_ratio_name.c_str(),"",n_bins,x_min,x_max);

      string sherpa_ratio_name = "h_sherpa_ratio_"+event_type+"_"+proc+"_"+var;
      TH1F* sherpa_ratio = new TH1F(sherpa_ratio_name.c_str(),"",n_bins,x_min,x_max);

      for(int i=0;i<n_bins;i++){ //loop over bins

	float data_count = h_data[p][v]->GetBinContent(i);
	float data_err = h_data[p][v]->GetBinError(i);


	// alpgen
	float alpgen_bkgd_count= h_alpgen_bkgd[p][v]->GetBinContent(i);
	float alpgen_bkgd_err=sqrt(alpgen_bkgd_count);
	// Luminosity Error
	float alpgen_lumi_error = alpgen_bkgd_count*0.037;
	alpgen_bkgd_err = sqrt(pow(alpgen_lumi_error,2.)+pow(alpgen_bkgd_err,2.));


	if(alpgen_bkgd_count && data_count) {
	    
	  //////////////////////////////////////////////////
	  // relErr((D-B)/B) = sqrt( (Err(D-B)/(D-B))^2 + (Err(B)/B)^2)

	  //Err(D-B)
	  double comb_alpgen_bkgd_data_err =
	    sqrt(pow(data_err,2.)+pow(alpgen_bkgd_err,2.));

	  // Err(D-B)/(D-B)
	  double rel_alpgen_bkgd_data_err =
	    comb_alpgen_bkgd_data_err/(data_count-alpgen_bkgd_count);

	  // Err(B)/B
	  double rel_alpgen_bkgd_err =
	    alpgen_bkgd_err/alpgen_bkgd_count;

	  // relErr((D-B)/B)
	  double rel_alpgen_ratio_err =
	    sqrt(pow(rel_alpgen_bkgd_data_err,2.)+pow(rel_alpgen_bkgd_err,2.));

	  double cur_alpgen_ratio = (data_count-alpgen_bkgd_count)/alpgen_bkgd_count;

	  double cur_alpgen_ratio_err = fabs(rel_alpgen_ratio_err*cur_alpgen_ratio);
	  alpgen_ratio->SetBinContent(i,cur_alpgen_ratio);
	  alpgen_ratio->SetBinError(i,cur_alpgen_ratio_err);


	}

	// sherpa
	float sherpa_bkgd_count= h_sherpa_bkgd[p][v]->GetBinContent(i);
	float sherpa_bkgd_err=sqrt(sherpa_bkgd_count);
	// Luminosity Error
	float sherpa_lumi_error = sherpa_bkgd_count*0.037;
	sherpa_bkgd_err = sqrt(pow(sherpa_lumi_error,2.)+pow(sherpa_bkgd_err,2.));


	if(sherpa_bkgd_count && data_count) {
	    
	  //////////////////////////////////////////////////
	  // relErr((D-B)/B) = sqrt( (Err(D-B)/(D-B))^2 + (Err(B)/B)^2)

	  //Err(D-B)
	  double comb_sherpa_bkgd_data_err =
	    sqrt(pow(data_err,2.)+pow(sherpa_bkgd_err,2.));

	  // Err(D-B)/(D-B)
	  double rel_sherpa_bkgd_data_err =
	    comb_sherpa_bkgd_data_err/(data_count-sherpa_bkgd_count);

	  // Err(B)/B
	  double rel_sherpa_bkgd_err =
	    sherpa_bkgd_err/sherpa_bkgd_count;

	  // relErr((D-B)/B)
	  double rel_sherpa_ratio_err =
	    sqrt(pow(rel_sherpa_bkgd_data_err,2.)+pow(rel_sherpa_bkgd_err,2.));

	  double cur_sherpa_ratio = (data_count-sherpa_bkgd_count)/sherpa_bkgd_count;
	  double cur_sherpa_ratio_err = fabs(rel_sherpa_ratio_err*cur_sherpa_ratio);
	 
	  sherpa_ratio->SetBinContent(i,cur_sherpa_ratio);
	  sherpa_ratio->SetBinError(i,cur_sherpa_ratio_err);
	}
      }

      h_sherpa_ratio[p][v] = (TH1F*) sherpa_ratio;
      h_alpgen_ratio[p][v] = (TH1F*) alpgen_ratio;
    }// vars
  }// procs

  //////////////////////////////////////////////////
  // Plotting Loop
  ////////////////////////////////////////////////// 

  const int nCanvases = nProcs*nVars;
  TCanvas* canvases[nCanvases];
  TPad* ratio_pads[nCanvases];
  TPad* plot_pads[nCanvases];

  int c=0; //canvas index
  for(int p=0;p<nProcs;p++){// e.g. elec,muon
    string proc = procs[p];
    for(int v=0;v<nVars;v++){// e.g. nocut_dijet_pt, dijet_m_lep_met_mt
      string var = vars[v];
      
      string canvas_name = "tc_vjets_"+event_type+"_"+proc+"_"+var;
	string hist_name = "h_vjets_"+event_type+"_"+proc+"_"+var;

	//////////////////////////////////////////////////
	// make canvas
	////////////////////////////////////////////////// 

	canvases[c] = 
	  new TCanvas(canvas_name.c_str(),canvas_name.c_str(),0,0,1920,1200);
	canvases[c]->cd();

	
	ratio_pads[c] = new TPad("ratio_pad","ratio_pad",0.01,0.01,0.99,ratio_split);
	ratio_pads[c]->SetTopMargin(0.05);
	ratio_pads[c]->SetBottomMargin(0.31);
	ratio_pads[c]->Draw();

	plot_pads[c] = new TPad("plot_pad","plot_pad",0.01,ratio_split,0.99,0.99);
	plot_pads[c]->SetBottomMargin(0);
	plot_pads[c]->Draw();
	plot_pads[c]->cd();
	plot_pads[c]->Update();  
     
	
	stk_alpgen_bkgd[p][v]->Draw();
	((THStack*) stk_alpgen_bkgd[p][v])->SetMinimum(0.1);
	stk_alpgen_bkgd[p][v]->Draw("hist");

	//h_sherpa_bkgd[p][v]->SetLineColor(sherpa_color);
	h_sherpa_bkgd[p][v]->SetLineWidth(1);
	h_sherpa_bkgd[p][v]->GetXaxis()->SetTitle(plot_vars[v].c_str());
	h_sherpa_bkgd[p][v]->Draw("hist sames");


	h_data[p][v]->SetMarkerStyle(data_marker_style);
	h_data[p][v]->SetMarkerSize(data_marker_size);
	h_data[p][v]->Draw("sames PE");

	cout<<vars[v]<<endl;
	if(vars[v].find("avg_int_per_xing") == string::npos &&
	   vars[v].find("dijet_m")==string::npos){
	  plot_pads[c]->SetLogy();
	}
	canvases[c]->Update();

	//////////////////////////////////////////////////
	// make legend
	////////////////////////////////////////////////// 

	TLegend* lgnd = new TLegend(0.63,0.7,0.9,0.9);
	lgnd->SetFillColor(0);
	lgnd->SetTextSize(0.045);
	lgnd->AddEntry(h_data[p][v],"data","F");
	lgnd->AddEntry(h_sherpa_bkgd[p][v],"SHERPA (qcd,v+jets)","F");
	lgnd->AddEntry(h_alpgen_bkgd[p][v],"ALPGEN (qcd,v+jets)","F");
	lgnd->AddEntry(top_hist,"mc.mcatnlo.top","F");
	lgnd->AddEntry(vv_hist,"mc.herwig.vv","F");
	lgnd->Draw();
	
	//////////////////////////////////////////////////
	// Do ratio
	////////////////////////////////////////////////// 

	ratio_pads[c]->cd();
	ratio_pads[c]->SetGrid();
  
	TAxis* alpgen_ratio_xaxis= h_alpgen_ratio[p][v]->GetXaxis();
	TAxis* alpgen_ratio_yaxis= h_alpgen_ratio[p][v]->GetYaxis();

	h_alpgen_ratio[p][v]->SetMarkerStyle(20);
	h_alpgen_ratio[p][v]->SetMarkerSize(2);
	h_alpgen_ratio[p][v]->SetLineWidth(1);
	h_alpgen_ratio[p][v]->SetLineColor(alpgen_color);

	alpgen_ratio_xaxis->SetLabelSize(0.08);
	alpgen_ratio_yaxis->SetLabelSize(0.08);
    
	alpgen_ratio_xaxis->SetTitle(plot_vars[v].c_str());
	alpgen_ratio_xaxis->SetTitleSize(0.16);
	alpgen_ratio_xaxis->SetTitleOffset(0.7);
	alpgen_ratio_yaxis->SetNdivisions(4,4,4);
	alpgen_ratio_yaxis->SetTitle("(data-MC)/MC");
	alpgen_ratio_yaxis->SetTitleSize(0.07);
	alpgen_ratio_yaxis->SetTitleOffset(0.36);

	alpgen_ratio_yaxis->SetRangeUser(-0.5,0.5);
	h_alpgen_ratio[p][v]->Draw("PE");
	canvases[c]->Update();
	
	TAxis* sherpa_ratio_yaxis= h_sherpa_ratio[p][v]->GetYaxis();
	h_sherpa_ratio[p][v]->SetMarkerStyle(20);
	h_sherpa_ratio[p][v]->SetMarkerSize(2);
	h_sherpa_ratio[p][v]->SetLineColor(sherpa_color);
	sherpa_ratio_yaxis->SetRangeUser(-0.5,0.5);
	h_sherpa_ratio[p][v]->Draw("PE sames");
	canvases[c]->Update();



	plot_pads[c]->cd();
	canvases[c]->RedrawAxis();
	double leg_x1 = lgnd->GetX1NDC();
	double leg_y1 = lgnd->GetY1NDC();
	double offset_x1 = -0.02;
	double offset_y1 = 0.08;
	// If you want to write text on the plot (e.g. integrated luminosity)
	//string atlas_text    = "ATLAS pre-approval";

	string sqrts_text    = "#sqrt{s}= 7 TeV";
	string lumi_text     = "#int Ldt = 4.701 fb^{-1}";
	myText(leg_x1-offset_x1, leg_y1-offset_y1, 1, sqrts_text.c_str());
	myText(leg_x1-offset_x1 + 0.1, leg_y1-offset_y1,1,  lumi_text.c_str());


	string cur_saveas = plot_loc+hist_name+save_ext;
	canvases[c]->SaveAs(cur_saveas.c_str());
	
	++c;
    }
  }

  sherpa_wjets->Close();
  sherpa_zjets->Close();
  vv->Close();
  alpgen_qcd->Close();
  sherpa_qcd->Close();  
  top->Close();
  alpgen_zjets->Close();
  sherpa_zjets->Close();
  
  gROOT->ProcessLine(".q");
}
Ejemplo n.º 15
0
void triggerPlots() {

// plot 
  TString filename = "trigger_";
  
#ifdef ALL
  filename += "all_";
#endif
#ifdef PERIOD1
  filename += "DtoI_";
#endif
#ifdef PERIOD2
  filename += "JtoM_";
#endif

#ifdef ELECTRON
  filename += "el_";
#endif
#ifdef MUON
  filename += "mu_";
#endif

#ifdef PT
  filename += "pt_";
#endif
#ifdef PTETA
  filename += "pt_eta_";
#endif
#ifdef ETAPHI
  filename += "eta_phi_";
#endif
#ifdef ZOOM
  filename += "zoom_";
#endif
#ifdef ETA
  filename += "eta_";
#endif
#ifdef PHI
  filename += "phi_";
#endif
#ifdef BARREL
  filename += "barrel_";
#endif
#ifdef ENDCAP
  filename += "endcap_";
#endif
#ifdef MC
  filename += "mc_";
#endif

#ifdef TAGPROBE
  filename += "TP";
#endif
#ifdef BOOTSTRAP
  filename += "BS";
#endif
  
  gROOT->SetStyle("ATLAS");
  SetAtlasStyle();
  gROOT->ForceStyle();
  
// TFile* file_electronStream  = TFile::Open("root/trigger_107650_electronStream.root");
// TFile* file_electronStream  = TFile::Open("root/trigger_190878_electronStream.root");
// TFile* file_electronStream  = TFile::Open("root/trigger_D_electronStream.root");
// TFile* file_electronStream  = TFile::Open("root/trigger_107652_electronStream.root");
// TFile* file_electronStream  = TFile::Open("root/trigger_107660_muonStream.root");

#ifdef PERIOD2
#ifdef ELECTRON
 TFile* file_electronStream0  = TFile::Open("root/trigger_J_electronStream.root");
 TFile* file_electronStream1  = TFile::Open("root/trigger_K_electronStream.root");
 TFile* file_electronStream2  = TFile::Open("root/trigger_L_electronStream.root");
 TFile* file_electronStream3  = TFile::Open("root/trigger_M_electronStream.root");
#endif
#ifdef MUON
 TFile* file_electronStream0  = TFile::Open("root/trigger_J_muonStream.root");
 TFile* file_electronStream1  = TFile::Open("root/trigger_K_muonStream.root");
 TFile* file_electronStream2  = TFile::Open("root/trigger_L_muonStream.root");
 TFile* file_electronStream3  = TFile::Open("root/trigger_M_muonStream.root");
#endif

#endif

#ifdef PERIOD1
#ifdef ELECTRON
 TFile* file_electronStream0  = TFile::Open("root/trigger_DEF_electronStream.root");
 TFile* file_electronStream1  = TFile::Open("root/trigger_G_electronStream.root");
 TFile* file_electronStream2  = TFile::Open("root/trigger_H_electronStream.root");
 TFile* file_electronStream3  = TFile::Open("root/trigger_I_electronStream.root");
#endif
#ifdef MUON
 TFile* file_electronStream0  = TFile::Open("root/trigger_G_muonStream.root");
 TFile* file_electronStream1  = TFile::Open("root/trigger_H_muonStream.root");
 TFile* file_electronStream2  = TFile::Open("root/trigger_I_muonStream.root");
 TFile* file_electronStream3  = TFile::Open("root/trigger_I_muonStream.root"); //dummy, don't plot
#endif
#endif

#ifdef ALL
// TFile* file_electronStream0  = TFile::Open("root/trigger_muonStream.root"); // my matching
// TFile* file_electronStream0  = TFile::Open("root/trigger_107660.root");
// TFile* file_electronStream0  = TFile::Open("root/trigger_190933_muonStream.root");
// TFile* file_electronStream0  = TFile::Open("root/trigger_107650_electronStream.root");//Zee
// TFile* file_electronStream0  = TFile::Open("root/trigger_106484_electronStream.root");
#ifdef ELECTRON
 TFile* file_electronStream0  = TFile::Open("root/trigger_electronStream.root"); //matching from d3pd
#endif
#ifdef MUON
 TFile* file_electronStream0  = TFile::Open("root/trigger_muonStream.root"); //matching from d3pd
#endif
#endif
#ifdef MC
#ifdef ELECTRON
 TFile* file_electronStream_mc  = TFile::Open("root/trigger_107650.root");//Zee
#endif
#ifdef MUON
 TFile* file_electronStream_mc  = TFile::Open("root/trigger_107660.root");//Zmumu
#endif
#endif

#ifdef ELECTRON
 histo_string = "h_el_trg_";
#endif
#ifdef MUON
 histo_string = "h_mu_trg_";
#endif
 
#ifdef PT
  histo_string += "pt"; //leading electron pt
#endif
#ifdef ETA
  histo_string += "eta"; 
#endif
#ifdef PHI
  histo_string += "phi"; 
#endif
#endif
#ifdef PTETA
  histo_string += "pt_eta"; //leading electron eta
#endif
#ifdef ETAPHI
  histo_string += "eta_phi"; 
#endif


#ifdef BARREL
  histo_string += "_barrel";
#endif
#ifdef ENDCAP
  histo_string += "_endcap";
#endif

#endif
  
#ifdef ALL
  TH2F *h2_ds0; 
  TH1D *h1_ds0, *h1_ds0_bs;
  TH1D *h1_ds0_total, *h1_ds0_bs_total;
#ifdef H2D
  TH3F *h3_ds0; 
#endif
#ifdef MC
  TH2F *h2_ds0_mc; 
  TH1D *h1_ds0_mc_total,*h1_ds0_mc;
#endif
#else
  TH2F *h2_ds0, *h2_ds1, *h2_ds2, *h2_ds3, *h2_ds4; 
  TH1D *h1_ds0, *h1_ds1, *h1_ds2, *h1_ds3, *h1_ds4;
  TH1D *h1_ds0_total, *h1_ds1_total, *h1_ds2_total, *h1_ds3_total, *h1_ds4_total;
#endif  

  cout << "retrieving "<<histo_string <<endl;

#ifdef H2D
  h3_ds0 = (TH3F*)file_electronStream0 ->Get(histo_string); 
#else  

#ifdef ALL
  h2_ds0 = (TH2F*)file_electronStream0 ->Get(histo_string); 
#else   
  h2_ds0 = (TH2F*)file_electronStream0 ->Get(histo_string); 
  h2_ds1 = (TH2F*)file_electronStream1 ->Get(histo_string); 
  h2_ds2 = (TH2F*)file_electronStream2 ->Get(histo_string); 
  h2_ds3 = (TH2F*)file_electronStream3 ->Get(histo_string); 
  //h2_ds4 = (TH2F*)file_electronStream4 ->Get(histo_string); 
#endif
#endif  

#endif

#ifdef MC
  h2_ds0_mc = (TH2F*)file_electronStream_mc ->Get(histo_string); 
#endif
  
#ifdef ELECTRON
  binmin = 14;//after EEcut
#endif
  
#ifdef MUON
  binmin = 16;//after MUMUcut
#endif
  binmax = binmin;

#ifdef BOOTSTRAP
  binmin +=4;
  binmax +=4;
#endif
    
  cout << "total bin "<<binmin<<endl; 

#ifdef H2D
  h3_ds0 = (TH3F*)file_electronStream0 ->Get(histo_string);

  int nbinsy = h3_ds0->GetYaxis()->GetNbins(); 
  int nbinsz = h3_ds0->GetZaxis()->GetNbins(); 

  TH2F* h2_ds0_total  = new TH2F("h2_ds0_total","h2_ds0_total",  
      h3_ds0->GetZaxis()->GetNbins(), h3_ds0->GetZaxis()->GetXmin(), h3_ds0->GetZaxis()->GetXmax(), 
      h3_ds0->GetYaxis()->GetNbins(), h3_ds0->GetYaxis()->GetXmin(), h3_ds0->GetYaxis()->GetXmax());
  
  TH2F* h2_ds0  = new TH2F("h2_ds0","h2_ds0",  
      h3_ds0->GetZaxis()->GetNbins(), h3_ds0->GetZaxis()->GetXmin(), h3_ds0->GetZaxis()->GetXmax(), 
      h3_ds0->GetYaxis()->GetNbins(), h3_ds0->GetYaxis()->GetXmin(), h3_ds0->GetYaxis()->GetXmax());
  cout << " "<<h3_ds0->GetZaxis()->GetNbins() << " "<< h3_ds0->GetZaxis()->GetXmin()<<  " "<< h3_ds0->GetZaxis()->GetXmax()<<  " "<< 
      h3_ds0->GetYaxis()->GetNbins()<<  " "<< h3_ds0->GetYaxis()->GetXmin() << " "<< h3_ds0->GetYaxis()->GetXmax()<<endl;

  for (int i = 0; i <= nbinsy; i++){
    for (int j = 0; j <= nbinsz; j++){
      double bin_total = h3_ds0->GetBinContent(binmin,i,j);
      double bin_pass = h3_ds0->GetBinContent(binmin+1,i,j);
      h2_ds0_total->SetBinContent(j,i,bin_total);
      h2_ds0->SetBinContent(j,i,bin_pass);
      //if (bin_pass>bin_total)
      //if (bin_total>0) cout << "pass "<<bin_pass<<" total "<<bin_total<< " (x,y) "<<i<<","<<j<<endl;
    }
  }
  
#else  

#ifdef ALL

  h1_ds0_total = h2_ds0->ProjectionY("h1_ds0_total", binmin, binmax, "e");
  #ifdef MC
  h1_ds0_mc_total = h2_ds0_mc->ProjectionY("h1_ds0_mc_total", binmin, binmax, "e"); 
  #endif

  
#else   

  h1_ds0_total = h2_ds0->ProjectionY("h1_ds0_total", binmin, binmax, "e");
  h1_ds1_total = h2_ds1->ProjectionY("h1_ds1_total", binmin, binmax, "e");
  h1_ds2_total = h2_ds2->ProjectionY("h1_ds2_total", binmin, binmax, "e");
  h1_ds3_total = h2_ds3->ProjectionY("h1_ds3_total", binmin, binmax, "e");
//  h1_ds4_total = h2_ds4->ProjectionY("h1_ds4_total", binmin, binmax, "e");

#endif //All 

#endif  //H2D

  binmin +=1;
  binmax = binmin;
  
  cout << "passed bin "<<binmin<<endl; 

#ifdef H2D

#else  
    
#ifdef ALL
  Double_t err=0.;

  h1_ds0   = h2_ds0->ProjectionY("h1_ds0", binmin, binmax, "e");

  h1_ds0->Sumw2();
  h1_ds0_total->Sumw2();

  cout <<endl<< "Entries trigger 0                : " << (h1_ds0_total->IntegralAndError(0, (h1_ds0_total->GetNbinsX()+1), err)) <<" +/- " <<err<< endl; 
  cout << "after Tag & Probe                : " << (h1_ds0->IntegralAndError(0, (h1_ds0->GetNbinsX()+1), err)) <<" +/- " <<err<< endl; 

  #ifdef MC
  h1_ds0_mc = h2_ds0_mc->ProjectionY("h1_ds0_mc", binmin, binmax, "e"); 
  h1_ds0_mc->Sumw2();
  h1_ds0_mc_total->Sumw2();
  h1_ds0_mc->SetLineColor(kRed);
  h1_ds0_mc->SetMarkerColor(kRed);

  cout <<endl<< "Entries trigger 0                : " << (h1_ds0_mc_total->IntegralAndError(0, (h1_ds0_mc_total->GetNbinsX()+1), err)) <<" +/- " <<err<< endl; 
  cout << "after Tag & Probe                : " << (h1_ds0_mc->IntegralAndError(0, (h1_ds0->GetNbinsX()+1), err)) <<" +/- " <<err<< endl; 
  #endif

#else   

  h1_ds0 = h2_ds0->ProjectionY("h1_ds0", binmin, binmax, "e");
  h1_ds1 = h2_ds1->ProjectionY("h1_ds1", binmin, binmax, "e");
  h1_ds2 = h2_ds2->ProjectionY("h1_ds2", binmin, binmax, "e");
  h1_ds3 = h2_ds3->ProjectionY("h1_ds3", binmin, binmax, "e");
//  h1_ds4 = h2_ds4->ProjectionY("h1_ds4", binmin, binmax, "e");


  h1_ds1->SetLineColor(kRed);
  h1_ds1->SetMarkerColor(kRed);
  h1_ds2->SetLineColor(kBlue);
  h1_ds2->SetMarkerColor(kBlue);
  h1_ds3->SetLineColor(kGreen);
  h1_ds3->SetMarkerColor(kGreen);
//  h1_ds4->SetLineColor(kGreen);
//  h1_ds4->SetMarkerColor(kGreen);

  
  h1_ds0->Sumw2();
  h1_ds1->Sumw2();
  h1_ds2->Sumw2();
  h1_ds3->Sumw2();
//  h1_ds4->Sumw2();

  h1_ds0_total ->Sumw2();
  h1_ds1_total->Sumw2();
  h1_ds2_total->Sumw2();
  h1_ds3_total->Sumw2();
//  h1_ds4_total->Sumw2();
    
  Double_t err=0.;
  cout <<endl<< "Entries trigger 0                : " << (h1_ds0_total->IntegralAndError(0, (h1_ds0_total->GetNbinsX()+1), err)) <<" +/- " <<err<< endl; 
  cout << "after Tag & Probe / BS           : " << (h1_ds0->IntegralAndError(0, (h1_ds0->GetNbinsX()+1), err)) <<" +/- " <<err<< endl; 
  cout <<endl<< "Entries trigger 1                : " << (h1_ds1_total->IntegralAndError(0, (h1_ds1_total->GetNbinsX()+1), err)) <<" +/- " <<err<< endl; 
  cout << "after Tag & Probe / BS           : " << (h1_ds1->IntegralAndError(0, (h1_ds1->GetNbinsX()+1), err)) <<" +/- " <<err<< endl; 
  cout <<endl<< "Entries trigger 2                : " << (h1_ds2_total->IntegralAndError(0, (h1_ds2_total->GetNbinsX()+1), err)) <<" +/- " <<err<< endl; 
  cout << "after Tag & Probe / BS           : " << (h1_ds2->IntegralAndError(0, (h1_ds2->GetNbinsX()+1), err)) <<" +/- " <<err<< endl; 
  cout <<endl<< "Entries trigger 3                : " << (h1_ds3_total->IntegralAndError(0, (h1_ds3_total->GetNbinsX()+1), err)) <<" +/- " <<err<< endl; 
  cout << "after Tag & Probe / BS           : " << (h1_ds3->IntegralAndError(0, (h1_ds3->GetNbinsX()+1), err)) <<" +/- " <<err<< endl; 
//  cout <<endl<< "Entries trigger 4                : " << (h1_ds4_total->IntegralAndError(0, (h1_ds4_total->GetNbinsX()+1), err)) <<" +/- " <<err<< endl; 
//  cout << "after Tag & Probe / BS           : " << (h1_ds4->IntegralAndError(0, (h1_ds4->GetNbinsX()+1), err)) <<" +/- " <<err<< endl; 
#endif //ALL

#endif //H2D

// Using Tefficiency

#ifdef H2D
  //h_trg_2d_yz->Draw();
  //h_trg_2d_yz_pass->Draw();
  const TH2& pass  = *h2_ds0;
  const TH2& total = *h2_ds0_total;

  TEfficiency* pEff0 = 0;

  TCanvas *c2 = new TCanvas("canvas2","canvas2", 200,10,900,800);  // 1D histo
  
  c2->cd();

  if(TEfficiency::CheckConsistency(pass,total)){
    pEff0 = new TEfficiency(pass,total);

#ifdef ETAPHI
//   pass.GetXaxis()->SetRangeUser(10.,100.);  //inv mass
    pass.GetYaxis()->SetRangeUser(-2.4,2.4);  //inv mass
    pass.GetXaxis()->SetTitle("Phi");  //inv mass
    pass.GetYaxis()->SetTitle("Eta");  //inv mass
#endif
#ifdef PTETA
    pass.GetYaxis()->SetRangeUser(10.,100.);  //inv mass
    pass.GetXaxis()->SetRangeUser(-2.4,2.4);  //inv mass
    pass.GetYaxis()->SetTitle("Pt [GeV]");  //inv mass
    pass.GetXaxis()->SetTitle("Eta");  //inv mass
#endif
    pass.Draw("AXIS");
    pEff0->Draw("COLZ same");
   //pass.Draw();
  }
  //h3_ds0->Draw();
  //h2_ds0_total->Draw();
#else

#ifdef ALL
  TEfficiency* pEff0 = 0;
  
  #ifdef MC
  TEfficiency* pEff0_mc = 0;
  const TH1& pass_mc  = *h1_ds0_mc;
  const TH1& total_mc = *h1_ds0_mc_total;
  if(TEfficiency::CheckConsistency(pass_mc,total_mc)){
   pEff0_mc = new TEfficiency(pass_mc,total_mc);
   pEff0_mc->SetLineColor(kRed);
   pEff0_mc->SetMarkerColor(kRed);
   pEff0_mc->SetMarkerSize(1);
  }
  #endif

  const TH1& pass     = *h1_ds0;
  const TH1& total    = *h1_ds0_total;
  
  if(TEfficiency::CheckConsistency(pass,total)){
   pEff0 = new TEfficiency(pass,total);
   //pEff0->SetStatisticOption(TEfficiency::kFCP);
 }


#else  //all 

  TEfficiency* pEff0 = 0;
  TEfficiency* pEff1 = 0;
  TEfficiency* pEff2 = 0;
  TEfficiency* pEff3 = 0;
//  TEfficiency* pEff4 = 0;
  
  //h_pass and h_total are valid and consistent histograms
  const TH1& pass0  = *h1_ds0;
  const TH1& pass1  = *h1_ds1;
  const TH1& pass2  = *h1_ds2;
  const TH1& pass3  = *h1_ds3;
//  const TH1& pass4  = *h1_ds4;
  
  const TH1& total0 = *h1_ds0_total;
  const TH1& total1 = *h1_ds1_total;
  const TH1& total2 = *h1_ds2_total;
  const TH1& total3 = *h1_ds3_total;
//  const TH1& total4 = *h1_ds4_total;
  
  if(TEfficiency::CheckConsistency(pass0,total0)){
   pEff0 = new TEfficiency(pass0,total0);
   //pEff0->SetStatisticOption(TEfficiency::kFCP);
 }

  if(TEfficiency::CheckConsistency(pass1,total1)){
   pEff1 = new TEfficiency(pass1,total1);
   pEff1->SetLineColor(kRed);
   pEff1->SetMarkerColor(kRed);
   pEff1->SetMarkerSize(1);
 }

  if(TEfficiency::CheckConsistency(pass2,total2)){
   pEff2 = new TEfficiency(pass2,total2);
   pEff2->SetLineColor(kBlue);
   pEff2->SetMarkerColor(kBlue);
   pEff2->SetMarkerSize(1);
 }

  if(TEfficiency::CheckConsistency(pass3,total3)){
   pEff3 = new TEfficiency(pass3,total3);
   pEff3->SetLineColor(kGreen);
   pEff3->SetMarkerColor(kGreen);
   pEff3->SetMarkerSize(1);
 }

//  if(TEfficiency::CheckConsistency(pass4,total4)){
//   pEff4 = new TEfficiency(pass4,total4);
//   pEff4->SetLineColor(kGreen);
//   pEff4->SetMarkerColor(kGreen);
//   pEff4->SetMarkerSize(1);
// }

#endif  //ALL 

#endif  //H2D

//Efficiency
#ifdef PT

#ifdef ELECTRON
int binPlateau = 12;  // bin 0: 0-1 GeV; bin 1: 1-2 GeV; ...;
#endif
#ifdef MUON
int binPlateau = 8;  // bin 0: 0-5 GeV; bin 1: 5-10 GeV; bin 2: 10-15 GeV; bin 3: 15-20 GeV; bin 4: 20-25 GeV; bin 5: 25-30 GeV;
#endif

//#ifdef ALL
//#else
int nTotal0 = h1_ds0_total->IntegralAndError(binPlateau, (h1_ds0_total->GetNbinsX()+1), err);
int nds0 = h1_ds0->IntegralAndError(binPlateau, (h1_ds0->GetNbinsX()+1), err);

  cout <<  endl; 
  cout << "Plateau bin "<< binPlateau  <<" : "<< nTotal0 << endl; 
  cout << " trigger0   : "<< nds0 << " efficiency "<< 1.*nds0/nTotal0<<endl; 

  cout <<  endl;
  binPlateau+=3; 

  nTotal0 = h1_ds0_total->IntegralAndError(binPlateau, (h1_ds0_total->GetNbinsX()+1), err);
  nds0 = h1_ds0->IntegralAndError(binPlateau, (h1_ds0->GetNbinsX()+1), err);

  cout << "Plateau bin "<< binPlateau  <<" : "<< nTotal0 << endl; 
  cout << " trigger0   : "<< nds0 << " efficiency "<< 1.*nds0/nTotal0<<endl; 
//#endif

#endif
/*
  TCanvas *c1 = new TCanvas("canvas1","canvas1", 200,10,1000,800);  // 1D histo
  c1->cd();
//  h1_ds0->Rebin(2);
//  h1_ds0_total->Rebin(2);
  h1_ds0->Draw();
  h1_ds0_total->Draw("same");

*/

#ifdef H2D
#else

  h1_ds0->SetMaximum(1.1);
  h1_ds0->SetMinimum(0.);
#ifdef PT
  h1_ds0->GetXaxis()->SetRangeUser(10.,100.);  //inv mass
#ifdef MUON
  h1_ds0->GetXaxis()->SetRangeUser(0.,100.);  //inv mass
#endif
  h1_ds0->GetXaxis()->SetTitle("Pt [GeV]");  //inv mass
#ifdef ZOOM
  h1_ds0->GetXaxis()->SetRangeUser(10.,50.);  //inv mass
  h1_ds0->GetXaxis()->SetTitle("Pt [GeV]");  //inv mass
  h1_ds0->SetMaximum(1.);
  h1_ds0->SetMinimum(0.8);  
#ifdef MUON
  h1_ds0->GetXaxis()->SetRangeUser(0.5,50.);  //inv mass
  h1_ds0->SetMinimum(0.);  
#endif
#endif  
#endif
#ifdef ETA
  h1_ds0->GetXaxis()->SetRangeUser(-2.5,2.5);  //inv mass
  h1_ds0->GetXaxis()->SetTitle("Eta");  //inv mass
#ifdef BARREL
  h1_ds0->GetXaxis()->SetRangeUser(-1.05,1.05);  //inv mass
#endif
#endif
#ifdef PHI
  h1_ds0->GetXaxis()->SetRangeUser(-3.14,3.14);  //inv mass
  h1_ds0->GetXaxis()->SetTitle("Phi");  //inv mass
#endif


  TLegend *legend = new TLegend(0.50,0.25,0.90,0.54);
  legend->SetBorderSize(0);
  legend->SetTextFont(42);
  legend->SetTextSize(0.04);
  legend->SetFillColor(0);
  legend->SetLineColor(0);
  

#ifdef ALL
  #ifdef MUON
  legend->SetHeader("EF_mu6"); 
  #else
  legend->SetHeader("EF_e10_medium"); 
  #endif
  #ifdef TAGPROBE
  legend->AddEntry(h1_ds0,   "Tag&Probe - data","flp");// 
  #ifdef MC
  legend->AddEntry(h1_ds0_mc,   "Tag&Probe - MC Z","flp");// 
  #endif
  #endif
  #ifdef BOOTSTRAP
  legend->AddEntry(h1_ds0,"Bootstrap - data","flp");// 
  #ifdef MC
  legend->AddEntry(h1_ds0_mc,   "Bootstrap - ttbar","flp");// 
   pEff0_mc->SetLineColor(kBlack);
   pEff0_mc->SetMarkerColor(kBlack);
  #endif
  #endif
#else

  #ifdef MUON
    #ifdef TAGPROBE
      legend->SetHeader("EF_mu6 - Tag&Probe"); 
    #else
      legend->SetHeader("EF_mu6 - Bootstrap");
    #endif   
  #else
    #ifdef TAGPROBE
      legend->SetHeader("EF_e10_medium - Tag&Probe"); 
    #else
      legend->SetHeader("EF_e10_medium - Bootstrap");
    #endif 
  #endif       
#endif


#ifdef PERIOD1
#ifdef ELECTRON
  legend->AddEntry(h1_ds0," period D-F","flp");// 
  legend->AddEntry(h1_ds1," period G","flp");// 
  legend->AddEntry(h1_ds2," period H","flp");// 
  legend->AddEntry(h1_ds3," period I","flp");// 
#endif
#ifdef MUON
  legend->AddEntry(h1_ds0," period G","flp");// 
  legend->AddEntry(h1_ds1," period H","flp");// 
  legend->AddEntry(h1_ds2," period I","flp");// 
#endif
#endif

#ifdef PERIOD2
  legend->AddEntry(h1_ds0," period J","flp");// 
  legend->AddEntry(h1_ds1," period K","flp");// 
  legend->AddEntry(h1_ds2," period L","flp");// 
  legend->AddEntry(h1_ds3," period M","flp");// 
#endif


//  legend->Draw();

  TCanvas *c2 = new TCanvas("canvas2","canvas2", 200,10,1000,800);  // 1D histo
  
  c2->cd();
  
//  pEff2->SetStatisticOption(TEfficiency::kFCP);  //DEFAULT
//  pEff2->SetStatisticOption(TEfficiency::kFNormal);
 // pEff2->SetStatisticOption(TEfficiency::kFWilson);
//  pEff2->SetStatisticOption(TEfficiency::kFAC);
//  pEff2->SetStatisticOption(TEfficiency::kFFC);
//  pEff2->SetStatisticOption(TEfficiency::kBJeffrey);
//  pEff2->SetStatisticOption(TEfficiency::kBUniform);
//  pEff2->SetStatisticOption(TEfficiency::kBBayesian);
  h1_ds0->GetYaxis()->SetTitle("Efficiency");  //inv mass
  h1_ds0->Draw("AXIS"); // I need this to be able to zoom the graph
  pEff0->Draw("P same");
#ifdef ALL
  #ifdef MC
  pEff0_mc->Draw("P same");
  #endif
#else
  pEff1->Draw("P same");
  pEff2->Draw("P same");
#ifdef PERIOD2
  pEff3->Draw("P same");
#endif
#ifdef PERIOD1
#ifdef ELECTRON
  pEff3->Draw("P same");
#endif
#endif
//  pEff4->Draw("P same");
#endif
  legend->Draw();

#endif
  c2->Print("plots/"+filename+".eps"); 
    
}
Ejemplo n.º 16
0
// *************************************** //
// this is a function that takes a set of  //
// histograms and draws them on a canvas   //
// in a stack, returning the canvas.       //
// It also plots the signal as a dashed    //
// line and the data with a ratio at the   //
// the bottom of data/allBackgrounds       //
// *************************************** //
TCanvas* drawPlots::plotAll(std::vector<TH1D*> histos, std::vector<std::string> names, std::string axisName, TH1D* signal, TH1D* data, TH1D* errDown, TH1D* errUp, bool isSignalRegion, bool doLogAxis){
         
   const unsigned int MAINPLOT_WIDTH  = 800;
   const unsigned int MAINPLOT_HEIGHT = 500;
   const unsigned int RATIOPLOT_HEIGHT = 125;
   const unsigned int OFFSET = 10;
   
  //LUKE: Title offset and title size are proportional in 
  //root, so you have to change them together, 
  //this makes me a sad panda 
   const double RATIOPLOT_YAXIS_TITLE_OFFSET = 0.4;
   const double RATIOPLOT_YAXIS_TITLE_SIZE   = 0.14;
   const double RATIOPLOT_YAXIS_TICK_LENGTH  = 0.01;
   const double RATIOPLOT_YAXIS_LABEL_SIZE   = 0.15;
  
   const double RATIOPLOT_XAXIS_TITLE_OFFSET = 0.9;
   const double RATIOPLOT_XAXIS_TITLE_SIZE   = 0.2;
   const double RATIOPLOT_XAXIS_TICK_LENGTH  = 0.05;
   const double RATIOPLOT_XAXIS_LABEL_SIZE   = 0.2;
   
   const double CANVAS_HEIGHT = MAINPLOT_HEIGHT+RATIOPLOT_HEIGHT+OFFSET;
   
   TCanvas* canvas = new TCanvas("canvas","canvas",0,0,MAINPLOT_WIDTH,CANVAS_HEIGHT);
   
   canvas->SetMargin(0.,0.,0.,0.);
   canvas->Clear();
   canvas->cd();
   
   // create main pad
   const double mainPad_ylow  = (CANVAS_HEIGHT - MAINPLOT_HEIGHT)/CANVAS_HEIGHT;
   const double mainPad_yhigh = 1.;
  
   const double pad_margin_left = 0.15;
   const double pad_margin_right  = 0.05;
   
   double main_y_max = -99;
   double main_y_min = -99;
   double main_x_max = -99;
   double main_x_min = -99;
   for(int a=0; a<histos.size(); a++){
     if(histos[a]){
       if(histos[a]->GetEntries()> 0.){
	 GetAxisLimits(histos[a], main_x_min, main_x_max, main_y_min, main_y_max);
       }
     }
   }
   
   if(data){
     int maxBinData = data->GetMaximumBin();
     double dataYmax = data->GetBinContent(maxBinData);
     if(dataYmax > main_y_max) main_y_max = dataYmax;
   }

   // create main pad
   TPad* mainPad = new TPad("main","main",0.,mainPad_ylow,1.,mainPad_yhigh);
   mainPad->SetMargin(pad_margin_left,pad_margin_right,0.,.05); // left, right, bottom, top
   mainPad->Draw();
   mainPad->cd();

   SetAtlasStyle();

   if(doLogAxis)mainPad->SetLogy();

   // clone signal or data because one should exist for each plot
   TH1D* allBackgrounds;
   bool gotSomething=false;
   if(signal)
     allBackgrounds = (TH1D*)signal->Clone("all_backgrounds");
   else if(data)
     allBackgrounds = (TH1D*)data->Clone("all_backgrounds");
   else{
     for(int b=0; b<histos.size(); b++){
       if(histos[b] && !gotSomething){
	 allBackgrounds = (TH1D*)histos[b]->Clone("all_backgrounds");
	 gotSomething=true;
       }
     }  
   }

   // set all bins to zero so that you can add all histograms to it
   for(int i=0; i<=allBackgrounds->GetNbinsX()+1; i++)
      allBackgrounds->SetBinContent(i,0);
   
   THStack* Stack = new THStack();
   std::string title = std::string(";") + axisName + ";Events";
   Stack->SetTitle(title.c_str());
   
   for(int b=0; b<histos.size(); b++){
     if(histos[b]){
       if(histos[b]->GetEntries() > 0.){
	 histos[b]->SetLineColor(1);
	 histos[b]->SetFillColor(tools::setColor(names[b]));
	 Stack->Add(histos[b]);
	 for(int j=0; j<=allBackgrounds->GetNbinsX()+1; j++){
	   double binContent=allBackgrounds->GetBinContent(j)+histos[b]->GetBinContent(j);
	   allBackgrounds->SetBinContent(j,binContent);
	 }
       }
     }
   }

   TH1D* backgroundsForRatio = (TH1D*)allBackgrounds->Clone("bkgds_for_ratio");
   
   if(doLogAxis){ 
     main_y_max = main_y_max*10;
     if(Stack->GetMinimum()>.1) Stack->SetMinimum(.1);
   }
   else main_y_max = main_y_max*1.4;
   Stack->SetMaximum(main_y_max);
   Stack->Draw("hist");
   errDown->Draw("E2same");
   errUp->Draw("E2Same");
   
   // make error histograms for the ratio plot
   TH1D* ratioErrDown = (TH1D*) errDown->Clone("ratio_error_down");
   TH1D* ratioErrUp = (TH1D*) errUp->Clone("ratio_error_up");

   ratioErrDown->Divide(backgroundsForRatio);
   ratioErrUp->Divide(backgroundsForRatio);

   if(!isSignalRegion && data)
      data->Draw("e same");

   if(signal){
     signal->SetLineStyle(2);
     signal->SetLineColor(kRed);
     signal->SetLineWidth(5);
     signal->Draw("hist same");
   }

   TLegend* leg = new TLegend(0.8,0.65,0.95,0.9);
   leg->SetFillStyle(0);
   leg->SetBorderSize(0);
   
   if(signal)
     leg->AddEntry(signal, "Signal", "l");
   if(!isSignalRegion)
     leg->AddEntry(data, "Data");
   for(int q=0; q<histos.size(); q++){
     if(histos[q]){
       if(histos[q]->GetEntries() > 0.)
	 leg->AddEntry(histos[q], names[q].c_str(), "f");
     }
   }
   leg->Draw("lpe");
   
   ATLAS_LABEL(0.2,0.85,1);
   char text[]="#sqrt{s}=8 TeV";
   myText(0.6,0.75,1,.04, text);
   char text_L[]="#int L dt = 20.3 fb^{-1}";
   myText(0.6, 0.85,1, .04, text_L);
   char inText[100];
   int t;
   if(signal)
     t=sprintf(inText, "N_{Signal} = %.1f", signal->Integral(0,signal->GetNbinsX()+1));
   else
     t=sprintf(inText, "N_{Signal} = %.1f", 0.);
   myText(0.2, 0.75, 1, .04, inText);
   double back_int = allBackgrounds->Integral(0,allBackgrounds->GetNbinsX()+1);
   if(back_int > 10000.)
     t=sprintf(inText, "N_{Bkgd} = %.3e", back_int);
   else
     t=sprintf(inText, "N_{Bkgd} = %.1f", back_int);
   myText(0.2, 0.7, 1, .04, inText);
   if(!isSignalRegion){
     if(data)
       t=sprintf(inText, "N_{Data} = %.0f", data->Integral(0,data->GetNbinsX()+1));
     else
       t=sprintf(inText, "N_{Data} = %.0f", 0.);
     myText(0.2, 0.65, 1, .04, inText);
   }
   
   canvas->cd();
   
   // Draw Ratio plot
   double ratio_max = 1.6;
   double ratio_min = 0.4;
  
   const double x_axis_size = 0.4;
   const double ratio_pad_height = RATIOPLOT_HEIGHT/CANVAS_HEIGHT;
   
   double pad_xlow = 0.,pad_xhigh = 1.;
   double pad_ylow = OFFSET/CANVAS_HEIGHT,pad_yhigh = ratio_pad_height;
   
   const char* pad_name = "pad";
   TPad* pad4ratio = new TPad(pad_name,pad_name,pad_xlow,pad_ylow,pad_xhigh,pad_yhigh);
   
   pad4ratio->SetMargin(pad_margin_left,pad_margin_right,x_axis_size,0.);
   pad4ratio->Draw();
   pad4ratio->cd();

   TH1D* ratioPlot;
   if(data) ratioPlot = (TH1D*)data->Clone("ratio");
   else if(signal) ratioPlot = (TH1D*)signal->Clone("ratio"); // if there is no data then use signal for axis 
   ratioPlot->SetTitle("");
   ratioPlot->GetYaxis()->SetTitle("Data/MC");
   ratioPlot->GetXaxis()->SetTitle(axisName.c_str());
   if(data){
     ratioPlot->Divide(allBackgrounds);
     // here change ratio_min and ratio_max if the ratio plot is quite flat
     double maxDeviation=0;
     double tempDev=0;
     for(int ibin=1; ibin<=allBackgrounds->GetNbinsX(); ibin++){
       tempDev = std::abs(ratioPlot->GetBinContent(ibin)-1.);
       if(tempDev > maxDeviation) maxDeviation = tempDev;
     }
     if(maxDeviation < 0.1){
       ratio_max = 1.12;
       ratio_min = 0.88;
     }
     else if(maxDeviation < 0.2){
       ratio_max = 1.25;
       ratio_min = .75;
     }
     ratioPlot->SetMinimum(ratio_min);
     ratioPlot->SetMaximum(ratio_max);
   }
   ratioPlot->GetXaxis()->SetLabelSize(RATIOPLOT_XAXIS_LABEL_SIZE);
   ratioPlot->GetXaxis()->SetTickLength(RATIOPLOT_XAXIS_TICK_LENGTH);
   ratioPlot->GetYaxis()->SetLabelSize(RATIOPLOT_YAXIS_LABEL_SIZE);
   ratioPlot->GetYaxis()->SetTickLength(RATIOPLOT_YAXIS_TICK_LENGTH);
   ratioPlot->GetYaxis()->SetNdivisions(3);
   ratioPlot->GetYaxis()->SetTitleSize(RATIOPLOT_YAXIS_TITLE_SIZE);
   ratioPlot->GetYaxis()->SetTitleOffset(RATIOPLOT_YAXIS_TITLE_OFFSET);
   ratioPlot->GetXaxis()->SetTitleSize(RATIOPLOT_XAXIS_TITLE_SIZE);
   ratioPlot->GetXaxis()->SetTitleOffset(RATIOPLOT_XAXIS_TITLE_OFFSET);
   
   if(!isSignalRegion && data){
     ratioPlot->Draw();
     // plot horizontal line at y=1
     TF1* horizontal = new TF1("horizontal","pol1",-10000,10000);
     horizontal->SetParameter(0,1.);
     horizontal->SetParameter(1,0.);
     horizontal->SetLineColor(kBlack);
     horizontal->SetLineStyle(2);
     horizontal->SetLineWidth(1);
     horizontal->Draw("same");
     ratioErrDown->Draw("E2same");
     ratioErrUp->Draw("E2same");
   }else if(isSignalRegion){
     ratioPlot->Draw("axis");
     char text[]="DATA IS BLINDED HERE";
     myText(0.4,0.6,1,.2,text);
   }else{ // in this case it is not the signal region but there is no data
     ratioPlot->Draw("axis");
     char text[]="NO DATA";
     myText(0.4,0.6,1,.2,text);
     }
   
   return canvas;
}
Ejemplo n.º 17
0
/******************************************
 *   Main code starts here
 */
int main(int argc, char** argv) {
  bool drawCalibCurves=true;
  TString JESfile="Rel17_JES_OffsetSubtracted.config";
  gErrorIgnoreLevel=2000;

  if (argc>1) JESfile=argv[1];
  _jesFile=JESfile;

  SetAtlasStyle();

  tex=new TLatex(); tex->SetNDC(); tex->SetTextSize(0.04);
  Can = new TCanvas("Can","",800,600);

  ps="JES_Plots/"+Str(gSystem->BaseName(JESfile));
  ps.ReplaceAll(".config",".ps");
  Can->Print(ps+"[");

  StrV jetAlgos;
  if (_jesFile.Contains("FatJet")) {
    add(jetAlgos,
	"AntiKt10LCTopo",
	"AntiKt10LCTopoTrimmedPtFrac3SmallR30",
	"AntiKt10LCTopoTrimmedPtFrac5SmallR30",
	"CamKt12LCTopo",
	"CamKt12LCTopoTrimmedPtFrac5SmallR30",
	"CamKt12LCTopoSplitFilteredmassFraction67minSplitR30");
  } else if (_jesFile.Contains("2012_AFII")) {
    add(jetAlgos,"AntiKt4TopoEM","AntiKt4LCTopo");
  } else if (_jesFile.Contains("2012_FirstCalibration_AFII")) {
    add(jetAlgos,"AntiKt4TopoEM","AntiKt4LCTopo","AntiKt6TopoEM");
  } else {
    add(jetAlgos,"AntiKt4TopoEM","AntiKt4LCTopo","AntiKt6TopoEM","AntiKt6LCTopo");
  }
  
  // 1. Draw JES
  for (int ji=0;ji<jetAlgos.size();++ji) {
    DrawJES_vs_Eta(jetAlgos[ji]); Can->Print(ps);
  }

  // 2. Draw JMS
  if (_jesFile.Contains("FatJet"))
    for (int ji=0;ji<jetAlgos.size();++ji) {
      DrawJMS_vs_Eta(jetAlgos[ji]); Can->Print(ps);
    }
  
  // 3. Draw insitu correction
  for (int ji=0;ji<jetAlgos.size();++ji) {
    DrawInsituCorr_vs_Eta(jetAlgos[ji]); Can->Print(ps);
  }


  Can->Clear();
  Can->SetLogx();
  // 3. Draw insitu correction
  for (int ji=0;ji<jetAlgos.size();++ji) {
    DrawInsituCorr_vs_Pt(jetAlgos[ji]);
    Can->Print(ps);
  }
  Can->SetLogx(0);
  
  JetCalibrationTool *theJES = new JetCalibrationTool("AntiKt4TopoEM",_jesFile,false);
  TH1F *axis = new TH1F("","",51,-0.5,50.5);
  axis->SetXTitle("#it{N}_{PV}^{raw}"); axis->SetYTitle("#it{N}_{PV}^{corr}"); 
  axis->SetMaximum(50); axis->Draw();
  Graph *g = new Graph(), *grat = new Graph();
  for (int i=0;i<51;++i) {
    g->SetPoint(i,i,theJES->GetNPVBeamspotCorrection(i));
    if (i)
      grat->SetPoint(i-1,i,theJES->GetNPVBeamspotCorrection(i)/i);
    printf("NPV = %2d : corr: %.2f, ratio: %.3f\n",
	   i,theJES->GetNPVBeamspotCorrection(i),theJES->GetNPVBeamspotCorrection(i)/i);
  }
  g->SetMarkerStyle(22); g->SetMarkerColor(kBlue); g->Draw("PL");
  Can->Print(ps);
  axis->GetYaxis()->SetRangeUser(0.8,1.1); axis->SetYTitle("#it{N}_{PV}^{corr} / #it{N}_{PV}^{raw}"); 
  axis->Draw();
  grat->SetMarkerStyle(22); grat->SetMarkerColor(kBlue); grat->Draw("PL");
  Can->Print(ps);

  // 4. Draw pile-up offset correction
  for (int j=0;j<jetAlgos.size();++j)
    if (DrawPileupCorr(jetAlgos[j])) Can->Print(ps);

  for (int j=0;j<jetAlgos.size();++j)
    DrawPileupCorrVsMuNPV(jetAlgos[j]);

  /*
  for (int j=0;j<jetAlgos.size();++j)
    if (DrawPileupCorr(jetAlgos[j],true)) Can->Print(ps);

  for (int j=0;j<jetAlgos.size();++j)
    DrawPileupCorrVsMuNPV(jetAlgos[j],false);

  */

  if (drawCalibCurves) {
    Can->SetLogx();
    TH1F *axis = new TH1F("","",1993,7,2000);
    axis->SetXTitle("Constituent scale #it{E} [GeV]"); 
    axis->GetXaxis()->SetMoreLogLabels();
    std::vector<JetCalibrationTool*> tools;
    std::vector<Graph*> jes_vec;
    for (int j=0;j<jetAlgos.size();++j) {
      tools.push_back(new JetCalibrationTool(jetAlgos[j],_jesFile));
      tools[j]->UseGeV();
      jes_vec.push_back(new Graph()); jes_vec[j]->SetLineColor(colors[j]);
      jes_vec[j]->SetLineWidth(2); jes_vec[j]->SetLineStyle(j);
    }
    for (int ai=0;ai<45;++ai) {
      for (int si=0;si<2;++si) {
	double etaMin=0.1*ai, etaMax=etaMin+0.1, eta=etaMin+0.05;
	if (si==0) { etaMin=-etaMax; etaMax=etaMin+0.1; eta*=-1; }
	axis->SetYTitle("JES calibration factor"); 
	axis->GetYaxis()->SetRangeUser(1,3.2);
	axis->GetXaxis()->SetRangeUser(7*cosh(eta),2000);
	axis->Draw();
	for (int j=0;j<jetAlgos.size();++j) {
	  jes_vec[j]->Clear(); double ptmin=7, ptmax=2000/cosh(eta), dpt=(log(ptmax)-log(ptmin))/100;
	  for (int p=0;p<=100;++p) {
	    double E=exp(log(7)+dpt*p)*cosh(eta);
	    jes_vec[j]->SetPoint(p,E,tools[j]->GetJES(E,eta));
	  }
	  jes_vec[j]->Draw("L");
	  tex->SetTextColor(colors[j]);
	  tex->DrawLatex(0.6,0.85-0.05*j,GetJetDesc(jetAlgos[j]));
	}
	tex->SetTextColor(kBlack);
	tex->DrawLatex(0.6,0.9,Form("%.1f < #it{#eta}_{det} < %.1f",etaMin,etaMax));
	tex->DrawLatex(0.18,0.975,myJES->AbsoluteJES_Description());
	TLine *l = new TLine(); l->SetLineStyle(4); l->SetLineWidth(3);
	//l->SetLineWidth(2); l->SetLineColor(kGray+2); 
	l->DrawLine(cosh(eta)*10,1,cosh(eta)*10,2.9);
	l->DrawLine(cosh(eta)*20,1,cosh(eta)*20,2.9);
	tex->SetTextAlign(22); tex->SetNDC(0);
	tex->DrawLatex(cosh(eta)*10,3.0,"#it{p}_{T} = 10");
	tex->DrawLatex(cosh(eta)*20,3.0,"#it{p}_{T} = 20");
	tex->SetTextAlign(11); tex->SetNDC();
	Can->Print(ps);

	// Below: check of the calibration curves
	// 
	continue;

	axis->SetYTitle("d#it{E}^{corr} / d#it{E}^{const}"); 
	axis->GetYaxis()->SetRangeUser(-0.1,2.0);
	axis->Draw();

	for (int j=0;j<jetAlgos.size();++j) {
	  jes_vec[j]->Clear(); double ptmin=7, ptmax=2000/cosh(eta), dpt=(log(ptmax)-log(ptmin))/100;
	  for (int p=0;p<=100;++p) {
	    double E1=exp(log(7)+dpt*p)*cosh(eta), E2=exp(log(7)+dpt*(p+1))*cosh(eta);
	    jes_vec[j]->SetPoint(p,E1,(tools[j]->GetJES(E2,eta)*E2 - tools[j]->GetJES(E1,eta)*E1)/(E2-E1));
	  }
	  jes_vec[j]->Draw("L");
	  tex->SetTextColor(colors[j]);
	  tex->DrawLatex(0.6,0.85-0.05*j,GetJetDesc(jetAlgos[j]));
	}

	tex->SetTextColor(kBlack);
	tex->DrawLatex(0.6,0.9,Form("%.1f < #it{#eta}_{det} < %.1f",etaMin,etaMax));
	tex->DrawLatex(0.18,0.975,myJES->AbsoluteJES_Description());

	l->DrawLine(cosh(eta)*10,0,cosh(eta)*10,1);
	l->DrawLine(cosh(eta)*15,0,cosh(eta)*15,1);
	l->DrawLine(cosh(eta)*20,0,cosh(eta)*20,1);
	tex->SetTextAlign(22); tex->SetNDC(0);
	tex->DrawLatex(cosh(eta)*10,1.1,"#it{p}_{T} = 10");
	tex->DrawLatex(cosh(eta)*20,1.1,"#it{p}_{T} = 20");
	tex->SetTextAlign(11); tex->SetNDC();

	Can->Print(ps);
      }
    } // for each abs eta bin
  }
  
  Can->Print(ps+"]");
  // Convert to pdf - kinda stupid, but my Mac
  // prefers making ps then convert to pdf
  // instead of making a pdf directly
  TString pdf=TString(ps).ReplaceAll(".ps",".pdf");
  gSystem->Exec("ps2pdf "+ps+" "+pdf);
  gSystem->Exec("rm -f "+ps);
  printf("\n  Plots saved in:\n    %s\n\n",pdf.Data());
}
Ejemplo n.º 18
0
// *************************************** //
// this is a function that takes a set of  //
// histograms and draws them on a canvas   //
// in a stack, returning the canvas.       //
// It also plots the signal as a dashed    //
// line and the data with a ratio at the   //
// the bottom of data/allBackgrounds       //
//                                         //
// This one is supposed to match the plots //
// make by JP                              //
// *************************************** //
TCanvas* drawPlots::plotAll_VLQ(std::vector<TH1D*> histos, std::vector<std::string> names, std::string axisName, std::vector<TH1D*> signal, TH1D* data, TGraphAsymmErrors* err, bool isSignalRegion, bool doLogAxis, std::string channel){

   const unsigned int CANVAS_WIDTH  = 720;
   const unsigned int CANVAS_HEIGHT = 750;
   const double RATIOPLOT_YAXIS_TITLE_OFFSET = 0.75;
   const double RATIOPLOT_YAXIS_TITLE_SIZE   = 0.11;
   const double RATIOPLOT_YAXIS_LABEL_SIZE   = 0.09;  
   const double RATIOPLOT_XAXIS_TITLE_OFFSET = 1.6;
   const double RATIOPLOT_XAXIS_TITLE_SIZE   = 0.11;
   const double RATIOPLOT_XAXIS_LABEL_SIZE   = 0.09;
   
   TCanvas* canvas = new TCanvas("canvas","canvas",0,0,CANVAS_WIDTH,CANVAS_HEIGHT);
   
   canvas->SetMargin(0.,0.,0.,0.);
   canvas->Clear();
   canvas->cd();
   
   SetAtlasStyle();
   gStyle->SetHistLineWidth(1.);
   
   // create histogram to store all backgrounds
   TH1D* allBackgrounds;
   bool gotSomething=false;
   for(int c=0; c<signal.size(); c++){
     if(signal[c]){
       allBackgrounds = (TH1D*)signal[c]->Clone("all_backgrounds");
       gotSomething=true;
     }
   }
   if(!gotSomething && data)
     allBackgrounds = (TH1D*)data->Clone("all_backgrounds");
   if(!gotSomething){
     for(int b=0; b<histos.size(); b++){
       if(histos[b] && !gotSomething){
	 allBackgrounds = (TH1D*)histos[b]->Clone("all_backgrounds");
	 gotSomething=true;
       }
     }
   }

   if(!gotSomething){
     std::cout << "Error: could not find any background, data, or signal for this plot" << std::endl;
     return canvas;
   }
   
   // set all bins to zero
   for(int i=0; i<=allBackgrounds->GetNbinsX()+1; i++)
     allBackgrounds->SetBinContent(i,0);
   
   // make stack of backgrounds, fill backgrounds histogram
   THStack* Stack = new THStack();
   for(int b=0; b<histos.size(); b++){
     if(histos[b]){
       if(histos[b]->GetEntries() > 0.){
	 histos[b]->SetLineColor(1);
	 histos[b]->SetFillColor(tools::setColor(names[b]));
	 Stack->Add(histos[b]);
	 for(int j=0; j<=allBackgrounds->GetNbinsX()+1; j++){
	   double binContent=allBackgrounds->GetBinContent(j)+histos[b]->GetBinContent(j);
	   allBackgrounds->SetBinContent(j,binContent);
	 }
       }
     }
   } 
   TH1D* backgroundsForRatio = (TH1D*)allBackgrounds->Clone("bkgds_for_ratio");

   // create main pad
   const double mainPad_ylow  = 0.3;
   const double mainPad_yhigh = 0.95;
   const double mainPad_xlow = 0.;
   const double mainPad_xhigh = 0.95;
   const double pad_margin_left = 0.2;
   const double pad_margin_right  = 0.02;
   double main_y_max = -99;
   double main_y_min = -99;

   TPad* mainPad = new TPad("main","main",mainPad_xlow,mainPad_ylow,mainPad_xhigh,mainPad_yhigh);
   mainPad->SetMargin(pad_margin_left,pad_margin_right,0.,.05); // left, right, bottom, top
   mainPad->Draw();
   mainPad->cd();

   // find max y
   if(allBackgrounds){
     int maxBinBkg = allBackgrounds->GetMaximumBin();
     double bkgYmax = allBackgrounds->GetBinContent(maxBinBkg);
     main_y_max = bkgYmax;
   }
   if(data){
     int maxBinData = data->GetMaximumBin();
     double dataYmax = data->GetBinContent(maxBinData);
     if(dataYmax > main_y_max) main_y_max = dataYmax;
   }
   if(main_y_max < .002) main_y_max = .1;

   if(doLogAxis){
     mainPad->SetLogy();
     main_y_min = 0.007;
     main_y_max*=600;
   }else{
     main_y_min = 0.001;
     main_y_max*=1.6;
   }

   // draw axis
   allBackgrounds->SetMaximum(main_y_max);
   allBackgrounds->SetMinimum(main_y_min);
   std::string title = std::string(";") + axisName + ";events/bin";
   allBackgrounds->SetTitle(title.c_str());   
   allBackgrounds->GetYaxis()->SetTitleOffset(1.4);
   allBackgrounds->GetYaxis()->SetTitleSize(0.06);
   allBackgrounds->GetXaxis()->SetTitleOffset(1.2);
   allBackgrounds->GetYaxis()->SetLabelSize(0.04);
   allBackgrounds->GetXaxis()->SetLabelSize(0.04);
   allBackgrounds->Draw("hist");

   // draw stack with error
   Stack->Draw("hist same");
   if(err){
     err->Draw("E2 same");
   }

   // make error histograms for the ratio plot
   TGraphAsymmErrors* ratioErr = tools::getRatio(err, backgroundsForRatio);

   // draw data
   if(!isSignalRegion && data)
      data->Draw("e same");

   // draw signal
   if(signal[0]){
     signal[0]->SetLineStyle(2);
     signal[0]->SetLineColor(kRed);
     signal[0]->SetLineWidth(5);
     signal[0]->Draw("hist same");
   }
   if(signal.size() > 1){
     if(signal[1]){
       signal[1]->SetLineStyle(2);
       signal[1]->SetLineColor(kOrange+7);
       signal[1]->SetLineWidth(4);
       signal[1]->Draw("hist same");
     }
     if(signal.size() > 2){
       if(signal[2]){
	 signal[2]->SetLineStyle(2);
	 signal[2]->SetLineColor(kPink-6);
	 signal[2]->SetLineWidth(4);
	 signal[2]->Draw("hist same");
       }
     }
   }
   allBackgrounds->Draw("axis same");

   // draw legend
   float leg_height = 0.45;
   float leg_width = 0.2;
   float leg_xoffset = 0.74;
   float leg_yoffset = 0.7;
   
   TLegend* leg = new TLegend(leg_xoffset,leg_yoffset-leg_height/2,leg_xoffset+leg_width,leg_yoffset+leg_height/2);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   leg->SetBorderSize(0);
   leg->SetTextFont(52);
   leg->SetTextSize(0.033);
   
   // currently assuming first signal is Tbq (single T production), second is TTS, third is BBS
   if(signal[0])
     leg->AddEntry(signal[0], "Tbq (650 GeV)", "l");
   if(signal.size()>1){
     if(signal[1])
       leg->AddEntry(signal[1], "TT_{S} (650 GeV)", "l");
     if(signal[2])
       leg->AddEntry(signal[2], "BB_{S} (650 GeV)", "l");
   }
   if(!isSignalRegion)
     leg->AddEntry(data, "data 2012");
   for(int q=0; q<histos.size(); q++){
     if(histos[q]){
       if(histos[q]->GetEntries() > 0.)
	 leg->AddEntry(histos[q], plotLists::GetLegendName(names[q]).c_str(), "f");
     }
   }
   leg->Draw("lpe");
   
   ATLAS_LABEL(0.24,0.86,1);
   myText(0.36, 0.86, 1, .05, "Internal");
   char text[]="#sqrt{s}=8 TeV";
   myText(0.55,0.77,1,.04, text);
   char text_L[]="#int L dt = 20.3 fb^{-1}";
   myText(0.5, 0.84,1, .04, text_L);
   if(channel!=""){
     char chan_txt[channel.size()-1];
     strcpy(chan_txt, (channel.substr(1)).c_str());
     myText(0.5, 0.7, 1, .06, chan_txt);
   }
   char inText[100];
   int t;
   if(signal[0])
     t=sprintf(inText, "N_{Tbq} = %.1f", signal[0]->Integral(0,signal[0]->GetNbinsX()+1));
   else
     t=sprintf(inText, "N_{Tbq} = %.1f", 0.);
   myText(0.24, 0.7, 1, .04, inText);
   if(signal.size()>1){
     if(signal[1])
       t=sprintf(inText, "N_{TTS} = %.1f", signal[1]->Integral(0,signal[1]->GetNbinsX()+1));
     else
       t=sprintf(inText, "N_{TTS} = %.1f", 0.);
     myText(0.24, 0.65, 1, .04, inText);
     if(signal.size()>2){
       if(signal[2])
	 t=sprintf(inText, "N_{BBS} = %.1f", signal[2]->Integral(0,signal[2]->GetNbinsX()+1));
       else
	 t=sprintf(inText, "N_{BBS} = %.1f", 0.);
       myText(0.24, 0.6, 1, .04, inText);
     }
   }

   double back_int = allBackgrounds->Integral(0,allBackgrounds->GetNbinsX()+1);
   if(back_int > 10000.)
     t=sprintf(inText, "N_{B} = %.3e", back_int);
   else
     t=sprintf(inText, "N_{B} = %.1f", back_int);
   myText(0.24, 0.75, 1, .04, inText);
   if(!isSignalRegion){
     if(data)
       t=sprintf(inText, "N_{D} = %.0f", data->Integral(0,data->GetNbinsX()+1));
     else
       t=sprintf(inText, "N_{D} = %.0f", 0.);
     myText(0.24, 0.8, 1, .04, inText);
   }
   
   canvas->cd();
   
   // Draw Ratio plot
   double ratio_max = 1.6;
   double ratio_min = 0.4;
  
   double pad_xlow = 0.;
   double pad_xhigh = 0.95;
   double pad_ylow = 0.0;
   double pad_yhigh = 0.3;
   
   const char* pad_name = "pad";
   TPad* pad4ratio = new TPad(pad_name,pad_name,pad_xlow,pad_ylow,pad_xhigh,pad_yhigh);

   pad4ratio->SetMargin(pad_margin_left,pad_margin_right,0.46,0.);
   pad4ratio->Draw();
   pad4ratio->cd();

   TH1D* ratioPlot;
   if(data)
     ratioPlot = (TH1D*)data->Clone("ratio");
   else if (signal[0]) 
     ratioPlot = (TH1D*)signal[0]->Clone("ratio"); // just for getting the axis

   ratioPlot->SetTitle("");
   ratioPlot->Divide(allBackgrounds);
   ratioPlot->GetYaxis()->SetTitle("Data/MC");
   ratioPlot->GetXaxis()->SetTitle(axisName.c_str());

   if (data){
     // here change ratio_min and ratio_max if the ratio plot is quite flat
     double maxDeviation=0;
     double tempDev=0;
     for(int ibin=1; ibin<=allBackgrounds->GetNbinsX(); ibin++){
       tempDev = std::abs(ratioPlot->GetBinContent(ibin)-1.);
       if(tempDev > maxDeviation) maxDeviation = tempDev;
     }
     if(maxDeviation < 0.1){
       ratio_max = 1.12;
       ratio_min = 0.88;
     }
     else if(maxDeviation < 0.2){
       ratio_max = 1.25;
       ratio_min = .75;
     }
     ratioPlot->SetMinimum(ratio_min);
     ratioPlot->SetMaximum(ratio_max);
   }     

   if(ratioPlot->GetXaxis()->GetNdivisions() > ratioPlot->GetNbinsX())
     ratioPlot->GetXaxis()->SetNdivisions(ratioPlot->GetNbinsX());
   if(ratioPlot->GetXaxis()->GetNdivisions() > 11)
     ratioPlot->GetXaxis()->SetNdivisions(11);
   ratioPlot->GetXaxis()->SetLabelSize(RATIOPLOT_XAXIS_LABEL_SIZE);
   ratioPlot->GetYaxis()->SetLabelSize(RATIOPLOT_YAXIS_LABEL_SIZE);
   ratioPlot->GetYaxis()->SetNdivisions(3);
   ratioPlot->GetYaxis()->SetTitleSize(RATIOPLOT_YAXIS_TITLE_SIZE);
   ratioPlot->GetYaxis()->SetTitleOffset(RATIOPLOT_YAXIS_TITLE_OFFSET);
   ratioPlot->GetXaxis()->SetTitleSize(RATIOPLOT_XAXIS_TITLE_SIZE);
   ratioPlot->GetXaxis()->SetTitleOffset(RATIOPLOT_XAXIS_TITLE_OFFSET);
   
   if(!isSignalRegion && data){
     ratioPlot->Draw();
     // plot horizontal line at y=1
     TF1* horizontal = new TF1("horizontal","pol1",-10000,10000);
     horizontal->SetParameter(0,1.);
     horizontal->SetParameter(1,0.);
     horizontal->SetLineColor(kBlack);
     horizontal->SetLineStyle(2);
     horizontal->SetLineWidth(1);
     horizontal->Draw("same");
     ratioErr->Draw("E2 same");
   }else if(isSignalRegion){
     ratioPlot->Draw("axis");
     char text[]="DATA IS BLIND HERE";
     myText(0.4,0.6,1,.15,text);
   }else{ // in this case it is not the signal region but there is no data
     ratioPlot->Draw("axis");
     char text[]="NO DATA";
     myText(0.4,0.6,1,.15,text);
   }
   
   return canvas;
}
Ejemplo n.º 19
0
void Plot_McollRatio(TString file, TString fakefile, TString sample, TString SR, bool subtractFakes)
{

	SetAtlasStyle();
	#ifdef __CINT__
	  gROOT->LoadMacro("AtlasUtils.C");
	#endif

  	double xmin = 50;
  	double xmax = 400;


  	TFile* f = new TFile(file);
  	TFile* fakef = new TFile(fakefile);

  	TH1D* hME;
  	TH1D* hEM;

  	//if (isScaled){
//  		hME =(TH1D*)f->Get("ME_scaled");//nom/ME_McollHiggs_Unblind");
//  		hEM =(TH1D*)f->Get("EM");//nom/EM_McollHiggs_Unblind");
//  		hME_orig = (TH1D*)f->Get("ME_original");
//  		hEM_orig = (TH1D*)f->Get("EM_original");
  	//}
  	//else{
  		hME =(TH1D*)f->Get("nom/ME_McollHiggs_Unblind");
  		hEM =(TH1D*)f->Get("nom/EM_McollHiggs_Unblind");
  	//}

  	if (subtractFakes){
  		TH1D* hME_fake = (TH1D*)fakef->Get("nom/ME_McollHiggs_Unblind");
  		TH1D* hEM_fake = (TH1D*)fakef->Get("nom/EM_McollHiggs_Unblind");

  		hME->Add(hME_fake,-1);
  		hEM->Add(hEM_fake,-1);
 	}
  	hEM->SetMarkerStyle(8); hEM->SetMarkerSize(0.7);
  	hEM->SetLineColor(kPink + 8);hEM->SetOption("e1");
  	hEM->SetMarkerColor(kPink + 8);
  	hME->SetMarkerStyle(8); hME->SetMarkerSize(0.7);
  	hME->SetLineColor(kTeal - 6);hME->SetOption("e1");
  	hME->SetMarkerColor(kTeal - 6);
  	hME->GetXaxis()->SetLabelOffset(0); hME->GetXaxis()->SetLabelSize(0);
  	hEM->GetXaxis()->SetLabelOffset(0); hEM->GetXaxis()->SetLabelSize(0);
  	hEM->GetXaxis()->SetRangeUser(xmin,xmax);   hME->GetXaxis()->SetRangeUser(xmin,xmax);
  	hEM->GetYaxis()->SetTitleOffset(1.0);
  	hME->GetYaxis()->SetTitleOffset(1.0);

//  	hEM_orig->SetMarkerStyle(8); hEM_orig->SetMarkerSize(0.7);
//  	hEM_orig->SetLineColor(kPink + 8);hEM_orig->SetOption("e1");
//  	hEM_orig->SetMarkerColor(kPink + 8);
//  	hME_orig->SetMarkerStyle(8); hME_orig->SetMarkerSize(0.7);
//  	hME_orig->SetLineColor(kTeal - 6);hME_orig->SetOption("e1");
//  	hME_orig->SetMarkerColor(kTeal - 6);
//  	hME_orig->GetXaxis()->SetLabelOffset(0); hME_orig->GetXaxis()->SetLabelSize(0);
//  	hEM_orig->GetXaxis()->SetLabelOffset(0); hEM_orig->GetXaxis()->SetLabelSize(0);
//  	hEM_orig->GetXaxis()->SetRangeUser(xmin,xmax);   hME_orig->GetXaxis()->SetRangeUser(xmin,xmax);
//  	hEM_orig->GetYaxis()->SetTitleOffset(1.0);
//  	hME_orig->GetYaxis()->SetTitleOffset(1.0);

  	double numEM = hEM->Integral();
  	double numME = hME->Integral();

  	cout<<"# entries EM = " << numEM << endl;
  	cout<<"# entries ME = " << numME << endl;

//  	TH1D* ratio2 = GetRatio(hEM_orig,hME_orig,xmin,xmax);
//  	TH1D* diff2 = GetDiff(hEM_orig,hME_orig,xmin,xmax);

  	TH1D* ratio = GetRatio(hEM,hME,xmin,xmax);
  	TH1D* diff = GetDiff(hEM,hME,xmin,xmax);

  	TLegend* leg = new TLegend(0.6,0.45,0.75,0.55);
  	leg->SetFillColor(kWhite); leg->SetBorderSize(1); leg->SetLineColor(0); leg->SetTextFont(42);
  	leg->SetTextSize(.05);

  	TLine* line1 = new TLine(xmin,1,xmax,1); line1->SetLineColor(kRed); line1->SetLineStyle(2);
  	TLine* line14 = new TLine(xmin,1.5,xmax,1.5); line14->SetLineStyle(9);
  	line14->SetLineColor(kBlack);
  	TLine* line13 = new TLine(xmin,2./3,xmax,2./3); line13->SetLineStyle(2);
  	line13->SetLineColor(kRed);
  	TLine* line12 = new TLine(xmin,2,xmax,2); line12->SetLineStyle(9);
  	line12->SetLineColor(kBlack);
  	TLine* line15 = new TLine(xmin,0.5,xmax,0.5); line15->SetLineStyle(9);
  	line15->SetLineColor(kBlack);
  	TLine* line2 = new TLine(xmin,0,xmax,0); line2->SetLineColor(kBlack); line2->SetLineStyle(9);

  	TLine* vline1 = new TLine(100,0,100,3000); vline1->SetLineStyle(2);
  	TLine* vline2 = new TLine(150,0,150,3000); vline2->SetLineStyle(2);

  	TCanvas* c0 = new TCanvas("mcoll ","mcoll ",600,600); c0=c0;
  	TPad *pad1 =  new TPad("pad1", "12<L1<15",0.0,0.2,1,1.0,21); pad1->SetMargin(0.1,0.1,0.02,0.2);
  	TPad *pad2 =  new TPad("pad2", "ratio",   0.0,0,1,0.2,21); pad2->SetMargin(0.1,0.1,0.3,0.02);
//  	TPad *pad3 =  new TPad("pad3", "diff",    0.0,0,1,0.2,21); pad3->SetMargin(0.1,0.1,0.3,0.02);

  	pad1->SetFillColor(0);pad2->SetFillColor(0);//pad3->SetFillColor(0);
  	pad1->Draw(); pad2->Draw();//pad3->Draw();


  	pad1->cd();

	#ifdef __CINT__
  		gROOT->LoadMacro("AtlasLabels.C");
	#endif

  	leg->AddEntry(hME,"#mue","le");
  	leg->AddEntry(hEM,"e#mu","le");


  	hEM->Draw("e1"); hME->Draw("e1 sames");
  	vline1->Draw(); vline2->Draw();


  	pad2->cd();
  	ratio->Draw();
  	line14->Draw();line15->Draw();line1->Draw();

//  	pad3->cd();
//  	diff->Draw();
//  	line2->Draw();

  	pad1->cd();
  	myText(0.5,0.65,1,"#int L dt = 20.3 fb^{-1}  #sqrt{s} = 8 TeV");
  	myText(0.6,0.35,1,sample);
  	myText(0.6,0.25,1,SR);

  	ATLASLabel(0.62,0.75,"Internal");

  	leg->Draw();


  	c0->Update();

//  	TCanvas* c1 = new TCanvas("mcoll original","mcoll original",600,600); c0=c0;
//  	TPad *pad1_2 =  new TPad("pad1", "12<L1<15",0.0,0.4,1,1.0,21); pad1_2->SetMargin(0.1,0.1,0.02,0.2);
//  	TPad *pad2_2 =  new TPad("pad2", "ratio",   0.0,0.2,1,0.4,21); pad2_2->SetMargin(0.1,0.1,0.02,0.02);
//  	TPad *pad3_2 =  new TPad("pad3", "diff",    0.0,0,1,0.2,21); pad3_2->SetMargin(0.1,0.1,0.3,0.02);
//
//  	pad1_2->SetFillColor(0);pad2_2->SetFillColor(0);pad3_2->SetFillColor(0);
//  	pad1_2->Draw(); pad2_2->Draw();pad3_2->Draw();
//
//
//  	pad1_2->cd();

//  	hEM_orig->Draw("e1"); hME_orig->Draw("e1 sames");
//  	vline1->Draw(); vline2->Draw();


//  	pad2_2->cd();
//  	ratio2->Draw();
//  	line14->Draw();line15->Draw();line1->Draw();

//  	pad3_2->cd();
//  	diff2->Draw();
//  	line2->Draw();

//  	pad1_2->cd();
//  	myText(0.5,0.65,1,"#int L dt = 20.3 fb^{-1}  #sqrt{s} = 8 TeV");
//  	myText(0.6,0.35,1,sample);
//
//  	ATLASLabel(0.62,0.75,"Internal");
//
//  	leg->Draw();
//
//
//  	c1->Update();



  return;
}
Ejemplo n.º 20
0
void runSbOpt()
{
	///-------------------------------------------------------------------------
	/// Compile everything
	///-------------------------------------------------------------------------  
	gSystem->Load("libPhysics.so");
	gSystem->CompileMacro ("Util.cpp", "k");
	gSystem->AddIncludePath("-I../common");
	//gSystem->AddDynamicPath("../common");
	//gSystem->CompileMacro ("limit_calculation.C", "k");   
	gSystem->Load("libCommon.so");
	gSystem->CompileMacro ("LowLevelClasses.cxx", "k"); 
	gSystem->CompileMacro ("OptimizationPlots.cxx", "k");
	//gROOT->LoadMacro("../../RootUtils/AtlasStyle.C");
	SetAtlasStyle();
	
	//output file for plots, lumi (pb^-1), use caching, debug
	//OptimizationPlots plotclass("susyopt.root",5000.,true,true);
	OptimizationPlots plotclass("susyopt.root",4710.,true,false);
	//OptimizationPlots plotclass("susyopt.root",2050.,true,false);
	//plotclass.SetPlotPathAndExt("output/",".png");
	plotclass.SetPlotPathAndExt("output/",".eps");

	//yield cross-checks
	//plotclass.AddSample("SU4","input/opt.su4.susy1004.root");

	//data
	plotclass.AddSample("data","input/opt.Data_2fb-1.susy1004.root");

	//backgrounds
	plotclass.AddSample("bkg","input/opt.ttsl.susy1004.root");
	plotclass.AddSample("bkg","input/opt.tthad.susy1004.root");
	plotclass.AddSample("bkg","input/opt.st.susy1004.root");

	plotclass.AddSample("bkg","input/opt.ttV.susy1004.root");
	plotclass.AddSample("bkg","input/opt.ttbb.susy1004.root");	
	
	plotclass.AddSample("bkg","input/opt.wjets.susy1004.root");
	plotclass.AddSample("bkg","input/opt.wc.susy1004.root");
	plotclass.AddSample("bkg","input/opt.wbbwcc.susy1004.root");	

	plotclass.AddSample("bkg","input/opt.zjets.susy1004.root");
	plotclass.AddSample("bkg","input/opt.zhf.susy1004.root","",1.44);

	plotclass.AddSample("bkg","input/opt.dibosonfake.susy1004.root");	

	//plotclass.AddSample("bkg","input/opt.qcd.susy1004.root");
	//plotclass.AddSample("bkg","input/opt.qcdsmear.smear");
	//plotclass.AddSample("bkg","input/opt.qcdbbalpgen.susy1004.root");
	//plotclass.AddSample("bkg","input/opt.qcdalpgen.susy1004.root");		
	
	
	plotclass.AddSample("smear","input/opt.JetTauEtmiss_2fb-1_LAr.qcdsmear.root","smearLAr");
	plotclass.AddSample("smear","input/opt.JetTauEtmiss_2fb-1_noLAr.qcdsmear.root","smearNonLAr");
	plotclass.AddSample("smear","input/LAr.JetTauEtmiss_2fb-1_LAr.qcdsmear.root","smearLArRev");
	plotclass.AddSample("smear","input/LAr.JetTauEtmiss_2fb-1.susy1004.root","dataLArRev");
	plotclass.AddSample("smear","input/LAr.ttslLAr.susy1004.root","ttslLArRev");
	
	
	//grids
	plotclass.AddSample("Bb","input/opt.BbB200L1.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB200L100.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB200L150.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB250L1.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB250L100.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB250L150.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB250L200.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB250L50.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB300L1.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB300L100.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB300L150.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB300L200.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB300L250.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB300L50.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB350L1.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB350L100.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB350L150.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB350L200.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB350L250.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB350L300.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB350L50.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB400L1.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB400L100.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB400L150.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB400L200.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB400L250.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB400L300.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB400L350.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB400L50.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB450L1.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB450L100.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB450L150.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB450L200.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB450L250.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB450L300.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB450L350.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB450L400.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB450L50.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB500L1.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB500L100.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB500L150.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB500L200.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB500L250.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB500L300.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB500L350.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB500L400.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB500L450.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB500L50.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB550L1.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB550L100.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB550L150.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB550L200.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB550L250.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB550L300.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB550L350.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB550L400.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB550L450.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB550L50.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB550L500.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB600L1.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB600L100.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB600L150.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB600L200.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB600L250.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB600L300.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB600L350.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB600L400.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB600L450.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB600L50.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB600L500.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB600L550.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB650L1.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB650L100.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB650L150.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB650L200.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB650L250.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB650L300.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB650L350.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB650L400.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB650L450.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB650L50.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB650L500.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB650L550.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB650L600.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB700L1.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB700L100.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB700L150.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB700L200.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB700L250.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB700L300.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB700L350.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB700L400.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB700L450.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB700L50.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB700L500.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB700L550.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB700L600.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB700L650.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB750L1.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB750L100.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB750L150.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB750L200.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB750L250.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB750L300.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB750L350.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB750L400.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB750L450.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB750L50.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB750L500.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB750L550.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB750L600.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB750L650.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB750L700.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB800L1.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB800L100.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB800L150.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB800L200.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB800L250.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB800L300.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB800L350.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB800L400.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB800L450.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB800L50.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB800L500.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB800L550.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB800L600.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB800L650.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB800L700.susy1004.root");
	plotclass.AddSample("Bb","input/opt.BbB800L750.susy1004.root");
	
	//ISR only
	plotclass.AddSample("BbISR","input/opt.BbB200L100.susy1004.root");
	plotclass.AddSample("BbISR","input/opt.BbB200L150.susy1004.root");
	plotclass.AddSample("BbISR","input/opt.BbB250L150.susy1004.root");
	plotclass.AddSample("BbISR","input/opt.BbB250L200.susy1004.root");
	plotclass.AddSample("BbISR","input/opt.BbB300L200.susy1004.root");
	plotclass.AddSample("BbISR","input/opt.BbB300L250.susy1004.root");
	plotclass.AddSample("BbISR","input/opt.BbB350L250.susy1004.root");
	plotclass.AddSample("BbISR","input/opt.BbB350L300.susy1004.root");
	plotclass.AddSample("BbISR","input/opt.BbB400L300.susy1004.root");
	plotclass.AddSample("BbISR","input/opt.BbB400L350.susy1004.root");
	plotclass.AddSample("BbISR","input/opt.BbB450L350.susy1004.root");
	plotclass.AddSample("BbISR","input/opt.BbB450L400.susy1004.root");
	plotclass.AddSample("BbISR","input/opt.BbB500L400.susy1004.root");
	plotclass.AddSample("BbISR","input/opt.BbB500L450.susy1004.root");
	plotclass.AddSample("BbISR","input/opt.BbB550L450.susy1004.root");
	plotclass.AddSample("BbISR","input/opt.BbB550L500.susy1004.root");
	plotclass.AddSample("BbISR","input/opt.BbB600L500.susy1004.root");
	plotclass.AddSample("BbISR","input/opt.BbB600L550.susy1004.root");
	plotclass.AddSample("BbISR","input/opt.BbB650L550.susy1004.root");
	plotclass.AddSample("BbISR","input/opt.BbB650L600.susy1004.root");
	plotclass.AddSample("BbISR","input/opt.BbB700L600.susy1004.root");
	plotclass.AddSample("BbISR","input/opt.BbB700L650.susy1004.root");
	plotclass.AddSample("BbISR","input/opt.BbB750L650.susy1004.root");
	plotclass.AddSample("BbISR","input/opt.BbB750L700.susy1004.root");
	plotclass.AddSample("BbISR","input/opt.BbB800L700.susy1004.root");
	plotclass.AddSample("BbISR","input/opt.BbB800L750.susy1004.root");

	plotclass.AddSample("BbRepISR","input/opt.BbB200L150.susy1004.root");
	plotclass.AddSample("BbRepISR","input/opt.BbB250L200.susy1004.root");
	plotclass.AddSample("BbRepISR","input/opt.BbB300L250.susy1004.root");
	plotclass.AddSample("BbRepISR","input/opt.BbB350L300.susy1004.root");
	
	plotclass.AddSample("BbRep","input/opt.BbB200L100.susy1004.root");
	plotclass.AddSample("BbRep","input/opt.BbB300L100.susy1004.root");
	plotclass.AddSample("BbRep","input/opt.BbB400L100.susy1004.root");
	plotclass.AddSample("BbRep","input/opt.BbB500L100.susy1004.root");
    
    //Chains
	plotclass.AddChain("standard","EF_j75_a4tc_EFFS_xe45_loose_noMu met(>160) nj(50,==2) metmeff(2,>0.25) mindphi(3,>0.4) nbtag(JetFitterCOMBNN,2.00,50,==2)");
	plotclass.AddChain("isr","EF_j75_a4tc_EFFS_xe45_loose_noMu mindphi(3,>0.4) nj(30,>=3) met(>160) btag(JetFitterCOMBNN,2.00,30,0,==0) nbtag(JetFitterCOMBNN,2.00,30,>0)");
	plotclass.AddChain("sr2base","EF_xe60_noMu met(>150) nj(60,==2) metmeff(2,>0.25) mindphi(3,>0.4) nbtag(JetFitterCOMBNN,2.00,60,==2)");

	plotclass.AddChain("standardmet","EF_xe60_noMu jpt(0,>60) met(>150) nj(50,==2) metmeff(2,>0.25) mindphi(3,>0.4) nbtag(JetFitterCOMBNN,2.00,50,==2)");
	plotclass.AddChain("isrmet","EF_xe60_noMu jpt(0,>60) met(>150) nj(30,>=3) mindphi(3,>0.4) btag(JetFitterCOMBNN,2.00,30,0,==0) nbtag(JetFitterCOMBNN,2.00,30,>0)");


    //plotclass.AddCut("sr2","sr2base mct(>100) met(>200) ht2(2,<50)", "SR2");

	plotclass.AddCut("isrSb","isr", "ISR baseline");
	plotclass.AddCut("BestISR","isr ht2(3,<50) dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,==2) bpt(JetFitterCOMBNN,2.00,30,<110.)","ISR, #slash{E}_{T}>160");
	plotclass.AddCut("BestISR","isr ht2(3,<50) dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,==2) bpt(JetFitterCOMBNN,2.00,30,<110.) met(>250)","ISR, #slash{E}_{T}>250");
	plotclass.AddCut("Mirjam","isr nj(30,<=4) dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,==2) metmeff(3,>0.2)","ISR, Mirjam");

	plotclass.AddCut("sr2base","sr2base", "SR2 trigger");
	
	//Cuts
	plotclass.AddCut("BbISR_opt","standard","m_{CT}>0 GeV");
	plotclass.AddCut("Bb_opt","standard","m_{CT}>0 GeV");
	plotclass.AddCut("Bb_opt","standard mct(>100)","m_{CT}>100 GeV");
	plotclass.AddCut("Bb_opt","standard mct(>150)","m_{CT}>150 GeV");
	plotclass.AddCut("Bb_opt","standard mct(>200)","m_{CT}>200 GeV");
	//plotclass.AddCut("baseline","standard","m_{CT}>0 GeV");
	//plotclass.AddCut("baseline","standard mct(>100)","m_{CT}>100 GeV");
	//plotclass.AddCut("baseline","standard mct(>150)","m_{CT}>150 GeV");
	//plotclass.AddCut("baseline","standard mct(>200)","m_{CT}>200 GeV");
	plotclass.AddCut("originalSb","standard","m_{CT}>0 GeV");
	plotclass.AddCut("originalSb","standard mct(>100)","m_{CT}>100 GeV");
	plotclass.AddCut("originalSb","standard mct(>150)","m_{CT}>150 GeV");
	plotclass.AddCut("originalSb","standard mct(>200)","m_{CT}>200 GeV");
	//plotclass.AddCut("originalSbMet","standard","m_{CT}>0 GeV");
	//plotclass.AddCut("originalSbMet","standard mct(>100)","m_{CT}>100 GeV");
	//plotclass.AddCut("originalSbMet","standard mct(>150)","m_{CT}>150 GeV");
	//plotclass.AddCut("originalSbMet","standard mct(>200)","m_{CT}>200 GeV");
	plotclass.AddCut("originalSbMet","standard met(>300) ","m_{CT}>0 GeV, MET>300 GeV");
	plotclass.AddCut("originalSbMet","standard mct(>100) met(>300) ","m_{CT}>100 GeV, MET>300 GeV");
	plotclass.AddCut("originalSbMet","standard mct(>150) met(>300) ","m_{CT}>150 GeV, MET>300 GeV");
	plotclass.AddCut("originalSbMet","standard mct(>200) met(>300) ","m_{CT}>200 GeV, MET>300 GeV");

	plotclass.AddCut("baseline","standard","m_{CT}>0 GeV");
/*	plotclass.AddCut("baseline","standard mct(>100)","m_{CT}>100 GeV");
	plotclass.AddCut("baseline","standard mct(>150)","m_{CT}>150 GeV");
	plotclass.AddCut("baseline","standard mct(>200)","m_{CT}>200 GeV");
	plotclass.AddCut("baseline","standard mct(>250)","m_{CT}>250 GeV");
	plotclass.AddCut("baseline","sr2base mct(>100) met(>200) ht2(2,<50)", "SR2");
	plotclass.AddCut("baseline","isr ht2(3,<50) dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,==2) bpt(JetFitterCOMBNN,2.00,30,<110.)","ISR, #slash{E}_{T}>160");
	plotclass.AddCut("baseline","isr ht2(3,<50) dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,==2) bpt(JetFitterCOMBNN,2.00,30,<110.) met(>250)","ISR, #slash{E}_{T}>250");

	
	plotclass.AddCut("combined","standard","m_{CT}>0 GeV");
	plotclass.AddCut("combined","standard mct(>100)","m_{CT}>100 GeV");
	plotclass.AddCut("combined","standard mct(>150)","m_{CT}>150 GeV");
	plotclass.AddCut("combined","standard mct(>200)","m_{CT}>200 GeV");
	plotclass.AddCut("combined","standard mct(>250)","m_{CT}>250 GeV");
	plotclass.AddCut("combined","sr2base mct(>100) met(>200) ht2(2,<50)", "SR2");
	plotclass.AddCut("combined","isr ht2(3,<50) dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,==2) bpt(JetFitterCOMBNN,2.00,30,<110.)","ISR, #slash{E}_{T}>160");
	plotclass.AddCut("combined","isr ht2(3,<50) dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,==2) bpt(JetFitterCOMBNN,2.00,30,<110.) met(>250)","ISR, #slash{E}_{T}>250");

	plotclass.AddCut("met","standardmet jpt(0,>130) met(>160)","m_{CT}>0 GeV");
	plotclass.AddCut("met","standardmet jpt(0,>130) met(>160) mct(>100)","m_{CT}>100 GeV");
	plotclass.AddCut("met","standardmet jpt(0,>130) met(>160) mct(>150)","m_{CT}>150 GeV");
	plotclass.AddCut("met","standardmet jpt(0,>130) met(>160) mct(>200)","m_{CT}>200 GeV");
	plotclass.AddCut("met","standardmet jpt(0,>130) met(>160) mct(>250)","m_{CT}>250 GeV");
	plotclass.AddCut("met","sr2base mct(>100) met(>200) ht2(2,<50)", "SR2");
	plotclass.AddCut("met","isrmet jpt(0,>130) met(>160) ht2(3,<50) dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,==2) bpt(JetFitterCOMBNN,2.00,30,<110.)","ISR, #slash{E}_{T}>160");
	plotclass.AddCut("met","isrmet jpt(0,>130) met(>160) ht2(3,<50) dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,==2) bpt(JetFitterCOMBNN,2.00,30,<110.) met(>250)","ISR, #slash{E}_{T}>250");

	plotclass.AddCut("lowermet","standardmet jpt(0,>130) ","m_{CT}>0 GeV");
	plotclass.AddCut("lowermet","standardmet jpt(0,>130) mct(>100)","m_{CT}>100 GeV");
	plotclass.AddCut("lowermet","standardmet jpt(0,>130) mct(>150)","m_{CT}>150 GeV");
	plotclass.AddCut("lowermet","standardmet jpt(0,>130) mct(>200)","m_{CT}>200 GeV");
	plotclass.AddCut("lowermet","standardmet jpt(0,>130) mct(>250)","m_{CT}>250 GeV");
	plotclass.AddCut("lowermet","sr2base mct(>100) met(>200) ht2(2,<50)", "SR2");
	plotclass.AddCut("lowermet","isrmet jpt(0,>130) ht2(3,<50) dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,==2) bpt(JetFitterCOMBNN,2.00,30,<110.)","ISR, #slash{E}_{T}>160");
	plotclass.AddCut("lowermet","isrmet jpt(0,>130) ht2(3,<50) dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,==2) bpt(JetFitterCOMBNN,2.00,30,<110.) met(>250)","ISR, #slash{E}_{T}>250");

	plotclass.AddCut("ht2","standard ht2(2,<50)","m_{CT}>0 GeV");
	plotclass.AddCut("ht2","standard ht2(2,<50) mct(>100)","m_{CT}>100 GeV");
	plotclass.AddCut("ht2","standard ht2(2,<50) mct(>150)","m_{CT}>150 GeV");
	plotclass.AddCut("ht2","standard ht2(2,<50) mct(>200)","m_{CT}>200 GeV");
	plotclass.AddCut("ht2","standard ht2(2,<50) mct(>250)","m_{CT}>250 GeV");
	plotclass.AddCut("ht2","sr2base mct(>100) met(>200) ht2(2,<50)", "SR2");
	plotclass.AddCut("ht2","isr ht2(3,<50) dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,==2) bpt(JetFitterCOMBNN,2.00,30,<110.)","ISR, #slash{E}_{T}>160");
	plotclass.AddCut("ht2","isr ht2(3,<50) dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,==2) bpt(JetFitterCOMBNN,2.00,30,<110.) met(>250)","ISR, #slash{E}_{T}>250");

	plotclass.AddCut("lowerjpt","standardmet jpt(0,>110) ","m_{CT}>0 GeV");
	plotclass.AddCut("lowerjpt","standardmet jpt(0,>110) mct(>100)","m_{CT}>100 GeV");
	plotclass.AddCut("lowerjpt","standardmet jpt(0,>110) mct(>150)","m_{CT}>150 GeV");
	plotclass.AddCut("lowerjpt","standardmet jpt(0,>110) mct(>200)","m_{CT}>200 GeV");
	plotclass.AddCut("lowerjpt","standardmet jpt(0,>110) mct(>250)","m_{CT}>250 GeV");
	plotclass.AddCut("lowerjpt","sr2base mct(>100) met(>200) ht2(2,<50)", "SR2");
	plotclass.AddCut("lowerjpt","isrmet jpt(0,>110) ht2(3,<50) dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,==2) bpt(JetFitterCOMBNN,2.00,30,<110.)","ISR, #slash{E}_{T}>160");
	plotclass.AddCut("lowerjpt","isrmet jpt(0,>110) ht2(3,<50) dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,==2) bpt(JetFitterCOMBNN,2.00,30,<110.) met(>250)","ISR, #slash{E}_{T}>250");

	plotclass.AddCut("lowjpt","standardmet jpt(0,>80) ","m_{CT}>0 GeV");
	plotclass.AddCut("lowjpt","standardmet jpt(0,>80) mct(>100)","m_{CT}>100 GeV");
	plotclass.AddCut("lowjpt","standardmet jpt(0,>80) mct(>150)","m_{CT}>150 GeV");
	plotclass.AddCut("lowjpt","standardmet jpt(0,>80) mct(>200)","m_{CT}>200 GeV");
	plotclass.AddCut("lowjpt","standardmet jpt(0,>80) mct(>250)","m_{CT}>250 GeV");
	plotclass.AddCut("lowjpt","sr2base mct(>100) met(>200) ht2(2,<50)", "SR2");
	plotclass.AddCut("lowjpt","isrmet jpt(0,>80) ht2(3,<50) dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,==2) bpt(JetFitterCOMBNN,2.00,30,<110.)","ISR, #slash{E}_{T}>160");
	plotclass.AddCut("lowjpt","isrmet jpt(0,>80) ht2(3,<50) dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,==2) bpt(JetFitterCOMBNN,2.00,30,<110.) met(>250)","ISR, #slash{E}_{T}>250");

	plotclass.AddCut("highjpt","standardmet jpt(0,>150) ","m_{CT}>0 GeV");
	plotclass.AddCut("highjpt","standardmet jpt(0,>150) mct(>100)","m_{CT}>100 GeV");
	plotclass.AddCut("highjpt","standardmet jpt(0,>150) mct(>150)","m_{CT}>150 GeV");
	plotclass.AddCut("highjpt","standardmet jpt(0,>150) mct(>200)","m_{CT}>200 GeV");
	plotclass.AddCut("highjpt","standardmet jpt(0,>150) mct(>250)","m_{CT}>250 GeV");
	plotclass.AddCut("highjpt","sr2base mct(>100) met(>200) ht2(2,<50)", "SR2");
	plotclass.AddCut("highjpt","isrmet jpt(0,>130) ht2(3,<50) dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,==2) bpt(JetFitterCOMBNN,2.00,30,<110.)","ISR, #slash{E}_{T}>150");
	plotclass.AddCut("highjpt","isrmet jpt(0,>150) ht2(3,<50) dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,==2) bpt(JetFitterCOMBNN,2.00,30,<110.) met(>250)","ISR, #slash{E}_{T}>250");
*/
	//plotclass.AddCut("best","standardmet jpt(0,>130) ","m_{CT}>0 GeV"); //ht2(2,<50) 
	//plotclass.AddCut("best","standardmet jpt(0,>130) mct(>100)","m_{CT}>100 GeV");
	plotclass.AddCut("best","standardmet jpt(0,>130) mct(>150)","SR1, m_{CT}>150 (GeV)");
	plotclass.AddCut("best","standardmet jpt(0,>130) mct(>200)","SR1, m_{CT}>200 (GeV)");
	plotclass.AddCut("best","standardmet jpt(0,>130) mct(>250)","SR1, m_{CT}>250 (GeV)");
	plotclass.AddCut("best","sr2base mct(>100) met(>200) ht2(2,<50)", "SR2, #slash{E}_{T}>200, H_{T,2}<50 (GeV)");
	plotclass.AddCut("best","isrmet jpt(0,>130) ht2(3,<50) dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,==2) bpt(JetFitterCOMBNN,2.00,30,<110.)","SR3, H_{T,3}<50 (GeV)");
	plotclass.AddCut("best","isrmet jpt(0,>150) ht2(3,<50) dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,==2) bpt(JetFitterCOMBNN,2.00,30,<110.) met(>250)","SR3, J1 p_{T}>150, #slash{E}_{T}>250, H_{T,3}<50 (GeV)");

	plotclass.AddCut("testISR","isr dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,>1)","test ISR");
	
	/*
	//ISR variations
	vector<int> jetpts;
	jetpts.push_back(30);
	//jetpts.push_back(40);	
	//jetpts.push_back(50);
	//jetpts.push_back(60);
	vector<int>::iterator jetptiter = jetpts.begin();

	vector<int> bjetpts;
	bjetpts.push_back(30);
	//bjetpts.push_back(40);	
	//bjetpts.push_back(50);
	//bjetpts.push_back(60);	
	vector<int>::iterator bjetptiter = bjetpts.begin();
	
	vector<float> btagops;
	btagops.push_back(-1.25);
	btagops.push_back(0.35);
	btagops.push_back(2.00);
	vector<float>::iterator btagopiter = btagops.begin();

	vector<int> jetsmin;
	jetsmin.push_back(3);
	//jetsmin.push_back(4);
	//jetsmin.push_back(5);
	vector<int>::iterator jetsminiter = jetsmin.begin();
	
	vector<int> jetsmax;
	//jetsmax.push_back(3);
	jetsmax.push_back(4);
	//jetsmax.push_back(5);
	//jetsmax.push_back(99);
	vector<int>::iterator jetsmaxiter = jetsmax.begin();	
	
	vector<TString> mets;
	mets.push_back(" met(>160)");
	//mets.push_back(" met(>200)");
	mets.push_back(" met(>250)");
	//mets.push_back(" met(>300)");
	vector<TString>::iterator metiter;
	
	vector<TString> nbtags;
	nbtags.push_back(" btag(JetFitterCOMBNN,%.2f,%i,1:2,>0)");
	nbtags.push_back(" btag(JetFitterCOMBNN,%.2f,%i,1:2,>1)");
	//nbtags.push_back(" btag(JetFitterCOMBNN,%.2f,%i,1:2,==2)");
	nbtags.push_back(" nbtag(JetFitterCOMBNN,%.2f,%i,>0)");
	nbtags.push_back(" nbtag(JetFitterCOMBNN,%.2f,%i,>1)");
	//nbtags.push_back(" nbtag(JetFitterCOMBNN,%.2f,%i,==2)");
	vector<TString>::iterator nbtagiter;
	
	vector<TString> antitags;
	antitags.push_back(" btag(JetFitterCOMBNN,%.2f,%i,0,==0)");
	//antitags.push_back("");	
	vector<TString>::iterator antitagiter;
	
	vector<TString> metmeffs;
	//metmeffs.push_back(" metmeff(%i,>0.1)");
	//metmeffs.push_back(" metmeff(%i,>0.2)");
	//metmeffs.push_back(" metmeff(%i,>0.25)");
	metmeffs.push_back(" metmeff(%i,>0.3)");
	//metmeffs.push_back(" metmeff(%i,>0.35)");
	metmeffs.push_back("");
	vector<TString>::iterator metmeffiter;
	
	vector<TString> bjet0pts;
	//bjet0pts.push_back(" bpt(JetFitterCOMBNN,%.2f,%i,<70.)");
	//bjet0pts.push_back(" bpt(JetFitterCOMBNN,%.2f,%i,<90.)");
	bjet0pts.push_back(" bpt(JetFitterCOMBNN,%.2f,%i,<110.)");
	//bjet0pts.push_back(" bpt(JetFitterCOMBNN,%.2f,%i,<130.)");
	//bjet0pts.push_back("");
	vector<TString>::iterator bjet0ptiter;

	vector<TString> bdphimets;
	//bdphimets.push_back(" bdphimet(JetFitterCOMBNN,%.2f,%i,<1.)");	
	//bdphimets.push_back(" bdphimet(JetFitterCOMBNN,%.2f,%i,<1.5)");	
	//bdphimets.push_back(" bdphimet(JetFitterCOMBNN,%.2f,%i,<2.)");	
	//bdphimets.push_back(" bdphimet(JetFitterCOMBNN,%.2f,%i,<2.5)");	
	bdphimets.push_back("");
	vector<TString>::iterator bphimetiter;

	vector<TString> dphi0mets;
	//dphi0mets.push_back(" dphi(0,met,>1.)");
	//dphi0mets.push_back(" dphi(0,met,>1.5)");
	//dphi0mets.push_back(" dphi(0,met,>2.)");
	dphi0mets.push_back(" dphi(0,met,>2.5)");
	//dphi0mets.push_back("");
	vector<TString>::iterator dphi0metiter;
	
	vector<TString> dphi1mets;
	//dphi1mets.push_back(" dphi(1,met,<1.)");
	//dphi1mets.push_back(" dphi(1,met,<1.5)");
	//dphi1mets.push_back(" dphi(1,met,<2.)");
	//dphi1mets.push_back(" dphi(1,met,<2.5)");
	dphi1mets.push_back("");
	vector<TString>::iterator dphi1metiter;

	vector<TString> ht2s;
	//ht2s.push_back(" ht2(1,<40)");
	//ht2s.push_back(" ht2(1,<60)");
	//ht2s.push_back(" ht2(1,<80)");
	//ht2s.push_back(" ht2(1,<100)");
	ht2s.push_back("");
	vector<TString>::iterator ht2iter;
	
	vector<TString> mtts;
	//mtts.push_back(" mtt(JetFitterCOMBNN,%.2f,%i,>200)");
	mtts.push_back("");
	vector<TString>::iterator mttiter;

	int jet_pt; //>
	int bjet_pt; //>
	float btag_op;
	int njets; //>
	
	int cutn = 1;

	for(jetptiter = jetpts.begin(); jetptiter!=jetpts.end(); ++jetptiter) {
		jet_pt = *jetptiter;
		
		for(bjetptiter = bjetpts.begin(); bjetptiter!=bjetpts.end(); ++bjetptiter) {
			bjet_pt = *bjetptiter;

			for(btagopiter = btagops.begin(); btagopiter!=btagops.end(); ++btagopiter) {
				btag_op = *btagopiter;
				
				for(jetsminiter = jetsmin.begin(); jetsminiter!=jetsmin.end(); ++jetsminiter) {
					njets = *jetsminiter;
					TString lvl1(TString::Format("EF_j75_a4tc_EFFS_xe45_loose_noMu mindphi(3,>0.4) nj(%i,>=%i)",jet_pt,njets));
					
					for(jetsmaxiter = jetsmax.begin(); jetsmaxiter!=jetsmax.end(); ++jetsmaxiter) {
						int njetsmax = *jetsmaxiter;
						if(njetsmax<njets) continue;
						TString lvl2(lvl1);
						if(njetsmax!=99) lvl2 += TString::Format(" nj(%i,<=%i)",jet_pt,njetsmax);
					
						for(metiter = mets.begin(); metiter!=mets.end(); ++metiter) {
							TString lvl3(lvl2);
							lvl3 += *metiter;
							
							for(nbtagiter = nbtags.begin(); nbtagiter!=nbtags.end(); ++nbtagiter) {
								TString lvl4(lvl3);
								lvl4 += TString::Format((*nbtagiter).Data(),btag_op,bjet_pt);
								
								for(antitagiter = antitags.begin(); antitagiter!=antitags.end(); ++antitagiter) {
									TString lvl5(lvl4);
									lvl5 += TString::Format((*antitagiter).Data(),btag_op,bjet_pt);
									
									for(metmeffiter = metmeffs.begin(); metmeffiter!=metmeffs.end(); ++metmeffiter) {
										TString lvl6(lvl5);
										lvl6 += TString::Format((*metmeffiter).Data(),njets);
										
										for(bjet0ptiter = bjet0pts.begin(); bjet0ptiter!=bjet0pts.end(); ++bjet0ptiter) {
											TString lvl7(lvl6);
											lvl7 += TString::Format((*bjet0ptiter).Data(),btag_op,bjet_pt);
											
											for(bdphimetiter = bdphimets.begin(); bdphimetiter!=bdphimets.end(); ++bdphimetiter) {
												TString lvl8(lvl7);
												lvl8 += TString::Format((*bdphimetiter).Data(),btag_op,bjet_pt);
												
												for(dphi0metiter = dphi0mets.begin(); dphi0metiter!=dphi0mets.end(); ++dphi0metiter) {
													TString lvl9(lvl8);
													lvl9 += *dphi0metiter;
													
													for(dphi1metiter = dphi1mets.begin(); dphi1metiter!=dphi1mets.end(); ++dphi1metiter) {
														TString lvl10(lvl9);
														lvl10 += *dphi1metiter;
														
														for(ht2iter = ht2s.begin(); ht2iter!=ht2s.end(); ++ht2iter) {
															TString lvl11(lvl10);
															lvl11 += *ht2iter;
															
															for(mttiter = mtts.begin(); mttiter!=mtts.end(); ++mttiter) {
																TString lvl12(lvl11);
																lvl12 += TString::Format((*mttiter).Data(),btag_op,bjet_pt);
																TString cutstring(lvl12);
																
																cout << "Cut " << cutn << ": " << cutstring << endl;
																plotclass.AddCut("ISRVariations",cutstring,TString::Format("%s",cutstring.Data()));
																
																cutn++;
															}
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
	        	}
	        }
	    }
	}
	
	//jet_1_pt
	//jet_2_pt
	*/
	/*
	plotclass.MakeSignifs("Bb","originalSb",true,10);
	//plotclass.MakeSignifs("Bb","originalSbMet",true,10);
	plotclass.MakeSignifs("Bb","isrSb",true,10);
	plotclass.MakeSignifs("Bb","isrSb+",true,10);
	plotclass.MakeSignifs("Bb","combined",true,10);

	plotclass.MakePlots("bkg BbRep data","originalSb","met mct meff(2) dphi(0,met) dphi(1,met)",false,true,true,5);
	//plotclass.MakePlots("bkg BbRep","originalSbMet","met mct meff(2) dphi(0,met) dphi(1,met)",false,true,true,5);
	plotclass.MakePlots("bkg BbRepISR data","isrSb","met meff(3) metmeff(3) jpt(1) dphi(0,met) dphi(1,met) bpt(JetFitterCOMBNN,2.00,30) bdphimet(JetFitterCOMBNN,2.00,30) mtt(JetFitterCOMBNN,2.00,30)",false,true,true,5);
	plotclass.MakePlots("bkg BbRepISR","isrSb+","met meff(3) metmeff(3) jpt(1) dphi(0,met) dphi(1,met) bpt(JetFitterCOMBNN,2.00,30) bdphimet(JetFitterCOMBNN,2.00,30) mtt(JetFitterCOMBNN,2.00,30)",false,true,true,5);
	plotclass.MakePlots("bkg BbRepISR data","Mirjam","met meff(3) mindphi(3) metmeff(3) ht2(1) jpt(1) dphi(0,met) dphi(1,met) bpt(JetFitterCOMBNN,2.00,30) bdphimet(JetFitterCOMBNN,2.00,30) mtt(JetFitterCOMBNN,2.00,30)",false,true,true,5);
	plotclass.MakePlots("bkg BbRepISR data","Mirjam","nj(30)",false,true,true);
	//plotclass.MakePlots("bkg BbRepISR data","isrSb","nj(30)",false,true,true);
	//plotclass.MakePlots("bkg BbRepISR","isrSb+","nj(30)",false,true,true);
	*/
	
	//plotclass.MakeSignifs("BbISR","BestISR",true,10);
	
	//plotclass.MakePlots("bkg BbRepISR data","BestISR","metmeff(3)",false,true,true,5);
	
	/*
	plotclass.MakeSignifs("Bb","originalSb",true,5);
	plotclass.MakeSignifs("Bb","combined",true,5);
	plotclass.MakePlots("bkg BbRepISR","isrSb","dphi(0,met) bpt(JetFitterCOMBNN,2.00,30) met ht2(3)",false,true,true,5);
	plotclass.MakePlots("bkg BbRepISR","isrSb","nj(30) nbtag(JetFitterCOMBNN,2.00,30)",false,true,true);
	plotclass.MakePlots("bkg BbRepISR","BestISR","dphi(0,met) bpt(JetFitterCOMBNN,2.00,30) met ht2(3)",false,true,true,5);
	plotclass.MakePlots("bkg BbRepISR","BestISR","nj(30) nbtag(JetFitterCOMBNN,2.00,30)",false,true,true);
	*/
	
	//plotclass.MakePlots("bkg BbRep data","sr2base","met meff(2) mindphi(2) metmeff(2), ht2(2) mct",false,true,true,5);	
	//plotclass.MakePlots("bkg BbRep data","sr2base","nj(30)",false,true,true);	
	//plotclass.MakeSignifs("Bb","combined",true,5);
	//plotclass.MakeSignifs("Bb","met",true,5);
	//plotclass.MakeSignifs("Bb","lowermet",true,5);
	//plotclass.MakeSignifs("Bb","ht2",true,5);
	//plotclass.MakeSignifs("Bb","lowerjpt",true,5);
	//plotclass.MakeSignifs("Bb","lowjpt",true,5);
	//plotclass.MakeSignifs("Bb","highjpt",true,5);
	plotclass.MakePlots("bkg BbRep data","best","met",false,true,true,5);
	plotclass.MakeSignifs("Bb","best",true,5);
			
	/*
	plotclass.MakePlots("bkg BbRepISR","testISR","dphi(0,met) bpt(JetFitterCOMBNN,2.00,30) met mbb(JetFitterCOMBNN,2.00,30) ht2(3)",false,true,true,5);
	plotclass.MakePlots("bkg BbRepISR","testISR","nj(30) nbtag(JetFitterCOMBNN,2.00,30)",false,true,true);
	
	plotclass.AddCut("Bb_opt","isr dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,>1) mbb(JetFitterCOMBNN,2.00,30,<150)","m_{bb} < 150 GeV");
	plotclass.AddCut("Bb_opt","isr dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,>1) nj(30,<4)","njet<4");
	plotclass.AddCut("Bb_opt","isr dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,>1) nj(30,<5)","njet<5");
	plotclass.AddCut("Bb_opt","isr dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,>1) bpt(JetFitterCOMBNN,2.00,30,<110)","b-Jet p_{T} < 110 GeV");	
	plotclass.AddCut("Bb_opt","isr dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,>1) bpt(JetFitterCOMBNN,2.00,30,<110) ht2(3,<50)","b-Jet, H_{T4} < 50 GeV");
	plotclass.AddCut("Bb_opt","isr dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,>1) bpt(JetFitterCOMBNN,2.00,30,<110) ht2(3,<80)","b-Jet, H_{T4} < 80 GeV");
	plotclass.AddCut("Bb_opt","isr dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,>1) bpt(JetFitterCOMBNN,2.00,30,<110) nj(30,<4)","b-Jet, njets<4");
	plotclass.AddCut("Bb_opt","isr dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,>1) bpt(JetFitterCOMBNN,2.00,30,<110) nj(30,<5)","b-Jet, njets<5");
	plotclass.AddCut("Bb_opt","isr dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,>1) bpt(JetFitterCOMBNN,2.00,30,<110) ht2(3,<50) met(>250)","b-Jet, H_{T4} < 50 GeV, met>250");
	plotclass.AddCut("Bb_opt","isr dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,>1) bpt(JetFitterCOMBNN,2.00,30,<110) ht2(3,<80) met(>250)","b-Jet, H_{T4} < 80 GeV, met>250");
	plotclass.AddCut("Bb_opt","isr dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,>1) bpt(JetFitterCOMBNN,2.00,30,<110) nj(30,<4) met(>250)","b-Jet, njets<4, met>250");
	plotclass.AddCut("Bb_opt","isr dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,>1) bpt(JetFitterCOMBNN,2.00,30,<110) nj(30,<5) met(>250)","b-Jet, njets<5, met>250");

	plotclass.AddCut("testISR2","isr dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,>1) bpt(JetFitterCOMBNN,2.00,30,<110) ht2(3,<50)","b-Jet, H_{T4} < 50 GeV");
	plotclass.AddCut("testISR2","isr dphi(0,met,>2.5) nbtag(JetFitterCOMBNN,2.00,30,>1) bpt(JetFitterCOMBNN,2.00,30,<110) ht2(3,<50) met(>250)","b-Jet, H_{T4} < 50 GeV, met>250");
	plotclass.AddCut("testISR2","standard","m_{CT}>0 GeV");
	plotclass.AddCut("testISR2","standard mct(>100)","m_{CT}>100 GeV");
	plotclass.AddCut("testISR2","standard mct(>150)","m_{CT}>150 GeV");
	plotclass.AddCut("testISR2","standard mct(>200)","m_{CT}>200 GeV");
	
	plotclass.MakeSignifs("Bb","testISR2",true,10);
	plotclass.MakeSignifs("Bb","Bb_opt",true,10); */
	
	plotclass.Run();
}