예제 #1
0
파일: greyscale.C 프로젝트: Y--/root
void greyscale()
{
   TCanvas *c = new TCanvas("grey", "Grey Scale", 500, 500);
   c->SetBorderMode(0);

   Int_t   n = 200;   // tunable parameter
   Float_t n1 = 1./n;
   for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
         TBox *b = new TBox(n1*j, n1*(n-1-i), n1*(j+1), n1*(n-i));
         Float_t grey = Float_t(i*n+j)/(n*n);
         b->SetFillColor(TColor::GetColor(grey, grey, grey));
         b->Draw();
      }
   }
   TPad *p = new TPad("p","p",0.3, 0.3, 0.7,0.7);
   const char *guibackground = gEnv->GetValue("Gui.BackgroundColor", "");
   p->SetFillColor(TColor::GetColor(guibackground));
   p->Draw();
   p->cd();
   TText *t = new TText(0.5, 0.5, "GUI Background Color");
   t->SetTextAlign(22);
   t->SetTextSize(.09);
   t->Draw();

   c->SetEditable(kFALSE);
}
예제 #2
0
void highlight1()
{
   TCanvas *ch = new TCanvas("ch", "ch", 0, 0, 700, 500);
   const Int_t n = 500;
   Double_t x[n], y[n];
   TH1F *h[n];

   for (Int_t i = 0; i < n; i++) {
      h[i] = new TH1F(TString::Format("h_%02d", i), "", 100, -3.0, 3.0);
      // in practice gaus need reset parameters
      h[i]->FillRandom("gaus", 1000);
      h[i]->Fit("gaus", "Q");
      h[i]->SetMaximum(250); // for n > 200
      x[i] = i;
      y[i] = h[i]->GetFunction("gaus")->GetParameter(2);
   }

   TGraph *g = new TGraph(n, x, y);
   g->SetMarkerStyle(6);
   for (Int_t i = 0; i < n; i++) g->AddHighlight(i, h[i]);
   g->Draw("AP");
   g->SetHighlight();

   TPad *ph = new TPad("ph", "ph", 0.3, 0.4, 1.0, 1.0);
   ph->SetFillColor(kBlue - 10);
   ph->Draw();
   ph->cd();
   TText *info = new TText(0.5, 0.5, "please move the mouse over the graph");
   info->SetTextAlign(22);
   info->Draw();
   ch->cd();

   TGraph::SetHighlightPad(ph);
}
예제 #3
0
void DrawGraph(string name, TGraphErrors* graph)
{
    TCanvas* canvas = new TCanvas(name.c_str(),"",1200,900);
    canvas->SetFillColor(kWhite);
    canvas->cd();
    TPad* pad = new TPad();
    // left right bottom top
    pad->SetMargin(0.15,0.05,0.15,0.05);
    pad->SetTicks(1,1);
    pad->SetFillColor(kWhite);
    pad->Draw();
    pad->cd();
    TGraphErrors* oldgraph = graph;
    graph = new TGraphErrors(*graph);
    delete oldgraph;
    float textsize = 0.055;
    graph->SetMinimum(0);
    graph->SetMaximum(100);
    graph->SetTitle("");
    graph->GetXaxis()->SetTitle("#it{m}(#it{K^{#plus}K^{#minus}}) [MeV/#it{c}^{2}]");
    graph->GetYaxis()->SetTitle("Efficiency [%]");
    graph->SetLineColor(kBlack);
    graph->SetLineWidth(1);
    graph->SetMarkerSize(1);
    graph->SetMarkerStyle(8);
    graph->SetMarkerColor(kBlack);
    graph->Draw("AP");
    graph->GetXaxis()->SetTitleSize(textsize*1.2);
    graph->GetYaxis()->SetTitleSize(textsize*1.2);
    graph->GetXaxis()->SetLabelSize(textsize);
    graph->GetYaxis()->SetLabelSize(textsize);
    graph->GetXaxis()->SetTitleFont(132);
    graph->GetYaxis()->SetTitleFont(132);
    graph->GetXaxis()->SetLabelFont(132);
    graph->GetYaxis()->SetLabelFont(132);
    graph->GetYaxis()->CenterTitle();
    double _blurbx        = 0.75;
    double _blurby        = 0.80;
    string _blurbtext     = "#splitline{LHCb}{#scale[0.75]{Preliminary}}";
    TLatex* _blurb = new TLatex(_blurbx,_blurby,_blurbtext.c_str());
    _blurb->SetTextFont(132);
    _blurb->SetTextColor(1);
    _blurb->SetNDC(kTRUE);
    _blurb->SetTextAlign(11);
    _blurb->SetTextSize(0.07);
    _blurb->Draw();
    canvas->SaveAs((name+".pdf").c_str());
    canvas->Write();
}
예제 #4
0
/** 
 * Draw the Poisson estimate of the occupancy in a given ring.
 * 
 * @param p            List 
 * @param d            Detector
 * @param r            Ring
 * 
 * @return The occupancy (in percent)
 *
 * @deprecated Use QATrender instead
 * @ingroup pwglf_forward_scripts_qa
 */
Double_t
DrawRingOccupancy(TList* p, UShort_t d, Char_t r)
{
  if (!p) return 0;

  TList* ring = static_cast<TList*>(p->FindObject(Form("FMD%d%c",d,r)));
  if (!ring) { 
    Error("DrawOccupancy", "List FMD%d%c not found in %s",d,r,p->GetName());
    return 0;
  }
  
  TH1* corr = static_cast<TH1*>(ring->FindObject("occupancy"));
  if (!corr) { 
    Error("DrawRingOccupancy", "Histogram occupancy not found in FMD%d%c",
	  d, r);
    return 0;
  }
  corr->Rebin(4);

  TPad* pad = static_cast<TPad*>(gPad);
  pad->SetGridy();
  pad->SetGridx();
  pad->SetLogy();
  pad->SetFillColor(0);
    pad->SetRightMargin(0.01);
#if 0
  if (d == 3) { 
    pad->SetPad(pad->GetXlowNDC(), pad->GetYlowNDC(), .99, 
		 pad->GetYlowNDC()+pad->GetHNDC());
    pad->SetRightMargin(0.15);
  }
#endif

  corr->Draw("hist");

  TLatex* ltx = new TLatex(.95, .95, Form("FMD%d%c", d, r));
  ltx->SetNDC();
  ltx->SetTextAlign(33);
  ltx->SetTextSize(.08);
  ltx->Draw();

  return corr->GetMean();
}
예제 #5
0
void root_util::set_box(Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, 
                              Int_t lstyle, Double_t lwidth, Double_t lcolor,  Double_t fcolor, 
                              Int_t fptn, Char_t *loctype, Int_t gnum, Int_t xonly, Int_t yonly){

    //cout << pad_size <<endl;
    Int_t clen = clst.size();
    //cout << clen<<endl;
    Int_t cnum = gnum / pad_size;
    cout << "fcolor"<< fcolor<<endl;
    Int_t pad_num = gnum % pad_size + 1;
    //cout << pad_num<<endl;
    //cout << xmin <<endl;
    //cout << xmax <<endl;
    //cout << ymin <<endl;
    //cout << ymax <<endl;
    TPad *b;

    //b = new TEllipse(xmin, ymin, xmin, ymax);
    b = new TPad("box","box", xmin, ymin, xmax, ymax);
    b->SetFillColor(fcolor);
    clst[cnum]->cd(pad_num);
    b->Draw();
//    clst[cnum]->UseCurrentStyle();
}
예제 #6
0
void markerwarning()
{
   const int Nph = 14;
   double np_ph[Nph]  = {353.4,300.2,254.3,215.2,181.0,151.3,125.2,102.7, 83.3, 66.7, 52.5, 40.2, 30.2, 22.0};
   double nc_ph[Nph]  = {3.890,3.734,3.592,3.453,3.342,3.247,3.151,3.047,2.965,2.858,2.701,2.599,2.486,2.328};
   double npe_ph[Nph] = {10.068,9.004,8.086,7.304,6.620,6.026,5.504,5.054,4.666,4.334,4.050,3.804,3.604,3.440};
   double nce_ph[Nph] = {0.235,0.217,0.210,0.206,0.213,0.223,0.239,0.260,0.283,0.318,0.356,0.405,0.465,0.545};

   const int Nbr = 6;
   double np_br[Nbr]  = {357.0,306.0,239.0,168.0,114.0, 73.0};
   double nc_br[Nbr]  = {3.501,3.275,3.155,3.060,3.053,3.014};
   double npe_br[Nbr] = {8.000,11.000,10.000,9.000,9.000,8.000};
   double nce_br[Nbr] = {0.318,0.311,0.306,0.319,0.370,0.429};

   TGraphErrors *phUP = new TGraphErrors(Nph,np_ph,nc_ph,npe_ph,nce_ph);
   TGraphErrors *phDN = new TGraphErrors(Nph,np_ph,nc_ph,npe_ph,nce_ph);
   TGraphErrors *brUP = new TGraphErrors(Nbr,np_br,nc_br,npe_br,nce_br);
   TGraphErrors *brDN = new TGraphErrors(Nbr,np_br,nc_br,npe_br,nce_br);

   float Top_margin   = 0.;
   float Left_margin  = 0.025;
   float Right_margin = 0.005;
   float maxPlotPart  = 395;
   float Marker_Size  = 1.3;
   int   Marker_Style = 8;
  
   float Et_200_Min   = 0.71;
   float Et_200_Max   = 3.80;
   float Et_130_Min   = 1.21;
   float Et_130_Max   = 3.29;
  
   float Nc_200_Min   = 1.31;
   float Nc_200_Max   = 4.30;
   float Nc_130_Min   = 1.51;
   float Nc_130_Max   = 3.89;
  
   TCanvas *canvasNc = new TCanvas("canvasNc", "Multiplicity",630,10,600,500);
  
   gStyle->SetOptStat(0);
   canvasNc->SetFillColor(10);
   canvasNc->SetBorderSize(0);
  
   // Primitives in Nc200 pad
   TPad *padNcUP = new TPad("padNcUP","200 GeV",0.07,0.60,1.,1.00);
   padNcUP->Draw();
   padNcUP->cd();
   padNcUP->SetFillColor(10);
   padNcUP->SetFrameFillColor(10);
   padNcUP->SetBorderSize(0);
   padNcUP->SetLeftMargin(Left_margin);
   padNcUP->SetRightMargin(Right_margin);
   padNcUP->SetTopMargin(Top_margin+0.005);
   padNcUP->SetBottomMargin(0.00);
  
   TH1F* frameNcUP = new TH1F("frameNcUP","",100,0,maxPlotPart);
   frameNcUP->GetYaxis()->SetLabelOffset(0.005);
   frameNcUP->GetYaxis()->SetLabelSize(0.10);
   frameNcUP->SetMinimum(Nc_200_Min);
   frameNcUP->SetMaximum(Nc_200_Max);
   frameNcUP->SetNdivisions(505,"Y");
   frameNcUP->SetNdivisions(505,"X");
   frameNcUP->Draw();
  
   brUP->SetMarkerStyle(22);
   brUP->SetMarkerSize (2.0);
   brUP->Draw("P");                    
  
   phDN->SetMarkerStyle(23);
   phDN->SetMarkerSize (2);
   phDN->Draw("P");
  
   canvasNc->cd();
  
   // Primitives in Nc130 pad
   TPad *padNcDN = new TPad("padNcDN","130 GeV",0.07,0.02,1.,0.60);
   padNcDN->Draw();
   padNcDN->cd();
   padNcDN->SetFillColor(10);
   padNcDN->SetFrameFillColor(10);
   padNcDN->SetBorderSize(0);
   padNcDN->SetLeftMargin(Left_margin);
   padNcDN->SetRightMargin(Right_margin);
   padNcDN->SetTopMargin(Top_margin+0.005);
   padNcDN->SetBottomMargin(0.30);
  
   TH1F* frameNcDN = new TH1F("frameNcDN","",100,0,maxPlotPart);
   frameNcDN->GetYaxis()->SetLabelOffset(0.005);
   frameNcDN->GetYaxis()->SetLabelSize(0.07);
   frameNcDN->GetXaxis()->SetLabelOffset(0.005);
   frameNcDN->GetXaxis()->SetLabelSize(0.07);
   frameNcDN->SetMinimum(Nc_200_Min);
   frameNcDN->SetMaximum(Nc_200_Max);
   frameNcDN->SetNdivisions(505,"Y");
   frameNcDN->SetNdivisions(505,"X");
   frameNcDN->Draw();
  
   brDN->SetMarkerStyle(23);
   brDN->SetMarkerSize (2.0);
   brDN->Draw("P");                    
             
   phUP->SetMarkerStyle(22);
   phUP->SetMarkerSize (2);
   phUP->Draw("P");

   TLatex t1;
   t1.SetTextFont(12); t1.SetTextSize(0.0525);
   t1.DrawLatex(-5,0.6,"Non-symmetric symbols should be used carefully in plotting.�These two graphs show how misleading");
   t1.DrawLatex(-5,0.4,"a careless use of symbols can be.�The two plots represent the same data sets but because of a bad");
   t1.DrawLatex(-5,0.2,"symbol choice, the two plots on the top appear further apart than for the bottom example.");

   canvasNc->cd();
}
예제 #7
0
void wmj_fit_stack()
{
//=========Macro generated from canvas: default_Canvas/defaultCanvas
//=========  (Tue May  3 07:35:30 2016) by ROOT version6.04/10
   TCanvas *default_Canvas = new TCanvas("default_Canvas", "defaultCanvas",0,0,700,500);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   default_Canvas->SetHighLightColor(2);
   default_Canvas->Range(0,0,1,1);
   default_Canvas->SetFillColor(0);
   default_Canvas->SetBorderMode(0);
   default_Canvas->SetBorderSize(2);
   default_Canvas->SetTickx(1);
   default_Canvas->SetTicky(1);
   default_Canvas->SetLeftMargin(0.14);
   default_Canvas->SetRightMargin(0.05);
   default_Canvas->SetTopMargin(0.05);
   default_Canvas->SetBottomMargin(0.16);
   default_Canvas->SetFrameLineWidth(2);
   default_Canvas->SetFrameBorderMode(0);
  
// ------------>Primitives in pad: upperPad
   TPad *upperPad = new TPad("upperPad", "upperPad",0.005,0.05,0.995,0.995);
   upperPad->Draw();
   upperPad->cd();
   upperPad->Range(-0.1730123,-5358.989,1.06279,32919.5);
   upperPad->SetFillColor(0);
   upperPad->SetFillStyle(4000);
   upperPad->SetBorderMode(0);
   upperPad->SetBorderSize(2);
   upperPad->SetTickx(1);
   upperPad->SetTicky(1);
   upperPad->SetLeftMargin(0.14);
   upperPad->SetRightMargin(0.05);
   upperPad->SetTopMargin(0.05);
   upperPad->SetBottomMargin(0.14);
   upperPad->SetFrameLineWidth(2);
   upperPad->SetFrameBorderMode(0);
   upperPad->SetFrameLineWidth(2);
   upperPad->SetFrameBorderMode(0);
   
   Double_t h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fx3005[20] = {
   0.025,
   0.075,
   0.125,
   0.175,
   0.225,
   0.275,
   0.325,
   0.375,
   0.425,
   0.475,
   0.525,
   0.575,
   0.625,
   0.675,
   0.725,
   0.775,
   0.825,
   0.875,
   0.925,
   0.975};
   Double_t h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fy3005[20] = {
   0,
   0,
   9,
   26,
   118,
   315,
   881,
   1812,
   3086,
   4575,
   5856,
   6537,
   6824,
   6348,
   5662,
   4769,
   4941,
   6726,
   13179,
   28019};
   Double_t h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_felx3005[20] = {
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025};
   Double_t h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fely3005[20] = {
   0,
   0,
   2.943461,
   5.066015,
   10.37428,
   17.25528,
   29.18586,
   42.07053,
   55.05403,
   67.14059,
   76.02614,
   80.35326,
   82.10902,
   79.17591,
   74.74792,
   68.55976,
   69.79403,
   81.51372,
   114.3009,
   166.8895};
   Double_t h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fehx3005[20] = {
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025};
   Double_t h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fehy3005[20] = {
   1.147874,
   1.147874,
   4.110204,
   6.164324,
   11.37428,
   18.25528,
   30.18586,
   43.07053,
   56.05403,
   68.14059,
   77.02614,
   81.35326,
   83.10902,
   80.17591,
   75.74792,
   69.55976,
   70.79403,
   82.51372,
   115.3009,
   167.8895};
   TGraphAsymmErrors *grae = new TGraphAsymmErrors(20,h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fx3005,h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fy3005,h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_felx3005,h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fehx3005,h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fely3005,h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fehy3005);
   grae->SetName("h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]");
   grae->SetTitle("Histogram of combData_plot__muminus_ISO_");
   grae->SetFillColor(1);
   grae->SetFillStyle(0);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(20);
   
   TH1F *Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005 = new TH1F("Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005","Histogram of combData_plot__muminus_ISO_",100,0,1.1);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->SetMinimum(0);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->SetMaximum(31005.58);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->SetDirectory(0);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->SetStats(0);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->SetLineWidth(2);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->SetMarkerStyle(0);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetXaxis()->SetTitle("#it{p}_{T}^{#it{#mu}} / #it{p}_{T}^{#it{#mu}-jet}   ");
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetXaxis()->SetRange(1,91);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetXaxis()->SetNdivisions(1005);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetXaxis()->SetLabelFont(132);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetXaxis()->SetLabelOffset(0.02);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetXaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetXaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetXaxis()->SetTitleFont(132);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetYaxis()->SetTitle("Events / (0.05)");
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetYaxis()->SetLabelFont(132);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetYaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetYaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetYaxis()->SetTitleOffset(1.1);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetYaxis()->SetTitleFont(132);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetZaxis()->SetLabelFont(132);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetZaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetZaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]56300130023005);
   
   grae->Draw("e1pa");
   
   Double_t h5_fx7[47] = {
   -0.02439024,
   -0.02439024,
   0,
   1.0201e-08,
   0.04999999,
   0.05000001,
   0.09999999,
   0.1,
   0.15,
   0.15,
   0.2,
   0.2,
   0.25,
   0.25,
   0.3,
   0.3,
   0.35,
   0.35,
   0.4,
   0.4,
   0.45,
   0.45,
   0.5,
   0.5,
   0.55,
   0.55,
   0.6,
   0.6,
   0.65,
   0.65,
   0.7,
   0.7,
   0.75,
   0.75,
   0.8,
   0.8,
   0.85,
   0.85,
   0.9,
   0.9,
   0.95,
   0.95,
   1,
   1,
   1,
   1.02439,
   1.02439};
   Double_t h5_fy7[47] = {
   0,
   0,
   0,
   8.630173e-06,
   8.630173e-06,
   8.630173e-06,
   8.630173e-06,
   8.630173e-06,
   8.630173e-06,
   3.789762,
   3.789762,
   71.12063,
   71.12063,
   211.4394,
   211.4394,
   857.7007,
   857.7007,
   1798.534,
   1798.534,
   3099.609,
   3099.609,
   4425.901,
   4425.901,
   5601.584,
   5601.584,
   6533.687,
   6533.687,
   6910.208,
   6910.208,
   6392.171,
   6392.171,
   5777.193,
   5777.193,
   5020.919,
   5020.919,
   5207.834,
   5207.834,
   6798.159,
   6798.159,
   13033.98,
   13033.98,
   27939.27,
   27939.27,
   0,
   0,
   0,
   0};
   TGraph *graph = new TGraph(47,h5_fx7,h5_fy7);
   graph->SetName("h5");
   graph->SetTitle("Projection of ");

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#3333ff");
   graph->SetFillColor(ci);

   ci = TColor::GetColor("#3333ff");
   graph->SetLineColor(ci);
   graph->SetLineWidth(2);

   ci = TColor::GetColor("#3333ff");
   graph->SetMarkerColor(ci);
   graph->SetMarkerStyle(0);
   
   TH1F *Graph_h57 = new TH1F("Graph_h57","Projection of ",100,-0.1292683,1.129268);
   Graph_h57->SetMinimum(0);
   Graph_h57->SetMaximum(30733.2);
   Graph_h57->SetDirectory(0);
   Graph_h57->SetStats(0);
   Graph_h57->SetLineWidth(2);
   Graph_h57->SetMarkerStyle(0);
   Graph_h57->GetXaxis()->SetTitle("#it{p}_{T}^{#it{#mu}} / #it{p}_{T}^{#it{#mu}-jet}   ");
   Graph_h57->GetXaxis()->SetRange(11,90);
   Graph_h57->GetXaxis()->SetNdivisions(1005);
   Graph_h57->GetXaxis()->SetLabelFont(132);
   Graph_h57->GetXaxis()->SetLabelOffset(0.02);
   Graph_h57->GetXaxis()->SetLabelSize(0.05);
   Graph_h57->GetXaxis()->SetTitleSize(0.06);
   Graph_h57->GetXaxis()->SetTitleFont(132);
   Graph_h57->GetYaxis()->SetTitle("Events / (0.05)");
   Graph_h57->GetYaxis()->SetLabelFont(132);
   Graph_h57->GetYaxis()->SetLabelSize(0.05);
   Graph_h57->GetYaxis()->SetTitleSize(0.06);
   Graph_h57->GetYaxis()->SetTitleFont(132);
   Graph_h57->GetZaxis()->SetLabelFont(132);
   Graph_h57->GetZaxis()->SetLabelSize(0.05);
   Graph_h57->GetZaxis()->SetTitleSize(0.06);
   Graph_h57->GetZaxis()->SetTitleFont(132);
   graph->SetHistogram(Graph_h57);
   
   graph->Draw("f");
   
   Double_t sumBkgPdf_totbkg_fitW_fx8[47] = {
   -0.02439024,
   -0.02439024,
   0,
   1.0201e-08,
   0.04999999,
   0.05000001,
   0.09999999,
   0.1,
   0.15,
   0.15,
   0.2,
   0.2,
   0.25,
   0.25,
   0.3,
   0.3,
   0.35,
   0.35,
   0.4,
   0.4,
   0.45,
   0.45,
   0.5,
   0.5,
   0.55,
   0.55,
   0.6,
   0.6,
   0.65,
   0.65,
   0.7,
   0.7,
   0.75,
   0.75,
   0.8,
   0.8,
   0.85,
   0.85,
   0.9,
   0.9,
   0.95,
   0.95,
   1,
   1,
   1,
   1.02439,
   1.02439};
   Double_t sumBkgPdf_totbkg_fitW_fy8[47] = {
   0,
   0,
   0,
   2.878569e-06,
   2.878569e-06,
   2.878569e-06,
   2.878569e-06,
   2.878569e-06,
   2.878569e-06,
   3.789757,
   3.789757,
   71.12063,
   71.12063,
   211.4394,
   211.4394,
   855.0132,
   855.0132,
   1794.513,
   1794.513,
   3088.88,
   3088.88,
   4399.772,
   4399.772,
   5568.272,
   5568.272,
   6460.972,
   6460.972,
   6790.725,
   6790.725,
   6142.168,
   6142.168,
   5333.208,
   5333.208,
   4062.953,
   4062.953,
   3103.771,
   3103.771,
   2394.858,
   2394.858,
   1734.507,
   1734.507,
   1650.883,
   1650.883,
   0,
   0,
   0,
   0};
   graph = new TGraph(47,sumBkgPdf_totbkg_fitW_fx8,sumBkgPdf_totbkg_fitW_fy8);
   graph->SetName("sumBkgPdf_totbkg_fitW");
   graph->SetTitle("Projection of ");

   ci = TColor::GetColor("#ffff66");
   graph->SetFillColor(ci);

   ci = TColor::GetColor("#ffff66");
   graph->SetLineColor(ci);
   graph->SetLineWidth(2);

   ci = TColor::GetColor("#ffff66");
   graph->SetMarkerColor(ci);
   graph->SetMarkerStyle(0);
   
   TH1F *Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618 = new TH1F("Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618","Projection of ",100,-0.1292683,1.129268);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->SetMinimum(0);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->SetMaximum(7469.797);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->SetDirectory(0);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->SetStats(0);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->SetLineWidth(2);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->SetMarkerStyle(0);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetXaxis()->SetTitle("#it{p}_{T}^{#it{#mu}} / #it{p}_{T}^{#it{#mu}-jet}   ");
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetXaxis()->SetRange(11,90);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetXaxis()->SetNdivisions(1005);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetXaxis()->SetLabelFont(132);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetXaxis()->SetLabelOffset(0.02);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetXaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetXaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetXaxis()->SetTitleFont(132);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetYaxis()->SetTitle("Events / (0.05)");
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetYaxis()->SetLabelFont(132);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetYaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetYaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetYaxis()->SetTitleFont(132);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetZaxis()->SetLabelFont(132);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetZaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetZaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618->GetZaxis()->SetTitleFont(132);
   graph->SetHistogram(Graph_Graph_Graph_Graph_sumBkgPdf_totbkg_fitW131618);
   
   graph->Draw("f");
   
   Double_t sumPdf_Norm[muminus_ISO_]_fx9[47] = {
   -0.02439024,
   -0.02439024,
   0,
   1.0201e-08,
   0.04999999,
   0.05000001,
   0.09999999,
   0.1,
   0.15,
   0.15,
   0.2,
   0.2,
   0.25,
   0.25,
   0.3,
   0.3,
   0.35,
   0.35,
   0.4,
   0.4,
   0.45,
   0.45,
   0.5,
   0.5,
   0.55,
   0.55,
   0.6,
   0.6,
   0.65,
   0.65,
   0.7,
   0.7,
   0.75,
   0.75,
   0.8,
   0.8,
   0.85,
   0.85,
   0.9,
   0.9,
   0.95,
   0.95,
   1,
   1,
   1,
   1.02439,
   1.02439};
   Double_t sumPdf_Norm[muminus_ISO_]_fy9[47] = {
   0,
   0,
   0,
   8.630165e-06,
   8.630165e-06,
   8.630165e-06,
   8.630165e-06,
   8.630165e-06,
   8.630165e-06,
   3.789756,
   3.789756,
   71.12054,
   71.12054,
   211.4391,
   211.4391,
   857.6998,
   857.6998,
   1798.532,
   1798.532,
   3099.606,
   3099.606,
   4425.897,
   4425.897,
   5601.578,
   5601.578,
   6533.68,
   6533.68,
   6910.201,
   6910.201,
   6392.164,
   6392.164,
   5777.187,
   5777.187,
   5020.914,
   5020.914,
   5207.829,
   5207.829,
   6798.152,
   6798.152,
   13033.97,
   13033.97,
   27939.24,
   27939.24,
   0,
   0,
   0,
   0};
   graph = new TGraph(47,sumPdf_Norm[muminus_ISO_]_fx9,sumPdf_Norm[muminus_ISO_]_fy9);
   graph->SetName("sumPdf_Norm[muminus_ISO_]");
   graph->SetTitle("Projection of ");

   ci = TColor::GetColor("#ff0000");
   graph->SetFillColor(ci);
   graph->SetFillStyle(0);

   ci = TColor::GetColor("#ff0000");
   graph->SetLineColor(ci);
   graph->SetLineWidth(2);

   ci = TColor::GetColor("#ff0000");
   graph->SetMarkerColor(ci);
   graph->SetMarkerStyle(0);
   
   TH1F *Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839 = new TH1F("Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839","Projection of ",100,-0.1292683,1.129268);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->SetMinimum(0);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->SetMaximum(30733.17);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->SetDirectory(0);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->SetStats(0);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->SetLineWidth(2);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->SetMarkerStyle(0);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetXaxis()->SetTitle("#it{p}_{T}^{#it{#mu}} / #it{p}_{T}^{#it{#mu}-jet}   ");
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetXaxis()->SetRange(11,90);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetXaxis()->SetNdivisions(1005);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetXaxis()->SetLabelFont(132);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetXaxis()->SetLabelOffset(0.02);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetXaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetXaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetXaxis()->SetTitleFont(132);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetYaxis()->SetTitle("Events / (0.05)");
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetYaxis()->SetLabelFont(132);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetYaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetYaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetYaxis()->SetTitleFont(132);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetZaxis()->SetLabelFont(132);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetZaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetZaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839->GetZaxis()->SetTitleFont(132);
   graph->SetHistogram(Graph_Graph_Graph_Graph_sumPdf_Norm[muminus_ISO_]151839);
   
   graph->Draw("");
   
   Double_t h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fx3006[20] = {
   0.025,
   0.075,
   0.125,
   0.175,
   0.225,
   0.275,
   0.325,
   0.375,
   0.425,
   0.475,
   0.525,
   0.575,
   0.625,
   0.675,
   0.725,
   0.775,
   0.825,
   0.875,
   0.925,
   0.975};
   Double_t h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fy3006[20] = {
   0,
   0,
   9,
   26,
   118,
   315,
   881,
   1812,
   3086,
   4575,
   5856,
   6537,
   6824,
   6348,
   5662,
   4769,
   4941,
   6726,
   13179,
   28019};
   Double_t h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_felx3006[20] = {
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025};
   Double_t h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fely3006[20] = {
   0,
   0,
   2.943461,
   5.066015,
   10.37428,
   17.25528,
   29.18586,
   42.07053,
   55.05403,
   67.14059,
   76.02614,
   80.35326,
   82.10902,
   79.17591,
   74.74792,
   68.55976,
   69.79403,
   81.51372,
   114.3009,
   166.8895};
   Double_t h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fehx3006[20] = {
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025,
   0.025};
   Double_t h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fehy3006[20] = {
   1.147874,
   1.147874,
   4.110204,
   6.164324,
   11.37428,
   18.25528,
   30.18586,
   43.07053,
   56.05403,
   68.14059,
   77.02614,
   81.35326,
   83.10902,
   80.17591,
   75.74792,
   69.55976,
   70.79403,
   82.51372,
   115.3009,
   167.8895};
   grae = new TGraphAsymmErrors(20,h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fx3006,h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fy3006,h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_felx3006,h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fehx3006,h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fely3006,h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]_fehy3006);
   grae->SetName("h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]");
   grae->SetTitle("Histogram of combData_plot__muminus_ISO_");
   grae->SetFillColor(1);
   grae->SetFillStyle(0);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(20);
   
   TH1F *Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006 = new TH1F("Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006","Histogram of combData_plot__muminus_ISO_",100,0,1.1);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->SetMinimum(0);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->SetMaximum(31005.58);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->SetDirectory(0);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->SetStats(0);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->SetLineWidth(2);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->SetMarkerStyle(0);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetXaxis()->SetTitle("#it{p}_{T}^{#it{#mu}} / #it{p}_{T}^{#it{#mu}-jet}   ");
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetXaxis()->SetRange(1,91);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetXaxis()->SetNdivisions(1005);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetXaxis()->SetLabelFont(132);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetXaxis()->SetLabelOffset(0.02);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetXaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetXaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetXaxis()->SetTitleFont(132);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetYaxis()->SetTitle("Events / (0.05)");
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetYaxis()->SetLabelFont(132);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetYaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetYaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetYaxis()->SetTitleOffset(1.1);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetYaxis()->SetTitleFont(132);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetZaxis()->SetLabelFont(132);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetZaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetZaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_Graph_Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]563001300230053006);
   
   grae->Draw("e1p");
   
   TLegend *leg = new TLegend(0.2,0.53,0.6,0.78,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextFont(132);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(2);
   leg->SetFillColor(10);
   leg->SetFillStyle(0);
   TLegendEntry *entry=leg->AddEntry("h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]","Data, #sqrt{s}=8 TeV","lep");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(20);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   entry=leg->AddEntry("h5","Electroweak","f");

   ci = TColor::GetColor("#3333ff");
   entry->SetFillColor(ci);
   entry->SetFillStyle(1001);

   ci = TColor::GetColor("#3333ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   entry=leg->AddEntry("sumBkgPdf_totbkg_fitW","QCD","f");

   ci = TColor::GetColor("#ffff66");
   entry->SetFillColor(ci);
   entry->SetFillStyle(1001);

   ci = TColor::GetColor("#ffff66");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   entry=leg->AddEntry("sumPdf_Norm[muminus_ISO_]","Fit","l");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   leg->Draw();
   
   TPaveText *pt = new TPaveText(0.2,0.8,0.4,0.87,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillStyle(0);
   pt->SetLineWidth(2);
   pt->SetTextFont(132);
   TText *AText = pt->AddText("LHCb");
   pt->Draw();
   
   TH1F *Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy = new TH1F("Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy","Histogram of combData_plot__muminus_ISO_",100,0,1.1);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->SetMinimum(0);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->SetMaximum(31005.58);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->SetDirectory(0);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->SetStats(0);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->SetLineWidth(2);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->SetMarkerStyle(0);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetXaxis()->SetTitle("#it{p}_{T}^{#it{#mu}} / #it{p}_{T}^{#it{#mu}-jet}   ");
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetXaxis()->SetRange(1,91);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetXaxis()->SetNdivisions(1005);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetXaxis()->SetLabelFont(132);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetXaxis()->SetLabelOffset(0.02);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetXaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetXaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetXaxis()->SetTitleFont(132);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetYaxis()->SetTitle("Events / (0.05)");
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetYaxis()->SetLabelFont(132);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetYaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetYaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetYaxis()->SetTitleOffset(1.1);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetYaxis()->SetTitleFont(132);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetZaxis()->SetLabelFont(132);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetZaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetZaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->GetZaxis()->SetTitleFont(132);
   Graph_Graph_Graph_Graph_h_combData_Cut[samples == samples::fitW_etam_0 || samples == samples::fitW_etam_1 || samples == samples::fitW_etam_2 || samples == samples::fitW_etam_3]5630013002_copy->Draw("sameaxis");
   upperPad->Modified();
   default_Canvas->cd();
   default_Canvas->Modified();
   default_Canvas->cd();
   default_Canvas->SetSelected(default_Canvas);
}
예제 #8
0
void plottingmacro_IVF()
{


  double fa = 0.46502;
  double fb = 0.53498;
  bool debug_ = true;

  //  std::string path("Nov10thFall11Plots/");
  //  std::string path("Nov10Fall1160MTopSlimPlots/");
  std::string path("Nov10Fall1160MTopIVFPlots_b/");

  if(debug_)
    std::cout << "Init the style form setTDRStyle" << std::endl;
  setTDRStyle();
  gStyle->SetErrorX(0.5);
  gROOT->ForceStyle();
  initOptions();
  

  if(debug_)
    std::cout << "Init the sample" << std::endl;
  //  std::vector<Sample> s = Nov10thDiJetPtUpdatedSlimHistos();
  //std::vector<Sample> s = Nov10Fall1160MTopSlimHistos();
  std::vector<Sample> s = Nov10Fall1160MTopIVFHistos();

  Sample data(1,"fake data","S1.root",0,true,1000);

  if(debug_)
    std::cout << "Init the data sample" << std::endl;
  for(size_t i=0;i< s.size();i++) if(s[i].data) {data=s[i];break;}

  if(debug_)
    std::cout << "Ls data sample" << std::endl;
  data.file()->ls(); 

  if(debug_)
    std::cout << "Init the mc sample" << std::endl;
  for(size_t i=0;i< s.size();i++) s[i].dump(1,fa,fb);

  std::vector<std::string> names;

  if(debug_)
    std::cout << "Get List of Keys" << std::endl;
  TList * subs = data.file()->GetListOfKeys();
  for(size_t i=0;i< subs->GetSize();i++)
    {
      TString nn = subs->At(i)->GetName();
      if( nn.Contains(TRegexp("Count*")) )
	continue;
      if(debug_)
	std::cout << "Get List of Keys in subdirs" << std::endl;
      TList * objs = ((TDirectoryFile *)data.file()->Get(subs->At(i)->GetName()))->GetListOfKeys();
      for(size_t j=0;j< objs->GetSize();j++)
	{
	  if(debug_)
	    std::cout << "Name = " << subs->At(i)->GetName()+std::string("/")  + objs->At(j)->GetName() << std::endl;
	  names.push_back(subs->At(i)->GetName()+std::string("/")  + objs->At(j)->GetName());
	  //      std::cout << subs->At(i)->GetName() << "/"  << objs->At(j)->GetName() << std::endl;
	  //TODO: select plots via regexp
	}
    }


  if(debug_)
    std::cout << "Starting plotting" << std::endl;

  std::string process;

  for(size_t i = 0 ; i < names.size() ; i++) 
    {
      
      std::map<std::string,TH1F *> grouped;
      TString n=names[i];
      //      if(!n.Contains(TRegexp("VlightRegionHZee/HiggsPtVlightRegionHZee"))) continue;
      //      if(!n.Contains(TRegexp("VlightRegionHZee/ZPtVlightRegionHZee"))) continue;
      //      if(!n.Contains(TRegexp("VlightRegionHZee"))) continue;
      //      if(!n.Contains(TRegexp("ZSVRegionZmmSV"))) continue;
      //      if(!n.Contains(TRegexp("ZSVRegionZeeSV"))) continue;
      //      if(!n.Contains(TRegexp("ZSVRegionZcombSV"))) continue;
      //      if(!n.Contains(TRegexp("ZSVPureRegionZcombSV"))) continue;
      //      if(!n.Contains(TRegexp("ZSVTTbarPureRegionZcombSV"))) continue;
      if(!n.Contains(TRegexp("TTbarRegionZeeSVJets"))) continue;

      if(n.Contains(TRegexp("RegionHZcomb")))
	process = "Z(l^{+}l^{-})H(b#bar{b})";
      if(n.Contains(TRegexp("RegionHZmm")))
	process = "Z(#mu^{+}#mu^{-})H(b#bar{b})";
      if(n.Contains(TRegexp("RegionHZee")))
	process = "Z(e^{+}e^{-})H(b#bar{b})";

      if(debug_)
	std::cout << "Creating the Canvas" << std::endl;

      TCanvas *c = new TCanvas();
      c->SetLogy(false);
      c->SetTitle(names[i].c_str());

      if(debug_)
	std::cout << "Creating histograms" << std::endl;
  
      TH1F *hd = ((TH1F*)data.file()->Get(names[i].c_str()));
      hd->Sumw2();
      Options o=options[names[i]];
      //      hd->Rebin(o.rebin);
      hd->SetMarkerStyle(20);
      hd->GetXaxis()->SetLabelOffset(99);
      hd->SetYTitle(o.yaxis.c_str());
      double nbin = hd->GetNbinsX();
      double min_bin = hd->GetXaxis()->GetXmin();
      double max_bin = hd->GetXaxis()->GetXmax();
      TH1F *hmc = new TH1F("hmc","hmc", nbin, min_bin, max_bin);
      hmc->SetFillColor(kWhite);
      hmc->Sumw2();
      //      hmc->Rebin(o.rebin);

      if(debug_)
	std::cout << "Creating the THStack and Legend" << std::endl;
      THStack * sta = new THStack("sta",hd->GetTitle());
      TLegend * l = new TLegend(o.legendx1,o.legendy1,o.legendx2,o.legendy2); //0.7,0.1,0.9,0.6);
      l->SetFillColor(kWhite);
      l->SetBorderSize(0);
      l->SetTextFont(62);
      l->SetTextSize(0.03);
      if(debug_)
	std::cout << "Adding data to the legend" << std::endl;  
      l->AddEntry(hd, "Data","P");
      if(debug_)
	std::cout << "Adding MC to the THStack" << std::endl;  

      //with the proper trigger eff
      //      double SF[] = {1.01,1.03,1.00};
      //      double SF[] = {1.03,1.054,1.032};
      double SF[] = {1.0,1.0,1.0};

      if(debug_){
	for(int i = 0; i< 3; ++i)
	  std::cout << "SF [" << i << "] = " << SF[i] << std::endl;
      }

      double mcIntegral=0;
      for(size_t j=0;j< s.size() ;j++) 
	{ 
	  if(!s[j].data) 
	    {
	      if(debug_)
		std::cout << "Creating TH1F from file " << s[j].name << std::endl;  
	      TH1F * h = ((TH1F*)s[j].file()->Get(names[i].c_str()));
	      h->Sumw2();
	      if(debug_){
		std::cout << "TH1F created from file " << s[j].name << std::endl;  
		std::cout << "Scaling : " << s[j].scale(data.lumi(),fa,fb) << std::endl;  
		std::cout << "Scaling with SF : " << s[j].scale(data.lumi(),fa,fb,SF) << std::endl;  
		std::cout << "Histo integral before scaling = " << h->Integral() << std::endl;
	      }
	      h->Scale(s[j].scale(data.lumi(),fa,fb,SF));
	      if(debug_){
		std::cout << "Histo integral after scaling = " << h->Integral() << std::endl;
		std::cout << "Managing style... " << std::endl;  
	      }
	      h->SetLineWidth(1.);
	      h->SetFillColor(s[j].color);
	      h->SetLineColor(s[j].color);
	      //	      h->Rebin(options[names[i]].rebin);
	      if(debug_)
		std::cout << "Cloning and update legend " << std::endl;  
	      if(grouped.find(s[j].name) == grouped.end()){
		l->AddEntry(h,s[j].name.c_str(),"F");
	      }
	      std::cout << "Sample : " << s[j].name << " - Integral for plot " << names[i] << " = " << h->Integral(-10000,10000) << std::endl;
	      mcIntegral += h->Integral();
	      sta->Add(h);
	      hmc->Add(h);	      
	      //TO FIX grouped map
	      // sovrascrive histo con lo stesso nome tipo VV o ST etc...
	      grouped[s[j].name]=(TH1F *)h->Clone(("_"+names[i]).c_str());
	    }
	}

      if(debug_){
	std::cout << "Data total = " << hd->Integral() << std::endl;
	std::cout << "MC = " << mcIntegral << std::endl;
	std::cout << "Data/MC = " << hd->Integral()/mcIntegral << std::endl;
      }

      TPad * TopPad = new TPad("TopPad","Top Pad",0.,0.3,1.,1. ) ;
      TPad * BtmPad = new TPad("BtmPad","Bottom Pad",0.,0.,1.,0.313 ) ;
      TopPad->SetBottomMargin(0.02);
      BtmPad->SetTopMargin(0.0);
      BtmPad->SetFillStyle(4000);
      TopPad->SetFillStyle(4000);
      BtmPad->SetFillColor(0);
      BtmPad->SetBottomMargin(0.35);
      TopPad->Draw() ;
      BtmPad->Draw() ;
      std::cout << "hd maximum = " << hd->GetMaximum() << "  sta maximum = " << sta->GetMaximum() << std::endl;
      double maxY;
      if(hd->GetMaximum() > sta->GetMaximum()) maxY = (hd->GetMaximum())*1.5;
      else maxY = (sta->GetMaximum())*1.5;
      TopPad->cd();
      hd->Draw("E1X0");
      sta->Draw("sameHIST");
      hmc->Draw("sameE2");
      hmc->SetFillColor(2);
      hmc->SetMarkerSize(0);
      hmc->SetFillStyle(3013);
      hd->Draw("E1X0same");
      l->Draw("same");
      std::cout << "Set Maximum to = " << maxY << std::endl;
      hd->GetYaxis()->SetRangeUser(0.,maxY);
      hd->GetXaxis()->SetRangeUser(options[names[i]].min,options[names[i]].max);

      BtmPad->cd();
      std::cout << "Division" << std::endl;

      TH1D * divisionErrorBand = (TH1D*)(hmc)->Clone("divisionErrorBand");
      divisionErrorBand->Sumw2();
      divisionErrorBand->Divide(hmc);
      divisionErrorBand->Draw("E2");      
      divisionErrorBand->SetMaximum(2.49);
      divisionErrorBand->SetMinimum(0);
      divisionErrorBand->SetMarkerStyle(20);
      divisionErrorBand->SetMarkerSize(0.55);
      divisionErrorBand->GetXaxis()->SetTitleOffset(1.12);
      divisionErrorBand->GetXaxis()->SetLabelSize(0.12);
      divisionErrorBand->GetXaxis()->SetTitleSize(0.5);
      divisionErrorBand->GetYaxis()->SetTitle("Data/MC");
      divisionErrorBand->GetYaxis()->SetLabelSize(0.12);
      divisionErrorBand->GetYaxis()->SetTitleSize(0.12);
      divisionErrorBand->GetYaxis()->SetTitleOffset(0.40);
      divisionErrorBand->GetYaxis()->SetNdivisions(505);
      //divisionErrorBand->UseCurrentStyle();
      divisionErrorBand->SetFillColor(2);
      divisionErrorBand->SetFillStyle(3001);
      divisionErrorBand->SetMarkerSize(0.);

      TH1D * division = (TH1D*)(hd)->Clone("division");
      division->Sumw2();
      division->Divide(hmc);
//       division->SetMaximum(2.5);
//       division->SetMinimum(0);
//       division->SetMarkerStyle(20);
//       division->SetMarkerSize(0.55);
//       division->GetXaxis()->SetLabelSize(0.12);
//       division->GetXaxis()->SetTitleSize(0.14);
//       division->GetYaxis()->SetLabelSize(0.10);
//       division->GetYaxis()->SetTitleSize(0.10);
//      division->GetYaxis()->SetTitle("Data/MC");
      Double_t min = division->GetXaxis()->GetXmin();
      Double_t max = division->GetXaxis()->GetXmax();
      division->Draw("E1X0same");

      TLine *line = new TLine(min, 1.0, max, 1.0);
      line->SetLineColor(kRed);
      line->Draw("same");
      
      TLegend * leg3 =new TLegend(0.50,0.86,0.69,0.96);
      leg3->AddEntry(divisionErrorBand,"MC uncert. (stat.)","f");
      leg3->SetFillColor(0);
      leg3->SetLineColor(0);
      leg3->SetShadowColor(0);
      leg3->SetTextFont(62);
      leg3->SetTextSize(0.06);
      leg3->Draw();

      TPaveText *pave = new TPaveText(0.15,0.85,0.32,0.96,"brNDC");
      pave->SetTextAlign(12);
      pave->SetLineColor(0);
      pave->SetFillColor(0);
      pave->SetShadowColor(0);
      //TText *text = pave->AddText(Form("#chi_{#nu}^{2} = %.3f, K_{s} = %.3f",histDt->Chi2Test(histCopyMC5,"UWCHI2/NDF"),histDt->KolmogorovTest(histCopyMC5))); // stat + sys
      TText *text = pave->AddText(Form("#chi_{#nu}^{2} = %.3f, K_{s} = %.3f",hd->Chi2Test(hmc,"UWCHI2/NDF"),hd->KolmogorovTest(hmc))); // stat only
      text->SetTextFont(62);
      text->SetTextSize(0.08);
      pave->Draw();

      TopPad->cd();
      TLatex latex;
      latex.SetNDC();
      latex.SetTextAlign(12);
      latex.SetTextSize(0.052);
      latex.DrawLatex(0.17,0.89,"CMS Preliminary");
      latex.SetTextSize(0.04);
      latex.DrawLatex(0.17,0.84,"#sqrt{s} = 7 TeV, L = 4.7 fb^{-1}");
      //      latex.DrawLatex(0.17,0.79,"Z(e^{+}e^{-})H(b#bar{b})");
      latex.DrawLatex(0.17,0.79,process.c_str());
      c->Update();
      std::string cName= hd->GetName();
      cName += "_bare.pdf";
      cName = path+cName;
      c->Print(cName.c_str(),"pdf");

//       std::cout << names[i] << " d: " <<  hd->Integral() << " ";
//       THStack * sta2 = new THStack("sta2",hd->GetTitle());
//       float tot=0;
//       float toterr2=0;

//       if(debug_)
// 	std::cout << "Putting the iterator in the for loop" << std::endl;
//       for(std::map<std::string,TH1F *>::reverse_iterator it=grouped.rbegin(); it!=grouped.rend();++it)
//  	{
// 	  if(debug_)
// 	    std::cout << "Using the iterator" << std::endl;
// 	  std::cout << (*it).first << " " << (*it).second->Integral() << " | " << std::endl ;
// 	  if((*it).second->GetEntries() > 0) {
// 	    float er=1.*sqrt((*it).second->GetEntries())/(*it).second->GetEntries()*(*it).second->Integral();
// 	    toterr2+=er*er;
// 	  }
// 	  tot+=(*it).second->Integral();
// 	  sta2->Add(it->second);
//  	}
//       std::cout << " Tot: " << tot << "+-" << sqrt(toterr2) <<  " SF: " << hd->Integral()/tot << std::endl;
//       TCanvas *c2 = new TCanvas();
//       c2->SetTitle(names[i].c_str());
//       std::cout << "hd maximum = " << hd->GetMaximum() << "  sta2 maximum = " << sta2->GetMaximum() << std::endl;
//       if(hd->GetMaximum() > sta2->GetMaximum()) maxY =  hd->GetBinContent(hd->GetMaximumBin()) * 1.5;
//       else maxY = ( sta2->GetMaximum())*1.5;
//       //      hd->Draw("E1"); 
//       sta2->Draw("PADSHIST");
//       //    hd->Draw("E1same");
//       //      l->Draw("same");
//       std::cout << "Set Maximum to = " << maxY << std::endl;
//       hd->GetYaxis()->SetRangeUser(0.,maxY);
//       hd->GetXaxis()->SetRangeUser(options[names[i]].min,options[names[i]].max);
//       c2->Update();

//       std::string c2Name = hd->GetName();
//       c2Name = path+c2Name;
//       c2Name += "_norm.pdf";
//       c2->Print(c2Name.c_str(),"pdf");  

    }

}
예제 #9
0
void RDK2AnalysisPlotter::makeEPPlot(CoDet detType)
{
    gROOT->cd();
    TCanvas* theCanvas;
    TPad* mainPad;
    TPad* titlePad;
    TPad* pTPad;
    TPad* eEPad;
    TPad* pEPad;
    TPad* pTPadSubs[3];
    TPad* eEPadSubs[3];
    TPad* pEPadSubs[3];


    int numTitleLines=getTitleBoxLines( detType);
    int canvasNumPixelsYPlot=600;
    int canvasNumPixelsYPlots=3*canvasNumPixelsYPlot;
    int canvasNumPixelsYTitle=40*numTitleLines;
    int canvasNumPixelsY=canvasNumPixelsYPlots+canvasNumPixelsYTitle;

    theCanvas = new TCanvas("EPExpMCAnalysisComparisonPlot","EPExpMCAnalysisComparisonPlot",10,10,1200,canvasNumPixelsY);
     mainPad=(TPad*) theCanvas->GetPad(0);


    double ylow,yhigh;

    yhigh=1;
    ylow=1.-canvasNumPixelsYTitle/(double)canvasNumPixelsY;
    titlePad=new TPad("titlePad", "titlePad", 0., ylow, 1., yhigh, -1, 1, 1);

    yhigh=1.-canvasNumPixelsYTitle/(double)canvasNumPixelsY;
    ylow=1.-canvasNumPixelsYTitle/(double)canvasNumPixelsY-canvasNumPixelsYPlot/(double)canvasNumPixelsY;
    pTPad=new TPad("pTPad", "pTPad", 0., ylow, 1., yhigh, -1, 1, 1);

    yhigh=1.-canvasNumPixelsYTitle/(double)canvasNumPixelsY-canvasNumPixelsYPlot/(double)canvasNumPixelsY;
    ylow=1.-canvasNumPixelsYTitle/(double)canvasNumPixelsY- 2*canvasNumPixelsYPlot/(double)canvasNumPixelsY;
    eEPad=new TPad("eEPad", "eEPad", 0., ylow, 1., yhigh, -1, 1, 1);

    yhigh=1.-canvasNumPixelsYTitle/(double)canvasNumPixelsY-2*canvasNumPixelsYPlot/(double)canvasNumPixelsY;
    ylow=0;
    pEPad=new TPad("pEPad", "pEPad", 0., ylow, 1., yhigh, -1, 1, 1);

    titlePad->Draw();
    pTPad->Draw();
    eEPad->Draw();
    pEPad->Draw();



//    titlePad=(TPad*) theCanvas->GetPad(1);
//    pTPad=(TPad*) theCanvas->GetPad(2);
//    eEPad=(TPad*) theCanvas->GetPad(3);
//    pEPad=(TPad*) theCanvas->GetPad(4);

    titlePad->SetMargin(0.05,0.0,0.0,0.0);
    pTPad->SetMargin(0.05,0.0,0.0,0.05);
    pEPad->SetMargin(0.05,0.0,0.0,0.05);
    eEPad->SetMargin(0.05,0.0,0.0,0.05);


    if(numExp+numMC >1)
    {
        pTPad->Divide(2);
        eEPad->Divide(2);
        pEPad->Divide(2);

        pTPadSubs[0]=(TPad*) pTPad->GetPad(1);
        eEPadSubs[0]=(TPad*) eEPad->GetPad(1);
        pEPadSubs[0]=(TPad*) pEPad->GetPad(1);

        TPad* tempPad;
        tempPad=(TPad*) pTPad->GetPad(2);
        tempPad->Divide(1,2);
        pTPadSubs[1]=(TPad*) tempPad->GetPad(1);
        pTPadSubs[2]=(TPad*) tempPad->GetPad(2);

        tempPad=(TPad*) pEPad->GetPad(2);
        tempPad->Divide(1,2);
        pEPadSubs[1]=(TPad*) tempPad->GetPad(1);
        pEPadSubs[2]=(TPad*) tempPad->GetPad(2);

        tempPad=(TPad*) eEPad->GetPad(2);
        tempPad->Divide(1,2);
        eEPadSubs[1]=(TPad*) tempPad->GetPad(1);
        eEPadSubs[2]=(TPad*) tempPad->GetPad(2);

        TPad* allBasePads[10]={titlePad,pTPadSubs[0],pTPadSubs[1],pTPadSubs[2],eEPadSubs[0],eEPadSubs[1],eEPadSubs[2],pEPadSubs[0],pEPadSubs[1],pEPadSubs[2]};
        for (int i = 1;i< 10;i++)
        {
            allBasePads[i]->SetGrid(1,1);
            allBasePads[i]->SetTickx(1);
            allBasePads[i]->SetTicky(1);
        }
        pTPadSubs[0]->SetMargin(0.13,0.1,.1,0.1);
        pEPadSubs[0]->SetMargin(0.13,0.1,.1,0.1);
        eEPadSubs[0]->SetMargin(0.13,0.1,.1,0.1);

        pTPadSubs[1]->SetMargin(0.1,0.1,.1,0.1);
        pEPadSubs[1]->SetMargin(0.1,0.1,.1,0.1);
        eEPadSubs[1]->SetMargin(0.1,0.1,.1,0.1);

        pTPadSubs[2]->SetMargin(0.1,0.1,.1,0.1);
        pEPadSubs[2]->SetMargin(0.1,0.1,.1,0.1);
        eEPadSubs[2]->SetMargin(0.1,0.1,.1,0.1);
        //Plot pT

        pTPadSubs[0]->cd(); drawPlot(detType, PLOTVAR_PT,PLOT_COMP);
        pTPadSubs[1]->cd(); drawPlot(detType, PLOTVAR_PT,PLOT_RESID);
        pTPadSubs[2]->cd(); drawPlot(detType, PLOTVAR_PT,PLOT_NORMRESID);


        //Plot eE
        eEPadSubs[0]->cd(); drawPlot(detType, PLOTVAR_EE,PLOT_COMP);
        eEPadSubs[1]->cd(); drawPlot(detType, PLOTVAR_EE,PLOT_RESID);
        eEPadSubs[2]->cd(); drawPlot(detType, PLOTVAR_EE,PLOT_NORMRESID);

        //Plot pE
        pEPadSubs[0]->cd(); drawPlot(detType, PLOTVAR_PE,PLOT_COMP);
        pEPadSubs[1]->cd(); drawPlot(detType, PLOTVAR_PE,PLOT_RESID);
        pEPadSubs[2]->cd(); drawPlot(detType, PLOTVAR_PE,PLOT_NORMRESID);
    }
    else
    {
        TPad* allBasePads[4]={titlePad,pTPad,eEPad,pEPad};
        for (int i = 1;i< 4;i++)
        {
            allBasePads[i]->SetGrid(1,1);
            allBasePads[i]->SetTickx(1);
            allBasePads[i]->SetTicky(1);
        }
        pTPad->SetMargin(0.13,0.1,.1,0.1);
        pEPad->SetMargin(0.13,0.1,.1,0.1);
        eEPad->SetMargin(0.13,0.1,.1,0.1);
        pTPad->cd(); drawPlot(detType, PLOTVAR_PT,PLOT_COMP);
        eEPad->cd(); drawPlot(detType, PLOTVAR_EE,PLOT_COMP);
        pEPad->cd(); drawPlot(detType, PLOTVAR_PE,PLOT_COMP);

    }
    mainPad->SetFillColor(kGray);

    ///Make Title box
    titlePad->cd();
    titlePad->SetFillColor(kGray);
    TPaveText* titleBox = makeTitleBox( detType);
    titleBox->Draw();





    TString coTypeString;
    if(detType==DET_EP)
    {
        coTypeString="EP";
    }
    else if(detType==DET_EPG)
    {
        coTypeString="EPG";
    }
    else if(detType==DET_EPBG)
    {
        coTypeString="EPBG";
    }
     TString imagePath=GRAPHS_DIR;
    imagePath+="layouts/PlotLayout";
    if(numMC>0) imagePath+="_MC";
    for (int i = 0;i< numMC;i++)
    {
        imagePath+=TString("_")+mc[i]->GetName();
    }
    if(numExp>0) imagePath+="_Exp";
    for (int i = 0;i< numExp;i++)
    {
        imagePath+=TString("_")+exp[i]->GetName();
    }

    imagePath+="_"+coTypeString+"_EPPlots.pdf";
    theCanvas->SaveAs(imagePath);

    delete theCanvas;
    clearPlotHists();

}
예제 #10
0
void CrossSectionRatio(TString inputFONLL="ROOTfiles/output_inclusiveDd0meson_5TeV_y1.root", TString input="ROOTfiles/hPtSpectrumDzeroPP.root", TString efficiency="test.root", TString inputprescales="prescalePP.root",int usePrescaleCorr=1,TString outputplot="myplot.root",int usePbPb=1,TString label="PbPb",double lumi=1.,Float_t centMin=0., Float_t centMax=100.)
{
  gStyle->SetOptTitle(0);
  gStyle->SetOptStat(0);
  gStyle->SetEndErrorSize(0);
  gStyle->SetMarkerStyle(20);

  TFile* fileReference = new TFile(inputFONLL.Data());  
  TGraphAsymmErrors* gaeBplusReference = (TGraphAsymmErrors*)fileReference->Get("gaeSigmaDzero");
  
  if (!(usePbPb==1||usePbPb==0)) std::cout<<"ERROR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!, you are using a non valid isPbPb option"<<std::endl;
  bool isPbPb=(bool)(usePbPb);

  TFile* file = new TFile(input.Data());
  
  TH1F* hYieldTriggerCorrected = (TH1F*)file->Get("hPt");
  hYieldTriggerCorrected->SetName("hYieldTriggerCorrected");  
  TH1F* hYieldNoTriggerCorrected = (TH1F*)file->Get("hPt");
  hYieldNoTriggerCorrected->SetName("hYieldNoTriggerCorrected");  
  TH1F* hYieldTriggerCorrectedFONLLnorm = (TH1F*)file->Get("hPt");
  hYieldTriggerCorrectedFONLLnorm->SetName("hYieldTriggerCorrectedFONLLnorm");
  TH1F* hDcandidatesTriggerCorrectedFONLLnorm = (TH1F*)file->Get("hDcandidates");
  hDcandidatesTriggerCorrectedFONLLnorm->SetName("hDcandidatesTriggerCorrectedFONLLnorm");
  TH1F* hYieldNoTriggerCorrectedFONLLnorm = (TH1F*)file->Get("hPt");
  hYieldNoTriggerCorrectedFONLLnorm->SetName("hYieldNoTriggerCorrectedFONLLnorm");
  TH1F* hDcandidatesNoTriggerCorrectedFONLLnorm = (TH1F*)file->Get("hDcandidates");
  hDcandidatesNoTriggerCorrectedFONLLnorm->SetName("hDcandidatesNoTriggerCorrectedFONLLnorm");
  
  
  TFile* fileeff = new TFile(efficiency.Data());
  TH1F* hEff = (TH1F*)fileeff->Get("hEff");
  
  TH1F* hfprompt = new TH1F("hfprompt","",nBins,ptBins);

  TH1F*hPrescalesPtBins;
  TH1F*hTriggerEfficiencyPtBins;
  

  TH1F* hPtSigma = (TH1F*)hYieldTriggerCorrected->Clone("hPtSigma");
   hPtSigma->Divide(hEff);
   hPtSigma->Scale(1./(2*lumi*BRchain));
   hPtSigma->SetName("hPtSigma");

/*
  TH1F* hPtSigma = (TH1F*)file->Get("hPtSigma");
  hPtSigma->Scale(1./lumi);
*/
  hYieldTriggerCorrected->Scale(1./lumi);
  hYieldNoTriggerCorrected->Scale(1./lumi);
  hYieldTriggerCorrectedFONLLnorm->Scale(1./lumi);
  hYieldNoTriggerCorrectedFONLLnorm->Scale(1./lumi);
  hDcandidatesTriggerCorrectedFONLLnorm->Scale(1./lumi);
  hDcandidatesNoTriggerCorrectedFONLLnorm->Scale(1./lumi);
  
  for (int i=0;i<nBins;i++) {
    double prompt=bFeedDownCorrection(hPtSigma->GetBinCenter(i+1),isPbPb,1);
    hfprompt->SetBinContent(i+1,prompt);
    hPtSigma->SetBinContent(i+1,hPtSigma->GetBinContent(i+1)*prompt);
    hPtSigma->SetBinError(i+1,hPtSigma->GetBinError(i+1)*prompt);
        
    std::cout<<"pt center="<<hPtSigma->GetBinCenter(i+1)<<", prompt fraction="<<prompt<<std::endl;
  }
  
  if (usePrescaleCorr==1){
    TFile*fprescales=new TFile(inputprescales.Data()); 
    hPrescalesPtBins=(TH1F*)fprescales->Get("hPrescalesPtBins");
    hTriggerEfficiencyPtBins=(TH1F*)fprescales->Get("hTriggerEfficiencyPtBins");
    
    for (int i=0;i<nBins;i++) {
      hPtSigma->SetBinContent(i+1,hPtSigma->GetBinContent(i+1)/hPrescalesPtBins->GetBinContent(i+1)/hTriggerEfficiencyPtBins->GetBinContent(i+1));
      hPtSigma->SetBinError(i+1,hPtSigma->GetBinError(i+1)/hPrescalesPtBins->GetBinContent(i+1)/hTriggerEfficiencyPtBins->GetBinContent(i+1));
      hYieldTriggerCorrected->SetBinContent(i+1,hYieldTriggerCorrected->GetBinContent(i+1)/hPrescalesPtBins->GetBinContent(i+1)/hTriggerEfficiencyPtBins->GetBinContent(i+1));
      hYieldTriggerCorrected->SetBinError(i+1,hYieldTriggerCorrected->GetBinError(i+1)/hPrescalesPtBins->GetBinContent(i+1)/hTriggerEfficiencyPtBins->GetBinContent(i+1));
      hYieldNoTriggerCorrected->SetBinContent(i+1,hYieldNoTriggerCorrected->GetBinContent(i+1)/hPrescalesPtBins->GetBinContent(i+1));
      hYieldNoTriggerCorrected->SetBinError(i+1,hYieldNoTriggerCorrected->GetBinError(i+1)/hPrescalesPtBins->GetBinContent(i+1));
      hYieldTriggerCorrectedFONLLnorm->SetBinContent(i+1,hYieldTriggerCorrectedFONLLnorm->GetBinContent(i+1)/hPrescalesPtBins->GetBinContent(i+1)/hTriggerEfficiencyPtBins->GetBinContent(i+1));
      hYieldTriggerCorrectedFONLLnorm->SetBinError(i+1,hYieldTriggerCorrectedFONLLnorm->GetBinError(i+1)/hPrescalesPtBins->GetBinContent(i+1)/hTriggerEfficiencyPtBins->GetBinContent(i+1));
      hDcandidatesTriggerCorrectedFONLLnorm->SetBinContent(i+1,hDcandidatesTriggerCorrectedFONLLnorm->GetBinContent(i+1)/hPrescalesPtBins->GetBinContent(i+1)/hTriggerEfficiencyPtBins->GetBinContent(i+1));
      hDcandidatesTriggerCorrectedFONLLnorm->SetBinError(i+1,hDcandidatesTriggerCorrectedFONLLnorm->GetBinError(i+1)/hPrescalesPtBins->GetBinContent(i+1)/hTriggerEfficiencyPtBins->GetBinContent(i+1));
      hYieldNoTriggerCorrectedFONLLnorm->SetBinContent(i+1,hYieldNoTriggerCorrectedFONLLnorm->GetBinContent(i+1)/hPrescalesPtBins->GetBinContent(i+1));
      hYieldNoTriggerCorrectedFONLLnorm->SetBinError(i+1,hYieldNoTriggerCorrectedFONLLnorm->GetBinError(i+1)/hPrescalesPtBins->GetBinContent(i+1));
      hDcandidatesNoTriggerCorrectedFONLLnorm->SetBinContent(i+1,hDcandidatesNoTriggerCorrectedFONLLnorm->GetBinContent(i+1)/hPrescalesPtBins->GetBinContent(i+1));
      hDcandidatesNoTriggerCorrectedFONLLnorm->SetBinError(i+1,hDcandidatesNoTriggerCorrectedFONLLnorm->GetBinError(i+1)/hPrescalesPtBins->GetBinContent(i+1));
    }
  }

  Double_t xr[nBins], xrlow[nBins], xrhigh[nBins], ycross[nBins],ycrossstat[nBins],ycrosssysthigh[nBins],ycrosssystlow[nBins], yFONLL[nBins];
  Double_t yratiocrossFONLL[nBins], yratiocrossFONLLstat[nBins], yratiocrossFONLLsysthigh[nBins], yratiocrossFONLLsystlow[nBins];
  Double_t yFONLLrelunclow[nBins], yFONLLrelunchigh[nBins], yunity[nBins];

  for(int i=0;i<nBins;i++)
    {
      gaeBplusReference->GetPoint(i,xr[i],yFONLL[i]);
      xrlow[i] = gaeBplusReference->GetErrorXlow(i);
      xrhigh[i] = gaeBplusReference->GetErrorXhigh(i);
      ycross[i] = hPtSigma->GetBinContent(i+1);
      ycrossstat[i] = hPtSigma->GetBinError(i+1);
      double systematic=0.;
      if (!isPbPb) systematic=0.01*systematicsPP(xr[i],0.);
      else  systematic=0.01*systematicsPbPb(xr[i],centMin,centMax,0.);     
      ycrosssysthigh[i]= hPtSigma->GetBinContent(i+1)*systematic;
      ycrosssystlow[i]= hPtSigma->GetBinContent(i+1)*systematic;
      yratiocrossFONLL[i] = ycross[i]/yFONLL[i];
      yratiocrossFONLLstat[i] = ycrossstat[i]/yFONLL[i];
      yratiocrossFONLLsysthigh[i] = ycrosssysthigh[i]/yFONLL[i];
      yratiocrossFONLLsystlow[i] = ycrosssystlow[i]/yFONLL[i];
      yFONLLrelunclow[i] = gaeBplusReference->GetErrorYlow(i)/yFONLL[i];
      yFONLLrelunchigh[i] = gaeBplusReference->GetErrorYhigh(i)/yFONLL[i];
      yunity[i] = yFONLL[i]/yFONLL[i];
      hYieldTriggerCorrectedFONLLnorm->SetBinContent(i+1,hYieldTriggerCorrectedFONLLnorm->GetBinContent(i+1)/yFONLL[i]);
      hYieldTriggerCorrectedFONLLnorm->SetBinError(i+1,hYieldTriggerCorrectedFONLLnorm->GetBinError(i+1)/yFONLL[i]);
      hDcandidatesTriggerCorrectedFONLLnorm->SetBinContent(i+1,hDcandidatesTriggerCorrectedFONLLnorm->GetBinContent(i+1)/yFONLL[i]);
      hDcandidatesTriggerCorrectedFONLLnorm->SetBinError(i+1,hDcandidatesTriggerCorrectedFONLLnorm->GetBinError(i+1)/yFONLL[i]);
    
      hYieldNoTriggerCorrectedFONLLnorm->SetBinContent(i+1,hYieldNoTriggerCorrectedFONLLnorm->GetBinContent(i+1)/yFONLL[i]);
      hYieldNoTriggerCorrectedFONLLnorm->SetBinError(i+1,hYieldNoTriggerCorrectedFONLLnorm->GetBinError(i+1)/yFONLL[i]);
      hDcandidatesNoTriggerCorrectedFONLLnorm->SetBinContent(i+1,hDcandidatesNoTriggerCorrectedFONLLnorm->GetBinContent(i+1)/yFONLL[i]);
      hDcandidatesNoTriggerCorrectedFONLLnorm->SetBinError(i+1,hDcandidatesNoTriggerCorrectedFONLLnorm->GetBinError(i+1)/yFONLL[i]);

 
 
    }

  TGraphAsymmErrors* gaeCrossSyst = new TGraphAsymmErrors(nBins,xr,ycross,xrlow,xrhigh,ycrosssystlow,ycrosssysthigh);
  gaeCrossSyst->SetName("gaeCrossSyst");
  gaeCrossSyst->SetMarkerStyle(20);
  gaeCrossSyst->SetMarkerSize(0.8);

  TGraphAsymmErrors* gaeRatioCrossFONLLstat = new TGraphAsymmErrors(nBins,xr,yratiocrossFONLL,xrlow,xrhigh,yratiocrossFONLLstat,yratiocrossFONLLstat);
  gaeRatioCrossFONLLstat->SetName("gaeRatioCrossFONLLstat");
  gaeRatioCrossFONLLstat->SetMarkerStyle(20);
  gaeRatioCrossFONLLstat->SetMarkerSize(0.8);
  
  TGraphAsymmErrors* gaeRatioCrossFONLLsyst= new TGraphAsymmErrors(nBins,xr,yratiocrossFONLL,xrlow,xrhigh,yratiocrossFONLLsystlow,yratiocrossFONLLsysthigh);
  gaeRatioCrossFONLLsyst->SetName("gaeRatioCrossFONLLsyst");
  gaeRatioCrossFONLLsyst->SetLineWidth(2);
  gaeRatioCrossFONLLsyst->SetLineColor(1);
  gaeRatioCrossFONLLsyst->SetFillColor(2);
  gaeRatioCrossFONLLsyst->SetFillStyle(0);

  TGraphAsymmErrors* gaeRatioCrossFONLLunity = new TGraphAsymmErrors(nBins,xr,yunity,xrlow,xrhigh,yFONLLrelunclow,yFONLLrelunchigh);
  gaeRatioCrossFONLLunity->SetName("gaeRatioCrossFONLLunity");
  gaeRatioCrossFONLLunity->SetLineWidth(2);
  gaeRatioCrossFONLLunity->SetLineColor(2);
  gaeRatioCrossFONLLunity->SetFillColor(2);
  gaeRatioCrossFONLLunity->SetFillStyle(3002);
  
  TCanvas* cSigma = new TCanvas("cSigma","",600,750);
  cSigma->SetFrameBorderMode(0);
  cSigma->SetFrameBorderMode(0);
  cSigma->Range(-1.989924,-0.2917772,25.49622,2.212202);
  cSigma->SetFillColor(0);
  cSigma->SetBorderMode(0);
  cSigma->SetBorderSize(2);
  cSigma->SetLeftMargin(0.1451613);
  cSigma->SetRightMargin(0.05443548);
  cSigma->SetTopMargin(0.08474576);
  cSigma->SetBottomMargin(0.1165254);
  cSigma->SetFrameBorderMode(0);
  cSigma->SetFrameBorderMode(0);
  cSigma->cd();
  TPad* pSigma = new TPad("pSigma","",0,0.25,1,1);
  pSigma->SetFillColor(0);
  pSigma->SetBorderMode(0);
  pSigma->SetBorderSize(2);
  pSigma->SetLeftMargin(0.1451613);
  pSigma->SetRightMargin(0.05443548);
  pSigma->SetTopMargin(0.08474576);
  pSigma->SetBottomMargin(0);
  pSigma->SetLogy();
  pSigma->Draw();
  pSigma->cd();


  Float_t yaxisMin=1.1,yaxisMax=1.e+9;
  if(label=="PPMB"||label=="PbPbMB")
    {
      yaxisMin=1.e+4;
      yaxisMax=1.e+13;
    }
  TH2F* hemptySigma=new TH2F("hemptySigma","",50,ptBins[0]-5.,ptBins[nBins]+5.,10.,yaxisMin,yaxisMax);  
  hemptySigma->GetXaxis()->CenterTitle();
  hemptySigma->GetYaxis()->CenterTitle();
  hemptySigma->GetYaxis()->SetTitle("d#sigma / dp_{T}( pb GeV^{-1}c)");
  if(isPbPb) hemptySigma->GetYaxis()->SetTitle("1/T_{AA} * dN / dp_{T}( pb GeV^{-1}c)");
  hemptySigma->GetXaxis()->SetTitleOffset(1.);
  hemptySigma->GetYaxis()->SetTitleOffset(1.3);
  hemptySigma->GetXaxis()->SetTitleSize(0.045);
  hemptySigma->GetYaxis()->SetTitleSize(0.045);
  hemptySigma->GetXaxis()->SetTitleFont(42);
  hemptySigma->GetYaxis()->SetTitleFont(42);
  hemptySigma->GetXaxis()->SetLabelFont(42);
  hemptySigma->GetYaxis()->SetLabelFont(42);
  hemptySigma->GetXaxis()->SetLabelSize(0.04);
  hemptySigma->GetYaxis()->SetLabelSize(0.04);  
  hemptySigma->SetMaximum(2);
  hemptySigma->SetMinimum(0.);
  hemptySigma->Draw();
  gaeBplusReference->SetFillColor(2);
  gaeBplusReference->SetFillStyle(3001); 
  gaeBplusReference->SetLineWidth(3);
  gaeBplusReference->SetLineColor(2);
  gaeBplusReference->Draw("5same");
  hPtSigma->SetLineColor(1);
  hPtSigma->SetLineWidth(2);
  hPtSigma->Draw("epsame"); 
  gaeCrossSyst->SetFillColor(1);
  gaeCrossSyst->SetFillStyle(0); 
  gaeCrossSyst->SetLineWidth(2);
  gaeCrossSyst->SetLineColor(1);
  gaeCrossSyst->Draw("5same");  
  
  TLatex* texCms = new TLatex(0.16,0.95, "#scale[1.25]{CMS} Preliminary");
  texCms->SetNDC();
  texCms->SetTextAlign(12);
  texCms->SetTextSize(0.04);
  texCms->SetTextFont(42);
  texCms->Draw();

  TLatex* texCol = new TLatex(0.94,0.95, Form("%s #sqrt{s_{NN}} = 5.02 TeV",label.Data()));
  texCol->SetNDC();
  texCol->SetTextAlign(32);
  texCol->SetTextSize(0.04);
  texCol->SetTextFont(42);
  texCol->Draw();

  TString texper="%";
  TLatex* texCent = new TLatex(0.53,0.815,Form("Centrality %.0f - %.0f%s",centMin,centMax,texper.Data()));
  texCent->SetNDC();
  texCent->SetTextFont(42);
  texCent->SetTextSize(0.04);
  if(isPbPb) texCent->Draw();

  TLatex* texY = new TLatex(0.53,0.77,"|y| < 1.0");
  texY->SetNDC();
  texY->SetTextFont(42);
  texY->SetTextSize(0.04);
  texY->SetLineWidth(2);
  texY->Draw();

  TLegend* leg_CS = new TLegend(0.52,0.64,0.85,0.75);
  leg_CS->SetBorderSize(0);
  leg_CS->SetFillStyle(0);
  leg_CS->AddEntry(hPtSigma,"data","pf");
  leg_CS->AddEntry(gaeBplusReference,"FONLL pp ref.","f");
  leg_CS->Draw("same");
  
  /*
  TLatex * tlatexlumi=new TLatex(0.671371,0.7801268,"L = 9.97 pb^{-1}");
  tlatexlumi->SetNDC();
  tlatexlumi->SetTextColor(1);
  tlatexlumi->SetTextFont(42);
  tlatexlumi->SetTextSize(0.045);
  */
  cSigma->cd();
  TPad* pRatio = new TPad("pRatio","",0,0,1,0.25);
  pRatio->SetLeftMargin(0.1451613);
  pRatio->SetRightMargin(0.05443548);
  pRatio->SetTopMargin(0);
  pRatio->SetBottomMargin(0.25);
  pRatio->Draw();
  pRatio->cd();

  TH2F* hemptyRatio=new TH2F("hemptyRatio","",50,ptBins[0]-5.,ptBins[nBins]+5.,10.,0.,3.1);
  hemptyRatio->GetXaxis()->SetTitle("p_{T} (GeV/c)");
  hemptyRatio->GetYaxis()->CenterTitle();
  hemptyRatio->GetYaxis()->SetTitle("Data / FONLL");
  hemptyRatio->GetXaxis()->SetTitleOffset(0.9);
  hemptyRatio->GetYaxis()->SetTitleOffset(0.5);
  hemptyRatio->GetXaxis()->SetTitleSize(0.12);
  hemptyRatio->GetYaxis()->SetTitleSize(0.12);
  hemptyRatio->GetXaxis()->SetTitleFont(42);
  hemptyRatio->GetYaxis()->SetTitleFont(42);
  hemptyRatio->GetXaxis()->SetLabelFont(42);
  hemptyRatio->GetYaxis()->SetLabelFont(42);
  hemptyRatio->GetXaxis()->SetLabelSize(0.1);
  hemptyRatio->GetYaxis()->SetLabelSize(0.1);  
  hemptyRatio->Draw();

  TLine* l = new TLine(ptBins[0]-5.,1,ptBins[nBins]+5.,1);
  l->SetLineWidth(1);
  l->SetLineStyle(2);
  gaeRatioCrossFONLLunity->Draw("5same");
  gaeRatioCrossFONLLstat->Draw("epsame");
  gaeRatioCrossFONLLsyst->Draw("5same");
  l->Draw("same");
  if(!isPbPb) cSigma->SaveAs(Form("plotCrossSection/canvasSigmaDzeroRatio%s.pdf",label.Data()));
  else cSigma->SaveAs(Form("plotCrossSection/canvasSigmaDzeroRatio%s_%.0f_%.0f.pdf",label.Data(),centMin,centMax));
  
  
  TCanvas* cEff = new TCanvas("cEff","",550,500);
  
  TH2F* hemptyEff=new TH2F("hemptyEff","",50,0.,110.,10.,0,1.);  
  hemptyEff->GetXaxis()->CenterTitle();
  hemptyEff->GetYaxis()->CenterTitle();
  hemptyEff->GetYaxis()->SetTitle("#alpha x #epsilon_{reco} x #epsilon_{sel} ");
  hemptyEff->GetXaxis()->SetTitle("p_{T} (GeV/c)");
  hemptyEff->GetXaxis()->SetTitleOffset(0.9);
  hemptyEff->GetYaxis()->SetTitleOffset(1.05);
  hemptyEff->GetXaxis()->SetTitleSize(0.045);
  hemptyEff->GetYaxis()->SetTitleSize(0.045);
  hemptyEff->GetXaxis()->SetTitleFont(42);
  hemptyEff->GetYaxis()->SetTitleFont(42);
  hemptyEff->GetXaxis()->SetLabelFont(42);
  hemptyEff->GetYaxis()->SetLabelFont(42);
  hemptyEff->GetXaxis()->SetLabelSize(0.04);
  hemptyEff->GetYaxis()->SetLabelSize(0.04);  
  hemptyEff->SetMaximum(2);
  hemptyEff->SetMinimum(0.);
  hemptyEff->Draw();
  cEff->cd();
  hemptyEff->Draw();
  hEff->SetLineWidth(2);
  hEff->SetLineColor(1);
  hEff->Draw("same");

  
  TString text;
  TString sample;
  if (label=="PbPb") { text="CMS Preliminary     PbPb #sqrt{s}= 5.02 TeV"; sample="Pythia8+Hydjet MC simulation, prompt D^{0}";}
  else {text="CMS Preliminary     pp #sqrt{s}= 5.02 TeV"; sample="Pythia8 MC simulation, prompt D^{0}";}
  
  TLatex * tlatexeff=new TLatex(0.1612903,0.8525793,text.Data());
  tlatexeff->SetNDC();
  tlatexeff->SetTextColor(1);
  tlatexeff->SetTextFont(42);
  tlatexeff->SetTextSize(0.04);
  tlatexeff->Draw();
  TLatex * tlatexeff2=new TLatex(0.1612903,0.7925793,sample.Data());
  tlatexeff2->SetNDC();
  tlatexeff2->SetTextColor(1);
  tlatexeff2->SetTextFont(42);
  tlatexeff2->SetTextSize(0.04);
  tlatexeff2->Draw();
  if(!isPbPb) cEff->SaveAs(Form("plotOthers/efficiency%s.pdf",label.Data()));
  else cEff->SaveAs(Form("plotOthers/efficiency%s_%.0f_%.0f.pdf",label.Data(),centMin,centMax));
  
  
  TCanvas* cFprompt = new TCanvas("cFprompt","",550,500);
  TH2F* hemptyPrompt=new TH2F("hemptyPrompt","",50,0.,110.,10.,0,1.);  
  hemptyPrompt->GetXaxis()->CenterTitle();
  hemptyPrompt->GetYaxis()->CenterTitle();
  hemptyPrompt->GetYaxis()->SetTitle("f_{prompt}");
  hemptyPrompt->GetXaxis()->SetTitle("p_{T} (GeV/c)");
  hemptyPrompt->GetXaxis()->SetTitleOffset(0.9);
  hemptyPrompt->GetYaxis()->SetTitleOffset(1.05);
  hemptyPrompt->GetXaxis()->SetTitleSize(0.045);
  hemptyPrompt->GetYaxis()->SetTitleSize(0.045);
  hemptyPrompt->GetXaxis()->SetTitleFont(42);
  hemptyPrompt->GetYaxis()->SetTitleFont(42);
  hemptyPrompt->GetXaxis()->SetLabelFont(42);
  hemptyPrompt->GetYaxis()->SetLabelFont(42);
  hemptyPrompt->GetXaxis()->SetLabelSize(0.04);
  hemptyPrompt->GetYaxis()->SetLabelSize(0.04);  
  hemptyPrompt->SetMaximum(2);
  hemptyPrompt->SetMinimum(0.);
  hemptyPrompt->Draw();
  cFprompt->cd();
  hemptyPrompt->Draw();
  hfprompt->SetLineWidth(2);
  hfprompt->SetLineColor(1);
  hfprompt->Draw("same");
  if(!isPbPb) cFprompt->SaveAs(Form("plotOthers/cFprompt%s.pdf",label.Data()));
  else cFprompt->SaveAs(Form("plotOthers/cFprompt%s_%.0f_%.0f.pdf",label.Data(),centMin,centMax));


  TFile *outputfile=new TFile(outputplot.Data(),"recreate");
  outputfile->cd();
  gaeCrossSyst->Write();
  gaeRatioCrossFONLLstat->Write();
  gaeBplusReference->Write();
  hPtSigma->Write();
  gaeRatioCrossFONLLstat->Write();
  gaeRatioCrossFONLLsyst->Write();
  gaeRatioCrossFONLLunity->Write();
  hEff->Write();
  hfprompt->Write();
  hYieldTriggerCorrected->Write();
  hYieldNoTriggerCorrected->Write();
  hDcandidatesTriggerCorrectedFONLLnorm->Write();
  hYieldTriggerCorrectedFONLLnorm->Write();
  hDcandidatesNoTriggerCorrectedFONLLnorm->Write();
  hYieldNoTriggerCorrectedFONLLnorm->Write();
  if (usePrescaleCorr==1){
  hPrescalesPtBins->Write();
  hTriggerEfficiencyPtBins->Write();
  }
}
예제 #11
0
파일: variables.C 프로젝트: sixie/EWKAna
// input: - Input file (result from TMVA),
//        - normal/decorrelated/PCA
//        - use of TMVA plotting TStyle
void variables( TString fin = "TMVA.root", TString dirName = "InputVariables_Id", TString title = "TMVA Input Variables",
                Bool_t isRegression = kFALSE, Bool_t useTMVAStyle = kTRUE )
{
   TString outfname = dirName;
   outfname.ToLower(); outfname.ReplaceAll( "input", ""  );

   // set style and remove existing canvas'
   TMVAGlob::Initialize( useTMVAStyle );

   // obtain shorter histogram title 
   TString htitle = title; 
   htitle.ReplaceAll("variables ","variable");
   htitle.ReplaceAll("and target(s)","");
   htitle.ReplaceAll("(training sample)","");

   // checks if file with name "fin" is already open, and if not opens one
   TFile* file = TMVAGlob::OpenFile( fin );

   TDirectory* dir = (TDirectory*)file->Get( dirName );
   if (dir==0) {
      cout << "No information about " << title << " available in directory " << dirName << " of file " << fin << endl;
      return;
   }
   dir->cd();

   // how many plots are in the directory?
   Int_t noPlots = TMVAGlob::GetNumberOfInputVariables( dir ) +
      TMVAGlob::GetNumberOfTargets( dir );

   // define Canvas layout here!
   // default setting
   Int_t xPad;  // no of plots in x
   Int_t yPad;  // no of plots in y
   Int_t width; // size of canvas
   Int_t height;
   switch (noPlots) {
   case 1:
      xPad = 1; yPad = 1; width = 550; height = 0.90*width; break;
   case 2:
      xPad = 2; yPad = 1; width = 600; height = 0.50*width; break;
   case 3:
      xPad = 3; yPad = 1; width = 900; height = 0.4*width; break;
   case 4:
      xPad = 2; yPad = 2; width = 600; height = width; break;
   default:
//       xPad = 3; yPad = 2; width = 800; height = 0.55*width; break;
     xPad = 1; yPad = 1; width = 550; height = 0.90*width; break;
   }

   Int_t noPadPerCanv = xPad * yPad ;

   // counter variables
   Int_t countCanvas = 0;
   Int_t countPad    = 0;

   // loop over all objects in directory
   TCanvas* canv = 0;
   TKey*    key  = 0;
   Bool_t   createNewFig = kFALSE;
   TIter next(dir->GetListOfKeys());
   while ((key = (TKey*)next())) {
      if (key->GetCycle() != 1) continue;

      if (!TString(key->GetName()).Contains("__Signal") && 
          !(isRegression && TString(key->GetName()).Contains("__Regression"))) continue;

      // make sure, that we only look at histograms
      TClass *cl = gROOT->GetClass(key->GetClassName());
      if (!cl->InheritsFrom("TH1")) continue;
      TH1 *sig = (TH1*)key->ReadObj();
      TString hname(sig->GetName());

      //normalize to 1
      NormalizeHist(sig);      

      // create new canvas
      if (countPad%noPadPerCanv==0) {
         ++countCanvas;
         canv = new TCanvas( Form("canvas%d", countCanvas), title,
                             countCanvas*50+50, countCanvas*20, width, height );
         canv->Divide(xPad,yPad);
         canv->SetFillColor(kWhite);
         canv->Draw();
      }

      TPad* cPad = (TPad*)canv->cd(countPad++%noPadPerCanv+1);
      cPad->SetFillColor(kWhite);

      // find the corredponding backgrouns histo
      TString bgname = hname;
      bgname.ReplaceAll("__Signal","__Background");
      TH1 *bgd = (TH1*)dir->Get(bgname);
      if (bgd == NULL) {
         cout << "ERROR!!! couldn't find background histo for" << hname << endl;
         exit;
      }
      //normalize to 1
      NormalizeHist(bgd);


      // this is set but not stored during plot creation in MVA_Factory
      TMVAGlob::SetSignalAndBackgroundStyle( sig, (isRegression ? 0 : bgd) );            

      sig->SetTitle( TString( htitle ) + ": " + sig->GetTitle() );
      TMVAGlob::SetFrameStyle( sig, 1.2 );

      // normalise both signal and background
//       if (!isRegression) TMVAGlob::NormalizeHists( sig, bgd );
//       else {
//          // change histogram title for target
//          TString nme = sig->GetName();
//          if (nme.Contains( "_target" )) {
//             TString tit = sig->GetTitle();
//             sig->SetTitle( tit.ReplaceAll("Input variable", "Regression target" ) );
//          }
//       }
      sig->SetTitle( "" );            
      

      // finally plot and overlay
      Float_t sc = 1.1;
      if (countPad == 1) sc = 1.3;
      sig->SetMaximum( TMath::Max( sig->GetMaximum(), bgd->GetMaximum() )*sc );
      sig->Draw( "hist" );
      cPad->SetLeftMargin( 0.17 );

      sig->GetYaxis()->SetTitleOffset( 1.50 );
      if (!isRegression) {
         bgd->Draw("histsame");
         TString ytit = TString("(1/N) ") + sig->GetYaxis()->GetTitle();
         ytit = TString("Fraction of Events");
         sig->GetYaxis()->SetTitle( ytit ); // histograms are normalised
      }

      if (countPad == 1) sig->GetXaxis()->SetTitle("Leading Lepton p_{T} [GeV/c]");
      if (countPad == 2) sig->GetXaxis()->SetTitle("Trailing Lepton p_{T} [GeV/c]");
      if (countPad == 3) sig->GetXaxis()->SetTitle("#Delta#phi(l,l)");
      if (countPad == 4) sig->GetXaxis()->SetTitle("#Delta R(l,l)");
      if (countPad == 5) sig->GetXaxis()->SetTitle("Dilepton Mass [GeV/c^{2}]");
      if (countPad == 6) sig->GetXaxis()->SetTitle("Dilepton Flavor Final State");
      if (countPad == 7) sig->GetXaxis()->SetTitle("M_{T} (Higgs) [GeV/c^{2}]");
      if (countPad == 8) sig->GetXaxis()->SetTitle("#Delta#phi(Dilepton System, MET)");
      if (countPad == 9) sig->GetXaxis()->SetTitle("#Delta#phi(Dilepton System, Jet)");


      // Draw legend
//       if (countPad == 1 && !isRegression) {
         TLegend *legend= new TLegend( cPad->GetLeftMargin(), 
                                       1-cPad->GetTopMargin()-.15, 
                                       cPad->GetLeftMargin()+.4, 
                                       1-cPad->GetTopMargin() );

         if(countPad == 1 || countPad == 2 ||countPad == 3 ||countPad == 4 ||countPad == 5 ||countPad == 7  ) {
           legend= new TLegend( 0.50, 
                                1-cPad->GetTopMargin()-.15, 
                                0.90, 
                                1-cPad->GetTopMargin() );
         }

         legend->SetFillStyle(0);
         legend->AddEntry(sig,"Signal","F");
         legend->AddEntry(bgd,"Background","F");
         legend->SetBorderSize(0);
         legend->SetMargin( 0.3 );
         legend->SetTextSize( 0.03 );
         legend->Draw("same");
//       } 

      // redraw axes
      sig->Draw("sameaxis");

      // text for overflows
      Int_t    nbin = sig->GetNbinsX();
      Double_t dxu  = sig->GetBinWidth(0);
      Double_t dxo  = sig->GetBinWidth(nbin+1);
      TString uoflow = "";
      if (isRegression) {
         uoflow = Form( "U/O-flow: %.1f%% / %.1f%%", 
                        sig->GetBinContent(0)*dxu*100, sig->GetBinContent(nbin+1)*dxo*100 );
      }
      else {
         uoflow = Form( "U/O-flow (S,B): (%.1f, %.1f)%% / (%.1f, %.1f)%%", 
                        sig->GetBinContent(0)*dxu*100, bgd->GetBinContent(0)*dxu*100,
                        sig->GetBinContent(nbin+1)*dxo*100, bgd->GetBinContent(nbin+1)*dxo*100 );
      }
  
      TText* t = new TText( 0.98, 0.14, uoflow );
      t->SetNDC();
      t->SetTextSize( 0.040 );
      t->SetTextAngle( 90 );
//       t->AppendPad();    

      // save canvas to file
      if (countPad%noPadPerCanv==0) {
         TString fname = Form( "plots/%s_c%i", outfname.Data(), countCanvas );
         TMVAGlob::plot_logo();
         TMVAGlob::imgconv( canv, fname );
         createNewFig = kFALSE;
      }
      else {
         createNewFig = kTRUE;
      }
   }
   
   if (createNewFig) {
      TString fname = Form( "plots/%s_c%i", outfname.Data(), countCanvas );
      TMVAGlob::plot_logo();
      TMVAGlob::imgconv( canv, fname );
      createNewFig = kFALSE;
   }

   return;
}
void GE11sEfficiencyScan(int RunNumber, string RunName, string path)
{
   
   ifstream InGE11_IV_GIF, InGE11_IV, InGE11_V;

   //string path = "/home/ramkrishna/TEMP/LogFiles_TB/LogFiles306To407";	    

   string gif	= path+"/Efficiency_LC1_"+std::to_string(RunNumber)+".log";
   string IV	= path+"/Efficiency_LC2_"+std::to_string(RunNumber)+".log";
   string V	= path+"/Efficiency_LC3_"+std::to_string(RunNumber)+".log";

   cout<<"gif = "<<gif<<endl;
   InGE11_IV_GIF.open(gif);
   InGE11_IV.open(IV);
   InGE11_V.open(V);

   string rootFile = "Efficiency_Run"+std::to_string(RunNumber)+".root";
   const char *CharrootFile = rootFile.c_str();
   TFile *f = new TFile(CharrootFile,"RECREATE");
   //TTree *tree = new TTree("Run306", "Detector info for Run 306");
   TNtuple *GE11_IV_GIF = new TNtuple("GE11_IV_GIF","data from text file LC1","MeanPosOfSector:Efficiency:EfficiencyError:Nevents");
   TNtuple *GE11_IV = new TNtuple("GE11_IV","data from text file LC2","MeanPosOfSector:Efficiency:EfficiencyError:Nevents");
   TNtuple *GE11_V = new TNtuple("GE11_V","data from text file LC3","MeanPosOfSector:Efficiency:EfficiencyError:Nevents");

   Int_t nlines = 0;

   vector<double> GIF_MeanPosOfSector, GIF_Efficiency, GIF_EfficiencyError;
   vector<unsigned int> GIF_Nevents;
   unsigned int temp_Nevents;
   double temp_MeanPosOfSector, temp_Efficiency, temp_EfficiencyError;

   vector<double> IV_MeanPosOfSector, IV_Efficiency, IV_EfficiencyError;
   vector<unsigned int> IV_Nevents;

   vector<double> V_MeanPosOfSector, V_Efficiency, V_EfficiencyError;
   vector<unsigned int> V_Nevents;

   string NameOfDet, xRange;

   while (1) 
   {
     InGE11_IV_GIF >> NameOfDet >> xRange >> temp_MeanPosOfSector >> temp_Efficiency >> temp_EfficiencyError >> temp_Nevents;
	if (!InGE11_IV_GIF.good()) break;

     GIF_MeanPosOfSector.push_back(temp_MeanPosOfSector+(nlines*5));
     GIF_Efficiency.push_back(temp_Efficiency);
     GIF_EfficiencyError.push_back(temp_EfficiencyError);
     GIF_Nevents.push_back(temp_Nevents);
    	GE11_IV_GIF->Fill(temp_MeanPosOfSector+(nlines*5),temp_Efficiency,temp_EfficiencyError,temp_Nevents);
	nlines++;
	if (nlines > 20) 
	{
	    cout<<"Check the input text file for run number "<< RunNumber << endl;
	    exit(EXIT_SUCCESS);
	}
   }

   InGE11_IV_GIF.close();
   nlines=0;
   while (1) 
   {
     InGE11_IV >> NameOfDet >> xRange >> temp_MeanPosOfSector >> temp_Efficiency >> temp_EfficiencyError >> temp_Nevents;
	if (!InGE11_IV.good()) break;

     IV_MeanPosOfSector.push_back(temp_MeanPosOfSector+(nlines*5));
     IV_Efficiency.push_back(temp_Efficiency);
     IV_EfficiencyError.push_back(temp_EfficiencyError);
     IV_Nevents.push_back(temp_Nevents);
    	GE11_IV->Fill(temp_MeanPosOfSector+(nlines*5),temp_Efficiency,temp_EfficiencyError,temp_Nevents);
	nlines++;
   }

   InGE11_IV.close();
   nlines=0;
   while (1) 
   {
     InGE11_V >> NameOfDet >> xRange >> temp_MeanPosOfSector >> temp_Efficiency >> temp_EfficiencyError >> temp_Nevents;
	if (!InGE11_V.good()) break;

     V_MeanPosOfSector.push_back(temp_MeanPosOfSector+(nlines*5));
     V_Efficiency.push_back(temp_Efficiency);
     V_EfficiencyError.push_back(temp_EfficiencyError);
     V_Nevents.push_back(temp_Nevents);
    	GE11_V->Fill(temp_MeanPosOfSector+(nlines*5),temp_Efficiency,temp_EfficiencyError,temp_Nevents);
	nlines++;
   }

   InGE11_V.close();
   string CanvasName = "RunNumber"+std::to_string(RunNumber);
   const char * CharCanvasName = CanvasName.c_str();
   TCanvas* c1 = new TCanvas(CharCanvasName,"Efficiency Scan Plot",200,10,700,500);
   TPad *pad = new TPad("pad","",0,0,1,1);
   //pad->SetFillColor(42);
   pad->SetGrid();
   pad->Draw();
   pad->cd();

      // draw a frame to define the range
   TH1F *hr = pad->DrawFrame(0,-0.5,100,1.1);
   hr->SetXTitle("Detector Position (mm)");
   hr->SetYTitle("Efficiency");
   //pad->GetFrame()->SetFillColor(21);
   pad->GetFrame()->SetBorderSize(12);

      // create first graph
   TGraphErrors *gr_GIF = new TGraphErrors(V_Efficiency.size());
   TGraphErrors *gr_IV = new TGraphErrors(V_Efficiency.size());
   TGraphErrors *gr_V = new TGraphErrors(V_Efficiency.size());
   for(unsigned int i=0;i<V_Efficiency.size();i++)
   {
       gr_GIF->SetPoint(i, GIF_MeanPosOfSector[i], GIF_Efficiency[i]);
       gr_GIF->SetPointError(i,0, GIF_EfficiencyError[i]);
       
       gr_IV->SetPoint(i, IV_MeanPosOfSector[i], IV_Efficiency[i]);
       gr_IV->SetPointError(i,0, IV_EfficiencyError[i]);

       gr_V->SetPoint(i, V_MeanPosOfSector[i], V_Efficiency[i]);
       gr_V->SetPointError(i,0, V_EfficiencyError[i]);
   }
   gr_GIF->SetMarkerColor(kBlue);
   gr_GIF->SetLineColor(kBlue);
   gr_GIF->SetMarkerStyle(21);
   gr_GIF->GetXaxis()->SetTitle("dist (mm)");
   gr_GIF->GetYaxis()->SetTitle("Efficiency");
   gr_GIF->GetYaxis()->SetRangeUser(0,1.2);
   gr_GIF->SetTitle("Efficiency Scan");
   gr_GIF->Draw("ACP");
   gr_IV->SetMarkerColor(kGreen-6);
   gr_IV->SetLineColor(kGreen);
   gr_IV->SetMarkerStyle(21);
   gr_IV->Draw("sameCP");
   gr_V->SetMarkerColor(kBlack);
   gr_V->SetLineColor(kBlack);
   gr_V->SetMarkerStyle(21);
   gr_V->Draw("sameCP");

   //create a transparent pad drawn on top of the main pad
   c1->cd();
   TPad *overlay = new TPad("overlay","",0,0,1,1);
   overlay->SetFillStyle(4000);
   overlay->SetFillColor(0);
   overlay->SetFrameFillStyle(4000);
   overlay->Draw();
   overlay->cd();
   // create second graph
   //TGraphErrors* gr_GIF_Num = new TGraphErrors("data_noerror.dat","%lg %lg");
   TGraphErrors *gr_GIF_Num = new TGraphErrors(GIF_Nevents.size());
   TGraphErrors *gr_IV_Num = new TGraphErrors(IV_Nevents.size());
   TGraphErrors *gr_V_Num = new TGraphErrors(V_Nevents.size());

   for(unsigned int i=0;i<V_MeanPosOfSector.size();i++)
   {
       gr_GIF_Num->SetPoint(i,GIF_MeanPosOfSector[i],GIF_Nevents[i]);
       gr_IV_Num->SetPoint(i,IV_MeanPosOfSector[i],IV_Nevents[i]);
       gr_V_Num->SetPoint(i,V_MeanPosOfSector[i],V_Nevents[i]);

   }
   gr_GIF_Num->SetMarkerColor(kBlue);
   gr_GIF_Num->SetLineColor(kBlue);
   gr_GIF_Num->SetLineStyle(2);
   gr_GIF_Num->SetLineWidth(3);
   gr_GIF_Num->SetMarkerStyle(22);
   gr_GIF_Num->SetName("gr_GIF_Num");

   gr_IV_Num->SetMarkerColor(kGreen-6);
   gr_IV_Num->SetLineColor(kGreen);
   gr_IV_Num->SetMarkerStyle(22);
   gr_IV_Num->SetLineStyle(2);
   gr_IV_Num->SetLineWidth(3);
   gr_IV_Num->SetName("gr_IV_Num");

   gr_V_Num->SetMarkerColor(kBlack);
   gr_V_Num->SetLineColor(kBlack);
   gr_V_Num->SetMarkerStyle(22);
   gr_V_Num->SetLineStyle(2);
   gr_V_Num->SetLineWidth(3);
   gr_V_Num->SetName("gr_V_Num");

   Double_t xmin = pad->GetUxmin();
   Double_t ymin = 0;
   Double_t xmax = pad->GetUxmax();
   Double_t ymax = 1550;
   TH1F *hframe = overlay->DrawFrame(xmin,ymin,xmax,ymax);
   hframe->GetXaxis()->SetLabelOffset(99);
   hframe->GetYaxis()->SetLabelOffset(99);
   hframe->Draw("Y+");
   
   gr_GIF_Num->Draw("CPY+");
   gr_IV_Num->Draw("CPY+");
   gr_V_Num->Draw("CPY+");

   //Draw the Legend 
   TLegend *leg = new TLegend(0.10,0.732,0.40,0.90);
   leg->AddEntry(gr_GIF,"GE11_IV_GIF eff","LPE");
   leg->AddEntry(gr_IV,"GE11_IV eff","LPE");
   leg->AddEntry(gr_V,"GE11_V eff","LPE");
   leg->AddEntry(gr_GIF_Num,"No of events_GE11_IV_GIF","LPE");
   leg->AddEntry(gr_IV_Num,"No of events_GE11_IV","LPE");
   leg->AddEntry(gr_V_Num,"No of events_GE11_V","LPE");

   leg->Draw("same");

   const char *runnum = RunName.c_str();
   
   TLatex *t2a = new TLatex(0.00,0.94, runnum  );
   t2a->SetNDC();
   t2a->SetTextFont(42);
   t2a->SetTextSize(0.033);
   t2a->SetTextAlign(13);
   t2a->Draw("same");
   
   
   //Draw an axis on the right side
   TGaxis *axis = new TGaxis(xmax,ymin,xmax, ymax,ymin,ymax,510,"+L");
   axis->SetLineColor(kRed);
   axis->SetLabelColor(kRed);
   axis->SetTitle("Approx. No. of Events");

   axis->Draw();

   string OutputFileName = "GE11_Efficiency_Scan_"+std::to_string(RunNumber)+".pdf";
   const char *CharOutputFileName = OutputFileName.c_str();
   c1->SaveAs(CharOutputFileName);

   c1->Write();
   //tree->Write();
   //tree->Write("", TObject::kOverwrite);
   f->Write();

}
void makePlot(double canvasSizeX, double canvasSizeY,
	      TH1* histogramTTH, 
	      TH1* histogramData, 
	      TH1* histogramTT,
	      TH1* histogramTTV,
	      TH1* histogramEWK,
	      TH1* histogramRares,
	      TH1* histogramBgrSum,
	      TH1* histogramBgrUncertainty,		
	      const std::string& xAxisTitle, double xAxisOffset,
	      bool useLogScale, double yMin, double yMax, const std::string& yAxisTitle, double yAxisOffset,
	      const std::string& outputFileName)
{
  TH1* histogramTTH_density = 0;
  if ( histogramTTH ) {
    if ( histogramData ) checkCompatibleBinning(histogramTTH, histogramData);
    histogramTTH_density = divideHistogramByBinWidth(histogramTTH);
  }
  TH1* histogramData_density = 0;
  if ( histogramData ) {
    histogramData_density = divideHistogramByBinWidth(histogramData);      
  }
  TH1* histogramTT_density = 0;
  if ( histogramTT ) {
    if ( histogramData ) checkCompatibleBinning(histogramTT, histogramData);
    histogramTT_density = divideHistogramByBinWidth(histogramTT);
  } 
  TH1* histogramTTV_density = 0;
  if ( histogramTTV ) {
    if ( histogramData ) checkCompatibleBinning(histogramTTV, histogramData);
    histogramTTV_density = divideHistogramByBinWidth(histogramTTV);
  }    
  TH1* histogramEWK_density = 0;
  if ( histogramEWK ) {
    if ( histogramData ) checkCompatibleBinning(histogramEWK, histogramData);
    histogramEWK_density = divideHistogramByBinWidth(histogramEWK);
  }
  TH1* histogramRares_density = 0;
  if ( histogramRares ) {
    if ( histogramData ) checkCompatibleBinning(histogramRares, histogramData);
    histogramRares_density = divideHistogramByBinWidth(histogramRares);
  }    
  TH1* histogramBgrSum_density = 0;
  if ( histogramBgrSum ) {
    if ( histogramData ) checkCompatibleBinning(histogramBgrSum, histogramData);
    histogramBgrSum_density = divideHistogramByBinWidth(histogramBgrSum); 
  }
  TH1* histogramBgrUncertainty_density = 0;
  if ( histogramBgrUncertainty ) {
    if ( histogramData ) checkCompatibleBinning(histogramBgrUncertainty, histogramData);
    histogramBgrUncertainty_density = divideHistogramByBinWidth(histogramBgrUncertainty);
  }
  
  TCanvas* canvas = new TCanvas("canvas", "", canvasSizeX, canvasSizeY);
  canvas->SetFillColor(10);
  canvas->SetFillStyle(4000);
  canvas->SetFillColor(10);
  canvas->SetTicky();
  canvas->SetBorderSize(2);  
  canvas->SetLeftMargin(0.12);
  canvas->SetBottomMargin(0.12);
  
  TPad* topPad = new TPad("topPad", "topPad", 0.00, 0.35, 1.00, 1.00);
  topPad->SetFillColor(10);
  topPad->SetTopMargin(0.065);
  topPad->SetLeftMargin(0.15);
  topPad->SetBottomMargin(0.03);
  topPad->SetRightMargin(0.05);
  topPad->SetLogy(useLogScale);
  
  TPad* bottomPad = new TPad("bottomPad", "bottomPad", 0.00, 0.00, 1.00, 0.35);
  bottomPad->SetFillColor(10);
  bottomPad->SetTopMargin(0.02);
  bottomPad->SetLeftMargin(0.15);
  bottomPad->SetBottomMargin(0.31);
  bottomPad->SetRightMargin(0.05);
  bottomPad->SetLogy(false);
  
  canvas->cd();
  topPad->Draw();
  topPad->cd();
  
  TAxis* xAxis_top = histogramData_density->GetXaxis();
  xAxis_top->SetTitle(xAxisTitle.data());
  xAxis_top->SetTitleOffset(xAxisOffset);
  xAxis_top->SetLabelColor(10);
  xAxis_top->SetTitleColor(10);
    
  TAxis* yAxis_top = histogramData_density->GetYaxis();
  yAxis_top->SetTitle(yAxisTitle.data());
  yAxis_top->SetTitleOffset(yAxisOffset);
  yAxis_top->SetTitleSize(0.085);
  yAxis_top->SetLabelSize(0.05);
  yAxis_top->SetTickLength(0.04);  
  
  TLegend* legend = new TLegend(0.66, 0.45, 0.94, 0.92, NULL, "brNDC");
  legend->SetFillStyle(0);
  legend->SetBorderSize(0);
  legend->SetFillColor(10);
  legend->SetTextSize(0.055);
  
  histogramData_density->SetTitle("");
  histogramData_density->SetStats(false);
  histogramData_density->SetMaximum(yMax);
  histogramData_density->SetMinimum(yMin);
  histogramData_density->SetMarkerStyle(20);
  histogramData_density->SetMarkerSize(2);
  histogramData_density->SetMarkerColor(kBlack);
  histogramData_density->SetLineColor(kBlack);
  legend->AddEntry(histogramData_density, "Observed", "p");    
  
  histogramData_density->Draw("ep");
  
  legend->AddEntry(histogramTTH_density, "t#bar{t}H", "l");

  histogramTT_density->SetTitle("");
  histogramTT_density->SetStats(false);
  histogramTT_density->SetMaximum(yMax);
  histogramTT_density->SetMinimum(yMin);
  histogramTT_density->SetFillColor(kMagenta - 10); 
  legend->AddEntry(histogramTT_density, "t#bar{t}+jets", "f");

  histogramTTV_density->SetFillColor(kOrange - 4);
  legend->AddEntry(histogramTTV_density, "t#bar{t}+V", "f");

  histogramEWK_density->SetFillColor(kRed + 2); 
  legend->AddEntry(histogramEWK_density, "EWK", "f");

  histogramRares_density->SetFillColor(kBlue - 8); 
  legend->AddEntry(histogramRares_density, "Rares", "f");

  THStack* histogramStack_density = new THStack("stack", "");
  histogramStack_density->Add(histogramRares_density);
  histogramStack_density->Add(histogramEWK_density);
  histogramStack_density->Add(histogramTTV_density);
  histogramStack_density->Add(histogramTT_density);
  histogramStack_density->Draw("histsame");
  
  histogramBgrUncertainty_density->SetFillColor(kBlack);
  histogramBgrUncertainty_density->SetFillStyle(3344);    
  histogramBgrUncertainty_density->Draw("e2same");
  legend->AddEntry(histogramBgrUncertainty_density, "Uncertainty", "f");

  histogramTTH_density->SetLineWidth(2);
  histogramTTH_density->SetLineStyle(1);
  histogramTTH_density->SetLineColor(kBlue);
  histogramTTH_density->Draw("histsame");
  
  histogramData_density->Draw("epsame");
  histogramData_density->Draw("axissame");
  
  legend->Draw();
  
  addLabel_CMS_luminosity(0.2050, 0.9225, 0.6850);
  
  canvas->cd();
  bottomPad->Draw();
  bottomPad->cd();
  
  TH1* histogramRatio = (TH1*)histogramData->Clone("histogramRatio");
  histogramRatio->Reset();
  if ( !histogramRatio->GetSumw2N() ) histogramRatio->Sumw2();
  checkCompatibleBinning(histogramRatio, histogramBgrSum);
  histogramRatio->Divide(histogramData, histogramBgrSum);
  int numBins_bottom = histogramRatio->GetNbinsX();
  for ( int iBin = 1; iBin <= numBins_bottom; ++iBin ) {
    double binContent = histogramRatio->GetBinContent(iBin);
    if ( histogramData && histogramData->GetBinContent(iBin) >= 0. ) histogramRatio->SetBinContent(iBin, binContent - 1.0);
    else histogramRatio->SetBinContent(iBin, -10.);
  }
  histogramRatio->SetTitle("");
  histogramRatio->SetStats(false);
  histogramRatio->SetMinimum(-0.50);
  histogramRatio->SetMaximum(+0.50);
  histogramRatio->SetMarkerStyle(histogramData_density->GetMarkerStyle());
  histogramRatio->SetMarkerSize(histogramData_density->GetMarkerSize());
  histogramRatio->SetMarkerColor(histogramData_density->GetMarkerColor());
  histogramRatio->SetLineColor(histogramData_density->GetLineColor());
  histogramRatio->Draw("ep");
  
  TAxis* xAxis_bottom = histogramRatio->GetXaxis();
  xAxis_bottom->SetTitle(xAxis_top->GetTitle());
  xAxis_bottom->SetLabelColor(1);
  xAxis_bottom->SetTitleColor(1);
  xAxis_bottom->SetTitleOffset(1.20);
  xAxis_bottom->SetTitleSize(0.13);
  xAxis_bottom->SetLabelOffset(0.02);
  xAxis_bottom->SetLabelSize(0.10);
  xAxis_bottom->SetTickLength(0.055);
  
  TAxis* yAxis_bottom = histogramRatio->GetYaxis();
  yAxis_bottom->SetTitle("#frac{Data - Simulation}{Simulation}");
  yAxis_bottom->SetTitleOffset(0.80);
  yAxis_bottom->SetNdivisions(505);
  yAxis_bottom->CenterTitle();
  yAxis_bottom->SetTitleSize(0.09);
  yAxis_bottom->SetLabelSize(0.10);
  yAxis_bottom->SetTickLength(0.04);  
  
  TH1* histogramRatioUncertainty = (TH1*)histogramBgrUncertainty->Clone("histogramRatioUncertainty");
  if ( !histogramRatioUncertainty->GetSumw2N() ) histogramRatioUncertainty->Sumw2();
  checkCompatibleBinning(histogramRatioUncertainty, histogramBgrUncertainty);
  histogramRatioUncertainty->Divide(histogramBgrSum);
  int numBins = histogramRatioUncertainty->GetNbinsX();
  for ( int iBin = 1; iBin <= numBins; ++iBin ) {
    double binContent = histogramRatioUncertainty->GetBinContent(iBin);
    histogramRatioUncertainty->SetBinContent(iBin, binContent - 1.0);
  }
  histogramRatioUncertainty->SetFillColor(histogramBgrUncertainty_density->GetFillColor());
  //histogramRatioUncertainty->SetFillStyle(histogramBgrUncertainty_density->GetFillStyle());    
  histogramRatioUncertainty->SetFillStyle(3644);    
  
  TF1* line = new TF1("line","0", xAxis_bottom->GetXmin(), xAxis_bottom->GetXmax());
  line->SetLineStyle(3);
  line->SetLineWidth(1);
  line->SetLineColor(kBlack);
  line->Draw("same");
  
  histogramRatioUncertainty->Draw("e2same");
  
  histogramRatio->Draw("epsame");
  
  canvas->Update();
  size_t idx = outputFileName.find(".");
  std::string outputFileName_plot(outputFileName, 0, idx);
  if ( useLogScale ) outputFileName_plot.append("_log");
  else outputFileName_plot.append("_linear");
  if ( idx != std::string::npos ) canvas->Print(std::string(outputFileName_plot).append(std::string(outputFileName, idx)).data());
  canvas->Print(std::string(outputFileName_plot).append(".png").data());
  canvas->Print(std::string(outputFileName_plot).append(".pdf").data());
  canvas->Print(std::string(outputFileName_plot).append(".root").data());
  
  delete histogramTTH_density;
  delete histogramData_density;
  delete histogramTT_density;
  delete histogramTTV_density;
  delete histogramEWK_density;
  delete histogramRares_density;
  delete histogramBgrSum_density;
  //delete histogramBgrUncertainty_density;
  delete histogramStack_density;
  delete legend;
  delete topPad;
  delete histogramRatio;
  delete histogramRatioUncertainty;
  delete line;
  delete bottomPad;    
  delete canvas;
}
예제 #14
0
void plot(int mass) {
  double myQCDRelUncert = 0.038;
  double myEWKRelUncert = 0.131;
  double myFakesRelUncert = 0.238;
  double delta = 1.4;
  double br = 0.05;
  bool debug = false;
  bool log = false;
  double ymin = 0.001;
  double ymax = 48;
  
  static bool bMessage = false;
  if (!bMessage) {
    cout << "Values used as relative uncertainty (please check):" << endl;
    cout << "  QCD: " << myQCDRelUncert << endl;
    cout << "  EWK genuine tau: " << myEWKRelUncert << endl;
    cout << "  EWK fake tau: " << myFakesRelUncert << endl << endl;
    bMessage = true;
  }
  cout << "Processing mass point: " << mass << " GeV/c2" << endl;
  
  gStyle->SetOptFit(1);
  gStyle->SetOptStat(0);
  gStyle->SetOptTitle(0);
  gStyle->SetTitleFont(43, "xyz");
  gStyle->SetTitleSize(33, "xyz");
  gStyle->SetLabelFont(43, "xyz");
  gStyle->SetLabelSize(27, "xyz");
  
  //std::string infile = "EPS_data_nodeltaphi/hplus_100.root";
  //std::string infile = "EPS_data_deltaphi160/hplus_100.root";
  std::stringstream s;
  s << "lands_histograms_hplushadronic_m" << mass << ".root";

  std::string infile = s.str();
  
 // Canvas
  TCanvas *myCanvas = new TCanvas("myCanvas", "",0,0,600,600);
  myCanvas->SetHighLightColor(2);
  myCanvas->Range(0,0,1,1);
  myCanvas->SetFillColor(0);
  myCanvas->SetBorderMode(0);
  myCanvas->SetBorderSize(2);
  if (log)
    myCanvas->SetLogy();
  myCanvas->SetTickx(1);
  myCanvas->SetTicky(1);
  myCanvas->SetLeftMargin(0.16);
  myCanvas->SetRightMargin(0.05);
  myCanvas->SetTopMargin(0.05);
  myCanvas->SetBottomMargin(0.08);
  myCanvas->SetFrameFillStyle(0);
  myCanvas->SetFrameBorderMode(0);
  myCanvas->SetFrameFillStyle(0);
  myCanvas->SetFrameBorderMode(0);
  myCanvas->cd();

  Int_t ci;

  TFile* f = TFile::Open(infile.c_str());
  s.str("");
  s << "HW" << mass << "_1";
  TH1* hw = (TH1*)f->Get(s.str().c_str());
  s.str("");
  s << "HH" << mass << "_1";
  TH1* hh = (TH1*)f->Get(s.str().c_str());
  TH1* data = (TH1*)f->Get("data_obs");
  data->SetLineWidth(2);
  data->SetMarkerStyle(20);
  data->SetMarkerSize(1.2);

  TH1* ewktau = (TH1*)f->Get("EWK_Tau");
  ci = TColor::GetColor("#993399");
  ewktau->SetFillColor(ci);
  ewktau->SetLineWidth(0);
  TH1* ewkDY = (TH1*)f->Get("EWK_DYx");
  TH1* ewkVV = (TH1*)f->Get("EWK_VVx");
  ewktau->Add(ewkDY);
  ewktau->Add(ewkVV);
  
  //TH1* qcd = (TH1*)f->Get("QCDInv");
  TH1* qcd = (TH1*)f->Get("QCD");
  ci = TColor::GetColor("#ffcc33");
  qcd->SetFillColor(ci);
  qcd->SetLineWidth(0);
  TH1* fakett = (TH1*)f->Get("fake_tt");
  ci = TColor::GetColor("#669900");
  fakett->SetFillColor(ci);
  fakett->SetLineWidth(0);
  TH1* fakeW = (TH1*)f->Get("fake_W");
  ci = TColor::GetColor("#cc3300");
  fakeW->SetFillColor(ci);
  fakeW->SetLineWidth(0);
  TH1* faket = (TH1*)f->Get("fake_t");

  TH1F *hFrame = new TH1F("hFrame","",20,0,400);
  hFrame->SetMinimum(ymin);
  if (log)
    hFrame->SetMaximum(ymax*1.5);
  else
    hFrame->SetMaximum(ymax);
  hFrame->SetDirectory(0);
  hFrame->SetStats(0);
  hFrame->SetLineStyle(0);
  hFrame->SetMarkerStyle(20);
  hFrame->SetXTitle("Transverse mass (#tau jet, E_{T}^{miss}), (GeV/c^{2})");
  if (paperStatus)
    hFrame->SetXTitle("Transverse mass (#tau_{h}, E_{T}^{miss}), (GeV/c^{2})");
  hFrame->SetYTitle("Events / 20 GeV/c^{2}");
  hFrame->GetXaxis()->SetTitleSize(0);
  hFrame->GetXaxis()->SetLabelSize(0);
  hFrame->GetYaxis()->SetTitleFont(43);
  hFrame->GetYaxis()->SetTitleSize(27);
  hFrame->GetYaxis()->SetTitleOffset(1.3);
  

  // signal
  hh->Scale(br*br);
  hw->Scale(2*br*(1.0-br));
  TH1* signal = (TH1*)hh->Clone();
  signal->Add(hw);

  ci = TColor::GetColor("#ff3399");
  signal->SetLineColor(ci);
  signal->SetLineStyle(2);
  signal->SetLineWidth(2);

  // Fakes
  TH1* fakes = (TH1*)(fakett->Clone());
  fakes->Add(fakeW);
  fakes->Add(faket);

  // stacked backgrounds
  THStack *exp = new THStack();
  exp->SetName("exp");
  exp->SetTitle("exp");
  exp->Add(fakes);
  exp->Add(ewktau);
  exp->Add(qcd);
  exp->Add(signal);
  
  TH1* hExpBkg = (TH1*)fakes->Clone();
  hExpBkg->Add(ewktau);
  hExpBkg->Add(qcd);
  
  // uncertainty
  TH1* uncert = (TH1*)fakeW->Clone();
  uncert->Add(fakett);
  uncert->Add(ewktau);
  uncert->Add(qcd);
  uncert->SetFillColor(1);
  uncert->SetFillStyle(3344);
  uncert->SetLineColor(0);
  uncert->SetLineStyle(0);
  uncert->SetLineWidth(0);

  TH1* hExpBkgTotalUncert = (TH1*)uncert->Clone();
  hExpBkgTotalUncert->SetFillStyle(3354);

  TH1* hAgreement = (TH1*)data->Clone();
  hAgreement->Divide(hExpBkg);
  TGraphErrors* hAgreementRelUncert = new TGraphErrors(hAgreement->GetNbinsX());
  hAgreementRelUncert->SetLineWidth(2);
  hAgreementRelUncert->SetLineColor(kBlack);
  for (int i = 1; i <= hFrame->GetNbinsX(); ++i) {
    double myQCDTotalUncert = TMath::Power(qcd->GetBinError(i), 2)
      + TMath::Power(qcd->GetBinContent(i)*myQCDRelUncert, 2);
    double myEWKTotalUncert = TMath::Power(ewktau->GetBinError(i), 2)
      + TMath::Power(ewktau->GetBinContent(i)*myEWKRelUncert, 2);
    double myFakesTotalUncert = TMath::Power(fakes->GetBinError(i), 2)
      + TMath::Power(fakes->GetBinContent(i)*myFakesRelUncert, 2);
    hExpBkgTotalUncert->SetBinError(i, TMath::Sqrt(myQCDTotalUncert + myEWKTotalUncert + myFakesTotalUncert));

    if (hExpBkg->GetBinContent(i) > 0) {
      hAgreementRelUncert->SetPoint(i-1, hExpBkg->GetBinCenter(i), data->GetBinContent(i) / hExpBkg->GetBinContent(i));
      double myUncertData = 0;
      if (data->GetBinContent(i) > 0)
        myUncertData = TMath::Power(data->GetBinError(i) / data->GetBinContent(i), 2);
      double myUncertBkg = (myQCDTotalUncert + myEWKTotalUncert + myFakesTotalUncert) / TMath::Power(hExpBkg->GetBinContent(i), 2);
      hAgreementRelUncert->SetPointError(i-1, 0,  data->GetBinContent(i) / hExpBkg->GetBinContent(i) * TMath::Sqrt(myUncertData + myUncertBkg));
    } else {
      hAgreementRelUncert->SetPoint(i-1, hExpBkg->GetBinCenter(i), 0);
      hAgreementRelUncert->SetPointError(i-1, 0, 0);
    }
    if (debug) {
      cout << "Point: " << hAgreementRelUncert->GetX()[i-1]-10 << "-" << hAgreementRelUncert->GetX()[i-1]+10
          << " GeV/c2, agreement: " << hAgreementRelUncert->GetY()[i-1] << ", uncert: " << hAgreement->GetBinError(i) << ", " << hAgreementRelUncert->GetErrorY(i-1) << endl;
      cout << "  bkg. stat. uncert. " << hExpBkg->GetBinError(i) << " (i.e. " << hExpBkg->GetBinError(i) / hExpBkg->GetBinContent(i) * 100.0 << " %)"
          << ", stat+syst uncert. " << TMath::Sqrt(myQCDTotalUncert + myEWKTotalUncert + myFakesTotalUncert) 
          << " (i.e. " << TMath::Sqrt(myQCDTotalUncert + myEWKTotalUncert + myFakesTotalUncert) / hExpBkg->GetBinContent(i) * 100.0 << " %)" << endl;
    }
  }

  // Agreement pad
  TPad* pad = new TPad("ratiopad","ratiopad",0.,0.,1.,.3);
  pad->Draw();
  pad->cd();
  pad->Range(0,0,1,1);
  pad->SetFillColor(0);
  pad->SetFillStyle(4000);
  pad->SetBorderMode(0);
  pad->SetBorderSize(2);
  pad->SetTickx(1);
  pad->SetTicky(1);
  pad->SetLeftMargin(0.16);
  pad->SetRightMargin(0.05);
  pad->SetTopMargin(0);
  pad->SetBottomMargin(0.34);
  pad->SetFrameFillStyle(0);
  pad->SetFrameBorderMode(0);
  // Plot here ratio
  if (1.0-delta > 0)
    hAgreement->SetMinimum(1.0-delta);
  else
    hAgreement->SetMinimum(0.);
  hAgreement->SetMaximum(1.0+delta);
  hAgreement->GetXaxis()->SetLabelOffset(0.007);
  hAgreement->GetXaxis()->SetLabelFont(43);
  hAgreement->GetXaxis()->SetLabelSize(27);
  hAgreement->GetYaxis()->SetLabelFont(43);
  hAgreement->GetYaxis()->SetLabelSize(27);
  hAgreement->GetYaxis()->SetLabelOffset(0.007);
  hAgreement->GetYaxis()->SetNdivisions(505);
  hAgreement->GetXaxis()->SetTitleFont(43);
  hAgreement->GetYaxis()->SetTitleFont(43);
  hAgreement->GetXaxis()->SetTitleSize(33);
  hAgreement->GetYaxis()->SetTitleSize(33);
  hAgreement->SetTitleSize(27, "xyz");
  hAgreement->GetXaxis()->SetTitleOffset(3.2);
  hAgreement->GetYaxis()->SetTitleOffset(1.3);
  hAgreement->SetXTitle(hFrame->GetXaxis()->GetTitle());
  hAgreement->SetYTitle("Data/#Sigmabkg");
  hAgreement->Draw("e2");
  // Plot line at zero
  TH1* hAgreementLine = dynamic_cast<TH1*>(hAgreement->Clone());
  for (int i = 1; i <= hAgreementLine->GetNbinsX(); ++i) {
    hAgreementLine->SetBinContent(i,1.0);
    hAgreementLine->SetBinError(i,0.0);
  }
  hAgreementLine->SetLineColor(kRed);
  hAgreementLine->SetLineWidth(2);
  hAgreementLine->SetLineStyle(3);
  hAgreementLine->Draw("hist same");
  hAgreement->Draw("same");
  hAgreementRelUncert->Draw("[]");
  pad->RedrawAxis();

  myCanvas->cd();
  
  TPad* plotpad = new TPad("plotpad", "plotpad",0,0.3,1.,1.);
  plotpad->Draw();
  plotpad->cd();
  plotpad->Range(0,0,1,1);
  plotpad->SetFillColor(0);
  plotpad->SetFillStyle(4000);
  plotpad->SetBorderMode(0);
  plotpad->SetBorderSize(2);
  //if (logy)
  //  plotpad->SetLogy();
  plotpad->SetTickx(1);
  plotpad->SetTicky(1);
  plotpad->SetLeftMargin(0.16);
  plotpad->SetRightMargin(0.05);
  plotpad->SetTopMargin(0.065);
  plotpad->SetBottomMargin(0.0);
  plotpad->SetFrameFillStyle(0);
  plotpad->SetFrameBorderMode(0);
  
  hFrame->GetXaxis()->SetTitleSize(0);
  hFrame->GetXaxis()->SetLabelSize(0);
  hFrame->GetYaxis()->SetTitleFont(43);
  hFrame->GetYaxis()->SetTitleSize(33);
  hFrame->GetYaxis()->SetTitleOffset(1.3);
  
  // Draw objects
  hFrame->Draw();
  exp->Draw("hist same");
  uncert->Draw("E2 same");
  hExpBkgTotalUncert->Draw("E2 same");
  // Data
  data->Draw("same");
  
  //signal->Draw("same");
  TLegend *leg = new TLegend(0.53,0.6,0.87,0.91,NULL,"brNDC");
  leg->SetBorderSize(0);
  leg->SetTextFont(63);
  leg->SetTextSize(18);
  leg->SetLineColor(1);
  leg->SetLineStyle(1);
  leg->SetLineWidth(1);
  leg->SetFillColor(kWhite);
  //leg->SetFillStyle(4000); // enabling this will cause the plot to be erased from the pad
  TLegendEntry* entry = leg->AddEntry(data, "Data", "P");
  s.str("");
  s << "with H^{#pm}#rightarrow#tau^{#pm}#nu";
  entry = leg->AddEntry(signal, s.str().c_str(), "L");
  entry = leg->AddEntry(qcd, "QCD (meas.)", "F");
  entry = leg->AddEntry(ewktau, "EWK genuine #tau (meas.)", "F");
  entry = leg->AddEntry(fakes, "EWK fake #tau (MC)", "F");
  entry = leg->AddEntry(uncert, "stat. uncert.", "F");
  entry = leg->AddEntry(hExpBkgTotalUncert, "stat. #oplus syst. uncert.", "F");
  leg->Draw();
  
  string myTitle = "CMS Preliminary";
  if (paperStatus)
    myTitle = "CMS";

  TLatex *tex = new TLatex(0.62,0.945,myTitle.c_str());
  tex->SetNDC();
  tex->SetTextFont(43);
  tex->SetTextSize(27);
  tex->SetLineWidth(2);
  tex->Draw();
  tex = new TLatex(0.2,0.945,"#sqrt{s} = 7 TeV");
  tex->SetNDC();
  tex->SetTextFont(43);
  tex->SetTextSize(27);
  tex->SetLineWidth(2);
  tex->Draw();
  tex = new TLatex(0.43,0.945,"2.2 fb^{-1}");
  tex->SetNDC();
  tex->SetTextFont(43);
  tex->SetTextSize(27);
  tex->SetLineWidth(2);
  tex->Draw();

  s.str("");
  s << "m_{H^{#pm}} = " << mass << " GeV/c^{2}";
  tex = new TLatex(0.28,0.865,s.str().c_str());
  tex->SetNDC();
  tex->SetTextFont(63);
  tex->SetTextSize(20);
  tex->SetLineWidth(2);
  tex->Draw();
  s.str("");
  s << "BR(t#rightarrowbH^{#pm})=" << setprecision(2) << br;
  tex = new TLatex(0.28,0.805,s.str().c_str());
  tex->SetNDC();
  tex->SetTextFont(63);
  tex->SetTextSize(20);
  tex->SetLineWidth(2);
  tex->Draw();

  
  plotpad->RedrawAxis();
  plotpad->Modified();

  s.str("");
  s << "mT_datadriven_m" << mass << ".png";
  myCanvas->Print(s.str().c_str());
  s.str("");
  s << "mT_datadriven_m" << mass << ".C";
  myCanvas->Print(s.str().c_str());
  s.str("");
  s << "mT_datadriven_m" << mass << ".eps";
  myCanvas->Print(s.str().c_str());
   

}
예제 #15
0
void DrawBoosted(TString VAR, float XMIN, float XMAX, int REBIN, TString XTITLE)
{
  gROOT->ForceStyle();
  const int N = 7;
  float XSEC[N] = {1.74e+6,3.67e+5,2.94e+4,6.524e+03,1.064e+03,121.5,2.542e+01};

  TString SAMPLE[N] = {
    "QCD_HT200to300",
    "QCD_HT300to500",
    "QCD_HT500to700", 
    "QCD_HT700to1000",
    "QCD_HT1000to1500",
    "QCD_HT1500to2000",
    "QCD_HT2000toInf" 
  };
 
  TFile *inf[N];
  TH1F  *h0[N],*h1[N];
  TH1F  *hQCD0,*hQCD1; 

  TCanvas *can = new TCanvas("Boosted","Boosted",900,600);
  can->cd(1);
  can->SetBottomMargin(0.3);
  //can->SetRightMargin(0.15);
  for(int k=0;k<N;k++) {
    inf[k] = TFile::Open("Histo_"+SAMPLE[k]+".root");
    h0[k]  = (TH1F*)inf[k]->Get("hadtopBoost/h_"+VAR+"_Cut_ctl");
    h0[k]->Sumw2();
    h0[k]->Rebin(REBIN);
    h1[k]  = (TH1F*)inf[k]->Get("hadtopBoost/h_"+VAR+"_Cut_sig");
    h1[k]->Sumw2();
    h1[k]->Rebin(REBIN);
    h0[k]->Scale(XSEC[k]/((TH1F*)inf[k]->Get("hadtopBoost/TriggerPass"))->GetBinContent(1));
    h1[k]->Scale(XSEC[k]/((TH1F*)inf[k]->Get("hadtopBoost/TriggerPass"))->GetBinContent(1)); 
    cout<<SAMPLE[k]<<": "<<h0[k]->GetEntries()<<" "<<h0[k]->Integral()<<endl;
    if (k == 0) {
      hQCD0 = (TH1F*)h0[k]->Clone();
      hQCD1 = (TH1F*)h1[k]->Clone();
    }
    if (k > 0) {
      hQCD0->Add(h0[k]);
      hQCD1->Add(h1[k]);
    }
  } 
  hQCD0->Scale(1/hQCD0->Integral());
  hQCD1->Scale(1/hQCD1->Integral());
  double max1 = TMath::Max(hQCD0->GetBinContent(hQCD0->GetMaximumBin()),hQCD1->GetBinContent(hQCD1->GetMaximumBin()));
  hQCD0->SetMaximum(1.2*max1);
  hQCD0->SetMinimum(1e-4);
  hQCD0->GetXaxis()->SetLabelSize(0.0);
  hQCD0->GetXaxis()->SetRangeUser(XMIN,XMAX); 
  hQCD0->Draw("HIST");
  hQCD1->Draw("sameE");

  TLegend *leg = new TLegend(0.6,0.7,0.9,0.9);
  leg->SetHeader("QCD Closure");
  leg->SetBorderSize(0);
  leg->SetTextFont(42);
  leg->SetTextSize(0.05);
  leg->AddEntry(hQCD1,"Signal sample","P");
  leg->AddEntry(hQCD0,"Control sample","F");
  leg->Draw();

  TH1F *hRatio = (TH1F*)hQCD1->Clone("Ratio");
  hRatio->Divide(hQCD0);

  hRatio->SetLineColor(kBlack);
  hRatio->SetMarkerColor(kBlack);

  TPad* pad = new TPad("pad", "pad", 0., 0., 1., 1.);
  pad->SetTopMargin(0.7);
  //pad->SetRightMargin(0.15);
  pad->SetFillColor(0);
  pad->SetFillStyle(0);
  pad->Draw();
  pad->cd(0);
  gPad->SetGridy();
  hRatio->GetXaxis()->SetTitle(XTITLE);
  hRatio->GetXaxis()->SetRangeUser(XMIN,XMAX); 
  hRatio->GetYaxis()->SetNdivisions(505);
  hRatio->GetYaxis()->SetRangeUser(0,2);
  hRatio->GetYaxis()->SetLabelSize(0.04);
  hRatio->Draw();
  hRatio->Draw("same");
}
예제 #16
0
void AccTimesEff::Loop()
{
   TStopwatch timer;
   timer.Start();
   // parameters /////////////////////////////////////////////////////////////
   vector<TString> files;
   files.push_back("file:////user/treis/mcsamples/ZprimeToEMu_M-500_noAccCuts_TuneZ2star_8TeV_madgraph_treis-Summer12_DR53X_PU_S10_START53_V7C1-v1_9999ev.root");
   files.push_back("file:////user/treis/mcsamples/ZprimeToEMu_M-750_noAccCuts_TuneZ2star_8TeV_madgraph_treis-Summer12_DR53X_PU_S10_START53_V7C1-v1_10000ev.root");
   files.push_back("file:////user/treis/mcsamples/ZprimeToEMu_M-1000_noAccCuts_TuneZ2star_8TeV_madgraph_treis-Summer12_DR53X_PU_S10_START53_V7C1-v1_9998ev.root");
   files.push_back("file:////user/treis/mcsamples/ZprimeToEMu_M-1250_noAccCuts_TuneZ2star_8TeV_madgraph_treis-Summer12_DR53X_PU_S10_START53_V7C1-v1_9998ev.root");
   files.push_back("file:////user/treis/mcsamples/ZprimeToEMu_M-1500_noAccCuts_TuneZ2star_8TeV_madgraph_treis-Summer12_DR53X_PU_S10_START53_V7C1-v1_9997ev.root");
   files.push_back("file:////user/treis/mcsamples/ZprimeToEMu_M-1750_noAccCuts_TuneZ2star_8TeV_madgraph_treis-Summer12_DR53X_PU_S10_START53_V7C1-v1_9997ev.root");
   files.push_back("file:////user/treis/mcsamples/ZprimeToEMu_M-2000_noAccCuts_TuneZ2star_8TeV_madgraph_treis-Summer12_DR53X_PU_S10_START53_V7C1-v1_9999ev.root");
   files.push_back("file:////user/treis/mcsamples/ZprimeToEMu_M-2500_noAccCuts_TuneZ2star_8TeV_madgraph_treis-Summer12_DR53X_PU_S10_START53_V7C1-v1_9999ev.root");
   files.push_back("file:////user/treis/mcsamples/ZprimeToEMu_M-3000_noAccCuts_TuneZ2star_8TeV_madgraph_treis-Summer12_DR53X_PU_S10_START53_V7C1-v1_10000ev.root");
   files.push_back("file:////user/treis/mcsamples/ZprimeToEMu_M-3500_noAccCuts_TuneZ2star_8TeV_madgraph_treis-Summer12_DR53X_PU_S10_START53_V7C1-v1_9898ev.root");
   files.push_back("file:////user/treis/mcsamples/ZprimeToEMu_M-4000_noAccCuts_TuneZ2star_8TeV_madgraph_treis-Summer12_DR53X_PU_S10_START53_V7C1-v1_9998ev.root");
   files.push_back("file:////user/treis/mcsamples/ZprimeToEMu_M-5000_noAccCuts_TuneZ2star_8TeV_madgraph_treis-Summer12_DR53X_PU_S10_START53_V7C1-v1_9966ev.root");
   string outfileName = "accTimesEffHistos";

   // output file formats
   const bool saveSpec = 0;
   const bool saveAsPdf = 0;
   const bool saveAsPng = 1;
   const bool saveAsRoot = 0;
   TString plotDir = "./plots/";

   int font = 42; //62
   // selection cuts /////////////////////////////////////////////////////////
   float elePtCut = 35.;
   float muPtCut = 35.;
   float minInvMass = 0.;

   TH1::SetDefaultSumw2(kTRUE);

   ///////////////////////////////////////////////////////////////////////////

   ///////////////////////////////////////////////////////////////////////////

   TH1F *hGenEvts = new TH1F("hGenEvts", "hGenEvts", 145, 0., 5010.);
   hGenEvts->GetXaxis()->SetTitle("M_{Z'}^{truth}");
   hGenEvts->GetXaxis()->SetTitleFont(font);
   hGenEvts->GetXaxis()->SetLabelFont(font);
   hGenEvts->GetYaxis()->SetTitle("Events");
   hGenEvts->GetYaxis()->SetTitleFont(font);
   hGenEvts->GetYaxis()->SetLabelFont(font);
   hGenEvts->GetYaxis()->SetTitleOffset(1.2);
   hGenEvts->SetLineColor(kBlack);
   hGenEvts->SetLineWidth(2);
   hGenEvts->SetMarkerStyle(20);
   hGenEvts->SetMarkerColor(kBlack);
   TH1F *hGenEvtsEleInAcc = (TH1F*)hGenEvts->Clone("hGenEvtsEleInAcc");
   TH1F *hGenEvtsEleInAccEB = (TH1F*)hGenEvts->Clone("hGenEvtsEleInAccEB");
   TH1F *hGenEvtsEleInAccEE = (TH1F*)hGenEvts->Clone("hGenEvtsEleInAccEE");
   TH1F *hGenEvtsMuInAcc = (TH1F*)hGenEvts->Clone("hGenEvtsMuInAcc");
   TH1F *hGenEvtsInAcc = (TH1F*)hGenEvts->Clone("hGenEvtsInAcc");
   TH1F *hTrgEvts = (TH1F*)hGenEvts->Clone("hTrgEvts");
   hTrgEvts->SetTitle("hTrgEvts");
   TH1F *hRecoEvts = (TH1F*)hGenEvts->Clone("hRecoEvts");
   hRecoEvts->SetTitle("hRecoEvts");
   TH1F *hRecoEvtsEB = (TH1F*)hRecoEvts->Clone("hRecoEvtsEB");
   TH1F *hRecoEvtsEE = (TH1F*)hRecoEvts->Clone("hRecoEvtsEE");
   TH1F *hRecoEleEvts = (TH1F*)hRecoEvts->Clone("hRecoEleEvts");
   TH1F *hRecoEleEvtsEB = (TH1F*)hRecoEvts->Clone("hRecoEleEvtsEB");
   TH1F *hRecoEleEvtsEE = (TH1F*)hRecoEvts->Clone("hRecoEleEvtsEE");
   TH1F *hRecoMuEvts = (TH1F*)hRecoEvts->Clone("hRecoMuEvts");
   TH1F *hRecoNoTrgEvts = (TH1F*)hGenEvts->Clone("hRecoNoTrgEvts");
   hRecoNoTrgEvts->SetTitle("hRecoNoTrgEvts");
   TH1F *hRecoNoTrgEvtsEB = (TH1F*)hRecoNoTrgEvts->Clone("hRecoNoTrgEvtsEB");
   TH1F *hRecoNoTrgEvtsEE = (TH1F*)hRecoNoTrgEvts->Clone("hRecoNoTrgEvtsEE");
   TH1F *hRecoNoTrgEleEvts = (TH1F*)hRecoNoTrgEvts->Clone("hRecoNoTrgEleEvts");
   TH1F *hRecoNoTrgEleEvtsEB = (TH1F*)hRecoNoTrgEvts->Clone("hRecoNoTrgEleEvtsEB");
   TH1F *hRecoNoTrgEleEvtsEE = (TH1F*)hRecoNoTrgEvts->Clone("hRecoNoTrgEleEvtsEE");
   TH1F *hRecoNoTrgMuEvts = (TH1F*)hRecoNoTrgEvts->Clone("hRecoNoTrgMuEvts");
   TH1F* hAcc;
   TH1F* hAccEle;
   TH1F* hAccEleEB;
   TH1F* hAccEleEE;
   TH1F* hAccMu;
   TH1F* hAccTimesTrgEff;
   TH1F* hTrgEff;
   TH1F* hAccTimesEff;
   TH1F* hAccTimesEffEB;
   TH1F* hAccTimesEffEE;
   TH1F* hAccTimesEffEle;
   TH1F* hAccTimesEffEleEB;
   TH1F* hAccTimesEffEleEE;
   TH1F* hAccTimesEffMu;
   TH1F* hAccTimesEffNoTrg;
   //TH1F* hAccTimesEffNoTrgEB;
   //TH1F* hAccTimesEffNoTrgEE;
   TH1F* hAccTimesEffNoTrgEle;
   TH1F* hAccTimesEffNoTrgEleEB;
   TH1F* hAccTimesEffNoTrgEleEE;
   TH1F* hAccTimesEffNoTrgMu;
   TH1F* hEffAftTrg;
   TH1F* hEffAftTrgEle;
   TH1F* hEffAftTrgEleEB;
   TH1F* hEffAftTrgEleEE;
   TH1F* hEffAftTrgMu;
   TH1F* hTrgRecoVsReco;
   //TH1F* hTrgRecoVsRecoEB;
   //TH1F* hTrgRecoVsRecoEE;
   TH1F* hTrgRecoVsRecoEle;
   TH1F* hTrgRecoVsRecoEleEB;
   TH1F* hTrgRecoVsRecoEleEE;
   TH1F* hTrgRecoVsRecoMu;

   // output file
   stringstream ssOutfile;
   ssOutfile << outfileName << ".root";
   TFile *output = new TFile(ssOutfile.str().c_str(), "recreate");

   ///////////////////////////////////////////////////////////////////////////
   //LOOP OVER FILES 
   ///////////////////////////////////////////////////////////////////////////
   for (unsigned int p = 0; p < files.size(); ++p) {
      TFile* input = new TFile(files[p]);
      TTree *thetree = (TTree*)input->Get("gsfcheckerjob/tree");
      Init(thetree);
      Long64_t nentries = fChain->GetEntriesFast();
      cout << nentries << " events" << endl;

      unsigned int evCounter = 0;
      /////////////////////////////////////////////////////////////////////////////////////////////
      //LOOP OVER EVENTS
      /////////////////////////////////////////////////////////////////////////////////////////////
      //nentries = 10000;
      for (Long64_t jentry = 0; jentry < nentries; ++jentry) {
         Long64_t ientry = LoadTree(jentry);
         if (ientry < 0) break;
         fChain->GetEntry(jentry);
         // if (Cut(ientry) < 0) continue;
         //if (jentry % 50000 == 0) cout << "Processing event " << jentry << endl;
         thetree->GetEntry(jentry);

         // fill the gen histograms
         hGenEvts->Fill(genelemom_mass[0]);

         // fill the acc histograms
         if (hardGenEle_pt[0] > elePtCut) {
            if (fabs(hardGenEle_eta[0]) < 1.442) {
               hGenEvtsEleInAcc->Fill(genelemom_mass[0]);
               hGenEvtsEleInAccEB->Fill(genelemom_mass[0]);
            }
            else if (fabs(hardGenEle_eta[0]) > 1.56 && fabs(hardGenEle_eta[0]) < 2.5) {
               hGenEvtsEleInAcc->Fill(genelemom_mass[0]);
               hGenEvtsEleInAccEE->Fill(genelemom_mass[0]);
            }
         }
         if (hardGenMu_pt[0] > muPtCut && fabs(hardGenMu_eta[0]) < 2.4) {
            hGenEvtsMuInAcc->Fill(genelemom_mass[0]);
            if (fabs(hardGenEle_eta[0]) < 1.442 || (fabs(hardGenEle_eta[0]) > 1.56 && fabs(hardGenEle_eta[0]) < 2.5)) {
               if (hardGenEle_pt[0] > elePtCut) hGenEvtsInAcc->Fill(genelemom_mass[0]);
            }
         }

         // trigger?
         if (HLT_Mu22_Photon22_CaloIdL) hTrgEvts->Fill(genelemom_mass[0]);

         // at least one gsf electron and one muon above the threshold
         if (gsf_size < 1 || muon_size < 1) continue;

         vector<int> GSF_passHEEP;
         vector<int> MU_passGOOD;
         /////////////////////////////////////////////////////////////////////////////////////////////
         //loop over electrons
         for (int j = 0; j < gsf_size; ++j) {
            //cleaning: fake electrons from muons
            bool fakeEle = false;
            for (int k = 0; k < muon_size; ++k) {
               float DeltaR = deltaR(gsf_eta[j], gsf_phi[j], muon_eta[k], muon_phi[k]);
               if (DeltaR < 0.1) {
                  fakeEle = true;
                  break;
               }
            }
            if (fakeEle) continue;

            if (PassHEEP(j)) GSF_passHEEP.push_back(j);
         }

         //loop over muons
         for (int j = 0; j < muon_size; ++j) {
            if (PassHighPtMu(j)) MU_passGOOD.push_back(j);
         }

         if (GSF_passHEEP.size() == 1) {
            if (HLT_Mu22_Photon22_CaloIdL) {
               hRecoEleEvts->Fill(genelemom_mass[0]);
               if (fabs(gsfsc_eta[GSF_passHEEP[0]]) < 1.5) hRecoEleEvtsEB->Fill(genelemom_mass[0]);
               if (fabs(gsfsc_eta[GSF_passHEEP[0]]) > 1.5) hRecoEleEvtsEE->Fill(genelemom_mass[0]);
            }
            hRecoNoTrgEleEvts->Fill(genelemom_mass[0]);
            if (fabs(gsfsc_eta[GSF_passHEEP[0]]) < 1.5) hRecoNoTrgEleEvtsEB->Fill(genelemom_mass[0]);
            if (fabs(gsfsc_eta[GSF_passHEEP[0]]) > 1.5) hRecoNoTrgEleEvtsEE->Fill(genelemom_mass[0]);
         } 
         if (MU_passGOOD.size() == 1) {
            if (HLT_Mu22_Photon22_CaloIdL) hRecoMuEvts->Fill(genelemom_mass[0]);
            hRecoNoTrgMuEvts->Fill(genelemom_mass[0]);
         }

         // veto when there are more than one good candidates
         if (GSF_passHEEP.size() != 1 || MU_passGOOD.size() != 1) continue;

         //HEEP ele + GOOD muon
         TLorentzVector ele1;
         TLorentzVector mu1;

         ele1.SetPtEtaPhiM(gsf_gsfet[GSF_passHEEP[0]], gsf_eta[GSF_passHEEP[0]], gsf_phi[GSF_passHEEP[0]], 0.000511);
         mu1.SetPtEtaPhiM(muon_pt[MU_passGOOD[0]], muon_eta[MU_passGOOD[0]], muon_phi[MU_passGOOD[0]], 0.10566);

         double invMass = (ele1 + mu1).M();

         //MASS CUT
         if (invMass < minInvMass) continue;

         if (HLT_Mu22_Photon22_CaloIdL) {
            hRecoEvts->Fill(genelemom_mass[0]);
            if (fabs(gsfsc_eta[GSF_passHEEP[0]]) < 1.5) hRecoEvtsEB->Fill(genelemom_mass[0]);
            if (fabs(gsfsc_eta[GSF_passHEEP[0]]) > 1.5) hRecoEvtsEE->Fill(genelemom_mass[0]);
         }
         hRecoNoTrgEvts->Fill(genelemom_mass[0]);
         if (fabs(gsfsc_eta[GSF_passHEEP[0]]) < 1.5) hRecoNoTrgEvtsEB->Fill(genelemom_mass[0]);
         if (fabs(gsfsc_eta[GSF_passHEEP[0]]) > 1.5) hRecoNoTrgEvtsEE->Fill(genelemom_mass[0]);
         ++evCounter;
        ///////////////////////////////////////////////////////////////////////
      } //END LOOP OVER EVENTS
        //////////////////////////////////////////////////////////////////////

     //////////////////////////////////////////////////////////////////////////
   } //END LOOP OVER FILES
     //////////////////////////////////////////////////////////////////////////
   hAcc = (TH1F*)hGenEvtsInAcc->Clone("hAcc");
   hAccEle = (TH1F*)hGenEvtsEleInAcc->Clone("hAccEle");
   hAccEleEB = (TH1F*)hGenEvtsEleInAccEB->Clone("hAccEleEB");
   hAccEleEE = (TH1F*)hGenEvtsEleInAccEE->Clone("hAccEleEE");
   hAccMu = (TH1F*)hGenEvtsMuInAcc->Clone("hAccMu");
   hAccTimesTrgEff = (TH1F*)hTrgEvts->Clone("hAccTimesTrgEff");
   hTrgEff = (TH1F*)hTrgEvts->Clone("hTrgEff");
   hAccTimesEff = (TH1F*)hRecoEvts->Clone("hAccTimesEff");
   hAccTimesEffEB = (TH1F*)hRecoEvtsEB->Clone("hAccTimesEffEB");
   hAccTimesEffEE = (TH1F*)hRecoEvtsEE->Clone("hAccTimesEffEE");
   hAccTimesEffEle = (TH1F*)hRecoEleEvts->Clone("hAccTimesEffEle");
   hAccTimesEffEleEB = (TH1F*)hRecoEleEvtsEB->Clone("hAccTimesEffEleEB");
   hAccTimesEffEleEE = (TH1F*)hRecoEleEvtsEE->Clone("hAccTimesEffEleEE");
   hAccTimesEffMu = (TH1F*)hRecoMuEvts->Clone("hAccTimesEffMu");
   hAccTimesEffNoTrg = (TH1F*)hRecoNoTrgEvts->Clone("hAccTimesEffNoTrg");
   //hAccTimesEffNoTrgEB = (TH1F*)hRecoNoTrgEvtsEB->Clone("hAccTimesEffNoTrgEB");
   //hAccTimesEffNoTrgEE = (TH1F*)hRecoNoTrgEvtsEE->Clone("hAccTimesEffNoTrgEE");
   hAccTimesEffNoTrgEle = (TH1F*)hRecoNoTrgEleEvts->Clone("hAccTimesEffNoTrgEle");
   hAccTimesEffNoTrgEleEB = (TH1F*)hRecoNoTrgEleEvtsEB->Clone("hAccTimesEffNoTrgEleEB");
   hAccTimesEffNoTrgEleEE = (TH1F*)hRecoNoTrgEleEvtsEE->Clone("hAccTimesEffNoTrgEleEE");
   hAccTimesEffNoTrgMu = (TH1F*)hRecoNoTrgMuEvts->Clone("hAccTimesEffNoTrgMu");
   hEffAftTrg = (TH1F*)hRecoEvts->Clone("hAccTimesEff");
   hEffAftTrgEle = (TH1F*)hRecoEleEvts->Clone("hAccTimesEffEle");
   hEffAftTrgEleEB = (TH1F*)hRecoEleEvtsEB->Clone("hAccTimesEffEleEB");
   hEffAftTrgEleEE = (TH1F*)hRecoEleEvtsEE->Clone("hAccTimesEffEleEE");
   hEffAftTrgMu = (TH1F*)hRecoMuEvts->Clone("hAccTimesEffMu");
   hTrgRecoVsReco = (TH1F*)hRecoEvts->Clone("hTrgRecoVsReco");
   //hTrgRecoVsRecoEB = (TH1F*)hRecoEvtsEB->Clone("hTrgRecoVsRecoEB");
   //hTrgRecoVsRecoEE = (TH1F*)hRecoEvtsEE->Clone("hTrgRecoVsRecoEE");
   hTrgRecoVsRecoEle = (TH1F*)hRecoEleEvts->Clone("hTrgRecoVsRecoEle");
   hTrgRecoVsRecoEleEB = (TH1F*)hRecoEleEvtsEB->Clone("hTrgRecoVsRecoEleEB");
   hTrgRecoVsRecoEleEE = (TH1F*)hRecoEleEvtsEE->Clone("hTrgRecoVsRecoEleEE");
   hTrgRecoVsRecoMu = (TH1F*)hRecoMuEvts->Clone("hTrgRecoVsRecoMu");
   hAcc->Divide(hGenEvts);
   hAccEle->Divide(hGenEvts);
   hAccEleEB->Divide(hGenEvts);
   hAccEleEE->Divide(hGenEvts);
   hAccMu->Divide(hGenEvts);
   hAccTimesTrgEff->Divide(hGenEvts);
   hTrgEff->Divide(hGenEvtsInAcc);
   hAccTimesEff->Divide(hGenEvts);
   hAccTimesEffEB->Divide(hGenEvts);
   hAccTimesEffEE->Divide(hGenEvts);
   hAccTimesEffEle->Divide(hGenEvts);
   hAccTimesEffEleEB->Divide(hGenEvts);
   hAccTimesEffEleEE->Divide(hGenEvts);
   hAccTimesEffMu->Divide(hGenEvts);
   hAccTimesEffNoTrg->Divide(hGenEvts);
   //hAccTimesEffNoTrgEB->Divide(hGenEvts);
   //hAccTimesEffNoTrgEE->Divide(hGenEvts);
   hAccTimesEffNoTrgEle->Divide(hGenEvts);
   hAccTimesEffNoTrgEleEB->Divide(hGenEvts);
   hAccTimesEffNoTrgEleEE->Divide(hGenEvts);
   hAccTimesEffNoTrgMu->Divide(hGenEvts);
   hEffAftTrg->Divide(hTrgEvts);
   hEffAftTrgEle->Divide(hTrgEvts);
   hEffAftTrgEleEB->Divide(hTrgEvts);
   hEffAftTrgEleEE->Divide(hTrgEvts);
   hEffAftTrgMu->Divide(hTrgEvts);
   hTrgRecoVsReco->Divide(hRecoNoTrgEvts);
   //hTrgRecoVsRecoEB->Divide(hRecoNoTrgEvtsEB);
   //hTrgRecoVsRecoEE->Divide(hRecoNoTrgEvtsEE);
   hTrgRecoVsRecoEle->Divide(hRecoNoTrgEleEvts);
   hTrgRecoVsRecoEleEB->Divide(hRecoNoTrgEleEvtsEB);
   hTrgRecoVsRecoEleEE->Divide(hRecoNoTrgEleEvtsEE);
   hTrgRecoVsRecoMu->Divide(hRecoNoTrgMuEvts);

   // plot
   TCanvas *accTimesEffPlot = new TCanvas("accTimesEffPlot", "acc x eff", 100, 100, 600, 600);
   TPad *accTimesEffPad = new TPad("accTimesEffPad", "acc x eff pad", 0., 0., 1., 1.);
   accTimesEffPad->SetBottomMargin(0.12);
   accTimesEffPad->SetBorderMode(0);
   accTimesEffPad->SetBorderSize(2);
   accTimesEffPad->SetFrameBorderMode(0);
   accTimesEffPad->SetFillColor(0);
   accTimesEffPad->SetFrameFillColor(0);
   accTimesEffPad->SetLeftMargin(0.11);
   accTimesEffPad->SetRightMargin(0.09);
   accTimesEffPad->SetTopMargin(0.08);
   accTimesEffPad->SetTickx(1);
   accTimesEffPad->SetTicky(1);
   accTimesEffPad->Draw();
   accTimesEffPad->cd();

   gStyle->SetTitleFont(font);
   gStyle->SetLabelFont(font);
   gStyle->SetLegendFont(font);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   gStyle->SetOptFit(1111);
   gStyle->SetTitleXOffset(1.);
   gStyle->SetTitleYOffset(1.3);
   gPad->SetTicks(1, 1);
   gPad->SetGrid(1, 1);

   TH1F* hAccTimesEff2 = (TH1F*)hAccTimesEff->Clone("hAccTimesEff2");

   TF1 *fitFunc = new TF1("fitFunc", "[0] + [1]/ (x + [2]) + [3]*x", 10., 5010.);
   //TF1 *fitFuncEB = new TF1("fitFuncEB", "[0] + [1]/ (x + [2])", 10., 5010.);
   TF1 *fitFuncEB = new TF1("fitFuncEB", "[0] + [1]/ (x + [2]) + [3]*x", 10., 5010.);
   TF1 *fitFuncEE = new TF1("fitFuncEE", "[0] + [1]/ (x*x + [2])", 10., 5010.);
   fitFunc->SetLineColor(kBlue);
   fitFuncEB->SetLineColor(kBlue);
   fitFuncEE->SetLineColor(kBlue);
   hAccTimesEff->Fit("fitFunc", "", "", 480., 5010.);
   hAccTimesEffEB->Fit("fitFuncEB", "", "", 480., 5010.);
   hAccTimesEffEE->Fit("fitFuncEE", "", "", 480., 5010.);
   cout << "Chi^2 / NDF: " << fitFunc->GetChisquare() << " / " << fitFunc->GetNDF() << ", prob: " << fitFunc->GetProb() << endl;
   cout << "Chi^2 / NDF EB: " << fitFuncEB->GetChisquare() << " / " << fitFuncEB->GetNDF() << ", prob: " << fitFuncEB->GetProb() << endl;
   cout << "Chi^2 / NDF EE: " << fitFuncEE->GetChisquare() << " / " << fitFuncEE->GetNDF() << ", prob: " << fitFuncEE->GetProb() << endl;

   hAccTimesEff->GetYaxis()->SetTitle("acc x eff");
   hAccTimesEff->GetYaxis()->SetRangeUser(0., 1.);
   hAccTimesEff->Draw();
   TLatex *tex = new TLatex(0.22, 0.21, "P(M|p0,p1,p2,p3) = p0 + #frac{p1}{M+p2} + p3*M");
   tex->SetNDC();
   tex->SetTextFont(font);
   tex->SetLineWidth(2);
   tex->SetTextSize(0.03);
   tex->Draw();
   tex->DrawLatex(0.109, 0.935, "CMS Simulation, 8 TeV");
   tex->DrawLatex(0.17, 0.85, "trg + electron + muon");

   TCanvas *accTimesEffPlotEB = new TCanvas("accTimesEffPlotEB", "acc x eff, barrel electron + muon", 100, 100, 600, 600);
   TPad *accTimesEffPadEB = (TPad*)accTimesEffPad->Clone("accTimesEffPadEB");
   accTimesEffPadEB->Draw(); 
   accTimesEffPadEB->cd();
   hAccTimesEffEB->GetYaxis()->SetTitle("acc x eff");
   hAccTimesEffEB->GetYaxis()->SetRangeUser(0., 1.);
   hAccTimesEffEB->Draw();
   tex->DrawLatex(0.109, 0.935, "CMS Simulation, 8 TeV");
   //tex->DrawLatex(0.46, 0.21, "P(M|p0,p1,p2) = p0 + #frac{p1}{M+p2}");
   tex->DrawLatex(0.22, 0.21, "P(M|p0,p1,p2,p3) = p0 + #frac{p1}{M+p2} + p3*M");
   tex->DrawLatex(0.17, 0.85, "trg + barrel electron + muon");

   TCanvas *accTimesEffPlotEE = new TCanvas("accTimesEffPlotEE", "acc x eff, endcap electron + muon", 100, 100, 600, 600);
   TPad *accTimesEffPadEE = (TPad*)accTimesEffPad->Clone("accTimesEffPadEE");
   accTimesEffPadEE->Draw(); 
   accTimesEffPadEE->cd();
   hAccTimesEffEE->GetYaxis()->SetTitle("acc x eff");
   hAccTimesEffEE->GetYaxis()->SetRangeUser(0., 1.);
   hAccTimesEffEE->Draw();
   tex->DrawLatex(0.109, 0.935, "CMS Simulation, 8 TeV");
   tex->DrawLatex(0.45, 0.38, "P(M|p0,p1,p2) = p0 + #frac{p1}{M^{2}+p2}");
   tex->DrawLatex(0.17, 0.85, "trg + endcap electron + muon");

   TCanvas *accTimesEffObjPlot = new TCanvas("accTimesEffObjPlot", "acc x eff, objects", 100, 100, 600, 600);
   TPad *accTimesEffObjPad = (TPad*)accTimesEffPad->Clone("accTimesEffObjPad");
   accTimesEffObjPad->Draw(); 
   accTimesEffObjPad->cd();
   hAccTimesEffEle->GetYaxis()->SetTitle("acc x eff");
   hAccTimesEffEle->GetYaxis()->SetRangeUser(0., 1.);
   hAccTimesEffEle->SetMarkerStyle(kFullSquare);
   hAccTimesEffEle->SetMarkerColor(kViolet);
   hAccTimesEffEle->SetLineColor(kViolet);
   hAccTimesEffEle->Draw();
   hAccTimesEffEleEB->SetMarkerStyle(kFullTriangleUp);
   hAccTimesEffEleEB->SetMarkerColor(kRed);
   hAccTimesEffEleEB->SetLineColor(kRed);
   hAccTimesEffEleEB->Draw("same");
   hAccTimesEffEleEE->SetMarkerStyle(kFullTriangleDown);
   hAccTimesEffEleEE->SetMarkerColor(kBlue);
   hAccTimesEffEleEE->SetLineColor(kBlue);
   hAccTimesEffEleEE->Draw("same");
   hAccTimesEffMu->SetMarkerStyle(34);
   hAccTimesEffMu->SetMarkerColor(kGreen+1);
   hAccTimesEffMu->SetLineColor(kGreen+1);
   hAccTimesEffMu->Draw("same");
   hAccTimesEff2->Draw("same");
   TLegend* legend = new TLegend(0.592, 0.279, 0.881, 0.467);
   legend->SetTextFont(font);
   legend->SetTextSize(0.03);
   legend->SetBorderSize(0);
   legend->SetLineColor(1);
   legend->SetLineStyle(1);
   legend->SetLineWidth(1);
   legend->SetFillColor(19);
   legend->SetFillStyle(0);
   legend->AddEntry(hAccTimesEff, "total acc x eff");
   legend->AddEntry(hAccTimesEffMu, "muons");
   legend->AddEntry(hAccTimesEffEle, "all electrons");
   legend->AddEntry(hAccTimesEffEleEB, "barrel electrons");
   legend->AddEntry(hAccTimesEffEleEE, "endcap electrons");
   legend->Draw("same");
   tex->DrawLatex(0.109, 0.935, "CMS Simulation, 8 TeV");
   tex->DrawLatex(0.17, 0.85, "trg: HLT_Mu22_Photon22_CaloIdL");

   // acc x eff with no trg applied
   TCanvas *accTimesEffNoTrgObjPlot = new TCanvas("accTimesEffNoTrgObjPlot", "acc x eff, no trigger, objects", 100, 100, 600, 600);
   TPad *accTimesEffNoTrgObjPad = (TPad*)accTimesEffPad->Clone("accTimesEffNoTrgObjPad");
   accTimesEffNoTrgObjPad->Draw(); 
   accTimesEffNoTrgObjPad->cd();
   hAccTimesEffNoTrgEle->GetYaxis()->SetTitle("acc x eff");
   hAccTimesEffNoTrgEle->GetYaxis()->SetRangeUser(0., 1.);
   hAccTimesEffNoTrgEle->SetMarkerStyle(kFullSquare);
   hAccTimesEffNoTrgEle->SetMarkerColor(kViolet);
   hAccTimesEffNoTrgEle->SetLineColor(kViolet);
   hAccTimesEffNoTrgEle->Draw();
   hAccTimesEffNoTrgEleEB->SetMarkerStyle(kFullTriangleUp);
   hAccTimesEffNoTrgEleEB->SetMarkerColor(kRed);
   hAccTimesEffNoTrgEleEB->SetLineColor(kRed);
   hAccTimesEffNoTrgEleEB->Draw("same");
   hAccTimesEffNoTrgEleEE->SetMarkerStyle(kFullTriangleDown);
   hAccTimesEffNoTrgEleEE->SetMarkerColor(kBlue);
   hAccTimesEffNoTrgEleEE->SetLineColor(kBlue);
   hAccTimesEffNoTrgEleEE->Draw("same");
   hAccTimesEffNoTrgMu->SetMarkerStyle(34);
   hAccTimesEffNoTrgMu->SetMarkerColor(kGreen+1);
   hAccTimesEffNoTrgMu->SetLineColor(kGreen+1);
   hAccTimesEffNoTrgMu->Draw("same");
   hAccTimesEffNoTrg->Draw("same");
   TLegend* accXeffNoTrg = (TLegend*)legend->Clone("effAftTrgLegend");
   accXeffNoTrg->Clear();
   accXeffNoTrg->AddEntry(hAccTimesEffNoTrg, "total acc x eff");
   accXeffNoTrg->AddEntry(hAccTimesEffNoTrgMu, "muons");
   accXeffNoTrg->AddEntry(hAccTimesEffNoTrgEle, "all electrons");
   accXeffNoTrg->AddEntry(hAccTimesEffNoTrgEleEB, "barrel electrons");
   accXeffNoTrg->AddEntry(hAccTimesEffNoTrgEleEE, "endcap electrons");
   accXeffNoTrg->Draw("same");
   tex->DrawLatex(0.109, 0.935, "CMS Simulation, 8 TeV");
   tex->DrawLatex(0.17, 0.85, "trg: none");

   // efficiency on triggered events
   TCanvas *effAftTrgPlot = new TCanvas("effAftTrgPlot", "efficiency after trigger", 100, 100, 600, 600);
   TPad *effAftTrgPad = (TPad*)accTimesEffPad->Clone("effAftTrgPad");
   effAftTrgPad->Draw(); 
   effAftTrgPad->cd();
   hEffAftTrgEle->GetYaxis()->SetTitle("eff");
   hEffAftTrgEle->GetYaxis()->SetRangeUser(0., 1.);
   hEffAftTrgEle->SetMarkerStyle(kFullSquare);
   hEffAftTrgEle->SetMarkerColor(kViolet);
   hEffAftTrgEle->SetLineColor(kViolet);
   hEffAftTrgEle->Draw();
   hEffAftTrgEleEB->SetMarkerStyle(kFullTriangleUp);
   hEffAftTrgEleEB->SetMarkerColor(kRed);
   hEffAftTrgEleEB->SetLineColor(kRed);
   hEffAftTrgEleEB->Draw("same");
   hEffAftTrgEleEE->SetMarkerStyle(kFullTriangleDown);
   hEffAftTrgEleEE->SetMarkerColor(kBlue);
   hEffAftTrgEleEE->SetLineColor(kBlue);
   hEffAftTrgEleEE->Draw("same");
   hEffAftTrgMu->SetMarkerStyle(34);
   hEffAftTrgMu->SetMarkerColor(kGreen+1);
   hEffAftTrgMu->SetLineColor(kGreen+1);
   hEffAftTrgMu->Draw("same");
   hEffAftTrg->Draw("same");
   TLegend* effAftTrgLegend = (TLegend*)legend->Clone("effAftTrgLegend");
   effAftTrgLegend->Clear();
   effAftTrgLegend->AddEntry(hEffAftTrg, "total eff after trigger");
   effAftTrgLegend->AddEntry(hEffAftTrgMu, "muons");
   effAftTrgLegend->AddEntry(hEffAftTrgEle, "all electrons");
   effAftTrgLegend->AddEntry(hEffAftTrgEleEB, "barrel electrons");
   effAftTrgLegend->AddEntry(hEffAftTrgEleEE, "endcap electrons");
   effAftTrgLegend->Draw("same");
   tex->DrawLatex(0.109, 0.935, "CMS Simulation, 8 TeV");
   tex->DrawLatex(0.14, 0.15, "trg: HLT_Mu22_Photon22_CaloIdL");

   // acceptance
   TCanvas *accPlot = new TCanvas("accPlot", "acc", 100, 100, 600, 600);
   TPad *accPad = (TPad*)accTimesEffPad->Clone("accPad");
   accPad->Draw(); 
   accPad->cd();
   hAcc->GetYaxis()->SetTitle("acc");
   hAcc->GetYaxis()->SetRangeUser(0., 1.);
   hAccEle->SetMarkerStyle(kFullSquare);
   hAccEle->SetMarkerColor(kViolet);
   hAccEle->SetLineColor(kViolet);
   hAccEle->Draw();
   hAccEleEB->SetMarkerStyle(kFullTriangleUp);
   hAccEleEB->SetMarkerColor(kRed);
   hAccEleEB->SetLineColor(kRed);
   hAccEleEB->Draw("same");
   hAccEleEE->SetMarkerStyle(kFullTriangleDown);
   hAccEleEE->SetMarkerColor(kBlue);
   hAccEleEE->SetLineColor(kBlue);
   hAccEleEE->Draw("same");
   hAccMu->SetMarkerStyle(34);
   hAccMu->SetMarkerColor(kGreen+1);
   hAccMu->SetLineColor(kGreen+1);
   hAccMu->Draw("same");
   hAcc->Draw("same");
   TLegend* accLegend = (TLegend*)legend->Clone("accLegend");
   accLegend->Clear();
   accLegend->AddEntry(hAcc, "total acceptance");
   accLegend->AddEntry(hAccMu, "muons");
   accLegend->AddEntry(hAccEle, "all electrons");
   accLegend->AddEntry(hAccEleEB, "barrel electrons");
   accLegend->AddEntry(hAccEleEE, "endcap electrons");
   accLegend->Draw("same");
   tex->DrawLatex(0.109, 0.935, "CMS Simulation, 8 TeV");

   // reco with trg vs. reco
   TCanvas *trgRecoVsRecoPlot = new TCanvas("trgRecoVsRecoPlot", "reco with trg vs. reco", 100, 100, 600, 600);
   TPad *trgRecoVsRecoPad = (TPad*)accTimesEffPad->Clone("trgRecoVsRecoPad");
   trgRecoVsRecoPad->Draw(); 
   trgRecoVsRecoPad->cd();
   hTrgRecoVsRecoEle->GetYaxis()->SetTitle("eff");
   hTrgRecoVsRecoEle->GetYaxis()->SetRangeUser(0., 1.);
   hTrgRecoVsRecoEle->SetMarkerStyle(kFullSquare);
   hTrgRecoVsRecoEle->SetMarkerColor(kViolet);
   hTrgRecoVsRecoEle->SetLineColor(kViolet);
   hTrgRecoVsRecoEle->Draw();
   //hTrgRecoVsRecoEleEB->SetMarkerStyle(kFullTriangleUp);
   //hTrgRecoVsRecoEleEB->SetMarkerColor(kRed);
   //hTrgRecoVsRecoEleEB->SetLineColor(kRed);
   //hTrgRecoVsRecoEleEB->Draw("same");
   //hTrgRecoVsRecoEleEE->SetMarkerStyle(kFullTriangleDown);
   //hTrgRecoVsRecoEleEE->SetMarkerColor(kBlue);
   //hTrgRecoVsRecoEleEE->SetLineColor(kBlue);
   //hTrgRecoVsRecoEleEE->Draw("same");
   hTrgRecoVsRecoMu->SetMarkerStyle(34);
   hTrgRecoVsRecoMu->SetMarkerColor(kGreen+1);
   hTrgRecoVsRecoMu->SetLineColor(kGreen+1);
   hTrgRecoVsRecoMu->Draw("same");
   hTrgRecoVsReco->Draw("same");
   TLegend* trgRecoVsRecoLegend = (TLegend*)legend->Clone("trgRecoVsRecoLegend");
   trgRecoVsRecoLegend->Clear();
   trgRecoVsRecoLegend->AddEntry(hTrgRecoVsReco, "total");
   trgRecoVsRecoLegend->AddEntry(hTrgRecoVsRecoMu, "muons");
   trgRecoVsRecoLegend->AddEntry(hTrgRecoVsRecoEle, "electrons");
   //trgRecoVsRecoLegend->AddEntry(hTrgRecoVsRecoEleEB, "barrel electrons");
   //trgRecoVsRecoLegend->AddEntry(hTrgRecoVsRecoEleEE, "endcap electrons");
   trgRecoVsRecoLegend->Draw("same");
   tex->DrawLatex(0.109, 0.935, "CMS Simulation, 8 TeV");

   TCanvas *accTimesTrgEffPlot = new TCanvas("accTimesTrgEffPlot", "acc x trigger eff", 100, 100, 600, 600);
   TPad *accTimesTrgEffPad = (TPad*)accTimesEffPad->Clone("accTimesTrgEffPad");
   accTimesTrgEffPad->Draw(); 
   accTimesTrgEffPad->cd();
   hAccTimesTrgEff->GetYaxis()->SetTitle("acc x trg eff");
   hAccTimesTrgEff->GetYaxis()->SetRangeUser(0., 1.);
   hAccTimesTrgEff->SetMarkerStyle(20);
   hAccTimesTrgEff->SetMarkerColor(kCyan);
   hAccTimesTrgEff->SetLineColor(kCyan);
   hAccTimesTrgEff->Draw();
   hTrgEff->SetMarkerStyle(21);
   hTrgEff->SetMarkerColor(kMagenta);
   hTrgEff->SetLineColor(kMagenta);
   hTrgEff->Draw("same");
   TLegend* trgLegend = (TLegend*)legend->Clone("trgLegend");
   trgLegend->Clear();
   trgLegend->AddEntry(hTrgEff, "trigger eff in acc");
   trgLegend->AddEntry(hAccTimesTrgEff, "acc x trigger eff");
   trgLegend->Draw("same");
   tex->DrawLatex(0.109, 0.935, "CMS Simulation, 8 TeV");

   // safe in various file formats
   if (saveSpec) {
     if (saveAsPdf) {
        accTimesTrgEffPlot->Print(plotDir + accTimesTrgEffPlot->GetName() + ".pdf", "pdf");
        accTimesEffPlot->Print(plotDir + accTimesEffPlot->GetName() + ".pdf", "pdf");
        accTimesEffPlotEB->Print(plotDir + accTimesEffPlotEB->GetName() + ".pdf", "pdf");
        accTimesEffPlotEE->Print(plotDir + accTimesEffPlotEE->GetName() + ".pdf", "pdf");
        accTimesEffObjPlot->Print(plotDir + accTimesEffObjPlot->GetName() + ".pdf", "pdf");
        accTimesEffNoTrgObjPlot->Print(plotDir + accTimesEffNoTrgObjPlot->GetName() + ".pdf", "pdf");
        effAftTrgPlot->Print(plotDir + effAftTrgPlot->GetName() + ".pdf", "pdf");
        trgRecoVsRecoPlot->Print(plotDir + trgRecoVsRecoPlot->GetName() + ".pdf", "pdf");
        accPlot->Print(plotDir + accPlot->GetName() + ".pdf", "pdf");
     }
     if (saveAsPng) {
        accTimesTrgEffPlot->Print(plotDir + accTimesTrgEffPlot->GetName() + ".png", "png");
        accTimesEffPlot->Print(plotDir + accTimesEffPlot->GetName() + ".png", "png");
        accTimesEffPlotEB->Print(plotDir + accTimesEffPlotEB->GetName() + ".png", "png");
        accTimesEffPlotEE->Print(plotDir + accTimesEffPlotEE->GetName() + ".png", "png");
        accTimesEffObjPlot->Print(plotDir + accTimesEffObjPlot->GetName() + ".png", "png");
        accTimesEffNoTrgObjPlot->Print(plotDir + accTimesEffNoTrgObjPlot->GetName() + ".png", "png");
        effAftTrgPlot->Print(plotDir + effAftTrgPlot->GetName() + ".png", "png");
        trgRecoVsRecoPlot->Print(plotDir + trgRecoVsRecoPlot->GetName() + ".png", "png");
        accPlot->Print(plotDir + accPlot->GetName() + ".png", "png");
     }
     if (saveAsRoot) {
        accTimesTrgEffPlot->Print(plotDir + accTimesTrgEffPlot->GetName() + ".root", "root");
        accTimesEffPlot->Print(plotDir + accTimesEffPlot->GetName() + ".root", "root");
        accTimesEffPlotEB->Print(plotDir + accTimesEffPlotEB->GetName() + ".root", "root");
        accTimesEffPlotEE->Print(plotDir + accTimesEffPlotEE->GetName() + ".root", "root");
        accTimesEffObjPlot->Print(plotDir + accTimesEffObjPlot->GetName() + ".root", "root");
        accTimesEffNoTrgObjPlot->Print(plotDir + accTimesEffNoTrgObjPlot->GetName() + ".root", "root");
        effAftTrgPlot->Print(plotDir + effAftTrgPlot->GetName() + ".root", "root");
        trgRecoVsRecoPlot->Print(plotDir + trgRecoVsRecoPlot->GetName() + ".root", "root");
        accPlot->Print(plotDir + accPlot->GetName() + ".root", "root");
     }
   }

   // write histos to file
   output->cd();
   hGenEvts->Write();
   hGenEvtsEleInAcc->Write();
   hGenEvtsEleInAccEB->Write();
   hGenEvtsEleInAccEE->Write();
   hGenEvtsMuInAcc->Write();
   hGenEvtsInAcc->Write();
   hTrgEvts->Write();
   hRecoEvts->Write();
   hRecoEvtsEB->Write();
   hRecoEvtsEE->Write();
   hRecoEleEvts->Write();
   hRecoEleEvtsEB->Write();
   hRecoEleEvtsEE->Write();
   hRecoMuEvts->Write();
   hAccEle->Write();
   hAccEleEB->Write();
   hAccEleEE->Write();
   hAccMu->Write();
   hAccTimesTrgEff->Write();
   hTrgEff->Write();
   hAccTimesEff->Write();
   hAccTimesEffEB->Write();
   hAccTimesEffEE->Write();
   hAccTimesEffEle->Write();
   hAccTimesEffEleEB->Write();
   hAccTimesEffEleEE->Write();
   hAccTimesEffMu->Write();
   hEffAftTrg->Write();
   hEffAftTrgEle->Write();
   hEffAftTrgEleEB->Write();
   hEffAftTrgEleEE->Write();
   hEffAftTrgMu->Write();
   fitFunc->Write();
   fitFuncEB->Write();
   fitFuncEE->Write();

   output->Close();
   timer.Stop();
   timer.Print();
}
예제 #17
0
void zj_ptj_8TeV()
{
//=========Macro generated from canvas: default_Canvas/defaultCanvas
//=========  (Thu Apr 28 10:19:34 2016) by ROOT version6.04/10
   TCanvas *default_Canvas = new TCanvas("default_Canvas", "defaultCanvas",0,0,800,800);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   default_Canvas->SetHighLightColor(2);
   default_Canvas->Range(0,0,1,1);
   default_Canvas->SetFillColor(0);
   default_Canvas->SetBorderMode(0);
   default_Canvas->SetBorderSize(2);
   default_Canvas->SetTickx(1);
   default_Canvas->SetTicky(1);
   default_Canvas->SetLeftMargin(0.14);
   default_Canvas->SetRightMargin(0.05);
   default_Canvas->SetTopMargin(0.05);
   default_Canvas->SetBottomMargin(0.16);
   default_Canvas->SetFrameLineWidth(2);
   default_Canvas->SetFrameBorderMode(0);
  
// ------------>Primitives in pad: bottomPad
   TPad *bottomPad = new TPad("bottomPad", "bottomPad",0.005,0.05,0.995,0.995);
   bottomPad->Draw();
   bottomPad->cd();
   bottomPad->Range(0,0,1,1);
   bottomPad->SetFillColor(0);
   bottomPad->SetFillStyle(4000);
   bottomPad->SetBorderMode(0);
   bottomPad->SetBorderSize(2);
   bottomPad->SetTickx(1);
   bottomPad->SetTicky(1);
   bottomPad->SetLeftMargin(0.14);
   bottomPad->SetRightMargin(0.05);
   bottomPad->SetTopMargin(0.05);
   bottomPad->SetBottomMargin(0.16);
   bottomPad->SetFrameLineWidth(2);
   bottomPad->SetFrameBorderMode(0);
   bottomPad->Modified();
   default_Canvas->cd();
  
// ------------>Primitives in pad: upperPad
   TPad *upperPad = new TPad("upperPad", "upperPad",0.005,0.05,0.995,0.995);
   upperPad->Draw();
   upperPad->cd();
   upperPad->Range(6.172839,-0.2132695,104.9383,0.4330016);
   upperPad->SetFillColor(0);
   upperPad->SetFillStyle(4000);
   upperPad->SetBorderMode(0);
   upperPad->SetBorderSize(2);
   upperPad->SetTickx(1);
   upperPad->SetTicky(1);
   upperPad->SetLeftMargin(0.14);
   upperPad->SetRightMargin(0.05);
   upperPad->SetTopMargin(0.05);
   upperPad->SetBottomMargin(0.33);
   upperPad->SetFrameLineWidth(2);
   upperPad->SetFrameBorderMode(0);
   upperPad->SetFrameLineWidth(2);
   upperPad->SetFrameBorderMode(0);
   Double_t xAxis19[6] = {20, 25, 30, 40, 50, 100}; 
   
   TH1F *z_ptj_toterr__19 = new TH1F("z_ptj_toterr__19","z_ptj",5, xAxis19);
   z_ptj_toterr__19->SetBinContent(1,0.3608738);
   z_ptj_toterr__19->SetBinContent(2,0.225932);
   z_ptj_toterr__19->SetBinContent(3,0.1253807);
   z_ptj_toterr__19->SetBinContent(4,0.06703913);
   z_ptj_toterr__19->SetBinContent(5,0.01561868);
   z_ptj_toterr__19->SetBinContent(6,0.780934);
   z_ptj_toterr__19->SetBinError(1,0.02073388);
   z_ptj_toterr__19->SetBinError(2,0.01400757);
   z_ptj_toterr__19->SetBinError(3,0.009350811);
   z_ptj_toterr__19->SetBinError(4,0.004623786);
   z_ptj_toterr__19->SetBinError(5,0.001395185);
   z_ptj_toterr__19->SetBinError(6,0.06975923);
   z_ptj_toterr__19->SetEntries(12);
   z_ptj_toterr__19->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#ffff00");
   z_ptj_toterr__19->SetFillColor(ci);

   ci = TColor::GetColor("#ffff00");
   z_ptj_toterr__19->SetLineColor(ci);
   z_ptj_toterr__19->SetLineWidth(2);

   ci = TColor::GetColor("#ffff00");
   z_ptj_toterr__19->SetMarkerColor(ci);
   z_ptj_toterr__19->SetMarkerStyle(0);
   z_ptj_toterr__19->GetXaxis()->SetNdivisions(4);
   z_ptj_toterr__19->GetXaxis()->SetLabelFont(132);
   z_ptj_toterr__19->GetXaxis()->SetLabelOffset(999);
   z_ptj_toterr__19->GetXaxis()->SetLabelSize(0);
   z_ptj_toterr__19->GetXaxis()->SetTitleSize(0.06);
   z_ptj_toterr__19->GetXaxis()->SetTitleFont(132);
   z_ptj_toterr__19->GetYaxis()->SetTitle("d#sigma(#it{Zj})/d#it{p}_{T}^{jet} [pb/GeV]");
   z_ptj_toterr__19->GetYaxis()->SetLabelFont(132);
   z_ptj_toterr__19->GetYaxis()->SetLabelSize(0.05);
   z_ptj_toterr__19->GetYaxis()->SetTitleSize(0.06);
   z_ptj_toterr__19->GetYaxis()->SetTitleOffset(1.3);
   z_ptj_toterr__19->GetYaxis()->SetTitleFont(132);
   z_ptj_toterr__19->GetZaxis()->SetLabelFont(132);
   z_ptj_toterr__19->GetZaxis()->SetLabelSize(0.05);
   z_ptj_toterr__19->GetZaxis()->SetTitleSize(0.06);
   z_ptj_toterr__19->GetZaxis()->SetTitleFont(132);
   z_ptj_toterr__19->Draw("e2");
   Double_t xAxis20[6] = {20, 25, 30, 40, 50, 100}; 
   
   TH1F *z_ptj_staterr__20 = new TH1F("z_ptj_staterr__20","z_ptj",5, xAxis20);
   z_ptj_staterr__20->SetBinContent(1,0.3608738);
   z_ptj_staterr__20->SetBinContent(2,0.225932);
   z_ptj_staterr__20->SetBinContent(3,0.1253807);
   z_ptj_staterr__20->SetBinContent(4,0.06703913);
   z_ptj_staterr__20->SetBinContent(5,0.01561868);
   z_ptj_staterr__20->SetBinContent(6,0.780934);
   z_ptj_staterr__20->SetBinError(1,0.007287406);
   z_ptj_staterr__20->SetBinError(2,0.005663236);
   z_ptj_staterr__20->SetBinError(3,0.002951952);
   z_ptj_staterr__20->SetBinError(4,0.002192817);
   z_ptj_staterr__20->SetBinError(5,0.0004728113);
   z_ptj_staterr__20->SetBinError(6,0.02364057);
   z_ptj_staterr__20->SetEntries(12);
   z_ptj_staterr__20->SetStats(0);

   ci = TColor::GetColor("#ff9933");
   z_ptj_staterr__20->SetFillColor(ci);

   ci = TColor::GetColor("#ff9933");
   z_ptj_staterr__20->SetLineColor(ci);
   z_ptj_staterr__20->SetLineWidth(2);

   ci = TColor::GetColor("#ff9933");
   z_ptj_staterr__20->SetMarkerColor(ci);
   z_ptj_staterr__20->SetMarkerStyle(0);
   z_ptj_staterr__20->GetXaxis()->SetNdivisions(4);
   z_ptj_staterr__20->GetXaxis()->SetLabelFont(132);
   z_ptj_staterr__20->GetXaxis()->SetLabelOffset(999);
   z_ptj_staterr__20->GetXaxis()->SetLabelSize(0);
   z_ptj_staterr__20->GetXaxis()->SetTitleSize(0.06);
   z_ptj_staterr__20->GetXaxis()->SetTitleFont(132);
   z_ptj_staterr__20->GetYaxis()->SetTitle("d#sigma(#it{Zj})/d#it{p}_{T}^{jet} [pb/GeV]");
   z_ptj_staterr__20->GetYaxis()->SetLabelFont(132);
   z_ptj_staterr__20->GetYaxis()->SetLabelSize(0.05);
   z_ptj_staterr__20->GetYaxis()->SetTitleSize(0.06);
   z_ptj_staterr__20->GetYaxis()->SetTitleFont(132);
   z_ptj_staterr__20->GetZaxis()->SetLabelFont(132);
   z_ptj_staterr__20->GetZaxis()->SetLabelSize(0.05);
   z_ptj_staterr__20->GetZaxis()->SetTitleSize(0.06);
   z_ptj_staterr__20->GetZaxis()->SetTitleFont(132);
   z_ptj_staterr__20->Draw("e2same");
   
   Double_t ptj_toterrs_fx3022[5] = {
   23.25,
   28.25,
   36.5,
   46.5,
   82.5};
   Double_t ptj_toterrs_fy3022[5] = {
   0.3671394,
   0.2404275,
   0.1334798,
   0.06537649,
   0.01594908};
   Double_t ptj_toterrs_felx3022[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t ptj_toterrs_fely3022[5] = {
   0.02997783,
   0.02293181,
   0.009217184,
   0.004503167,
   0.001643067};
   Double_t ptj_toterrs_fehx3022[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t ptj_toterrs_fehy3022[5] = {
   0.02512764,
   0.01751375,
   0.008693834,
   0.005222099,
   0.001753864};
   TGraphAsymmErrors *grae = new TGraphAsymmErrors(5,ptj_toterrs_fx3022,ptj_toterrs_fy3022,ptj_toterrs_felx3022,ptj_toterrs_fehx3022,ptj_toterrs_fely3022,ptj_toterrs_fehy3022);
   grae->SetName("ptj_toterrs");
   grae->SetTitle("");
   grae->SetFillColor(1);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(24);
   
   TH1F *Graph_Graph_ptj_toterrs30153022 = new TH1F("Graph_Graph_ptj_toterrs30153022","",100,17.325,88.425);
   Graph_Graph_ptj_toterrs30153022->SetMinimum(0.01287542);
   Graph_Graph_ptj_toterrs30153022->SetMaximum(0.4300631);
   Graph_Graph_ptj_toterrs30153022->SetDirectory(0);
   Graph_Graph_ptj_toterrs30153022->SetStats(0);
   Graph_Graph_ptj_toterrs30153022->SetLineWidth(2);
   Graph_Graph_ptj_toterrs30153022->SetMarkerStyle(0);
   Graph_Graph_ptj_toterrs30153022->GetXaxis()->SetNdivisions(4);
   Graph_Graph_ptj_toterrs30153022->GetXaxis()->SetLabelFont(132);
   Graph_Graph_ptj_toterrs30153022->GetXaxis()->SetLabelOffset(999);
   Graph_Graph_ptj_toterrs30153022->GetXaxis()->SetLabelSize(0);
   Graph_Graph_ptj_toterrs30153022->GetXaxis()->SetTitleSize(0.06);
   Graph_Graph_ptj_toterrs30153022->GetXaxis()->SetTitleFont(132);
   Graph_Graph_ptj_toterrs30153022->GetYaxis()->SetTitle("d#sigma(#it{Zj})/d#it{p}_{T}^{jet} [pb/GeV]");
   Graph_Graph_ptj_toterrs30153022->GetYaxis()->SetLabelFont(132);
   Graph_Graph_ptj_toterrs30153022->GetYaxis()->SetLabelSize(0.05);
   Graph_Graph_ptj_toterrs30153022->GetYaxis()->SetTitleSize(0.06);
   Graph_Graph_ptj_toterrs30153022->GetYaxis()->SetTitleFont(132);
   Graph_Graph_ptj_toterrs30153022->GetZaxis()->SetLabelFont(132);
   Graph_Graph_ptj_toterrs30153022->GetZaxis()->SetLabelSize(0.05);
   Graph_Graph_ptj_toterrs30153022->GetZaxis()->SetTitleSize(0.06);
   Graph_Graph_ptj_toterrs30153022->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_Graph_ptj_toterrs30153022);
   
   grae->Draw("p1p");
   
   Double_t _fx3023[5] = {
   23.25,
   28.25,
   36.5,
   46.5,
   82.5};
   Double_t _fy3023[5] = {
   0.3671394,
   0.2404275,
   0.1334798,
   0.06537649,
   0.01594908};
   Double_t _felx3023[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t _fely3023[5] = {
   0.01985385,
   0.01348796,
   0.006928003,
   0.003412992,
   0.001084033};
   Double_t _fehx3023[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t _fehy3023[5] = {
   0.01921597,
   0.01338518,
   0.006596172,
   0.003531927,
   0.001381032};
   grae = new TGraphAsymmErrors(5,_fx3023,_fy3023,_felx3023,_fehx3023,_fely3023,_fehy3023);
   grae->SetName("");
   grae->SetTitle("");
   grae->SetFillColor(1);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(24);
   
   TH1F *Graph_Graph_Graph30163023 = new TH1F("Graph_Graph_Graph30163023","",100,17.325,88.425);
   Graph_Graph_Graph30163023->SetMinimum(0.01337855);
   Graph_Graph_Graph30163023->SetMaximum(0.4235044);
   Graph_Graph_Graph30163023->SetDirectory(0);
   Graph_Graph_Graph30163023->SetStats(0);
   Graph_Graph_Graph30163023->SetLineWidth(2);
   Graph_Graph_Graph30163023->SetMarkerStyle(0);
   Graph_Graph_Graph30163023->GetXaxis()->SetNdivisions(4);
   Graph_Graph_Graph30163023->GetXaxis()->SetLabelFont(132);
   Graph_Graph_Graph30163023->GetXaxis()->SetLabelOffset(999);
   Graph_Graph_Graph30163023->GetXaxis()->SetLabelSize(0);
   Graph_Graph_Graph30163023->GetXaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph30163023->GetXaxis()->SetTitleFont(132);
   Graph_Graph_Graph30163023->GetYaxis()->SetTitle("d#sigma(#it{Zj})/d#it{p}_{T}^{jet} [pb/GeV]");
   Graph_Graph_Graph30163023->GetYaxis()->SetLabelFont(132);
   Graph_Graph_Graph30163023->GetYaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph30163023->GetYaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph30163023->GetYaxis()->SetTitleFont(132);
   Graph_Graph_Graph30163023->GetZaxis()->SetLabelFont(132);
   Graph_Graph_Graph30163023->GetZaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph30163023->GetZaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph30163023->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_Graph_Graph30163023);
   
   grae->Draw("p1p");
   
   Double_t ptj_toterrs_fx3024[5] = {
   21.75,
   26.75,
   33.5,
   43.5,
   67.5};
   Double_t ptj_toterrs_fy3024[5] = {
   0.389299,
   0.2509263,
   0.1443755,
   0.07365244,
   0.01874484};
   Double_t ptj_toterrs_felx3024[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t ptj_toterrs_fely3024[5] = {
   0.0283978,
   0.01982285,
   0.01219084,
   0.00636368,
   0.001684181};
   Double_t ptj_toterrs_fehx3024[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t ptj_toterrs_fehy3024[5] = {
   0.03041728,
   0.02088176,
   0.0127053,
   0.007720362,
   0.001934453};
   grae = new TGraphAsymmErrors(5,ptj_toterrs_fx3024,ptj_toterrs_fy3024,ptj_toterrs_felx3024,ptj_toterrs_fehx3024,ptj_toterrs_fely3024,ptj_toterrs_fehy3024);
   grae->SetName("ptj_toterrs");
   grae->SetTitle("");
   grae->SetFillColor(1);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(20);
   
   TH1F *Graph_Graph_ptj_toterrs30173024 = new TH1F("Graph_Graph_ptj_toterrs30173024","",100,17.175,72.075);
   Graph_Graph_ptj_toterrs30173024->SetMinimum(0.01535459);
   Graph_Graph_ptj_toterrs30173024->SetMaximum(0.4599818);
   Graph_Graph_ptj_toterrs30173024->SetDirectory(0);
   Graph_Graph_ptj_toterrs30173024->SetStats(0);
   Graph_Graph_ptj_toterrs30173024->SetLineWidth(2);
   Graph_Graph_ptj_toterrs30173024->SetMarkerStyle(0);
   Graph_Graph_ptj_toterrs30173024->GetXaxis()->SetNdivisions(4);
   Graph_Graph_ptj_toterrs30173024->GetXaxis()->SetLabelFont(132);
   Graph_Graph_ptj_toterrs30173024->GetXaxis()->SetLabelOffset(999);
   Graph_Graph_ptj_toterrs30173024->GetXaxis()->SetLabelSize(0);
   Graph_Graph_ptj_toterrs30173024->GetXaxis()->SetTitleSize(0.06);
   Graph_Graph_ptj_toterrs30173024->GetXaxis()->SetTitleFont(132);
   Graph_Graph_ptj_toterrs30173024->GetYaxis()->SetTitle("d#sigma(#it{Zj})/d#it{p}_{T}^{jet} [pb/GeV]");
   Graph_Graph_ptj_toterrs30173024->GetYaxis()->SetLabelFont(132);
   Graph_Graph_ptj_toterrs30173024->GetYaxis()->SetLabelSize(0.05);
   Graph_Graph_ptj_toterrs30173024->GetYaxis()->SetTitleSize(0.06);
   Graph_Graph_ptj_toterrs30173024->GetYaxis()->SetTitleFont(132);
   Graph_Graph_ptj_toterrs30173024->GetZaxis()->SetLabelFont(132);
   Graph_Graph_ptj_toterrs30173024->GetZaxis()->SetLabelSize(0.05);
   Graph_Graph_ptj_toterrs30173024->GetZaxis()->SetTitleSize(0.06);
   Graph_Graph_ptj_toterrs30173024->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_Graph_ptj_toterrs30173024);
   
   grae->Draw("p1p");
   
   Double_t _fx3025[5] = {
   21.75,
   26.75,
   33.5,
   43.5,
   67.5};
   Double_t _fy3025[5] = {
   0.389299,
   0.2509263,
   0.1443755,
   0.07365244,
   0.01874484};
   Double_t _felx3025[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t _fely3025[5] = {
   0.02243218,
   0.01539977,
   0.009090877,
   0.00492242,
   0.001303763};
   Double_t _fehx3025[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t _fehy3025[5] = {
   0.02411537,
   0.01689699,
   0.0100922,
   0.005544287,
   0.001554499};
   grae = new TGraphAsymmErrors(5,_fx3025,_fy3025,_felx3025,_fehx3025,_fely3025,_fehy3025);
   grae->SetName("");
   grae->SetTitle("");
   grae->SetFillColor(1);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(20);
   
   TH1F *Graph_Graph_Graph30183025 = new TH1F("Graph_Graph_Graph30183025","",100,17.175,72.075);
   Graph_Graph_Graph30183025->SetMinimum(0.01569697);
   Graph_Graph_Graph30183025->SetMaximum(0.4530117);
   Graph_Graph_Graph30183025->SetDirectory(0);
   Graph_Graph_Graph30183025->SetStats(0);
   Graph_Graph_Graph30183025->SetLineWidth(2);
   Graph_Graph_Graph30183025->SetMarkerStyle(0);
   Graph_Graph_Graph30183025->GetXaxis()->SetNdivisions(4);
   Graph_Graph_Graph30183025->GetXaxis()->SetLabelFont(132);
   Graph_Graph_Graph30183025->GetXaxis()->SetLabelOffset(999);
   Graph_Graph_Graph30183025->GetXaxis()->SetLabelSize(0);
   Graph_Graph_Graph30183025->GetXaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph30183025->GetXaxis()->SetTitleFont(132);
   Graph_Graph_Graph30183025->GetYaxis()->SetTitle("d#sigma(#it{Zj})/d#it{p}_{T}^{jet} [pb/GeV]");
   Graph_Graph_Graph30183025->GetYaxis()->SetLabelFont(132);
   Graph_Graph_Graph30183025->GetYaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph30183025->GetYaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph30183025->GetYaxis()->SetTitleFont(132);
   Graph_Graph_Graph30183025->GetZaxis()->SetLabelFont(132);
   Graph_Graph_Graph30183025->GetZaxis()->SetLabelSize(0.05);
   Graph_Graph_Graph30183025->GetZaxis()->SetTitleSize(0.06);
   Graph_Graph_Graph30183025->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_Graph_Graph30183025);
   
   grae->Draw("p1p");
   
   TLegend *leg = new TLegend(0.65,0.57,0.95,0.82,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextFont(132);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(2);
   leg->SetFillColor(10);
   leg->SetFillStyle(0);
   TLegendEntry *entry=leg->AddEntry("data_stat","Data_{stat}","f");

   ci = TColor::GetColor("#ff9933");
   entry->SetFillColor(ci);
   entry->SetFillStyle(1001);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   entry=leg->AddEntry("data_tot","Data_{tot}","f");

   ci = TColor::GetColor("#ffff00");
   entry->SetFillColor(ci);
   entry->SetFillStyle(1001);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   entry=leg->AddEntry("powheg_temp","POWHEG","p");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(20);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   entry=leg->AddEntry("amcatnlo_temp","aMC@NLO","p");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(24);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   leg->Draw();
   
   TPaveText *pt = new TPaveText(0.5,0.85,0.85,0.94,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillStyle(0);
   pt->SetLineWidth(2);
   pt->SetTextFont(132);
   TText *AText = pt->AddText("LHCb, #sqrt{s} = 8 TeV");
   pt->Draw();
   Double_t xAxis21[6] = {20, 25, 30, 40, 50, 100}; 
   
   TH1F *z_ptj_toterr_copy__21 = new TH1F("z_ptj_toterr_copy__21","z_ptj",5, xAxis21);
   z_ptj_toterr_copy__21->SetBinContent(1,0.3608738);
   z_ptj_toterr_copy__21->SetBinContent(2,0.225932);
   z_ptj_toterr_copy__21->SetBinContent(3,0.1253807);
   z_ptj_toterr_copy__21->SetBinContent(4,0.06703913);
   z_ptj_toterr_copy__21->SetBinContent(5,0.01561868);
   z_ptj_toterr_copy__21->SetBinContent(6,0.780934);
   z_ptj_toterr_copy__21->SetBinError(1,0.02073388);
   z_ptj_toterr_copy__21->SetBinError(2,0.01400757);
   z_ptj_toterr_copy__21->SetBinError(3,0.009350811);
   z_ptj_toterr_copy__21->SetBinError(4,0.004623786);
   z_ptj_toterr_copy__21->SetBinError(5,0.001395185);
   z_ptj_toterr_copy__21->SetBinError(6,0.06975923);
   z_ptj_toterr_copy__21->SetEntries(12);
   z_ptj_toterr_copy__21->SetDirectory(0);
   z_ptj_toterr_copy__21->SetStats(0);

   ci = TColor::GetColor("#ffff00");
   z_ptj_toterr_copy__21->SetFillColor(ci);

   ci = TColor::GetColor("#ffff00");
   z_ptj_toterr_copy__21->SetLineColor(ci);
   z_ptj_toterr_copy__21->SetLineWidth(2);

   ci = TColor::GetColor("#ffff00");
   z_ptj_toterr_copy__21->SetMarkerColor(ci);
   z_ptj_toterr_copy__21->SetMarkerStyle(0);
   z_ptj_toterr_copy__21->GetXaxis()->SetNdivisions(4);
   z_ptj_toterr_copy__21->GetXaxis()->SetLabelFont(132);
   z_ptj_toterr_copy__21->GetXaxis()->SetLabelOffset(999);
   z_ptj_toterr_copy__21->GetXaxis()->SetLabelSize(0);
   z_ptj_toterr_copy__21->GetXaxis()->SetTitleSize(0.06);
   z_ptj_toterr_copy__21->GetXaxis()->SetTitleFont(132);
   z_ptj_toterr_copy__21->GetYaxis()->SetTitle("d#sigma(#it{Zj})/d#it{p}_{T}^{jet} [pb/GeV]");
   z_ptj_toterr_copy__21->GetYaxis()->SetLabelFont(132);
   z_ptj_toterr_copy__21->GetYaxis()->SetLabelSize(0.05);
   z_ptj_toterr_copy__21->GetYaxis()->SetTitleSize(0.06);
   z_ptj_toterr_copy__21->GetYaxis()->SetTitleOffset(1.3);
   z_ptj_toterr_copy__21->GetYaxis()->SetTitleFont(132);
   z_ptj_toterr_copy__21->GetZaxis()->SetLabelFont(132);
   z_ptj_toterr_copy__21->GetZaxis()->SetLabelSize(0.05);
   z_ptj_toterr_copy__21->GetZaxis()->SetTitleSize(0.06);
   z_ptj_toterr_copy__21->GetZaxis()->SetTitleFont(132);
   z_ptj_toterr_copy__21->Draw("sameaxis");
   upperPad->Modified();
   default_Canvas->cd();
  
// ------------>Primitives in pad: lowerPad
   TPad *lowerPad = new TPad("lowerPad", "lowerPad",0.005,0.05,0.995,0.995);
   lowerPad->Draw();
   lowerPad->cd();
   lowerPad->Range(6.172839,-0.1935898,104.9383,4.832052);
   lowerPad->SetFillColor(0);
   lowerPad->SetFillStyle(4000);
   lowerPad->SetBorderMode(0);
   lowerPad->SetBorderSize(2);
   lowerPad->SetTickx(1);
   lowerPad->SetTicky(1);
   lowerPad->SetLeftMargin(0.14);
   lowerPad->SetRightMargin(0.05);
   lowerPad->SetTopMargin(0.665);
   lowerPad->SetBottomMargin(0.14);
   lowerPad->SetFrameLineWidth(2);
   lowerPad->SetFrameBorderMode(0);
   lowerPad->SetFrameLineWidth(2);
   lowerPad->SetFrameBorderMode(0);
   Double_t xAxis22[6] = {20, 25, 30, 40, 50, 100}; 
   
   TH1F *zj_ptj_8TeV_400_1001_0ratiocomp0__22 = new TH1F("zj_ptj_8TeV_400_1001_0ratiocomp0__22","z_ptj",5, xAxis22);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetBinContent(1,1);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetBinContent(2,1);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetBinContent(3,1);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetBinContent(4,1);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetBinContent(5,1);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetBinContent(6,0.780934);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetBinError(1,0.05745466);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetBinError(2,0.06199906);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetBinError(3,0.07457933);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetBinError(4,0.06897145);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetBinError(5,0.08932795);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetBinError(6,0.06975923);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetMinimum(0.51);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetMaximum(1.49);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetEntries(17);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetStats(0);

   ci = TColor::GetColor("#ffff00");
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetFillColor(ci);

   ci = TColor::GetColor("#ffff00");
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetLineColor(ci);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetLineWidth(2);

   ci = TColor::GetColor("#ffff00");
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetMarkerColor(ci);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->SetMarkerStyle(0);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetXaxis()->SetTitle("#it{p}_{T}^{jet} [GeV]");
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetXaxis()->SetNdivisions(4);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetXaxis()->SetLabelFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetXaxis()->SetLabelOffset(0.02);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetXaxis()->SetLabelSize(0.05);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetXaxis()->SetTitleSize(0.06);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetXaxis()->SetTitleFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetYaxis()->SetTitle("Ratio");
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetYaxis()->CenterTitle(true);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetYaxis()->SetNdivisions(505);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetYaxis()->SetLabelFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetYaxis()->SetLabelSize(0.05);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetYaxis()->SetTitleSize(0.06);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetYaxis()->SetTickLength(0.12325);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetYaxis()->SetTitleOffset(1.3);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetYaxis()->SetTitleFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetZaxis()->SetLabelFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetZaxis()->SetLabelSize(0.05);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetZaxis()->SetTitleSize(0.06);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->GetZaxis()->SetTitleFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp0__22->Draw("e2");
   Double_t xAxis23[6] = {20, 25, 30, 40, 50, 100}; 
   
   TH1F *zj_ptj_8TeV_400_1001_0ratiocomp1__23 = new TH1F("zj_ptj_8TeV_400_1001_0ratiocomp1__23","z_ptj",5, xAxis23);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetBinContent(1,1);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetBinContent(2,1);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetBinContent(3,1);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetBinContent(4,1);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetBinContent(5,1);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetBinContent(6,0.780934);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetBinError(1,0.02019378);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetBinError(2,0.02506611);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetBinError(3,0.02354391);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetBinError(4,0.03270951);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetBinError(5,0.03027217);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetBinError(6,0.02364057);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetMinimum(0.51);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetMaximum(1.49);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetEntries(17);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetStats(0);

   ci = TColor::GetColor("#ff9933");
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetFillColor(ci);

   ci = TColor::GetColor("#ff9933");
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetLineColor(ci);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetLineWidth(2);

   ci = TColor::GetColor("#ff9933");
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetMarkerColor(ci);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->SetMarkerStyle(0);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetXaxis()->SetTitle("#it{p}_{T}^{jet} [GeV]");
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetXaxis()->SetNdivisions(4);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetXaxis()->SetLabelFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetXaxis()->SetLabelOffset(0.02);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetXaxis()->SetLabelSize(0.05);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetXaxis()->SetTitleSize(0.06);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetXaxis()->SetTitleFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetYaxis()->SetTitle("Ratio");
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetYaxis()->CenterTitle(true);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetYaxis()->SetNdivisions(505);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetYaxis()->SetLabelFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetYaxis()->SetLabelSize(0.05);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetYaxis()->SetTitleSize(0.06);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetYaxis()->SetTickLength(0.12325);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetYaxis()->SetTitleFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetZaxis()->SetLabelFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetZaxis()->SetLabelSize(0.05);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetZaxis()->SetTitleSize(0.06);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->GetZaxis()->SetTitleFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp1__23->Draw("e2same");
   
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp2_fx3026[5] = {
   23.25,
   28.25,
   36.5,
   46.5,
   82.5};
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp2_fy3026[5] = {
   1.017362,
   1.064159,
   1.064596,
   0.9751989,
   1.021154};
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp2_felx3026[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp2_fely3026[5] = {
   0.08307013,
   0.1014988,
   0.07351357,
   0.06717222,
   0.1051988};
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp2_fehx3026[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp2_fehy3026[5] = {
   0.06962999,
   0.07751779,
   0.06933948,
   0.07789628,
   0.1122927};
   grae = new TGraphAsymmErrors(5,zj_ptj_8TeV_400_1001_0ratiocomp2_fx3026,zj_ptj_8TeV_400_1001_0ratiocomp2_fy3026,zj_ptj_8TeV_400_1001_0ratiocomp2_felx3026,zj_ptj_8TeV_400_1001_0ratiocomp2_fehx3026,zj_ptj_8TeV_400_1001_0ratiocomp2_fely3026,zj_ptj_8TeV_400_1001_0ratiocomp2_fehy3026);
   grae->SetName("zj_ptj_8TeV_400_1001_0ratiocomp2");
   grae->SetTitle("");
   grae->SetFillColor(1);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(24);
   
   TH1F *Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026 = new TH1F("Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026","",100,17.325,88.425);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->SetMinimum(0.51);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->SetMaximum(1.49);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->SetDirectory(0);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->SetStats(0);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->SetLineWidth(2);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->SetMarkerStyle(0);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetXaxis()->SetTitle("#it{p}_{T}^{jet} [GeV]");
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetXaxis()->SetNdivisions(4);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetXaxis()->SetLabelFont(132);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetXaxis()->SetLabelOffset(0.02);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetXaxis()->SetLabelSize(0.05);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetXaxis()->SetTitleSize(0.06);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetXaxis()->SetTitleFont(132);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetYaxis()->SetTitle("Ratio");
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetYaxis()->CenterTitle(true);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetYaxis()->SetNdivisions(505);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetYaxis()->SetLabelFont(132);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetYaxis()->SetLabelSize(0.05);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetYaxis()->SetTitleSize(0.06);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetYaxis()->SetTitleFont(132);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetZaxis()->SetLabelFont(132);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetZaxis()->SetLabelSize(0.05);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetZaxis()->SetTitleSize(0.06);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_zj_ptj_8TeV_400_1001_0ratiocomp23026);
   
   grae->Draw("p1");
   
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp3_fx3027[5] = {
   23.25,
   28.25,
   36.5,
   46.5,
   82.5};
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp3_fy3027[5] = {
   1.017362,
   1.064159,
   1.064596,
   0.9751989,
   1.021154};
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp3_felx3027[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp3_fely3027[5] = {
   0.05501606,
   0.05969921,
   0.05525572,
   0.05091044,
   0.06940621};
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp3_fehx3027[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp3_fehy3027[5] = {
   0.05324843,
   0.05924428,
   0.05260914,
   0.05268456,
   0.08842185};
   grae = new TGraphAsymmErrors(5,zj_ptj_8TeV_400_1001_0ratiocomp3_fx3027,zj_ptj_8TeV_400_1001_0ratiocomp3_fy3027,zj_ptj_8TeV_400_1001_0ratiocomp3_felx3027,zj_ptj_8TeV_400_1001_0ratiocomp3_fehx3027,zj_ptj_8TeV_400_1001_0ratiocomp3_fely3027,zj_ptj_8TeV_400_1001_0ratiocomp3_fehy3027);
   grae->SetName("zj_ptj_8TeV_400_1001_0ratiocomp3");
   grae->SetTitle("");
   grae->SetFillColor(1);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(24);
   
   TH1F *Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027 = new TH1F("Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027","",100,17.325,88.425);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->SetMinimum(0.51);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->SetMaximum(1.49);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->SetDirectory(0);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->SetStats(0);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->SetLineWidth(2);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->SetMarkerStyle(0);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetXaxis()->SetTitle("#it{p}_{T}^{jet} [GeV]");
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetXaxis()->SetNdivisions(4);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetXaxis()->SetLabelFont(132);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetXaxis()->SetLabelOffset(0.02);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetXaxis()->SetLabelSize(0.05);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetXaxis()->SetTitleSize(0.06);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetXaxis()->SetTitleFont(132);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetYaxis()->SetTitle("Ratio");
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetYaxis()->CenterTitle(true);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetYaxis()->SetNdivisions(505);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetYaxis()->SetLabelFont(132);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetYaxis()->SetLabelSize(0.05);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetYaxis()->SetTitleSize(0.06);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetYaxis()->SetTitleFont(132);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetZaxis()->SetLabelFont(132);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetZaxis()->SetLabelSize(0.05);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetZaxis()->SetTitleSize(0.06);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_zj_ptj_8TeV_400_1001_0ratiocomp33027);
   
   grae->Draw("p1");
   
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp4_fx3028[5] = {
   21.75,
   26.75,
   33.5,
   43.5,
   67.5};
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp4_fy3028[5] = {
   1.078768,
   1.110628,
   1.151497,
   1.098648,
   1.200155};
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp4_felx3028[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp4_fely3028[5] = {
   0.07869176,
   0.08773815,
   0.0972306,
   0.09492486,
   0.1078312};
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp4_fehx3028[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t zj_ptj_8TeV_400_1001_0ratiocomp4_fehy3028[5] = {
   0.08428785,
   0.09242501,
   0.1013337,
   0.115162,
   0.1238551};
   grae = new TGraphAsymmErrors(5,zj_ptj_8TeV_400_1001_0ratiocomp4_fx3028,zj_ptj_8TeV_400_1001_0ratiocomp4_fy3028,zj_ptj_8TeV_400_1001_0ratiocomp4_felx3028,zj_ptj_8TeV_400_1001_0ratiocomp4_fehx3028,zj_ptj_8TeV_400_1001_0ratiocomp4_fely3028,zj_ptj_8TeV_400_1001_0ratiocomp4_fehy3028);
   grae->SetName("zj_ptj_8TeV_400_1001_0ratiocomp4");
   grae->SetTitle("");
   grae->SetFillColor(1);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(20);
   
   TH1F *Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028 = new TH1F("Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028","",100,17.175,72.075);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->SetMinimum(0.51);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->SetMaximum(1.49);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->SetDirectory(0);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->SetStats(0);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->SetLineWidth(2);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->SetMarkerStyle(0);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetXaxis()->SetTitle("#it{p}_{T}^{jet} [GeV]");
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetXaxis()->SetNdivisions(4);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetXaxis()->SetLabelFont(132);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetXaxis()->SetLabelOffset(0.02);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetXaxis()->SetLabelSize(0.05);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetXaxis()->SetTitleSize(0.06);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetXaxis()->SetTitleFont(132);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetYaxis()->SetTitle("Ratio");
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetYaxis()->CenterTitle(true);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetYaxis()->SetNdivisions(505);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetYaxis()->SetLabelFont(132);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetYaxis()->SetLabelSize(0.05);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetYaxis()->SetTitleSize(0.06);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetYaxis()->SetTitleFont(132);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetZaxis()->SetLabelFont(132);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetZaxis()->SetLabelSize(0.05);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetZaxis()->SetTitleSize(0.06);
   Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_zj_ptj_8TeV_400_1001_0ratiocomp43028);
   
   grae->Draw("p1");
   Double_t xAxis24[6] = {20, 25, 30, 40, 50, 100}; 
   
   TH1F *zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24 = new TH1F("zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24","z_ptj",5, xAxis24);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetBinContent(1,1);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetBinContent(2,1);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetBinContent(3,1);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetBinContent(4,1);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetBinContent(5,1);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetBinContent(6,0.780934);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetBinError(1,0.05745466);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetBinError(2,0.06199906);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetBinError(3,0.07457933);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetBinError(4,0.06897145);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetBinError(5,0.08932795);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetBinError(6,0.06975923);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetMinimum(0.51);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetMaximum(1.49);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetEntries(17);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetDirectory(0);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetStats(0);

   ci = TColor::GetColor("#ffff00");
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetFillColor(ci);

   ci = TColor::GetColor("#ffff00");
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetLineColor(ci);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetLineWidth(2);

   ci = TColor::GetColor("#ffff00");
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetMarkerColor(ci);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->SetMarkerStyle(0);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetXaxis()->SetTitle("#it{p}_{T}^{jet} [GeV]");
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetXaxis()->SetNdivisions(4);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetXaxis()->SetLabelFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetXaxis()->SetLabelOffset(0.02);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetXaxis()->SetLabelSize(0.05);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetXaxis()->SetTitleSize(0.06);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetXaxis()->SetTitleFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetYaxis()->SetTitle("Ratio");
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetYaxis()->CenterTitle(true);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetYaxis()->SetNdivisions(505);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetYaxis()->SetLabelFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetYaxis()->SetLabelSize(0.05);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetYaxis()->SetTitleSize(0.06);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetYaxis()->SetTickLength(0.12325);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetYaxis()->SetTitleOffset(1.3);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetYaxis()->SetTitleFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetZaxis()->SetLabelFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetZaxis()->SetLabelSize(0.05);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetZaxis()->SetTitleSize(0.06);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->GetZaxis()->SetTitleFont(132);
   zj_ptj_8TeV_400_1001_0ratiocomp0_copy__24->Draw("sameaxis");
   lowerPad->Modified();
   default_Canvas->cd();
   default_Canvas->Modified();
   default_Canvas->cd();
   default_Canvas->SetSelected(default_Canvas);
}
예제 #18
0
void DrawVariable(TString VAR,bool SHAPE,int REBIN,float XMIN,float XMAX,TString XTITLE,bool PRINT,bool BLIND=false,float BLIND_MIN=0,float BLIND_MAX=0)
{
  gROOT->ForceStyle();
  const int N = 20;

  TString SAMPLE[N] = {
    "JetHT",
    "ttHJetTobb_M125_13TeV_amcatnloFXFX_madspin_pythia8",
    "ttHJetToNonbb_M125_13TeV_amcatnloFXFX_madspin_pythia8_mWCutfix",
    "QCD_HT300to500_TuneCUETP8M1_13TeV-madgraphMLM-pythia8",
    "QCD_HT500to700_TuneCUETP8M1_13TeV-madgraphMLM-pythia8",
    "QCD_HT700to1000_TuneCUETP8M1_13TeV-madgraphMLM-pythia8",
    "QCD_HT1000to1500_TuneCUETP8M1_13TeV-madgraphMLM-pythia8",
    "QCD_HT1500to2000_TuneCUETP8M1_13TeV-madgraphMLM-pythia8",
    "QCD_HT2000toInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8",
    "DYJetsToQQ_HT180_13TeV-madgraphMLM-pythia8",
    "WJetsToQQ_HT180_13TeV-madgraphMLM-pythia8",
    "TT_TuneCUETP8M1_13TeV-powheg-pythia8",
    "ST_t-channel_antitop_4f_inclusiveDecays_13TeV-powhegV2-madspin-pythia8_TuneCUETP8M1",
    "ST_tW_top_5f_inclusiveDecays_13TeV-powheg-pythia8_TuneCUETP8M1",
    "ST_tW_antitop_5f_inclusiveDecays_13TeV-powheg-pythia8_TuneCUETP8M1",
    "TTWJetsToQQ_TuneCUETP8M1_13TeV-amcatnloFXFX-madspin-pythia8",
    "TTZToQQ_TuneCUETP8M1_13TeV-amcatnlo-pythia8",
    "WZ_TuneCUETP8M1_13TeV-pythia8",
    "WWTo4Q_13TeV-powheg",
    "ZZTo4Q_13TeV_amcatnloFXFX_madspin_pythia8"
  };

  float XSEC[N] = {
    1.0,
    0.2934,
    0.2151,
    347700, 
    32100,
    6831,
    1207,
    119.9,
    25.24,
    1460,
    3539,
    832,
    217,
    35.6,
    35.6,
    0.4062,
    0.5297,
    47.13,
    51.723,
    22.29
  }; 
 
  float LUMI(5760);
  TFile *inf[N];
  TH1F  *h[N];

  TCanvas *can = new TCanvas("can_"+VAR,"can_"+VAR,900,600);
  can->SetRightMargin(0.15);

  for(int i=0;i<N;i++) {
    inf[i] = TFile::Open("Histo_"+SAMPLE[i]+".root");
    //cout<<inf[i]->GetName()<<" "<<VAR<<endl;
    h[i]   = (TH1F*)inf[i]->Get("ttH/h_"+VAR);
    h[i]->SetDirectory(0);
    h[i]->Rebin(REBIN);
    h[i]->Sumw2();
    h[i]->SetLineWidth(1);
    h[i]->SetLineColor(kBlack);
    if (i>0) {
      float norm = ((TH1F*)inf[i]->Get("eventCounter/GenEventWeight"))->GetSumOfWeights();
      //cout<<inf[i]->GetName()<<" "<<norm<<endl; 
      h[i]->Scale(LUMI*XSEC[i]/norm);
    }
    else {
      h[i]->SetLineWidth(2);
    }
    inf[i]->Close();
  }

  TH1F *hQCD = (TH1F*)h[3]->Clone("hQCD");
  hQCD->Add(h[4]);
  hQCD->Add(h[5]);
  hQCD->Add(h[6]); 
  hQCD->Add(h[7]);
  hQCD->Add(h[8]);

  TH1F *hVV = (TH1F*)h[17]->Clone("hVV");
  hVV->Add(h[18]);
  hVV->Add(h[19]);

  TH1F *hST = (TH1F*)h[12]->Clone("hST");
  hST->Add(h[13]);
  hST->Add(h[14]);

  h[1]->SetLineColor(kRed);//ttHbb
  h[1]->SetFillColor(kRed-9);
  h[1]->SetLineWidth(2);
  h[2]->SetLineColor(kRed);//ttHNobb
  h[2]->SetFillColor(kRed-10);
  h[2]->SetLineWidth(2);

  TH1F *hTT     = (TH1F*)h[11]->Clone("TTbar");
  TH1F *hTTZ    = (TH1F*)h[16]->Clone("TTZ");
  TH1F *hTTW    = (TH1F*)h[15]->Clone("TTW");
  TH1F *hWJets  = (TH1F*)h[10]->Clone("WJets");
  TH1F *hDYJets = (TH1F*)h[9]->Clone("DYJets");
 
  hQCD->SetFillColor(kBlue-10);//QCD
  hTT->SetFillColor(kOrange);
  hST->SetFillColor(kOrange-1);//ST
  hVV->SetFillColor(kMagenta-10);//VV
  hTTZ->SetFillColor(kYellow-10);//ttZ
  hTTW->SetFillColor(kYellow-9);//ttW
  hWJets->SetFillColor(kGreen-10);//WJets
  hDYJets->SetFillColor(kGreen-8);//ZJets
 
 

  float kfactor = 1.0;
  if (hQCD->Integral() > 0) { 
    kfactor = (h[0]->Integral()-hTT->Integral()-hWJets->Integral()-hDYJets->Integral()-hST->Integral())/hQCD->Integral();
  }  
  hQCD->Scale(kfactor);

  TH1F *hBkg = (TH1F*)hQCD->Clone("hBkg");
  hBkg->Add(hTT);
  hBkg->Add(hST);
  hBkg->Add(hTTW);
  hBkg->Add(hTTZ);
  hBkg->Add(hWJets);
  hBkg->Add(hDYJets);
  hBkg->Add(hVV);
  hBkg->SetFillColor(kGray);

  cout<<"Data events:  "<<h[0]->Integral()<<endl;
  cout<<"ttHJetTobb:   "<<h[1]->Integral()<<endl;
  cout<<"ttHJetToNonbb:"<<h[2]->Integral()<<endl;
  cout<<"QCD events:   "<<hQCD->Integral()<<endl;
  cout<<"TTbar events: "<<hTT->Integral()<<endl;
  cout<<"ST events:    "<<hST->Integral()<<endl;
  cout<<"TTZ events:   "<<hTTZ->Integral()<<endl;  
  cout<<"TTW events:   "<<hTTW->Integral()<<endl;
  cout<<"WJets events: "<<hWJets->Integral()<<endl;
  cout<<"DYJets events:"<<hDYJets->Integral()<<endl;
  cout<<"VV events:    "<<hVV->Integral()<<endl;
  cout<<"kfactor:      "<<kfactor<<endl;

  THStack *hs = new THStack("hs","hs");
  hs->Add(hVV);
  hs->Add(hTTW);
  hs->Add(hTTZ);
  hs->Add(hWJets);
  hs->Add(hDYJets);
  hs->Add(hST);
  hs->Add(hTT);
  hs->Add(hQCD);

  if (BLIND) {
    for(int i=0;i<h[0]->GetNbinsX();i++) {
      if (h[0]->GetBinCenter(i+1) > BLIND_MIN && h[0]->GetBinCenter(i+1) < BLIND_MAX) {
        h[0]->SetBinContent(i+1,0);
        h[0]->SetBinError(i+1,0);
      } 
    }
  }

  TH1F *hRatio = (TH1F*)h[0]->Clone("Ratio");
  hRatio->SetLineWidth(2);
  hRatio->Divide(hBkg);

  TLegend *leg = new TLegend(0.86,0.55,0.99,0.9);
  leg->SetFillColor(0);
  leg->SetTextFont(42);
  leg->SetTextSize(0.03);
  leg->AddEntry(hQCD,"QCD","F");
  leg->AddEntry(hTT,"TTbar","F");
  leg->AddEntry(hST,"ST","F");
  leg->AddEntry(hTTZ,"ttZ","F");
  leg->AddEntry(hTTW,"ttW","F");
  leg->AddEntry(hWJets,"WJets","F");
  leg->AddEntry(hDYJets,"ZJets","F");
  leg->AddEntry(hVV,"Diboson","F");
  leg->AddEntry(h[1],"ttHbb","L");
  leg->AddEntry(h[2],"ttHNonbb","L");
  
  if (SHAPE) {
    h[1]->SetFillStyle(3001);
    h[2]->SetFillStyle(3001);
    h[0]->Scale(1./h[0]->Integral());
    h[1]->Scale(1./h[1]->Integral());
    h[2]->Scale(1./h[2]->Integral());
    hQCD->Scale(1./hQCD->Integral());
    hBkg->Scale(1./hBkg->Integral());
    double max = TMath::Max(h[0]->GetBinContent(h[0]->GetMaximumBin()),hBkg->GetBinContent(hBkg->GetMaximumBin()));
    hBkg->SetMaximum(1.1*max);
    hBkg->GetXaxis()->SetTitle(XTITLE);
    hBkg->GetXaxis()->SetRangeUser(XMIN,XMAX);
    hBkg->Draw("hist");
    h[0]->Draw("same E"); 
    //h[1]->Draw("same hist"); 
    leg->Draw();
    gPad->RedrawAxis();
    can->Print("can_"+VAR+"_norm.pdf"); 
  }
  else {
    can->SetBottomMargin(0.25);
    gPad->SetLogy(); 
    //h[1]->Scale(h[0]->Integral()/h[1]->Integral());
    h[1]->SetFillColor(0);
    TH1F *hAux = (TH1F*)h[0]->Clone("aux");
    hAux->Reset();
    hAux->GetYaxis()->SetRangeUser(0.5,1.1*TMath::Max(h[1]->GetBinContent(h[1]->GetMaximumBin()),h[0]->GetBinContent(h[0]->GetMaximumBin()))); 
    
    hAux->GetXaxis()->SetRangeUser(XMIN,XMAX);
    hAux->GetYaxis()->SetTitle(TString::Format("Number of events / %1.2f fb^{-1}",LUMI/1000));
    hAux->GetXaxis()->SetTitle("");
    hAux->GetXaxis()->SetLabelSize(0.0);
    hAux->Draw();
    hs->Draw("hist same"); 
    h[0]->Draw("same E");
    h[1]->Draw("same hist");
    h[2]->Draw("same hist");
    leg->Draw();
    gPad->RedrawAxis();

    TPad *pad = new TPad("pad","pad",0.,0.,1.,1.);
    pad->SetTopMargin(0.77);
    pad->SetRightMargin(0.15);
    pad->SetFillColor(0);
    pad->SetFillStyle(0);
    pad->Draw();
    pad->cd(0);
    pad->SetGridy();
    hRatio->GetXaxis()->SetTitleOffset(0.95);
    hRatio->GetYaxis()->SetTitleOffset(1.5);
    hRatio->GetYaxis()->SetTickLength(0.06);
    hRatio->GetYaxis()->SetTitleSize(0.03);
    hRatio->GetYaxis()->SetLabelSize(0.03);
    hRatio->GetYaxis()->SetTitle("Data/MC");
    hRatio->GetXaxis()->SetTitle(XTITLE);
    hRatio->GetXaxis()->SetRangeUser(XMIN,XMAX);
    hRatio->GetYaxis()->SetRangeUser(0.5,1.5);
    hRatio->GetYaxis()->SetNdivisions(505);
    hRatio->Draw();
    if (PRINT) {
      can->Print("plots/can_"+VAR+"_abs.pdf"); 
      can->Print("plots/can_"+VAR+"_abs.png");
    }
  }
}
예제 #19
0
void DrawVariable(TString DIR,TString VAR,float LUMI,bool LOG,int REBIN,float XMIN,float XMAX,TString XTITLE,bool isINT,int XNDIV,bool PRINT)
{
  gROOT->ForceStyle();
  const int N = 14;

  TString SAMPLE[N] = {
    "JetHT",
    "TT_TuneCUETP8M1_13TeV-powheg-pythia8",
    "WJetsToQQ_HT180_13TeV-madgraphMLM-pythia8",
    "DYJetsToQQ_HT180_13TeV-madgraphMLM-pythia8",
    "ST_t-channel_top_4f_inclusiveDecays_13TeV-powhegV2-madspin-pythia8_TuneCUETP8M1",
    "ST_t-channel_antitop_4f_inclusiveDecays_13TeV-powhegV2-madspin-pythia8_TuneCUETP8M1",
    "ST_tW_top_5f_inclusiveDecays_13TeV-powheg-pythia8_TuneCUETP8M1",
    "ST_tW_antitop_5f_inclusiveDecays_13TeV-powheg-pythia8_TuneCUETP8M1",
    "QCD_HT300to500_TuneCUETP8M1_13TeV-madgraphMLM-pythia8",
    "QCD_HT500to700_TuneCUETP8M1_13TeV-madgraphMLM-pythia8",
    "QCD_HT700to1000_TuneCUETP8M1_13TeV-madgraphMLM-pythia8",
    "QCD_HT1000to1500_TuneCUETP8M1_13TeV-madgraphMLM-pythia8",
    "QCD_HT1500to2000_TuneCUETP8M1_13TeV-madgraphMLM-pythia8",
    "QCD_HT2000toInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8"
  };
  float XSEC[N] = {1.0,0.5*832,3539,1460.,136.02,80.95,35.6,35.6,3.67e+5,2.94e+4,6.524e+03,1.064e+03,121.5,2.542e+01};

  TFile *inf[N];
  TH1F  *h[N];

  TCanvas *can = new TCanvas("DataVsMC_"+DIR+"_"+VAR,"DataVsMC_"+DIR+"_"+VAR,900,600);
  can->SetRightMargin(0.15);

  for(int i=0;i<N;i++) {
    inf[i] = TFile::Open("Histo_"+SAMPLE[i]+".root");
    h[i] = (TH1F*)inf[i]->Get(DIR+"/hWt_"+VAR);
    if (!h[i]) {
      cout<<"Histogram "<<"hWt_"+VAR<<" does not exist !!!"<<endl;
      break;
    } 
    h[i]->SetDirectory(0);
    h[i]->Sumw2();
    h[i]->Rebin(REBIN);
    h[i]->SetLineWidth(1);
    h[i]->SetLineColor(kBlack);
    if (i>0) {
      float norm = ((TH1F*)inf[i]->Get("eventCounter/GenEventWeight"))->GetSumOfWeights();   
      //cout<<SAMPLE[i]<<" "<<norm<<endl;
      h[i]->Scale(LUMI*XSEC[i]/norm);
    }
    inf[i]->Close();
  }

  TH1F *hQCD = (TH1F*)h[8]->Clone("hQCD");
  for(int i=9;i<N;i++) {
    hQCD->Add(h[i]);
  }
 
  TH1F *hST = (TH1F*)h[4]->Clone("hST");
  hST->Add(h[5]);
  hST->Add(h[6]);
  hST->Add(h[7]);
  h[0]->SetLineWidth(2);//data
  hQCD->SetFillColor(kBlue-10);//QCD
  h[1]->SetFillColor(kOrange);//ttbar
  h[2]->SetFillColor(kGreen-10);//WJets
  h[3]->SetFillColor(kGreen-8);//ZJets
  hST->SetFillColor(kOrange-1);//ST

  float kfactor = 1.0;
  if (hQCD->Integral() > 0) { 
    kfactor = (h[0]->Integral()-h[1]->Integral()-h[2]->Integral()-h[3]->Integral()-hST->Integral())/hQCD->Integral();
  }  
  hQCD->Scale(kfactor);

  TH1F *hBkg = (TH1F*)hQCD->Clone("hBkg");
  hBkg->Add(h[1]);
  hBkg->Add(h[2]);
  hBkg->Add(h[3]);
  hBkg->Add(h[4]);
  hBkg->Add(hST);
  //hBkg->SetFillColor(kGray);

  cout<<"======== "<<VAR<<"====================="<<endl;
  cout<<"Data events:  "<<h[0]->Integral()<<endl;
  cout<<"QCD events:   "<<hQCD->Integral()<<endl;
  cout<<"WJets events: "<<h[2]->Integral()<<endl;
  cout<<"ZJets events: "<<h[3]->Integral()<<endl;
  cout<<"ST events:    "<<hST->Integral()<<endl;
  cout<<"TTbar events: "<<h[1]->Integral()<<endl;
  cout<<"kfactor:      "<<kfactor<<endl;

  THStack *hs = new THStack("hs","hs");
  if (LOG) {   
    hs->Add(h[2]);
    hs->Add(h[3]);
    hs->Add(hST); 
    hs->Add(hQCD);
    hs->Add(h[1]);
  }
  else {
    hs->Add(h[3]);
    hs->Add(hST);
    hs->Add(h[2]);
    hs->Add(hQCD);
    hs->Add(h[1]);
  }
  TH1F *hRatio = (TH1F*)h[0]->Clone("Ratio");
  hRatio->SetLineWidth(2);
  hRatio->Divide(hBkg);

  TLegend *leg = new TLegend(0.86,0.7,0.99,0.9);
  leg->SetFillColor(0);
  leg->SetTextFont(42);
  leg->SetTextSize(0.03);
  leg->AddEntry(hQCD,"QCD","F");
  leg->AddEntry(h[1],"TTbar","F"); 
  leg->AddEntry(hST,"ST","F"); 
  leg->AddEntry(h[2],"WJets","F");
  leg->AddEntry(h[3],"ZJets","F"); 
  
  can->SetBottomMargin(0.25);
  TH1F *hAux = (TH1F*)h[0]->Clone("aux");
  hAux->Reset();
  hAux->GetXaxis()->SetNdivisions(XNDIV);
  if (isINT) {
    hAux->GetXaxis()->CenterLabels();
  } 
  hAux->GetYaxis()->SetRangeUser(0.5,1.1*TMath::Max(hBkg->GetBinContent(hBkg->GetMaximumBin()),h[0]->GetBinContent(h[0]->GetMaximumBin())));  
  if (LOG) {
    gPad->SetLogy(); 
    hAux->GetYaxis()->SetRangeUser(0.5,2*TMath::Max(hBkg->GetBinContent(hBkg->GetMaximumBin()),h[0]->GetBinContent(h[0]->GetMaximumBin())));
  }
  hAux->GetXaxis()->SetRangeUser(XMIN,XMAX);
  hAux->GetYaxis()->SetTitle(TString::Format("Number of events / %1.2f fb^{-1}",LUMI/1000));
  hAux->GetXaxis()->SetTitle("");
  hAux->GetXaxis()->SetLabelSize(0.0);
  hAux->Draw();
  hs->Draw("hist same");
  //hBkg->Draw("sames hist"); 
  h[0]->Draw("sames E");
  
  leg->Draw();
  gPad->RedrawAxis();

  TPad *pad = new TPad("pad","pad",0.,0.,1.,1.);
  pad->SetTopMargin(0.77);
  pad->SetRightMargin(0.15);
  pad->SetFillColor(0);
  pad->SetFillStyle(0);
  pad->Draw();
  pad->cd(0);
  pad->SetGridy();
  hRatio->GetXaxis()->SetTitleOffset(0.95);
  hRatio->GetYaxis()->SetTitleOffset(1.5);
  hRatio->GetYaxis()->SetTickLength(0.06);
  hRatio->GetYaxis()->SetTitleSize(0.03);
  hRatio->GetYaxis()->SetLabelSize(0.03);
  hRatio->GetYaxis()->SetTitle("Data/MC");
  hRatio->GetXaxis()->SetTitle(XTITLE);
  hRatio->GetXaxis()->SetRangeUser(XMIN,XMAX);
  hRatio->GetYaxis()->SetRangeUser(0.5,1.5);
  hRatio->GetYaxis()->SetNdivisions(505);
  hRatio->GetXaxis()->SetNdivisions(XNDIV);
  if (isINT) {
    hRatio->GetXaxis()->CenterLabels();
  }
  hRatio->Draw();
  if (PRINT) {
    can->Print("plots/"+TString(can->GetName())+".pdf"); 
    can->Print("plots/"+TString(can->GetName())+".png");
  }
}
예제 #20
0
파일: limit.C 프로젝트: abdollah110/LQ80X
void limit()
{
//=========Macro generated from canvas: limit/limit
//=========  (Thu Apr 27 14:38:33 2017) by ROOT version6.02/05
   TCanvas *limit = new TCanvas("limit", "limit",0,0,600,600);
   gStyle->SetOptFit(1);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   limit->SetHighLightColor(2);
   limit->Range(0,0,1,1);
   limit->SetFillColor(0);
   limit->SetBorderMode(0);
   limit->SetBorderSize(2);
   limit->SetLeftMargin(0.16);
   limit->SetRightMargin(0.04);
   limit->SetTopMargin(0.06);
   limit->SetBottomMargin(0.12);
   limit->SetFrameFillStyle(0);
   limit->SetFrameBorderMode(0);
  
// ------------>Primitives in pad: pad
   TPad *pad = new TPad("pad", "pad",0,0,1,1);
   pad->Draw();
   pad->cd();
   pad->Range(-59.99999,-2.046818,1565,15.01);
   pad->SetFillColor(0);
   pad->SetBorderMode(0);
    pad->SetLogy();
   pad->SetBorderSize(2);
   pad->SetTickx(1);
   pad->SetTicky(1);
   pad->SetLeftMargin(0.16);
   pad->SetRightMargin(0.04);
   pad->SetTopMargin(0.06);
   pad->SetBottomMargin(0.12);
   pad->SetFrameFillStyle(0);
   pad->SetFrameBorderMode(0);
   pad->SetFrameFillStyle(0);
   pad->SetFrameBorderMode(0);
   
   TH1F *tmp01 = new TH1F("tmp01","Graph",100,200,1500);
   tmp01->SetMinimum(0.);
   tmp01->SetMaximum(13.98659);
   tmp01->SetStats(0);
   tmp01->SetLineStyle(0);
   tmp01->SetMarkerStyle(20);
   tmp01->GetXaxis()->SetTitle("m_{H} (GeV)");
   tmp01->GetXaxis()->SetLabelFont(42);
   tmp01->GetXaxis()->SetLabelOffset(0.01);
   tmp01->GetXaxis()->SetTitleSize(0.05);
   tmp01->GetXaxis()->SetTickLength(0.02);
   tmp01->GetXaxis()->SetTitleOffset(1.08);
   tmp01->GetXaxis()->SetTitleFont(42);
   tmp01->GetYaxis()->SetTitle("95% CL limit on #sigma/#sigma_{SM}");
   tmp01->GetYaxis()->SetLabelFont(42);
   tmp01->GetYaxis()->SetLabelOffset(0.007);
   tmp01->GetYaxis()->SetTitleSize(0.05);
   tmp01->GetYaxis()->SetTickLength(0.02);
   tmp01->GetYaxis()->SetTitleOffset(1.56);
   tmp01->GetYaxis()->SetTitleFont(42);
   tmp01->GetZaxis()->SetLabelFont(42);
   tmp01->GetZaxis()->SetLabelOffset(0.007);
   tmp01->GetZaxis()->SetTitleSize(0.05);
   tmp01->GetZaxis()->SetTickLength(0.02);
   tmp01->GetZaxis()->SetTitleFont(42);
   tmp01->Draw("AXIS");
   
   TH1F *tmp02 = new TH1F("tmp02","Graph",100,200,1500);
   tmp02->SetMinimum(0);
   tmp02->SetMaximum(13.98659);
   tmp02->SetStats(0);
   tmp02->SetLineStyle(0);
   tmp02->SetMarkerStyle(20);
   tmp02->GetXaxis()->SetTitle("m_{H} (GeV)");
   tmp02->GetXaxis()->SetLabelFont(42);
   tmp02->GetXaxis()->SetLabelOffset(0.01);
   tmp02->GetXaxis()->SetTitleSize(0.05);
   tmp02->GetXaxis()->SetTickLength(0.02);
   tmp02->GetXaxis()->SetTitleOffset(1.08);
   tmp02->GetXaxis()->SetTitleFont(42);
   tmp02->GetYaxis()->SetTitle("95% CL limit on #sigma/#sigma_{SM}");
   tmp02->GetYaxis()->SetLabelFont(42);
   tmp02->GetYaxis()->SetLabelOffset(0.007);
   tmp02->GetYaxis()->SetTitleSize(0.05);
   tmp02->GetYaxis()->SetTickLength(0.02);
   tmp02->GetYaxis()->SetTitleOffset(1.56);
   tmp02->GetYaxis()->SetTitleFont(42);
   tmp02->GetZaxis()->SetLabelFont(42);
   tmp02->GetZaxis()->SetLabelOffset(0.007);
   tmp02->GetZaxis()->SetTitleSize(0.05);
   tmp02->GetZaxis()->SetTickLength(0.02);
   tmp02->GetZaxis()->SetTitleFont(42);
   tmp02->Draw("AXIGSAME");
   
   Double_t Graph0_fx3001[27] = {
   200,
   250,
   300,
   350,
   400,
   450,
   500,
   550,
   600,
   650,
   700,
   750,
   800,
   850,
   900,
   950,
   1000,
   1050,
   1100,
   1150,
   1200,
   1250,
   1300,
   1350,
   1400,
   1450,
   1500};
   Double_t Graph0_fy3001[27] = {
   4.796875,
   2.148438,
   0.8398438,
   0.3857422,
   0.2001953,
   0.1088867,
   0.06591797,
   0.04736328,
   0.03564453,
   0.02783203,
   0.02294922,
   0.01806641,
   0.01513672,
   0.01220703,
   0.01123047,
   0.009277344,
   0.008300781,
   0.007324219,
   0.007324219,
   0.006347656,
   0.006347656,
   0.005371094,
   0.005371094,
   0.004394531,
   0.004394531,
   0.004394531,
   0.004394531};
   Double_t Graph0_felx3001[27] = {
   4.032346e-316,
   0,
   0,
   0,
   6.906313e-310,
   4.032343e-316,
   2.121996e-314,
   4.032582e-316,
   0,
   4.032588e-316,
   4.032343e-316,
   0,
   4.032584e-316,
   1.508018e-316,
   1.508219e-316,
   4.032589e-316,
   2.124327e-314,
   4.032593e-316,
   5.582942e-322,
   6.906313e-310,
   0,
   4.032344e-316,
   4.032583e-316,
   4.032588e-316,
   1.58101e-322,
   4.032293e-316,
   5.582942e-322};
   Double_t Graph0_fely3001[27] = {
   2.370331,
   1.057434,
   0.405159,
   0.1845837,
   0.09618759,
   0.05231667,
   0.03192902,
   0.02331161,
   0.01754379,
   0.01435089,
   0.01183319,
   0.009315491,
   0.008041382,
   0.006484985,
   0.005966187,
   0.004928589,
   0.00440979,
   0.004119873,
   0.004119873,
   0.003570557,
   0.003570557,
   0.00302124,
   0.00302124,
   0.002471924,
   0.002471924,
   0.002471924,
   0.002471924};
   Double_t Graph0_fehx3001[27] = {
   4.031643e-316,
   0,
   0,
   0,
   6.906313e-310,
   4.032106e-316,
   2.121996e-314,
   4.032349e-316,
   0,
   4.032354e-316,
   4.032106e-316,
   0,
   4.032351e-316,
   1.508018e-316,
   1.508219e-316,
   4.032356e-316,
   2.124327e-314,
   4.03236e-316,
   5.582942e-322,
   6.906313e-310,
   0,
   4.032107e-316,
   4.03235e-316,
   4.032354e-316,
   1.58101e-322,
   4.032222e-316,
   5.582942e-322};
   Double_t Graph0_fehy3001[27] = {
   5.693069,
   2.47175,
   0.8989364,
   0.4081147,
   0.2108151,
   0.1170805,
   0.07362081,
   0.05438244,
   0.04146756,
   0.03243252,
   0.02825768,
   0.02361592,
   0.01990321,
   0.01752287,
   0.01712826,
   0.0153559,
   0.01456667,
   0.01341494,
   0.01192601,
   0.0124739,
   0.01149977,
   0.01055484,
   0.01051202,
   0.008670811,
   0.008670811,
   0.008635777,
   0.008635777};
   TGraphAsymmErrors *grae = new TGraphAsymmErrors(27,Graph0_fx3001,Graph0_fy3001,Graph0_felx3001,Graph0_fehx3001,Graph0_fely3001,Graph0_fehy3001);
   grae->SetName("Graph0");
   grae->SetTitle("Graph");

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#ffff00");
   grae->SetFillColor(ci);
   grae->SetMarkerStyle(20);
   
   TH1F *Graph_Graph3001 = new TH1F("Graph_Graph3001","Graph",100,70,1630);
   Graph_Graph3001->SetMinimum(0);
   Graph_Graph3001->SetMaximum(11.53875);
   Graph_Graph3001->SetDirectory(0);
   Graph_Graph3001->SetStats(0);
   Graph_Graph3001->SetLineStyle(0);
   Graph_Graph3001->SetMarkerStyle(20);
   Graph_Graph3001->GetXaxis()->SetLabelFont(42);
   Graph_Graph3001->GetXaxis()->SetTitleSize(0.05);
   Graph_Graph3001->GetXaxis()->SetTickLength(0.02);
   Graph_Graph3001->GetXaxis()->SetTitleOffset(1.08);
   Graph_Graph3001->GetXaxis()->SetTitleFont(42);
   Graph_Graph3001->GetYaxis()->SetLabelFont(42);
   Graph_Graph3001->GetYaxis()->SetLabelOffset(0.007);
   Graph_Graph3001->GetYaxis()->SetTitleSize(0.05);
   Graph_Graph3001->GetYaxis()->SetTickLength(0.02);
   Graph_Graph3001->GetYaxis()->SetTitleOffset(1.56);
   Graph_Graph3001->GetYaxis()->SetTitleFont(42);
   Graph_Graph3001->GetZaxis()->SetLabelFont(42);
   Graph_Graph3001->GetZaxis()->SetLabelOffset(0.007);
   Graph_Graph3001->GetZaxis()->SetTitleSize(0.05);
   Graph_Graph3001->GetZaxis()->SetTickLength(0.02);
   Graph_Graph3001->GetZaxis()->SetTitleFont(42);
   grae->SetHistogram(Graph_Graph3001);
   
   grae->Draw("3");
   
   Double_t Graph1_fx3002[27] = {
   200,
   250,
   300,
   350,
   400,
   450,
   500,
   550,
   600,
   650,
   700,
   750,
   800,
   850,
   900,
   950,
   1000,
   1050,
   1100,
   1150,
   1200,
   1250,
   1300,
   1350,
   1400,
   1450,
   1500};
   Double_t Graph1_fy3002[27] = {
   4.796875,
   2.148438,
   0.8398438,
   0.3857422,
   0.2001953,
   0.1088867,
   0.06591797,
   0.04736328,
   0.03564453,
   0.02783203,
   0.02294922,
   0.01806641,
   0.01513672,
   0.01220703,
   0.01123047,
   0.009277344,
   0.008300781,
   0.007324219,
   0.007324219,
   0.006347656,
   0.006347656,
   0.005371094,
   0.005371094,
   0.004394531,
   0.004394531,
   0.004394531,
   0.004394531};
   Double_t Graph1_felx3002[27] = {
   4.028644e-316,
   2.608667e-321,
   4.022558e-316,
   0,
   2.420922e-322,
   4.028601e-316,
   0,
   2.11372e-314,
   0,
   4.940656e-323,
   8.744962e-322,
   0,
   0,
   4.940656e-323,
   0,
   6.906314e-310,
   5.33769e+160,
   0,
   4.021573e-316,
   6.906314e-310,
   0,
   1.188318e-312,
   4.027998e-316,
   0,
   1.58101e-322,
   4.027629e-316,
   1.630417e-322};
   Double_t Graph1_fely3002[27] = {
   1.490716,
   0.6650269,
   0.2516418,
   0.1146438,
   0.05974151,
   0.03228919,
   0.01945674,
   0.01420552,
   0.01069075,
   0.009417772,
   0.007765532,
   0.006113291,
   0.005277157,
   0.003647804,
   0.00335598,
   0.002772331,
   0.002480507,
   0.002317429,
   0.002832413,
   0.002231598,
   0.002231598,
   0.001888275,
   0.001888275,
   0.001544952,
   0.001544952,
   0.001544952,
   0.002162933};
   Double_t Graph1_fehx3002[27] = {
   1.179415e-312,
   2.608667e-321,
   4.022558e-316,
   0,
   2.420922e-322,
   4.028634e-316,
   0,
   2.113722e-314,
   0,
   4.940656e-323,
   8.744962e-322,
   0,
   0,
   4.940656e-323,
   0,
   6.906314e-310,
   2.139459e+161,
   0,
   4.021573e-316,
   6.906314e-310,
   0,
   1.188318e-312,
   4.027998e-316,
   0,
   1.58101e-322,
   4.027675e-316,
   1.630417e-322};
   Double_t Graph1_fehy3002[27] = {
   2.351828,
   1.053343,
   0.3849801,
   0.1768222,
   0.09017253,
   0.05078118,
   0.03126747,
   0.02303264,
   0.01790216,
   0.012869,
   0.0113431,
   0.009505779,
   0.008205643,
   0.007395977,
   0.0068043,
   0.006212621,
   0.006088058,
   0.005138258,
   0.004204029,
   0.005262822,
   0.003643492,
   0.004453157,
   0.003768056,
   0.004204029,
   0.004204029,
   0.003643492,
   0.003643492};
   grae = new TGraphAsymmErrors(27,Graph1_fx3002,Graph1_fy3002,Graph1_felx3002,Graph1_fehx3002,Graph1_fely3002,Graph1_fehy3002);
   grae->SetName("Graph1");
   grae->SetTitle("Graph");

   ci = TColor::GetColor("#00ff00");
   grae->SetFillColor(ci);
   grae->SetMarkerStyle(20);
   
   TH1F *Graph_Graph3002 = new TH1F("Graph_Graph3002","Graph",100,-8.010917e+160,2.406781e+161);
   Graph_Graph3002->SetMinimum(0);
   Graph_Graph3002->SetMaximum(7.86335);
   Graph_Graph3002->SetDirectory(0);
   Graph_Graph3002->SetStats(0);
   Graph_Graph3002->SetLineStyle(0);
   Graph_Graph3002->SetMarkerStyle(20);
   Graph_Graph3002->GetXaxis()->SetLabelFont(42);
   Graph_Graph3002->GetXaxis()->SetTitleSize(0.05);
   Graph_Graph3002->GetXaxis()->SetTickLength(0.02);
   Graph_Graph3002->GetXaxis()->SetTitleOffset(1.08);
   Graph_Graph3002->GetXaxis()->SetTitleFont(42);
   Graph_Graph3002->GetYaxis()->SetLabelFont(42);
   Graph_Graph3002->GetYaxis()->SetLabelOffset(0.007);
   Graph_Graph3002->GetYaxis()->SetTitleSize(0.05);
   Graph_Graph3002->GetYaxis()->SetTickLength(0.02);
   Graph_Graph3002->GetYaxis()->SetTitleOffset(1.56);
   Graph_Graph3002->GetYaxis()->SetTitleFont(42);
   Graph_Graph3002->GetZaxis()->SetLabelFont(42);
   Graph_Graph3002->GetZaxis()->SetLabelOffset(0.007);
   Graph_Graph3002->GetZaxis()->SetTitleSize(0.05);
   Graph_Graph3002->GetZaxis()->SetTickLength(0.02);
   Graph_Graph3002->GetZaxis()->SetTitleFont(42);
   grae->SetHistogram(Graph_Graph3002);
   
   grae->Draw("3");
   
   Double_t Graph2_fx1[27] = {
   200,
   250,
   300,
   350,
   400,
   450,
   500,
   550,
   600,
   650,
   700,
   750,
   800,
   850,
   900,
   950,
   1000,
   1050,
   1100,
   1150,
   1200,
   1250,
   1300,
   1350,
   1400,
   1450,
   1500};
   Double_t Graph2_fy1[27] = {
   4.796875,
   2.148438,
   0.8398438,
   0.3857422,
   0.2001953,
   0.1088867,
   0.06591797,
   0.04736328,
   0.03564453,
   0.02783203,
   0.02294922,
   0.01806641,
   0.01513672,
   0.01220703,
   0.01123047,
   0.009277344,
   0.008300781,
   0.007324219,
   0.007324219,
   0.006347656,
   0.006347656,
   0.005371094,
   0.005371094,
   0.004394531,
   0.004394531,
   0.004394531,
   0.004394531};
   TGraph *graph = new TGraph(27,Graph2_fx1,Graph2_fy1);
   graph->SetName("Graph2");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#ff0000");
   graph->SetLineColor(ci);
   graph->SetLineWidth(2);
   graph->SetMarkerStyle(20);
   
   TH1F *Graph_Graph1 = new TH1F("Graph_Graph1","Graph",100,70,1630);
   Graph_Graph1->SetMinimum(0);
   Graph_Graph1->SetMaximum(5.276123);
   Graph_Graph1->SetDirectory(0);
   Graph_Graph1->SetStats(0);
   Graph_Graph1->SetLineStyle(0);
   Graph_Graph1->SetMarkerStyle(20);
   Graph_Graph1->GetXaxis()->SetLabelFont(42);
   Graph_Graph1->GetXaxis()->SetTitleSize(0.05);
   Graph_Graph1->GetXaxis()->SetTickLength(0.02);
   Graph_Graph1->GetXaxis()->SetTitleOffset(1.08);
   Graph_Graph1->GetXaxis()->SetTitleFont(42);
   Graph_Graph1->GetYaxis()->SetLabelFont(42);
   Graph_Graph1->GetYaxis()->SetLabelOffset(0.007);
   Graph_Graph1->GetYaxis()->SetTitleSize(0.05);
   Graph_Graph1->GetYaxis()->SetTickLength(0.02);
   Graph_Graph1->GetYaxis()->SetTitleOffset(1.56);
   Graph_Graph1->GetYaxis()->SetTitleFont(42);
   Graph_Graph1->GetZaxis()->SetLabelFont(42);
   Graph_Graph1->GetZaxis()->SetLabelOffset(0.007);
   Graph_Graph1->GetZaxis()->SetTitleSize(0.05);
   Graph_Graph1->GetZaxis()->SetTickLength(0.02);
   Graph_Graph1->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph1);
   
   graph->Draw("l");
   
   Double_t Graph3_fx2[27] = {
   200,
   250,
   300,
   350,
   400,
   450,
   500,
   550,
   600,
   650,
   700,
   750,
   800,
   850,
   900,
   950,
   1000,
   1050,
   1100,
   1150,
   1200,
   1250,
   1300,
   1350,
   1400,
   1450,
   1500};
   Double_t Graph3_fy2[27] = {
   4.79203,
   2.152691,
   0.8377939,
   0.3861777,
   0.1995838,
   0.1090425,
   0.0660598,
   0.04759021,
   0.03596779,
   0.02751563,
   0.02238263,
   0.01815241,
   0.01512282,
   0.01228406,
   0.01162986,
   0.009836298,
   0.008643669,
   0.007866618,
   0.007089044,
   0.006702567,
   0.005960677,
   0.005744891,
   0.005145786,
   0.004956617,
   0.004917011,
   0.004476165,
   0.004343825};
   graph = new TGraph(27,Graph3_fx2,Graph3_fy2);
   graph->SetName("Graph3");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);
   graph->SetLineWidth(2);
   graph->SetMarkerStyle(20);
   
   TH1F *Graph_Graph2 = new TH1F("Graph_Graph2","Graph",100,70,1630);
   Graph_Graph2->SetMinimum(0);
   Graph_Graph2->SetMaximum(5.270799);
   Graph_Graph2->SetDirectory(0);
   Graph_Graph2->SetStats(0);
   Graph_Graph2->SetLineStyle(0);
   Graph_Graph2->SetMarkerStyle(20);
   Graph_Graph2->GetXaxis()->SetLabelFont(42);
   Graph_Graph2->GetXaxis()->SetTitleSize(0.05);
   Graph_Graph2->GetXaxis()->SetTickLength(0.02);
   Graph_Graph2->GetXaxis()->SetTitleOffset(1.08);
   Graph_Graph2->GetXaxis()->SetTitleFont(42);
   Graph_Graph2->GetYaxis()->SetLabelFont(42);
   Graph_Graph2->GetYaxis()->SetLabelOffset(0.007);
   Graph_Graph2->GetYaxis()->SetTitleSize(0.05);
   Graph_Graph2->GetYaxis()->SetTickLength(0.02);
   Graph_Graph2->GetYaxis()->SetTitleOffset(1.56);
   Graph_Graph2->GetYaxis()->SetTitleFont(42);
   Graph_Graph2->GetZaxis()->SetLabelFont(42);
   Graph_Graph2->GetZaxis()->SetLabelOffset(0.007);
   Graph_Graph2->GetZaxis()->SetTitleSize(0.05);
   Graph_Graph2->GetZaxis()->SetTickLength(0.02);
   Graph_Graph2->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph2);
   
   graph->Draw("pl");
   
   TH1F *tmp0_copy3 = new TH1F("tmp0_copy3","Graph",100,200,1500);
   tmp0_copy3->SetMinimum(0);
   tmp0_copy3->SetMaximum(11.53875);
   tmp0_copy3->SetDirectory(0);
   tmp0_copy3->SetStats(0);
   tmp0_copy3->SetLineStyle(0);
   tmp0_copy3->SetMarkerStyle(20);
   tmp0_copy3->GetXaxis()->SetLabelFont(42);
   tmp0_copy3->GetXaxis()->SetTitleSize(0.05);
   tmp0_copy3->GetXaxis()->SetTickLength(0.02);
   tmp0_copy3->GetXaxis()->SetTitleOffset(1.08);
   tmp0_copy3->GetXaxis()->SetTitleFont(42);
   tmp0_copy3->GetYaxis()->SetLabelFont(42);
   tmp0_copy3->GetYaxis()->SetLabelOffset(0.007);
   tmp0_copy3->GetYaxis()->SetTitleSize(0.05);
   tmp0_copy3->GetYaxis()->SetTickLength(0.02);
   tmp0_copy3->GetYaxis()->SetTitleOffset(1.56);
   tmp0_copy3->GetYaxis()->SetTitleFont(42);
   tmp0_copy3->GetZaxis()->SetLabelFont(42);
   tmp0_copy3->GetZaxis()->SetLabelOffset(0.007);
   tmp0_copy3->GetZaxis()->SetTitleSize(0.05);
   tmp0_copy3->GetZaxis()->SetTickLength(0.02);
   tmp0_copy3->GetZaxis()->SetTitleFont(42);
   tmp0_copy3->Draw("sameaxis");
   
   TH1F *tmp0_copy4 = new TH1F("tmp0_copy4","Graph",100,200,1500);
   tmp0_copy4->SetMinimum(0);
   tmp0_copy4->SetMaximum(11.53875);
   tmp0_copy4->SetDirectory(0);
   tmp0_copy4->SetStats(0);
   tmp0_copy4->SetLineStyle(0);
   tmp0_copy4->SetMarkerStyle(20);
   tmp0_copy4->GetXaxis()->SetLabelFont(42);
   tmp0_copy4->GetXaxis()->SetTitleSize(0.05);
   tmp0_copy4->GetXaxis()->SetTickLength(0.02);
   tmp0_copy4->GetXaxis()->SetTitleOffset(1.08);
   tmp0_copy4->GetXaxis()->SetTitleFont(42);
   tmp0_copy4->GetYaxis()->SetLabelFont(42);
   tmp0_copy4->GetYaxis()->SetLabelOffset(0.007);
   tmp0_copy4->GetYaxis()->SetTitleSize(0.05);
   tmp0_copy4->GetYaxis()->SetTickLength(0.02);
   tmp0_copy4->GetYaxis()->SetTitleOffset(1.56);
   tmp0_copy4->GetYaxis()->SetTitleFont(42);
   tmp0_copy4->GetZaxis()->SetLabelFont(42);
   tmp0_copy4->GetZaxis()->SetLabelOffset(0.007);
   tmp0_copy4->GetZaxis()->SetTitleSize(0.05);
   tmp0_copy4->GetZaxis()->SetTickLength(0.02);
   tmp0_copy4->GetZaxis()->SetTitleFont(42);
   tmp0_copy4->Draw("sameaxig");
   
   TLegend *leg = new TLegend(0.495,0.825,0.945,0.925,NULL,"NBNDC");
   leg->SetBorderSize(0);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   TLegendEntry *entry=leg->AddEntry("Graph3","Observed","LP");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(20);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph2","Expected","L");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph1","#pm1#sigma Expected","F");

   ci = TColor::GetColor("#00ff00");
   entry->SetFillColor(ci);
   entry->SetFillStyle(1001);
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph0","#pm2#sigma Expected","F");

   ci = TColor::GetColor("#ffff00");
   entry->SetFillColor(ci);
   entry->SetFillStyle(1001);
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   TPave *pave = new TPave(0.16,0.81,0.96,0.94,1,"brNDC");
   pave->SetFillColor(0);
   pave->Draw();
   
   leg = new TLegend(0.495,0.825,0.945,0.925,NULL,"NBNDC");
   leg->SetBorderSize(0);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   entry=leg->AddEntry("Graph3","Observed","LP");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(20);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph2","Expected","L");

   ci = TColor::GetColor("#ff0000");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(2);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph1","#pm1#sigma Expected","F");

   ci = TColor::GetColor("#00ff00");
   entry->SetFillColor(ci);
   entry->SetFillStyle(1001);
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph0","#pm2#sigma Expected","F");

   ci = TColor::GetColor("#ffff00");
   entry->SetFillColor(ci);
   entry->SetFillStyle(1001);
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   TLatex *   tex = new TLatex(0.196,0.9113,"CMS");
tex->SetNDC();
   tex->SetTextAlign(13);
   tex->SetTextSize(0.048);
   tex->SetLineWidth(2);
   tex->Draw();
      tex = new TLatex(0.196,0.8537,"Internal");
tex->SetNDC();
   tex->SetTextAlign(13);
   tex->SetTextFont(52);
   tex->SetTextSize(0.03648);
   tex->SetLineWidth(2);
   tex->Draw();
      tex = new TLatex(0.96,0.952,"");
tex->SetNDC();
   tex->SetTextAlign(31);
   tex->SetTextFont(42);
   tex->SetTextSize(0.036);
   tex->SetLineWidth(2);
   tex->Draw();
      tex = new TLatex(0.16,0.952,"");
tex->SetNDC();
   tex->SetTextFont(42);
   tex->SetTextSize(0.036);
   tex->SetLineWidth(2);
   tex->Draw();
   pad->Modified();
   limit->cd();
   limit->Modified();
   limit->cd();
   limit->SetSelected(limit);
}
예제 #21
0
파일: second.C 프로젝트: alcap-org/AlcapDAQ
void second() {
   
   TCanvas *nut = new TCanvas("nut", "Second Session",100,10,750,1000);
   nut->Range(0,0,20,24);
   nut->SetFillColor(18);

   TPaveLabel *pl = new TPaveLabel(3,22,17,23.7,"My second ROOT interactive session","br");
   pl->SetFillColor(18);
   pl->Draw();

   TText t(0,0,"a");
   t.SetTextFont(62);
   t.SetTextSize(0.025);
   t.SetTextAlign(12);
   t.DrawText(2,21,"Very large C/C++ files can be interpreted (50,000 lines+).");
   t.DrawText(2,20,"Functions in macros can reference other functions, etc.");
   t.DrawText(2,19,"Let's make a file \"graph.C\" with the following statements:");

   TPaveText *macro = new TPaveText(2,11,18,18);
   macro->SetFillColor(10);
   macro->SetTextColor(kBlue);
   macro->SetBorderSize(6);
   macro->SetTextAlign(12);
   macro->SetTextFont(61);
   macro->AddText("{");
   macro->AddText("   TCanvas *c1 = new TCanvas(\"c1\",\"A Simple Graph Example\",200,10,700,500);");
   macro->AddText("   c1->Range(-0.5,-2,2.5,12);");
   macro->AddText("   const Int_t n = 20");
   macro->AddText("   Float_t x[n], y[n];");
   macro->AddText("   for (Int_t i=0;i<n;i++) {");
   macro->AddText("        x[i] = i*0.1;");
   macro->AddText("        y[i] = 10*sin(x[i]+0.2);");
   macro->AddText("   }");
   macro->AddText("   gr = new TGraph(n,x,y);");
   macro->AddText("   gr->Draw(\"AC*\");");
   macro->AddText("}");
   macro->AddText(" ");
   macro->Draw();

   t.SetTextFont(72);
   t.SetTextColor(kRed);
   t.SetTextSize(0.026);
   t.DrawText(3,10,"Root > .x graph.C");

   TPad *pad = new TPad("pad","pad",.15,.05,.85,.40);
   pad->SetFillColor(41);
   pad->SetFrameFillColor(33);
   pad->Draw();
   pad->cd();
   pad->SetGrid();
   pad->Range(-0.5,-2,2.5,12);
   const Int_t n = 20;
   Float_t x[n], y[n];
   for (Int_t i=0;i<n;i++) {
     x[i] = i*0.1;
     y[i] = 10*sin(x[i]+0.2);
   }
   gr = new TGraph(n,x,y);
   gr->Draw("AC*");
   nut->cd();
}
예제 #22
0
void compareplots(){
  vector<TFile*> files; 
  files.push_back(new TFile("/storage/9/schweiger/analyseFxFx/pythia8/100kEvents/mergingscale_100/ttbar2JetLO8TeVMECut50GeVCTEQ6M-extracted.root"));   
  files.push_back(new TFile("/storage/9/schweiger/analyseFxFx/pythia8/100kEvents/mergingscale_100/ttbarMergedMS100GeVMCCut50GeV8TeVCTEQ6M-extracted.root"));

  



  vector<TString> names;
  names.push_back("ttbar+2 Jets, in LO");
  names.push_back("ttbar+1 Jet, FxFx-Merged");

  
  vector<TString> titles;
  titles.push_back("Gen-Jet p_{T}  with pos weights (GeV)");
  titles.push_back("Gen-Jet p_{T} with neg weights (GeV)");
  titles.push_back("Gen-Jet p_{T} (GeV)");
  titles.push_back("Gen_Jet #phi with pos. weights");
  titles.push_back("Gen_Jet #phi with neg. weights");
  titles.push_back("Gen_Jet #phi");
  titles.push_back("Gen Jet #theta with pos weights");
  titles.push_back("Gen Jet #theta with neg weights");
  titles.push_back("Gen Jet #theta");
  titles.push_back("Gen Jet Energy with pos weights (GeV) ");
  titles.push_back("Gen Jet Energy with neg weights (GeV)");
  titles.push_back("Gen Jet Energy (GeV)");
  titles.push_back("p_{T} of hardest Gen-Jet with pos weights (GeV)");
  titles.push_back("p_{T} of hardest Gen-Jet with neg weights (GeV)");
  titles.push_back("p_{T} of hardest Gen-Jet (GeV)");
  titles.push_back("p_{T} of 2nd hardest Gen-Jet with pos weights (GeV)");
  titles.push_back("p_{T} of 2nd hardest Gen-Jet with neg weights (GeV)");
  titles.push_back("p_{T} of 2nd hardest Gen-Jet (GeV)");
  titles.push_back("#eta of hardest Gen-Jets with pos weights");
  titles.push_back("#eta of hardest Gen-Jets with neg weights");
  titles.push_back("#eta of hardest Gen-Jets");
  titles.push_back("Number of Gen-Jets with pos. weights");
  titles.push_back("Number of Gen-Jets with neg. weights");
  titles.push_back("Number of Gen-Jets");


  TFile *vergleich = new TFile("vergleich_ttbar_Fx_vs_noFx.root","RECREATE");


// Show no statistics box
gStyle->SetOptStat(0);

TH1::SetDefaultSumw2();

// Main program part
  TIter nextkey(files.at(0)->GetListOfKeys());
  TKey *key;
  bool first=true;
  TCanvas* c = new TCanvas();
  c->Print("plots.pdf[");

  // Save also as pictures
  int pictureNumber = 0;

  int run = 0;
  while (key = (TKey*)nextkey()) {
    pictureNumber++;
    TString pictureName = TString::Format("%d.png",pictureNumber);


    vector<TH1F*> histos;
    histos.push_back((TH1F*)key->ReadObj());
    for(size_t i=1;i<files.size();i++){
      histos.push_back((TH1F*)files.at(i)->Get(histos.at(0)->GetName()));
    }
		       
    for(size_t i=0;i<histos.size();i++){
      if(i == 0){
	histos.at(i)->SetLineColor(kBlack);
      }
      if(i == 1){
	histos.at(i)->SetLineColor(kRed);
      }
      if(i == 2){
	histos.at(i)->SetLineColor(kBlue);
      }
      if(i == 3){
	histos.at(i)->SetLineColor(kGreen+2);
      }
      if(i == 4){
	histos.at(i)->SetLineColor(kMagenta-7);
      }
      if(i == 5){
	histos.at(i)->SetLineColor(kOrange+7);
      }
    }
    
    for(size_t i=0;i<histos.size();i++){
      histos.at(i)->Sumw2();
      histos.at(i)->Scale(1./histos.at(i)->Integral(),"width");
    }

// Set axis title
histos.at(0)->GetYaxis()->SetTitle("Normalized units"); 
std::string const histogramName = histos.at(0)->GetName();
histos.at(0)->GetXaxis()->SetLabelSize(0.06);
histos.at(0)->GetXaxis()->SetLabelOffset(0.006);
histos.at(0)->GetYaxis()->SetLabelSize(0.06);
histos.at(0)->GetYaxis()->SetLabelOffset(0.006);
histos.at(0)->GetXaxis()->SetTitleSize(0.06);
histos.at(0)->GetXaxis()->SetTitleOffset(1.1);
histos.at(0)->GetYaxis()->SetTitleSize(0.06);
histos.at(0)->GetYaxis()->SetTitleOffset(1.08);



histos.at(0)->GetXaxis()->SetTitle(titles.at(run));
run = run+1;
 if(run == (3*8)){
   run = 0;
 }
// If only two histograms per plot make a ratio plot
if(histos.size() == 2)
{

//create main pad  
                                                                                                                                                          
           TPad *mainPad = new TPad("","",0.0,0.3,1.0,1.0);
           mainPad->SetNumber(1);
           mainPad->SetBottomMargin(0.0);
           mainPad->SetRightMargin(0.04);
	   mainPad->SetLeftMargin(0.13);
           mainPad->Draw();

           //create ratio pad                                                                                                                                                           
           TPad *ratioPad = new TPad("","",0.0,0.0,1.0,0.3);
           ratioPad->SetTopMargin(0.0);
           ratioPad->SetBottomMargin(0.4);
           ratioPad->SetLeftMargin(0.13);                                                                                                                                             
           ratioPad->SetRightMargin(0.04);
           gStyle->SetOptTitle(0);
           ratioPad->SetFillColor(0);
           ratioPad->SetNumber(2);
           ratioPad->SetGridy();                                                                                                                                                      
           ratioPad->Draw();

// Draw both histograms first
c->cd(1);

histos.at(0)->Draw("histo E");
histos.at(1)->Draw("histo same E");

// Show legend and statistical tests in first pad
    for(size_t i=0;i<histos.size()-1;i=i+2){

      double ksresult = histos.at(i)->KolmogorovTest(histos.at(i+1));
      ksresult=floor(ksresult*1000+0.5)/1000;
      double chi2result =histos.at(i)->Chi2Test(histos.at(i+1),"WW");
      chi2result=floor(chi2result*1000+0.5)/1000;

      stringstream ss;
      ss << "     KS: " <<std::setprecision(3) << ksresult << " chi2: " <<std::setprecision(3) << chi2result << " Private Work"; 
      const char * ch = & ss.str().c_str();;
      TLatex * ks = new TLatex(0.1, 0.9-0.03*i, ch );
      ks->SetTextColor(histos.at(i)->GetLineColor());
      ks->SetNDC();
      ks->Draw("");      

    }

    TLegend* l = new TLegend(0.55,0.9,0.69,0.99);
    // Options for legend
    l->SetBorderSize(0);
    l->SetLineStyle(0);
    l->SetTextSize(0.049);
    l->SetFillStyle(0);
    for(size_t i=0;i<names.size();i++){
      l->AddEntry(histos.at(i),names.at(i),"L");
    }
    l->Draw("same");


// Clone histograms and draw ratio plot
c->cd(2);
 TH1F* ratioHisto = (TH1F*)histos.at(0)->Clone();
ratioHisto->Divide(histos.at(1));
ratioHisto->SetLineColor(kBlue);
ratioHisto->SetStats(false);
ratioHisto->GetYaxis()->SetTitle("Ratio #frac{noFxFx}{FxFx}");
// Same Size like in histogram
ratioHisto->SetLabelSize(histos.at(0)->GetLabelSize() * 0.7 / 0.3);
ratioHisto->SetTitleOffset((histos.at(0)->GetTitleOffset("Y") * 0.3 / 0.7), "Y");
ratioHisto->SetTitleSize((histos.at(0)->GetTitleSize("Y") * 0.7 / 0.3), "Y");
ratioHisto->SetTitleOffset((histos.at(0)->GetTitleOffset("X")), "X");
ratioHisto->SetTitleSize((histos.at(0)->GetTitleSize("X") * 0.7 / 0.3), "X");
// Use nicer range
ratioHisto->GetYaxis()->SetRangeUser(0, 2.2);
ratioHisto->GetYaxis()->SetNdivisions(503);
ratioHisto->GetYaxis()->SetLabelSize(0.06 * 0.7 / 0.3);
ratioHisto->Draw();
}
else
{

    histos.at(0)->Draw("histo E");
    for(size_t i=0;i<histos.size();i++){
      histos.at(i)->Draw("histo same E");
    }


    for(size_t i=0;i<histos.size()-1;i=i+2){

      double ksresult = histos.at(i)->KolmogorovTest(histos.at(i+1));
      ksresult=floor(ksresult*1000+0.5)/1000;
      double chi2result =histos.at(i)->Chi2Test(histos.at(i+1),"WW");
      chi2result=floor(chi2result*1000+0.5)/1000;

      stringstream ss;
      ss << "KS: " <<std::setprecision(3) << ksresult << " chi2: " <<std::setprecision(3) << chi2result; 
      const char * ch = & ss.str().c_str();;
      TText * ks = new TText(0.1, 0.9-0.03*i, ch );
      ks->SetTextColor(histos.at(i)->GetLineColor());
      ks->SetNDC();
      ks->Draw("");      

    }

    TLegend* l = new TLegend(0.65,0.5,0.9,0.7);
    l->SetBorderSize(0);
    l->SetLineStyle(0);
    //    l->SetTextSize(0.039);
    l->SetFillStyle(0);
    for(size_t i=0;i<names.size();i++){
      l->AddEntry(histos.at(i),names.at(i),"L");
    }
    l->Draw("same");
}

    c->Print("plots.pdf");
    c->SaveAs(pictureName);
    vergleich->WriteTObject(c);

}
  c->Print("plots.pdf]");


}
예제 #23
0
void CreateDataTemplates(double dX,int BRN_ORDER)
{
  gROOT->ForceStyle();
  RooMsgService::instance().setSilentMode(kTRUE);
  for(int i=0;i<2;i++) {
    RooMsgService::instance().setStreamStatus(i,kFALSE);
  }
  double XMIN = 80;
  double XMAX = 200;
  const int NSEL(2);
  const int NCAT[NSEL] = {4,3};
  const double MVA_BND[NSEL][NCAT[0]+1] = {{-0.6,0.0,0.7,0.84,1},{-0.1,0.4,0.8,1}};
  char name[1000];
  TString SELECTION[NSEL] = {"NOM","VBF"};
  TString SELTAG[NSEL]    = {"NOM","PRK"};
  TString MASS_VAR[NSEL]  = {"mbbReg[1]","mbbReg[2]"};

  TFile *fBKG  = TFile::Open("limit_BRN5+4_dX0p1_80-200_CAT0-6/output/bkg_shapes_workspace.root");
  RooWorkspace *wBkg = (RooWorkspace*)fBKG->Get("w");
  RooWorkspace *w = new RooWorkspace("w","workspace");
  //RooRealVar x(*(RooRealVar*)wBkg->var("mbbReg"));
  TTree *tr;
  TH1F *h,*hBlind;
  TCanvas *canFit[5]; 
  RooDataHist *roohist[5],*roohist_blind[5];

  TFile *fTransfer = TFile::Open("limit_BRN5+4_dX0p1_80-200_CAT0-6/output/transferFunctions.root");
  TF1 *transFunc;

  int counter(0);
  int NPAR = BRN_ORDER;

  for(int isel=0;isel<NSEL;isel++) {
    TFile *fDATA = TFile::Open("flat/Fit_data_sel"+SELECTION[isel]+".root");
    RooRealVar *brn[8];
    RooArgSet brn_params;
    if (isel == 1) {
      NPAR = 4;
    } 
    for(int ib=0;ib<=NPAR;ib++) {
      brn[ib] = new RooRealVar("b"+TString::Format("%d",ib)+"_sel"+SELECTION[isel],"b"+TString::Format("%d",ib)+"_sel"+SELECTION[isel],0.5,0,10.);
      brn_params.add(*brn[ib]);
    }
    for(int icat=0;icat<NCAT[isel];icat++) {
      RooRealVar x("mbbReg_"+TString::Format("CAT%d",counter),"mbbReg_"+TString::Format("CAT%d",counter),XMIN,XMAX);

      sprintf(name,"fitRatio_sel%s_CAT%d",SELTAG[isel].Data(),counter);
      transFunc = (TF1*)fTransfer->Get(name);
		transFunc->Print();
      // --- The error on the tranfer function parameters is shrinked because the correlations are ingored. 
      // --- Must be consistent with TransferFunctions.C
      float p0 = transFunc->GetParameter(0);
      float e0 = transFunc->GetParError(0);
      float p1 = transFunc->GetParameter(1);
      float e1 = transFunc->GetParError(1);
      float p2 = transFunc->GetParameter(2);
      float e2 = transFunc->GetParError(2);
      RooRealVar trans_p2(TString::Format("trans_p2_CAT%d",counter),TString::Format("trans_p2_CAT%d",counter),p2);
      RooRealVar trans_p1(TString::Format("trans_p1_CAT%d",counter),TString::Format("trans_p1_CAT%d",counter),p1);
      RooRealVar trans_p0(TString::Format("trans_p0_CAT%d",counter),TString::Format("trans_p0_CAT%d",counter),p0);
		printf("%.2f %.2f %.2f\n",p0,p1,p2);
      RooGenericPdf *transfer;
      if (isel == 0) {
        trans_p2.setError(0.5*e2);
        trans_p1.setError(0.5*e1);
        trans_p0.setError(0.5*e0);
        transfer = new RooGenericPdf(TString::Format("transfer_CAT%d",counter),"@2*@0+@1",RooArgList(x,trans_p0,trans_p1)); 
      }
      else {
        trans_p2.setError(0.05*e2);
        trans_p1.setError(0.05*e1);
        trans_p0.setError(0.05*e0);
        transfer = new RooGenericPdf(TString::Format("transfer_CAT%d",counter),"@3*@0*@0+@2*@0+@1",RooArgList(x,trans_p0,trans_p1,trans_p2));
      }
      trans_p2.setConstant(kTRUE);
      trans_p1.setConstant(kTRUE);
      trans_p0.setConstant(kTRUE);

		transfer->Print();
            
      sprintf(name,"FitData_sel%s_CAT%d",SELECTION[isel].Data(),icat);
      canFit[icat] = new TCanvas(name,name,900,600);
      canFit[icat]->cd(1)->SetBottomMargin(0.4);
      sprintf(name,"Hbb/events");
      tr = (TTree*)fDATA->Get(name); 
      sprintf(name,"hMbb_%s_CAT%d",SELECTION[isel].Data(),icat);
      int NBINS = (XMAX[isel][icat]-XMIN[isel][icat])/dX;
      
      h = new TH1F(name,name,NBINS,XMIN[isel][icat],XMAX[isel][icat]);

      sprintf(name,"hMbb_blind_%s_CAT%d",SELECTION[isel].Data(),icat);
      hBlind = new TH1F(name,name,NBINS,XMIN[isel][icat],XMAX[isel][icat]);

      sprintf(name,"mva%s>%1.2f && mva%s<=%1.2f",SELECTION[isel].Data(),MVA_BND[isel][icat],SELECTION[isel].Data(),MVA_BND[isel][icat+1]);
      TCut cut(name);
      sprintf(name,"mva%s>%1.2f && mva%s<=%1.2f && %s>100 && %s<150",SELECTION[isel].Data(),MVA_BND[isel][icat],SELECTION[isel].Data(),MVA_BND[isel][icat+1],MASS_VAR[isel].Data(),MASS_VAR[isel].Data());
      TCut cutBlind(name);
      tr->Draw(MASS_VAR[isel]+">>"+h->GetName(),cut); 
      tr->Draw(MASS_VAR[isel]+">>"+hBlind->GetName(),cutBlind); 
      sprintf(name,"yield_data_CAT%d",counter);
      RooRealVar *Yield = new RooRealVar(name,name,h->Integral());
      
      sprintf(name,"data_hist_CAT%d",counter);
      roohist[icat] = new RooDataHist(name,name,x,h);

      sprintf(name,"data_hist_blind_CAT%d",counter);
      roohist_blind[icat] = new RooDataHist(name,name,x,hBlind);
        
      RooAbsPdf *qcd_pdf;
      if (icat == 0) {
        for(int ib=0;ib<=NPAR;ib++) {
          brn[ib]->setConstant(kFALSE);
        }
        sprintf(name,"qcd_model_CAT%d",counter);
        RooBernstein *qcd_pdf_aux = new RooBernstein(name,name,x,brn_params);
        qcd_pdf = dynamic_cast<RooAbsPdf*> (qcd_pdf_aux);
      }
      else {
        for(int ib=0;ib<=NPAR;ib++) {
          brn[ib]->setConstant(kTRUE);
        }
        sprintf(name,"qcd_model_aux1_CAT%d",counter);
        RooBernstein *qcd_pdf_aux1 = new RooBernstein(name,name,x,brn_params);
        sprintf(name,"qcd_model_CAT%d",counter);
        RooProdPdf *qcd_pdf_aux2 = new RooProdPdf(name,name,RooArgSet(*transfer,*qcd_pdf_aux1));
        qcd_pdf = dynamic_cast<RooAbsPdf*> (qcd_pdf_aux2);
      } 

      sprintf(name,"Z_model_CAT%d",counter);
      RooAbsPdf *z_pdf = (RooAbsPdf*)wBkg->pdf(name);
      sprintf(name,"Top_model_CAT%d",counter);
      RooAbsPdf *top_pdf = (RooAbsPdf*)wBkg->pdf(name);

      sprintf(name,"yield_ZJets_CAT%d",counter);
      RooRealVar *nZ = (RooRealVar*)wBkg->var(name);
      sprintf(name,"yield_Top_CAT%d",counter);
      RooRealVar *nT = (RooRealVar*)wBkg->var(name);
      sprintf(name,"yield_QCD_CAT%d",counter);
      RooRealVar nQCD(name,name,1000,0,1e+10);
      nZ->setConstant(kTRUE);
      nT->setConstant(kTRUE);
    
      sprintf(name,"bkg_model_CAT%d",counter);
      RooAddPdf model(name,name,RooArgList(*z_pdf,*top_pdf,*qcd_pdf),RooArgList(*nZ,*nT,nQCD));
      
      RooFitResult *res = model.fitTo(*roohist[icat],RooFit::Save());
      res->Print();
      
      RooPlot* frame = x.frame();
      RooPlot* frame1 = x.frame();
      roohist[icat]->plotOn(frame);
      model.plotOn(frame,LineWidth(2));
      cout<<"chi2/ndof = "<<frame->chiSquare()<<endl;
      RooHist *hresid = frame->residHist(); 
      //model.plotOn(frame,RooFit::VisualizeError(*res,1,kFALSE),FillColor(kGray)MoveToBack());
      model.plotOn(frame,Components(*qcd_pdf),LineWidth(2),LineColor(kBlack),LineStyle(kDashed));
      model.plotOn(frame,Components(*z_pdf),LineWidth(2),LineColor(kBlue));
      model.plotOn(frame,Components(*top_pdf),LineWidth(2),LineColor(kGreen+1));
      frame->Draw(); 
      gPad->Update();
      TPad* pad = new TPad("pad", "pad", 0., 0., 1., 1.);
      pad->SetTopMargin(0.6);
      pad->SetFillColor(0);
      pad->SetFillStyle(0);
      pad->Draw();
      pad->cd(0);
      frame1->addPlotable(hresid,"p");
      frame1->Draw();

      for(int ib=0;ib<=NPAR;ib++) {
        brn[ib]->setConstant(kFALSE);
      }
      
      if (icat > 0) {
        trans_p2.setConstant(kFALSE);
        trans_p1.setConstant(kFALSE);
        trans_p0.setConstant(kFALSE);
      }
      if (isel == 0) {
        w->import(trans_p1);
        w->import(trans_p0);
      }
      else {
        w->import(trans_p2);
        w->import(trans_p1);
        w->import(trans_p0);
      }
      w->import(*roohist[icat]);
      w->import(*roohist_blind[icat]);
      w->import(model);
      w->import(*Yield);
      counter++; 
    }// category loop
  }// selection loop
  w->Print();
  w->writeToFile("data_shapes_workspace_"+TString::Format("BRN%d",BRN_ORDER)+".root");
}
예제 #24
0
파일: talk.C 프로젝트: bainbrid/usercode
// -----------------------------------------------------------------------------
//
void talk() {
  
  time_t start = TTimeStamp().GetSec();

  bool draw = true;
  bool debug = true;
  
  // Binning
  int xbins = 100;
  int ybins = 100;
  double xmin = 0.0;
  double xmax = 1.0;
  double ymin = 0.0;
  double ymax = 1.0;
  double xbin_centre = ( ( xmax - xmin ) / xbins ) / 2.;
  double ybin_centre = ( ( ymax - ymin ) / ybins ) / 2.;
  
  // AlphaT values
  const int nat = 1;
  double at[nat];
  for ( int ii = 0; ii < nat; ++ii ) { at[ii] = 0.55 + ii * 0.001; } 
  
  // HT regions
  const int nht = 3;
  double ht_min[nht] = { 250., 300., 350. };

  // Jet pT thresholds
  double pt1_min[nht] = { 71.4, 85.7, 100. };
  double pt2_min[nht] = { 71.4, 85.7, 100. };
  double pt3_min[nht] = { 35.7, 42.9., 50. };

  // x fractions
  double x1_min[nht];
  double x2_min[nht];
  double x3_max[nht];
  for ( int ii = 0; ii < nht; ++ii ) { x1_min[ii] = ( 2. * pt1_min[ii]) / ( ht_min[ii] + pt3_min[ii] ); }
  for ( int ii = 0; ii < nht; ++ii ) { x2_min[ii] = ( 2. * pt2_min[ii]) / ( ht_min[ii] + pt3_min[ii] ); }
  for ( int ii = 0; ii < nht; ++ii ) { x3_max[ii] = ( 2. * pt3_min[ii]) / ( ht_min[ii] + pt3_min[ii] ); }
  
  // Loop through bins 
  int loop = 0;
  int nloops = nht;
  for ( int iht = 0; iht < nht; ++iht ) {
    std::cout << "Completed " 
	      << 100.*float(loop)/float(nloops) 
	      << "%..." 
	      << std::endl; 
    loop++;
    
    // Labeling
    std::stringstream ss;
    ss << "HT" << int(ht_min[iht]);
	  
    // New canvas for plots
    TCanvas* c1 = 0;
    if (draw) c1 = new TCanvas( TString("Canvas"+ss.str()), "" );
	  
    // Pad for cross-section plot
    TPad* pad = 0;
    if (draw) pad = new TPad(TString("Pad"+ss.str()),"",0.,0.,1.,1.);
    if (pad) {
      pad->SetGrid();
      pad->Draw();
      pad->cd();
      pad->SetLogz();
    }
    TH1F* hr = 0;
    if (draw) hr = pad->DrawFrame(0.,0.,1.,1.);

    // Histo title
    if (hr) {
      std::stringstream sss;
      sss << "H_{T}=" << ht_min[iht]
	  << "(p_{T1},p_{T2},p_{T3})=" 
	  << pt1_min[iht] << ","
	  << pt2_min[iht] << ","
	  << pt3_min[iht] << ")"
	  << ", (x_{1},x_{2},x_{3})=" 
	  << x1_min[iht] << ","
	  << x2_min[iht] << ","
	  << x3_max[iht] << ")";
      hr->SetTitle( sss.str().c_str() );
      hr->GetXaxis()->SetTitle( "x_{2}" );
      hr->GetYaxis()->SetTitle( "x_{1}" );
    }
	  
    // Create 2D cross-section plot
    TH2D* his = 0;
    if (draw) his = new TH2D(TString("Histo"+ss.str()),"",
			     xbins,xmin,xmax,
			     ybins,ymin,ymax);
	  
    // Fill 2D cross-section plot
    for ( int xbin = 0; xbin < xbins; ++xbin ) { 
      for ( int ybin = 0; ybin < ybins; ++ybin ) { 
	double x2 = ( ( xmax - xmin ) / xbins ) * xbin + xmin;
	double x1 = ( ( ymax - ymin ) / ybins ) * ybin + ymin;
	double val = ( x1*x1 + x2*x2 ) / ( ( 1 - x1 ) * ( 1 - x2 ) ); 
	      
	if ( !constrain( x1, x2, x3 ) ) { continue; }
	      
	if ( x1 < x1_cut[ix1] ) { continue; }
	      
	double alpha_t =  x2 / ( 2 * sqrt(x1+x2-1) );
	if (his) his->Fill( x2+xbin_centre, x1+ybin_centre, val ); 
      }
    }
	  
    // Draw 2D cross-section plot
    gStyle->SetPalette(1);
    if (his) {
      his->SetMaximum( his->GetMaximum() );
      his->SetMinimum( his->GetMinimum(1.e-12) );
      his->Draw("COLZsame");
    }

    // Pad for AlphaT contours
    if (c1) c1->cd();
    TPad* overlay = 0;
    if (draw) overlay = new TPad(TString("Overlay"+ss.str()),"",0.,0.,1.,1.);
    if (overlay) {
      overlay->SetFillStyle(4000);
      overlay->SetFillColor(0);
      overlay->SetFrameFillStyle(4000);
      overlay->Draw();
      overlay->cd();
    }
    TH1F* hframe = 0;
    if (draw) overlay->DrawFrame(pad->GetUxmin(),
				 pad->GetUymin(),
				 pad->GetUxmax(),
				 pad->GetUymax());
	  
    // Graphs of AlphaT contours
    TMultiGraph* mg = 0;
    if (draw) {
      mg = new TMultiGraph();
      for ( Int_t iat = 0; iat < nat; iat++ ) {
	Double_t alpha_t = at[iat];
	const Int_t n_ = 100;
	Double_t x1_[n_];
	Double_t x2_[n_];
	for ( Int_t j = 0; j < 100; j++ ) {
	  x2_[j] = j*0.01;
	  Double_t temp = ( x2_[j] - 2. * alpha_t * alpha_t ) / ( 2. * alpha_t );
	  x1_[j] = temp * temp + 1 - alpha_t * alpha_t;
	}
	TGraph* gr = new TGraph(n_,x2_,x1_);
	mg->Add(gr,"l");
      }
      mg->Draw();
    }
	  
    if (c1) c1->cd();
    if (c1) c1->SaveAs(TString(ss.str()+".png"));
	  
  }

}
void makePlot(const TString& title, 
	      TGraphAsymmErrors* graph_Data_passed, TF1* fit_Data_passed, const TString& legendEntry_Data_passed,
	      TGraphAsymmErrors* graph_mcSum_passed, TF1* fit_mcSum_passed, const TString& legendEntry_mcSum_passed,
	      TGraphAsymmErrors* graph_Data_failed, TF1* fit_Data_failed, const TString& legendEntry_Data_failed,
	      TGraphAsymmErrors* graph_mcSum_failed, TF1* fit_mcSum_failed, const TString& legendEntry_mcSum_failed,
	      const TString& outputFileName)
{
  TCanvas* canvas = new TCanvas("canvas", "canvas", 800, 900);
  canvas->SetFillColor(10);
  canvas->SetBorderSize(2);
  canvas->SetLeftMargin(0.12);
  canvas->SetBottomMargin(0.12);

  //TPad* topPad = new TPad("topPad", "topPad", 0.00, 0.35, 1.00, 1.00);
  TPad* topPad = new TPad("topPad", "topPad", 0.00, 1.00 - 0.65*(0.93/0.84), 1.00, 1.00);
  topPad->SetFillColor(10);
  topPad->SetTopMargin(0.04);
  topPad->SetLeftMargin(0.15);
  //topPad->SetBottomMargin(0.03);
  topPad->SetBottomMargin(0.12);
  topPad->SetRightMargin(0.05);
  topPad->SetGridx();
  topPad->SetGridy();

  canvas->cd();
  topPad->Draw();
  topPad->cd();

  TH1* dummyHistogram_top = new TH1D("dummyHistogram_top", "dummyHistogram_top", 10, 0., 100.);
  dummyHistogram_top->SetTitle("");
  dummyHistogram_top->SetStats(false);
  dummyHistogram_top->SetMaximum(1.2);
  dummyHistogram_top->SetMinimum(0.);
  
  TAxis* xAxis_top = dummyHistogram_top->GetXaxis();
  xAxis_top->SetTitle("calo-E_{T}^{miss} / GeV");
  xAxis_top->SetTitleOffset(1.15);
  //xAxis_top->SetLabelColor(10);
  //xAxis_top->SetTitleColor(10);

  TAxis* yAxis_top = dummyHistogram_top->GetYaxis();
  yAxis_top->SetTitle("#varepsilon");
  yAxis_top->SetTitleOffset(1.2);

  dummyHistogram_top->Draw();
  //dummyHistogram_top->Draw("axis");

  //graph_Data_passed->SetLineColor(4);
  //graph_Data_passed->SetMarkerColor(4);
  //graph_Data_passed->SetMarkerStyle(20);
  //graph_Data_passed->Draw("p");

  //fit_Data_passed->SetLineColor(graph_Data_passed->GetLineColor());
  //fit_Data_passed->SetLineWidth(2);
  //fit_Data_passed->Draw("same");

  graph_mcSum_passed->SetLineColor(7);
  graph_mcSum_passed->SetMarkerColor(7);
  graph_mcSum_passed->SetMarkerStyle(24);
  graph_mcSum_passed->Draw("p");

  fit_mcSum_passed->SetLineColor(graph_mcSum_passed->GetLineColor());
  fit_mcSum_passed->SetLineWidth(2);
  fit_mcSum_passed->Draw("same");

  graph_Data_failed->SetLineColor(2);
  graph_Data_failed->SetMarkerColor(2);
  graph_Data_failed->SetMarkerStyle(21);
  //graph_Data_failed->Draw("p");

  fit_Data_failed->SetLineColor(graph_Data_failed->GetLineColor());
  fit_Data_failed->SetLineWidth(2);
  //fit_Data_failed->Draw("same");
 
  graph_mcSum_failed->SetLineColor(6);
  graph_mcSum_failed->SetMarkerColor(6);
  graph_mcSum_failed->SetMarkerStyle(25);
  graph_mcSum_failed->Draw("p");

  fit_mcSum_failed->SetLineColor(graph_mcSum_failed->GetLineColor());
  fit_mcSum_failed->SetLineWidth(2);
  fit_mcSum_failed->Draw("same");
 
  TLegend* legend = new TLegend(0.61, 0.16, 0.89, 0.47, "", "brNDC"); 
  legend->SetBorderSize(0);
  legend->SetFillColor(0);
  //legend->AddEntry(graph_Data_passed,  legendEntry_Data_passed.Data(),  "p");
  legend->AddEntry(graph_mcSum_passed, legendEntry_mcSum_passed.Data(), "p");
  //legend->AddEntry(graph_Data_failed,  legendEntry_Data_failed.Data(),  "p");
  legend->AddEntry(graph_mcSum_failed, legendEntry_mcSum_failed.Data(), "p");
  legend->Draw();

  TPaveText* label = 0;
  if ( title.Length() > 0 ) {
    label = new TPaveText(0.175, 0.89, 0.48, 0.94, "NDC");
    label->AddText(title.Data());
    label->SetTextAlign(13);
    label->SetTextSize(0.045);
    label->SetFillStyle(0);
    label->SetBorderSize(0);
    label->Draw();
  }

  TPad* bottomPad = new TPad("bottomPad", "bottomPad", 0.00, 0.00, 1.00, 0.35);
  bottomPad->SetFillColor(10);
  bottomPad->SetTopMargin(0.02);
  bottomPad->SetLeftMargin(0.15);
  bottomPad->SetBottomMargin(0.24);
  bottomPad->SetRightMargin(0.05);
  bottomPad->SetGridx();
  bottomPad->SetGridy();

  canvas->cd();
  bottomPad->Draw();
  bottomPad->cd();

  TH1* dummyHistogram_bottom = new TH1D("dummyHistogram_bottom", "dummyHistogram_bottom", 10, 0., 100.);
  
  dummyHistogram_bottom->SetMinimum(-1.0);
  dummyHistogram_bottom->SetMaximum(+1.0);

  TAxis* xAxis_bottom = dummyHistogram_bottom->GetXaxis();
  xAxis_bottom->SetTitle("calo-E_{T}^{miss} / GeV");
  xAxis_bottom->SetTitleOffset(1.20);
  xAxis_bottom->SetLabelColor(1);
  xAxis_bottom->SetTitleColor(1);
  xAxis_bottom->SetTitleSize(0.08);
  xAxis_bottom->SetLabelOffset(0.02);
  xAxis_bottom->SetLabelSize(0.08);
  xAxis_bottom->SetTickLength(0.055);

  TAxis* yAxis_bottom = dummyHistogram_bottom->GetYaxis();
  yAxis_bottom->SetTitle("#frac{Data-Simulation}{Simulation}");
  yAxis_bottom->SetTitleOffset(0.85);
  yAxis_bottom->SetNdivisions(505);
  yAxis_bottom->CenterTitle();
  yAxis_bottom->SetTitleSize(0.08);
  yAxis_bottom->SetLabelSize(0.08);
  yAxis_bottom->SetTickLength(0.04);

  dummyHistogram_bottom->SetTitle("");
  dummyHistogram_bottom->SetStats(false);
  dummyHistogram_bottom->Draw("axis");
 
  TGraphAsymmErrors* graph_Data_div_mc_passed = makeGraph_data_div_mc(graph_Data_passed, graph_mcSum_passed);
  graph_Data_div_mc_passed->SetLineColor(graph_Data_passed->GetLineColor());
  graph_Data_div_mc_passed->SetMarkerColor(graph_Data_passed->GetMarkerColor());
  graph_Data_div_mc_passed->SetMarkerStyle(graph_Data_passed->GetMarkerStyle());
  graph_Data_div_mc_passed->Draw("p");
  
  TF1* fit_Data_div_mc_passed = 
    new TF1("fit_Data_div_mc_passed", &integralCrystalBall_f_div_f, 
	    fit_mcSum_passed->GetMinimumX(), fit_mcSum_passed->GetMaximumX(), 2*fit_mcSum_passed->GetNpar());
  for ( int iPar = 0; iPar < fit_mcSum_passed->GetNpar(); ++iPar ) {
    fit_Data_div_mc_passed->SetParameter(iPar, fit_Data_passed->GetParameter(iPar));
    fit_Data_div_mc_passed->SetParameter(iPar + fit_mcSum_passed->GetNpar(), fit_mcSum_passed->GetParameter(iPar));
  }
  fit_Data_div_mc_passed->SetLineColor(graph_Data_div_mc_passed->GetLineColor());
  fit_Data_div_mc_passed->SetLineWidth(2);
  fit_Data_div_mc_passed->Draw("same");

  TGraphAsymmErrors* graph_Data_div_mc_failed = makeGraph_data_div_mc(graph_Data_failed, graph_mcSum_failed);
  graph_Data_div_mc_failed->SetLineColor(graph_Data_failed->GetLineColor());
  graph_Data_div_mc_failed->SetMarkerColor(graph_Data_failed->GetMarkerColor());
  graph_Data_div_mc_failed->SetMarkerStyle(graph_Data_failed->GetMarkerStyle());
  graph_Data_div_mc_failed->Draw("p");
  
  TF1* fit_Data_div_mc_failed = 
    new TF1("fit_Data_div_mc_failed", &integralCrystalBall_f_div_f, 
	    fit_mcSum_failed->GetMinimumX(), fit_mcSum_failed->GetMaximumX(), 2*fit_mcSum_failed->GetNpar());
  for ( int iPar = 0; iPar < fit_mcSum_failed->GetNpar(); ++iPar ) {
    fit_Data_div_mc_failed->SetParameter(iPar, fit_Data_failed->GetParameter(iPar));
    fit_Data_div_mc_failed->SetParameter(iPar + fit_mcSum_failed->GetNpar(), fit_mcSum_failed->GetParameter(iPar));
  }
  fit_Data_div_mc_failed->SetLineColor(graph_Data_div_mc_failed->GetLineColor());
  fit_Data_div_mc_failed->SetLineWidth(2);
  fit_Data_div_mc_failed->Draw("same");

  topPad->RedrawAxis();
  bottomPad->RedrawAxis();

  canvas->Update();
  size_t idx = outputFileName.Last('.');
  std::string outputFileName_plot = std::string(outputFileName.Data(), 0, idx);
  if ( idx != std::string::npos ) canvas->Print(std::string(outputFileName_plot).append(std::string(outputFileName.Data(), idx)).data());
  //canvas->Print(std::string(outputFileName_plot).append(".png").data());
  //canvas->Print(std::string(outputFileName_plot).append(".pdf").data());
  topPad->Print(std::string(outputFileName_plot).append(".png").data());
  topPad->Print(std::string(outputFileName_plot).append(".pdf").data());

  delete legend;
  delete label;
  delete dummyHistogram_top;
  delete topPad;
  delete dummyHistogram_bottom;
  delete bottomPad;
  delete canvas;
}
예제 #26
0
void SingleAnalysis::DrawGraphs()
{
	std::cout << "Drawing graphs" << std::endl;

	// special case for erec and deviation
	m_pERecCanvas->cd();

	TPad *pERecPad = new TPad("ERecPad", "ERecPad", 0.02, 0.37, 0.95, 0.99);
	pERecPad->Draw();
	pERecPad->cd();
	pERecPad->Range(-19.23077,0.01,96.15385,1428.571);
	pERecPad->SetFillColor(0);
	pERecPad->SetBorderMode(0);
	pERecPad->SetBorderSize(2);
	pERecPad->SetTickx(1);
	pERecPad->SetTicky(1);
	pERecPad->SetLeftMargin(0.1666667);
	pERecPad->SetRightMargin(0.01);
	pERecPad->SetTopMargin(0.02);
	pERecPad->SetBottomMargin(0.0);
	pERecPad->SetFrameLineWidth(1);
	pERecPad->SetFrameBorderMode(0);

	m_canvasMultiGraphMap[E_REC].second->Draw("ap");
	this->PostDrawMultiGraph(E_REC, m_canvasMultiGraphMap[E_REC].second);

	TLegend *pLegend = pERecPad->BuildLegend();
	pLegend->SetBorderSize(0);
	pLegend->SetLineColor(0);
	pLegend->SetLineStyle(0);
	pLegend->SetLineWidth(1);
	pLegend->SetFillColor(0);
	pLegend->SetFillStyle(0);
	pLegend->SetTextSize(0.04);

	pERecPad->Modified();

	m_pERecCanvas->cd();

	TPad *pERecDeviationPad = new TPad("ERecDeviationPad", "ERecDeviationPad", 0.02, 0, 0.95, 0.37);
	pERecDeviationPad->Draw();
	pERecDeviationPad->cd();
	pERecDeviationPad->Range(-19.23077,-0.3993507,96.15385,0.25);
	pERecDeviationPad->SetFillColor(0);
	pERecDeviationPad->SetBorderMode(0);
	pERecDeviationPad->SetBorderSize(2);
	pERecDeviationPad->SetTickx(1);
	pERecDeviationPad->SetTicky(1);
	pERecDeviationPad->SetLeftMargin(0.1666667);
	pERecDeviationPad->SetRightMargin(0.01);
	pERecDeviationPad->SetTopMargin(0);
	pERecDeviationPad->SetBottomMargin(0.23);
	pERecDeviationPad->SetFrameLineWidth(1);
	pERecDeviationPad->SetFrameBorderMode(0);

	m_canvasMultiGraphMap[E_REC_DEVIATION].second->Draw("ap");

	TF1 *pLin = new TF1("lin", "0", 0, 90);
	pLin->SetLineColor(kBlack);
	pLin->SetLineWidth(1);
	pLin->SetLineStyle(2);
	pLin->Draw("same");

	this->PostDrawMultiGraph(E_REC_DEVIATION, m_canvasMultiGraphMap[E_REC_DEVIATION].second);

	pERecDeviationPad->Modified();

	for(CanvasMultiGraphMap::iterator graphIter = m_canvasMultiGraphMap.begin(), graphEndIter = m_canvasMultiGraphMap.end() ;
			graphEndIter != graphIter ; ++graphIter)
	{
		if(graphIter->first == E_REC || graphIter->first == E_REC_DEVIATION)
			continue;

		graphIter->second.first->cd();

		graphIter->second.second->Draw("ap");
		this->PostDrawMultiGraph(graphIter->first, graphIter->second.second);

		TLegend *pLegend = graphIter->second.first->BuildLegend();
		pLegend->SetBorderSize(0);
		pLegend->SetLineColor(0);
		pLegend->SetLineStyle(1);
		pLegend->SetLineWidth(1);
		pLegend->SetFillColor(0);
		pLegend->SetFillStyle(0);
		pLegend->SetTextSize(0.04);
	}
}
예제 #27
0
void RDK2AnalysisPlotter::makeEPGPlot(CoDet detType)
{
     gROOT->cd();
    TCanvas* theCanvas;
    TPad* mainPad;
    TPad* titlePad;
    TPad* gEPad;
    TPad* detPad;
    TPad* gEPadSubs[3];


    int numTitleLines=getTitleBoxLines( detType);
    int canvasNumPixelsYPlot=600;
    int canvasNumPixelsYPlots=2*canvasNumPixelsYPlot;
    int canvasNumPixelsYTitle=40*numTitleLines;
    int canvasNumPixelsY=canvasNumPixelsYPlots+canvasNumPixelsYTitle;

    theCanvas = new TCanvas("EPGExpMCAnalysisComparisonPlot","EPGExpMCAnalysisComparisonPlot",10,10,1200,canvasNumPixelsY);
     mainPad=(TPad*) theCanvas->GetPad(0);


    double ylow,yhigh;

    yhigh=1;
    ylow=1.-canvasNumPixelsYTitle/(double)canvasNumPixelsY;
    titlePad=new TPad("titlePad", "titlePad", 0., ylow, 1., yhigh, -1, 1, 1);

    yhigh=ylow;
    ylow=ylow-canvasNumPixelsYPlot/(double)canvasNumPixelsY;
    gEPad=new TPad("gEPad", "gEPad", 0., ylow, 1., yhigh, -1, 1, 1);

    yhigh=ylow;
    ylow=0;
    detPad=new TPad("detPad", "detPad", 0., ylow, 1., yhigh, -1, 1, 1);

    titlePad->Draw();
    gEPad->Draw();
    detPad->Draw();



//    titlePad=(TPad*) theCanvas->GetPad(1);
//    gEPad=(TPad*) theCanvas->GetPad(2);
//    detPad=(TPad*) theCanvas->GetPad(3);
//    egTPad=(TPad*) theCanvas->GetPad(4);

    titlePad->SetMargin(0.05,0.0,0.0,0.0);
    gEPad->SetMargin(0.05,0.0,0.0,0.05);

    if(numExp>1 && numMC>1)
    {
        gEPad->Divide(2);

        gEPadSubs[0]=(TPad*) gEPad->GetPad(1);

        TPad* tempPad;
        tempPad=(TPad*) gEPad->GetPad(2);
        tempPad->Divide(1,2);
        gEPadSubs[1]=(TPad*) tempPad->GetPad(1);
        gEPadSubs[2]=(TPad*) tempPad->GetPad(2);


        TPad* allBasePads[5]={titlePad,gEPadSubs[0],gEPadSubs[1],gEPadSubs[2],detPad};
         for (int i = 1;i< 5;i++)
        {
            allBasePads[i]->SetGrid(1,1);
            allBasePads[i]->SetTickx(1);
            allBasePads[i]->SetTicky(1);
        }

        gEPadSubs[2]->SetLogx();

        gEPadSubs[0]->SetMargin(0.15,0.1,.1,0.1);
        gEPadSubs[1]->SetMargin(0.1,0.1,.1,0.1);
        gEPadSubs[2]->SetMargin(0.1,0.1,.1,0.1);

        //Plot gE

        gEPadSubs[0]->cd(); drawPlot(detType, PLOTVAR_GE,PLOT_COMP);
        gEPadSubs[1]->cd(); drawPlot(detType, PLOTVAR_GE,PLOT_RESID);
        gEPadSubs[2]->cd(); drawPlot(detType, PLOTVAR_GEVAR,PLOT_NORMRESID);

    }
    else
    {

        TPad* allBasePads[3]={titlePad,gEPad,detPad};
        for (int i = 1;i< 3;i++)
        {
            allBasePads[i]->SetGrid(1,1);
            allBasePads[i]->SetTickx(1);
            allBasePads[i]->SetTicky(1);
        }

        gEPad->SetMargin(0.13,0.1,.1,0.1);


        //Plot gE

        gEPad->cd(); drawPlot(detType, PLOTVAR_GE,PLOT_COMP);
    }
    mainPad->SetFillColor(kGray);

    ///Make Title box
    titlePad->cd();
    titlePad->SetFillColor(kGray);
    TPaveText* titleBox = makeTitleBox( detType);
    titleBox->Draw();

    detPad->SetMargin(0.1,0.05,.1,0.1);

    //Plot det
     detPad->cd(); drawPlot(detType, PLOTVAR_GE,PLOT_DETS);

    TString coTypeString;
    if(detType==DET_EP)
    {
        coTypeString="EP";
    }
    else if(detType==DET_EPG)
    {
        coTypeString="EPG";
    }
    else if(detType==DET_EPBG)
    {
        coTypeString="EPBG";
    }
    TString imagePath=GRAPHS_DIR;
    imagePath+="layouts/PlotLayout";
    if(numMC) imagePath+="_MC";
    for (int i = 0;i< numMC;i++)
    {
        imagePath+=TString("_")+mc[i]->GetName();
    }
    if(numExp) imagePath+="_Exp";
    for (int i = 0;i< numExp;i++)
    {
        imagePath+=TString("_")+exp[i]->GetName();
    }

    imagePath+="_"+coTypeString+"_EPGPlots.pdf";
    theCanvas->SaveAs(imagePath);

    delete theCanvas;
    clearPlotHists();

}
예제 #28
0
파일: test.C 프로젝트: bainbrid/usercode
// -----------------------------------------------------------------------------
//
void test() {

  time_t start = TTimeStamp().GetSec();

  set_plot_style();

  bool draw = true;
  //bool debug = true;

  // Define analysis configuration
  PSet ps;
  defaultPSet(ps);

  // Response plots
  if (false) {
    //xSectDistr(ps);
    responseProfile();
    return;
  }
  
  // Print configuration
  std::stringstream ss;
  printPSet(ps,ss);
  std::cout << ss.str() << std::endl;
  
  // Params to store
  DoubleVV ratio, ratio_errh, ratio_errl, pass, pass_err, fail, fail_err;
  IntV length;
  clear( ratio, ratio_errh, ratio_errl, pass, pass_err, fail, fail_err, length );
  init( ps, ratio, ratio_errh, ratio_errl, pass, pass_err, fail, fail_err, length );
  
  // Loop through Meff bins 
  int loop = 0;
  int nloops = ps.nmeff;
  for ( int imeff = 0; imeff < ps.nmeff; ++imeff ) {

    // Generate numbers in (x1,x2) plane
    DoubleVV dalitz;
    generateTruth( ps, imeff, dalitz, true );

    // Integrate across dalitz plane
    integrate( ps, imeff, dalitz, ratio, ratio_errh, ratio_errl, 
	       pass, pass_err, fail, fail_err, length );
    
    // Labeling
    std::stringstream ss;
    ss << "Meff" << int( ps.meff_bins[imeff] );
    
    // New canvas for plots
    TCanvas* c1 = 0;
    if (draw) c1 = new TCanvas( TString("Canvas"+ss.str()), "" );
    
    // Pad for cross-section plot
    TPad* pad = 0;
    if (draw) pad = new TPad(TString("Pad"+ss.str()),"",0.,0.,1.,1.);
    if (pad) {
      pad->SetGrid();
      pad->Draw();
      pad->cd();
      pad->SetLogz();
    }
    TH1F* hr = 0;
    if (draw) hr = pad->DrawFrame(ps.min,ps.min,ps.max,ps.max);
    
    // Histo title
    if (hr) {
      std::stringstream sss;
      sss << "M_{eff}=" << ps.meff_bins[imeff] << " GeV"
	  << ", p_{T1}=" << dr(ps.pt1_bins[imeff],1) << " GeV"
	  << ", p_{T2}=" << dr(ps.pt2_bins[imeff],1) << " GeV"
	  << ", p_{T3}=" << dr(ps.pt3_bins[imeff],1) << " GeV";
      hr->SetTitle( sss.str().c_str() );
      hr->GetXaxis()->SetTitle( "x_{2}" );
      hr->GetYaxis()->SetTitle( "x_{1}" );
    }
    
    // Create 2D cross-section plot
    TH2D* his = 0;
    if (draw) his = new TH2D(TString("Histo"+ss.str()),"",
			     ps.nbins,ps.min,ps.max,
			     ps.nbins,ps.min,ps.max);
    
    //double x3 = ( 2. * ps.pt3_bins[imeff] ) / ( ps.meff_bins[imeff] + ps.pt3_bins[imeff] );
    
    // Fill 2D cross-section plot
    for ( int x2_bin = 0; x2_bin < ps.nbins; ++x2_bin ) { 
      for ( int x1_bin = 0; x1_bin < ps.nbins; ++x1_bin ) { 
// 	std::cout << " Fill:"
// 		  << " x2_bin: " << x2_bin 
// 		  << " x2: " << val(x2_bin,nbins) 
// 		  << " x1_bin: " << x1_bin 
// 		  << " x1: " << val(x1_bin,nbins) 
// 		  << " val: " << dalitz[x2_bin][x1_bin]
// 		  << std::endl;
	if (his) his->Fill( val(x2_bin,ps)+ps.width/2.,
			    val(x1_bin,ps)+ps.width/2.,
			    dalitz[x2_bin][x1_bin] ); 
      }
    }
    
    // Draw 2D cross-section plot
    gStyle->SetPalette(1);
    if (his) {
      //his->SetMaximum( his->GetMaximum()*10. );
      //his->SetMinimum( his->GetMinimum(1.e-12)*0.1 );
//       his->SetMaximum( 1.e9 );
//       his->SetMinimum( 1.e0 );
      his->Draw("COLZsame");
    }
    
    // Pad for AlphaT contours
    if (c1) c1->cd();
    TPad* overlay = 0;
    if (draw) overlay = new TPad(TString("Overlay"+ss.str()),"",0.,0.,1.,1.);
    if (overlay) {
      overlay->SetFillStyle(4000);
      overlay->SetFillColor(0);
      overlay->SetFrameFillStyle(4000);
      overlay->Draw();
      overlay->cd();
    }
    //TH1F* hframe = 0;
    if (draw) overlay->DrawFrame(pad->GetUxmin(),
				 pad->GetUymin(),
				 pad->GetUxmax(),
				 pad->GetUymax());
	  
    // Graphs of AlphaT contours
    TMultiGraph* mg = 0;
    if (draw) {
      mg = new TMultiGraph();
      for ( Int_t icut = 0; icut < (int)ps.cutValues.size(); icut++ ) {
	Double_t alpha_t = ps.cutValues[icut];
	const Int_t n = ps.nbins;
	DoubleV x1(n,0.);
	DoubleV x2(n,0.);
	for ( Int_t x2_bin = 0; x2_bin < ps.nbins; x2_bin++ ) {
	  x2[x2_bin] = x2_bin * ps.width;
	  x1[x2_bin] = cutAlgoInverse(ps.cutValues[icut],x2[x2_bin],ALGO_TYPE);
	}
	TGraph* gr = new TGraph(n,&x2.front(),&x1.front());
	mg->Add(gr,"l");
      }
      mg->Draw();
    }
	  
    if (c1) c1->cd();
    if (c1) c1->SaveAs(TString(ss.str()+".png"));
    if (c1) c1->SaveAs(TString(ss.str()+".pdf"));
    if (c1) c1->SaveAs(TString(ss.str()+".C"));

  }

  // Canvas for ratio vs Meff
  if (false) {
    
    TCanvas* c2 = new TCanvas( "c2", "" );
    c2->SetRightMargin(0.2);
    c2->SetLogy();
    c2->cd();
    TMultiGraph* mg2 = new TMultiGraph();

    DoubleV err( ps.nmeff, 0. );
    for ( Int_t icut = 0; icut < (int)ps.cutValues.size(); icut++ ) {
      if ( length[icut] == 0 ) { continue; }
//       TGraphAsymmErrors* gr = new TGraphAsymmErrors( length[icut], 
//  						     &ps.meff_bins.front(), 
//  						     &err.front(),
//  						     &err.front(),
//  						     &ratio[icut].front(),
//  						     &ratio_errl[icut].front(),
//  						     &ratio_errh[icut].front() );
      TGraph* gr = new TGraphAsymmErrors( length[icut], 
 					  &ps.meff_bins.front(), 
 					  &ratio[icut].front() );
      std::stringstream ss;
      ss << "a_{T}=" << ps.cutValues[icut];
// 	 << " Meff=" << meff_bins[imeff]
// 	 << ", p_{T3}=" << pt3_bins[imeff];
      mg2->Add(gr,"lp");
      gr->SetTitle(TString(ss.str()));
      gr->SetLineColor(2+icut);
      gr->SetLineWidth(2);
      gr->SetMarkerStyle(20+icut);
      gr->SetMarkerColor(2+icut);
      gr->SetMarkerSize(1.5);
    }
    
    mg2->Draw("a");
    mg2->GetYaxis()->SetRangeUser(1.e-6,1.e0);
    c2->Update();
    c2->BuildLegend(0.81,0.1,0.99,0.9);
    
    // Save canvases
    c2->cd();
    c2->SaveAs("RatioVsMeff.png");
    c2->SaveAs("RatioVsMeff.pdf");
    c2->SaveAs("RatioVsMeff.C");
    
  }
  
  time_t stop = TTimeStamp().GetSec();
  std::cout << " Time taken: " << stop - start <<  " seconds" << std::endl;

}
예제 #29
0
void showHistograms(double canvasSizeX, double canvasSizeY,
		    TH1* histogram_ref, const std::string& legendEntry_ref, double integral_ref,
		    TH1* histogram2, const std::string& legendEntry2, double integral2,
		    TH1* histogram3, const std::string& legendEntry3, double integral3,
		    TH1* histogram4, const std::string& legendEntry4, double integral4,
		    TH1* histogram5, const std::string& legendEntry5, double integral5,
		    TH1* histogram6, const std::string& legendEntry6, double integral6,
		    const std::string& xAxisTitle, double xAxisOffset,
		    bool useLogScale, double yMin, double yMax, const std::string& yAxisTitle, double yAxisOffset,
		    double legendX0, double legendY0, 
		    const std::string& outputFileName)
{
  if ( !(histogram_ref && histogram2) ) return;

  TCanvas* canvas = new TCanvas("canvas", "canvas", canvasSizeX, canvasSizeY);
  canvas->SetFillColor(10);
  canvas->SetBorderSize(2);
  canvas->SetLeftMargin(0.12);
  canvas->SetBottomMargin(0.12);

  TPad* topPad = new TPad("topPad", "topPad", 0.00, 0.35, 1.00, 1.00);
  topPad->SetFillColor(10);
  topPad->SetTopMargin(0.04);
  topPad->SetLeftMargin(0.15);
  topPad->SetBottomMargin(0.03);
  topPad->SetRightMargin(0.05);
  topPad->SetLogy(useLogScale);

  TPad* bottomPad = new TPad("bottomPad", "bottomPad", 0.00, 0.00, 1.00, 0.35);
  bottomPad->SetFillColor(10);
  bottomPad->SetTopMargin(0.02);
  bottomPad->SetLeftMargin(0.15);
  bottomPad->SetBottomMargin(0.24);
  bottomPad->SetRightMargin(0.05);
  bottomPad->SetLogy(false);

  canvas->cd();
  topPad->Draw();
  topPad->cd();

  //int colors[6] = { kBlack, kGreen - 6, kBlue - 7,  kMagenta - 7, kCyan - 6, kRed - 6 };
  int colors[6] = { kBlack, kRed, kBlue - 7,  kMagenta - 7, kCyan - 6, kRed - 6 };
  int markerStyles[6] = { 24, 25, 20, 21, 22, 23 };
  int markerSizes[6] = { 1, 1, 1, 1, 1, 1 };

  TLegend* legend = new TLegend(legendX0, legendY0, legendX0 + 0.61, legendY0 + 0.21, "", "brNDC"); 
  legend->SetBorderSize(0);
  legend->SetFillColor(0);

  histogram_ref->SetTitle("");
  histogram_ref->SetStats(false);
  histogram_ref->SetMinimum(yMin);
  histogram_ref->SetMaximum(yMax);
  histogram_ref->SetLineColor(colors[0]);
  histogram_ref->SetLineWidth(2);
  histogram_ref->SetMarkerColor(colors[0]);
  histogram_ref->SetMarkerStyle(markerStyles[0]);
  histogram_ref->SetMarkerSize(markerSizes[0]);
  histogram_ref->Draw("e1p");
  //if ( integral_ref >= 0. ) legend->AddEntry(histogram_ref, Form("%s: %1.2f", legendEntry_ref.data(), integral_ref), "p");
  //else legend->AddEntry(histogram_ref, legendEntry_ref.data(), "p");
  legend->AddEntry(histogram_ref, Form("%s: %1.2f", legendEntry_ref.data(), integral_ref), "p");

  TAxis* xAxis_top = histogram_ref->GetXaxis();
  xAxis_top->SetTitle(xAxisTitle.data());
  xAxis_top->SetTitleOffset(xAxisOffset);
  xAxis_top->SetLabelColor(10);
  xAxis_top->SetTitleColor(10);

  TAxis* yAxis_top = histogram_ref->GetYaxis();
  yAxis_top->SetTitle(yAxisTitle.data());
  yAxis_top->SetTitleOffset(yAxisOffset);

  if ( histogram2 ) {
    histogram2->SetLineColor(colors[1]);
    histogram2->SetLineWidth(2);
    histogram2->SetMarkerColor(colors[1]);
    histogram2->SetMarkerStyle(markerStyles[1]);
    histogram2->SetMarkerSize(markerSizes[1]);
    histogram2->Draw("e1psame");
    //if ( integral2 >= 0. ) legend->AddEntry(histogram2, Form("%s: %1.2f", legendEntry2.data(), integral2), "p");
    //else legend->AddEntry(histogram2, legendEntry2.data(), "p");
    legend->AddEntry(histogram2, Form("%s: %1.2f", legendEntry2.data(), integral2), "p");
  }

  if ( histogram3 ) {
    histogram3->SetLineColor(colors[2]);
    histogram3->SetLineWidth(2);
    histogram3->SetMarkerColor(colors[2]);
    histogram3->SetMarkerStyle(markerStyles[2]);
    histogram3->SetMarkerSize(markerSizes[2]);
    histogram3->Draw("e1psame");
    //if ( integral3 >= 0. ) legend->AddEntry(histogram3, Form("%s: %1.2f", legendEntry3.data(), integral3), "p");
    //else legend->AddEntry(histogram3, legendEntry3.data(), "p");
    legend->AddEntry(histogram3, Form("%s: %1.2f", legendEntry3.data(), integral3), "p");
  }

  if ( histogram4 ) {
    histogram4->SetLineColor(colors[3]);
    histogram4->SetLineWidth(2);
    histogram4->SetMarkerColor(colors[3]);
    histogram4->SetMarkerStyle(markerStyles[3]);
    histogram4->SetMarkerSize(markerSizes[3]);
    histogram4->Draw("e1psame");
    if ( integral4 >= 0. ) legend->AddEntry(histogram4, Form("%s: %1.2f", legendEntry4.data(), integral4), "p");
    else legend->AddEntry(histogram4, legendEntry4.data(), "p");
  }

  if ( histogram5 ) {
    histogram5->SetLineColor(colors[4]);
    histogram5->SetLineWidth(2);
    histogram5->SetMarkerColor(colors[4]);
    histogram5->SetMarkerStyle(markerStyles[4]);
    histogram5->SetMarkerSize(markerSizes[4]);
    histogram5->Draw("e1psame");
    if ( integral5 >= 0. ) legend->AddEntry(histogram5, Form("%s: %1.2f", legendEntry5.data(), integral5), "p");
    else legend->AddEntry(histogram5, legendEntry5.data(), "p");
  }

  if ( histogram6 ) {
    histogram6->SetLineColor(colors[5]);
    histogram6->SetLineWidth(2);
    histogram6->SetMarkerColor(colors[5]);
    histogram6->SetMarkerStyle(markerStyles[5]);
    histogram6->SetMarkerSize(markerSizes[5]);
    histogram6->Draw("e1psame");
    if ( integral6 >= 0. ) legend->AddEntry(histogram6, Form("%s: %1.2f", legendEntry6.data(), integral6), "p");
    else legend->AddEntry(histogram6, legendEntry6.data(), "p");
  }

  legend->Draw();

  canvas->cd();
  bottomPad->Draw();
  bottomPad->cd();

  TH1* histogram2_div_ref = 0;
  if ( histogram2 ) {
    std::string histogramName2_div_ref = std::string(histogram2->GetName()).append("_div_").append(histogram_ref->GetName());
    histogram2_div_ref = compRatioHistogram(histogramName2_div_ref, histogram2, histogram_ref);
    if ( histogram2_div_ref ) {
      histogram2_div_ref->SetTitle("");
      histogram2_div_ref->SetStats(false);
      histogram2_div_ref->SetMinimum(-0.50);
      histogram2_div_ref->SetMaximum(+0.50);
      
      TAxis* xAxis_bottom = histogram2_div_ref->GetXaxis();
      xAxis_bottom->SetTitle(xAxis_top->GetTitle());
      xAxis_bottom->SetLabelColor(1);
      xAxis_bottom->SetTitleColor(1);
      xAxis_bottom->SetTitleOffset(1.20);
      xAxis_bottom->SetTitleSize(0.08);
      xAxis_bottom->SetLabelOffset(0.02);
      xAxis_bottom->SetLabelSize(0.08);
      xAxis_bottom->SetTickLength(0.055);
      
      TAxis* yAxis_bottom = histogram2_div_ref->GetYaxis();
      yAxis_bottom->SetTitle(Form("#frac{%s - %s}{%s}", legendEntry2.data(), legendEntry_ref.data(), legendEntry_ref.data()));
      yAxis_bottom->SetTitleOffset(0.85);
      yAxis_bottom->SetNdivisions(505);
      yAxis_bottom->CenterTitle();
      yAxis_bottom->SetTitleSize(0.08);
      yAxis_bottom->SetLabelSize(0.08);
      yAxis_bottom->SetTickLength(0.04);  
      
      histogram2_div_ref->Draw("e1p");
    }
  }

  TH1* histogram3_div_ref = 0;
  if ( histogram3 ) {
    std::string histogramName3_div_ref = std::string(histogram3->GetName()).append("_div_").append(histogram_ref->GetName());
    histogram3_div_ref = compRatioHistogram(histogramName3_div_ref, histogram3, histogram_ref);
    if ( histogram3_div_ref ) {
      histogram3_div_ref->SetTitle("");
      histogram3_div_ref->SetStats(false);
      histogram3_div_ref->SetMinimum(-0.50);
      histogram3_div_ref->SetMaximum(+0.50);
      
      TAxis* xAxis_bottom = histogram3_div_ref->GetXaxis();
      xAxis_bottom->SetTitle(xAxis_top->GetTitle());
      xAxis_bottom->SetLabelColor(1);
      xAxis_bottom->SetTitleColor(1);
      xAxis_bottom->SetTitleOffset(1.20);
      xAxis_bottom->SetTitleSize(0.08);
      xAxis_bottom->SetLabelOffset(0.02);
      xAxis_bottom->SetLabelSize(0.08);
      xAxis_bottom->SetTickLength(0.055);
      
      TAxis* yAxis_bottom = histogram3_div_ref->GetYaxis();
      yAxis_bottom->SetTitle(Form("#frac{%s - %s}{%s}", legendEntry3.data(), legendEntry_ref.data(), legendEntry_ref.data()));
      yAxis_bottom->SetTitleOffset(0.85);
      yAxis_bottom->SetNdivisions(505);
      yAxis_bottom->CenterTitle();
      yAxis_bottom->SetTitleSize(0.08);
      yAxis_bottom->SetLabelSize(0.08);
      yAxis_bottom->SetTickLength(0.04);  
      
      if ( histogram2 ) histogram3_div_ref->Draw("e1psame");
      else histogram3_div_ref->Draw("e1p");
    }
  }

  TGraph* graph_line = new TGraph(2);
  graph_line->SetPoint(0, xAxis_top->GetXmin(), 0.);
  graph_line->SetPoint(1, xAxis_top->GetXmax(), 0.);
  graph_line->SetLineColor(8);
  graph_line->SetLineWidth(1);
  graph_line->Draw("L");

  if ( histogram2_div_ref ) histogram2_div_ref->Draw("e1psame");
  if ( histogram3_div_ref ) histogram3_div_ref->Draw("e1psame");

  TH1* histogram4_div_ref = 0;
  if ( histogram4 ) {
    std::string histogramName4_div_ref = std::string(histogram4->GetName()).append("_div_").append(histogram_ref->GetName());
    histogram4_div_ref = compRatioHistogram(histogramName4_div_ref, histogram4, histogram_ref);
    if ( histogram4_div_ref ) {
      histogram4_div_ref->Draw("e1psame");
    }
  }

  TH1* histogram5_div_ref = 0;
  if ( histogram5 ) {
    std::string histogramName5_div_ref = std::string(histogram5->GetName()).append("_div_").append(histogram_ref->GetName());
    histogram5_div_ref = compRatioHistogram(histogramName5_div_ref, histogram5, histogram_ref);
    if ( histogram5_div_ref ) {
      histogram5_div_ref->Draw("e1psame");
    }
  }

  TH1* histogram6_div_ref = 0;
  if ( histogram6 ) {
    std::string histogramName6_div_ref = std::string(histogram6->GetName()).append("_div_").append(histogram_ref->GetName());
    histogram6_div_ref = compRatioHistogram(histogramName6_div_ref, histogram6, histogram_ref);
    if ( histogram6_div_ref ) {
      histogram6_div_ref->Draw("e1psame");
    }
  }
  
  canvas->Update();
  size_t idx = outputFileName.find_last_of('.');
  std::string outputFileName_plot = std::string(outputFileName, 0, idx);
  if ( useLogScale ) outputFileName_plot.append("_log");
  else outputFileName_plot.append("_linear");
  if ( idx != std::string::npos ) canvas->Print(std::string(outputFileName_plot).append(std::string(outputFileName, idx)).data());
  canvas->Print(std::string(outputFileName_plot).append(".png").data());
  //canvas->Print(std::string(outputFileName_plot).append(".pdf").data());
  //canvas->Print(std::string(outputFileName_plot).append(".root").data());
  
  delete legend;
  delete histogram2_div_ref;
  delete histogram3_div_ref;
  delete histogram4_div_ref;
  delete histogram5_div_ref;
  delete histogram6_div_ref;
  delete topPad;
  delete bottomPad;
  delete canvas;  
}
예제 #30
0
void ATLASCMSCOMPARISON(TString quantity="ttbarMass"){

  bool cmssim=true;

  // ---
  //    canvas style 
  // ---
  TStyle myStyle("HHStyle","HHStyle");
  setHHStyle(myStyle);
  myStyle.SetErrorX(0.5);
  myStyle.cd();
  gROOT->SetStyle("HHStyle");
  gStyle->SetEndErrorSize(10);
  gStyle->SetOptFit(0);

  // ---
  //    top Pt 7 TeV
  // ---
  int Nbins7=7;
  if(     quantity=="topPt"    ) Nbins7=7;
  else if(quantity=="ttbarMass") Nbins7=5;
  else if(quantity=="ttbarY"   ) Nbins7=6;

  // CMS data
  TGraphAsymmErrors* CMSdata7 = new TGraphAsymmErrors(Nbins7);
  if(quantity=="topPt"){
    CMSdata7->SetPoint( 0, 25.0 , 0.004032 ); 
    CMSdata7->SetPoint( 1, 75.0 , 0.006746 ); 
    CMSdata7->SetPoint( 2, 125.0, 0.004737 ); 
    CMSdata7->SetPoint( 3, 175.0, 0.002506 ); 
    CMSdata7->SetPoint( 4, 225.0, 0.001140 ); 
    CMSdata7->SetPoint( 5, 300.0, 0.000334 ); 
    CMSdata7->SetPoint( 6, 575.0, 0.000019 ); 
    
    CMSdata7->SetPointError( 0, 25., 25., ( 5.5/100)*0.004032, ( 5.5/100)*0.004032 );
    CMSdata7->SetPointError( 1, 25., 25., ( 4.1/100)*0.006746, ( 4.1/100)*0.006746 );
    CMSdata7->SetPointError( 2, 25., 25., ( 4.0/100)*0.004737, ( 4.0/100)*0.004737 );
    CMSdata7->SetPointError( 3, 25., 25., ( 5.4/100)*0.002506, ( 5.4/100)*0.002506 );
    CMSdata7->SetPointError( 4, 25., 25., ( 5.6/100)*0.001140, ( 5.6/100)*0.001140 );
    CMSdata7->SetPointError( 5, 50., 50., ( 8.4/100)*0.000334, ( 8.4/100)*0.000334 );
    CMSdata7->SetPointError( 6, 225.,225., (14.1/100)*0.000019, (14.1/100)*0.000019 );
  }
  else if(quantity=="ttbarMass"){
    CMSdata7->SetPoint( 0, 350.0 , 0.002588 ); 
    CMSdata7->SetPoint( 1, 500.0 , 0.002685 ); 
    CMSdata7->SetPoint( 2, 625.0 , 0.000953 ); 
    CMSdata7->SetPoint( 3, 825.0 , 0.000232 ); 
    CMSdata7->SetPoint( 4, 1725.0, 0.000008 ); 
    
    CMSdata7->SetPointError( 0, 100., 100., ( 4.9 /100)*0.002588, (4.9 /100)*0.002588 );
    CMSdata7->SetPointError( 1, 50. , 50. , ( 6.9 /100)*0.002685, (6.9 /100)*0.002685 );
    CMSdata7->SetPointError( 2, 75. , 75. , ( 7.7 /100)*0.000953, (7.7 /100)*0.000953 );
    CMSdata7->SetPointError( 3, 125., 125., ( 14.4/100)*0.000232, (14.4/100)*0.000232 );
    CMSdata7->SetPointError( 4, 775., 775., ( 27.6/100)*0.000008, (27.6/100)*0.000008 );
  }
  else if(quantity=="ttbarY"){
    CMSdata7->SetPoint( 0, -1.75, 0.082140 ); 
    CMSdata7->SetPoint( 1, -0.75, 0.318979 ); 
    CMSdata7->SetPoint( 2, -0.25, 0.427823 ); 
    CMSdata7->SetPoint( 3,  0.25, 0.44591  ); 
    CMSdata7->SetPoint( 4,  0.75, 0.318820 ); 
    CMSdata7->SetPoint( 5,  1.75, 0.080457 );

    CMSdata7->SetPointError( 0, 0.75, 0.75, (8.1/100)*0.082140, (8.1/100)*0.082140 );
    CMSdata7->SetPointError( 1, 0.25, 0.25, (3.3/100)*0.318979, (3.3/100)*0.318979 );
    CMSdata7->SetPointError( 2, 0.25, 0.25, (3.0/100)*0.427823, (3.0/100)*0.427823 );
    CMSdata7->SetPointError( 3, 0.25, 0.25, (3.5/100)*0.44591 , (3.5/100)*0.44591  );
    CMSdata7->SetPointError( 4, 0.25, 0.25, (3.5/100)*0.318820, (3.5/100)*0.318820 );
    CMSdata7->SetPointError( 5, 0.75, 0.75, (5.9/100)*0.080457, (5.9/100)*0.080457 );
  }

  CMSdata7->SetLineWidth(3.);
  CMSdata7->SetMarkerSize(1.2);
  CMSdata7->SetMarkerStyle(24);
  CMSdata7->SetLineStyle(1);
  CMSdata7->SetMarkerColor(kBlue);
  CMSdata7->SetLineColor(kBlue);
  CMSdata7->SetFillStyle(3004);
  CMSdata7->SetFillColor(kBlue);

  // CMS MadGraph+Pythia(Z2*)
  TGraphAsymmErrors* CMSMadGraph7 = new TGraphAsymmErrors(Nbins7);
  if(quantity=="topPt"){
    CMSMadGraph7->SetPoint( 0, 25.0 , 0.003331 ); 
    CMSMadGraph7->SetPoint( 1, 75.0 , 0.006495 ); 
    CMSMadGraph7->SetPoint( 2, 125.0, 0.005077 ); 
    CMSMadGraph7->SetPoint( 3, 175.0, 0.002748 ); 
    CMSMadGraph7->SetPoint( 4, 225.0, 0.001282 ); 
    CMSMadGraph7->SetPoint( 5, 300.0, 0.000413 ); 
    CMSMadGraph7->SetPoint( 6, 575.0, 0.000027 ); 

    CMSMadGraph7->SetPointError( 0, 25., 25., 0., 0. );
    CMSMadGraph7->SetPointError( 1, 25., 25., 0., 0. );
    CMSMadGraph7->SetPointError( 2, 25., 25., 0., 0. );
    CMSMadGraph7->SetPointError( 3, 25., 25., 0., 0. );
    CMSMadGraph7->SetPointError( 4, 25., 25., 0., 0. );
    CMSMadGraph7->SetPointError( 5, 50., 50., 0., 0. );
    CMSMadGraph7->SetPointError( 6, 225., 225., 0., 0. );
  }
  else if(quantity=="ttbarMass"){
    CMSMadGraph7->SetPoint( 0, 350.0 , 0.002541 ); 
    CMSMadGraph7->SetPoint( 1, 500.0 , 0.002759 ); 
    CMSMadGraph7->SetPoint( 2, 625.0 , 0.000988 ); 
    CMSMadGraph7->SetPoint( 3, 825.0 , 0.000222 ); 
    CMSMadGraph7->SetPoint( 4, 1725.0, 0.000008 ); 
    
    CMSMadGraph7->SetPointError( 0, 100., 100., 0., 0. );
    CMSMadGraph7->SetPointError( 1, 50. , 50. , 0., 0. );
    CMSMadGraph7->SetPointError( 2, 75. , 75. , 0., 0. );
    CMSMadGraph7->SetPointError( 3, 125., 125., 0., 0. );
    CMSMadGraph7->SetPointError( 4, 775., 775., 0., 0. );
  }
  else if(quantity=="ttbarY"){
    CMSMadGraph7->SetPoint( 0, -1.75, 0.088374 ); 
    CMSMadGraph7->SetPoint( 1, -0.75, 0.319964 ); 
    CMSMadGraph7->SetPoint( 2, -0.25, 0.414022 ); 
    CMSMadGraph7->SetPoint( 3,  0.25, 0.415108 ); 
    CMSMadGraph7->SetPoint( 4,  0.75, 0.320370 ); 
    CMSMadGraph7->SetPoint( 5,  1.75, 0.088218 );

    CMSMadGraph7->SetPointError( 0, 0.75, 0.75, 0., 0. );
    CMSMadGraph7->SetPointError( 1, 0.25, 0.25, 0., 0. );
    CMSMadGraph7->SetPointError( 2, 0.25, 0.25, 0., 0. );
    CMSMadGraph7->SetPointError( 3, 0.25, 0.25, 0., 0. );
    CMSMadGraph7->SetPointError( 4, 0.25, 0.25, 0., 0. );
    CMSMadGraph7->SetPointError( 5, 0.75, 0.75, 0., 0. ); 
  }

  CMSMadGraph7->SetLineWidth(3.);
  CMSMadGraph7->SetMarkerSize(1.2);
  CMSMadGraph7->SetLineStyle(1);
  CMSMadGraph7->SetMarkerStyle(20);
  CMSMadGraph7->SetMarkerColor(kAzure+6);
  CMSMadGraph7->SetLineColor(kAzure+6);


  // ATLAS data
  TGraphAsymmErrors* ATLASdata7 = new TGraphAsymmErrors(Nbins7);
  if(quantity=="topPt"){
    ATLASdata7->SetPoint( 0, 25.0 , 0.0034  ); 
    ATLASdata7->SetPoint( 1, 75.0 , 0.0067  ); 
    ATLASdata7->SetPoint( 2, 125.0, 0.0052  ); 
    ATLASdata7->SetPoint( 3, 175.0, 0.00266 ); 
    ATLASdata7->SetPoint( 4, 225.0, 0.00114 ); 
    ATLASdata7->SetPoint( 5, 300.0, 0.00033 ); 
    ATLASdata7->SetPoint( 6, 575.0, 0.000018); 

    ATLASdata7->SetPointError( 0, 25., 25., (4.47 /100)*0.0034  , (4.47 /100)*0.0034   );
    ATLASdata7->SetPointError( 1, 25., 25., (1.41 /100)*0.0067  , (1.41 /100)*0.0067   );
    ATLASdata7->SetPointError( 2, 25., 25., (2.83 /100)*0.0052  , (2.83 /100)*0.0052   );
    ATLASdata7->SetPointError( 3, 25., 25., (3.61 /100)*0.00266 , (3.61 /100)*0.00266  );
    ATLASdata7->SetPointError( 4, 25., 25., (3.61 /100)*0.00114 , (3.61 /100)*0.00114  );
    ATLASdata7->SetPointError( 5, 50., 50., (5.83 /100)*0.00033 , (5.83 /100)*0.00033  );
    ATLASdata7->SetPointError( 6, 225., 225., (11.66/100)*0.000018, (11.66/100)*0.000018 );
  }
  else if(quantity=="ttbarMass"){
    ATLASdata7->SetPoint( 0, 350.0 , 0.00250   ); 
    ATLASdata7->SetPoint( 1, 500.0 , 0.00273   ); 
    ATLASdata7->SetPoint( 2, 625.0 , 0.00102   ); 
    ATLASdata7->SetPoint( 3, 825.0 , 0.00023   ); 
    ATLASdata7->SetPoint( 4, 1725.0, 0.0000076 ); 
    
    ATLASdata7->SetPointError( 0, 100., 100., 0.00008   , 0.00008  );
    ATLASdata7->SetPointError( 1, 50. , 50. , 0.00007   , 0.00007  );
    ATLASdata7->SetPointError( 2, 75. , 75. , 0.00004   , 0.00004  );
    ATLASdata7->SetPointError( 3, 125., 125., 0.00001   , 0.00001  );
    ATLASdata7->SetPointError( 4, 775., 775., 0.0000005, 0.0000005 );
  }
  else if(quantity=="ttbarY"){
    ATLASdata7->SetPoint( 0, -1.75, 0.081 ); 
    ATLASdata7->SetPoint( 1, -0.75, 0.321 ); 
    ATLASdata7->SetPoint( 2, -0.25, 0.436 ); 
    ATLASdata7->SetPoint( 3,  0.25, 0.423 ); 
    ATLASdata7->SetPoint( 4,  0.75, 0.321 ); 
    ATLASdata7->SetPoint( 5,  1.75, 0.087 );

    ATLASdata7->SetPointError( 0, 0.75, 0.75, 0.003, 0.003);
    ATLASdata7->SetPointError( 1, 0.25, 0.25, 0.009, 0.009);
    ATLASdata7->SetPointError( 2, 0.25, 0.25, 0.009, 0.009);
    ATLASdata7->SetPointError( 3, 0.25, 0.25, 0.007, 0.007);
    ATLASdata7->SetPointError( 4, 0.25, 0.25, 0.005, 0.005);
    ATLASdata7->SetPointError( 5, 0.75, 0.75, 0.005, 0.005);
  }
  ATLASdata7->SetLineWidth(3.);
  ATLASdata7->SetMarkerSize(1.2);
  ATLASdata7->SetMarkerStyle(22);
  ATLASdata7->SetLineStyle(2);
  ATLASdata7->SetMarkerColor(kRed);
  ATLASdata7->SetLineColor(kRed);
  ATLASdata7->SetFillStyle(3005);
  ATLASdata7->SetFillColor(kRed);

  // ---
  //    dummy plots for axis
  // ---
  // create variable bin edges
  std::map<TString, std::vector<double> > binning_ = makeVariableBinning(false);
  std::vector<double> newTopBins_;
  if(quantity=="topPt"){
    newTopBins_.push_back(0.);
    newTopBins_.push_back(50.);
    newTopBins_.push_back(100.);
    newTopBins_.push_back(150.);
    newTopBins_.push_back(200.);
    newTopBins_.push_back(250.);
    newTopBins_.push_back(350.);
    newTopBins_.push_back(800.);
  }

  else if(quantity=="ttbarMass"){
    newTopBins_.push_back(250.);
    newTopBins_.push_back(450.);
    newTopBins_.push_back(550.);
    newTopBins_.push_back(700.);
    newTopBins_.push_back(950.);
    newTopBins_.push_back(2500.);
  }
  else if(quantity=="ttbarY"   ){
    newTopBins_.push_back(-2.5);
    newTopBins_.push_back(-1.0);
    newTopBins_.push_back(-0.5);
    newTopBins_.push_back(0.  );
    newTopBins_.push_back(0.5 );
    newTopBins_.push_back(1.0 );
    newTopBins_.push_back(2.5 );
  }

  binning_[quantity]=newTopBins_;
  double start=0.;
  double range=800.;
  int Nfinebins=800;
  if(quantity=="topPt"){ Nfinebins=800; start=0.; range=800.;}
  else if(quantity=="ttbarMass"){ Nfinebins=2250; start=250.; range=2500.; }
  else if(quantity=="ttbarY"   ){ Nfinebins=500 ; start=-2.5; range=2.5;}
  TH1F* dummy= new TH1F("","",Nfinebins,start,range);
  reBinTH1F(*dummy, binning_[quantity], 0);
  histogramStyle(*dummy, kSig);
  TString label="p_{T}^{t} [GeV]";
  TString label2="p_{T}^{t}";
  if(quantity=="topPt"){label="p_{T}^{t} [GeV]"; label2="p_{T}^{t}";}
  else if(quantity=="ttbarMass"){ label="m^{t#bar{t}} [GeV]"; label2="m^{t#bar{t}}"; }
  else if(quantity=="ttbarY"   ){ label="y^{t#bar{t}}"; label2=label; }
  dummy->GetXaxis()->SetTitle(label);
  dummy->GetYaxis()->SetTitle(TString("#frac{1}{#sigma} #frac{d#sigma}{")+label2+"}");
  double max=0.01;
  double min=0.;
  if(quantity=="topPt"    ){max=0.01 ; min=0.;}
  if(quantity=="ttbarMass"){max=0.004; min=0.;}
  if(quantity=="ttbarY"   ){max=1.0  ; min=0.;}
  dummy->SetMaximum(max);
  dummy->SetMinimum(min);
  TH1F* A=convertToHist(ATLASdata7, dummy, Nbins7);
  TH1F* C=convertToHist(CMSdata7  , dummy, Nbins7);
  histogramStyle(*A, kSig, true, 1.2, kRed);
  A->SetLineWidth(3.);
  A->SetMarkerSize(1.2);
  A->SetMarkerStyle(22);
  A->SetLineStyle(1);
  A->SetMarkerColor(kRed);
  A->SetLineColor(kRed);
  A->SetFillStyle(3005);
  histogramStyle(*C, kSig, true, 1.2, kBlue);
  C->SetLineWidth(3.);
  C->SetMarkerSize(1.2);
  C->SetMarkerStyle(24);
  C->SetLineStyle(1);
  C->SetMarkerColor(kBlue);
  C->SetLineColor(kBlue);
  C->SetFillStyle(3004);
  TH1F* M=convertToHist(CMSMadGraph7  , dummy, Nbins7);
  histogramStyle(*M, kSig, false, 1.2, kAzure+6);
  M->SetLineWidth(3.);
  M->SetMarkerSize(1.2);
  M->SetMarkerStyle(22);
  M->SetLineStyle(1);
  M->SetMarkerColor(kAzure+6);
  M->SetLineColor(kAzure+6);

  // ---
  //    legend
  // ---
  TLegend *leg0 = new TLegend(0.45, 0.65, 0.95, 0.85);
  leg0->SetFillStyle(0);
  leg0->SetBorderSize(0);
  leg0->SetHeader("#sqrt{s}=7TeV data (e/#mu channel)");
  TLegend *leg1=(TLegend*)leg0->Clone(); 
  if(cmssim) leg0->AddEntry( CMSMadGraph7, "CMS MadGraph+Pythia(Z2*)", "LP");
  leg0->AddEntry( CMSdata7    , "CMS data in ATLAS binning"   , "LP");
  leg0->AddEntry( ATLASdata7  , "ATLAS data" , "LP");
  leg1->AddEntry( ATLASdata7  , "ATLAS (ATLAS-CONF-2013-099)" , "FP");
  leg1->AddEntry( CMSdata7    , "CMS (TOP-11-013 in ATLAS binning)"   , "FP");
  if(cmssim) leg1->AddEntry( CMSMadGraph7, "CMS MadGraph+Pythia(Z2*)", "LP");


  // ---
  //    privatworklabel
  // ---
  TPaveText *privatworklabel = new TPaveText();
  privatworklabel -> SetX1NDC(gStyle->GetPadLeftMargin());
  privatworklabel -> SetY1NDC(1.0-gStyle->GetPadTopMargin());
  privatworklabel -> SetX2NDC(1.0-gStyle->GetPadRightMargin());
  privatworklabel -> SetY2NDC(1.0);
  privatworklabel -> SetTextFont(42);
  privatworklabel -> AddText("private work");
  privatworklabel->SetFillStyle(0);
  privatworklabel->SetBorderSize(0);
  privatworklabel->SetTextSize(0.04);
  privatworklabel->SetTextAlign(32);

  // canvas
  std::vector<TCanvas*> plotCanvas_;
  // a) linear
  addCanvas(plotCanvas_);
  plotCanvas_[plotCanvas_.size()-1]->cd(0);
  plotCanvas_[plotCanvas_.size()-1]->SetTitle(quantity+" measurement comparison");
  // drawing
  dummy->Draw("axis");
  if(cmssim) CMSMadGraph7->Draw("p e1 same");
  ATLASdata7  ->Draw("p e2 same");
  CMSdata7    ->Draw("p e2 same");
  leg0 ->Draw("same");
  privatworklabel->Draw("same");
  // b) log scale
  TH1F* dummy2=(TH1F*)dummy->Clone();
  dummy2->SetMinimum(0.00001);
  dummy2->SetMaximum(max*10);
  addCanvas(plotCanvas_);
  plotCanvas_[plotCanvas_.size()-1]->cd(0);
  plotCanvas_[plotCanvas_.size()-1]->SetTitle(quantity+" measurement comparison");
  plotCanvas_[plotCanvas_.size()-1]->SetLogy();
  // drawing
  dummy2->Draw("axis");
  if(cmssim) CMSMadGraph7->Draw("p e1 same");
  CMSdata7    ->Draw("p e2 same");
  ATLASdata7  ->Draw("p e2 same");
  leg0 ->Draw("same");
  privatworklabel->Draw("same");
  // c) both data with bands
  addCanvas(plotCanvas_);
  plotCanvas_[plotCanvas_.size()-1]->cd(0);
  plotCanvas_[plotCanvas_.size()-1]->SetTitle(quantity+" measurement comparison");
  // drawing
  dummy->Draw("axis");
  //DrawSteps(C, "e2 same");
  //C->Draw("e2 same");
  //DrawSteps(A, "e2 same");
  //A->Draw("e2 same");
  if(cmssim) CMSMadGraph7->Draw("p e1 same");
  CMSdata7    ->Draw("p e2 same");
  ATLASdata7  ->Draw("p e2 same");
  // new pad for log plot
  TPad *rPad = new TPad("rPad","",0.4,0.15,0.95,0.85);
  rPad->SetFillStyle(0);
  rPad->SetFillColor(0);
  rPad->SetBorderSize(0);
  rPad->SetBorderMode(0);
  rPad->SetLogy(0);
  rPad->SetLogx(0);
  rPad->SetTicky(1);
  rPad->Draw("");
  rPad->cd();
  // log plot curves
  rPad->SetLogy();
  dummy2->Draw("axis");
  if(cmssim) CMSMadGraph7->Draw("p e1 same");
  CMSdata7    ->Draw("p e2 same");
  ATLASdata7  ->Draw("p e2 same");
  leg1->Draw("same");
  privatworklabel->Draw("same");
  // d) both data with ratio
  addCanvas(plotCanvas_);
  plotCanvas_[plotCanvas_.size()-1]->cd(0);
  plotCanvas_[plotCanvas_.size()-1]->SetTitle(quantity+" measurement comparison");
  // drawing
  dummy->Draw("axis");
  if(cmssim) CMSMadGraph7->Draw("p e1 same");
  //DrawSteps(C, "e2 same");
  //C->Draw("e2 same");
  //DrawSteps(A, "e2 same");
  //A->Draw("e2 same");
  CMSdata7    ->Draw("p e2 same");
  ATLASdata7  ->Draw("p e2 same");
  leg1 ->Draw("same");
  privatworklabel->Draw("same");
  std::vector<double> errA_;
  for(int bin=1; bin<=Nbins7; ++bin){
    errA_.push_back((ATLASdata7->GetY()[bin-1]/CMSdata7->GetY()[bin-1])*((ATLASdata7->GetErrorYhigh(bin-1)/ATLASdata7->GetY()[bin-1])));
  }
  std::vector<double> errC_;
  for(int bin=1; bin<=Nbins7; ++bin){
    errC_.push_back((CMSdata7->GetErrorYhigh(bin-1)/CMSdata7->GetY()[bin-1]));
  }
  if(cmssim){
    std::vector<double> errM_;
    for(int bin=1; bin<=Nbins7; ++bin){
      errM_.push_back(0.);
      //errM_.push_back((CMSMadGraph7->GetY()[bin-1]/CMSdata7->GetY()[bin-1])*((CMSMadGraph7->GetErrorYhigh(bin-1)/CMSMadGraph7->GetY()[bin-1])));
    }
    drawRatio(M, C, 0.5, 1.5,  myStyle, 0, errM_, "x", "CMS data", "hist ", kAzure+6, false, 0.7);
    drawRatio(C, C, 0.5, 1.5,  myStyle, 0, errC_, "x", "CMS data", "p e2 same"     , kBlue, true, 0.7);

  }
  else drawRatio(C, C, 0.5, 1.5,  myStyle, 0, errC_, "x", "CMS data", "p e2"     , kBlue, true, 0.7);
  drawRatio(A, C, 0.5, 1.5,  myStyle, 0, errA_, "x", "CMS data", "p e2 same", kRed , true, 0.7);

  //saving
  TString path="./diffXSecFromSignal/plots/combined/2012/comparisonATLAS/";
  plotCanvas_[0]->Print(path+quantity+"ATLASvsCMS7TeV.eps");
  plotCanvas_[0]->Print(path+quantity+"ATLASvsCMS7TeV.png");
  plotCanvas_[1]->Print(path+quantity+"ATLASvsCMS7TeVLog.eps");
  plotCanvas_[1]->Print(path+quantity+"ATLASvsCMS7TeVLog.png");
  plotCanvas_[2]->Print(path+quantity+"ATLASvsCMS7TeVNoratio.eps");
  plotCanvas_[2]->Print(path+quantity+"ATLASvsCMS7TeVNoratio.png");
  plotCanvas_[plotCanvas_.size()-1]->Print(path+quantity+"ATLASvsCMS7TeVratio.eps");
  plotCanvas_[plotCanvas_.size()-1]->Print(path+quantity+"ATLASvsCMS7TeVratio.png");
  plotCanvas_[plotCanvas_.size()-1]->SetTitle(quantity);
  saveToRootFile("ATLASvsCMSDataComparisonPlots.root", plotCanvas_[plotCanvas_.size()-1], true, 0,"");
}