示例#1
0
int CmpNmuMCData()
{
  double ene[21]    = {2.0,     2.05,    2.1,     2.15,   2.175, 
                       2.2,     2.2324,  2.3094,  2.3864, 2.396,  
	           2.5,     2.6444,  2.6464,  2.7,    2.8,
	           2.9,     2.95,    2.981,   3.0,    3.02,     3.08};
  double enee[21]   = {0.0};
  double Nmu_mc[21] = {73.4868, 24.4878, 106.242, 28.242, 123.445, 
                       171.389, 155.009, 336.687, 412.597, 1314.02,
	           26.2072, 1117.27, 1111.97, 37.838, 41.3881,
	           5159.19, 899.304, 924.003, 928.963, 1074.39, 8685.27};
  double Nmue_mc[21]; for (int i=0; i<21;i++) Nmue_mc[i] = sqrt(Nmu_mc[i]);
  double Nmu_da[21] = {91.9,    39.1,    143.0,   25.8,    129.5,
                       163.7,   159.6,   361.1,   443.5,   1240.1,
	           22.0,    1081.5,  1073.7,  53.1,    41.9,
	           5441.4,  894.8,   974.4,   977.4,   1172.0,  8805.7};
  double Nmue_da[21]= {11.9,    6.4,     13.5,    5.,      12.7,
                       13.2,    17.1,    24.9,    24.8,    50.5,
	           4.1,     35.2,    42.7,    7.5,     7.7,
	           124.6,   32.5,    32.4,    31.6,    35.6,    102.7};

  double Nmu_mc_s[21];
  double Nmue_mc_s[21];
  double Nmu_da_s[21];
  double Nmue_da_s[21];
  for (int i=0; i<21; i++){
    Nmu_mc_s[i] = Nmu_mc[i]/Nmu_da[i];
    Nmue_mc_s[i] = Nmue_mc[i]/Nmu_da[i];
    Nmu_da_s[i] = Nmu_da[i]/Nmu_da[i];
    Nmue_da_s[i] = Nmue_da[i]/Nmu_da[i];
    cout << "At "<< ene[i]<<" GeV, Nmu from data is "<< Nmu_da[i]<<", Nmu from MC is "<< Nmu_mc[i]<<endl;
  //cout << ene[i]<<"\t" << Nmu_da[i];
  //cout << "\t" << Nmu_mc[i] << " "<< Nmu_mc_s[i] ;
  //cout << "\t "<< Nmue_mc[i] << " "<< Nmue_mc_s[i] ;
  //cout << "\t "<< Nmu_da[i] <<" "<< Nmu_da_s[i];
  //cout <<"\t " << Nmue_da[i] <<" "<<  Nmue_da_s[i] << endl;
  }

  TGraphErrors *gdata = new TGraphErrors(21, ene, Nmu_da_s, enee, Nmue_da_s);
  TGraphErrors *gmcmu = new TGraphErrors(21, ene, Nmu_mc_s, enee, Nmue_mc_s);
  gdata->Draw("AP");
  gdata->SetFillColor(0);
  gmcmu->SetFillColor(0);
  gmcmu->SetLineColor(3);
  gmcmu->SetMarkerColor(3);
  gmcmu->Draw("P");
  TLegend *lg = new TLegend(0.5,0.5,0.9,0.9);
  lg->SetFillStyle(0);
  lg->AddEntry(gdata,"Nmu from data");
  lg->AddEntry(gmcmu,"Nmu from MC");
  lg->Draw();




}
示例#2
0
TGraphErrors g(TTree *tree, TString alphaName, TString constTermName){
  Double_t alpha, constTerm;
  alphaName.ReplaceAll("-","_");
  constTermName.ReplaceAll("-","_");

  tree->SetBranchAddress(alphaName,&alpha);
  tree->SetBranchAddress(constTermName,&constTerm);

  //Long64_t nEntries=genTree->GetEntries();

  TGraphErrors graph;
  Int_t iPoint=0;

  tree->GetEntry(0);
  std::cout << alpha << "\t" << constTerm << std::endl;
  Double_t alpha2=alpha*alpha;
  Double_t const2=constTerm*constTerm;
  for(Double_t energy=20; energy<150; energy+=10){
    Double_t addSmearing = (sqrt(alpha2/energy+const2));
    
    graph.SetPoint(iPoint, energy, addSmearing);
    graph.SetPointError(iPoint,0, 0);
    iPoint++;
  }

  graph.Set(iPoint);
  tree->ResetBranchAddresses();
  graph.Draw("A L");
  graph.SetFillColor(kBlue);
  graph.SetLineColor(kYellow);
  graph.GetXaxis()->SetTitle("Energy [GeV]");
  graph.GetYaxis()->SetTitle("Additional smearing [%]");
  return graph;
}
示例#3
0
TGraphErrors g(TTree *genTree, TString constTermName=""){
  Double_t alpha, constTerm;
  genTree->SetBranchAddress("alpha",&alpha);
  genTree->SetBranchAddress("constTerm",&constTerm);

  Long64_t nEntries=genTree->GetEntries();

  TH1F h("smearingHist","",10000,0,0.1);
  TGraphErrors graph;
  Int_t iPoint=0;
  for(Double_t energy=20; energy<150; energy+=10){
    h.Reset();
    for(Long64_t jentry=0; jentry<nEntries; jentry++){
      genTree->GetEntry(jentry);
      h.Fill(sqrt(alpha*alpha/energy+constTerm*constTerm));
    }
    graph.SetPoint(iPoint, energy, h.GetMean());
    graph.SetPointError(iPoint,0, h.GetRMS());
    iPoint++;
  }
  h.SetTitle(constTermName);
  h.SaveAs("tmp/h-"+constTermName+".root");
  graph.Set(iPoint);
  genTree->ResetBranchAddresses();
  graph.Draw("A L3");
  graph.SetFillColor(kBlue);
  graph.SetLineColor(kYellow);
  graph.GetXaxis()->SetTitle("Energy [GeV]");
  graph.GetYaxis()->SetTitle("Additional smearing [%]");
  return graph;
}
示例#4
0
TGraphErrors* MakeErrorGraphSystematicAndStatistical(TH1F *ofpred, TH1F *sfpred, TH1F *prediction, TH1F *SystHisto, float AdditionalSystematicOnFSE) { 
  
  float dx[ofpred->GetNbinsX()];
  float dy[ofpred->GetNbinsX()];
  float x[ofpred->GetNbinsX()];
  float y[ofpred->GetNbinsX()];
  for(int i=1;i<=ofpred->GetNbinsX();i++) {
    x[i-1]=prediction->GetBinCenter(i);
    y[i-1]=prediction->GetBinContent(i);
    if(i>1) dx[i-1]=(prediction->GetBinCenter(i)-prediction->GetBinCenter(i-1))/2.0;
    else dx[i-1]=(prediction->GetBinCenter(i+1)-prediction->GetBinCenter(i))/2.0;
    if(ofpred->GetBinCenter(i)>20 && ofpred->GetBinCenter(i)<70) {
      //need to increase uncertainty by 5% due to extrapolation
      dy[i-1] = pow((MetPlotsSpace::Zprediction_Uncertainty+0.05),2)*pow(sfpred->GetBinContent(i),2); //systematic for Z+Jets prediction
    } else {
      dy[i-1] = pow(MetPlotsSpace::Zprediction_Uncertainty,2)*pow(sfpred->GetBinContent(i),2); //systematic for Z+Jets prediction
    }
    dy[i-1]+= pow(MetPlotsSpace::OFprediction_Uncertainty,2)*pow(ofpred->GetBinContent(i),2); //systematic for OF prediction
    if(AdditionalSystematicOnFSE>0) dy[i-1]+= pow(AdditionalSystematicOnFSE,2)* pow(ofpred->GetBinContent(i),2); //systematic for OF prediction
    float sys=sqrt(dy[i-1])/prediction->GetBinContent(i);
    if(prediction->GetBinContent(i)==0) sys=0.0;
    if(sys!=sys || sys<0) sys=0;
    SystHisto->SetBinContent(i,sys);
    dy[i-1]+= prediction->GetBinError(i) * prediction->GetBinError(i); // plus statistical!
    dy[i-1]=sqrt(dy[i-1]);
  }
  
  TGraphErrors *gr = new TGraphErrors(ofpred->GetNbinsX(),x,y,dx,dy);
  gr->SetFillColor(TColor::GetColor("#2E9AFE"));//blue
  return gr;
}
示例#5
0
void plot_mc(string name="g", double q2=1.9, Int_t n=0)
{
//    SetAtlasStyle();
    TGraphErrors *p;

    TString nn;
    nn.Form("ave_%s_vs_x_for_Q2=%g",name.c_str(),q2);
    gDirectory->GetObject(nn,p);

//    p->Print();

    Double_t ratsize = 0.0;

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

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

    Double_t av = 0;
    Double_t av2 = 0;

    for (Int_t i = 1; i<n+1 ; i++) {
        nn.Form("%s_vs_x_for_Q^{2}=%g_%i",name.c_str(),q2,i);
        TGraph *pp = NULL;
        gDirectory->GetObject(nn,pp);
        if (pp != NULL) {
            pp->SetLineColor(kGreen);
            pp->Draw("L");

            av  += pp->GetY()[0];
            av2 += pp->GetY()[0]*pp->GetY()[0];
            cout << i << " "<<pp->GetY()[0] << endl;


        }
    }

    av  /= n;
    av2 = sqrt(av2/n - av*av);
//    cout << n << " "<<av << " "<< av2<<endl;


    p->Draw("E3C");


}
示例#6
0
void gerrors() {
   
   TCanvas *mycanvas = new TCanvas("mycanvs","A Simple Graph with error bars",200,10,700,500);

//   mycanvas->SetFillColor(42);
   mycanvas->SetGrid();
//   mycanvas->GetFrame()->SetFillColor(21);
//  mycanvas->GetFrame()->SetBorderSize(12);

 const int  n_points =10;
 #double x_vals [ n_points]= {1,2,3,4,5,6,7,8,9,10};
 double  y_vals [ n_points]= {6 ,12 ,14 ,20 ,22 ,24 ,35 ,45 ,44 ,53};
 double y_errs [ n_points]= {5 ,5 ,4.7 ,4.5 ,4.2 ,5.1,2.9,4.1,4.8,5.43};

   TGraphErrors *gr = new TGraphErrors(n_points,x_vals,y_vals,NULL,y_errs);
//   TGraphErrors graph(n_points,x_vals,y_vals,NULL,y_errs);
  gROOT -> SetStyle("Plain");
   gr->SetTitle("TGraphErrors Example; lengtht  [cm];Arb. Units");
   gr->SetMarkerColor(kBlue);
   gr->SetMarkerStyle(kOpenCircle);
   gr->SetLineColor ( kBlue ) ;
   gr->Draw("ALP");
 
 //Define a linear function
TF1 f("Linear law" ,"[0]+x*[1]" ,.5 ,10.5) ; 
 
// Let's make the funcion line nicer 
f.SetLineColor(kRed);
 f.SetLineStyle(2);

 // Fit it to the graph and draw it 
  gr->Fit(&f); 
      f.DrawClone("Same"); 

 // Build and Draw a legend 
      TLegend leg(.1 ,.7 ,.3 ,.9 ,"Lab. Lesson 1"); 
     leg.SetFillColor (0) ; 
    gr->SetFillColor (0) ; 
     leg.AddEntry(gr,"Exp. Points"); 
     leg.AddEntry(&f,"Th. Law"); 
     leg.DrawClone("Same"); 
         // Draw an arrow on the canvas 
       TArrow arrow(8,8,6.2,23,0.02,"----|>"); 
       arrow.SetLineWidth (2) ; 
       arrow.DrawClone ( ) ; 
         // Add some text to the plot 
 TLatex text(8.2,7.5,"#splitline{Maximum}{Deviation}"); 
         text.DrawClone ( ) ; 

   mycanvas->Update();
   mycanvas -> Print("example.pdf");
}
///
/// Plot the discrepancy between the observable and the predicted
/// observable when making predictions about observables by scanning
/// them. This checks if the chi2 term of the observable is tight enough.
/// This only works for 1D scans for now.
///
void ParameterEvolutionPlotter::plotObsScanCheck()
{
	vector<RooSlimFitResult*> results = curveResults;

	cout << "ParameterEvolutionPlotter::plotObsScanCheck() : plotting ..." << endl;
	TCanvas *c2 = newNoWarnTCanvas("plotObsScanCheck"+getUniqueRootName(), title, 800,600);
	c2->SetLeftMargin(0.2);

	// get observable
	TGraphErrors *g = new TGraphErrors(results.size());
	int iGraph = 0;

	for ( int i=0; i<results.size(); i++ ){
		assert(results[i]);
		// get value of observable
		float obsValue = results[i]->getParVal(scanVar1);
		float obsError = w->var(scanVar1)->getError();

		// get value of theory prediction
		setParameters(w,parsName,results[i]);
		TString thName = scanVar1;
		thName.ReplaceAll("_obs","_th");
		if ( !w->function(thName) ){
			cout << "ParameterEvolutionPlotter::plotObsScanCheck() : ERROR : theory value not found: " << thName << endl;
			continue;
		}
		float thValue = w->function(thName)->getVal();
		g->SetPoint(iGraph, iGraph, obsValue-thValue);
		g->SetPointError(iGraph, 0., obsError);
		iGraph++;
	}

	g->SetTitle(scanVar1);
	g->GetXaxis()->SetTitle("scan step");
	g->GetYaxis()->SetTitleSize(0.06);
	g->GetYaxis()->SetLabelSize(0.04);
	g->GetYaxis()->SetTitleOffset(1.5);
	g->GetYaxis()->SetTitle(scanVar1);
	Int_t ci = 927;
	TColor *col = new TColor(ci, 0, 0, 1, " ", 0.5);
	g->SetFillColor(ci);
	g->SetFillStyle(1001);
	g->Draw("a3");
	g->Draw("lxsame");
	c2->Update();

	savePlot(c2, "parEvolutionObsSanCheck_"+name+"_"+scanVar1);
}
示例#8
0
TGraphErrors* MakeErrorGraph(TH1F *histo) { 
  
  float dx[histo->GetNbinsX()];
  float dy[histo->GetNbinsX()];
  float x[histo->GetNbinsX()];
  float y[histo->GetNbinsX()];
  for(int i=1;i<=histo->GetNbinsX();i++) {
    x[i-1]=histo->GetBinCenter(i);
    y[i-1]=histo->GetBinContent(i);
    if(i>1) dx[i-1]=(histo->GetBinCenter(i)-histo->GetBinCenter(i-1))/2.0;
    else dx[i-1]=(histo->GetBinCenter(i+1)-histo->GetBinCenter(i))/2.0;
    dy[i-1]=histo->GetBinError(i);
  }
  
  TGraphErrors *gr = new TGraphErrors(histo->GetNbinsX(),x,y,dx,dy);
  gr->SetFillColor(TColor::GetColor("#2E9AFE"));
  return gr;
}
示例#9
0
TGraphErrors g(Double_t alpha, Double_t constTerm){
  TGraphErrors graph;
  Int_t iPoint=0;

  //  std::cout << alpha << "\t" << constTerm << std::endl;
  Double_t alpha2=alpha*alpha;
  Double_t const2=constTerm*constTerm;
  for(Double_t energy=20; energy<150; energy+=10){
    Double_t addSmearing = (sqrt(alpha2/energy+const2));
    
    graph.SetPoint(iPoint, energy, addSmearing);
    graph.SetPointError(iPoint,0, 0);
    iPoint++;
  }

  graph.Set(iPoint);
  graph.Draw("A L");
  graph.SetFillColor(kBlue);
  graph.SetLineColor(kYellow);
  graph.GetXaxis()->SetTitle("Energy [GeV]");
  graph.GetYaxis()->SetTitle("Additional smearing [%]");
  return graph;
}
示例#10
0
void drawResults() {

    // Syst error: take the max difference
    double dataSystErrEB[nEtaBins][nPtBinsEB];
    for (int ii=0; ii<nPtBinsEB; ii++ ) {
        if ( fabs(dataEB[0][ii]-dataSystSigEB[0][ii]) > fabs(dataEB[0][ii]-dataSystBackEB[0][ii]) ) dataSystErrEB[0][ii] = fabs(dataEB[0][ii]-dataSystSigEB[0][ii]);
        else dataSystErrEB[0][ii] = fabs(dataEB[0][ii]-dataSystBackEB[0][ii]);
    }

    double dataSystErrEE[nEtaBins][nPtBinsEE];
    for (int ii=0; ii<nPtBinsEE; ii++ ) {
        if ( fabs(dataEE[0][ii]-dataSystSigEE[0][ii]) > fabs(dataEE[0][ii]-dataSystBackEE[0][ii]) ) dataSystErrEE[0][ii] = fabs(dataEE[0][ii]-dataSystSigEE[0][ii]);
        else dataSystErrEE[0][ii] = fabs(dataEE[0][ii]-dataSystBackEE[0][ii]);
    }

    // Tot error: stat + syst
    double dataErrEB[nEtaBins][nPtBinsEB];
    double dataErrEE[nEtaBins][nPtBinsEE];

    if (wantSyst) {
        cout << "systematics added" << endl;
        for (int ii=0; ii<nPtBinsEB; ii++ ) {
            dataErrEB[0][ii] = sqrt( dataSystErrEB[0][ii]*dataSystErrEB[0][ii] + dataErrStatEB[0][ii]*dataErrStatEB[0][ii] );
        }
        for (int ii=0; ii<nPtBinsEE; ii++ ) {
            dataErrEE[0][ii] = sqrt( dataSystErrEE[0][ii]*dataSystErrEE[0][ii] + dataErrStatEE[0][ii]*dataErrStatEE[0][ii] );
        }
    } else {
        cout << "only statistical error" << endl;
        for (int ii=0; ii<nPtBinsEB; ii++ ) {
            dataErrEB[0][ii] = dataErrStatEB[0][ii];
        }
        for (int ii=0; ii<nPtBinsEE; ii++ ) {
            dataErrEE[0][ii] = dataErrStatEE[0][ii];
        }
    }

    cout << "================================" << endl;
    cout << "EB" << endl;
    for (int ii=0; ii<nPtBinsEB; ii++ )
        cout << ii << ", nominal = " << dataEB[0][ii] << ", forSigSyst = " << dataSystSigEB[0][ii] << ", forBkgSyst = " << dataSystBackEB[0][ii]
             << ", statErr = " << dataErrStatEB[0][ii] << ", systErr = " <<dataSystErrEB[0][ii] << endl;
    cout << "================================" << endl;
    cout << "EE" << endl;
    for (int ii=0; ii<nPtBinsEE; ii++ )
        cout << ii << ", nominal = " << dataEE[0][ii] << ", forSigSyst = " << dataSystSigEE[0][ii] << ", forBkgSyst = " << dataSystBackEE[0][ii]
             << ", statErr = " << dataErrStatEE[0][ii] << ", systErr = " <<dataSystErrEE[0][ii] << endl;
    cout << "================================" << endl;


    // Scale factors and errors
    double sfEB[nEtaBins][nPtBinsEB];
    double sfErrTotEB[nEtaBins][nPtBinsEB];
    for (int iEta=0; iEta<nEtaBins; iEta++) {
        for (int iPt=0; iPt<nPtBinsEB; iPt++) {
            sfEB[iEta][iPt] = dataEB[iEta][iPt]/mcEB[iEta][iPt];
            float sigmaDoDEB   = dataErrEB[iEta][iPt]/dataEB[iEta][iPt];
            float sigmaMCoMCEB = mcErrEB[iEta][iPt]/mcEB[iEta][iPt];
            sfErrTotEB[iEta][iPt] = sfEB[iEta][iPt]*sqrt( (sigmaDoDEB*sigmaDoDEB) + (sigmaMCoMCEB*sigmaMCoMCEB) );
        }
    }

    double sfEE[nEtaBins][nPtBinsEE];
    double sfErrTotEE[nEtaBins][nPtBinsEE];
    for (int iEta=0; iEta<nEtaBins; iEta++) {
        for (int iPt=0; iPt<nPtBinsEE; iPt++) {
            sfEE[iEta][iPt] = dataEE[iEta][iPt]/mcEE[iEta][iPt];
            float sigmaDoDEE   = dataErrEE[iEta][iPt]/dataEE[iEta][iPt];
            float sigmaMCoMCEE = mcErrEE[iEta][iPt]/mcEE[iEta][iPt];
            sfErrTotEE[iEta][iPt] = sfEE[iEta][iPt]*sqrt( (sigmaDoDEE*sigmaDoDEE) + (sigmaMCoMCEE*sigmaMCoMCEE) );
        }
    }


    // Draw all canvases
    for(int ieta = 0; ieta<nEtaBins; ieta++) {

        TString cname = "sfEff_";
        TCanvas *c1 = new TCanvas(cname, cname, 10,10,700,700);
        c1->SetFillColor(kWhite);
        c1->Draw();
        TPad *pad1 = new TPad("main","",0, 0.3, 1.0, 1.0);
        pad1->SetTopMargin(0.20);
        pad1->SetBottomMargin(0.02);
        pad1->SetGrid();
        TPad *pad2 = new TPad("ratio", "", 0, 0, 1.0, 0.3);
        pad2->SetTopMargin(0.05);
        pad2->SetBottomMargin(0.30);
        pad2->SetGrid();

        pad1->Draw();
        pad2->Draw();

        // Create and fill arrays for graphs for this eta bin
        double *dataSliceEB    = new double[nPtBinsEB];
        double *dataSliceErrEB = new double[nPtBinsEB];
        double *mcSliceEB      = new double[nPtBinsEB];
        double *mcSliceErrEB   = new double[nPtBinsEB];
        double *sfSliceEB      = new double[nPtBinsEB];
        double *sfSliceErrEB   = new double[nPtBinsEB];
        for(int ipt = 0; ipt<nPtBinsEB; ipt++) {
            dataSliceEB   [ipt] = dataEB     [ieta][ipt];
            dataSliceErrEB[ipt] = dataErrEB  [ieta][ipt];
            mcSliceEB     [ipt] = mcEB       [ieta][ipt];
            mcSliceErrEB  [ipt] = mcErrEB    [ieta][ipt];
            sfSliceEB     [ipt] = sfEB       [ieta][ipt];
            sfSliceErrEB  [ipt] = sfErrTotEB [ieta][ipt];
        }

        double *dataSliceEE    = new double[nPtBinsEE];
        double *dataSliceErrEE = new double[nPtBinsEE];
        double *mcSliceEE      = new double[nPtBinsEE];
        double *mcSliceErrEE   = new double[nPtBinsEE];
        double *sfSliceEE      = new double[nPtBinsEE];
        double *sfSliceErrEE   = new double[nPtBinsEE];
        for(int ipt = 0; ipt<nPtBinsEE; ipt++) {
            dataSliceEE   [ipt] = dataEE     [ieta][ipt];
            dataSliceErrEE[ipt] = dataErrEE  [ieta][ipt];
            mcSliceEE     [ipt] = mcEE       [ieta][ipt];
            mcSliceErrEE  [ipt] = mcErrEE    [ieta][ipt];
            sfSliceEE     [ipt] = sfEE       [ieta][ipt];
            sfSliceErrEE  [ipt] = sfErrTotEE [ieta][ipt];
        }

        // Create and configure the graphs
        TGraphErrors *grDataEB = new TGraphErrors(nPtBinsEB, ptBinCentersEB, dataSliceEB, ptBinHalfWidthEB, dataSliceErrEB);
        TGraphErrors *grMcEB   = new TGraphErrors(nPtBinsEB, ptBinCentersEB, mcSliceEB, ptBinHalfWidthEB, mcSliceErrEB);
        TGraphErrors *grSfEB   = new TGraphErrors(nPtBinsEB, ptBinCentersEB, sfSliceEB, ptBinHalfWidthEB, sfSliceErrEB);

        TGraphErrors *grDataEE = new TGraphErrors(nPtBinsEE, ptBinCentersEE, dataSliceEE, ptBinHalfWidthEE, dataSliceErrEE);
        TGraphErrors *grMcEE   = new TGraphErrors(nPtBinsEE, ptBinCentersEE, mcSliceEE, ptBinHalfWidthEE, mcSliceErrEE);
        TGraphErrors *grSfEE   = new TGraphErrors(nPtBinsEE, ptBinCentersEE, sfSliceEE, ptBinHalfWidthEE, sfSliceErrEE);

        grDataEB->SetLineColor(kBlack);
        grDataEB->SetMarkerColor(kBlack);
        grDataEB->SetMarkerStyle(20);
        grDataEB->SetMarkerSize(1.);
        grDataEE->SetLineColor(kBlack);
        grDataEE->SetMarkerColor(kBlack);
        grDataEE->SetMarkerStyle(20);
        grDataEE->SetMarkerSize(1.);

        int ci = TColor::GetColor("#99ccff");
        grMcEB->SetFillColor(kGreen-8);
        ci = TColor::GetColor("#3399ff");
        grMcEB->SetLineColor(kGreen+4);
        grMcEB->SetMarkerStyle(22);
        grMcEB->SetMarkerColor(kGreen+4);
        grMcEB->SetMarkerSize(1.);

        ci = TColor::GetColor("#99ccff");
        grMcEE->SetFillColor(kGreen-8);
        ci = TColor::GetColor("#3399ff");
        grMcEE->SetLineColor(kGreen+4);
        grMcEE->SetMarkerStyle(22);
        grMcEE->SetMarkerColor(kGreen+4);
        grMcEE->SetMarkerSize(1.);

        ci = TColor::GetColor("#99ccff");
        grSfEB->SetFillColor(kGreen-8);
        ci = TColor::GetColor("#3399ff");
        grSfEB->SetLineColor(kGreen+4);
        grSfEB->SetMarkerStyle(20);
        grSfEB->SetMarkerColor(kGreen+4);
        grSfEB->SetMarkerSize(1.);

        ci = TColor::GetColor("#99ccff");
        grSfEE->SetFillColor(kGreen-8);
        ci = TColor::GetColor("#3399ff");
        grSfEE->SetLineColor(kGreen+4);
        grSfEE->SetMarkerStyle(20);
        grSfEE->SetMarkerColor(kGreen+4);
        grSfEE->SetMarkerSize(1.);

        // Create and configure the dummy histograms on which to draw the graphs
        TH2F *h1 = new TH2F("dummy1","", 100, 0, 500, 100, 0.6, 1.1);
        h1->GetYaxis()->SetTitle("Efficiency");
        h1->SetStats(0);
        h1->GetXaxis()->SetLabelSize(0);
        h1->GetXaxis()->SetNdivisions(505);
        h1->GetXaxis()->SetDecimals();
        h1->GetYaxis()->SetTitleOffset(0.8);
        h1->GetYaxis()->SetTitleSize(0.05);
        TH2F *h2 = new TH2F("dummy2","", 100, 0, 500, 100, 0.8, 1.2);
        h2->GetXaxis()->SetTitle("p_{T} [GeV]");
        h2->GetYaxis()->SetTitle("Scale Factor");
        h2->GetXaxis()->SetTitleOffset(1.0);
        h2->GetXaxis()->SetTitleSize(0.1);
        h2->GetYaxis()->SetTitleOffset(0.4);
        h2->GetYaxis()->SetTitleSize(0.1);
        h2->GetXaxis()->SetLabelSize(0.08);
        h2->GetYaxis()->SetLabelSize(0.08);
        h2->GetYaxis()->SetNdivisions(505);
        h2->GetYaxis()->SetDecimals();
        h2->SetStats(0);

        TLegend *leg = new TLegend(0.65,0.1,0.9,0.25);
        leg->SetFillColor(kWhite);
        leg->SetFillStyle(0);
        leg->SetBorderSize(0);
        leg->AddEntry(grDataEB, "Data", "pl");
        leg->AddEntry(grMcEB, "Simulation DY", "pFlE");

        TLatex *latLumi = new TLatex(0, 1.15, lumiString);

        TLatex *latEtaEB = new TLatex(60.0, 0.5, etaLimitsStringArrayEB[ieta]);
        TLatex *latEtaEE = new TLatex(60.0, 0.5, etaLimitsStringArrayEE[ieta]);


        // --------------------------------------
        // EB
        // Draw the efficiencies
        pad1->cd();
        h1->Draw();
        grMcEB  ->Draw("2same");
        grMcEB  ->Draw("pZ,same");
        grDataEB->Draw("PEZ,same");
        leg->Draw("same");
        latEtaEB->Draw("same");
        latLumi->Draw("same");
        // Draw the scale factors
        pad2->cd();
        h2->Draw();
        grSfEB  ->Draw("2same");
        grSfEB  ->Draw("pEZ,same");
        // Save into a file
        TString fname = cname;
        fname += "_EB.pdf";
        c1->Print(fname);

        // --------------------------------------
        // EE
        // Draw the efficiencies
        pad1->cd();
        h1->Draw();
        grMcEE  ->Draw("2same");
        grMcEE  ->Draw("pZ,same");
        grDataEE->Draw("PEZ,same");
        leg->Draw("same");
        latEtaEE->Draw("same");
        latLumi->Draw("same");
        // Draw the scale factors
        pad2->cd();
        h2->Draw();
        grSfEE  ->Draw("2same");
        grSfEE  ->Draw("pEZ,same");
        // Save into a file
        fname = cname;
        fname += "_EE.pdf";
        c1->Print(fname);
    }

}
示例#11
0
void plotOFVZsub(TString var, int nb, float min, float max, bool norm, TString mycut, int njets, TString fs) {

  gROOT->Reset();
  gStyle->SetOptStat(0);

  TString dir = "/smurf/cerati/skims/Run2012_Summer12_SmurfV9_53X/test/skim_dy/";

  TChain *ph = new TChain("tree");
  ph->Add(dir+"./dyll.root");

  TFile *_da = TFile::Open(dir+"./data.root");
  TTree* da = (TTree*) _da->Get("tree");

  TFile *_zz = TFile::Open(dir+"./zz.root");
  TTree* zz = (TTree*) _zz->Get("tree");
  TFile *_wz = TFile::Open(dir+"./wz.root");
  TTree* wz = (TTree*) _wz->Get("tree");

  TFile *_hw = TFile::Open(dir+"./hww125.root");
  TTree* hw = (TTree*) _hw->Get("tree");

  TH1F* h_zz = new TH1F("h_zz","h_zz",nb,min,max);
  TH1F* h_wz = new TH1F("h_wz","h_wz",nb,min,max);
  TH1F* h_dy = new TH1F("h_dy","h_dy",nb,min,max);
  TH1F* h_da = new TH1F("h_da","h_da",nb,min,max);
  TH1F* h_of = new TH1F("h_of","h_of",nb,min,max);
  TH1F* h_hw = new TH1F("h_hw","h_hw",nb,min,max);

  h_dy->SetFillColor(kGreen);
  h_of->SetFillColor(kRed);
  h_zz->SetFillColor(kBlue);
  h_wz->SetFillColor(kBlue);

  h_da->SetMarkerStyle(20);
  h_da->SetLineWidth(2);

  h_hw->SetLineColor(kCyan);
  h_hw->SetLineWidth(2);

  float lumi = 11.9;
  float lumicorr = 1.04;
  float dysf = 1.0;
  float dyer = 1.0;
  if (njets==0) dysf = 10.75;
  if (njets==1) dysf =  7.68;
  if (njets==0) dyer = 0.11;
  if (njets==1) dyer = 0.11;

  TString Met20 = Form("((cuts & 4719111)==4719111)&&njets==%i&&lep1.pt()>20.&&lep2.pt()>10.&&(dstype!=0 || (cuts & 1073741824)==1073741824) && met>20  && dilep.mass()>12. && min(pmet,pTrackMet)>20. && mt>80. && dilep.pt()>45.",njets);

  TString cut = Met20;

  TString minmet = " && min(pmet,pTrackMet)>45.  && (jet1.pt()<15 || dPhiDiLepJet1<165.*TMath::Pi()/180. )"; 
  TString dymva = " && ((njets==0 && dymva>0.88) || (njets==1 && dymva>0.84))";

  if (mycut.Contains("Zp")) cut+="&& abs(dilep.mass()-91)<7.5";
  if (mycut.Contains("oZ")) cut+="&& abs(dilep.mass()-91)>15";

  if (mycut.Contains("ptll45")) {
    cut+="&& dilep.pt()>45.";
    Met20+="&& dilep.pt()>45.";
  }

  if (mycut.Contains("DyMva")) cut+=dymva;

  if (mycut.Contains("MetGt45")) cut+=minmet;
  if (mycut.Contains("MetLt45")) cut+="&& min(pmet,pTrackMet)<45.";

  if (mycut.Contains("mll70")) cut+="&& dilep.mass()<70.";

  if (mycut.Contains("metsig25")) cut+="&& met/sqrt(sumet)<2.5";

  if (mycut.Contains("Mva05")) cut+="&& dymva>0.5";
  if (mycut.Contains("Mva02")) cut+="&& dymva>0.2";

  if (mycut.Contains("HiPU")) cut+="&& nvtx>=10";
  if (mycut.Contains("LoPU")) cut+="&& nvtx<10";

  if (mycut.Contains("HWW125")) {
    cut+="&& lep1.pt()>23 &&  lep2.pt()>10 && dPhi<100.*TMath::Pi()/180. && mt>80 && mt<123"+dymva;
    if (njets==0) dysf = 8.40;
    if (njets==1) dysf = 1.0;
    if (njets==0) dyer = 2.87/8.40;
    if (njets==1) dyer = 1.0;
  }

  if (mycut.Contains("HWW145")) {
    cut+="&& lep1.pt()>25 &&  lep2.pt()>15 && dPhi<90.*TMath::Pi()/180. && mt>80 && mt<130"+dymva;
    if (njets==0) dysf = 7.42;
    if (njets==1) dysf = 3.1;
    if (njets==0) dyer = 1.71/7.42;
    if (njets==1) dyer = 0.5;
  }

  if (mycut.Contains("HWW150")) {
    cut+="&& lep1.pt()>27 &&  lep2.pt()>25 && dPhi<90.*TMath::Pi()/180. && mt>80 && mt<150"+dymva;
    if (njets==0) dysf = 15.78;
    if (njets==1) dysf = 2.8;
    if (njets==0) dyer = 4.20/15.78;
    if (njets==1) dyer = 0.5;
  }

  if (mycut.Contains("HWW160")) {
    cut+="&& lep1.pt()>30 &&  lep2.pt()>25 && dPhi<60.*TMath::Pi()/180. && mt>90 && mt<160"+dymva;
    if (njets==0) dysf = 11.85;
    if (njets==1) dysf = 3.3;
    if (njets==0) dyer = 4.65/11.85;
    if (njets==1) dyer = 0.4;
  }

  if (mycut.Contains("HWW170")) {
    cut+="&& lep1.pt()>34 &&  lep2.pt()>25 && dPhi<60.*TMath::Pi()/180. && mt>110 && mt<170"+dymva;
    if (njets==0) dysf = 5.50;
    if (njets==1) dysf = 3.8;
    if (njets==0) dyer = 3.62/5.50;
    if (njets==1) dyer = 0.4;
  }

  if (mycut.Contains("HWW180")) {
    cut+="&& lep1.pt()>36 &&  lep2.pt()>25 && dPhi<70.*TMath::Pi()/180. && mt>120 && mt<180"+dymva;
    if (njets==0) dysf = 1.0;
    if (njets==1) dysf = 5.0;
    if (njets==0) dyer = 1.0;
    if (njets==1) dyer = 0.4;
  }

  if (mycut.Contains("HWW190")) {
    cut+="&& lep1.pt()>38 &&  lep2.pt()>25 && dPhi<90.*TMath::Pi()/180. && mt>120 && mt<190"+dymva;
    if (njets==0) dysf = 11.78;
    if (njets==1) dysf = 5.2;
    if (njets==0) dyer = 4.12/11.78;
    if (njets==1) dyer = 0.4;
  }

  if (mycut.Contains("HWW200")) {
    cut+="&& lep1.pt()>40 &&  lep2.pt()>25 && dPhi<100.*TMath::Pi()/180. && mt>120 && mt<200"+dymva;
    if (njets==0) dysf = 10.18;
    if (njets==1) dysf = 4.9;
    if (njets==0) dyer = 3.10/10.18;
    if (njets==1) dyer = 0.4;
  }

  TString sf = "(type==0 || type==3)";
  TString of = "(type==1 || type==2)";
  if (fs=="mm") {
    sf = "type==0";
    of = "type==1";
  } else if (fs=="ee") {
    sf = "type==3";
    of = "type==2";
  }

  TString cutsf = "("+cut+"&&"+sf+")";
  TString cutof = "("+cut+"&&"+of+")";
  TString cutmc = "scale1fb*sfWeightPU*sfWeightTrig*sfWeightEff*"+cutsf;

  cout << cutmc << endl;

  TCanvas c1;
  //c1.SetLogy();

  zz->Draw(var+">>h_zz",cutmc); 
  wz->Draw(var+">>h_wz",cutmc); 
  ph->Draw(var+">>h_dy",cutmc); 
  da->Draw(var+">>h_da",cutsf); 
  da->Draw(var+">>h_of",cutof); 
  hw->Draw(var+">>h_hw","scale1fb*sfWeightPU*sfWeightTrig*sfWeightEff*("+Met20+"&&"+sf+")"); 

  cout << h_dy->GetEntries() << endl;

  //add
  h_wz->Scale(lumi);
  h_zz->Scale(lumi);
  h_dy->Scale(lumi*dysf);
  h_of->Scale(lumicorr);
  h_hw->Scale(lumi);

  THStack hs("hs","stack");
  hs.Add(h_of);
  hs.Add(h_zz);
  hs.Add(h_wz);
  hs.Add(h_dy);

  TH1F* herr = new TH1F("herr","herr",nb,min,max);
  for (int bin=1;bin<max+1;bin++) {
    herr->SetBinContent(bin, ((TH1*)(hs.GetStack()->Last()))->GetBinContent(bin) );
    herr->SetBinError(bin,sqrt( pow(0.15*h_wz->GetBinContent(bin),2) + pow(0.15*h_wz->GetBinContent(bin),2) + 
				h_of->GetBinContent(bin) + dyer*h_dy->GetBinContent(bin) ) );
  }
  TGraphErrors* gerr = new TGraphErrors(herr);
  gerr->SetFillColor(kBlack);
  gerr->SetFillStyle(3244);

  var.ReplaceAll(".","");
  var.ReplaceAll("(","");
  var.ReplaceAll(")","");

  h_da->GetYaxis()->SetRangeUser(0.05,1.2*TMath::Max(h_da->GetBinContent(h_da->GetMaximumBin()), 
					      ((TH1*)(hs.GetStack()->Last()))->GetBinContent(((TH1*)(hs.GetStack()->Last()))->GetMaximumBin()) ));//3*
  h_da->GetXaxis()->SetTitle(var);
  h_da->SetTitle("");

  if (!norm) {
    h_da->Draw("PE");
    hs.Draw("same");
    h_da->Draw("PE,same");
    //h_hw->Draw("same");
    gerr->Draw("2");
  } else {
    h_da->Sumw2();
    h_da->DrawNormalized("PE");
    hs.DrawNormalized("same");
    //h_hw->DrawNormalized("same");
  }

  TLegend* leg = new TLegend(0.1,0.91,0.9,0.96);
  /*if (var.Contains("dPhi")) {
    delete leg;
    leg = new TLegend(0.55,0.11,0.88,0.31);
    }*/
  leg->SetFillColor(kWhite);
  leg->SetNColumns(5);
  leg->SetLineWidth(0);
  leg->SetLineColor(kWhite);
  leg->SetShadowColor(kWhite);
  leg->AddEntry(h_da,"SF data","p");
  leg->AddEntry(h_dy,Form("%2.1f x DY MC",dysf),"f");
  leg->AddEntry(h_of,"OF data","f");
  leg->AddEntry(h_wz,"VZ MC","f");
  //leg->AddEntry(h_hw,"HWW120","l");
  leg->Draw();

  c1.RedrawAxis();

  if (var.Contains("/")) var.ReplaceAll("/","");
  var = var+Form("_%ij",njets);

  gSystem->Exec("mkdir -p "+mycut+Form("_%ij_",njets)+fs);
  if (!norm) c1.SaveAs(mycut+Form("_%ij_",njets)+fs+"/"+var+".png");
  else c1.SaveAs(mycut+Form("_%ij_",njets)+fs+"/"+var+"_norm.png");
}
示例#12
0
void Plots(TString plots="4Jets", TString sys="", bool EvtNorm=false){
  
  /****************
        Style
  ****************/
  gROOT->SetStyle("Plain");
  gStyle->SetOptFit(1000);
  gStyle->SetOptStat("emruo");
  gStyle->SetOptStat(kFALSE);
  gStyle->SetPadTickY(1);
  gStyle->SetPadTickX(1);
  
  gROOT->ProcessLine(".L /home/brochero/ttbar/TopCodeljets/tdrStyle.C");
  setTDRStyle();
  
  Int_t chatch = 1756;
  TColor *color = new TColor(chatch, 0.3, 0.5, 0.5, "", 0.45); // alpha = 0.5
  TString files  = dirnameIn + fl;  
  
  /****************
       Channel
  ****************/
  TString channel[3];
  channel[0] = "mujets";
  channel[1] = "ejets";  
  channel[2] = "lepjet"; 
  
 
  /****************
        Data
  ****************/ 
  std::vector<histos> DataMu;
  DataMu = loadhistograms(plots, files + "_DataSingleMu");
  std::vector<histos> DataEG;
  DataEG = loadhistograms(plots, files + "_DataSingleEG");
  std::vector<histos> Data;
  Data = addhistograms(DataMu, DataEG);
  setuphistograms(Data, kBlack);

  /****************
    ttbar Signal
  ****************/ 
  std::vector<histos> ttbar_0;
  ttbar_0 = loadhistograms(plots, files + "_ttbar-PowhegPythia");
  setuphistograms(ttbar_0, kRed+1);

  std::vector<histos> ttbar_1;
  ttbar_1 = loadhistograms(plots, files + "_ttbar-MCatNLO");
  setuphistograms(ttbar_1, kRed+2);

  std::vector<histos> ttbar_2;
  ttbar_2 = loadhistograms(plots, files + "_ttbar-Madgraph");
  setuphistograms(ttbar_2, kRed+3);

  /****************
       Z+Jets
  ****************/ 
  std::vector<histos> ZJets;
  ZJets = loadhistograms(plots, files + "_ZJets");
  setuphistograms(ZJets, kAzure-2);

  /****************
         VV
  ****************/ 
  std::vector<histos> WW;
  WW = loadhistograms(plots, files + "_WW");
  std::vector<histos> WZ;
  WZ = loadhistograms(plots, files + "_WZ");
  std::vector<histos> ZZ;
  ZZ = loadhistograms(plots, files + "_ZZ");
  std::vector<histos> VV;
  VV = addhistograms(WW, WZ);
  VV = addhistograms(VV, ZZ);
  setuphistograms(VV, kYellow-3);

  /****************
     Single Top
  ****************/ 
  std::vector<histos> tW;
  tW = loadhistograms(plots, files + "_tW");
  std::vector<histos> tbarW;
  tbarW = loadhistograms(plots, files + "_tbarW");
  std::vector<histos> t_tch;
  t_tch = loadhistograms(plots, files + "_t-tchannel");
  std::vector<histos> tbar_tch;
  tbar_tch = loadhistograms(plots, files + "_tbar-tchannel");
  std::vector<histos> Single_top;
  Single_top = addhistograms(tW, tbarW);
  Single_top = addhistograms(Single_top, t_tch);
  Single_top = addhistograms(Single_top, tbar_tch);
  setuphistograms(Single_top, kPink-3);

  /****************
       W+Jets
  ****************/ 
  std::vector<histos> WJets;
  WJets = loadhistograms(plots, files + "_WJets");
  setuphistograms(WJets, kGreen-3);

  /****************
     ttbar Bkg
  ****************/ 
  std::vector<histos> ttbar_bkg;
  ttbar_bkg = loadhistograms(plots, files + "_ttbar-PowhegPythiaBkg");
  setuphistograms(ttbar_bkg, kViolet-3);

  /****************
        QCD
  ****************/ 
  std::vector<histos> QCD;
  QCD = loadhistograms(plots, files + "_QCD-MuEnr");
  setuphistograms(QCD, kOrange-3);

  /****************
       Stacks
  ****************/ 
  std::vector<histos> Stack_bkg;
  std::vector<histos> Stack;
  histos st_bkg;
  histos st;
  for(unsigned int h=0; h<WJets.size(); h++){
    TString variable;
    for(int ch=0; ch<3; ch++){
      st.mc[ch]     = new THStack(variable, "");
      st_bkg.mc[ch] = new THStack(variable, "");
      st.mc[ch]->SetHistogram( (TH1F*)WJets[h].hist[ch]->Clone());
      st_bkg.mc[ch]->SetHistogram( (TH1F*)WJets[h].hist[ch]->Clone());
    }
    Stack.push_back(st);
    Stack_bkg.push_back(st_bkg);
  }
  
  //-------------------------------------------------------
  // Background Stack
  Stack_bkg = addstack(Stack_bkg, WJets);
  Stack_bkg = addstack(Stack_bkg, QCD);
  Stack_bkg = addstack(Stack_bkg, Single_top);
  Stack_bkg = addstack(Stack_bkg, VV);
  Stack_bkg = addstack(Stack_bkg, ttbar_bkg);
  Stack_bkg = addstack(Stack_bkg, ZJets);

  //-------------------------------------------------------
  // Stack
  Stack = addstack(Stack, WJets);
  Stack = addstack(Stack, QCD);
  Stack = addstack(Stack, Single_top);
  Stack = addstack(Stack, VV);
  Stack = addstack(Stack, ttbar_bkg);
  Stack = addstack(Stack, ZJets);
  Stack = addstack(Stack, ttbar_0);

  //-------------------------------------------------------
  // other ttbar Generators
  ttbar_1 = addhistograms(ttbar_1, Stack_bkg);
  ttbar_2 = addhistograms(ttbar_2, Stack_bkg);

  
  /****************
     Draw Histos
  ****************/ 
  TCanvas *histocanvas;
  histocanvas = new TCanvas("plots", "Plots");
  
  for(unsigned int h=0; h<WJets.size(); h++){
    for(int ch=0; ch<3; ch++){
      
      histocanvas->Divide(1,2);
      
      TPad    *pad[2];
      //Plot Pad
      pad[0] = (TPad*)histocanvas->GetPad(1);
      pad[0]->SetPad(0.01, 0.23, 0.99, 0.99);
      pad[0]->SetTopMargin(0.1);
      pad[0]->SetRightMargin(0.04);
      
      //Ratio Pad
      pad[1] = (TPad*)histocanvas->GetPad(2);
      pad[1]->SetPad(0.01, 0.02, 0.99, 0.3);
      gStyle->SetGridWidth(0.5);
      gStyle->SetGridColor(14);
      pad[1]->SetGridx();
      pad[1]->SetGridy();
      pad[1]->SetTopMargin(0.05);
      pad[1]->SetBottomMargin(0.4);
      pad[1]->SetRightMargin(0.04);
      
      //-------------------------------------------------------
      // Stack
      pad[0]->cd();

      Stack[h].mc[ch]->Draw("hist");

      Stack[h].mc[ch]->GetYaxis()->SetTitle("Events");
      Stack[h].mc[ch]->GetYaxis()->SetTitleOffset(1.2);
      Stack[h].mc[ch]->GetYaxis()->SetTitleSize(0.07);
      Stack[h].mc[ch]->GetYaxis()->SetLabelSize(0.055);
      Stack[h].mc[ch]->GetYaxis()->SetNdivisions(607);
      //Stack[h].mc[ch]->GetYaxis()->SetLabelSize(0.05);
      TGaxis *hYaxis = (TGaxis*)Stack[h].mc[ch]->GetYaxis();
      //hYaxis->SetMaxDigits(3);
      Stack[h].mc[ch]->GetXaxis()->SetLabelSize(0.0);
      Stack[h].mc[ch]->GetXaxis()->SetTitle("");

      float maxh = Data[h].hist[ch]->GetMaximum();
      if(maxh < Stack[h].mc[ch]->GetMaximum()) maxh = Stack[h].mc[ch]->GetMaximum();
      Stack[h].mc[ch]->SetMaximum(1.7*maxh);
      
      //-------------------------------------------------------
      // Band error
      TGraphErrors *thegraph = new TGraphErrors(Stack[h].hist[ch]);
      thegraph->SetName("thegraph");
      thegraph->SetFillStyle(1001);
      thegraph->SetFillColor(chatch);
      thegraph->SetLineColor(chatch);

      thegraph->Draw("e2SAME");

      //-------------------------------------------------------
      // Other ttbar generators
      ttbar_1[h].hist[ch]->SetLineColor(6);
      ttbar_1[h].hist[ch]->SetLineStyle(2);
      ttbar_1[h].hist[ch]->SetFillColor(0);
      ttbar_1[h].hist[ch]->Draw("histoSAME");

      ttbar_2[h].hist[ch]->SetLineColor(8);
      ttbar_2[h].hist[ch]->SetLineStyle(4);
      ttbar_2[h].hist[ch]->SetFillColor(0);
      ttbar_2[h].hist[ch]->Draw("histoSAME");
      //-------------------------------------------------------
      // Data Histogram
      Data[h].hist[ch]->SetMarkerStyle(20);
      Data[h].hist[ch]->SetMarkerSize(0.7);

      Data[h].hist[ch]->Draw("SAME");

      /***********************
             Legends
      ***********************/
      TLegend *leg;
      float legx1=0.76;
      float legy1=0.54;
      float legx2=0.90;
      float legy2=0.87;
      leg = new TLegend(legx1,legy1,legx2,legy2);
      leg->SetFillColor(0);
      leg->SetLineColor(1);
      leg->SetTextFont(62);
      leg->SetTextSize(0.03);

      leg->AddEntry(Data[h].hist[ch],"Data","PL");
      leg->AddEntry(ttbar_0[h].hist[ch],"t#bar{t} Signal","F");
      leg->AddEntry(ZJets[h].hist[ch],"Z+Jets","F");
      leg->AddEntry(ttbar_bkg[h].hist[ch],"t#bar{t} Bkg","F");
      leg->AddEntry(VV[h].hist[ch],"VV","F");
      leg->AddEntry(Single_top[h].hist[ch],"Single t","F");
      leg->AddEntry(QCD[h].hist[ch],"QCD","F");
      leg->AddEntry(WJets[h].hist[ch],"W+Jets","F");
      leg->AddEntry("thegraph","Uncertainty","F");
      leg->AddEntry((TObject*)0,"","");
      leg->AddEntry(ttbar_1[h].hist[ch],"MC@NLO","L");
      leg->AddEntry(ttbar_2[h].hist[ch],"Madgraph","L");

      leg->Draw("SAME");
      //-------------------------------------------------------
      // CMS
      TString htitleCMSChannel[3];
      htitleCMSChannel[0] = "#mu^{#pm}+jets channel";
      htitleCMSChannel[1] = "e^{#pm}+jets channel";
      htitleCMSChannel[2] = "l^{#pm}+jets channel";
      
      titlePr  = new TLatex(-20.,50.,"Preliminary");
      titlePr->SetNDC();
      titlePr->SetTextAlign(12);
      titlePr->SetX(0.25);
      titlePr->SetY(0.93);
      titlePr->SetTextColor(2);
      titlePr->SetTextFont(42);
      titlePr->SetTextSize(0.05);
      titlePr->SetTextSizePixels(24);
      titlePr->Draw("SAME");
      
      title  = new TLatex(-20.,50.,"CMS #sqrt{s} = 13TeV, L = 42 pb^{-1}(50ns)");
      title->SetNDC();
      title->SetTextAlign(12);
      title->SetX(0.20);
      title->SetY(0.83);
      title->SetTextFont(42);
      title->SetTextSize(0.05);
      title->SetTextSizePixels(24);
      title->Draw("SAME");
      
      chtitle  = new TLatex(-20.,50.,htitleCMSChannel[ch]);
      chtitle->SetNDC();
      chtitle->SetTextAlign(12);
      chtitle->SetX(0.20);
      chtitle->SetY(0.75);
      chtitle->SetTextFont(42);
      chtitle->SetTextSize(0.05);
      chtitle->SetTextSizePixels(24);
      chtitle->Draw("SAME");

      /***********************
               Ratio
      ***********************/    
      pad[1]->cd();
      
      //-------------------------------------------------------
      //Graph Ratio Clone
      TH1F *Ratio;
      Ratio = (TH1F*)Data[h].hist[ch]->Clone();
      Ratio->Divide(Stack[h].hist[ch]);

      TH1F *RatioSyst;
      RatioSyst = (TH1F*)Data[h].hist[ch]->Clone();
      RatioSyst->Divide(Stack[h].hist[ch]); // Should be the histogram with the Total Syst. Unc.
      std::vector<double> ratioContent;
      for(unsigned int b_r = 1; b_r <= RatioSyst->GetNbinsX(); b_r++){
	RatioSyst->SetBinContent(b_r,1.0);
	//RatioSyst->SetBinError(b_r,0.15); // Tempotal!!!
      }      

      Ratio->SetMarkerStyle(20);
      Ratio->SetMarkerSize(0.5);
      Ratio->SetMarkerColor(1);
      Ratio->SetLineColor(1);
      Ratio->SetLineWidth(1);
      Ratio->SetMaximum(2);
      Ratio->SetMinimum(0);
      Ratio->SetTitle("");
      
      Ratio->GetYaxis()->SetTitle("Obs/Exp");
      Ratio->GetYaxis()->CenterTitle();
      Ratio->GetYaxis()->SetTitleOffset(0.45);
      Ratio->GetYaxis()->SetTitleSize(0.16);
      Ratio->GetYaxis()->SetLabelSize(0.15);
      Ratio->GetYaxis()->SetNdivisions(402);
      Ratio->GetXaxis()->SetNdivisions(509);
      Ratio->GetXaxis()->SetTitleOffset(1.1);
      Ratio->GetXaxis()->SetLabelSize(0.20);
      Ratio->GetXaxis()->SetTitleSize(0.16);
      
      Ratio->SetMinimum(0.6);
      Ratio->SetMaximum(1.4);
      
      TGraphErrors *thegraphRatioSyst = new TGraphErrors(RatioSyst);
      thegraphRatioSyst->SetFillStyle(1001);
      thegraphRatioSyst->SetFillColor(chatch);
      thegraphRatioSyst->SetName("thegraphRatioSyst");
      
      //-------------------------------------------------------
      //Graph Ratio other ttbar generators
      TH1F *Ratio_1;
      Ratio_1 = (TH1F*)Data[h].hist[ch]->Clone();
      Ratio_1->Divide(ttbar_1[h].hist[ch]);
      Ratio_1->SetLineColor(6);
      Ratio_1->SetLineStyle(2);
      Ratio_1->SetLineWidth(2);
      Ratio_1->SetFillColor(0);

      TH1F *Ratio_2;
      Ratio_2 = (TH1F*)Data[h].hist[ch]->Clone();
      Ratio_2->Divide(ttbar_2[h].hist[ch]);
      Ratio_2->SetLineColor(8);
      Ratio_2->SetLineStyle(4);
      Ratio_2->SetLineWidth(2);
      Ratio_2->SetFillColor(0);

      //-------------------------------------------------------
      // Draw Ratios
      Ratio->Draw();
      thegraphRatioSyst->Draw("e2");
      Ratio->Draw("histpSAME");
      Ratio_1->Draw("histSAME");
      Ratio_2->Draw("histSAME");
            
      /***********************
            Save Histos
      ***********************/    
      TString dirfigname_pdf=dirnameIn + "figures_" + fl + "/pdf/";
      // make a dir if it does not exist!!
      gSystem->mkdir(dirfigname_pdf,       kTRUE);
      histocanvas->SaveAs(dirfigname_pdf + WJets[h].hist[ch]->GetName() + ".pdf");
      
      // clear Canvas
      histocanvas->Clear();    

    }
  }
  
} //end Plots.C
示例#13
0
void acceptance_mass()
{
//=========Macro generated from canvas: c2/c2
//=========  (Mon Oct 26 11:11:00 2015) by ROOT version6.02/05
   TCanvas *c2 = new TCanvas("c2", "c2",20,42,700,500);
   gStyle->SetOptStat(0);
   c2->Range(-1.3125,-0.025,9.8125,0.225);
   c2->SetFillColor(0);
   c2->SetBorderMode(0);
   c2->SetBorderSize(2);
   c2->SetFrameBorderMode(0);
   c2->SetFrameBorderMode(0);
   
   TH2F *dummy42 = new TH2F("dummy42","dummy4",178,-0.2,8.7,100,0,0.2);
   dummy42->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#000099");
   dummy42->SetLineColor(ci);
   dummy42->GetXaxis()->SetTitle("Mass [GeV]");
   dummy42->GetXaxis()->SetLabelFont(42);
   dummy42->GetXaxis()->SetLabelSize(0.035);
   dummy42->GetXaxis()->SetTitleSize(0.035);
   dummy42->GetXaxis()->SetTitleFont(42);
   dummy42->GetYaxis()->SetTitle("#epsilon_{rec} = N_{rec}/N_{tot}");
   dummy42->GetYaxis()->SetLabelFont(42);
   dummy42->GetYaxis()->SetLabelSize(0.035);
   dummy42->GetYaxis()->SetTitleSize(0.035);
   dummy42->GetYaxis()->SetTitleFont(42);
   dummy42->GetZaxis()->SetLabelFont(42);
   dummy42->GetZaxis()->SetLabelSize(0.035);
   dummy42->GetZaxis()->SetTitleSize(0.035);
   dummy42->GetZaxis()->SetTitleFont(42);
   dummy42->Draw("");
   
   Double_t Graph0_fx1006[5] = {
   0.25,
   0.275,
   0.3,
   2,
   8.5};
   Double_t Graph0_fy1006[5] = {
   0.0865404,
   0.08208333,
   0.0749858,
   0.05958333,
   0.1375897};
   Double_t Graph0_fex1006[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t Graph0_fey1006[5] = {
   0.0009990599,
   0.0009753636,
   0.0009926071,
   0.0008541653,
   0.001244048};
   TGraphErrors *gre = new TGraphErrors(5,Graph0_fx1006,Graph0_fy1006,Graph0_fex1006,Graph0_fey1006);
   gre->SetName("Graph0");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);
   gre->SetMarkerStyle(7);
   gre->SetMarkerSize(5);
   
   TH1F *Graph_Graph1006 = new TH1F("Graph_Graph1006","Graph",100,0,9.325);
   Graph_Graph1006->SetMinimum(0.05071871);
   Graph_Graph1006->SetMaximum(0.1468442);
   Graph_Graph1006->SetDirectory(0);
   Graph_Graph1006->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1006->SetLineColor(ci);
   Graph_Graph1006->GetXaxis()->SetLabelFont(42);
   Graph_Graph1006->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1006->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1006->GetXaxis()->SetTitleFont(42);
   Graph_Graph1006->GetYaxis()->SetLabelFont(42);
   Graph_Graph1006->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1006->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1006->GetYaxis()->SetTitleFont(42);
   Graph_Graph1006->GetZaxis()->SetLabelFont(42);
   Graph_Graph1006->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1006->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1006->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1006);
   
   gre->Draw(" pl");
   
   Double_t Graph1_fx1007[4] = {
   0.25,
   0.275,
   2,
   8.5};
   Double_t Graph1_fy1007[4] = {
   0.08294682,
   0.07862374,
   0.06207908,
   0.137474};
   Double_t Graph1_fex1007[4] = {
   0,
   0,
   0,
   0};
   Double_t Graph1_fey1007[4] = {
   0.0009899688,
   0.000956385,
   0.0008617826,
   0.001242555};
   gre = new TGraphErrors(4,Graph1_fx1007,Graph1_fy1007,Graph1_fex1007,Graph1_fey1007);
   gre->SetName("Graph1");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);
   gre->SetLineColor(2);
   gre->SetMarkerColor(2);
   gre->SetMarkerStyle(7);
   gre->SetMarkerSize(5);
   
   TH1F *Graph_Graph1007 = new TH1F("Graph_Graph1007","Graph",100,0,9.325);
   Graph_Graph1007->SetMinimum(0.05346738);
   Graph_Graph1007->SetMaximum(0.1464664);
   Graph_Graph1007->SetDirectory(0);
   Graph_Graph1007->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1007->SetLineColor(ci);
   Graph_Graph1007->GetXaxis()->SetLabelFont(42);
   Graph_Graph1007->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1007->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1007->GetXaxis()->SetTitleFont(42);
   Graph_Graph1007->GetYaxis()->SetLabelFont(42);
   Graph_Graph1007->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1007->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1007->GetYaxis()->SetTitleFont(42);
   Graph_Graph1007->GetZaxis()->SetLabelFont(42);
   Graph_Graph1007->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1007->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1007->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1007);
   
   gre->Draw(" pl");
   
   Double_t Graph2_fx1008[5] = {
   0.25,
   0.275,
   0.3,
   2,
   8.5};
   Double_t Graph2_fy1008[5] = {
   0.06949495,
   0.06748737,
   0.0642268,
   0.06051768,
   0.1364046};
   Double_t Graph2_fex1008[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t Graph2_fey1008[5] = {
   0.0009035941,
   0.000891407,
   0.0008800606,
   0.000847272,
   0.00123208};
   gre = new TGraphErrors(5,Graph2_fx1008,Graph2_fy1008,Graph2_fex1008,Graph2_fey1008);
   gre->SetName("Graph2");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);
   gre->SetLineColor(3);
   gre->SetMarkerColor(3);
   gre->SetMarkerStyle(7);
   gre->SetMarkerSize(5);
   
   TH1F *Graph_Graph1008 = new TH1F("Graph_Graph1008","Graph",100,0,9.325);
   Graph_Graph1008->SetMinimum(0.05187377);
   Graph_Graph1008->SetMaximum(0.1454334);
   Graph_Graph1008->SetDirectory(0);
   Graph_Graph1008->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1008->SetLineColor(ci);
   Graph_Graph1008->GetXaxis()->SetLabelFont(42);
   Graph_Graph1008->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1008->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1008->GetXaxis()->SetTitleFont(42);
   Graph_Graph1008->GetYaxis()->SetLabelFont(42);
   Graph_Graph1008->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1008->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1008->GetYaxis()->SetTitleFont(42);
   Graph_Graph1008->GetZaxis()->SetLabelFont(42);
   Graph_Graph1008->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1008->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1008->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1008);
   
   gre->Draw(" pl");
   
   Double_t Graph3_fx1009[5] = {
   0.25,
   0.275,
   0.3,
   2,
   8.5};
   Double_t Graph3_fy1009[5] = {
   0.04645202,
   0.04597222,
   0.04502717,
   0.05941919,
   0.1359975};
   Double_t Graph3_fex1009[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t Graph3_fey1009[5] = {
   0.000747844,
   0.0007441589,
   0.0007643529,
   0.0008400378,
   0.001218037};
   gre = new TGraphErrors(5,Graph3_fx1009,Graph3_fy1009,Graph3_fex1009,Graph3_fey1009);
   gre->SetName("Graph3");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);
   gre->SetLineColor(4);
   gre->SetMarkerColor(4);
   gre->SetMarkerStyle(7);
   gre->SetMarkerSize(5);
   
   TH1F *Graph_Graph1009 = new TH1F("Graph_Graph1009","Graph",100,0,9.325);
   Graph_Graph1009->SetMinimum(0.03496755);
   Graph_Graph1009->SetMaximum(0.1465108);
   Graph_Graph1009->SetDirectory(0);
   Graph_Graph1009->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1009->SetLineColor(ci);
   Graph_Graph1009->GetXaxis()->SetLabelFont(42);
   Graph_Graph1009->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1009->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1009->GetXaxis()->SetTitleFont(42);
   Graph_Graph1009->GetYaxis()->SetLabelFont(42);
   Graph_Graph1009->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1009->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1009->GetYaxis()->SetTitleFont(42);
   Graph_Graph1009->GetZaxis()->SetLabelFont(42);
   Graph_Graph1009->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1009->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1009->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1009);
   
   gre->Draw(" pl");
   
   Double_t Graph4_fx1010[5] = {
   0.25,
   0.275,
   0.3,
   2,
   8.5};
   Double_t Graph4_fy1010[5] = {
   0.0157633,
   0.01659091,
   0.01693182,
   0.05516582,
   0.1364646};
   Double_t Graph4_fex1010[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t Graph4_fey1010[5] = {
   0.0004493916,
   0.0004538785,
   0.0004584384,
   0.0008153701,
   0.001219797};
   gre = new TGraphErrors(5,Graph4_fx1010,Graph4_fy1010,Graph4_fex1010,Graph4_fey1010);
   gre->SetName("Graph4");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);
   gre->SetLineColor(6);
   gre->SetMarkerColor(6);
   gre->SetMarkerStyle(7);
   gre->SetMarkerSize(5);
   
   TH1F *Graph_Graph1010 = new TH1F("Graph_Graph1010","Graph",100,0,9.325);
   Graph_Graph1010->SetMinimum(0.003076858);
   Graph_Graph1010->SetMaximum(0.1499215);
   Graph_Graph1010->SetDirectory(0);
   Graph_Graph1010->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1010->SetLineColor(ci);
   Graph_Graph1010->GetXaxis()->SetLabelFont(42);
   Graph_Graph1010->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1010->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1010->GetXaxis()->SetTitleFont(42);
   Graph_Graph1010->GetYaxis()->SetLabelFont(42);
   Graph_Graph1010->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1010->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1010->GetYaxis()->SetTitleFont(42);
   Graph_Graph1010->GetZaxis()->SetLabelFont(42);
   Graph_Graph1010->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1010->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1010->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1010);
   
   gre->Draw(" pl");
   
   Double_t Graph5_fx1011[4] = {
   0.25,
   0.275,
   2,
   8.5};
   Double_t Graph5_fy1011[4] = {
   0.005542929,
   0.005892857,
   0.04303571,
   0.132096};
   Double_t Graph5_fex1011[4] = {
   0,
   0,
   0,
   0};
   Double_t Graph5_fey1011[4] = {
   0.0002638154,
   0.0002733515,
   0.0007247769,
   0.001203145};
   gre = new TGraphErrors(4,Graph5_fx1011,Graph5_fy1011,Graph5_fex1011,Graph5_fey1011);
   gre->SetName("Graph5");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);
   gre->SetLineColor(7);
   gre->SetMarkerColor(7);
   gre->SetMarkerStyle(7);
   gre->SetMarkerSize(5);
   
   TH1F *Graph_Graph1011 = new TH1F("Graph_Graph1011","Graph",100,0,9.325);
   Graph_Graph1011->SetMinimum(0);
   Graph_Graph1011->SetMaximum(0.1461011);
   Graph_Graph1011->SetDirectory(0);
   Graph_Graph1011->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1011->SetLineColor(ci);
   Graph_Graph1011->GetXaxis()->SetLabelFont(42);
   Graph_Graph1011->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1011->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1011->GetXaxis()->SetTitleFont(42);
   Graph_Graph1011->GetYaxis()->SetLabelFont(42);
   Graph_Graph1011->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1011->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1011->GetYaxis()->SetTitleFont(42);
   Graph_Graph1011->GetZaxis()->SetLabelFont(42);
   Graph_Graph1011->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1011->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1011->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1011);
   
   gre->Draw(" pl");
   
   Double_t Graph6_fx1012[5] = {
   0.25,
   0.275,
   0.3,
   2,
   8.5};
   Double_t Graph6_fy1012[5] = {
   0.00155303,
   0.001868687,
   0.002222281,
   0.02356061,
   0.1211862};
   Double_t Graph6_fex1012[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t Graph6_fey1012[5] = {
   0.0001399232,
   0.0001534615,
   0.0001707546,
   0.000538956,
   0.001165513};
   gre = new TGraphErrors(5,Graph6_fx1012,Graph6_fy1012,Graph6_fex1012,Graph6_fey1012);
   gre->SetName("Graph6");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);
   gre->SetLineColor(8);
   gre->SetMarkerColor(8);
   gre->SetMarkerStyle(7);
   gre->SetMarkerSize(5);
   
   TH1F *Graph_Graph1012 = new TH1F("Graph_Graph1012","Graph",100,0,9.325);
   Graph_Graph1012->SetMinimum(0);
   Graph_Graph1012->SetMaximum(0.1344456);
   Graph_Graph1012->SetDirectory(0);
   Graph_Graph1012->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1012->SetLineColor(ci);
   Graph_Graph1012->GetXaxis()->SetLabelFont(42);
   Graph_Graph1012->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1012->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1012->GetXaxis()->SetTitleFont(42);
   Graph_Graph1012->GetYaxis()->SetLabelFont(42);
   Graph_Graph1012->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1012->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1012->GetYaxis()->SetTitleFont(42);
   Graph_Graph1012->GetZaxis()->SetLabelFont(42);
   Graph_Graph1012->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1012->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1012->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1012);
   
   gre->Draw(" pl");
   
   Double_t Graph7_fx1013[4] = {
   0.25,
   0.275,
   2,
   8.5};
   Double_t Graph7_fy1013[4] = {
   0.0009974747,
   0.0009974747,
   0.01513298,
   0.1061111};
   Double_t Graph7_fex1013[4] = {
   0,
   0,
   0,
   0};
   Double_t Graph7_fey1013[4] = {
   0.0001121687,
   0.0001121687,
   0.0004451866,
   0.001147773};
   gre = new TGraphErrors(4,Graph7_fx1013,Graph7_fy1013,Graph7_fex1013,Graph7_fey1013);
   gre->SetName("Graph7");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);
   gre->SetLineColor(9);
   gre->SetMarkerColor(9);
   gre->SetMarkerStyle(7);
   gre->SetMarkerSize(5);
   
   TH1F *Graph_Graph1013 = new TH1F("Graph_Graph1013","Graph",100,0,9.325);
   Graph_Graph1013->SetMinimum(0);
   Graph_Graph1013->SetMaximum(0.1178962);
   Graph_Graph1013->SetDirectory(0);
   Graph_Graph1013->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1013->SetLineColor(ci);
   Graph_Graph1013->GetXaxis()->SetLabelFont(42);
   Graph_Graph1013->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1013->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1013->GetXaxis()->SetTitleFont(42);
   Graph_Graph1013->GetYaxis()->SetLabelFont(42);
   Graph_Graph1013->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1013->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1013->GetYaxis()->SetTitleFont(42);
   Graph_Graph1013->GetZaxis()->SetLabelFont(42);
   Graph_Graph1013->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1013->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1013->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1013);
   
   gre->Draw(" pl");
   
   Double_t Graph8_fx1014[5] = {
   0.25,
   0.275,
   0.3,
   2,
   8.5};
   Double_t Graph8_fy1014[5] = {
   0.0002651515,
   0.0004419192,
   0.0003815789,
   0.006989796,
   0.07766414};
   Double_t Graph8_fex1014[5] = {
   0,
   0,
   0,
   0,
   0};
   Double_t Graph8_fey1014[5] = {
   5.785313e-05,
   7.468147e-05,
   7.084391e-05,
   0.0002975439,
   0.0009510256};
   gre = new TGraphErrors(5,Graph8_fx1014,Graph8_fy1014,Graph8_fex1014,Graph8_fey1014);
   gre->SetName("Graph8");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);
   gre->SetLineColor(40);
   gre->SetMarkerColor(40);
   gre->SetMarkerStyle(7);
   gre->SetMarkerSize(5);
   
   TH1F *Graph_Graph1014 = new TH1F("Graph_Graph1014","Graph",100,0,9.325);
   Graph_Graph1014->SetMinimum(0);
   Graph_Graph1014->SetMaximum(0.08645595);
   Graph_Graph1014->SetDirectory(0);
   Graph_Graph1014->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1014->SetLineColor(ci);
   Graph_Graph1014->GetXaxis()->SetLabelFont(42);
   Graph_Graph1014->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1014->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1014->GetXaxis()->SetTitleFont(42);
   Graph_Graph1014->GetYaxis()->SetLabelFont(42);
   Graph_Graph1014->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1014->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1014->GetYaxis()->SetTitleFont(42);
   Graph_Graph1014->GetZaxis()->SetLabelFont(42);
   Graph_Graph1014->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1014->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1014->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1014);
   
   gre->Draw(" pl");
   
   Double_t Graph9_fx1015[2] = {
   0.25,
   2};
   Double_t Graph9_fy1015[2] = {
   6.47017e-05,
   0.002367956};
   Double_t Graph9_fex1015[2] = {
   0,
   0};
   Double_t Graph9_fey1015[2] = {
   1.3794e-05,
   6.810597e-05};
   gre = new TGraphErrors(2,Graph9_fx1015,Graph9_fy1015,Graph9_fex1015,Graph9_fey1015);
   gre->SetName("Graph9");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);
   gre->SetMarkerStyle(7);
   gre->SetMarkerSize(5);
   
   TH1F *Graph_Graph1015 = new TH1F("Graph_Graph1015","Graph",100,0.075,2.175);
   Graph_Graph1015->SetMinimum(0);
   Graph_Graph1015->SetMaximum(0.002674577);
   Graph_Graph1015->SetDirectory(0);
   Graph_Graph1015->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1015->SetLineColor(ci);
   Graph_Graph1015->GetXaxis()->SetLabelFont(42);
   Graph_Graph1015->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1015->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1015->GetXaxis()->SetTitleFont(42);
   Graph_Graph1015->GetYaxis()->SetLabelFont(42);
   Graph_Graph1015->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1015->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1015->GetYaxis()->SetTitleFont(42);
   Graph_Graph1015->GetZaxis()->SetLabelFont(42);
   Graph_Graph1015->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1015->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1015->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1015);
   
   gre->Draw(" pl");
   
   Double_t Graph10_fx1016[2] = {
   0.25,
   2};
   Double_t Graph10_fy1016[2] = {
   2.397917e-05,
   0.0007142042};
   Double_t Graph10_fex1016[2] = {
   0,
   0};
   Double_t Graph10_fey1016[2] = {
   9.063167e-06,
   4.035479e-05};
   gre = new TGraphErrors(2,Graph10_fx1016,Graph10_fy1016,Graph10_fex1016,Graph10_fey1016);
   gre->SetName("Graph10");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);
   gre->SetMarkerStyle(7);
   gre->SetMarkerSize(5);
   
   TH1F *Graph_Graph1016 = new TH1F("Graph_Graph1016","Graph",100,0.075,2.175);
   Graph_Graph1016->SetMinimum(0);
   Graph_Graph1016->SetMaximum(0.0008285233);
   Graph_Graph1016->SetDirectory(0);
   Graph_Graph1016->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1016->SetLineColor(ci);
   Graph_Graph1016->GetXaxis()->SetLabelFont(42);
   Graph_Graph1016->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1016->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1016->GetXaxis()->SetTitleFont(42);
   Graph_Graph1016->GetYaxis()->SetLabelFont(42);
   Graph_Graph1016->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1016->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1016->GetYaxis()->SetTitleFont(42);
   Graph_Graph1016->GetZaxis()->SetLabelFont(42);
   Graph_Graph1016->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1016->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1016->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1016);
   
   gre->Draw(" pl");
   
   TLegend *leg = new TLegend(0.158046,0.5369979,0.5071839,0.8372093,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextSize(0.045);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   TLegendEntry *entry=leg->AddEntry("Graph0","c#Tau=0.00 mm","PL");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(7);
   entry->SetMarkerSize(5);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph1","c#Tau=0.05 mm","PL");
   entry->SetLineColor(2);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(2);
   entry->SetMarkerStyle(7);
   entry->SetMarkerSize(5);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph2","c#Tau=0.10 mm","PL");
   entry->SetLineColor(3);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(3);
   entry->SetMarkerStyle(7);
   entry->SetMarkerSize(5);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph3","c#Tau=0.20 mm","PL");
   entry->SetLineColor(4);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(4);
   entry->SetMarkerStyle(7);
   entry->SetMarkerSize(5);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph4","c#Tau=0.50 mm","PL");
   entry->SetLineColor(6);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(6);
   entry->SetMarkerStyle(7);
   entry->SetMarkerSize(5);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph5","c#Tau=1.00 mm","PL");
   entry->SetLineColor(7);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(7);
   entry->SetMarkerStyle(7);
   entry->SetMarkerSize(5);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph6","c#Tau=2.00 mm","PL");
   entry->SetLineColor(8);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(8);
   entry->SetMarkerStyle(7);
   entry->SetMarkerSize(5);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph7","c#Tau=3.00 mm","PL");
   entry->SetLineColor(9);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(9);
   entry->SetMarkerStyle(7);
   entry->SetMarkerSize(5);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph8","c#Tau=5.00 mm","PL");
   entry->SetLineColor(40);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(40);
   entry->SetMarkerStyle(7);
   entry->SetMarkerSize(5);
   entry->SetTextFont(42);
   leg->Draw();
   
   TPaveText *pt = new TPaveText(0.4195977,0.9339831,0.5804023,0.995,"blNDC");
   pt->SetName("title");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetFillStyle(0);
   pt->SetTextFont(42);
   TText *AText = pt->AddText("dummy4");
   pt->Draw();
   c2->Modified();
   c2->cd();
   c2->SetSelected(c2);
}
示例#14
0
void printBfraction(char *tagger="discr_ssvHighEff", Double_t workingPoint=2, char *taggerName="ssvHighEff", int doCent=2, int do3bin=1) {

  gROOT->ForceStyle(1);

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


  gStyle->SetTextFont(42);
  gStyle->SetLabelFont(42,"XYZ");
  gStyle->SetTitleFont(42,"XYZ");

  // hack
  if(doCent)gStyle->SetErrorX(0);
  gStyle->SetLabelSize(0.05,"xy");
  gStyle->SetTitleSize(0.05,"xy");
  gStyle->SetTitleOffset(1.5,"xy");
  gStyle->SetPadLeftMargin(0.15);
  gStyle->SetPadBottomMargin(0.12);
  gStyle->SetNdivisions(408,"y");


  TFile *fin1, *fin2;
  if(doCent){
    if(doCent==1){
      fin1 = new TFile("output/bFractionMerged_SSVHEat2.0FixCL1_centDep_80_100.root");
      fin2 = new TFile("output/bFractionMerged_SSVHEat2.0FixCL0_centDep_80_100.root");
    }
    if(doCent==2){
      fin1 = new TFile("output/bFractionMerged_SSVHEat2.0FixCL1_centDep_100_120.root");
      fin2 = new TFile("output/bFractionMerged_SSVHEat2.0FixCL0_centDep_100_120.root");
    }
    // broken
    //fin1 = new TFile("output/bFractionMerged_ssvHighEffat2.0FixCL1_centDep_80_100.root");
    //fin2 = new TFile("output/bFractionMerged_ssvHighEffat2.0FixCL0_centDep_80_100.root");
  }
  else{
    // try to smear by 2 sigma
    //fin1 = new TFile("output/bFractionMerged_Smear2Sigma_SSVHEat2.0FixCL1_bin_0_40_eta_0_2.root");
    //fin2 = new TFile("output/bFractionMerged_Smear2Sigma_SSVHEat2.0FixCL0_bin_0_40_eta_0_2.root");
    // with reg tracks in reco jets
    //fin1 = new TFile("output/bFractionMerged_regPFJets_SSVHEat2.0FixCL1_bin_0_40_eta_0_2.root");
    //fin2 = new TFile("output/bFractionMerged_regPFJets_SSVHEat2.0FixCL0_bin_0_40_eta_0_2.root");
    if(do3bin){
      fin1 = new TFile("output/bFractionMerged_3bins_SSVHEat2.0FixCL1_bin_0_40_eta_0_2.root");
      fin2 = new TFile("output/bFractionMerged_3bins_SSVHEat2.0FixCL0_bin_0_40_eta_0_2.root");
    }
    else{
      fin1 = new TFile("output/bFractionMerged_SSVHEat2.0FixCL1_bin_0_40_eta_0_2.root");
      fin2 = new TFile("output/bFractionMerged_SSVHEat2.0FixCL0_bin_0_40_eta_0_2.root");
      // old naming convention
    //fin1 = new TFile("output/bFractionMerged_ssvHighEffat2.0FixCL1_bin_0_40_eta_0_2.root");
    //fin2 = new TFile("output/bFractionMerged_ssvHighEffat2.0FixCL0_bin_0_40_eta_0_2.root");

    }
  }

  TH1F *hBFractionMC = (TH1F*) fin1->Get("hBFractionMC");

  TH1F *hBFractionData = (TH1F*) fin1->Get("hBFractionData");
  TH1F *hBFractionDataLTJP = (TH1F*) fin1->Get("hBFractionDataLTJP");
  TH1F *hBFractionJPdirect = (TH1F*) fin1->Get("hBFractionJPdirect");

  TH1F *hBFractionDataFixC = (TH1F*) fin2->Get("hBFractionData");
  TH1F *hBFractionDataLTJPFixC = (TH1F*) fin2->Get("hBFractionDataLTJP");
  TH1F *hBFractionJPdirectFixC = (TH1F*) fin2->Get("hBFractionJPdirect");

  


  /*  --- correction due to Jet Energy Scale (calcul) ---
  correct(hBFractionMC);
  correct(hBFractionData);
  correct(hBFractionDataMoreC);
  correct(hBFractionDataLessC);
  correct(hBFractionDataLTJP);
  correct(hBFractionDataLTJPMoreC);
  correct(hBFractionDataLTJPLessC);
  correct(hBFractionJPdirect);
  correct(hBFractionJPdirectMoreC);
  correct(hBFractionJPdirectLessC);
  //*/

  //*  --- correction due to Jet Energy Scale (by hand) ---
  if(doCent){
    correctByCent(hBFractionMC,doCent);
    correctByCent(hBFractionData,doCent);
    correctByCent(hBFractionDataFixC,doCent);
    correctByCent(hBFractionDataLTJP,doCent);
    correctByCent(hBFractionDataLTJPFixC,doCent);
    correctByCent(hBFractionJPdirect,doCent);
    correctByCent(hBFractionJPdirectFixC,doCent);
  }
  else{
    //*
    correct2(hBFractionMC,do3bin);
    correct2(hBFractionData,do3bin);
    correct2(hBFractionDataFixC,do3bin);
    correct2(hBFractionDataLTJP,do3bin);
    correct2(hBFractionDataLTJPFixC,do3bin);
    correct2(hBFractionJPdirect,do3bin);
    correct2(hBFractionJPdirectFixC,do3bin);
    //*/
  }
  //*/

  //  --- plots with variation of charm ---


  TCanvas *cBFraction1 = new TCanvas("cBFraction1","b-jet fraction",600,600);
  hBFractionMC->SetLineColor(2);
  hBFractionMC->SetLineWidth(2);
  hBFractionMC->SetMarkerColor(2);
  //hBFractionMC->SetMarkerStyle(4);
  if(!doCent)hBFractionMC->SetAxisRange(80,200,"X");
  hBFractionMC->SetAxisRange(0,0.06,"Y");
  hBFractionMC->SetTitleOffset(1,"X");  
  hBFractionMC->GetYaxis()->SetTitle("b-jet fraction");;
  //hBFractionMC->Draw("e1"); 
  
  //hBFractionMC->GetYaxis()->SetNdivisions(505);
  
  TH1F *hBFractionMC_dummy= (TH1F*)hBFractionMC->Clone("hBFractionMC_dummy");
  hBFractionMC_dummy->SetLineWidth(0);
  hBFractionMC_dummy->SetLineColor(0);
  hBFractionMC_dummy->SetMarkerSize(0);
  hBFractionMC_dummy->Draw(); 
  //  hBFractionMC->Draw("hist"); 

  hBFractionData->SetMarkerStyle(8);
  hBFractionData->Draw("e1,same");  
  hBFractionDataLTJP->SetLineColor(kGreen-2); 
  hBFractionDataLTJP->SetMarkerColor(kGreen-2); 
  hBFractionDataLTJP->SetMarkerStyle(8); 
  hBFractionDataLTJP->Draw("e1,same");
  hBFractionJPdirect->SetMarkerStyle(8); 
  hBFractionJPdirect->SetMarkerColor(kBlue);
  hBFractionJPdirect->SetLineColor(kBlue);
  hBFractionJPdirect->Draw("e1,same");

  
  hBFractionDataFixC->SetLineStyle(2);
  //hBFractionDataFixC->Draw("e1same");   
  hBFractionDataLTJPFixC->SetLineColor(kGreen-2);
  hBFractionDataLTJPFixC->SetMarkerColor(kGreen-2);
  hBFractionDataLTJPFixC->SetMarkerStyle(4);
  hBFractionDataLTJPFixC->SetLineStyle(2);
  hBFractionDataLTJPFixC->Draw("e1same");
  hBFractionJPdirectFixC->SetLineStyle(2);
  //hBFractionJPdirectFixC->Draw("e1same");

  
  TLegend *legFrac1 = new TLegend(0.15,0.65,0.87,0.95);

  legFrac1->SetBorderSize(0);
  legFrac1->SetFillStyle(0);
  legFrac1->SetHeader("PbPb, #sqrt{s_{NN}} = 2.76 TeV");
  legFrac1->AddEntry(hBFractionDataLTJP,Form("SSVHE, LT method",taggerName,workingPoint),"pl");
  legFrac1->AddEntry(hBFractionDataLTJPFixC,Form("SSVHE, LT method, Floating Charm Norm.",taggerName,workingPoint),"pl");
  legFrac1->AddEntry(hBFractionData,Form("SSVHE, MC eff.",taggerName,workingPoint),"pl");
  legFrac1->AddEntry(hBFractionJPdirect,"Jet Probability","pl");
  //legFrac1->AddEntry(hBFractionMC,"MC Input (reconstructed)","l");

  legFrac1->Draw();




  //  --- plots of LT method with syst. uncertainty ---

  TCanvas *cBFraction2 = new TCanvas("cBFraction2","b-jet fraction",600,600);

  TH1F *hBFractionMC2 = hBFractionMC->Clone("hBFractionMC2");
  if(!doCent)hBFractionMC2->GetXaxis()->SetRangeUser(80,200);
  hBFractionMC2->SetMarkerSize(0);
  hBFractionMC2->SetMaximum(0.06);
  hBFractionMC2->SetMinimum(0.0);
  hBFractionMC2->Draw("hist");


  TGraphAsymmErrors *gBFractionMC2 = new TGraphAsymmErrors(hBFractionMC);
  if(!doCent){
    setMeanPt(gBFractionMC2,hBFractionMC,0,do3bin);
    gBFractionMC2->GetXaxis()->SetRangeUser(80,200);
  }



  TLatex *prel;
  if(doCent)prel= new TLatex(10,0.0615,"CMS preliminary");
  else prel= new TLatex(85,0.0615,"CMS preliminary");
  prel->Draw();

  TLatex *roots = new TLatex(147,0.0615,"#sqrt{s_{NN}} = 2.76 TeV");
  roots->Draw();

  if(!doCent){
    TLatex *csel = new TLatex(90,0.05,"Centrality 0-100%");
    csel->Draw();
  }
  TLatex *ptlabel;
  if(doCent==1) ptlabel= new TLatex(20,0.005,"80 < Jet p_{T} < 100 GeV/c");
  if(doCent==2) ptlabel= new TLatex(20,0.005,"100 < Jet p_{T} < 120 GeV/c");
  if(doCent)ptlabel->Draw();

  // to be precise we should evaluate mcStatErr for 3 bins seperately
  float mcStatErr[4] = {0.03,0.06,0.07,0.15};

  
  //TGraphAsymmErrors *gSyst = new TGraphAsymmErrors(3);
  TGraphErrors *gSyst;
  if(do3bin) gSyst= new TGraphErrors(3);
  else gSyst= new TGraphErrors(4);
  Double_t errCLratio, errMethod, totalSystErr;

  for(Int_t i=1;i<=hBFractionDataLTJP->GetNbinsX();i++) {
    gSyst->SetPoint(i-1,hBFractionDataLTJP->GetBinCenter(i),hBFractionDataLTJP->GetBinContent(i));
    cout<<" central value "<<hBFractionDataLTJP->GetBinContent(i)<<endl;
    errCLratio = abs(hBFractionDataLTJP->GetBinContent(i)-hBFractionDataLTJPFixC->GetBinContent(i));
    errMethod = max(abs(hBFractionDataLTJP->GetBinContent(i)-hBFractionData->GetBinContent(i)),abs(hBFractionDataLTJP->GetBinContent(i)-hBFractionJPdirect->GetBinContent(i)));
    double errJES = 0.14*hBFractionDataLTJP->GetBinContent(i);
    
    totalSystErr = norm(errCLratio,errMethod,errJES);
    gSyst->SetPointError(i-1,hBFractionDataLTJP->GetBinWidth(i)/2,totalSystErr);
    cout<<" sys error "<<totalSystErr<<endl;
    // add in MC template uncertainties
    float origStatErr = hBFractionDataLTJP->GetBinError(i);
    int statBin=i-1;
    if(doCent==1) statBin=0;
    if(doCent==2) statBin=1;
    float extraStatErr = mcStatErr[statBin]*hBFractionDataLTJP->GetBinContent(i);
    float totalStatErr = sqrt(origStatErr*origStatErr + extraStatErr*extraStatErr);
    hBFractionDataLTJP->SetBinError(i,totalStatErr);
    cout<<" total error "<<sqrt(totalSystErr*totalSystErr+totalStatErr*totalStatErr)<<endl;

  }

  gSyst->SetFillColor(5);
  gSyst->Draw("2");


  gBFractionMC2->Draw("Z,p,same");
  hBFractionMC2->Draw("hist,same");


  TGraphAsymmErrors *gBFractionDataLTJP2 = new TGraphAsymmErrors(hBFractionDataLTJP);
  if(!doCent)setMeanPt(gBFractionDataLTJP2,hBFractionDataLTJP,1,do3bin);
  gBFractionDataLTJP2->SetLineColor(1);
  gBFractionDataLTJP2->SetMarkerColor(1);
  gBFractionDataLTJP2->SetMarkerSize(1.5);
  gBFractionDataLTJP2->Draw("p,e1,same");


  TLegend *legFrac2 = new TLegend(0.2,0.15,0.8,0.34);
  if(doCent){
    legFrac2->SetX1(0.365);
    legFrac2->SetY1(0.657);
    legFrac2->SetX2(0.965);
    legFrac2->SetY2(0.848);
  }

  legFrac2->SetHeader("#int L dt = 150 #mub^{-1}");
  legFrac2->SetBorderSize(0);
  legFrac2->SetFillStyle(0);
  legFrac2->AddEntry(gBFractionDataLTJP2,"PbPb data","p");
  legFrac2->AddEntry(gBFractionMC2,"PYTHIA+HYDJET 1.8","lp");
  legFrac2->AddEntry(gSyst,"Exp. uncertainty","f");
  legFrac2->Draw();

 
  cBFraction2->RedrawAxis();

}
示例#15
0
int EffAndCross(char* name)
{
 
  char line[1000];
  TFile *file = new TFile("cross.root","recreate");


  ifstream inbescross("cross.txt_665p01");
  double xbes[22];
  double xebes[22];
  double ybes[22];
  double yebes[22];
  inbescross.getline(line,1000);
  int idbes=0;
  while (!inbescross.eof() && idbes<21){
    double tmpe, tmpeff, tmpcross, tmpcrosse, tmp;
    inbescross >> tmpe >> tmp >> tmp>> tmpeff >> tmp >> tmp >> tmpcross >> tmpcrosse >> tmp >> tmp >> tmp ;
    xbes[idbes] = tmpe;
    xebes[idbes] = 0;
    ybes[idbes] = tmpcross;
    yebes[idbes] = tmpcrosse;
    idbes++;
  }

  TGraphErrors *gbes = new TGraphErrors(idbes,xbes,ybes,xebes,yebes);
  gbes->SetLineColor(2);
  gbes->SetMarkerColor(2);
  gbes->SetFillColor(0);
  //gbes->Draw("P");








  double xx[1000];
  double xxe[1000];
  double yy[1000];
  double yye[1000];
  double emat[1000][1000];

  int n2=0;
  ifstream infile2("KKBabar.txt");
  if (!infile2.is_open()) return -100;
  while (!infile2.eof())
  { 
    double energy1, energy2;
    double obs, obse;

    infile2.getline(line,1000);
    istringstream iss;
    iss.str(line);
  //if (iss.peek()<48 || iss.peek()>57) // not a number
  //{
  //  continue;  
  //}
    //else 
    {
      char a;
      iss >> energy1 >> a >> energy2;
      iss >> obs >> obse;
    }
    //std::cout<<"E1: "<< energy1 << "\tE2: "<< energy2 << "\tsigma: "<< obs <<"\terr: "<<obse<<std::endl;

    xx[n2] = (energy2+energy1)/2.;
    xxe[n2] = (energy2-energy1)/2.;
    yy[n2] = obs;
    yye[n2] = 0;
    n2 ++;
  }

  ifstream infile3("epapsFileKpKm.txt");
  if (!infile3.is_open()) return -200;
  int xid=0,yid=0;
  while(!infile3.eof())
  {
    infile3.getline(line,1000);
    istringstream iss;
    iss.str(line);
    if ((iss.peek()<48 || iss.peek()>57) && iss.peek()!='-') // not a number
    {
      continue;  
     }
    iss >> emat[xid][yid];
    yid++;
     if (yid==159){
      xid++;
      yid=0;
    }
    if (xid==159) break;
  }
  //std::cout<<"xid: "<<xid<<"\tyid: "<<yid<<std::endl;
  for (int i=0; i<159;i++)
  {
    yye[i] = sqrt(emat[i][i]);
  }

  //---------------------------
  //add bes result
  for (int i=0;i<21;i++){
    xx[n2] = xbes[i];
    xxe[n2] = 0.001;
    yy[n2] = ybes[i];
    yye[n2] = yebes[i];
    n2 ++; 
  }
  //----------------------------

  TCanvas *c2 = new TCanvas();
  TGraphErrors *graph1 = new TGraphErrors(n2,xx,yy,xxe,yye);
  graph1->GetXaxis()->SetTitle("#sqrt{s} (GeV)");
  graph1->GetYaxis()->SetTitle("#sigma (nb)");
  graph1->SetTitle("Cross section");
  //graph1->SetMarkerStyle(5);
  graph1->SetFillColor(0);
  graph1->Draw("AP");

  ofstream fitxs("fitxsbabar.txt");
  double gap = 0.01;
  TF1 *fit;
  for (int i=0; xx[i]<1.1-0.0000001;i++){
    double xs = yy[i];
    //fitxs<<xx[i]<<"\t"<<xs<<"\t"<<0<<endl;
    fitxs << "xx.push_back(" << xx[i] << ");\tyy.push_back("<< yy[i] << ");\t er.push_back(0);" <<endl;
  }
 
//fit = new TF1("f0","[0]/(pow(x-[1],2)+pow([2],2))",0.99,1.05);
//fit->SetParameter(0,1.0);
//fit->SetParameter(1,1.02);
//fit->SetParameter(2,0.005);
//graph1->Fit(fit,"R","",0.99,1.05);
//for (double x=0.99; x<1.05-0.0000001;x+=gap){
//  double xs = fit->Eval(x);
//  fitxs << "xx.push_back(" << x << ");\tyy.push_back("<< xs << ");\t er.push_back(0);" <<endl;
//}


  fit = new TF1("f1","pol2",1.1,1.6);
  graph1->Fit(fit,"R+","",1.1,1.6);
  for (double x=1.1; x<1.6-0.0000001;x+=gap){
    double xs = fit->Eval(x);
    //fitxs<<x<<"\t"<<xs<<"\t"<<0<<endl;
    fitxs << "xx.push_back(" << x << ");\tyy.push_back("<< xs << ");\t er.push_back(0);" <<endl;
  }
  
  fit = new TF1("f2","pol2",1.6,1.76);
  graph1->Fit(fit,"R+","",1.6,1.779);
  for (double x=1.6; x<1.779-0.0000001;x+=gap){
    double xs = fit->Eval(x);
    //fitxs<<x<<"\t"<<xs<<"\t"<<0<<endl;
    fitxs << "xx.push_back(" << x << ");\tyy.push_back("<< xs << ");\t er.push_back(0);" <<endl;
  }
  
//fit = new TF1("f3","pol2",1.8,2.16);
//graph1->Fit(fit,"R+","",1.8,2.16);
//for (double x=1.8; x<2.16-0.0000001;x+=gap){
//  double xs = fit->Eval(x);
//  fitxs<<x<<"\t"<<xs<<"\t"<<0<<endl;
//  //fitxs << "xx.push_back(" << x << ");\tyy.push_back("<< xs << ");\t er.push_back(0);" <<endl;
//}
  
  
//
//fit = new TF1("f4","gaus",2.16,2.35);
//graph1->Fit(fit,"R+","",2.16,2.4);
//for (double x=2.16; x<2.4-0.0000001;x+=gap){
//  double xs = fit->Eval(x);
//  fitxs<<x<<"\t"<<xs<<"\t"<<0<<endl;
//  //fitxs << "xx.push_back(" << x << ");\tyy.push_back("<< xs << ");\t er.push_back(0);" <<endl;
//}
//
//fit = new TF1("f5","expo",2.35,5);
//graph1->Fit(fit,"R+","",2.4,5);
//for (double x=2.4; x<5-0.0000001;x+=gap){
//  double xs = fit->Eval(x);
//  fitxs<<x<<"\t"<<xs<<"\t"<<0<<endl;
//  //fitxs << "xx.push_back(" << x << ");\tyy.push_back("<< xs << ");\t er.push_back(0);" <<endl;
//}
  
//fit = new TF1("f4",GausInvx,2.,5,6);
//fit->SetNpx(1000);
//fit->SetParameters(1,2.25,0.05,0.03,1.8,1.5);
//fit->SetParLimits(0, 0.1,  10);
//fit->SetParLimits(1, 2.2,  2.4);
//fit->SetParLimits(2, 0.03, 0.05);
//fit->SetParLimits(3, 0.02,  10);
//fit->SetParLimits(4, 1.5,    2);
//fit->SetParLimits(5, 1,    2);
  
//fit = new TF1("f4",DGausInvx,2.,5,9);
//fit->SetNpx(1000);
//fit->SetParameters(0.2,   2.25, 0.05,
//                   0.03,  1.8,  5,
//                   0.1,   2.0,  0.05);
//
//fit->SetParLimits(0, 0.1,  10);
//fit->SetParLimits(1, 2.2,  2.3);
//fit->SetParLimits(2, 0.03, 0.05);
//
//fit->SetParLimits(3, 0.02, 10);
//fit->SetParLimits(4, -1,    2);
//fit->SetParLimits(5, 5,    20);
//
//fit->SetParLimits(6, 0.1,  0.2);
//fit->SetParLimits(7, 1.9,  2.05);
//fit->SetParLimits(8, 0.04, 0.08);
//graph1->Fit(fit,"R+","",1.8,5);

//fit = new TF1("f4",DGausExp,2.,5,8);
//fit->SetNpx(1000);
//fit->SetParameters(0.2,   2.25, 0.05,
//                   0.1,   2.0,  0.06,
//                   0.03,  1.8);
//
//fit->SetParLimits(0, 0.1,  10);
//fit->SetParLimits(1, 2.2,  2.4);
//fit->SetParLimits(2, 0.03, 0.052);
//
//fit->SetParLimits(3, 0.1,  1.0);
//fit->SetParLimits(4, 1.9,    2.0);
//fit->SetParLimits(5, 0.06,   0.1);
//
//fit->SetParLimits(6, 0.02,  9);
//fit->SetParLimits(7, 0,    1.8);
//
//graph1->Fit(fit,"R+","",1.75,5);
 
//fit = new TF1("f4",TGaus,2.,5,9);
//fit->SetNpx(1000);
//fit->SetParameters(0.2,   2.25, 0.05,
//                   0.1,   2.0,  0.06,
//                   0.03,  1.8,  1.0);
//
//fit->SetParLimits(0, 0.1,  10);
//fit->SetParLimits(1, 2.2,  2.4);
//fit->SetParLimits(2, 0.03, 0.052);
//
//fit->SetParLimits(3, 0.1,  1.0);
//fit->SetParLimits(4, 1.9,    2.0);
//fit->SetParLimits(5, 0.06,   0.1);
//
//fit->SetParLimits(6, 0.02,  90);
////fit->SetParLimits(7, -10,    2);
//fit->SetParLimits(7, -10,    2.4);
//fit->SetParLimits(8, 0.2,    2);
  
//fit = new TF1("f4",DGausAExp,2.,5,9);
//fit->SetNpx(1000);
//fit->SetParameters(0.5,   2.2,  30,
//                   0.1,   2.0,  0.06,
//                   0.03,  1.8,  1.0);
//
//fit->SetParLimits(0, 0.1,  100);
//fit->SetParLimits(1, 2.1,  2.3);
//fit->SetParLimits(2, 10,   60);
//
//fit->SetParLimits(3, 0.1,  1.0);
//fit->SetParLimits(4, 1.9,    2.0);
//fit->SetParLimits(5, 0.06,   0.1);
//
//fit->SetParLimits(6, 0.02,  90);
//fit->SetParLimits(7, -10,    2.4);
//fit->SetParLimits(8, 0.2,    2);
 
  fit = new TF1("f4",AGausDExp,2.,5,9);
  fit->SetNpx(1000);
  fit->SetParameters(50,   2.2,  30,
                     0.1,  2.0,  0.06,
                     0.1,  2.2,  1.8);
  
  fit->SetParLimits(0, 0.1,  100);
  fit->SetParLimits(1, 2.1,  2.3);
  fit->SetParLimits(2, 10,   60);
  
  fit->SetParLimits(3, 0.1,  1.0);
  fit->SetParLimits(4, 1.9,    2.1);
  fit->SetParLimits(5, 0.06,   0.1);
  
  fit->SetParLimits(6, 0.02,  90);
  fit->SetParLimits(7, -10,    2.4);
  fit->SetParLimits(8, 0.2,    2);
  
  graph1->Fit(fit,"R+","",1.77,5);



  for (double x=1.77; x<5-0.0000001;x+=gap){
    double xs = fit->Eval(x);
    //fitxs<<x<<"\t"<<xs<<"\t"<<0<<endl;
    fitxs << "xx.push_back(" << x << ");\tyy.push_back("<< xs << ");\t er.push_back(0);" <<endl;
  }

  gbes->Draw("P");


  file->WriteTObject(c2);
  graph1->GetXaxis()->SetRangeUser(1.6,3.5);
  graph1->GetYaxis()->SetRangeUser(0,0.5);
  c2->Print("cross.pdf");

  return 0;
}
示例#16
0
TGraphErrors *ReadMWGraph(const char *name, Int_t flag)
{
  Double_t xreject = 0.49;

  TGraphErrors *g = new TGraphErrors(name);
  if (g->IsZombie()) return 0;
  while (g->GetX()[0] < xreject)
    g->RemovePoint(0);

  TGraphErrors *g2 = new TGraphErrors(name);
  if (g2->IsZombie()) return 0;
  while (g2->GetX()[0] < xreject)
    g2->RemovePoint(0);
  g2->SetMarkerStyle(4);
  g2->SetMarkerSize(1.00);
  g2->SetMarkerColor(kBlack);
  g2->SetLineColor(kBlack);

  TGraphErrors *gsys = new TGraphErrors(name, "%lg %lg %lg %*lg %lg");
  if (gsys->IsZombie()) return 0;
  while (gsys->GetX()[0] < xreject)
    gsys->RemovePoint(0);
  for (Int_t i = 0; i < gsys->GetN(); i++)
    gsys->SetPointError(i, gsys->GetErrorX(i)*0.75, gsys->GetErrorY(i));
  gsys->SetFillColor(kGray+2);
  gsys->SetLineColor(kGray+2);
  gsys->SetFillStyle(3000);

  if (flag == 1 || flag == 3) {
    TGraphErrors *gt = new TGraphErrors(Form("%s_%s", name, "trues"));
    if (gt->IsZombie()) return 0;
    while (gt->GetX()[0] < xreject)
      gt->RemovePoint(0);
    gt->SetMarkerStyle(20);
    gt->SetMarkerSize(0.75);
    gt->SetMarkerColor(kGreen+1);
    gt->SetLineColor(kGreen+1);

    TGraphErrors *gbw = new TGraphErrors(Form("%s_%s", name, "gen"));
    if (gbw->IsZombie()) return 0;
    while (gbw->GetX()[0] < xreject)
      gbw->RemovePoint(0);
    gbw->SetMarkerStyle(20);
    gbw->SetMarkerSize(0.75);
    gbw->SetMarkerColor(kBlue+1);
    gbw->SetLineColor(kBlue+1);

    for (Int_t i = 0; i < g->GetN(); i++) {
      g->SetPointError(i, g->GetEX()[i], 0.);
      gt->SetPointError(i, gt->GetEX()[i], 0.);
      gbw->SetPointError(i, gbw->GetEX()[i], 0.);
    }

    for (Int_t i = 0; i < g2->GetN(); i++) {
      g2->SetPoint(i, g2->GetX()[i], g2->GetY()[i] - gt->GetY()[i] + gbw->GetY()[i]);
      g2->SetPointError(i, g2->GetEX()[i], TMath::Sqrt(g2->GetEY()[i]*g2->GetEY()[i] + gt->GetEY()[i]*gt->GetEY()[i] +
                                                       gbw->GetEY()[i]*gbw->GetEY()[i]));

      //      g2->SetPoint(i, g2->GetX()[i], g2->GetY()[i] - gt->GetY()[i] + 1.01947);
      //      g2->SetPointError(i, g2->GetEX()[i], TMath::Sqrt(g2->GetEY()[i]*g2->GetEY()[i] + gt->GetEY()[i]*gt->GetEY()[i] +
      //                                                       7.78680e-06*7.78680e-06));

      gsys->SetPoint(i, gsys->GetX()[i], g2->GetY()[i]);
    }
  }

  g->SetTitle();
  g->SetName(name);
  g->GetXaxis()->SetTitle("p_{T}, GeV/c");
  g->SetMarkerStyle(20);
  g->SetMarkerSize(0.95);
  g->SetMarkerColor(kRed+1);
  g->SetLineColor(kRed+1);

  const Double_t mass = 1.019455;
  const Double_t mass_delta = 0.000020;
  const Double_t width = 0.00426;
  const Double_t width_delta = 0.00004;
  if (flag == 1) { // mass
    g->GetYaxis()->SetTitleOffset(1.50);
    g->GetYaxis()->SetTitle("mass, GeV/c^{2}");
    g->SetMaximum(mass+0.0015);
    g->SetMinimum(mass-0.0015);
    TBox *box = new TBox(g->GetXaxis()->GetXmin(), mass - mass_delta, g->GetXaxis()->GetXmax(), mass + mass_delta);
    box->SetFillColor(kGray+1);
    box->SetFillStyle(3001);
    g->GetListOfFunctions()->Add(box);
    g->GetListOfFunctions()->Add(g2, "CP");
    g->GetListOfFunctions()->Add(gt, "CP");
    g->GetListOfFunctions()->Add(gbw, "CP");
  }
  else if (flag == 3) { // mass simple
    g2->SetTitle();
    g2->SetName(Form("%s_only", name));
    g2->GetXaxis()->SetTitle("p_{T}, GeV/c");
    g2->SetMarkerStyle(20);
    g2->SetMarkerSize(0.75);
    g2->SetMarkerColor(kBlack);
    g2->SetLineColor(kBlack);
    g2->GetYaxis()->SetTitleOffset(1.50);
    g2->GetYaxis()->SetTitle("mass, GeV/c^{2}");
    g2->SetMaximum(mass+0.0015);
    g2->SetMinimum(mass-0.0015);
    TBox *box = new TBox(g->GetXaxis()->GetXmin(), mass - mass_delta, g2->GetXaxis()->GetXmax(), mass + mass_delta);
    box->SetFillColor(kGray+1);
    box->SetFillStyle(3001);
    g2->GetListOfFunctions()->Add(box);
    g2->GetListOfFunctions()->Add(gsys, "E5");
    return g2;
  }
  else if (flag == 2) { // width
    g->SetTitle();
    g->SetName(name);
    g->GetXaxis()->SetTitle("p_{T}, GeV/c");
    g->SetMarkerStyle(20);
    g->SetMarkerSize(0.75);
    g->SetMarkerColor(kBlack);
    g->SetLineColor(kBlack);
    g->GetYaxis()->SetTitleOffset(1.50);
    g->GetYaxis()->SetTitle("width, GeV/c^{2}");
    g->SetMaximum(0.01);
    g->SetMinimum(0.0);
    TBox *box = new TBox(g->GetXaxis()->GetXmin(), width - width_delta, g->GetXaxis()->GetXmax(), width + width_delta);
    box->SetFillColor(kGray+1);
    box->SetFillStyle(3001);
    g->GetListOfFunctions()->Add(box);
    g->GetListOfFunctions()->Add(gsys, "E5");
  }

  return g;
}
示例#17
0
void ttbar_isojet1CSV()
{
//=========Macro generated from canvas: c1/c1
//=========  (Sun Dec 11 15:16:19 2016) by ROOT version6.06/01
   TCanvas *c1 = new TCanvas("c1", "c1",1,1,1200,1416);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   c1->SetHighLightColor(2);
   c1->Range(0,0,1,1);
   c1->SetFillColor(0);
   c1->SetBorderMode(0);
   c1->SetBorderSize(2);
   c1->SetTickx(1);
   c1->SetTicky(1);
   c1->SetLeftMargin(0.15);
   c1->SetRightMargin(0.05);
   c1->SetTopMargin(0.07);
   c1->SetBottomMargin(0.13);
   c1->SetFrameFillStyle(0);
   c1->SetFrameBorderMode(0);
  
// ------------>Primitives in pad: pad1
   TPad *pad1 = new TPad("pad1", "pad1",0,0.3,1,1);
   pad1->Draw();
   pad1->cd();
   pad1->Range(-0.1875,0,1.0625,0.6289089);
   pad1->SetFillColor(0);
   pad1->SetBorderMode(0);
   pad1->SetBorderSize(2);
   pad1->SetTickx(1);
   pad1->SetTicky(1);
   pad1->SetLeftMargin(0.15);
   pad1->SetRightMargin(0.05);
   pad1->SetTopMargin(0.07);
   pad1->SetBottomMargin(0);
   pad1->SetFrameFillStyle(0);
   pad1->SetFrameBorderMode(0);
   pad1->SetFrameFillStyle(0);
   pad1->SetFrameBorderMode(0);
   
   THStack *h = new THStack();
   h->SetName("h");
   h->SetTitle("");
   h->SetMinimum(0);
   h->SetMaximum(0.5570336);
   
   TH1F *h_stack_23 = new TH1F("h_stack_23","",10,0,1);
   h_stack_23->SetMinimum(0);
   h_stack_23->SetMaximum(0.5848853);
   h_stack_23->SetDirectory(0);
   h_stack_23->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#000099");
   h_stack_23->SetLineColor(ci);
   h_stack_23->GetXaxis()->SetLabelFont(42);
   h_stack_23->GetXaxis()->SetLabelOffset(0.007);
   h_stack_23->GetXaxis()->SetTitleSize(0.05);
   h_stack_23->GetXaxis()->SetTickLength(0.025);
   h_stack_23->GetXaxis()->SetTitleFont(42);
   h_stack_23->GetYaxis()->SetTitle("a.u.");
   h_stack_23->GetYaxis()->SetLabelFont(42);
   h_stack_23->GetYaxis()->SetLabelOffset(0.007);
   h_stack_23->GetYaxis()->SetTitleSize(0.05);
   h_stack_23->GetYaxis()->SetTickLength(0.025);
   h_stack_23->GetYaxis()->SetTitleOffset(1.5);
   h_stack_23->GetYaxis()->SetTitleFont(42);
   h_stack_23->GetZaxis()->SetLabelFont(42);
   h_stack_23->GetZaxis()->SetLabelOffset(0.007);
   h_stack_23->GetZaxis()->SetTitleSize(0.05);
   h_stack_23->GetZaxis()->SetTickLength(0.025);
   h_stack_23->GetZaxis()->SetTitleFont(42);
   h->SetHistogram(h_stack_23);
   
   
   TH1D *h_isojet1CSV_QCD__265 = new TH1D("h_isojet1CSV_QCD__265","",10,0,1);
   h_isojet1CSV_QCD__265->SetBinContent(1,0.002129117);
   h_isojet1CSV_QCD__265->SetBinContent(2,0.001248327);
   h_isojet1CSV_QCD__265->SetBinContent(3,0.0006205357);
   h_isojet1CSV_QCD__265->SetBinContent(4,0.001430306);
   h_isojet1CSV_QCD__265->SetBinContent(5,0.001031553);
   h_isojet1CSV_QCD__265->SetBinContent(6,0.0005098467);
   h_isojet1CSV_QCD__265->SetBinContent(7,0.0002095089);
   h_isojet1CSV_QCD__265->SetBinContent(8,9.216642e-05);
   h_isojet1CSV_QCD__265->SetBinContent(10,0.004314199);
   h_isojet1CSV_QCD__265->SetBinError(1,0.001510477);
   h_isojet1CSV_QCD__265->SetBinError(2,0.0006911766);
   h_isojet1CSV_QCD__265->SetBinError(3,0.0004578373);
   h_isojet1CSV_QCD__265->SetBinError(4,0.0008388365);
   h_isojet1CSV_QCD__265->SetBinError(5,0.0008715622);
   h_isojet1CSV_QCD__265->SetBinError(6,0.0005098467);
   h_isojet1CSV_QCD__265->SetBinError(7,0.0002095089);
   h_isojet1CSV_QCD__265->SetBinError(8,9.216642e-05);
   h_isojet1CSV_QCD__265->SetBinError(10,0.002213733);
   h_isojet1CSV_QCD__265->SetEntries(25);
   h_isojet1CSV_QCD__265->SetStats(0);

   ci = TColor::GetColor("#cccccc");
   h_isojet1CSV_QCD__265->SetFillColor(ci);
   h_isojet1CSV_QCD__265->GetXaxis()->SetTitle("isojet 1 CSV");
   h_isojet1CSV_QCD__265->GetXaxis()->SetLabelFont(42);
   h_isojet1CSV_QCD__265->GetXaxis()->SetLabelOffset(0.007);
   h_isojet1CSV_QCD__265->GetXaxis()->SetTitleSize(0.05);
   h_isojet1CSV_QCD__265->GetXaxis()->SetTickLength(0.025);
   h_isojet1CSV_QCD__265->GetXaxis()->SetTitleFont(42);
   h_isojet1CSV_QCD__265->GetYaxis()->SetTitle("a.u.");
   h_isojet1CSV_QCD__265->GetYaxis()->SetLabelFont(42);
   h_isojet1CSV_QCD__265->GetYaxis()->SetLabelOffset(0.007);
   h_isojet1CSV_QCD__265->GetYaxis()->SetTitleSize(0.05);
   h_isojet1CSV_QCD__265->GetYaxis()->SetTickLength(0.025);
   h_isojet1CSV_QCD__265->GetYaxis()->SetTitleFont(42);
   h_isojet1CSV_QCD__265->GetZaxis()->SetLabelFont(42);
   h_isojet1CSV_QCD__265->GetZaxis()->SetLabelOffset(0.007);
   h_isojet1CSV_QCD__265->GetZaxis()->SetTitleSize(0.05);
   h_isojet1CSV_QCD__265->GetZaxis()->SetTickLength(0.025);
   h_isojet1CSV_QCD__265->GetZaxis()->SetTitleFont(42);
   h->Add(h_isojet1CSV_QCD,"");
   
   TH1D *h_isojet1CSV_Diboson__266 = new TH1D("h_isojet1CSV_Diboson__266","",10,0,1);
   h_isojet1CSV_Diboson__266->SetBinContent(1,0.006910874);
   h_isojet1CSV_Diboson__266->SetBinContent(2,0.01156259);
   h_isojet1CSV_Diboson__266->SetBinContent(3,0.00597142);
   h_isojet1CSV_Diboson__266->SetBinContent(4,0.003397186);
   h_isojet1CSV_Diboson__266->SetBinContent(5,0.003453268);
   h_isojet1CSV_Diboson__266->SetBinContent(6,0.001659304);
   h_isojet1CSV_Diboson__266->SetBinContent(7,0.001617052);
   h_isojet1CSV_Diboson__266->SetBinContent(8,0.001259235);
   h_isojet1CSV_Diboson__266->SetBinContent(9,0.000286628);
   h_isojet1CSV_Diboson__266->SetBinContent(10,0.00067562);
   h_isojet1CSV_Diboson__266->SetBinError(1,0.001086007);
   h_isojet1CSV_Diboson__266->SetBinError(2,0.001467728);
   h_isojet1CSV_Diboson__266->SetBinError(3,0.001077108);
   h_isojet1CSV_Diboson__266->SetBinError(4,0.0008370875);
   h_isojet1CSV_Diboson__266->SetBinError(5,0.0009085276);
   h_isojet1CSV_Diboson__266->SetBinError(6,0.000631351);
   h_isojet1CSV_Diboson__266->SetBinError(7,0.0006254813);
   h_isojet1CSV_Diboson__266->SetBinError(8,0.0005614698);
   h_isojet1CSV_Diboson__266->SetBinError(9,0.0001726014);
   h_isojet1CSV_Diboson__266->SetBinError(10,0.0003333104);
   h_isojet1CSV_Diboson__266->SetEntries(227);
   h_isojet1CSV_Diboson__266->SetStats(0);

   ci = TColor::GetColor("#9966cc");
   h_isojet1CSV_Diboson__266->SetFillColor(ci);
   h_isojet1CSV_Diboson__266->GetXaxis()->SetTitle("isojet 1 CSV");
   h_isojet1CSV_Diboson__266->GetXaxis()->SetLabelFont(42);
   h_isojet1CSV_Diboson__266->GetXaxis()->SetLabelOffset(0.007);
   h_isojet1CSV_Diboson__266->GetXaxis()->SetTitleSize(0.05);
   h_isojet1CSV_Diboson__266->GetXaxis()->SetTickLength(0.025);
   h_isojet1CSV_Diboson__266->GetXaxis()->SetTitleFont(42);
   h_isojet1CSV_Diboson__266->GetYaxis()->SetTitle("a.u.");
   h_isojet1CSV_Diboson__266->GetYaxis()->SetLabelFont(42);
   h_isojet1CSV_Diboson__266->GetYaxis()->SetLabelOffset(0.007);
   h_isojet1CSV_Diboson__266->GetYaxis()->SetTitleSize(0.05);
   h_isojet1CSV_Diboson__266->GetYaxis()->SetTickLength(0.025);
   h_isojet1CSV_Diboson__266->GetYaxis()->SetTitleFont(42);
   h_isojet1CSV_Diboson__266->GetZaxis()->SetLabelFont(42);
   h_isojet1CSV_Diboson__266->GetZaxis()->SetLabelOffset(0.007);
   h_isojet1CSV_Diboson__266->GetZaxis()->SetTitleSize(0.05);
   h_isojet1CSV_Diboson__266->GetZaxis()->SetTickLength(0.025);
   h_isojet1CSV_Diboson__266->GetZaxis()->SetTitleFont(42);
   h->Add(h_isojet1CSV_Diboson,"");
   
   TH1D *h_isojet1CSV_ZpLjets__267 = new TH1D("h_isojet1CSV_ZpLjets__267","",10,0,1);
   h_isojet1CSV_ZpLjets__267->SetBinContent(1,0.00997839);
   h_isojet1CSV_ZpLjets__267->SetBinContent(2,0.01450317);
   h_isojet1CSV_ZpLjets__267->SetBinContent(3,0.006432142);
   h_isojet1CSV_ZpLjets__267->SetBinContent(4,0.004194575);
   h_isojet1CSV_ZpLjets__267->SetBinContent(5,0.003727646);
   h_isojet1CSV_ZpLjets__267->SetBinContent(6,0.002569373);
   h_isojet1CSV_ZpLjets__267->SetBinContent(7,0.001898935);
   h_isojet1CSV_ZpLjets__267->SetBinContent(8,0.001314676);
   h_isojet1CSV_ZpLjets__267->SetBinContent(9,0.001323422);
   h_isojet1CSV_ZpLjets__267->SetBinContent(10,0.001471477);
   h_isojet1CSV_ZpLjets__267->SetBinError(1,0.0002843835);
   h_isojet1CSV_ZpLjets__267->SetBinError(2,0.0003526741);
   h_isojet1CSV_ZpLjets__267->SetBinError(3,0.0002379666);
   h_isojet1CSV_ZpLjets__267->SetBinError(4,0.0002075278);
   h_isojet1CSV_ZpLjets__267->SetBinError(5,0.0001971644);
   h_isojet1CSV_ZpLjets__267->SetBinError(6,0.0001564817);
   h_isojet1CSV_ZpLjets__267->SetBinError(7,0.0001321731);
   h_isojet1CSV_ZpLjets__267->SetBinError(8,0.0001133749);
   h_isojet1CSV_ZpLjets__267->SetBinError(9,0.0001162263);
   h_isojet1CSV_ZpLjets__267->SetBinError(10,0.0001379738);
   h_isojet1CSV_ZpLjets__267->SetEntries(24915);
   h_isojet1CSV_ZpLjets__267->SetStats(0);

   ci = TColor::GetColor("#3399cc");
   h_isojet1CSV_ZpLjets__267->SetFillColor(ci);
   h_isojet1CSV_ZpLjets__267->GetXaxis()->SetTitle("isojet 1 CSV");
   h_isojet1CSV_ZpLjets__267->GetXaxis()->SetLabelFont(42);
   h_isojet1CSV_ZpLjets__267->GetXaxis()->SetLabelOffset(0.007);
   h_isojet1CSV_ZpLjets__267->GetXaxis()->SetTitleSize(0.05);
   h_isojet1CSV_ZpLjets__267->GetXaxis()->SetTickLength(0.025);
   h_isojet1CSV_ZpLjets__267->GetXaxis()->SetTitleFont(42);
   h_isojet1CSV_ZpLjets__267->GetYaxis()->SetTitle("a.u.");
   h_isojet1CSV_ZpLjets__267->GetYaxis()->SetLabelFont(42);
   h_isojet1CSV_ZpLjets__267->GetYaxis()->SetLabelOffset(0.007);
   h_isojet1CSV_ZpLjets__267->GetYaxis()->SetTitleSize(0.05);
   h_isojet1CSV_ZpLjets__267->GetYaxis()->SetTickLength(0.025);
   h_isojet1CSV_ZpLjets__267->GetYaxis()->SetTitleFont(42);
   h_isojet1CSV_ZpLjets__267->GetZaxis()->SetLabelFont(42);
   h_isojet1CSV_ZpLjets__267->GetZaxis()->SetLabelOffset(0.007);
   h_isojet1CSV_ZpLjets__267->GetZaxis()->SetTitleSize(0.05);
   h_isojet1CSV_ZpLjets__267->GetZaxis()->SetTickLength(0.025);
   h_isojet1CSV_ZpLjets__267->GetZaxis()->SetTitleFont(42);
   h->Add(h_isojet1CSV_Z+jets,"");
   
   TH1D *h_isojet1CSV_WpLjets__268 = new TH1D("h_isojet1CSV_WpLjets__268","",10,0,1);
   h_isojet1CSV_WpLjets__268->SetBinContent(1,0.01060448);
   h_isojet1CSV_WpLjets__268->SetBinContent(2,0.01194981);
   h_isojet1CSV_WpLjets__268->SetBinContent(3,0.007295854);
   h_isojet1CSV_WpLjets__268->SetBinContent(4,0.004201536);
   h_isojet1CSV_WpLjets__268->SetBinContent(5,0.003315037);
   h_isojet1CSV_WpLjets__268->SetBinContent(6,0.002154035);
   h_isojet1CSV_WpLjets__268->SetBinContent(7,0.001704806);
   h_isojet1CSV_WpLjets__268->SetBinContent(8,0.001590696);
   h_isojet1CSV_WpLjets__268->SetBinContent(9,0.001506952);
   h_isojet1CSV_WpLjets__268->SetBinContent(10,0.00135957);
   h_isojet1CSV_WpLjets__268->SetBinError(1,0.0007760229);
   h_isojet1CSV_WpLjets__268->SetBinError(2,0.0008063374);
   h_isojet1CSV_WpLjets__268->SetBinError(3,0.0006567409);
   h_isojet1CSV_WpLjets__268->SetBinError(4,0.0005519722);
   h_isojet1CSV_WpLjets__268->SetBinError(5,0.0004860992);
   h_isojet1CSV_WpLjets__268->SetBinError(6,0.0003673486);
   h_isojet1CSV_WpLjets__268->SetBinError(7,0.0003806515);
   h_isojet1CSV_WpLjets__268->SetBinError(8,0.0003677212);
   h_isojet1CSV_WpLjets__268->SetBinError(9,0.0003252218);
   h_isojet1CSV_WpLjets__268->SetBinError(10,0.0002763251);
   h_isojet1CSV_WpLjets__268->SetEntries(3309);
   h_isojet1CSV_WpLjets__268->SetStats(0);

   ci = TColor::GetColor("#66cc66");
   h_isojet1CSV_WpLjets__268->SetFillColor(ci);
   h_isojet1CSV_WpLjets__268->GetXaxis()->SetTitle("isojet 1 CSV");
   h_isojet1CSV_WpLjets__268->GetXaxis()->SetLabelFont(42);
   h_isojet1CSV_WpLjets__268->GetXaxis()->SetLabelOffset(0.007);
   h_isojet1CSV_WpLjets__268->GetXaxis()->SetTitleSize(0.05);
   h_isojet1CSV_WpLjets__268->GetXaxis()->SetTickLength(0.025);
   h_isojet1CSV_WpLjets__268->GetXaxis()->SetTitleFont(42);
   h_isojet1CSV_WpLjets__268->GetYaxis()->SetTitle("a.u.");
   h_isojet1CSV_WpLjets__268->GetYaxis()->SetLabelFont(42);
   h_isojet1CSV_WpLjets__268->GetYaxis()->SetLabelOffset(0.007);
   h_isojet1CSV_WpLjets__268->GetYaxis()->SetTitleSize(0.05);
   h_isojet1CSV_WpLjets__268->GetYaxis()->SetTickLength(0.025);
   h_isojet1CSV_WpLjets__268->GetYaxis()->SetTitleFont(42);
   h_isojet1CSV_WpLjets__268->GetZaxis()->SetLabelFont(42);
   h_isojet1CSV_WpLjets__268->GetZaxis()->SetLabelOffset(0.007);
   h_isojet1CSV_WpLjets__268->GetZaxis()->SetTitleSize(0.05);
   h_isojet1CSV_WpLjets__268->GetZaxis()->SetTickLength(0.025);
   h_isojet1CSV_WpLjets__268->GetZaxis()->SetTitleFont(42);
   h->Add(h_isojet1CSV_W+jets,"");
   
   TH1D *h_isojet1CSV_TopsPoPLFcP__269 = new TH1D("h_isojet1CSV_TopsPoPLFcP__269","",10,0,1);
   h_isojet1CSV_TopsPoPLFcP__269->SetBinContent(1,0.09097508);
   h_isojet1CSV_TopsPoPLFcP__269->SetBinContent(2,0.09232326);
   h_isojet1CSV_TopsPoPLFcP__269->SetBinContent(3,0.04269338);
   h_isojet1CSV_TopsPoPLFcP__269->SetBinContent(4,0.02949662);
   h_isojet1CSV_TopsPoPLFcP__269->SetBinContent(5,0.02281892);
   h_isojet1CSV_TopsPoPLFcP__269->SetBinContent(6,0.01709603);
   h_isojet1CSV_TopsPoPLFcP__269->SetBinContent(7,0.01404044);
   h_isojet1CSV_TopsPoPLFcP__269->SetBinContent(8,0.009499499);
   h_isojet1CSV_TopsPoPLFcP__269->SetBinContent(9,0.006095059);
   h_isojet1CSV_TopsPoPLFcP__269->SetBinContent(10,0.003040849);
   h_isojet1CSV_TopsPoPLFcP__269->SetBinError(1,0.0009372855);
   h_isojet1CSV_TopsPoPLFcP__269->SetBinError(2,0.0009857636);
   h_isojet1CSV_TopsPoPLFcP__269->SetBinError(3,0.0007155424);
   h_isojet1CSV_TopsPoPLFcP__269->SetBinError(4,0.0005977933);
   h_isojet1CSV_TopsPoPLFcP__269->SetBinError(5,0.0005373378);
   h_isojet1CSV_TopsPoPLFcP__269->SetBinError(6,0.0004781073);
   h_isojet1CSV_TopsPoPLFcP__269->SetBinError(7,0.0004489056);
   h_isojet1CSV_TopsPoPLFcP__269->SetBinError(8,0.0003875753);
   h_isojet1CSV_TopsPoPLFcP__269->SetBinError(9,0.0003337873);
   h_isojet1CSV_TopsPoPLFcP__269->SetBinError(10,0.0003173281);
   h_isojet1CSV_TopsPoPLFcP__269->SetEntries(45754);
   h_isojet1CSV_TopsPoPLFcP__269->SetStats(0);

   ci = TColor::GetColor("#cc33cc");
   h_isojet1CSV_TopsPoPLFcP__269->SetFillColor(ci);
   h_isojet1CSV_TopsPoPLFcP__269->GetXaxis()->SetTitle("isojet 1 CSV");
   h_isojet1CSV_TopsPoPLFcP__269->GetXaxis()->SetLabelFont(42);
   h_isojet1CSV_TopsPoPLFcP__269->GetXaxis()->SetLabelOffset(0.007);
   h_isojet1CSV_TopsPoPLFcP__269->GetXaxis()->SetTitleSize(0.05);
   h_isojet1CSV_TopsPoPLFcP__269->GetXaxis()->SetTickLength(0.025);
   h_isojet1CSV_TopsPoPLFcP__269->GetXaxis()->SetTitleFont(42);
   h_isojet1CSV_TopsPoPLFcP__269->GetYaxis()->SetTitle("a.u.");
   h_isojet1CSV_TopsPoPLFcP__269->GetYaxis()->SetLabelFont(42);
   h_isojet1CSV_TopsPoPLFcP__269->GetYaxis()->SetLabelOffset(0.007);
   h_isojet1CSV_TopsPoPLFcP__269->GetYaxis()->SetTitleSize(0.05);
   h_isojet1CSV_TopsPoPLFcP__269->GetYaxis()->SetTickLength(0.025);
   h_isojet1CSV_TopsPoPLFcP__269->GetYaxis()->SetTitleFont(42);
   h_isojet1CSV_TopsPoPLFcP__269->GetZaxis()->SetLabelFont(42);
   h_isojet1CSV_TopsPoPLFcP__269->GetZaxis()->SetLabelOffset(0.007);
   h_isojet1CSV_TopsPoPLFcP__269->GetZaxis()->SetTitleSize(0.05);
   h_isojet1CSV_TopsPoPLFcP__269->GetZaxis()->SetTickLength(0.025);
   h_isojet1CSV_TopsPoPLFcP__269->GetZaxis()->SetTitleFont(42);
   h->Add(h_isojet1CSV_Top (LF),"");
   
   TH1D *h_isojet1CSV_TopsPoPHFcP__270 = new TH1D("h_isojet1CSV_TopsPoPHFcP__270","",10,0,1);
   h_isojet1CSV_TopsPoPHFcP__270->SetBinContent(1,0.01878166);
   h_isojet1CSV_TopsPoPHFcP__270->SetBinContent(2,0.02708098);
   h_isojet1CSV_TopsPoPHFcP__270->SetBinContent(3,0.01896531);
   h_isojet1CSV_TopsPoPHFcP__270->SetBinContent(4,0.01870601);
   h_isojet1CSV_TopsPoPHFcP__270->SetBinContent(5,0.01924485);
   h_isojet1CSV_TopsPoPHFcP__270->SetBinContent(6,0.02077131);
   h_isojet1CSV_TopsPoPHFcP__270->SetBinContent(7,0.02899544);
   h_isojet1CSV_TopsPoPHFcP__270->SetBinContent(8,0.03698897);
   h_isojet1CSV_TopsPoPHFcP__270->SetBinContent(9,0.07325594);
   h_isojet1CSV_TopsPoPHFcP__270->SetBinContent(10,0.2676551);
   h_isojet1CSV_TopsPoPHFcP__270->SetBinError(1,0.0004640739);
   h_isojet1CSV_TopsPoPHFcP__270->SetBinError(2,0.0005643558);
   h_isojet1CSV_TopsPoPHFcP__270->SetBinError(3,0.0004957084);
   h_isojet1CSV_TopsPoPHFcP__270->SetBinError(4,0.0004766015);
   h_isojet1CSV_TopsPoPHFcP__270->SetBinError(5,0.0004665302);
   h_isojet1CSV_TopsPoPHFcP__270->SetBinError(6,0.0005070097);
   h_isojet1CSV_TopsPoPHFcP__270->SetBinError(7,0.0006476121);
   h_isojet1CSV_TopsPoPHFcP__270->SetBinError(8,0.0007056579);
   h_isojet1CSV_TopsPoPHFcP__270->SetBinError(9,0.0009826258);
   h_isojet1CSV_TopsPoPHFcP__270->SetBinError(10,0.001744809);
   h_isojet1CSV_TopsPoPHFcP__270->SetEntries(77950);
   h_isojet1CSV_TopsPoPHFcP__270->SetStats(0);

   ci = TColor::GetColor("#ff9900");
   h_isojet1CSV_TopsPoPHFcP__270->SetFillColor(ci);
   h_isojet1CSV_TopsPoPHFcP__270->GetXaxis()->SetTitle("isojet 1 CSV");
   h_isojet1CSV_TopsPoPHFcP__270->GetXaxis()->SetLabelFont(42);
   h_isojet1CSV_TopsPoPHFcP__270->GetXaxis()->SetLabelOffset(0.007);
   h_isojet1CSV_TopsPoPHFcP__270->GetXaxis()->SetTitleSize(0.05);
   h_isojet1CSV_TopsPoPHFcP__270->GetXaxis()->SetTickLength(0.025);
   h_isojet1CSV_TopsPoPHFcP__270->GetXaxis()->SetTitleFont(42);
   h_isojet1CSV_TopsPoPHFcP__270->GetYaxis()->SetTitle("a.u.");
   h_isojet1CSV_TopsPoPHFcP__270->GetYaxis()->SetLabelFont(42);
   h_isojet1CSV_TopsPoPHFcP__270->GetYaxis()->SetLabelOffset(0.007);
   h_isojet1CSV_TopsPoPHFcP__270->GetYaxis()->SetTitleSize(0.05);
   h_isojet1CSV_TopsPoPHFcP__270->GetYaxis()->SetTickLength(0.025);
   h_isojet1CSV_TopsPoPHFcP__270->GetYaxis()->SetTitleFont(42);
   h_isojet1CSV_TopsPoPHFcP__270->GetZaxis()->SetLabelFont(42);
   h_isojet1CSV_TopsPoPHFcP__270->GetZaxis()->SetLabelOffset(0.007);
   h_isojet1CSV_TopsPoPHFcP__270->GetZaxis()->SetTitleSize(0.05);
   h_isojet1CSV_TopsPoPHFcP__270->GetZaxis()->SetTickLength(0.025);
   h_isojet1CSV_TopsPoPHFcP__270->GetZaxis()->SetTitleFont(42);
   h->Add(h_isojet1CSV_Top (HF),"");
   h->Draw("hist");
   
   TH1D *hsum__271 = new TH1D("hsum__271","",10,0,1);
   hsum__271->SetBinContent(1,0.1393796);
   hsum__271->SetBinContent(2,0.1586681);
   hsum__271->SetBinContent(3,0.08197864);
   hsum__271->SetBinContent(4,0.06142623);
   hsum__271->SetBinContent(5,0.05359128);
   hsum__271->SetBinContent(6,0.0447599);
   hsum__271->SetBinContent(7,0.04846618);
   hsum__271->SetBinContent(8,0.05074524);
   hsum__271->SetBinContent(9,0.082468);
   hsum__271->SetBinContent(10,0.2785168);
   hsum__271->SetBinError(1,0.002288647);
   hsum__271->SetBinError(2,0.002167196);
   hsum__271->SetBinError(3,0.001617233);
   hsum__271->SetBinError(4,0.001528597);
   hsum__271->SetBinError(5,0.001538373);
   hsum__271->SetBinError(6,0.001141764);
   hsum__271->SetBinError(7,0.001103813);
   hsum__271->SetBinError(8,0.001058293);
   hsum__271->SetBinError(9,0.001107265);
   hsum__271->SetBinError(10,0.002872657);
   hsum__271->SetEntries(45);
   hsum__271->SetStats(0);

   ci = 1202;
   color = new TColor(ci, 0, 0, 0, " ", 0.99);
   hsum__271->SetFillColor(ci);
   hsum__271->SetFillStyle(3003);
   hsum__271->SetLineWidth(0);
   hsum__271->GetXaxis()->SetTitle("isojet 1 CSV");
   hsum__271->GetXaxis()->SetLabelFont(42);
   hsum__271->GetXaxis()->SetLabelOffset(0.007);
   hsum__271->GetXaxis()->SetTitleSize(0.05);
   hsum__271->GetXaxis()->SetTickLength(0.025);
   hsum__271->GetXaxis()->SetTitleFont(42);
   hsum__271->GetYaxis()->SetTitle("a.u.");
   hsum__271->GetYaxis()->SetLabelFont(42);
   hsum__271->GetYaxis()->SetLabelOffset(0.007);
   hsum__271->GetYaxis()->SetTitleSize(0.05);
   hsum__271->GetYaxis()->SetTickLength(0.025);
   hsum__271->GetYaxis()->SetTitleFont(42);
   hsum__271->GetZaxis()->SetLabelFont(42);
   hsum__271->GetZaxis()->SetLabelOffset(0.007);
   hsum__271->GetZaxis()->SetTitleSize(0.05);
   hsum__271->GetZaxis()->SetTickLength(0.025);
   hsum__271->GetZaxis()->SetTitleFont(42);
   hsum__271->Draw("e2 same");
   
   TH1D *h_isojet1CSV_Data__272 = new TH1D("h_isojet1CSV_Data__272","",10,0,1);
   h_isojet1CSV_Data__272->SetBinContent(1,0.138368);
   h_isojet1CSV_Data__272->SetBinContent(2,0.1592858);
   h_isojet1CSV_Data__272->SetBinContent(3,0.08381231);
   h_isojet1CSV_Data__272->SetBinContent(4,0.06152831);
   h_isojet1CSV_Data__272->SetBinContent(5,0.05196457);
   h_isojet1CSV_Data__272->SetBinContent(6,0.04475643);
   h_isojet1CSV_Data__272->SetBinContent(7,0.04833695);
   h_isojet1CSV_Data__272->SetBinContent(8,0.05059832);
   h_isojet1CSV_Data__272->SetBinContent(9,0.08235183);
   h_isojet1CSV_Data__272->SetBinContent(10,0.2789975);
   h_isojet1CSV_Data__272->SetBinError(1,0.002553194);
   h_isojet1CSV_Data__272->SetBinError(2,0.002739394);
   h_isojet1CSV_Data__272->SetBinError(3,0.0019871);
   h_isojet1CSV_Data__272->SetBinError(4,0.001702564);
   h_isojet1CSV_Data__272->SetBinError(5,0.001564659);
   h_isojet1CSV_Data__272->SetBinError(6,0.00145209);
   h_isojet1CSV_Data__272->SetBinError(7,0.001509057);
   h_isojet1CSV_Data__272->SetBinError(8,0.001543953);
   h_isojet1CSV_Data__272->SetBinError(9,0.001969711);
   h_isojet1CSV_Data__272->SetBinError(10,0.003625484);
   h_isojet1CSV_Data__272->SetEntries(21226);
   h_isojet1CSV_Data__272->SetStats(0);
   h_isojet1CSV_Data__272->SetLineWidth(3);
   h_isojet1CSV_Data__272->SetMarkerStyle(20);
   h_isojet1CSV_Data__272->SetMarkerSize(2);
   h_isojet1CSV_Data__272->GetXaxis()->SetTitle("isojet 1 CSV");
   h_isojet1CSV_Data__272->GetXaxis()->SetLabelFont(42);
   h_isojet1CSV_Data__272->GetXaxis()->SetLabelOffset(0.007);
   h_isojet1CSV_Data__272->GetXaxis()->SetTitleSize(0.05);
   h_isojet1CSV_Data__272->GetXaxis()->SetTickLength(0.025);
   h_isojet1CSV_Data__272->GetXaxis()->SetTitleFont(42);
   h_isojet1CSV_Data__272->GetYaxis()->SetTitle("a.u.");
   h_isojet1CSV_Data__272->GetYaxis()->SetLabelFont(42);
   h_isojet1CSV_Data__272->GetYaxis()->SetLabelOffset(0.007);
   h_isojet1CSV_Data__272->GetYaxis()->SetTitleSize(0.05);
   h_isojet1CSV_Data__272->GetYaxis()->SetTickLength(0.025);
   h_isojet1CSV_Data__272->GetYaxis()->SetTitleFont(42);
   h_isojet1CSV_Data__272->GetZaxis()->SetLabelFont(42);
   h_isojet1CSV_Data__272->GetZaxis()->SetLabelOffset(0.007);
   h_isojet1CSV_Data__272->GetZaxis()->SetTitleSize(0.05);
   h_isojet1CSV_Data__272->GetZaxis()->SetTickLength(0.025);
   h_isojet1CSV_Data__272->GetZaxis()->SetTitleFont(42);
   h_isojet1CSV_Data__272->Draw("elp same");
   
   TLegend *leg = new TLegend(0.6,0.55,0.88,0.9,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   TLegendEntry *entry=leg->AddEntry("h_isojet1CSV_Data","Data","ELP");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(20);
   entry->SetMarkerSize(2);
   entry->SetTextFont(42);
   entry=leg->AddEntry("h_isojet1CSV_Top (HF)","Top (HF)","F");

   ci = TColor::GetColor("#ff9900");
   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("h_isojet1CSV_Top (LF)","Top (LF)","F");

   ci = TColor::GetColor("#cc33cc");
   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("h_isojet1CSV_W+jets","W+jets","F");

   ci = TColor::GetColor("#66cc66");
   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("h_isojet1CSV_Z+jets","Z+jets","F");

   ci = TColor::GetColor("#3399cc");
   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("h_isojet1CSV_Diboson","Diboson","F");

   ci = TColor::GetColor("#9966cc");
   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("h_isojet1CSV_QCD","QCD","F");

   ci = TColor::GetColor("#cccccc");
   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();
   
   leg = new TLegend(0.6,0.55,0.88,0.9,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   entry=leg->AddEntry("h_isojet1CSV_Data","Data","ELP");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(20);
   entry->SetMarkerSize(2);
   entry->SetTextFont(42);
   entry=leg->AddEntry("h_isojet1CSV_Top (HF)","Top (HF)","F");

   ci = TColor::GetColor("#ff9900");
   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("h_isojet1CSV_Top (LF)","Top (LF)","F");

   ci = TColor::GetColor("#cc33cc");
   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("h_isojet1CSV_W+jets","W+jets","F");

   ci = TColor::GetColor("#66cc66");
   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("h_isojet1CSV_Z+jets","Z+jets","F");

   ci = TColor::GetColor("#3399cc");
   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("h_isojet1CSV_Diboson","Diboson","F");

   ci = TColor::GetColor("#9966cc");
   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("h_isojet1CSV_QCD","QCD","F");

   ci = TColor::GetColor("#cccccc");
   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.18,0.85,"CMS");
tex->SetNDC();
   tex->SetTextSize(0.06);
   tex->SetLineWidth(2);
   tex->Draw();
      tex = new TLatex(0.28,0.85,"Preliminary");
tex->SetNDC();
   tex->SetTextFont(52);
   tex->SetTextSize(0.06);
   tex->SetLineWidth(2);
   tex->Draw();
      tex = new TLatex(0.9,0.94,"36.6 fb^{-1} (13 TeV)");
tex->SetNDC();
   tex->SetTextAlign(31);
   tex->SetTextFont(42);
   tex->SetTextSize(0.04);
   tex->SetLineWidth(2);
   tex->Draw();
   pad1->Modified();
   c1->cd();
  
// ------------>Primitives in pad: pad2
   TPad *pad2 = new TPad("pad2", "pad2",0,0.05,1,0.3);
   pad2->Draw();
   pad2->cd();
   pad2->Range(-0.1875,-0.8914286,1.0625,0.48);
   pad2->SetFillColor(0);
   pad2->SetBorderMode(0);
   pad2->SetBorderSize(2);
   pad2->SetGridy();
   pad2->SetTickx(1);
   pad2->SetTicky(1);
   pad2->SetLeftMargin(0.15);
   pad2->SetRightMargin(0.05);
   pad2->SetTopMargin(0);
   pad2->SetBottomMargin(0.3);
   pad2->SetFrameFillStyle(0);
   pad2->SetFrameBorderMode(0);
   pad2->SetFrameFillStyle(0);
   pad2->SetFrameBorderMode(0);
   
   TH1D *ratio__273 = new TH1D("ratio__273","",10,0,1);
   ratio__273->SetBinContent(1,-0.00725764);
   ratio__273->SetBinContent(2,0.003892779);
   ratio__273->SetBinContent(3,0.0223676);
   ratio__273->SetBinContent(4,0.001661897);
   ratio__273->SetBinContent(5,-0.0303539);
   ratio__273->SetBinContent(6,-7.754564e-05);
   ratio__273->SetBinContent(7,-0.002666473);
   ratio__273->SetBinContent(8,-0.002895236);
   ratio__273->SetBinContent(9,-0.001408637);
   ratio__273->SetBinContent(10,0.001725793);
   ratio__273->SetBinError(1,0.0001);
   ratio__273->SetBinError(2,0.0001);
   ratio__273->SetBinError(3,0.0001);
   ratio__273->SetBinError(4,0.0001);
   ratio__273->SetBinError(5,0.0001);
   ratio__273->SetBinError(6,0.0001);
   ratio__273->SetBinError(7,0.0001);
   ratio__273->SetBinError(8,0.0001);
   ratio__273->SetBinError(9,0.0001);
   ratio__273->SetBinError(10,0.0001);
   ratio__273->SetMinimum(-0.48);
   ratio__273->SetMaximum(0.48);
   ratio__273->SetEntries(21236);
   ratio__273->SetStats(0);
   ratio__273->SetLineWidth(3);
   ratio__273->SetMarkerStyle(20);
   ratio__273->SetMarkerSize(2);
   ratio__273->GetXaxis()->SetTitle("isojet 1 CSV");
   ratio__273->GetXaxis()->SetLabelFont(43);
   ratio__273->GetXaxis()->SetLabelOffset(0.007);
   ratio__273->GetXaxis()->SetLabelSize(30);
   ratio__273->GetXaxis()->SetTitleSize(40);
   ratio__273->GetXaxis()->SetTickLength(0.025);
   ratio__273->GetXaxis()->SetTitleOffset(5);
   ratio__273->GetXaxis()->SetTitleFont(43);
   ratio__273->GetYaxis()->SetTitle("#frac{Data-Exp}{Exp}");
   ratio__273->GetYaxis()->SetNdivisions(5);
   ratio__273->GetYaxis()->SetLabelFont(43);
   ratio__273->GetYaxis()->SetLabelOffset(0.007);
   ratio__273->GetYaxis()->SetLabelSize(30);
   ratio__273->GetYaxis()->SetTitleSize(40);
   ratio__273->GetYaxis()->SetTickLength(0.025);
   ratio__273->GetYaxis()->SetTitleOffset(2.5);
   ratio__273->GetYaxis()->SetTitleFont(43);
   ratio__273->GetZaxis()->SetLabelFont(42);
   ratio__273->GetZaxis()->SetLabelOffset(0.007);
   ratio__273->GetZaxis()->SetTitleSize(0.05);
   ratio__273->GetZaxis()->SetTickLength(0.025);
   ratio__273->GetZaxis()->SetTitleFont(42);
   ratio__273->Draw("elp");
   
   TH1D *zero__274 = new TH1D("zero__274","",10,0,1);
   zero__274->SetBinError(1,0.002553194);
   zero__274->SetBinError(2,0.002739394);
   zero__274->SetBinError(3,0.0019871);
   zero__274->SetBinError(4,0.001702564);
   zero__274->SetBinError(5,0.001564659);
   zero__274->SetBinError(6,0.00145209);
   zero__274->SetBinError(7,0.001509057);
   zero__274->SetBinError(8,0.001543953);
   zero__274->SetBinError(9,0.001969711);
   zero__274->SetBinError(10,0.003625484);
   zero__274->SetEntries(21236);
   zero__274->SetStats(0);
   zero__274->SetLineWidth(3);
   zero__274->SetMarkerStyle(20);
   zero__274->SetMarkerSize(2);
   zero__274->GetXaxis()->SetTitle("isojet 1 CSV");
   zero__274->GetXaxis()->SetLabelFont(42);
   zero__274->GetXaxis()->SetLabelOffset(0.007);
   zero__274->GetXaxis()->SetTitleSize(0.05);
   zero__274->GetXaxis()->SetTickLength(0.025);
   zero__274->GetXaxis()->SetTitleFont(42);
   zero__274->GetYaxis()->SetTitle("a.u.");
   zero__274->GetYaxis()->SetLabelFont(42);
   zero__274->GetYaxis()->SetLabelOffset(0.007);
   zero__274->GetYaxis()->SetTitleSize(0.05);
   zero__274->GetYaxis()->SetTickLength(0.025);
   zero__274->GetYaxis()->SetTitleFont(42);
   zero__274->GetZaxis()->SetLabelFont(42);
   zero__274->GetZaxis()->SetLabelOffset(0.007);
   zero__274->GetZaxis()->SetTitleSize(0.05);
   zero__274->GetZaxis()->SetTickLength(0.025);
   zero__274->GetZaxis()->SetTitleFont(42);
   zero__274->Draw("hist same");
   
   TH1D *sumratioup__275 = new TH1D("sumratioup__275","",10,0,1);
   sumratioup__275->SetBinContent(1,0.01642024);
   sumratioup__275->SetBinContent(2,0.01365867);
   sumratioup__275->SetBinContent(3,0.01972749);
   sumratioup__275->SetBinContent(4,0.02488509);
   sumratioup__275->SetBinContent(5,0.02870566);
   sumratioup__275->SetBinContent(6,0.02550863);
   sumratioup__275->SetBinContent(7,0.02277492);
   sumratioup__275->SetBinContent(8,0.02085501);
   sumratioup__275->SetBinContent(9,0.01342661);
   sumratioup__275->SetBinContent(10,0.01031412);
   sumratioup__275->SetBinError(1,0.002288647);
   sumratioup__275->SetBinError(2,0.002167196);
   sumratioup__275->SetBinError(3,0.001617233);
   sumratioup__275->SetBinError(4,0.001528597);
   sumratioup__275->SetBinError(5,0.001538373);
   sumratioup__275->SetBinError(6,0.001141764);
   sumratioup__275->SetBinError(7,0.001103813);
   sumratioup__275->SetBinError(8,0.001058293);
   sumratioup__275->SetBinError(9,0.001107265);
   sumratioup__275->SetBinError(10,0.002872657);
   sumratioup__275->SetEntries(55);
   sumratioup__275->SetStats(0);

   ci = 1202;
   color = new TColor(ci, 0, 0, 0, " ", 0.99);
   sumratioup__275->SetFillColor(ci);
   sumratioup__275->SetFillStyle(3003);
   sumratioup__275->GetXaxis()->SetTitle("isojet 1 CSV");
   sumratioup__275->GetXaxis()->SetLabelFont(42);
   sumratioup__275->GetXaxis()->SetLabelOffset(0.007);
   sumratioup__275->GetXaxis()->SetTitleSize(0.05);
   sumratioup__275->GetXaxis()->SetTickLength(0.025);
   sumratioup__275->GetXaxis()->SetTitleFont(42);
   sumratioup__275->GetYaxis()->SetTitle("a.u.");
   sumratioup__275->GetYaxis()->SetLabelFont(42);
   sumratioup__275->GetYaxis()->SetLabelOffset(0.007);
   sumratioup__275->GetYaxis()->SetTitleSize(0.05);
   sumratioup__275->GetYaxis()->SetTickLength(0.025);
   sumratioup__275->GetYaxis()->SetTitleFont(42);
   sumratioup__275->GetZaxis()->SetLabelFont(42);
   sumratioup__275->GetZaxis()->SetLabelOffset(0.007);
   sumratioup__275->GetZaxis()->SetTitleSize(0.05);
   sumratioup__275->GetZaxis()->SetTickLength(0.025);
   sumratioup__275->GetZaxis()->SetTitleFont(42);
   sumratioup__275->Draw("hist same");
   
   TH1D *sumratiodown__276 = new TH1D("sumratiodown__276","",10,0,1);
   sumratiodown__276->SetBinContent(1,-0.01642024);
   sumratiodown__276->SetBinContent(2,-0.01365867);
   sumratiodown__276->SetBinContent(3,-0.01972749);
   sumratiodown__276->SetBinContent(4,-0.02488509);
   sumratiodown__276->SetBinContent(5,-0.02870566);
   sumratiodown__276->SetBinContent(6,-0.02550863);
   sumratiodown__276->SetBinContent(7,-0.02277492);
   sumratiodown__276->SetBinContent(8,-0.02085501);
   sumratiodown__276->SetBinContent(9,-0.01342661);
   sumratiodown__276->SetBinContent(10,-0.01031412);
   sumratiodown__276->SetBinError(1,0.002288647);
   sumratiodown__276->SetBinError(2,0.002167196);
   sumratiodown__276->SetBinError(3,0.001617233);
   sumratiodown__276->SetBinError(4,0.001528597);
   sumratiodown__276->SetBinError(5,0.001538373);
   sumratiodown__276->SetBinError(6,0.001141764);
   sumratiodown__276->SetBinError(7,0.001103813);
   sumratiodown__276->SetBinError(8,0.001058293);
   sumratiodown__276->SetBinError(9,0.001107265);
   sumratiodown__276->SetBinError(10,0.002872657);
   sumratiodown__276->SetEntries(55);
   sumratiodown__276->SetStats(0);

   ci = 1202;
   color = new TColor(ci, 0, 0, 0, " ", 0.99);
   sumratiodown__276->SetFillColor(ci);
   sumratiodown__276->SetFillStyle(3003);
   sumratiodown__276->GetXaxis()->SetTitle("isojet 1 CSV");
   sumratiodown__276->GetXaxis()->SetLabelFont(42);
   sumratiodown__276->GetXaxis()->SetLabelOffset(0.007);
   sumratiodown__276->GetXaxis()->SetTitleSize(0.05);
   sumratiodown__276->GetXaxis()->SetTickLength(0.025);
   sumratiodown__276->GetXaxis()->SetTitleFont(42);
   sumratiodown__276->GetYaxis()->SetTitle("a.u.");
   sumratiodown__276->GetYaxis()->SetLabelFont(42);
   sumratiodown__276->GetYaxis()->SetLabelOffset(0.007);
   sumratiodown__276->GetYaxis()->SetTitleSize(0.05);
   sumratiodown__276->GetYaxis()->SetTickLength(0.025);
   sumratiodown__276->GetYaxis()->SetTitleFont(42);
   sumratiodown__276->GetZaxis()->SetLabelFont(42);
   sumratiodown__276->GetZaxis()->SetLabelOffset(0.007);
   sumratiodown__276->GetZaxis()->SetTitleSize(0.05);
   sumratiodown__276->GetZaxis()->SetTickLength(0.025);
   sumratiodown__276->GetZaxis()->SetTitleFont(42);
   sumratiodown__276->Draw("hist same");
   
   Double_t Graph0_fx1023[10] = {
   0.05,
   0.15,
   0.25,
   0.35,
   0.45,
   0.55,
   0.65,
   0.75,
   0.85,
   0.95};
   Double_t Graph0_fy1023[10] = {
   -0.00725764,
   0.003892779,
   0.0223676,
   0.001661897,
   -0.0303539,
   -7.754564e-05,
   -0.002666473,
   -0.002895236,
   -0.001408637,
   0.001725793};
   Double_t Graph0_fex1023[10] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t Graph0_fey1023[10] = {
   0.01831827,
   0.01726493,
   0.02423924,
   0.02771721,
   0.02919614,
   0.03244177,
   0.03113628,
   0.03042557,
   0.02388455,
   0.01301711};
   TGraphErrors *gre = new TGraphErrors(10,Graph0_fx1023,Graph0_fy1023,Graph0_fex1023,Graph0_fey1023);
   gre->SetName("Graph0");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);
   gre->SetLineWidth(3);
   
   TH1F *Graph_Graph1023 = new TH1F("Graph_Graph1023","Graph",100,0,1.04);
   Graph_Graph1023->SetMinimum(-0.07016574);
   Graph_Graph1023->SetMaximum(0.05722253);
   Graph_Graph1023->SetDirectory(0);
   Graph_Graph1023->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1023->SetLineColor(ci);
   Graph_Graph1023->GetXaxis()->SetLabelFont(42);
   Graph_Graph1023->GetXaxis()->SetLabelOffset(0.007);
   Graph_Graph1023->GetXaxis()->SetTitleSize(0.05);
   Graph_Graph1023->GetXaxis()->SetTickLength(0.025);
   Graph_Graph1023->GetXaxis()->SetTitleFont(42);
   Graph_Graph1023->GetYaxis()->SetLabelFont(42);
   Graph_Graph1023->GetYaxis()->SetLabelOffset(0.007);
   Graph_Graph1023->GetYaxis()->SetTitleSize(0.05);
   Graph_Graph1023->GetYaxis()->SetTickLength(0.025);
   Graph_Graph1023->GetYaxis()->SetTitleFont(42);
   Graph_Graph1023->GetZaxis()->SetLabelFont(42);
   Graph_Graph1023->GetZaxis()->SetLabelOffset(0.007);
   Graph_Graph1023->GetZaxis()->SetTitleSize(0.05);
   Graph_Graph1023->GetZaxis()->SetTickLength(0.025);
   Graph_Graph1023->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1023);
   
   gre->Draw("pe0");
   pad2->Modified();
   c1->cd();
   c1->Modified();
   c1->cd();
   c1->SetSelected(c1);
}
MatrixMethod_Results_PullTest_EMu(string selection, string eventType){


  float NjetsMin = -0.5;
  float NjetsMax = 5.5;

  gROOT->SetStyle("Plain");
  gStyle->SetOptStat(0);
  
  TFile * file_Expected   = new TFile("MatrixMethod_OutPut_EMuCase_MC_Fast_PullTest.root");
  TFile * file_Estimated  = new TFile("MatrixMethod_OutPut_EMuCase_MC_Fast_PullTest.root");

  file_Expected->cd();
  TH1F* tt_TTDilept  = (TH1F*)gROOT->FindObject("MMExpected_TTEMu_TTbarSignal");
  TH1F* tl_TTDilept = (TH1F*)gROOT->FindObject("MMExpected_TLEMu_TTbarSignal");
  TH1F* lt_TTDilept  = (TH1F*)gROOT->FindObject("MMExpected_LTEMu_TTbarSignal");
  TH1F* ll_TTDilept  = (TH1F*)gROOT->FindObject("MMExpected_LLEMu_TTbarSignal");

  tt_TTDilept->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
  tl_TTDilept->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
  lt_TTDilept->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
  ll_TTDilept->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);

  TH1F* tt_TTSemi_TF  = (TH1F*)gROOT->FindObject("MMExpected_TTEMu_TTbarSemileptonic_TF");
  TH1F* tl_TTSemi_TF = (TH1F*)gROOT->FindObject("MMExpected_TLEMu_TTbarSemileptonic_TF");
  TH1F* lt_TTSemi_TF  = (TH1F*)gROOT->FindObject("MMExpected_LTEMu_TTbarSemileptonic_TF");
  TH1F* ll_TTSemi_TF  = (TH1F*)gROOT->FindObject("MMExpected_LLEMu_TTbarSemileptonic_TF");

  tt_TTSemi_TF->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
  tl_TTSemi_TF->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
  lt_TTSemi_TF->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
  ll_TTSemi_TF->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);

  TH1F* tt_TTSemi_FT  = (TH1F*)gROOT->FindObject("MMExpected_TTEMu_TTbarSemileptonic_FT");
  TH1F* tl_TTSemi_FT = (TH1F*)gROOT->FindObject("MMExpected_TLEMu_TTbarSemileptonic_FT");
  TH1F* lt_TTSemi_FT  = (TH1F*)gROOT->FindObject("MMExpected_LTEMu_TTbarSemileptonic_FT");
  TH1F* ll_TTSemi_FT  = (TH1F*)gROOT->FindObject("MMExpected_LLEMu_TTbarSemileptonic_FT");

  tt_TTSemi_FT->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
  tl_TTSemi_FT->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
  lt_TTSemi_FT->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
  ll_TTSemi_FT->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);

  TH1F* tt_TTBckg  = (TH1F*)gROOT->FindObject("MMExpected_TTEMu_TTbar");
  TH1F* tl_TTBckg = (TH1F*)gROOT->FindObject("MMExpected_TLEMu_TTbar");
  TH1F* lt_TTBckg  = (TH1F*)gROOT->FindObject("MMExpected_LTEMu_TTbar");
  TH1F* ll_TTBckg  = (TH1F*)gROOT->FindObject("MMExpected_LLEMu_TTbar");

  tt_TTBckg->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
  tl_TTBckg->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
  lt_TTBckg->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
  ll_TTBckg->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);

  tt_TTDilept->SetFillColor(kRed+1);
  tl_TTDilept->SetFillColor(kRed+1);
  lt_TTDilept->SetFillColor(kRed+1);
  ll_TTDilept->SetFillColor(kRed+1);

  tt_TTSemi_TF->SetFillColor(kRed-7);
  tl_TTSemi_TF->SetFillColor(kRed-7);
  lt_TTSemi_TF->SetFillColor(kRed-7);
  ll_TTSemi_TF->SetFillColor(kRed-7);

  tt_TTSemi_FT->SetFillColor(kRed-4);
  tl_TTSemi_FT->SetFillColor(kRed-4);
  lt_TTSemi_FT->SetFillColor(kRed-4);
  ll_TTSemi_FT->SetFillColor(kRed-4);

  tt_TTBckg->SetFillColor(kRed-7);
  tl_TTBckg->SetFillColor(kRed-7);
  lt_TTBckg->SetFillColor(kRed-7);
  ll_TTBckg->SetFillColor(kRed-7);
  
  THStack* ttSignalLike = new THStack("ttSignalLike","tt signal like");
  ttSignalLike->Add(tt_TTDilept);
  THStack* tlSignalLike = new THStack("tlSignalLike","tl signal like");
  tlSignalLike->Add(tl_TTDilept);
  THStack* ltSignalLike = new THStack("ltSignalLike","lt signal like");
  ltSignalLike->Add(lt_TTDilept);
  THStack* llSignalLike = new THStack( "llSignalLike", "ll signal like");
  llSignalLike->Add(ll_TTDilept);

  THStack* ttWLike = new THStack( "ttWLike"," tt W-like" );
  ttWLike->Add(tt_TTSemi_TF);
  ttWLike->Add(tt_TTSemi_FT);
  THStack* tlWLike = new THStack("tlWLike","tl W-like");
  tlWLike->Add(tl_TTSemi_TF);
  tlWLike->Add(lt_TTSemi_FT);
  THStack* ltWLike = new THStack( "ltWLike", "lt W-like" );
  ltWLike->Add(lt_TTSemi_TF);
  ltWLike->Add(tl_TTSemi_FT);
  THStack* llWLike = new THStack( "llWLike", "ll W-like" );
  llWLike->Add(ll_TTSemi_TF);
  llWLike->Add(ll_TTSemi_FT);
  
  THStack* ttQCDLike = new THStack("ttQCDLike",  "tt QCD-like" );
  ttQCDLike->Add(tt_TTBckg);
  THStack* tlQCDLike = new THStack("tlQCDLike","tl QCD-like");
  tlQCDLike->Add(tl_TTBckg);
  THStack* ltQCDLike = new THStack("ltQCDLike","lt QCD-like");
  ltQCDLike->Add(lt_TTBckg);
  THStack* llQCDLike = new THStack("llQCDLike",  "ll QCD-like" );
  llQCDLike->Add(ll_TTBckg);

  
  file_Estimated->cd();
  
  TH1F* estimate_LL_QCD  = (TH1F*)gROOT->FindObject("MMEstimated_LLEMu_FF" );
  TH1F* estimate_TT_QCD  = (TH1F*)gROOT->FindObject("MMEstimated_TTEMu_FF" );
  TH1F* estimate_TL_QCD = (TH1F*)gROOT->FindObject("MMEstimated_TLEMu_FF");
  TH1F* estimate_LT_QCD = (TH1F*)gROOT->FindObject("MMEstimated_LTEMu_FF");

  estimate_LL_QCD->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
  estimate_TT_QCD->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
  estimate_TL_QCD->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
  estimate_LT_QCD->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);

  // Be careful, here TF and FT estimates are added together to give WJets-like estimate
  TH1F* estimate_LL_TF  = (TH1F*)gROOT->FindObject("MMEstimated_LLEMu_TF" );
  TH1F* estimate_TT_TF  = (TH1F*)gROOT->FindObject("MMEstimated_TTEMu_TF" );
  TH1F* estimate_LT_TF = (TH1F*)gROOT->FindObject("MMEstimated_LTEMu_TF");
  TH1F* estimate_TL_TF = (TH1F*)gROOT->FindObject("MMEstimated_TLEMu_TF");

  TH1F* estimate_LL_WJets  = (TH1F*)gROOT->FindObject("MMEstimated_LLEMu_FT" );
  TH1F* estimate_TT_WJets = (TH1F*)gROOT->FindObject("MMEstimated_TTEMu_FT" );
  TH1F* estimate_LT_WJets = (TH1F*)gROOT->FindObject("MMEstimated_LTEMu_FT");
  TH1F* estimate_TL_WJets = (TH1F*)gROOT->FindObject("MMEstimated_TLEMu_FT");

  estimate_LL_WJets->Add(estimate_LL_TF, estimate_LL_WJets, 1, 1);
  estimate_TT_WJets->Add(estimate_TT_TF, estimate_TT_WJets, 1, 1);
  estimate_LT_WJets->Add(estimate_LT_TF, estimate_LT_WJets, 1, 1);
  estimate_TL_WJets->Add(estimate_TL_TF, estimate_TL_WJets, 1, 1);
  ///////

  estimate_LL_WJets->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
  estimate_TT_WJets->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
  estimate_LT_WJets->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
  estimate_TL_WJets->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);

  TH1F* estimate_LL_Signal  = (TH1F*)gROOT->FindObject("MMEstimated_LLEMu_TT" );
  TH1F* estimate_TT_Signal  = (TH1F*)gROOT->FindObject("MMEstimated_TTEMu_TT" );
  TH1F* estimate_TL_Signal = (TH1F*)gROOT->FindObject("MMEstimated_TLEMu_TT");
  TH1F* estimate_LT_Signal = (TH1F*)gROOT->FindObject("MMEstimated_LTEMu_TT");

  estimate_LL_Signal->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
  estimate_TT_Signal->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
  estimate_TL_Signal->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
  estimate_LT_Signal->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);

  title = new TLatex(10.,10.,"CMS preliminary");
  title->SetNDC();
  title->SetTextAlign(12);
  title->SetX(0.60);
  title->SetY(0.70);
  title->SetTextFont(42);
  title->SetTextSize(0.04);
  title->SetTextSizePixels(24);
    
  TLegend* qw = 0;
  qw = new TLegend(0.70,0.75,0.95,0.95);
  qw->SetFillColor(kWhite);

  if( selection == "TT"){
    
    
    if(eventType == "Signal"){
      TCanvas * canv = new TCanvas(("canvPullTest_EMu_"+selection+eventType).c_str(), ("canvPullTest_EMu_"+selection+eventType).c_str(), 600, 800);
      estimate_TT_Signal->SetMarkerStyle(20);
      estimate_TT_Signal->GetXaxis()->SetTitle("Jet multiplicity");
      estimate_TT_Signal->GetYaxis()->SetTitle("Number of events");
      estimate_TT_Signal->GetYaxis()->SetLabelSize(0.025);
      estimate_TT_Signal->SetTitle("Signal-like e#mu (tight-tight)");
      estimate_TT_Signal->Draw();
      ttSignalLike->Draw("hesame");
      estimate_TT_Signal->Draw("same");
      TH1F * tmp  = new TH1F("tmp",  "tmp",  11, -0.5,  10.5);
      tmp->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
      tmp->Add(tmp, tt_TTDilept);
      TGraphErrors *thegraph = new TGraphErrors(tmp);
      thegraph->SetFillStyle(3005);
      thegraph->SetFillColor(1);
      thegraph->Draw("e2same");
      qw->AddEntry(tt_TTDilept, " t#bar{t} signal ","f");
      qw->AddEntry(estimate_TT_Signal,    " Matrix Method  ","p");
      qw->Draw("same");
      title->Draw("same");
      canv->SaveAs("TTSignalEMu_PullTest.pdf");
    }
    
    
    if(eventType == "Wlike"){
      TCanvas * canv = new TCanvas(("canvPullTest_EMu_"+selection+eventType).c_str(), ("canvPullTest_EMu_"+selection+eventType).c_str(), 600, 800);
      estimate_TT_WJets->SetMarkerStyle(20);
      estimate_TT_WJets->GetXaxis()->SetTitle("Jet multiplicity");
      estimate_TT_WJets->GetYaxis()->SetTitle("Number of events");
      estimate_TT_WJets->GetYaxis()->SetLabelSize(0.025);
      estimate_TT_WJets->SetTitle("W+jets-like e#mu (tight-tight)");
      estimate_TT_WJets->Draw();
      ttWLike->Draw("hesame");
      estimate_TT_WJets->Draw("same");
      TH1F * tmp  = new TH1F("tmp",  "tmp",  11, -0.5,  10.5);
      tmp->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
      tmp->Add(tmp, tt_TTSemi_TF);
      tmp->Add(tmp, tt_TTSemi_FT);
      TGraphErrors *thegraph = new TGraphErrors(tmp);
      thegraph->SetFillStyle(3005);
      thegraph->SetFillColor(1);
      thegraph->Draw("e2same");
      qw->AddEntry(tt_TTSemi_TF, " t#bar{t} semileptonic TF","f");
      qw->AddEntry(tt_TTSemi_FT, " t#bar{t} semileptonic FT","f");
      qw->AddEntry(estimate_TT_WJets,    " Matrix Method  ","p");
      qw->Draw("same");
      title->Draw("same");
      canv->SaveAs("TTWlikeEMu_PullTest.pdf");
    }
    
    
    if(eventType == "QCDlike"){
      TCanvas * canv = new TCanvas(("canvPullTest_EMu_"+selection+eventType).c_str(), ("canvPullTest_EMu_"+selection+eventType).c_str(), 600, 800);
      estimate_TT_QCD->SetMarkerStyle(20);
      estimate_TT_QCD->GetXaxis()->SetTitle("Jet multiplicity");
      estimate_TT_QCD->GetYaxis()->SetTitle("Number of events");
      estimate_TT_QCD->GetYaxis()->SetLabelSize(0.025);
      estimate_TT_QCD->SetTitle("QCD-like e#mu (tight-tight)");
      estimate_TT_QCD->GetXaxis()->SetTitle("Jet multiplicity");
      estimate_TT_QCD->Draw();
      ttQCDLike->Draw("hesame");
      estimate_TT_QCD->Draw("same");
      TH1F * tmp  = new TH1F("tmp",  "tmp",  11, -0.5,  10.5);
      tmp->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
      tmp->Add(tmp, tt_TTBckg);
      TGraphErrors *thegraph = new TGraphErrors(tmp);
      thegraph->SetFillStyle(3005);
      thegraph->SetFillColor(1);
      estimate_TT_QCD->Draw("same");
      thegraph->Draw("e2same");
      qw->AddEntry(tt_TTBckg, " t#bar{t} hadronic ","f");
      qw->AddEntry(estimate_TT_QCD, " Matrix Method  ","p");
      qw->Draw("same");
      title->Draw("same");
      canv->SaveAs("TTQCDEMu_PullTest.pdf");      
    }
    
    
  }
  
  if( selection == "LT"){
    
    
    if(eventType == "Signal"){
      TCanvas * canv = new TCanvas(("canvPullTest_EMu_"+selection+eventType).c_str(), ("canvPullTest_EMu_"+selection+eventType).c_str(), 600, 800);
      estimate_LT_Signal->SetMarkerStyle(20);
      estimate_LT_Signal->GetXaxis()->SetTitle("Jet multiplicity");
      estimate_LT_Signal->GetYaxis()->SetTitle("Number of events");
      estimate_LT_Signal->GetYaxis()->SetLabelSize(0.025);
      estimate_LT_Signal->SetTitle("Signal-like e#mu (loose-tight)");
      estimate_LT_Signal->Draw();
      ltSignalLike->Draw("hesame");
      estimate_LT_Signal->Draw("same");
      TH1F * tmp  = new TH1F("tmp",  "tmp",  11, -0.5,  10.5);
      tmp->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
      tmp->Add(tmp, lt_TTDilept);
      TGraphErrors *thegraph = new TGraphErrors(tmp);
      thegraph->SetFillStyle(3005);
      thegraph->SetFillColor(1);
      thegraph->Draw("e2same");
      qw->AddEntry(lt_TTDilept, " t#bar{t} signal ","f");
      qw->AddEntry(estimate_LT_Signal,    " Matrix Method  ","p");
      qw->Draw("same");
      title->Draw("same");
      canv->SaveAs("LTSignalEMu_PullTest.pdf");
    }
    
    
    if(eventType == "Wlike"){
      TCanvas * canv = new TCanvas(("canvPullTest_EMu_"+selection+eventType).c_str(), ("canvPullTest_EMu_"+selection+eventType).c_str(), 600, 800);
      estimate_LT_WJets->SetMarkerStyle(20);
      estimate_LT_WJets->GetXaxis()->SetTitle("Jet multiplicity");
      estimate_LT_WJets->GetYaxis()->SetTitle("Number of events");
      estimate_LT_WJets->GetYaxis()->SetLabelSize(0.025);
      estimate_LT_WJets->SetTitle("W+jets-like e#mu (loose-tight)");
      estimate_LT_WJets->Draw();
      ltWLike->Draw("hesame");
      estimate_LT_WJets->Draw("same");
      TH1F * tmp  = new TH1F("tmp",  "tmp",  11, -0.5,  10.5);
      tmp->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
      tmp->Add(tmp, tl_TTSemi_TF);
      tmp->Add(tmp, lt_TTSemi_FT);
      TGraphErrors *thegraph = new TGraphErrors(tmp);
      thegraph->SetFillStyle(3005);
      thegraph->SetFillColor(1);
      thegraph->Draw("e2same");
      qw->AddEntry(tl_TTSemi_TF, " t#bar{t} semileptonic TF","f");
      qw->AddEntry(lt_TTSemi_FT, " t#bar{t} semileptonic FT","f");
      qw->AddEntry(estimate_LT_WJets,    " Matrix Method  ","p");
      qw->Draw("same");
      title->Draw("same");
      canv->SaveAs("LTWlikeEMu_PullTest.pdf");      
    }
    
    
    if(eventType == "QCDlike"){
      TCanvas * canv = new TCanvas(("canvPullTest_EMu_"+selection+eventType).c_str(), ("canvPullTest_EMu_"+selection+eventType).c_str(), 600, 800);
      estimate_LT_QCD->SetMarkerStyle(20);
      estimate_LT_QCD->GetXaxis()->SetTitle("Jet multiplicity");
      estimate_LT_QCD->GetYaxis()->SetTitle("Number of events");
      estimate_LT_QCD->GetYaxis()->SetLabelSize(0.025);
      estimate_LT_QCD->SetTitle("QCD-like e#mu (loose-tight)");
      estimate_LT_QCD->Draw();
      ltQCDLike->Draw("hesame");
      estimate_LT_QCD->Draw("same"); 
      TH1F * tmp  = new TH1F("tmp",  "tmp",  11, -0.5,  10.5);
      tmp->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
      tmp->Add(tmp, lt_TTBckg);
      TGraphErrors *thegraph = new TGraphErrors(tmp);
      thegraph->SetFillStyle(3005);
      thegraph->SetFillColor(1);
      thegraph->Draw("e2same");
      qw->AddEntry(lt_TTBckg, " t#bar{t} hadronic ","f");
      qw->AddEntry(estimate_LT_QCD, " Matrix Method  ","p");
      qw->Draw("same");
      title->Draw("same");
      canv->SaveAs("LTQCDEMu_PullTest.pdf");      
    }
    
    
  }






  if( selection == "TL"){
    
    
    if(eventType == "Signal"){
      TCanvas * canv = new TCanvas(("canvPullTest_EMu_"+selection+eventType).c_str(), ("canvPullTest_EMu_"+selection+eventType).c_str(), 600, 800);
      estimate_TL_Signal->SetMarkerStyle(20);
      estimate_TL_Signal->GetXaxis()->SetTitle("Jet multiplicity");
      estimate_TL_Signal->GetYaxis()->SetTitle("Number of events");
      estimate_TL_Signal->GetYaxis()->SetLabelSize(0.025);
      estimate_TL_Signal->SetTitle("Signal-like e#mu (tight-loose)");
      estimate_TL_Signal->Draw();
      estimate_TL_Signal->Draw();
      tlSignalLike->Draw("hesame");
      estimate_TL_Signal->Draw("same");
      TH1F * tmp  = new TH1F("tmp",  "tmp",  11, -0.5,  10.5);
      tmp->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
      tmp->Add(tmp, tl_TTDilept);
      TGraphErrors *thegraph = new TGraphErrors(tmp);
      thegraph->SetFillStyle(3005);
      thegraph->SetFillColor(1);
      thegraph->Draw("e2same");
      qw->AddEntry(tl_TTDilept, " t#bar{t} signal ","f");
      qw->AddEntry(estimate_TL_Signal,    " Matrix Method  ","p");
      qw->Draw("same");
      title->Draw("same");
      canv->SaveAs("TLSignalEMu_PullTest.pdf");
    }
    
    
    if(eventType == "Wlike"){
      TCanvas * canv = new TCanvas(("canvPullTest_EMu_"+selection+eventType).c_str(), ("canvPullTest_EMu_"+selection+eventType).c_str(), 600, 800);
      estimate_TL_WJets->SetMarkerStyle(20);
      estimate_TL_WJets->GetXaxis()->SetTitle("Jet multiplicity");
      estimate_TL_WJets->GetYaxis()->SetTitle("Number of events");
      estimate_TL_WJets->GetYaxis()->SetLabelSize(0.025);
      estimate_TL_WJets->SetTitle("W+jets-like e#mu (tight-loose)");
      estimate_TL_WJets->Draw();
      tlWLike->Draw("hesame");
      estimate_TL_WJets->Draw("same");
      TH1F * tmp  = new TH1F("tmp",  "tmp",  11, -0.5,  10.5);
      tmp->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
      tmp->Add(tmp, tl_TTSemi_TF);
      tmp->Add(tmp, lt_TTSemi_FT);
      TGraphErrors *thegraph = new TGraphErrors(tmp);
      thegraph->SetFillStyle(3005);
      thegraph->SetFillColor(1);
      thegraph->Draw("e2same");
      qw->AddEntry(tl_TTSemi_TF, " t#bar{t} semileptonic TF","f");
      qw->AddEntry(lt_TTSemi_FT, " t#bar{t} semileptonic FT","f");
      qw->Draw("same");
      title->Draw("same");
      canv->SaveAs("TLWlikeEMu_PullTest.pdf");      
    }
    
    
    if(eventType == "QCDlike"){
      TCanvas * canv = new TCanvas(("canvPullTest_EMu_"+selection+eventType).c_str(), ("canvPullTest_EMu_"+selection+eventType).c_str(), 600, 800);
      estimate_TL_QCD->SetMarkerStyle(20);
      estimate_TL_QCD->GetXaxis()->SetTitle("Jet multiplicity");
      estimate_TL_QCD->GetYaxis()->SetTitle("Number of events");
      estimate_TL_QCD->GetYaxis()->SetLabelSize(0.025);
      estimate_TL_QCD->SetTitle("QCD-like e#mu (tight-loose)");
      estimate_TL_QCD->Draw();
      tlQCDLike->Draw("hesame");
      estimate_TL_QCD->Draw("same"); 
      TH1F * tmp  = new TH1F("tmp",  "tmp",  11, -0.5,  10.5);
      tmp->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
      tmp->Add(tmp, tl_TTBckg);
      TGraphErrors *thegraph = new TGraphErrors(tmp);
      thegraph->SetFillStyle(3005);
      thegraph->SetFillColor(1);
      thegraph->Draw("e2same");
      qw->AddEntry(tl_TTBckg, " t#bar{t} hadronic ","f");
      qw->AddEntry(estimate_TL_QCD, " Matrix Method  ","p");
      qw->Draw("same");
      title->Draw("same");
      canv->SaveAs("TLQCDEMu_PullTest.pdf");      
    }
    
    
  }









  
  
  
  
  
  if( selection == "LL"){
    
    
    if(eventType == "Signal"){
      TCanvas * canv = new TCanvas(("canvPullTest_EMu_"+selection+eventType).c_str(), ("canvPullTest_EMu_"+selection+eventType).c_str(), 600, 800);
      estimate_LL_Signal->SetMarkerStyle(20);
      estimate_LL_Signal->GetXaxis()->SetTitle("Jet multiplicity");
      estimate_LL_Signal->GetYaxis()->SetTitle("Number of events");
      estimate_LL_Signal->GetYaxis()->SetLabelSize(0.025);
      estimate_LL_Signal->SetTitle("Signal-like e#mu (loose-loose)");
      estimate_LL_Signal->Draw();
      llSignalLike->Draw("hesame");
      estimate_LL_Signal->Draw("same");
      TH1F * tmp  = new TH1F("tmp",  "tmp",  11, -0.5,  10.5);
      tmp->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
      tmp->Add(tmp, ll_TTDilept);
      TGraphErrors *thegraph = new TGraphErrors(tmp);
      thegraph->SetFillStyle(3005);
      thegraph->SetFillColor(1);
      thegraph->Draw("e2same");
      qw->AddEntry(ll_TTDilept, " t#bar{t} signal ","f");
      qw->AddEntry(estimate_LL_Signal,    " Matrix Method  ","p");
      qw->Draw("same");
      title->Draw("same");
      canv->SaveAs("LLSignalEMu_PullTest.pdf");      
    }
    
    
    if(eventType == "Wlike"){
      TCanvas * canv = new TCanvas(("canvPullTest_EMu_"+selection+eventType).c_str(), ("canvPullTest_EMu_"+selection+eventType).c_str(), 600, 800);
      estimate_LL_WJets->SetMarkerStyle(20);
      estimate_LL_WJets->GetXaxis()->SetTitle("Jet multiplicity");
      estimate_LL_WJets->GetYaxis()->SetTitle("Number of events");
      estimate_LL_WJets->GetYaxis()->SetLabelSize(0.025);
      estimate_LL_WJets->SetTitle("W+jets-like e#mu (loose-loose)");
      estimate_LL_WJets->Draw();
      llWLike->Draw("hesame");
      estimate_LL_WJets->Draw("same");
      TH1F * tmp  = new TH1F("tmp",  "tmp",  11, -0.5,  10.5);
      tmp->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
      tmp->Add(tmp, ll_TTSemi_TF);
      tmp->Add(tmp, ll_TTSemi_FT);
      TGraphErrors *thegraph = new TGraphErrors(tmp);
      thegraph->SetFillStyle(3005);
      thegraph->SetFillColor(1);
      thegraph->Draw("e2same");
      qw->AddEntry(ll_TTSemi_TF, " t#bar{t} semileptonic TF","f");
      qw->AddEntry(ll_TTSemi_FT, " t#bar{t} semileptonic FT","f");
      qw->AddEntry(estimate_LL_WJets,    " Matrix Method  ","p");
      qw->Draw("same");
      title->Draw("same");
      canv->SaveAs("LLWlikeEMu_PullTest.pdf");      
    }
    
    
    if(eventType == "QCDlike"){
      TCanvas * canv = new TCanvas(("canvPullTest_EMu_"+selection+eventType).c_str(), ("canvPullTest_EMu_"+selection+eventType).c_str(), 600, 800);
      estimate_LL_QCD->SetMarkerStyle(20);
      estimate_LL_QCD->GetXaxis()->SetTitle("Jet multiplicity");
      estimate_LL_QCD->GetYaxis()->SetTitle("Number of events");
      estimate_LL_QCD->GetYaxis()->SetLabelSize(0.025);
      estimate_LL_QCD->SetTitle("QCD-like e#mu (loose-loose)");
      estimate_LL_QCD->Draw(); 
      llQCDLike->Draw("hesame");
      estimate_LL_QCD->Draw("same"); 
      TH1F * tmp  = new TH1F("tmp",  "tmp",  11, -0.5,  10.5);
      tmp->GetXaxis()->SetRangeUser(NjetsMin,NjetsMax);
      tmp->Add(tmp, ll_TTBckg);
      TGraphErrors *thegraph = new TGraphErrors(tmp);
      thegraph->SetFillStyle(3005);
      thegraph->SetFillColor(1);
      thegraph->Draw("e2same");
      qw->AddEntry(ll_TTBckg, " t#bar{t} hadronic ","f");
      qw->AddEntry(estimate_LL_QCD, " Matrix Method  ","p");
      qw->Draw("same");
      title->Draw("same");
      canv->SaveAs("LLQCDEMu_PullTest.pdf");      
    }
    
    
  }
   
 
 
}
示例#19
0
void profileDistributions(TString dist)
{
  gStyle->SetOptStat(0);
  gStyle->SetOptTitle(0);
  gStyle->SetPalette(1);

  TFile *inF=TFile::Open("~/work/top_539/plotter.root");
  TFile *inSystF=TFile::Open("~/work/top_539/plotter_syst.root");

  bool isPhi(dist.Contains("phi"));
  TString profs[]={dist,
		   dist+"toward",
		   dist+"transverse",
		   dist+"away"};
  const size_t nprofs= isPhi ? 1 : sizeof(profs)/sizeof(TString);


  Int_t colors[]={1,kBlue,kRed,kGreen-3};

  TString cats[]={"inclusive","away","transverse","toward"};

  /*
  TFile *inNomF=inF;
  TString nomTTbar="t#bar{t}";
  TString nomTTbarTitle="MG+PY";
  
  //TString systList[]={"t#bar{t}systmcatnlo"};
  //TString systLabels[]={"MC@NLO+HW"};
  
  //TString systList[]={"t#bar{t}systq2down","t#bar{t}systq2up"};
  //TString systLabels[]={"-Q^{2}","+Q^{2}"};

  //TString systList[]={"t#bar{t}systmepsdown","t#bar{t}systmepsup"};
  // TString systLabels[]={"-ME-PS","+ME-PS"};
  */

  TFile *inNomF=inSystF;
  TString nomTTbar="t#bar{t}systtunep11";
  TString nomTTbarTitle="P11";
  TString systList[]={"t#bar{t}systtunep11nocr","t#bar{t}systtunep11tev"};
  TString systLabels[]={"P11-noCR","P11TeV"};


  Int_t systColors[]={1,kAzure,kRed-6,kGreen+3};

  const size_t nSysts=sizeof(systList)/sizeof(TString);

  TString ch[]={"emu"};
  const size_t nch=sizeof(ch)/sizeof(TString);
  
  for(size_t ich=0; ich<nch; ich++)
    {
      TCanvas *c=new TCanvas("c"+ch[ich]+dist,"c"+ch[ich]+dist,800,800); c->SetTopMargin(0); c->SetBottomMargin(0);
      c->Divide(1,nprofs);
      
      TCanvas *cratios=new TCanvas("cratios"+ch[ich]+dist,"cratios"+ch[ich]+dist,800,800); cratios->SetTopMargin(0); cratios->SetBottomMargin(0);
      cratios->Divide(1,nprofs);

      TCanvas *cproj=new TCanvas("cproj"+ch[ich]+dist,"cproj"+ch[ich]+dist,600,600);
      TLegend *dataprojLeg=new TLegend(0.5,0.9,0.6,0.7,"Data","brNDC");
      TLegend *mcprojLeg=new TLegend(0.7,0.9,0.92,0.7,"MC","brNDC");
      
      for(size_t i=0; i<nprofs; i++)
	{
	  TH2 *bckgMC   = (TH2 *) inF->Get("Z#rightarrow ll/"+ch[ich]+"_"+profs[i]); 
	  bckgMC->Add( (TH2 *) inF->Get("VV/"+ch[ich]+"_"+profs[i]) );
	  bckgMC->Add( (TH2 *) inF->Get("Single top/"+ch[ich]+"_"+profs[i]) );
	  bckgMC->Add( (TH2 *) inF->Get("W+jets-multijets/"+ch[ich]+"_"+profs[i]) );
	  
	  //build the total MC with signal alternatives
	  TH2 *MC = (TH2 *) inNomF->Get(nomTTbar+"/"+ch[ich]+"_"+profs[i]) ; 
	  Double_t totalTTbar(MC->Integral());
	  MC->Add(bckgMC);
	  MC->SetDirectory(0);
	  MC->Sumw2();	  
	  
	  std::vector<TH2 *> systMC;
	  for(size_t isyst=0; isyst<nSysts; isyst++)
	    {
	      TH2F *h=(TH2F *)inSystF->Get(systList[isyst]+"/"+ch[ich]+"_"+profs[i]) ;
	      h->Scale(totalTTbar/h->Integral());
	      h->Add(bckgMC);
	      h->Sumw2();
	      h->SetDirectory(0);
	      systMC.push_back(h);
	    }
		

	  //get the data
	  TH2 *Data = (TH2 *) inF->Get("data/"+ch[ich]+"_"+profs[i]);            
	  Data->SetDirectory(0);
	  Data->Sumw2();

	  TGraphErrors *MCProf   = new TGraphErrors(MC->ProfileX());    MCProf->SetMarkerStyle(24);   MCProf->SetFillStyle(0); MCProf->SetName(ch[ich]+profs[i]+"mc");
	  TGraphErrors *DataProf = new TGraphErrors(Data->ProfileX());  DataProf->SetMarkerStyle(20); DataProf->SetFillStyle(0); DataProf->SetName(ch[ich]+profs[i]+"data");
	  
	  //build data/MC scale factors
	  std::vector<TGraphErrors *> data2mcProfs;
	  for(size_t isyst=0; isyst<=systMC.size(); isyst++)
	    {
	      TGraphErrors *prof= (isyst==0 ? MCProf : new TGraphErrors(systMC[isyst-1]->ProfileX()));
	      TString baseName(ch[ich]+profs[i]);
	      if(isyst) baseName += systList[isyst];
	      prof = (TGraphErrors *) prof->Clone(baseName+"data2mc");
	      for(int ip=0; ip<DataProf->GetN(); ip++)
		{
		  Double_t x,y,ydata,y_err,ydata_err;
		  prof->GetPoint(ip,x,y);         y_err=prof->GetErrorY(ip);
		  DataProf->GetPoint(ip,x,ydata); ydata_err=DataProf->GetErrorY(ip);
		  if(y<=0) continue;
		  prof->SetPoint(ip,x,ydata/y);
		  prof->SetPointError(ip,0,sqrt(pow(ydata*y_err,2)+pow(ydata_err*y,2))/pow(y,2));
		}
	      prof->SetFillColor(systColors[isyst]);
	      prof->SetFillStyle(3001+isyst%2);
	      prof->SetTitle( isyst==0 ? nomTTbarTitle : systLabels[isyst-1] );
	      //prof->SetMarkerStyle(24);   prof->SetFillStyle(3001); prof->SetMarkerColor(1+isyst); prof->SetMarkerColor(1+isyst); prof->SetLineColor(1+isyst);
	      data2mcProfs.push_back(prof);
	    }

	  
	  TH1D *MCProjY=MC->ProjectionY();
	  MCProjY->Scale(1./MCProjY->Integral()); 
	  TGraphErrors *MCProj   = new TGraphErrors(MCProjY);    MCProj->SetMarkerStyle(24); MCProj->SetFillStyle(0);  MCProj->SetName(ch[ich]+profs[i]+"projmc");
	  TH1D *DataProjY=Data->ProjectionY();
	  DataProjY->Scale(1./DataProjY->Integral());
	  TGraphErrors *DataProj = new TGraphErrors(DataProjY);  DataProj->SetMarkerStyle(20); DataProj->SetFillStyle(0); DataProj->SetName(ch[ich]+profs[i]+"projdata");
	  MCProj->SetLineColor(colors[i]);   MCProj->SetMarkerColor(colors[i]);   MCProj->SetFillColor(colors[i]); MCProj->SetFillStyle(1001);
	  DataProj->SetLineColor(colors[i]); DataProj->SetMarkerColor(colors[i]);   DataProj->SetFillColor(colors[i]);
	  
	  TPad *p=(TPad *)cproj->cd();
	  p->SetLeftMargin(0.15);
	  p->SetRightMargin(0.02);
	  p->SetTopMargin(0.05);
	  p->SetLogy();
	  MCProj->SetFillStyle(0);
	  MCProj->Draw(i==0 ? "al3" : "l3");
	  MCProj->GetYaxis()->SetRangeUser(1e-5,1.0);
	  MCProj->GetXaxis()->SetTitle( MC->GetYaxis()->GetTitle() );
	  MCProj->GetYaxis()->SetTitle( "1/N dN/dx" );
	  MCProj->GetYaxis()->SetTitleOffset(1.8);
	  DataProj->Draw("p");
	  std::pair<float,int> chi2=computeChiSquareFor(DataProj,MCProj);
	  char buf[200];
	  sprintf(buf,"#scale[0.7]{#chi^{2}/ndof=%3.1f}", chi2.first/chi2.second );
	  dataprojLeg->AddEntry(DataProj,buf,"p");
	  mcprojLeg->AddEntry(MCProj,cats[i],"l");
	  if(i==0) drawCMSHeader(ch[ich]);
	  

	  p=(TPad *)c->cd(i+1);
	  if(i<nprofs-1) p->SetBottomMargin(0.01);
	  if(i>0) p->SetTopMargin(0);
	  if(i==0)p->SetTopMargin(0.1);
	  if(i==nprofs-1) p->SetBottomMargin(0.15);
	  TGraphErrors *frame=DataProf;
	  frame->Draw("ap");
	  //frame->GetYaxis()->SetRangeUser(0.54,1.46);
	  frame->GetXaxis()->SetTitle(MC->GetXaxis()->GetTitle());
	  //frame->GetXaxis()->SetRangeUser(0,4.75);
	  TString yTit("<"); yTit+=MC->GetYaxis()->GetTitle(); yTit +=">";
	  frame->GetYaxis()->SetTitle(yTit);
	  frame->GetYaxis()->SetLabelSize(0.07);
	  frame->GetYaxis()->SetTitleSize(0.09);
	  frame->GetYaxis()->SetTitleOffset(0.5);
	  frame->GetXaxis()->SetLabelSize(0.07);
	  frame->GetXaxis()->SetTitleSize(0.09);
	  frame->GetXaxis()->SetTitleOffset(0.7);
	  //p->SetGridy();
	  //DataProf->Draw("p");
	  MCProf->Draw("p");
	  if(i==0)
	    {
	      drawCMSHeader(ch[ich],0.08);

	      TLegend *leg=new TLegend(0.6,0.95,1.0,0.99);
	      leg->SetBorderSize(0);
	      leg->SetFillStyle(0);
	      leg->SetTextFont(42);
	      leg->SetTextSize(0.09);
	      leg->AddEntry(DataProf,"data","p");
	      leg->AddEntry(MCProf,"simulation","p");
	      leg->SetNColumns(2);
	      leg->Draw();
	    }

	  TPaveText *pt=new TPaveText(0.15,0.5,0.8,0.85,"brNDC");
	  pt->SetBorderSize(0);
	  pt->SetFillStyle(0);
	  pt->SetTextAlign(13);
	  pt->SetTextFont(42);
	  pt->SetTextColor(kBlue);
	  pt->SetTextSize(0.08);
	  pt->AddText("[ "+cats[i]+" ]");
	  if(i==0)
	    {
	      pt->AddText("p_{T}>0.5 GeV");
	      pt->AddText("|#eta|<2.1");
	    }
	  pt->Draw();


	  p=(TPad *) cratios->cd(i+1);
	  if(i<nprofs-1) p->SetBottomMargin(0.01);
	  if(i>0) p->SetTopMargin(0);
	  if(i==0)p->SetTopMargin(0.1);
	  if(i==nprofs-1) p->SetBottomMargin(0.15);
	  frame=data2mcProfs[0];
	  frame->Draw("a3");
	  TLine *l=new TLine(frame->GetXaxis()->GetXmin(),1,frame->GetXaxis()->GetXmax(),1);
	  l->Draw();
	  frame->GetYaxis()->SetRangeUser(0.54,1.46);
	  frame->GetXaxis()->SetTitle(MC->GetXaxis()->GetTitle());
	  frame->GetYaxis()->SetTitle("Data/Simulation");
	  frame->GetYaxis()->SetLabelSize(0.07);
	  frame->GetYaxis()->SetTitleSize(0.09);
	  frame->GetYaxis()->SetTitleOffset(0.5);
	  frame->GetXaxis()->SetLabelSize(0.07);
	  frame->GetXaxis()->SetTitleSize(0.09);
	  frame->GetXaxis()->SetTitleOffset(0.7);
	  //p->SetGridy();
	  for(size_t ip=1; ip<data2mcProfs.size(); ip++) data2mcProfs[ip]->Draw("3");
	  if(i==0)
	    {
	      drawCMSHeader(ch[ich],0.08);

	      TLegend *leg=new TLegend(0.6,0.94,1.0,0.98);
	      leg->SetBorderSize(0);
	      leg->SetFillStyle(0);
	      leg->SetTextFont(42);
	      leg->SetTextSize(0.09);
	      leg->SetNColumns(data2mcProfs.size());
	      for(size_t ip=0; ip<data2mcProfs.size(); ip++)
		leg->AddEntry(data2mcProfs[ip],data2mcProfs[ip]->GetTitle(),"f");
	      leg->Draw();
	    }
	  
	  pt=new TPaveText(0.12,0.65,0.8,0.9,"brNDC");
	  pt->SetBorderSize(0);
	  pt->SetFillStyle(0);
	  pt->SetTextAlign(13);
	  pt->SetTextFont(42);
	  pt->SetTextColor(kBlue);
	  pt->SetTextSize(0.08);
	  pt->AddText("[ "+cats[i]+" ]");
	  if(i==0)
	    {
	      pt->AddText("p_{T}>0.5 GeV");
	      pt->AddText("|#eta|<2.1");
	    }
	  pt->Draw();
	}

      cproj->cd();
      dataprojLeg->SetFillStyle(0);
      dataprojLeg->SetBorderSize(0);
      dataprojLeg->SetTextFont(42);
      dataprojLeg->SetTextSize(0.03);
      dataprojLeg->Draw();
      mcprojLeg->SetFillStyle(0);
      mcprojLeg->SetBorderSize(0);
      mcprojLeg->SetTextFont(42);
      mcprojLeg->SetTextSize(0.03);
      mcprojLeg->Draw();


      TString pf(".png");
      c->SaveAs(outDir+c->GetName()+pf);
      cproj->SaveAs(outDir+cproj->GetName()+pf);
      cratios->SaveAs(outDir+cratios->GetName()+pf);

    }

  inF->Close();
  inSystF->Close();
}
示例#20
0
TCanvas * makegraph()
{
	TCanvas	*c1 = new TCanvas();
	// OUR DATA	
	Double_t qsq[5]={0.125,0.375,0.625,0.875,1.125};//X-axis!
	Double_t crosssection[5]={3.32,1.78,0.998,0.601,0.383};
	Double_t xer[5]={0.125,0.125,0.125,0.125,0.125};
	Double_t pfluxerr[5]={4.2,4.8,5.1,4.5,6.3};
	Double_t pmaerr[5]={4.9,11.3,16.2,21.0,20.0};
	Double_t pstaterr[5]={0.02,0.02,0.02,0.03,0.05};
	Double_t fluxerr[5];
	Double_t maerr[5];
	Double_t staterr[5];
	for(int i=0; i<5; i++) fluxerr[i]=pfluxerr[i]*crosssection[i]*0.01;
	for(int i=0; i<5; i++) maerr[i]=pmaerr[i]*crosssection[i]*0.01;
	for(int i=0; i<5; i++) staterr[i]=pstaterr[i]*crosssection[i];

	//sum error in quadrature
	Double_t toterr[5];
	for(int i=0; i<5; i++) toterr[i]=sqrt(	fluxerr[i]*fluxerr[i] /*+ staterr[i]*staterr[i]*/ + maerr[i]*maerr[i]	);	
	TGraphErrors *gr = new TGraphErrors(5,qsq,crosssection,xer,toterr);

	//SCIBOONE
/*	double sciqsq[6] = {0.24,0.294,0.347,0.401,0.454,0.508};
	double scicsc[6] = {1.26,0.59,0.35,0.17,0.13,0.05};
	double scixerh[6] = {0.0268,0.0268,0.0268,0.0268,0.0268,0.0268};
	double scixerl[6] = {0.0268,0.0268,0.0268,0.0268,0.0268,0.0268};
	double sciyerh[6] = {0.42,0.14,0.08,0.04,0.04,0.01};
	double sciyerl[6] = {0.56,0.19,0.1,0.05,0.08,0.03};
	TGraphAsymmErrors *scigr = new TGraphAsymmErrors(6,sciqsq,scicsc,scixerl,scixerh,sciyerl,sciyerh);*/

	//MINIBOONE	
	double minqsq[17] = {0.133,0.201,0.268,0.336,0.404,0.472,0.539,0.607,0.674,0.741,0.809,0.877,0.944,1.012,1.079,1.147,1.214};
	double mincsc[17] = {3.35,2.95,2.5,2.09,1.75,1.42,1.18,0.92,0.77,0.6,0.49,0.39,0.31,0.28,0.22,0.2,0.14};
	double minxer[17] = {0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338,0.0338};
	double minyer[17] = {0.35,0.4,0.42,0.35,0.25,0.23,0.24,0.22,0.22,0.21,0.21,0.22,0.22,0.21,0.14,0.12,0.1};
	TGraphErrors *mingr = new TGraphErrors(17,minqsq,mincsc,minxer,minyer);

	//BNL
	double bnlqsq[7] = {0.425,0.525,0.625,0.725,0.825,0.925,1.025};
	double bnlcsc[7] = {1.65,1.09,0.8,0.65,0.42,0.29,0.2};
	double bnlxer[7] = {0.05,0.05,0.05,0.05,0.05,0.05,0.05};
	double bnlyer[7] = {0.12,0.09,0.09,0.08,0.08,0.08,0.08};
	TGraphErrors *bnlgr = new TGraphErrors(7,bnlqsq,bnlcsc,bnlxer,bnlyer);

	//Multigraph? maybE?
	TMultiGraph *mg = new TMultiGraph();
	
	//Draw our data
	//Systematix
//	gr->Draw("AP");
	gr->SetFillColor(2);
    gr->SetFillStyle(3001);
	gr->GetXaxis()->SetTitle("Q^{2} / GeV^{2} ");
	gr->GetYaxis()->SetTitle("#frac{d#sigma}{dQ^{2}} 10^{-39} cm^{2}GeV^{-2} ");
//    gr->Draw("a2");
//   gr->Draw("p");

	//statistical errs too!
	TGraphErrors *gstaterr = new TGraphErrors(5,qsq,crosssection,xer,staterr);
//	gstaterr->SetFillColor(4);
//	gstaterr->SetFillStyle(3001);
//	gstaterr->Draw("p");

	//overlay minib0One
	mingr->SetFillColor(kBlue);
	mingr->SetMarkerStyle(20);
	mingr->SetFillStyle(3004);
//	mingr->Draw("samea3");
//	mingr->Draw("same");

	//dont forget about good ol' BNL
	bnlgr->SetFillColor(kGreen);
	bnlgr->SetMarkerColor(50);
	bnlgr->SetFillStyle(3002);

	//MULTIGRAPH, ASSEMBLE!
	mg->Add(gr,"a2");
	mg->Add(gstaterr,"p");
	mg->Add(mingr,"3");
	mg->Add(bnlgr,"3");
	mg->Draw();
	
	TLegend *leg = new TLegend(0.7,0.9,0.9,0.7);
	leg->AddEntry(gr, "Systematic Errors","f");
	leg->AddEntry(gstaterr, "Statistical Errors","lep");
	leg->AddEntry(mingr, "Miniboone","f");
	leg->AddEntry(bnlgr, "BNL","f");
	leg->Draw();
	
//	bnlgr->SetMarkerColor(kRed);
//	bnlgr->SetMarkerStyle(20);
//	bnlgr->Draw("sameP");


//	TGraphErrors *gr1 = new TGraphErrors(5,qsq,crosssection,xer,staterr);
//	gr1->SetMarkerStyle(1);
//	TGraphErrors *gr2 = new TGraphErrors(5,qsq,crosssection,xer,fluxerr);
//	gr2->SetMarkerStyle(1);
//	TGraphErrors *gr3 = new TGraphErrors(5,qsq,crosssection,xer,maerr);
//	gr3->SetMarkerStyle(1);
//
//	TMultiGraph *g = new TMultiGraph();
//	g->Add(gr1);
//	g->Add(gr2);
//	g->Draw("AP");
//	g->SetTitle("Cross-Section Errors");
//	g->GetXaxis()->SetTitle("Q^{2}");
//	g->GetYaxis()->SetTitle("#frac{d#sigma}{dQ^{2}}");
//
//	g->Draw("AP");
	return c1;
}	
示例#21
0
文件: makeRaa_pt.C 项目: goni/Dimuons
void makeRaa_pt( bool bSavePlots=1,
		 bool bDoDebug = 0, // adds some numbers, numerator, denominator, to help figure out if things are read properly
		 bool bAddLumi = 0, // add the lumi boxes at raa=1
		 int  whichSample     = 1,//0: no TnP corrections; 1: w/ TnP corr on Data; 2: w/ TnP corr on MC; 3: lxy w/ TnP on MC
		 const char* inputDir="../readFitTable", // the place where the input root files, with the histograms are
		 const char* outputDir="figs")// where the output figures will be
{
  gSystem->mkdir(Form("./%s/png",outputDir), kTRUE);
  gSystem->mkdir(Form("./%s/pdf",outputDir), kTRUE);
 // set the style
  setTDRStyle();
 
  // type of available comparisons:
  const char* sample[4] = {"noTnP","dataTnP","mcTnP","lxyTnP"};

  const int nInHist = 4;
  const char* yieldHistNames[nInHist] = {"pt", "ptLow", "ptLow_mb", "mb"};

  // input files: are in the filesRaa_2015.h

  // open the files with yields and do the math
  TFile *fYesWeighFile_aa   = new TFile(Form("%s/%s",inputDir,yieldHistFile_yesWeight_1[0]));
  TFile *fYesWeighFile_pp   = new TFile(Form("%s/%s",inputDir,yieldHistFile_yesWeight_1[1]));
  
  TFile *fNoWeighFile_aa = new TFile(Form("%s/%s",inputDir,yieldHistFile_noWeight_1[0]));
  TFile *fNoWeighFile_pp = new TFile(Form("%s/%s",inputDir,yieldHistFile_noWeight_1[1]));

  TFile *fEffFile_aa = new TFile(Form("%s/%s",inputDir,effHistFile[0]));
  TFile *fEffFile_pp = new TFile(Form("%s/%s",inputDir,effHistFile[1]));

  switch(whichSample){
  case 0:
    cout << "You are making Raa, with NOT TnP corrections whatsoever!"<<endl;
    fYesWeighFile_aa   = new TFile(Form("%s/%s",inputDir,yieldHistFile_yesWeight_0[0]));
    fYesWeighFile_pp   = new TFile(Form("%s/%s",inputDir,yieldHistFile_yesWeight_0[1]));
  
    fNoWeighFile_aa = new TFile(Form("%s/%s",inputDir,yieldHistFile_noWeight_0[0]));
    fNoWeighFile_pp = new TFile(Form("%s/%s",inputDir,yieldHistFile_noWeight_0[1]));

    fEffFile_aa = new TFile(Form("%s/%s",inputDir,effHistFile_noTnP[0]));
    fEffFile_pp = new TFile(Form("%s/%s",inputDir,effHistFile_noTnP[1]));
    break;

  case 2:
    cout << "You are making Raa, with TnP corrections applied on MC!"<<endl;
    fYesWeighFile_aa   = new TFile(Form("%s/%s",inputDir,yieldHistFile_yesWeight_2[0]));
    fYesWeighFile_pp   = new TFile(Form("%s/%s",inputDir,yieldHistFile_yesWeight_2[1]));
  
    fNoWeighFile_aa = new TFile(Form("%s/%s",inputDir,yieldHistFile_noWeight_2[0]));
    fNoWeighFile_pp = new TFile(Form("%s/%s",inputDir,yieldHistFile_noWeight_2[1]));
    break;

  case 3: 
    cout << "You are making Raa, with Lxy and TnP corrections applie on MC!"<<endl;
    fYesWeighFile_aa   = new TFile(Form("%s/%s",inputDir,yieldHistFile_yesWeight_3[0]));
    fYesWeighFile_pp   = new TFile(Form("%s/%s",inputDir,yieldHistFile_yesWeight_3[1]));
  
    fNoWeighFile_aa = new TFile(Form("%s/%s",inputDir,yieldHistFile_noWeight_3[0]));
    fNoWeighFile_pp = new TFile(Form("%s/%s",inputDir,yieldHistFile_noWeight_3[1]));
    break;

  case 1:
  default:
    cout<<" You are doing Raa Nominal: TnP on data!"<<endl;
    break;
  }

  if (!fYesWeighFile_aa->IsOpen() || !fYesWeighFile_pp->IsOpen()|| !fNoWeighFile_aa->IsOpen() || !fNoWeighFile_pp->IsOpen() || !fEffFile_aa->IsOpen() || !fEffFile_pp->IsOpen()) {
    cout << "One or more input files are missing" << endl;
    return ;
  }

  TH1F *phRaw_pr_pp; 
  TH1F *phCorr_pr_pp;
  TH1F *phEff_pr_pp;
  TH1F *phRaw_pr_aa; 
  TH1F *phCorr_pr_aa;
  TH1F *phEff_pr_aa;

  TH1F *phRaw_npr_pp; 
  TH1F *phCorr_npr_pp;
  TH1F *phEff_npr_pp;
  TH1F *phRaw_npr_aa; 
  TH1F *phCorr_npr_aa;
  TH1F *phEff_npr_aa;
  
  for(int ih=0; ih<nInHist;ih++) // for each kinematic range
  {
    TString hist_pr(Form("phPrp_%s",yieldHistNames[ih]));
    TString hist_npr(Form("phNPrp_%s",yieldHistNames[ih]));
    
    cout<<"histogram input name: "<< hist_pr<<"\t"<<hist_npr<<endl; 

    // prompt histos
    phRaw_pr_pp  = (TH1F*)fNoWeighFile_pp->Get(hist_pr);
    phCorr_pr_pp = (TH1F*)fYesWeighFile_pp->Get(hist_pr);
    phRaw_pr_aa  = (TH1F*)fNoWeighFile_aa->Get(hist_pr);
    phCorr_pr_aa = (TH1F*)fYesWeighFile_aa->Get(hist_pr);
    
    // non-prompt histos
    phRaw_npr_pp  = (TH1F*)fNoWeighFile_pp->Get(hist_npr);
    phCorr_npr_pp = (TH1F*)fYesWeighFile_pp->Get(hist_npr);
    phRaw_npr_aa  = (TH1F*)fNoWeighFile_aa->Get(hist_npr);
    phCorr_npr_aa = (TH1F*)fYesWeighFile_aa->Get(hist_npr);

    // efficiency histos
    phEff_pr_pp  = (TH1F*)fEffFile_pp->Get(hist_pr);
    phEff_npr_pp = (TH1F*)fEffFile_pp->Get(hist_npr);
    phEff_pr_aa  = (TH1F*)fEffFile_aa->Get(hist_pr);
    phEff_npr_aa = (TH1F*)fEffFile_aa->Get(hist_npr);

    double scaleFactor = ppLumi/nMbEvents;
    double scale_cent = 1/(adTaaMB[0]*adDeltaCentMB[0]);
  
    int numBins = 0;
    if(ih==0) numBins = nBinsPt;
    if(ih==1 || ih==2) numBins = nBinsPt3;
    if(ih==3) numBins = nBinsMB;

    for(int ibin=1; ibin<=numBins; ibin++)
    {
      double raa_pr=0, raaErr_pr=0, raa_npr=0, raaErr_npr=0;

      //prompt
      double dRelErrRaw_pr_pp  = phRaw_pr_pp->GetBinError(ibin)/phRaw_pr_pp->GetBinContent(ibin);
      double dRelErrRaw_pr_aa  = phRaw_pr_aa->GetBinError(ibin)/phRaw_pr_aa->GetBinContent(ibin);
      double yieldRatio_pr     = phCorr_pr_aa->GetBinContent(ibin)/phCorr_pr_pp->GetBinContent(ibin);
     
      raa_pr      =  yieldRatio_pr * scaleFactor * scale_cent;
      raaErr_pr   = TMath::Sqrt(TMath::Power(dRelErrRaw_pr_pp,2)+TMath::Power(dRelErrRaw_pr_aa,2))*raa_pr;

      //non-prompt
      // get the rel uncert from the raw sample
      double dRelErrRaw_npr_pp  = phRaw_npr_pp->GetBinError(ibin)/phRaw_npr_pp->GetBinContent(ibin);
      double dRelErrRaw_npr_aa  = phRaw_npr_aa->GetBinError(ibin)/phRaw_npr_aa->GetBinContent(ibin);
      double yieldRatio_npr     = phCorr_npr_aa->GetBinContent(ibin)/phCorr_npr_pp->GetBinContent(ibin);
    
      raa_npr    = yieldRatio_npr * scaleFactor * scale_cent;
      raaErr_npr = TMath::Sqrt(TMath::Power(dRelErrRaw_npr_pp,2)+TMath::Power(dRelErrRaw_npr_aa,2))*raa_npr;
     
      // fill the corresponding array
      switch(ih){
      case 0:
        prJpsi_pt[ibin-1]    = raa_pr;
        prJpsiErr_pt[ibin-1] = raaErr_pr;
              
        nonPrJpsi_pt[ibin-1]    = raa_npr;
        nonPrJpsiErr_pt[ibin-1] = raaErr_npr;
        break;

      case 1:
        prJpsi_pt365y1624_pt[ibin-1]        = raa_pr;
        prJpsiErr_pt365y1624_pt[ibin-1]     = raaErr_pr;

        nonPrJpsi_pt365y1624_pt[ibin-1]     = raa_npr;
        nonPrJpsiErr_pt365y1624_pt[ibin-1]  = raaErr_npr;
        break;

      case 2:
        prJpsi_y1624MB_pt[ibin-1]        = raa_pr;
        prJpsiErr_y1624MB_pt[ibin-1]     = raaErr_pr;

        nonPrJpsi_y1624MB_pt[ibin-1]     = raa_npr;
        nonPrJpsiErr_y1624MB_pt[ibin-1]  = raaErr_npr;

        if(bDoDebug)
        {
	  cout<<"yield_npr_aa "<<phCorr_npr_aa->GetBinContent(ibin)<<"\t yield_pr_pp "<<phCorr_npr_pp->GetBinContent(ibin)<<endl;
	  cout<<setprecision(2);
          cout<<"!!!!! raa_pr = "<<raa_pr<<"\t raa_npr= "<<raa_npr<<endl;
        }
        break;
      case 3:
        // mb
        prJpsi_mb[0]     = raa_pr;
        prJpsiErr_mb[0]  = raaErr_pr;
        
        nonPrJpsi_mb[0]     = raa_npr;
        nonPrJpsiErr_mb[0]  = raaErr_npr;
        break;
      }
    }//loop end: for(int ibin=1; ibin<=numBins; ibin++)
  }//loop end: for(int ih=0; ih<nInHist;ih++)

  // ***** //Drawing
  // pr
  TGraphErrors *gPrJpsi     = new TGraphErrors(nBinsPt, binsPt, prJpsi_pt, binsPtErr, prJpsiErr_pt);
  TGraphErrors *gPrJpsiP    = new TGraphErrors(nBinsPt, binsPt, prJpsi_pt, binsPtErr, prJpsiErr_pt);
  TGraphErrors *gPrJpsiSyst = new TGraphErrors(nBinsPt, binsPt, prJpsi_pt, binsPtX, prJpsiErrSyst_pt);

  TGraphErrors *gPrJpsi_mb     = new TGraphErrors(nBinsMB, binsPtMB, prJpsi_pt, binsPtMBErr, prJpsiErr_pt);
  TGraphErrors *gPrJpsiP_mb    = new TGraphErrors(nBinsMB, binsPtMB, prJpsi_pt, binsPtMBErr, prJpsiErr_pt);
  TGraphErrors *gPrJpsiSyst_mb = new TGraphErrors(nBinsMB, binsPtMB, prJpsi_pt, binsPtMBX  , prJpsiErrSyst_pt);
 
  TGraphErrors *gPrJpsi_y1624_mb     = new TGraphErrors(nBinsPt3, binsPt3_mb, prJpsi_y1624MB_pt, binsPt3Err_mb, prJpsiErr_y1624MB_pt);
  TGraphErrors *gPrJpsiP_y1624_mb    = new TGraphErrors(nBinsPt3, binsPt3_mb, prJpsi_y1624MB_pt, binsPt3Err_mb, prJpsiErr_y1624MB_pt);
  TGraphErrors *gPrJpsiSyst_y1624_mb = new TGraphErrors(nBinsPt3, binsPt3_mb, prJpsi_y1624MB_pt, binsPt3X_mb,   prJpsiErrSyst_y1624MB_pt);


  TGraphErrors *gPrJpsi_pt365y1624     = new TGraphErrors(nBinsPt3, binsPt3, prJpsi_pt365y1624_pt, binsPt3Err, prJpsiErr_pt365y1624_pt);
  TGraphErrors *gPrJpsiP_pt365y1624    = new TGraphErrors(nBinsPt3, binsPt3, prJpsi_pt365y1624_pt, binsPt3Err, prJpsiErr_pt365y1624_pt);
  TGraphErrors *gPrJpsiSyst_pt365y1624 = new TGraphErrors(nBinsPt3, binsPt3, prJpsi_pt365y1624_pt, binsPt3X, prJpsiErrSyst_pt365y1624_pt);

 
  // nonPr   
  TGraphErrors *gNonPrJpsi     = new TGraphErrors(nBinsPt, binsPt, nonPrJpsi_pt, binsPtErr, nonPrJpsiErr_pt);
  TGraphErrors *gNonPrJpsiP    = new TGraphErrors(nBinsPt, binsPt, nonPrJpsi_pt, binsPtErr, nonPrJpsiErr_pt);
  TGraphErrors *gNonPrJpsiSyst = new TGraphErrors(nBinsPt, binsPt, nonPrJpsi_pt, binsPtX, nonPrJpsiErrSyst_pt);

  TGraphErrors *gNonPrJpsi_mb     = new TGraphErrors(nBinsMB, binsPtMB, nonPrJpsi_pt, binsPtMBErr, nonPrJpsiErr_pt);
  TGraphErrors *gNonPrJpsiP_mb    = new TGraphErrors(nBinsMB, binsPtMB, nonPrJpsi_pt, binsPtMBErr, nonPrJpsiErr_pt);
  TGraphErrors *gNonPrJpsiSyst_mb = new TGraphErrors(nBinsMB, binsPtMB, nonPrJpsi_pt, binsPtMBX, nonPrJpsiErrSyst_pt);


  TGraphErrors *gNonPrJpsi_y1624_mb     = new TGraphErrors(nBinsPt3, binsPt3_mb, nonPrJpsi_y1624MB_pt, binsPt3Err_mb, nonPrJpsiErr_y1624MB_pt);
  TGraphErrors *gNonPrJpsiP_y1624_mb    = new TGraphErrors(nBinsPt3, binsPt3_mb, nonPrJpsi_y1624MB_pt, binsPt3Err_mb, nonPrJpsiErr_y1624MB_pt);
  TGraphErrors *gNonPrJpsiSyst_y1624_mb = new TGraphErrors(nBinsPt3, binsPt3_mb, nonPrJpsi_y1624MB_pt, binsPt3X_mb,   nonPrJpsiErrSyst_y1624MB_pt);

  TGraphErrors *gNonPrJpsi_pt365y1624     = new TGraphErrors(nBinsPt3, binsPt3, nonPrJpsi_pt365y1624_pt, binsPt3Err, nonPrJpsiErr_pt365y1624_pt);
  TGraphErrors *gNonPrJpsiP_pt365y1624    = new TGraphErrors(nBinsPt3, binsPt3, nonPrJpsi_pt365y1624_pt, binsPt3Err, nonPrJpsiErr_pt365y1624_pt);
  TGraphErrors *gNonPrJpsiSyst_pt365y1624 = new TGraphErrors(nBinsPt3, binsPt3, nonPrJpsi_pt365y1624_pt, binsPt3X,   nonPrJpsiErrSyst_pt365y1624_pt);


  //-------------------------------------------------------------------
  // **************** marker colors
  //prompt
  gPrJpsi->SetMarkerColor(kRed);
  gPrJpsi_pt365y1624->SetMarkerColor(kViolet+2);
    
  // non-prompt
  gNonPrJpsi->SetMarkerColor(kOrange+2);
  gNonPrJpsi_pt365y1624->SetMarkerColor(kViolet+2);

  //mnbias colors
  gPrJpsi_mb->SetMarkerColor(kCyan+2);
  gNonPrJpsi_mb->SetMarkerColor(kCyan+2);

  gPrJpsi_y1624_mb->SetMarkerColor(kBlue-4);
  gNonPrJpsi_y1624_mb->SetMarkerColor(kBlue-4);

  //--------- marker style  
  // pr
  gPrJpsi->SetMarkerStyle(21);
  gPrJpsiP->SetMarkerStyle(25);

  gPrJpsi_pt365y1624->SetMarkerStyle(34);
  gPrJpsiP_pt365y1624->SetMarkerStyle(28);

  // non-pr
  gNonPrJpsi->SetMarkerStyle(29);
  gNonPrJpsiP->SetMarkerStyle(30);
  
  gNonPrJpsi_pt365y1624->SetMarkerStyle(34);
  gNonPrJpsiP_pt365y1624->SetMarkerStyle(28);

  //mb
  gPrJpsi_mb->SetMarkerStyle(28);
  gPrJpsi_y1624_mb->SetMarkerStyle(21);   
  
  gNonPrJpsi_mb->SetMarkerStyle(28);
  gNonPrJpsi_y1624_mb->SetMarkerStyle(21);


  // ************** contour
  // pr
  gPrJpsiP->SetMarkerColor(kBlack);
  gPrJpsiP_pt365y1624->SetMarkerColor(kBlack);

  // nonPr
  gNonPrJpsiP->SetMarkerColor(kBlack);
  gNonPrJpsiP_pt365y1624->SetMarkerColor(kBlack);


  // marker size
  // pr
  gPrJpsi->SetMarkerSize(1.2);
  gPrJpsiP->SetMarkerSize(1.2);

  gPrJpsiP_pt365y1624->SetMarkerSize(1.7);
  gPrJpsi_pt365y1624->SetMarkerSize(1.7);

  gPrJpsi_mb->SetMarkerSize(1.5);
  gNonPrJpsi_y1624_mb->SetMarkerSize(1.5);

  // nonPr
  gNonPrJpsi->SetMarkerSize(2.0);
  gNonPrJpsiP->SetMarkerSize(2.0);
  
  gNonPrJpsiP_pt365y1624->SetMarkerSize(1.7);
  gNonPrJpsi_pt365y1624->SetMarkerSize(1.7);


  //stat boxes
  gPrJpsiSyst->SetFillColor(kRed-9);
  gPrJpsiSyst_pt365y1624->SetFillColor(kViolet-9);

  // non-pr
  gNonPrJpsiSyst->SetFillColor(kOrange-9);
  gNonPrJpsiSyst_pt365y1624->SetFillColor(kViolet-9);

  //mb
  // gPrJpsiP_mb->SetFillColor(kBlue-9);
  // gNonPrJpsiP_y1624_mb->SetFillColor(kBlue-9);
  //-------------------------------------------
  TF1 *f4 = new TF1("f4","1",0,30);
  f4->SetLineWidth(1);
  f4->GetXaxis()->SetTitle("p_{T} (GeV/c)");
  f4->GetYaxis()->SetTitle("R_{AA}");
  f4->GetYaxis()->SetRangeUser(0.0,1.5);
  f4->GetXaxis()->CenterTitle(kTRUE);

 // sqrt(sig_lumi(6%)*sig_lumi(6%)+sig_taa(5.7%)*sig_taa(5.7%)) = 0.083
  TBox *lumi = new TBox(0.0,0.917,1.,1.083);
  lumi->SetFillColor(kGray+1);


  //---------------- general stuff
  TLatex *ly     = new TLatex(20.0,0.05,"|y| < 2.4");
  ly->SetTextFont(42);
  ly->SetTextSize(0.05);
  TLatex *lcent = new TLatex(19,1.03,"Cent. 0-100%");
  lcent->SetTextFont(42);
  lcent->SetTextSize(0.05);

  TLatex *lPr = new TLatex(2,1.35,"Prompt J/#psi");
  lPr->SetTextFont(42);
  lPr->SetTextSize(0.05);

  TLatex *lNpr = new TLatex(2,1.35,"Non-prompt J/#psi");
  lNpr->SetTextFont(42);
  lNpr->SetTextSize(0.05);

  TLegend *leg11a = new TLegend(0.65,0.52,0.8,0.65);
  leg11a->SetFillStyle(0);
  leg11a->SetFillColor(0);
  leg11a->SetBorderSize(0);
  leg11a->SetMargin(0.2);
  leg11a->SetTextSize(0.04);
  leg11a->AddEntry(gPrJpsi,"|y|<2.4","P");
  leg11a->AddEntry(gPrJpsi_pt365y1624,"1.6<|y|<2.4","P");

  TLegend *leg11b = new TLegend(0.65,0.52,0.8,0.65);
  leg11b->SetFillStyle(0);
  leg11b->SetFillColor(0);
  leg11b->SetBorderSize(0);
  leg11b->SetMargin(0.2);
  leg11b->SetTextSize(0.04);
  
  leg11b->AddEntry(gPrJpsi_mb,"|y|<2.4","P");
  leg11b->AddEntry(gPrJpsi_y1624_mb,"1.6<|y|<2.4","P");

  TLegend *leg22a = new TLegend(0.65,0.52,0.8,0.65);
  leg22a->SetFillStyle(0);
  leg22a->SetFillColor(0);
  leg22a->SetBorderSize(0);
  leg22a->SetMargin(0.2);
  leg22a->SetTextSize(0.04);
  leg22a->AddEntry(gNonPrJpsi,"|y|<2.4","P");
  leg22a->AddEntry(gNonPrJpsi_pt365y1624,"1.6<|y|<2.4","P");
 
  TLegend *leg22b = new TLegend(0.65,0.52,0.8,0.65);
  leg22b->SetFillStyle(0);
  leg22b->SetFillColor(0);
  leg22b->SetBorderSize(0);
  leg22b->SetMargin(0.2);
  leg22b->SetTextSize(0.04);
  
  leg22b->AddEntry(gNonPrJpsi_mb,"|y|<2.4","P");
  leg22b->AddEntry(gNonPrJpsi_y1624_mb,"1.6<|y|<2.4","P");
 

  // ##################################################### pr plots
  TCanvas *c1 = new TCanvas("c1","c1");
  // general stuff
  f4->Draw();// axis
  if(bAddLumi) 
  {
    lumi->Draw();
    f4->Draw("same");
  }
 
  CMS_lumi(c1,103,33);
  lcent->Draw();
  lPr->Draw();
  leg11a->Draw();
  
  gPrJpsiSyst->Draw("2");
  gPrJpsi->Draw("P");
  gPrJpsiP->Draw("P");

  gPrJpsiSyst_pt365y1624->Draw("2");
  gPrJpsi_pt365y1624->Draw("P");
  gPrJpsiP_pt365y1624->Draw("P");


  if(bSavePlots)
  {
    c1->SaveAs(Form("%s/pdf/PrJpsi_vsPt_%s.pdf",outputDir,sample[whichSample]));
    c1->SaveAs(Form("%s/png/PrJpsi_vsPt_%s.png",outputDir,sample[whichSample]));
  }
  
  //-------------------minbias dependence
  TCanvas *c11b = new TCanvas("c11b","c11b");
  f4->Draw();
  if(bAddLumi)
  {
    lumi->Draw();
    f4->Draw("same");
  }
  CMS_lumi(c11b,103,33);
  lcent->Draw();
  lPr->Draw();
  leg11b->Draw();
  
  gPrJpsiSyst_mb->Draw("2");
  gPrJpsi_mb->Draw("P");
 
  gPrJpsiSyst_y1624_mb->Draw("2");
  gPrJpsi_y1624_mb->Draw("P");
 
  gPad->RedrawAxis();

  if(bSavePlots)
  {
    c11b->SaveAs(Form("%s/pdf/PrJpsi_vsPt_mb_%s.pdf",outputDir,sample[whichSample]));
    c11b->SaveAs(Form("%s/png/PrJpsi_vsPt_mb_%s.png",outputDir,sample[whichSample]));
  }

  //   // ############################################## non-pr 
  //   // ############################################## non-pr
  //   // ############################################## non-pr
  TCanvas *c2 = new TCanvas("c2","c2");
  // general stuff
  f4->Draw();// axis
  if(bAddLumi) 
  {
    lumi->Draw();
    f4->Draw("same");
  }
 
  CMS_lumi(c2,103,33);
  lcent->Draw();
  lNpr->Draw(0);
  leg22a->Draw();

  gNonPrJpsiSyst->Draw("2");
  gNonPrJpsi->Draw("P");
  gNonPrJpsiP->Draw("P");

  gNonPrJpsiSyst_pt365y1624->Draw("2");
  gNonPrJpsi_pt365y1624->Draw("P");
  gNonPrJpsiP_pt365y1624->Draw("P");

  if(bSavePlots)
  {
    c2->SaveAs(Form("%s/pdf/nonPrJpsi_vsPt_%s.pdf",outputDir,sample[whichSample]));
    c2->SaveAs(Form("%s/png/nonPrJpsi_vsPt_%s.png",outputDir,sample[whichSample]));
  }
  
  //-------------------minbias dependence
  TCanvas *c22b = new TCanvas("c22b","c22b");
  f4->Draw();
  if(bAddLumi)
  {
    lumi->Draw();
    f4->Draw("same");
  }

  CMS_lumi(c22b,103,33);
  lcent->Draw();
  lNpr->Draw(0);
  leg22b->Draw();
   
  gNonPrJpsiSyst_mb->Draw("2");
  gNonPrJpsi_mb->Draw("P");
 
  gNonPrJpsiSyst_y1624_mb->Draw("2");
  gNonPrJpsi_y1624_mb->Draw("P");

 
  gPad->RedrawAxis();

  if(bSavePlots)
  {
    c22b->SaveAs(Form("%s/pdf/nonPrJpsi_vsPt_mb_%s.pdf",outputDir,sample[whichSample]));
    c22b->SaveAs(Form("%s/png/nonPrJpsi_vsPt_mb_%s.png",outputDir,sample[whichSample]));
  }


}
示例#22
0
void v2ExpOpen_pt(bool bSavePlots = true, 
		  float rangeYAxis    = 0.6,
		  float rangeXAxis    = 30,
                  bool  bDrawCh       = true,
		  const char* inputDir= "../macro_v2/outRoot", // the place where the input root files, with the histograms are
		  const char* figNamePrefix="v2ExpOpen_pt")
{
  gSystem->mkdir(Form("./figs/png"), kTRUE);
  gSystem->mkdir(Form("./figs/pdf"), kTRUE);
  setTDRStyle();
  //  gStyle->SetCanvasPreferGL(1);
  // read CMS graphs
  TFile *pfV2Cms_cent   = new TFile(Form("%s/NPrp_v2_pt_plotter.root",inputDir));
  
  TGraphAsymmErrors *pgV2Low  = (TGraphAsymmErrors *)pfV2Cms_cent->Get("pgV2_low");
  TGraphErrors *pgV2LowSyst   = (TGraphErrors *)pfV2Cms_cent->Get("pgV2_low_sys");
  TGraphErrors *pgV2LowP      = (TGraphErrors *)pfV2Cms_cent->Get("pgV2_low_cont");

  TGraphAsymmErrors *pgV2High = (TGraphAsymmErrors *)pfV2Cms_cent->Get("pgV2");
  TGraphErrors *pgV2HighSyst  = (TGraphErrors *)pfV2Cms_cent->Get("pgV2_sys");
  TGraphErrors *pgV2HighP     = (TGraphErrors *)pfV2Cms_cent->Get("pgV2_cont");
  
  pgV2Low->SetName("pgV2Low");
  pgV2LowSyst->SetFillColorAlpha(kViolet-9,0.5);
  pgV2High->SetName("pgV2High");
  pgV2HighSyst->SetFillColorAlpha(kOrange-9,0.5);

  // -----------------------------------------------------------------------------------------
  // ----- charged hadrons
  TGraphErrors *gChar    = new TGraphErrors(19, pTChar, v2Char, chxerr, v2CharSt);
  TGraphErrors *gChar2   = new TGraphErrors(19, pTChar, v2Char, chxerr, v2CharSt2);
  TGraphErrors *gCharSys = new TGraphErrors(19, pTChar, v2Char, chxerr2, v2CharSys);
 
  gChar->SetName("gChar");
  gChar->SetMarkerStyle(20);
  gChar->SetMarkerColor(kTeal+3);
  gChar->SetLineColor(kTeal+3);
  gChar->SetMarkerSize(1.3);
  gChar2->SetMarkerStyle(24);
  gChar2->SetMarkerColor(kTeal+4);
  gChar2->SetLineColor(kTeal+4);
  gChar2->SetMarkerSize(1.3);
 
  gCharSys->SetFillColor(kTeal-9);

  //----------- D from ALICE
  TGraphErrors *pgAlice          = new TGraphErrors(6, v2AliceX_pt, v2Alice_pt, v2AliceXl, v2AliceStat_pt);
  TGraphErrors *pgAliceSys       = new TGraphErrors(6, v2AliceX_pt, v2Alice_pt, v2AliceXl, v2AliceSyst_pt);
  TGraphAsymmErrors *pgAliceSysB = new TGraphAsymmErrors(6, v2AliceX_pt, v2Alice_pt, v2AliceXl2, v2AliceXl2, v2AliceSystBLow_pt, v2AliceSystBHigh_pt);

 
  pgAlice->SetName("pgAlice");
  pgAlice->SetMarkerStyle(kOpenSquare);
  pgAlice->SetMarkerColor(kGray+2);
  pgAlice->SetLineColor(kGray+2);
  pgAlice->SetMarkerSize(1.0);
  
  pgAliceSys->SetFillStyle(0);
  pgAliceSys->SetMarkerStyle(27);
  pgAliceSys->SetMarkerColor(kGray+2);
  pgAliceSys->SetLineColor(kGray+2);
  pgAliceSys->SetMarkerSize(1.7);

  pgAliceSysB->SetFillColor(kGray);

  // drawing
  //------------------------------------------------------------------------
  // put everything on one plot
  TH1D *phAxis_v2 = new TH1D("phAxis_v2",";p_{T} (GeV/c);v_{2}",1,0,rangeXAxis);  
  phAxis_v2->SetDirectory(0);
  phAxis_v2->GetXaxis()->CenterTitle(true);
  phAxis_v2->GetXaxis()->LabelsOption("h");
  phAxis_v2->GetYaxis()->SetRangeUser(-0.01,rangeYAxis); 
  phAxis_v2->GetYaxis()->SetTitleOffset(1.25);
 
  TCanvas *pcCombi = new TCanvas("pcCombi","pcCombi");
  phAxis_v2->Draw();
  CMS_lumi(pcCombi,12001000,0);
 
  pgAliceSysB->Draw("2");
  pgAliceSys->Draw("2");
  pgAlice->Draw("pz");
 
  if (bDrawCh) {
    gCharSys->Draw("2");
    gChar->Draw("pz");
    gChar2->Draw("p");
  }
 
  pgV2LowSyst->Draw("2");
  pgV2Low->Draw("PZ");
  pgV2LowP->Draw("P");
 
  pgV2HighSyst->Draw("2");
  pgV2High->Draw("PZ");
  pgV2HighP->Draw("P");
  
  // --------- legends ----
  TLegend *leg = new TLegend(0.2,0.77,0.7,0.89,NULL,"brNDC"); // at top center
  leg->SetBorderSize(0);
  leg->SetTextFont(132);
  leg->SetTextSize(ltxSetTextSize3);
  leg->SetLineColor(1);
  leg->SetLineStyle(1);
  leg->SetLineWidth(1);
  leg->SetFillColor(19);
  leg->SetFillStyle(0);
 
  TLegendEntry *entry, *entry11;
  entry=leg->AddEntry("cmspr","Open beauty: nonprompt J/#psi","");
  entry->SetTextSize(ltxSetTextSize3);
 
  entry=leg->AddEntry("pgV2Low", "1.6 < |y| < 2.4","p");
  entry->SetTextFont(42);
  entry->SetTextSize(entrySize);
  entry=leg->AddEntry("pgV2High", "|y| < 2.4","P");
  entry->SetTextFont(42);
  entry->SetTextSize(entrySize);
 
  //--------------------------- 
  TLegend *leg1 = new TLegend(0.2,0.685,0.7,0.765,NULL,"brNDC");
  leg1->SetBorderSize(0);
  leg1->SetTextFont(132);
  leg1->SetTextSize(ltxSetTextSize3);
  
  if (bDrawCh) {
    TLegendEntry *entry1;
    entry1=leg1->AddEntry("hpm","Charged hadron","");
    entry1->SetTextFont(132);
    entry1->SetTextSize(ltxSetTextSize3);
    entry1=leg1->AddEntry("gChar","|#eta| < 0.8","P");
    entry1->SetTextFont(42);
    entry1->SetTextSize(entrySize);
  }
 
  TLegend *leg_alice;
  if (bDrawCh) {
    leg_alice = new TLegend(0.2,0.60,0.7,0.68,NULL,"brNDC");
  } else {
    leg_alice = new TLegend(0.2,0.685,0.7,0.765,NULL,"brNDC");
  }
  leg_alice->SetBorderSize(0);
  leg_alice->SetTextFont(132);
  leg_alice->SetTextSize(ltxSetTextSize3);
  leg_alice->SetLineColor(1);
  leg_alice->SetLineStyle(1);
  leg_alice->SetLineWidth(1);
  leg_alice->SetFillColor(19);
  leg_alice->SetFillStyle(0);

  TLegendEntry *entry_alice=leg_alice->AddEntry("pgAlice","Open charm: prompt D (ALICE)","");
  entry_alice=leg_alice->AddEntry("pgAlice","|y| < 0.8, Cent. 30-50\%","P");
  entry_alice->SetTextFont(42);
  entry_alice->SetTextSize(entrySize);
 
  TLatex *lat = new TLatex();
  lat->SetNDC();
  lat->SetTextFont(42);
  lat->SetTextSize(ltxSetTextSize2);
  if (bDrawCh) lat->DrawLatex(0.63,0.52,"Cent. 10-60%");
  else lat->DrawLatex(0.63,0.58,"Cent. 10-60%");

  leg->Draw();
  if (bDrawCh) leg1->Draw();
  leg_alice->Draw();
 
  gPad->RedrawAxis();
  pcCombi->Update();
  if(bSavePlots)
  {
    pcCombi->SaveAs(Form("figs/pdf/%s_RaaCh%d.pdf",figNamePrefix,bDrawCh));
    pcCombi->SaveAs(Form("figs/png/%s_RaaCh%d.png",figNamePrefix,bDrawCh));
  }
 
  return;
}
void paraPull_alpha_EL_EFF_Iso_TotalCorrUncertainty_2TeV_2Lep_plots_All()
{
//=========Macro generated from canvas: c1/alpha_EL_EFF_Iso_TotalCorrUncertainty
//=========  (Sun Nov 22 20:14:54 2015) by ROOT version6.02/12
    TCanvas *c1 = new TCanvas("c1", "alpha_EL_EFF_Iso_TotalCorrUncertainty",0,22,1000,600);
    gStyle->SetOptStat(0);
    c1->Range(-4.125,-0.9750892,37.125,1.047955);
    c1->SetFillColor(0);
    c1->SetBorderMode(0);
    c1->SetBorderSize(2);
    c1->SetGridx();
    c1->SetGridy();
    c1->SetFrameBorderMode(0);
    c1->SetFrameBorderMode(0);

    TH1F *NuisanceParameterFreed9 = new TH1F("NuisanceParameterFreed9","alpha_EL_EFF_Iso_TotalCorrUncertainty",33,0,33);
    NuisanceParameterFreed9->SetMinimum(-0.7727848);
    NuisanceParameterFreed9->SetMaximum(0.8456503);
    NuisanceParameterFreed9->SetStats(0);

    Int_t ci;      // for color index setting
    TColor *color; // for color definition with alpha
    ci = TColor::GetColor("#000099");
    NuisanceParameterFreed9->SetLineColor(ci);
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(1,"XS_ttbar");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(2,"EG_SCALE_ALL");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(3,"FT_EFF_Eigen_C_0");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(4,"Luminosity");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(5,"XS_st");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(6,"FT_EFF_Eigen_B_1");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(7,"XS_Zc");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(8,"MUONS_ID");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(9,"FT_EFF_Eigen_C_1");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(10,"FT_EFF_Eigen_C_3");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(11,"MUON_EFF_TrigSystUncertainty");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(12,"XS_Zl");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(13,"EL_EFF_ID_TotalCorrUncertainty");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(14,"FT_EFF_Eigen_B_0");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(15,"FT_EFF_Eigen_B_2");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(16,"EL_EFF_Reco_TotalCorrUncertainty");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(17,"MUONS_SCALE");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(18,"MUON_ISO_STAT");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(19,"FT_EFF_extrapolation");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(20,"MUON_EFF_STAT");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(21,"MUON_EFF_SYS");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(22,"MUON_EFF_TrigStatUncertainty");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(23,"FT_EFF_Eigen_Light_1");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(24,"FT_EFF_Eigen_Light_2");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(25,"EG_RESOLUTION_ALL");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(26,"XS_diboson");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(27,"FT_EFF_Eigen_Light_4");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(28,"FT_EFF_Eigen_Light_3");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(29,"MUON_ISO_SYS");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(30,"XS_Zb");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(31,"MUONS_MS");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(32,"FT_EFF_Eigen_C_2");
    NuisanceParameterFreed9->GetXaxis()->SetBinLabel(33,"FT_EFF_Eigen_Light_0");
    NuisanceParameterFreed9->GetXaxis()->SetLabelFont(42);
    NuisanceParameterFreed9->GetXaxis()->SetLabelSize(0.035);
    NuisanceParameterFreed9->GetXaxis()->SetTitleSize(0.035);
    NuisanceParameterFreed9->GetXaxis()->SetTitleFont(42);
    NuisanceParameterFreed9->GetYaxis()->SetTitle("#theta_{fit} - #theta_{initial}/#Delta#theta");
    NuisanceParameterFreed9->GetYaxis()->SetLabelFont(42);
    NuisanceParameterFreed9->GetYaxis()->SetLabelSize(0.035);
    NuisanceParameterFreed9->GetYaxis()->SetTitleSize(0.035);
    NuisanceParameterFreed9->GetYaxis()->SetTitleFont(42);
    NuisanceParameterFreed9->GetZaxis()->SetLabelFont(42);
    NuisanceParameterFreed9->GetZaxis()->SetLabelSize(0.035);
    NuisanceParameterFreed9->GetZaxis()->SetTitleSize(0.035);
    NuisanceParameterFreed9->GetZaxis()->SetTitleFont(42);
    NuisanceParameterFreed9->Draw("hist");

    Double_t _fx1009[35] = {
        1.22802e-312,
        0.5,
        1.5,
        2.5,
        3.5,
        4.5,
        5.5,
        6.5,
        7.5,
        8.5,
        9.5,
        10.5,
        11.5,
        12.5,
        13.5,
        14.5,
        15.5,
        16.5,
        17.5,
        18.5,
        19.5,
        20.5,
        21.5,
        22.5,
        23.5,
        24.5,
        25.5,
        26.5,
        27.5,
        28.5,
        29.5,
        30.5,
        31.5,
        32.5,
        0
    };
    Double_t _fy1009[35] = {
        1.22802e-312,
        -0.7727848,
        -0.3922476,
        -0.2907829,
        -0.2050988,
        -0.1826652,
        -0.1278621,
        -0.1246447,
        -0.1083822,
        -0.06587814,
        -0.05693349,
        -0.05334209,
        -0.04676047,
        -0.03729371,
        -0.03207689,
        -0.03107143,
        -0.01702517,
        -0.001380258,
        0.0001641211,
        0.01041877,
        0.01060027,
        0.01810894,
        0.01987367,
        0.02024918,
        0.02038876,
        0.02749887,
        0.0401174,
        0.04268003,
        0.04584905,
        0.05094516,
        0.05434531,
        0.05598196,
        0.05756905,
        0.8456503,
        0
    };
    Double_t _fex1009[35] = {
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0
    };
    Double_t _fey1009[35] = {
        0,
        0,
        0.6107702,
        1.073131,
        1.266362,
        0.9365976,
        0.9916527,
        0.9863054,
        0.9267238,
        0.7691165,
        0.9864524,
        0.9937947,
        0.9917419,
        0.9970684,
        0.9817834,
        0.9376065,
        0.9926703,
        0.9925594,
        1.005011,
        0.9933467,
        0.9551198,
        0.9932276,
        0.9929662,
        0.9927806,
        0.9913159,
        0.9909915,
        1.097968,
        0.9870135,
        0.9931711,
        0.9930639,
        0.9855126,
        0.7540343,
        0.738039,
        0.9909039,
        0.7858475
    };
    TGraphErrors *gre = new TGraphErrors(35,_fx1009,_fy1009,_fex1009,_fey1009);
    gre->SetName("");
    gre->SetTitle("");
    gre->SetFillColor(1);
    gre->SetMarkerStyle(20);
    gre->SetMarkerSize(1.2);

    TH1F *Graph_Graph1009 = new TH1F("Graph_Graph1009","",100,0,35.75);
    Graph_Graph1009->SetMinimum(-1.802262);
    Graph_Graph1009->SetMaximum(2.167356);
    Graph_Graph1009->SetDirectory(0);
    Graph_Graph1009->SetStats(0);

    ci = TColor::GetColor("#000099");
    Graph_Graph1009->SetLineColor(ci);
    Graph_Graph1009->GetXaxis()->SetLabelFont(42);
    Graph_Graph1009->GetXaxis()->SetLabelSize(0.035);
    Graph_Graph1009->GetXaxis()->SetTitleSize(0.035);
    Graph_Graph1009->GetXaxis()->SetTitleFont(42);
    Graph_Graph1009->GetYaxis()->SetLabelFont(42);
    Graph_Graph1009->GetYaxis()->SetLabelSize(0.035);
    Graph_Graph1009->GetYaxis()->SetTitleSize(0.035);
    Graph_Graph1009->GetYaxis()->SetTitleFont(42);
    Graph_Graph1009->GetZaxis()->SetLabelFont(42);
    Graph_Graph1009->GetZaxis()->SetLabelSize(0.035);
    Graph_Graph1009->GetZaxis()->SetTitleSize(0.035);
    Graph_Graph1009->GetZaxis()->SetTitleFont(42);
    gre->SetHistogram(Graph_Graph1009);

    gre->Draw("p");

    TLegend *leg = new TLegend(0.1,0.4,0.4,0.95,NULL,"brNDC");
    leg->SetBorderSize(0);
    leg->SetTextFont(72);
    leg->SetTextSize(0.015);
    leg->SetLineColor(1);
    leg->SetLineStyle(1);
    leg->SetLineWidth(1);
    leg->SetFillColor(0);
    leg->SetFillStyle(0);
    leg->Draw();

    TPaveText *pt = new TPaveText(0.2068675,0.9341608,0.7931325,0.995,"blNDC");
    pt->SetName("title");
    pt->SetBorderSize(0);
    pt->SetFillColor(0);
    pt->SetFillStyle(0);
    pt->SetTextFont(42);
    TText *AText = pt->AddText("alpha_EL_EFF_Iso_TotalCorrUncertainty");
    pt->Draw();
    c1->Modified();
    c1->cd();
    c1->SetSelected(c1);
}
示例#24
0
void PostFitCombine(TString Plots = "fit_s", TString InpDir = "FitResults_DataCardFixbtagSysVisPhSp_hSF-PreApp-v0_Tree_LepJets_NewJEC-OldKinFit_v8-0-6_Spring16-80X_36814pb-1_2btag", TString FitDir = "OBSERVED"){

  TString PlotsFileName;
  if(FitDir == "OBSERVED") PlotsFileName = "obs";
  if(FitDir == "EXPECTED") PlotsFileName = "exp";
 
  TString inputfile = "CombineResults/" + InpDir + "/" + FitDir + "/fitDiagnostics" + PlotsFileName + "MLF.root";
  
 
  setTDRStyle();

  gROOT->SetStyle("Plain");
  gStyle->SetOptFit(1000);
  gStyle->SetOptStat("emruo");
  gStyle->SetOptStat(kFALSE);
  gStyle->SetPadTickY(1);
  gStyle->SetPadTickX(1);
  
  int col_ttbb = TColor::GetColor("#660000");
  int col_ttb  = TColor::GetColor("#ffcc00");
  int col_ttcc = TColor::GetColor("#cc6600");
  int col_ttc  = TColor::GetColor("#cc6600");
  int col_ttLF = TColor::GetColor("#ff0000");
  int col_tt   = TColor::GetColor("#FF7F7F");

  int col_ttbarBkg  = TColor::GetColor("#ff6565");
  int col_SingleTop = TColor::GetColor("#ff00ff");
  int col_WJets     = TColor::GetColor("#33cc33");
  int col_ZJets     = TColor::GetColor("#3366ff");
  int col_QCD       = TColor::GetColor("#ffff00");
  int col_ttbarV    = TColor::GetColor("#e75c8d");
  int col_ttbarH    = TColor::GetColor("#e5c4f4");
  int col_VV        = TColor::GetColor("#ffffff");
 
  TFile *hfile = NULL;
  hfile = TFile::Open(inputfile);
  cout << "file loaded: " << inputfile << endl;

  std::vector<TString> hNamefile;
  std::vector<int> hColor;
  hNamefile.push_back("ttbar_LepJetsPowhegPythiattbb"); // 0
  hColor.push_back(TColor::GetColor("#660000"));
  hNamefile.push_back("ttbar_LepJetsPowhegPythiattbj"); // 1 
  hColor.push_back(TColor::GetColor("#ffcc00"));
  hNamefile.push_back("ttbar_LepJetsPowhegPythiattcc"); // 2
  hColor.push_back(TColor::GetColor("#cc6600"));
  hNamefile.push_back("ttbar_LepJetsPowhegPythiattLF"); // 3
  hColor.push_back(TColor::GetColor("#ff0000"));
  hNamefile.push_back("ttbar_PowhegPythiaBkgtt");
  hColor.push_back(TColor::GetColor("#FF7F7F"));
  hNamefile.push_back("ttHbb_PowhegPythia");
  hColor.push_back(TColor::GetColor("#e5c4f4"));
  hNamefile.push_back("ttV_Madgraph");
  hColor.push_back(TColor::GetColor("#e75c8d"));
  hNamefile.push_back("WJets_aMCatNLO");
  hColor.push_back(TColor::GetColor("#33cc33"));
  hNamefile.push_back("QCD");
  hColor.push_back(TColor::GetColor("#ffff00"));
  hNamefile.push_back("SingleTop");
  hColor.push_back(TColor::GetColor("#ff00ff"));
  hNamefile.push_back("VV");
  hColor.push_back(TColor::GetColor("#ffffff"));
  hNamefile.push_back("ZJets_aMCatNLO");
  hColor.push_back(TColor::GetColor("#3366ff"));
  hNamefile.push_back("total");
  hColor.push_back(1);
  hNamefile.push_back("total_signal");
  hColor.push_back(1);
  hNamefile.push_back("total_background");
  hColor.push_back(1);



  //TString dirname[2]     = {"Name1","Name2"};     //{mu,e}
  TString dirname[2]     = {"ch1","ch2"};     //{mu,e}
  TString titlechname[2] = {"#mu+Jets","e+Jets"}; 
  TString chname[2]      = {"mujets","ejets"};    

  std::vector<TH1D*> hInput[2];
  TH1D    *hData[2], *hData_reg[2][20];
  THStack *AllMC[2], *AllMC_reg[2][20];
  
  THStack *AllMC_CSV1[2], *AllMC_CSV2[2];

  // THStack Initialization
  for(int ich=0;ich<2;ich++){
    AllMC[ich] = new THStack("PostFit_"+chname[ich], "CSV Distribution Post-Fit ("+titlechname[ich]+")");  
    for(int ireg=0;ireg<20;ireg++){
      TString RegNum;
      RegNum.Form("%i",ireg); 
      AllMC_reg[ich][ireg] = new THStack("PostFit_"+chname[ich]+RegNum, "CSV Distribution Post-Fit ("+titlechname[ich]+") for "+RegNum);        
    } // for(ireg)
  } // for(ich)
 
  cout << "Loading histograms... " << endl;

  // MC Profiles
  for(int ich=0;ich<2;ich++){

    for(int ih=0;ih<hNamefile.size();ih++){      
      cout << "shapes_"+Plots+"/"+dirname[ich]+"/" + hNamefile.at(ih) << endl;
      TH1D *htemp = (TH1D*) hfile->Get("shapes_"+Plots+"/"+dirname[ich]+"/" + hNamefile.at(ih))->Clone("c" + hNamefile.at(ih));
      htemp->SetFillColor(hColor.at(ih));
      htemp->SetLineColor(1);
      hInput[ich].push_back(htemp);
      cout << hNamefile.at(ih) << " = " << htemp->Integral()  << endl;
      if(ih==0) AllMC[ich]->SetHistogram((TH1D*)htemp->Clone("FirstStack"));
      if (!hNamefile.at(ih).Contains("total")) AllMC[ich] -> Add(htemp);
      // Data
      // Clone Histo Structure only once
      if(ih==0){
	hData[ich] = (TH1D *) htemp->Clone("data_"+dirname[ich]);
	hData[ich]->Reset();
      }
    } // for(ih)

    // Data TGraph
    TGraphAsymmErrors *DataFull = (TGraphAsymmErrors *) hfile->Get("shapes_"+Plots+"/"+dirname[ich]+"/data")->Clone("data_"+dirname[ich]);
    for(int ibin=1;ibin<=hData[ich]->GetNbinsX();ibin++){ 
      double igb, EvtBinData, EvtErrBinData;
      DataFull->GetPoint((ibin-1),igb,EvtBinData); 
      hData[ich]->SetBinContent(ibin,EvtBinData);
      EvtErrBinData = DataFull->GetErrorY((ibin-1));
      hData[ich]->SetBinError(ibin,EvtErrBinData);
    }
    
    // Histograms for each region
    for(int ih=0;ih<hNamefile.size();ih++){

      TH1D *htemp = (TH1D*) hfile->Get("shapes_"+Plots+"/"+dirname[ich]+"/" + hNamefile.at(ih))->Clone("c_reg" + hNamefile.at(ih));
      
      for(int ireg=0;ireg<20;ireg++){
	TH1D *htempreg = new TH1D ("","",20,0,20);       
    	for(int ibin=1;ibin<=20;ibin++){
	  //if ( (ibin+20*ireg) == 181) cout << hNamefile.at(ih) << " " << ibin+20*ireg << " : " << htemp->GetBinContent(ibin+20*ireg) << " ; " << htemp->GetBinError(ibin+20*ireg) << endl;
    	  htempreg->SetBinContent(ibin,htemp->GetBinContent(ibin+20*ireg));	  
    	  htempreg->SetBinError(ibin,htemp->GetBinError(ibin+20*ireg));	  
	  htempreg->SetFillColor(hColor.at(ih));
    	} // for(ibin)
	if(ih==0) AllMC_reg[ich][ireg]->SetHistogram((TH1D*)htempreg->Clone("FirstStack"));
	if (!hNamefile.at(ih).Contains("total")) AllMC_reg[ich][ireg] -> Add(htempreg);
      } // for(ireg)
    } // for(ih)

    // Data
    for(int ireg=0;ireg<20;ireg++){
      TString RegNum;
      RegNum.Form("%i",ireg);
      hData_reg[ich][ireg] = new TH1D ("hData_"+chname[ich]+RegNum,"Data Histogram "+titlechname[ich]+" for "+RegNum,20,0,20);       

      // Data
      for(int ibin=1;ibin<=20;ibin++){ 
	double igb, EvtBinData, EvtErrBinData;
	DataFull->GetPoint(((ibin-1)+(20*ireg)),igb,EvtBinData); 
	hData_reg[ich][ireg]->SetBinContent(ibin,EvtBinData);	  
	EvtErrBinData = DataFull->GetErrorY((ibin-1));
	hData_reg[ich][ireg]->SetBinError(ibin,EvtErrBinData);

	hData_reg[ich][ireg]->SetMarkerStyle(20);
	hData_reg[ich][ireg]->SetMarkerSize(0.5);
      } // for(ibin)
    } // for(ireg)


    // Recover basic CSV plots
    // -- MC
    TH1D *GlobalCSVJet[12][2]; // 12 components
    AllMC_CSV1[ich] = new THStack("CSV1_"+chname[ich], "CSV-AddJet1 Distribution Post-Fit ("+titlechname[ich]+")");
    AllMC_CSV2[ich] = new THStack("CSV2_"+chname[ich], "CSV-AddJet2 Distribution Post-Fit ("+titlechname[ich]+")");

    for(int ih=0;ih<12;ih++){
      GlobalCSVJet[ih][0] = new TH1D("GlobalCSVJet1_" + hNamefile.at(ih), "CSV distribution for AddJet-1", 20, 0.0, 1.0);
      GlobalCSVJet[ih][1] = new TH1D("GlobalCSVJet2_" + hNamefile.at(ih), "CSV distribution for AddJet-2", 20, 0.0, 1.0);
      RecoverCSVHisto (hInput[ich].at(ih), GlobalCSVJet[ih][0], GlobalCSVJet[ih][1]);
      GlobalCSVJet[ih][0]->SetFillColor(hColor.at(ih));
      GlobalCSVJet[ih][1]->SetFillColor(hColor.at(ih));
      
      if(ih==0) AllMC_CSV1[ich]->SetHistogram((TH1D*)GlobalCSVJet[ih][0]->Clone("FirstStack"));
      if(ih==0) AllMC_CSV2[ich]->SetHistogram((TH1D*)GlobalCSVJet[ih][1]->Clone("FirstStack"));
      AllMC_CSV1[ich] -> Add(GlobalCSVJet[ih][0]);
      AllMC_CSV2[ich] -> Add(GlobalCSVJet[ih][1]);
    }

    // -- Data
    TH1D *GlobalCSVJet_Data[2]; // 12 components
    GlobalCSVJet_Data[0] = new TH1D("GlobalCSVJet1_Data", "CSV distribution for AddJet-1", 20, 0.0, 1.0);
    GlobalCSVJet_Data[1] = new TH1D("GlobalCSVJet2_Data", "CSV distribution for AddJet-2", 20, 0.0, 1.0);
    RecoverCSVHisto (hData[ich], GlobalCSVJet_Data[0], GlobalCSVJet_Data[1]);
    
    // -----------
    // Plotting
    // -----------

    TH1D *hstyle = new TH1D ("","",
			     hData[ich]->GetNbinsX(),
			     hData[ich]->GetBinLowEdge (1),
			     hData[ich]->GetBinLowEdge (hData[ich]->GetNbinsX()+1));
    
    hstyle -> SetMaximum(1.1*hInput[ich].at(12)->GetMaximum());
    hstyle -> GetYaxis()->SetTitleFont(42);
    hstyle -> GetYaxis()->SetTitleOffset(0.7);
    hstyle -> GetYaxis()->SetTitleSize(0.05);
    hstyle -> GetYaxis()->SetLabelFont(42);
    hstyle -> GetYaxis()->SetLabelSize(0.045);
    hstyle -> GetYaxis()->SetNdivisions(607);
    hstyle -> GetYaxis()->SetTitle("Events / unit"); 
    
    
    hData[ich] -> SetMarkerStyle(20); 
    hData[ich] -> SetMarkerSize(0.4); 
    hData[ich] -> SetLineWidth(1); 
    hData[ich] -> SetTitle(""); 
    
    
    TCanvas *cPlots;//histos
    cPlots = new TCanvas("cPlots"+dirname[ich] ,"Plots");
    cPlots->Divide(1,2);
    TPad    *pad[4], *glpad[2];
    // Global Pad
    glpad[0] = (TPad*)cPlots->GetPad(1);
    glpad[0]->Divide(1,2);
    glpad[1] = (TPad*)cPlots->GetPad(2);
    glpad[1]->Divide(1,2);

    //Plot Pad
    pad[0] = (TPad*)glpad[0]->GetPad(1);
    pad[0]->SetPad(0.01, 0.23, 0.99, 0.99);
    pad[0]->SetTopMargin(0.1);
    pad[0]->SetRightMargin(0.04);
    
    //Ratio Pad
    pad[1] = (TPad*)glpad[0]->GetPad(2);
    pad[1]->SetPad(0.01, 0.02, 0.99, 0.3);
    gStyle->SetGridWidth(1);
    gStyle->SetGridColor(14);
    pad[1]->SetGridx();
    pad[1]->SetGridy();
    pad[1]->SetTopMargin(0.05);
    pad[1]->SetBottomMargin(0.4);
    pad[1]->SetRightMargin(0.04);

    //Plot Pad
    pad[2] = (TPad*)glpad[1]->GetPad(1);
    pad[2]->SetPad(0.01, 0.23, 0.99, 0.99);
    pad[2]->SetTopMargin(0.1);
    pad[2]->SetRightMargin(0.04);
    
    //Ratio Pad
    pad[3] = (TPad*)glpad[1]->GetPad(2);
    pad[3]->SetPad(0.01, 0.02, 0.99, 0.3);
    gStyle->SetGridWidth(1);
    gStyle->SetGridColor(14);
    pad[3]->SetGridx();
    pad[3]->SetGridy();
    pad[3]->SetTopMargin(0.05);
    pad[3]->SetBottomMargin(0.4);
    pad[3]->SetRightMargin(0.04);
    
    pad[0]->cd();

    hstyle->Draw();
    AllMC[ich] -> Draw("HISTSAME"); 
    hData[ich] -> Draw("PSAME"); 
    
    TH1D *RatioFull = HistoRatio (hData[ich] , (TH1D*) AllMC[ich]->GetStack()->Last());
    TGraphErrors *gRatioFull = new TGraphErrors(RatioFull);
    gRatioFull->SetFillStyle(1001);
    gRatioFull->SetFillColor(chatch);
    gRatioFull->SetName("gRatioFull");


    TLegend *leg;
    float legPos[4] = {0.70,  // x_o
		       0.40,  // y_o
		       0.94,  // x_f
		       0.87}; // y_f
 
    leg = new TLegend(legPos[0],legPos[1],legPos[2],legPos[3]);
    leg->SetFillColor(0);
    leg->SetLineColor(0);
    leg->SetLineWidth(0.0);
    leg->SetTextFont(62);
    leg->SetTextSize(0.03);
    leg->SetNColumns(2);
  
    leg->AddEntry(hData[ich],         "Data","PL");
    leg->AddEntry(hInput[ich].at(11), "Z+Jets","F");
    leg->AddEntry(hInput[ich].at(10), "VV","F");
    leg->AddEntry(hInput[ich].at(9),  "Single t","F");
    leg->AddEntry(hInput[ich].at(8),  "QCD","F");
    leg->AddEntry(hInput[ich].at(7),  "W+Jets","F");
    leg->AddEntry(hInput[ich].at(6),  "t#bar{t}+V","F");
    leg->AddEntry(hInput[ich].at(5),  "t#bar{t}+H","F");
    leg->AddEntry(hInput[ich].at(4),  "t#bar{t}+other","F");
    leg->AddEntry(hInput[ich].at(3),  "t#bar{t}+LF","F");
    leg->AddEntry(hInput[ich].at(2),  "t#bar{t}+cc","F");
    leg->AddEntry(hInput[ich].at(1),  "t#bar{t}+bj","F");
    leg->AddEntry(hInput[ich].at(0),  "t#bar{t}+bb","F");
    leg->AddEntry(gRatioFull,         "Stat. Unc.","F");

    leg->Draw("SAME");
    
    TLatex *titlePr;      
    titlePr  = new TLatex(-20.,50.,"35.9 fb^{-1} (13TeV)");
    titlePr->SetNDC();
    titlePr->SetTextAlign(12);
    titlePr->SetX(0.78);
    titlePr->SetY(0.935);
    titlePr->SetTextFont(42);
    titlePr->SetTextSize(0.05);
    titlePr->SetTextSizePixels(24);
    titlePr->Draw("SAME");
    
    TLatex *title;
    //title  = new TLatex(-20.,50.,"CMS(2016) #sqrt{s} = 13TeV, L = 35.9 fb^{-1}");
    title  = new TLatex(-20.,50.,"CMS");
    title->SetNDC();
    title->SetTextAlign(12);
    title->SetX(0.13);
    title->SetY(0.84);
    title->SetTextFont(61);
    title->SetTextSize(0.06);
    title->SetTextSizePixels(24);
    title->Draw("SAME");
  
    TLatex *chtitle;
    chtitle  = new TLatex(-20.,50.,titlechname[ich]+"");
    chtitle->SetNDC();
    chtitle->SetTextAlign(12);
    chtitle->SetX(0.14);
    chtitle->SetY(0.74);
    chtitle->SetTextFont(42);
    chtitle->SetTextSize(0.05);
    chtitle->SetTextSizePixels(24);
    chtitle->Draw("SAME");

    pad[2]->cd();
    pad[2]->cd()->SetLogy();
    
    TH1D *hstyleLog = (TH1D *)hstyle->Clone();
    hstyleLog -> SetMaximum(10.0*hInput[ich].at(12)->GetMaximum());
    hstyleLog -> SetMinimum(0.8);
    hstyleLog -> Draw();
    
    AllMC[ich] -> Draw("HISTSAME"); 
    hData[ich] -> Draw("PSAME"); 
    titlePr->Draw("SAME");
    title->Draw("SAME");
    chtitle->Draw("SAME");

    pad[1]->cd();
    RatioFull ->Draw("HIST");
    gRatioFull->Draw("e2");
    RatioFull ->Draw("HISTSAME");

    pad[3]->cd();
    RatioFull ->Draw("HIST");
    gRatioFull->Draw("e2");
    RatioFull ->Draw("HISTSAME");

    TString dirfigname_pdf = "CombineResults/Figures_" + InpDir + Plots + FitDir + "/";
    // make a dir if it does not exist!!
    gSystem->mkdir(dirfigname_pdf, kTRUE);

    cPlots->SaveAs(dirfigname_pdf + "FullHisto_" + dirname[ich] + "_NormLog.pdf");

    // -----------------------------------------------------------------------------
    // Only Log Plots
    // -----------------------------------------------------------------------------

    TCanvas *cPlotsLog;//histos                                                                                                                                                                   
    cPlotsLog = new TCanvas("cPlotsLog"+dirname[ich] ,"Plots");
    cPlotsLog->Divide(1,2);
    TPad    *padLog[2];

    //Plot Pad
    padLog[0] = (TPad*)cPlotsLog->GetPad(1);
    padLog[0]->SetPad(0.01, 0.23, 0.99, 0.99);
    padLog[0]->SetTopMargin(0.1);
    padLog[0]->SetRightMargin(0.04);
    
    //Ratio Pad
    padLog[1] = (TPad*)cPlotsLog->GetPad(2);;
    padLog[1]->SetPad(0.01, 0.02, 0.99, 0.3);
    gStyle->SetGridWidth(1);
    gStyle->SetGridColor(14);
    padLog[1]->SetGridx();
    padLog[1]->SetGridy();
    padLog[1]->SetTopMargin(0.05);
    padLog[1]->SetBottomMargin(0.4);
    padLog[1]->SetRightMargin(0.04);

    padLog[0]->cd();
    padLog[0]->cd()->SetLogy();
    
    hstyleLog -> Draw();
    
    AllMC[ich] -> Draw("HISTSAME"); 
    hData[ich] -> Draw("PSAME"); 
    titlePr->Draw("SAME");
    title->Draw("SAME");
    chtitle->Draw("SAME");

    TLegend *legLog;
    legLog = new TLegend(0.70,0.60,0.94,0.87);
    legLog->SetFillColor(0);
    legLog->SetLineColor(0);
    legLog->SetLineWidth(0.0);
    legLog->SetTextFont(62);
    legLog->SetTextSize(0.03);
    legLog->SetNColumns(2);
  
    legLog->AddEntry(hData[ich],         "Data","PL");
    legLog->AddEntry(hInput[ich].at(11), "Z+Jets","F");
    legLog->AddEntry(hInput[ich].at(10), "VV","F");
    legLog->AddEntry(hInput[ich].at(9),  "Single t","F");
    legLog->AddEntry(hInput[ich].at(8),  "QCD","F");
    legLog->AddEntry(hInput[ich].at(7),  "W+Jets","F");
    legLog->AddEntry(hInput[ich].at(6),  "t#bar{t}+V","F");
    legLog->AddEntry(hInput[ich].at(5),  "t#bar{t}+H","F");
    legLog->AddEntry(hInput[ich].at(4),  "t#bar{t}+other","F");
    legLog->AddEntry(hInput[ich].at(3),  "t#bar{t}+LF","F");
    legLog->AddEntry(hInput[ich].at(2),  "t#bar{t}+cc","F");
    legLog->AddEntry(hInput[ich].at(1),  "t#bar{t}+bj","F");
    legLog->AddEntry(hInput[ich].at(0),  "t#bar{t}+bb","F");
    legLog->AddEntry(gRatioFull,         "Stat. Unc.","F");
    legLog->Draw("SAME");

    padLog[1]->cd();
    RatioFull ->Draw("HIST");
    gRatioFull->Draw("e2");
    RatioFull ->Draw("HISTSAME");

    cPlotsLog->SaveAs(dirfigname_pdf + "FullHisto_" + dirname[ich] + "_OnlyLog.pdf");
    
    // -----------------------------------------------------------------------------
    // -----------------------------------------------------------------------------
    // -----------------------------------------------------------------------------
    // Plots by Regions
    // -----------------------------------------------------------------------------
    // -----------------------------------------------------------------------------
    // -----------------------------------------------------------------------------
    int ireg = 0;
    for(int ican=0;ican<5;ican++){

      TString CanNum;
      CanNum.Form("%i",ican); 
      TCanvas *cPlots_reg;//histos
      cPlots_reg = new TCanvas("cPlots_reg" + CanNum + dirname[ich] ,"Plots By regions");
      cPlots_reg->Divide(2,2);
      
      for(int icr=1;icr<=4;icr++){

        //cPlots_reg->cd(icr);

	TPad *glpad_reg = (TPad*)cPlots_reg->cd(icr);
	glpad_reg->Divide(2,1);
	TPad *pad_reg[2];
	//Plot Pad
	pad_reg[0] = (TPad*)glpad_reg->GetPad(1);
	pad_reg[0]->SetPad(0.01, 0.23, 0.99, 0.99);
	pad_reg[0]->SetTopMargin(0.1);
	pad_reg[0]->SetRightMargin(0.04);	
	//Ratio Pad
	pad_reg[1] = (TPad*)glpad_reg->GetPad(2);
	pad_reg[1]->SetPad(0.01, 0.02, 0.99, 0.3);
	gStyle->SetGridWidth(1);
	gStyle->SetGridColor(14);
	pad_reg[1]->SetGridx();
	pad_reg[1]->SetGridy();
	pad_reg[1]->SetTopMargin(0.05);
	pad_reg[1]->SetBottomMargin(0.4);
	pad_reg[1]->SetRightMargin(0.04);

	pad_reg[0]->cd();
	pad_reg[0]->SetLogy();
	TH1D *hstyle_reg = (TH1D*)AllMC_reg[ich][ireg]->GetHistogram(); 
	hstyle_reg -> Reset();
	hstyle_reg -> SetMaximum(10.0*hData_reg[ich][ireg]->GetMaximum());
	hstyle_reg -> SetMinimum(0.7);
	hstyle_reg -> GetYaxis()->SetTitleOffset(0.9);
	hstyle_reg -> GetYaxis()->SetTitleSize(0.05);
	hstyle_reg -> GetYaxis()->SetLabelSize(0.05);
	hstyle_reg -> GetYaxis()->SetTitle("Events"); 

	pad_reg[0]->cd();
	hstyle_reg->Draw();
	AllMC_reg[ich][ireg] -> Draw("HISTSAME"); 
	hData_reg[ich][ireg] -> Draw("E1SAME"); 
	titlePr->Draw("SAME");
	title->Draw("SAME");
	chtitle->Draw("SAME");	

	TH1D *RatioFull_reg = HistoRatio (hData_reg[ich][ireg] , (TH1D*) AllMC_reg[ich][ireg]->GetStack()->Last());
	TGraphErrors *gRatioFull_reg = new TGraphErrors(RatioFull_reg);
	gRatioFull_reg->SetFillStyle(1001);
	gRatioFull_reg->SetFillColor(chatch);
	gRatioFull_reg->SetName("gRatioFull");
	
	pad_reg[1]->cd();
	RatioFull_reg->GetYaxis()->SetTitleOffset(0.25);	
	RatioFull_reg->Draw("HIST");
	gRatioFull_reg->Draw("e2");
	RatioFull_reg->Draw("HISTSAME");
	
	ireg++;
      } // for(ireg) 

      cPlots_reg->SaveAs(dirfigname_pdf + "RegionHisto_" + CanNum + "_" + dirname[ich] + "_NormLog.pdf");
    } // for(ican) 


    TCanvas *cPlotsI;
    cPlotsI = new TCanvas("cPlotsI"+dirname[ich] ,"Plots");
    cPlotsI->Divide(1,2);

    TPad    *padI[4];
    //Plot Pad
    padI[0] = (TPad*)cPlotsI->GetPad(1);
    padI[0]->SetPad(0.01, 0.23, 0.99, 0.99);
    padI[0]->SetTopMargin(0.1);
    padI[0]->SetRightMargin(0.04);
    
    //Ratio Pad
    padI[1] = (TPad*)cPlotsI->GetPad(2);
    padI[1]->SetPad(0.01, 0.02, 0.99, 0.3);
    gStyle->SetGridWidth(1);
    gStyle->SetGridColor(14);
    padI[1]->SetGridx();
    padI[1]->SetGridy();
    padI[1]->SetTopMargin(0.05);
    padI[1]->SetBottomMargin(0.4);
    padI[1]->SetRightMargin(0.04);

    TCanvas *cPlotsII;
    cPlotsII = new TCanvas("cPlotsII"+dirname[ich] ,"Plots");
    cPlotsII->Divide(1,2);
    //Plot Pad
    padI[2] = (TPad*)cPlotsII->GetPad(1);
    padI[2]->SetPad(0.01, 0.23, 0.99, 0.99);
    padI[2]->SetTopMargin(0.1);
    padI[2]->SetRightMargin(0.04);
    
    //Ratio Pad
    padI[3] = (TPad*)cPlotsII->GetPad(2);
    padI[3]->SetPad(0.01, 0.02, 0.99, 0.3);
    gStyle->SetGridWidth(1);
    gStyle->SetGridColor(14);
    padI[3]->SetGridx();
    padI[3]->SetGridy();
    padI[3]->SetTopMargin(0.05);
    padI[3]->SetBottomMargin(0.4);
    padI[3]->SetRightMargin(0.04);
    


    TH1D *hstyleI = new TH1D ("hstyleI","",
			      GlobalCSVJet_Data[1]->GetNbinsX(),
			      GlobalCSVJet_Data[1]->GetBinLowEdge (1),
			      GlobalCSVJet_Data[1]->GetBinLowEdge (GlobalCSVJet_Data[1]->GetNbinsX()+1));
    
    hstyleI -> SetMaximum(1.1*GlobalCSVJet_Data[1]->GetMaximum());
    hstyleI -> GetYaxis()->SetTitleOffset(0.8);
    hstyleI -> GetYaxis()->SetTitleSize(0.05);
    hstyleI -> GetYaxis()->SetLabelSize(0.05);
    hstyleI -> GetYaxis()->SetTitle("Events"); 
    
    GlobalCSVJet_Data[0] -> SetMarkerStyle(20); 
    GlobalCSVJet_Data[0] -> SetMarkerSize(0.4); 
    GlobalCSVJet_Data[0] -> SetLineWidth(1); 
    GlobalCSVJet_Data[0] -> SetTitle(""); 


    padI[0]->cd();
    padI[0]->cd()->SetLogy();
    
    hstyleI -> SetMaximum(100.0*GlobalCSVJet_Data[0]->GetMaximum());
    hstyleI -> SetMinimum(0.7);
    hstyleI -> Draw();

    AllMC_CSV1[ich] -> Draw("HISTSAME");

    GlobalCSVJet_Data[0] -> SetMarkerStyle(20); 
    GlobalCSVJet_Data[0] -> SetMarkerSize(0.6); 
    GlobalCSVJet_Data[0] -> SetLineWidth(1); 
    GlobalCSVJet_Data[0] -> SetTitle(""); 
    GlobalCSVJet_Data[0] -> Draw("SAME");

    titlePr->Draw("SAME");
    title->Draw("SAME");
    chtitle->Draw("SAME");	

    TLegend *legI;
    legI = new TLegend(0.70,0.64,0.93,0.87);
    legI->SetFillColor(0);
    legI->SetLineColor(0);
    legI->SetLineWidth(0.0);
    legI->SetTextFont(62);
    legI->SetTextSize(0.03);
    legI->SetNColumns(2);
  
    legI->AddEntry(hData[ich],         "Data","PL");
    legI->AddEntry(hInput[ich].at(11), "Z+Jets","F");
    legI->AddEntry(hInput[ich].at(10), "VV","F");
    legI->AddEntry(hInput[ich].at(9),  "Single t","F");
    legI->AddEntry(hInput[ich].at(8),  "QCD","F");
    legI->AddEntry(hInput[ich].at(7),  "W+Jets","F");
    legI->AddEntry(hInput[ich].at(6),  "t#bar{t}+V","F");
    legI->AddEntry(hInput[ich].at(5),  "t#bar{t}+H","F");
    legI->AddEntry(hInput[ich].at(4),  "t#bar{t}+other","F");
    legI->AddEntry(hInput[ich].at(3),  "t#bar{t}+LF","F");
    legI->AddEntry(hInput[ich].at(2),  "t#bar{t}+cc","F");
    legI->AddEntry(hInput[ich].at(1),  "t#bar{t}+bj","F");
    legI->AddEntry(hInput[ich].at(0),  "t#bar{t}+bb","F");
    legI->AddEntry(gRatioFull,         "Stat. Unc.","F");

    legI->Draw("SAME");

    TH1D *RatioFullJet1 = HistoRatio (GlobalCSVJet_Data[0] , (TH1D*) AllMC_CSV1[ich]->GetStack()->Last());
    TGraphErrors *gRatioFullJet1 = new TGraphErrors(RatioFullJet1);
    gRatioFullJet1->SetFillStyle(1001);
    gRatioFullJet1->SetFillColor(chatch);
    gRatioFullJet1->SetName("gRatioFullJet2");

    padI[1]->cd();
    RatioFullJet1 ->GetYaxis()->SetTitleOffset(0.25);
    RatioFullJet1 ->GetXaxis()->SetTitle("CSVv2");
    RatioFullJet1 ->Draw("HIST");
    gRatioFullJet1->Draw("e2");
    RatioFullJet1 ->Draw("HISTSAME");

    padI[2]->cd();
    padI[2]->cd()->SetLogy();
    // No Log
    TH1D *hstyleII = (TH1D *)hstyleI -> Clone("StyleII"); 
    hstyleII -> SetMaximum(100.0*GlobalCSVJet_Data[1]->GetMaximum());
    hstyleII -> SetMinimum(0.7);

    hstyleII -> Draw();
    AllMC_CSV2[ich] -> Draw("HISTSAME");

    GlobalCSVJet_Data[1] -> SetMarkerStyle(20); 
    GlobalCSVJet_Data[1] -> SetMarkerSize(0.5); 
    GlobalCSVJet_Data[1] -> SetLineWidth(1); 
    GlobalCSVJet_Data[1] -> SetTitle(""); 
    GlobalCSVJet_Data[1] -> Draw("SAME");

    titlePr->Draw("SAME");
    title->Draw("SAME");
    chtitle->Draw("SAME");	

    legI->Draw("SAME");

    TH1D *RatioFullJet2 = HistoRatio (GlobalCSVJet_Data[1] , (TH1D*) AllMC_CSV2[ich]->GetStack()->Last());
    TGraphErrors *gRatioFullJet2 = new TGraphErrors(RatioFullJet2);
    gRatioFullJet2->SetFillStyle(1001);
    gRatioFullJet2->SetFillColor(chatch);
    gRatioFullJet2->SetName("gRatioFullJet2");

    padI[3]->cd();
    RatioFullJet2 ->GetYaxis()->SetTitleOffset(0.25);
    RatioFullJet2 ->GetXaxis()->SetTitle("CSVv2");
    RatioFullJet2 ->Draw("HIST");
    gRatioFullJet2->Draw("e2");
    RatioFullJet2 ->Draw("HISTSAME");


    cPlotsI ->SaveAs(dirfigname_pdf + "CSVHistosJet1_" + dirname[ich] + "_Log.pdf");
    cPlotsII->SaveAs(dirfigname_pdf + "CSVHistosJet2_" + dirname[ich] + "_Log.pdf");

    // ttbb Shape

    


  }// for(ich)
  

}
void result_JES_akPu4PF_(refpt> 75 && refpt < 120)&&(abs(refeta)<2)_Centrality()
{
//=========Macro generated from canvas: Can_result_0/
//=========  (Mon Apr 18 02:39:41 2016) by ROOT version6.02/13
   TCanvas *Can_result_0 = new TCanvas("Can_result_0", "",18,40,700,500);
   gStyle->SetOptFit(1);
   Can_result_0->Range(-18.75,0.9236134,118.75,1.043845);
   Can_result_0->SetFillColor(0);
   Can_result_0->SetBorderMode(0);
   Can_result_0->SetBorderSize(2);
   Can_result_0->SetFrameBorderMode(0);
   Can_result_0->SetFrameBorderMode(0);
   
   TMultiGraph *multigraph = new TMultiGraph();
   multigraph->SetName("name");
   multigraph->SetTitle("JES_akPu4PF");
   
   Double_t Graph_fx1001[4] = {
   5,
   20,
   40,
   75};
   Double_t Graph_fy1001[4] = {
   1.025461,
   0.982262,
   0.9644553,
   0.970611};
   Double_t Graph_fex1001[4] = {
   5,
   10,
   10,
   25};
   Double_t Graph_fey1001[4] = {
   0.001598024,
   0.0009318739,
   0.0008002418,
   0.0004502591};
   TGraphErrors *gre = new TGraphErrors(4,Graph_fx1001,Graph_fy1001,Graph_fex1001,Graph_fey1001);
   gre->SetName("Graph");
   gre->SetTitle("some title_0");
   gre->SetFillColor(1);
   gre->SetFillStyle(0);
   
   TH1F *Graph_Graph1001 = new TH1F("Graph_Graph1001","some title_0",100,0,110);
   Graph_Graph1001->SetMinimum(0.9573146);
   Graph_Graph1001->SetMaximum(1.0334);
   Graph_Graph1001->SetDirectory(0);
   Graph_Graph1001->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#000099");
   Graph_Graph1001->SetLineColor(ci);
   Graph_Graph1001->GetXaxis()->SetLabelFont(42);
   Graph_Graph1001->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1001->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1001->GetXaxis()->SetTitleFont(42);
   Graph_Graph1001->GetYaxis()->SetLabelFont(42);
   Graph_Graph1001->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1001->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1001->GetYaxis()->SetTitleFont(42);
   Graph_Graph1001->GetZaxis()->SetLabelFont(42);
   Graph_Graph1001->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1001->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1001->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1001);
   
   multigraph->Add(gre,"");
   
   Double_t Graph_fx1002[4] = {
   5,
   20,
   40,
   75};
   Double_t Graph_fy1002[4] = {
   1.025808,
   0.9823451,
   0.964104,
   0.9707841};
   Double_t Graph_fex1002[4] = {
   5,
   10,
   10,
   25};
   Double_t Graph_fey1002[4] = {
   0.001641175,
   0.0009556419,
   0.0008206184,
   0.000461058};
   gre = new TGraphErrors(4,Graph_fx1002,Graph_fy1002,Graph_fex1002,Graph_fey1002);
   gre->SetName("Graph");
   gre->SetTitle("some title_1");
   gre->SetFillColor(1);
   gre->SetFillStyle(0);
   gre->SetLineColor(2);
   gre->SetMarkerColor(2);
   
   TH1F *Graph_Graph1002 = new TH1F("Graph_Graph1002","some title_1",100,0,110);
   Graph_Graph1002->SetMinimum(0.9568668);
   Graph_Graph1002->SetMaximum(1.033866);
   Graph_Graph1002->SetDirectory(0);
   Graph_Graph1002->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1002->SetLineColor(ci);
   Graph_Graph1002->GetXaxis()->SetLabelFont(42);
   Graph_Graph1002->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1002->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1002->GetXaxis()->SetTitleFont(42);
   Graph_Graph1002->GetYaxis()->SetLabelFont(42);
   Graph_Graph1002->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1002->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1002->GetYaxis()->SetTitleFont(42);
   Graph_Graph1002->GetZaxis()->SetLabelFont(42);
   Graph_Graph1002->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1002->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1002->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1002);
   
   multigraph->Add(gre,"");
   
   Double_t Graph_fx1003[4] = {
   5,
   20,
   40,
   75};
   Double_t Graph_fy1003[4] = {
   0.9944711,
   0.9453074,
   0.9619222,
   0.9556338};
   Double_t Graph_fex1003[4] = {
   5,
   10,
   10,
   25};
   Double_t Graph_fey1003[4] = {
   0.01053149,
   0.005298861,
   0.004412705,
   0.002663901};
   gre = new TGraphErrors(4,Graph_fx1003,Graph_fy1003,Graph_fex1003,Graph_fey1003);
   gre->SetName("Graph");
   gre->SetTitle("some title_2");
   gre->SetFillColor(1);
   gre->SetFillStyle(0);
   gre->SetLineColor(3);
   gre->SetMarkerColor(3);
   
   TH1F *Graph_Graph1003 = new TH1F("Graph_Graph1003","some title_2",100,0,110);
   Graph_Graph1003->SetMinimum(0.9335092);
   Graph_Graph1003->SetMaximum(1.011502);
   Graph_Graph1003->SetDirectory(0);
   Graph_Graph1003->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1003->SetLineColor(ci);
   Graph_Graph1003->GetXaxis()->SetLabelFont(42);
   Graph_Graph1003->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1003->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1003->GetXaxis()->SetTitleFont(42);
   Graph_Graph1003->GetYaxis()->SetLabelFont(42);
   Graph_Graph1003->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1003->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1003->GetYaxis()->SetTitleFont(42);
   Graph_Graph1003->GetZaxis()->SetLabelFont(42);
   Graph_Graph1003->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1003->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1003->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1003);
   
   multigraph->Add(gre,"");
   multigraph->Draw("AP");
   multigraph->GetXaxis()->SetTitle("Centrality");
   multigraph->GetXaxis()->SetLabelFont(42);
   multigraph->GetXaxis()->SetLabelSize(0.035);
   multigraph->GetXaxis()->SetTitleSize(0.035);
   multigraph->GetXaxis()->SetTitleFont(42);
   multigraph->GetYaxis()->SetTitle("#mu_{Reco./Gen.}");
   multigraph->GetYaxis()->SetLabelFont(42);
   multigraph->GetYaxis()->SetLabelSize(0.035);
   multigraph->GetYaxis()->SetTitleSize(0.035);
   multigraph->GetYaxis()->SetTitleFont(42);
   
   TLegend *leg = new TLegend(0.68,0.7,0.88,0.85,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   TLegendEntry *entry=leg->AddEntry("Graph","allJets","l");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph","lightJets","l");
   entry->SetLineColor(2);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph","bJets","l");
   entry->SetLineColor(3);
   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.25,0.7,"#bf{#color[2]{|#eta_{jet}|<2.0 &75<refpt<120}}");
tex->SetNDC();
   tex->SetTextFont(43);
   tex->SetTextSize(24);
   tex->SetLineWidth(2);
   tex->Draw();
   
   TPaveText *pt = new TPaveText(0.3750575,0.9365254,0.6249425,0.995,"blNDC");
   pt->SetName("title");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetFillStyle(0);
   pt->SetTextFont(42);
   AText = pt->AddText("JES_akPu4PF");
   pt->Draw();
   Can_result_0->Modified();
   Can_result_0->cd();
   Can_result_0->SetSelected(Can_result_0);
}
void makeNice(TString fileName, TString nice = "nicePlot"){

  TFile *f = TFile::Open(fileName);
  //  TFile *f = TFile::Open("out_Parameters_bkg1_3vtx.root");
  TGraphErrors * gRgre = (TGraphErrors*)f->Get("gR");
  TGraphErrors * gXgre = (TGraphErrors*)f->Get("gX");
  TGraphErrors * gYgre = (TGraphErrors*)f->Get("gY");

  TGraphErrors * rRgre = (TGraphErrors*)f->Get("rR");
  TGraphErrors * rXgre = (TGraphErrors*)f->Get("rX");
  TGraphErrors * rYgre = (TGraphErrors*)f->Get("rY");



//=========Macro generated from canvas: c1_n2/c1_n2
//=========  (Fri May 27 11:43:08 2011) by ROOT version5.27/06b
   TCanvas *c1_n2 = new TCanvas("c1_n2","c1_n2",700,1500);
   gStyle->SetOptFit(0);
   gStyle->SetOptStat(0);
   c1_n2->Range(0,0,1,1);
   c1_n2->SetFillColor(0);
   c1_n2->SetBorderMode(0);
   c1_n2->SetBorderSize(2);
   c1_n2->SetTickx(1);
   c1_n2->SetTicky(1);
   c1_n2->SetLeftMargin(0.13);
   c1_n2->SetRightMargin(0.05);
   c1_n2->SetTopMargin(0.05);
   c1_n2->SetBottomMargin(0.13);
   c1_n2->SetFrameFillStyle(0);
   c1_n2->SetFrameBorderMode(0);
  
// ------------>Primitives in pad: c1_n2_1
   TPad *c1_n2_1 = new TPad("c1_n2_1", "c1_n2_1",0.01,0.67,0.99,0.99);
   c1_n2_1->Draw();
   c1_n2_1->cd();
   c1_n2_1->Range(-52.68293,-0.03170732,44.87805,0.2121951);
   c1_n2_1->SetFillColor(0);
   c1_n2_1->SetBorderMode(0);
   c1_n2_1->SetBorderSize(2);
   c1_n2_1->SetTickx(1);
   c1_n2_1->SetTicky(1);
   c1_n2_1->SetLeftMargin(0.12);
   c1_n2_1->SetRightMargin(0.02);
   c1_n2_1->SetTopMargin(0.05);
   c1_n2_1->SetBottomMargin(0.2);
   c1_n2_1->SetFrameFillStyle(0);
   c1_n2_1->SetFrameBorderMode(0);
   c1_n2_1->SetFrameFillStyle(0);
   c1_n2_1->SetFrameBorderMode(0);
   
   TH1D *PLOTTERX = new TH1D("PLOTTERX","",1,-40,40);
   PLOTTERX->SetMinimum(-0.19);
   PLOTTERX->SetMaximum(+0.19);
   PLOTTERX->SetFillColor(63);
   PLOTTERX->SetLineStyle(0);
   PLOTTERX->SetMarkerStyle(20);
   PLOTTERX->GetXaxis()->SetLabelFont(42);
   PLOTTERX->GetXaxis()->SetLabelOffset(0.007);
   PLOTTERX->GetXaxis()->SetLabelSize(0.09);
   PLOTTERX->GetXaxis()->SetTitleSize(0.1);
   PLOTTERX->GetXaxis()->SetTitleOffset(0.9);
   PLOTTERX->GetXaxis()->SetTitleFont(42);
   PLOTTERX->GetXaxis()->SetTitle("z [cm]");
   PLOTTERX->GetYaxis()->SetNdivisions(505);
   PLOTTERX->GetYaxis()->SetTitle("x_{0} [cm] ");
   PLOTTERX->GetYaxis()->SetLabelFont(42);
   PLOTTERX->GetYaxis()->SetLabelOffset(0.007);
   PLOTTERX->GetYaxis()->SetLabelSize(0.09);
   PLOTTERX->GetYaxis()->SetTitleSize(0.1);
   PLOTTERX->GetYaxis()->SetTitleOffset(0.5);
   PLOTTERX->GetYaxis()->SetTitleFont(42);
   PLOTTERX->GetZaxis()->SetLabelFont(42);
   PLOTTERX->GetZaxis()->SetLabelOffset(0.007);
   PLOTTERX->GetZaxis()->SetLabelSize(0.05);
   PLOTTERX->GetZaxis()->SetTitleSize(0.06);
   PLOTTERX->GetZaxis()->SetTitleFont(42);
   PLOTTERX->Draw("");
   
   gXgre->SetFillColor(kBlack);
   gXgre->SetMarkerStyle(20);
   gXgre->SetMarkerColor(kBlack);
   gXgre->SetLineColor(kBlack);
   gXgre->GetListOfFunctions()->RemoveLast(); //to remove parameters panel...
   gXgre->GetListOfFunctions()->RemoveLast(); //...and old fit
   gXgre->SetLineWidth(2);
   gXgre->Draw("P");

   rXgre->SetFillColor(kBlue);
   rXgre->SetMarkerStyle(20);
   rXgre->SetMarkerColor(kBlue);
   rXgre->SetLineColor(kBlue);
   rXgre->GetListOfFunctions()->RemoveLast(); //to remove parameters panel...
   rXgre->GetListOfFunctions()->RemoveLast(); //...and old fit
   rXgre->SetLineWidth(2);
   rXgre->Draw("P");

   TLatex *CMSPrel = new TLatex(-37.0,PLOTTERX->GetMaximum()-0.025,"CMS Preliminary 2011");
   CMSPrel->SetTextSize(0.06);
   //   CMSPrel->Draw();
   c1_n2_1->Modified();
   c1_n2->cd();
  
// ------------>Primitives in pad: c1_n2_2
   TPad *c1_n2_2 = new TPad("c1_n2_1", "c1_n2_1",0.01,0.34,0.99,0.66);
   //   TPad *c1_n2_1 = new TPad("c1_n2_1", "c1_n2_1",0.01,0.01,0.99,0.33);
   c1_n2_2->Draw();
   c1_n2_2->cd();
   c1_n2_2->Range(-52.68293,-0.3317073,44.87805,-0.08780488);
   c1_n2_2->SetFillColor(0);
   c1_n2_2->SetBorderMode(0);
   c1_n2_2->SetBorderSize(2);
   c1_n2_2->SetTickx(1);
   c1_n2_2->SetTicky(1);
   c1_n2_2->SetLeftMargin(0.12);
   c1_n2_2->SetRightMargin(0.02);
   c1_n2_2->SetTopMargin(0.05);
   c1_n2_2->SetBottomMargin(0.2);
   c1_n2_2->SetFrameFillStyle(0);
   c1_n2_2->SetFrameBorderMode(0);
   c1_n2_2->SetFrameFillStyle(0);
   c1_n2_2->SetFrameBorderMode(0);
   
   TH1D *PLOTTERY = new TH1D("PLOTTERY","",1,-40,40);
   PLOTTERY->SetMinimum(-0.29);
   PLOTTERY->SetMaximum(+0.09);
   PLOTTERY->SetFillColor(63);
   PLOTTERY->SetLineStyle(0);
   PLOTTERY->SetMarkerStyle(20);
   PLOTTERY->GetXaxis()->SetLabelFont(42);
   PLOTTERY->GetXaxis()->SetLabelOffset(0.007);
   PLOTTERY->GetXaxis()->SetLabelSize(0.09);
   PLOTTERY->GetXaxis()->SetTitleSize(0.1);
   PLOTTERY->GetXaxis()->SetTitleFont(42);
   PLOTTERY->GetXaxis()->SetTitleOffset(0.9);
   PLOTTERY->GetXaxis()->SetTitle("z [cm]");
   PLOTTERY->GetYaxis()->SetNdivisions(505);
   PLOTTERY->GetYaxis()->SetTitle("y_{0} [cm] ");
   PLOTTERY->GetYaxis()->SetLabelFont(42);
   PLOTTERY->GetYaxis()->SetLabelOffset(0.007);
   PLOTTERY->GetYaxis()->SetLabelSize(0.09);
   PLOTTERY->GetYaxis()->SetTitleSize(0.1);
   PLOTTERY->GetYaxis()->SetTitleOffset(0.5);
   PLOTTERY->GetYaxis()->SetTitleFont(42);
   PLOTTERY->GetZaxis()->SetLabelFont(42);
   PLOTTERY->GetZaxis()->SetLabelOffset(0.007);
   PLOTTERY->GetZaxis()->SetLabelSize(0.05);
   PLOTTERY->GetZaxis()->SetTitleSize(0.06);
   PLOTTERY->GetZaxis()->SetTitleFont(42);
   PLOTTERY->Draw("");
   
   gYgre->SetFillColor(kBlack);
   gYgre->SetMarkerStyle(20);
   gYgre->SetMarkerColor(kBlack);
   gYgre->SetLineColor(kBlack);
   gYgre->GetListOfFunctions()->RemoveLast(); //to remove parameters panel...
   gYgre->GetListOfFunctions()->RemoveLast(); //...and old fit
   gYgre->SetLineWidth(2);
   gYgre->Draw("P");

   rYgre->SetFillColor(kBlue);
   rYgre->SetMarkerStyle(20);
   rYgre->SetMarkerColor(kBlue);
   rYgre->SetLineColor(kBlue);
   rYgre->GetListOfFunctions()->RemoveLast(); //to remove parameters panel...
   rYgre->GetListOfFunctions()->RemoveLast(); //...and old fit
   rYgre->SetLineWidth(2);
   rYgre->Draw("P");

   TLatex *CMSPrel = new TLatex(-37.0,PLOTTERY->GetMaximum()-0.025,"CMS Preliminary 2011");
   CMSPrel->SetTextSize(0.06);
   //   CMSPrel->Draw();
   c1_n2_2->Modified();
   c1_n2->cd();
  

// ------------>Primitives in pad: c1_n2_2
   TPad *c1_n2_3 = new TPad("c1_n2_1", "c1_n2_1",0.01,0.01,0.99,0.33);
   //   TPad *c1_n2_1 = new TPad("c1_n2_1", "c1_n2_1",0.01,0.01,0.99,0.33);
   c1_n2_3->Draw();
   c1_n2_3->cd();
   c1_n2_3->Range(-52.68293,-0.3317073,44.87805,-0.08780488);
   c1_n2_3->SetFillColor(0);
   c1_n2_3->SetBorderMode(0);
   c1_n2_3->SetBorderSize(2);
   c1_n2_3->SetTickx(1);
   c1_n2_3->SetTicky(1);
   c1_n2_3->SetLeftMargin(0.12);
   c1_n2_3->SetRightMargin(0.02);
   c1_n2_3->SetTopMargin(0.05);
   c1_n2_3->SetBottomMargin(0.2);
   c1_n2_3->SetFrameFillStyle(0);
   c1_n2_3->SetFrameBorderMode(0);
   c1_n2_3->SetFrameFillStyle(0);
   c1_n2_3->SetFrameBorderMode(0);
   
   TH1D *PLOTTERR = new TH1D("PLOTTERR","",1,-40,40);
   PLOTTERR->SetMinimum(2.87);
   PLOTTERR->SetMaximum(2.97);
   PLOTTERR->SetFillColor(63);
   PLOTTERR->SetLineStyle(0);
   PLOTTERR->SetMarkerStyle(20);
   PLOTTERR->GetXaxis()->SetLabelFont(42);
   PLOTTERR->GetXaxis()->SetLabelOffset(0.007);
   PLOTTERR->GetXaxis()->SetLabelSize(0.09);
   PLOTTERR->GetXaxis()->SetTitleSize(0.1);
   PLOTTERR->GetXaxis()->SetTitleFont(42);
   PLOTTERR->GetXaxis()->SetTitleOffset(0.9);
   PLOTTERR->GetXaxis()->SetTitle("z [cm]");
   PLOTTERR->GetYaxis()->SetNdivisions(505);
   PLOTTERR->GetYaxis()->SetTitle("R [cm] ");
   PLOTTERR->GetYaxis()->SetLabelFont(42);
   PLOTTERR->GetYaxis()->SetLabelOffset(0.007);
   PLOTTERR->GetYaxis()->SetLabelSize(0.09);
   PLOTTERR->GetYaxis()->SetTitleSize(0.1);
   PLOTTERR->GetYaxis()->SetTitleOffset(0.5);
   PLOTTERR->GetYaxis()->SetTitleFont(42);
   PLOTTERR->GetZaxis()->SetLabelFont(42);
   PLOTTERR->GetZaxis()->SetLabelOffset(0.007);
   PLOTTERR->GetZaxis()->SetLabelSize(0.05);
   PLOTTERR->GetZaxis()->SetTitleSize(0.06);
   PLOTTERR->GetZaxis()->SetTitleFont(42);
   PLOTTERR->Draw("");
   
   gRgre->SetFillColor(kBlack);
   gRgre->SetMarkerStyle(20);
   gRgre->SetMarkerColor(kBlack);
   gRgre->SetLineColor(kBlack);
   gRgre->GetListOfFunctions()->RemoveLast(); //to remove parameters panel...
   gRgre->GetListOfFunctions()->RemoveLast(); //...and old fit
   gRgre->SetLineWidth(2);
   gRgre->Draw("P");

   rRgre->SetFillColor(kBlue);
   rRgre->SetMarkerStyle(20);
   rRgre->SetMarkerColor(kBlue);
   rRgre->SetLineColor(kBlue);
   rRgre->GetListOfFunctions()->RemoveLast(); //to remove parameters panel...
   rRgre->GetListOfFunctions()->RemoveLast(); //...and old fit
   rRgre->SetLineWidth(2);
   rRgre->Draw("P");

   TLatex *CMSPrel = new TLatex(-37.0,PLOTTERR->GetMaximum()-0.025,"CMS Preliminary 2011");
   CMSPrel->SetTextSize(0.06);
   //   CMSPrel->Draw();
   c1_n2_3->Modified();
   c1_n2->cd();
 
   

   TF1* fX = new TF1("fX", "[0]+[1]*x", -35, 35); 
   TF1* fY = new TF1("fY", "[0]+[1]*x", -35, 35); 
   TF1* fR = new TF1("fR", "[0]+[1]*x", -35, 35); 

   fX->SetParameter(0, 0.1);
   fX->SetParameter(1, -0.0007);

   fY->SetParameter(0, -0.2);
   fY->SetParameter(1, +0.0007);

   fR->SetParameter(0, 2.94);
   fR->SetParameter(1, 0.0);

   gXgre->Fit(fX);
   gYgre->Fit(fY);
   gRgre->Fit(fR);

   //
   c1_n2->cd();
   c1_n2->Modified();
   c1_n2->cd();
   c1_n2->SetSelected(c1_n2);

   c1_n2->SaveAs(nice+".png"); //!Serve!!!!
   c1_n2->SaveAs(nice+".gif");
   c1_n2->SaveAs(nice+".png");


}
void paraPull_alpha_MUON_ISO_SYS_2TeV_2Lep_plots_All()
{
//=========Macro generated from canvas: c1/alpha_MUON_ISO_SYS
//=========  (Sun Nov 22 20:21:56 2015) by ROOT version6.02/12
   TCanvas *c1 = new TCanvas("c1", "alpha_MUON_ISO_SYS",0,22,1000,600);
   gStyle->SetOptStat(0);
   c1->Range(-4.125,-0.9777052,37.125,1.049159);
   c1->SetFillColor(0);
   c1->SetBorderMode(0);
   c1->SetBorderSize(2);
   c1->SetGridx();
   c1->SetGridy();
   c1->SetFrameBorderMode(0);
   c1->SetFrameBorderMode(0);
   
   TH1F *NuisanceParameterFreed33 = new TH1F("NuisanceParameterFreed33","alpha_MUON_ISO_SYS",33,0,33);
   NuisanceParameterFreed33->SetMinimum(-0.7750188);
   NuisanceParameterFreed33->SetMaximum(0.8464727);
   NuisanceParameterFreed33->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#000099");
   NuisanceParameterFreed33->SetLineColor(ci);
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(1,"XS_ttbar");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(2,"EG_SCALE_ALL");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(3,"FT_EFF_Eigen_C_0");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(4,"Luminosity");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(5,"XS_st");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(6,"FT_EFF_Eigen_B_1");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(7,"XS_Zc");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(8,"MUONS_ID");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(9,"FT_EFF_Eigen_C_1");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(10,"FT_EFF_Eigen_C_3");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(11,"MUON_EFF_TrigSystUncertainty");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(12,"XS_Zl");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(13,"EL_EFF_ID_TotalCorrUncertainty");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(14,"FT_EFF_Eigen_B_0");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(15,"FT_EFF_Eigen_B_2");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(16,"EL_EFF_Iso_TotalCorrUncertainty");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(17,"EL_EFF_Reco_TotalCorrUncertainty");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(18,"MUONS_SCALE");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(19,"MUON_ISO_STAT");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(20,"FT_EFF_extrapolation");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(21,"MUON_EFF_STAT");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(22,"MUON_EFF_SYS");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(23,"MUON_EFF_TrigStatUncertainty");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(24,"FT_EFF_Eigen_Light_2");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(25,"FT_EFF_Eigen_Light_1");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(26,"EG_RESOLUTION_ALL");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(27,"XS_diboson");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(28,"FT_EFF_Eigen_Light_4");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(29,"FT_EFF_Eigen_Light_3");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(30,"MUONS_MS");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(31,"XS_Zb");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(32,"FT_EFF_Eigen_C_2");
   NuisanceParameterFreed33->GetXaxis()->SetBinLabel(33,"FT_EFF_Eigen_Light_0");
   NuisanceParameterFreed33->GetXaxis()->SetLabelFont(42);
   NuisanceParameterFreed33->GetXaxis()->SetLabelSize(0.035);
   NuisanceParameterFreed33->GetXaxis()->SetTitleSize(0.035);
   NuisanceParameterFreed33->GetXaxis()->SetTitleFont(42);
   NuisanceParameterFreed33->GetYaxis()->SetTitle("#theta_{fit} - #theta_{initial}/#Delta#theta");
   NuisanceParameterFreed33->GetYaxis()->SetLabelFont(42);
   NuisanceParameterFreed33->GetYaxis()->SetLabelSize(0.035);
   NuisanceParameterFreed33->GetYaxis()->SetTitleSize(0.035);
   NuisanceParameterFreed33->GetYaxis()->SetTitleFont(42);
   NuisanceParameterFreed33->GetZaxis()->SetLabelFont(42);
   NuisanceParameterFreed33->GetZaxis()->SetLabelSize(0.035);
   NuisanceParameterFreed33->GetZaxis()->SetTitleSize(0.035);
   NuisanceParameterFreed33->GetZaxis()->SetTitleFont(42);
   NuisanceParameterFreed33->Draw("hist");
   
   Double_t _fx1033[35] = {
   1.22802e-312,
   0.5,
   1.5,
   2.5,
   3.5,
   4.5,
   5.5,
   6.5,
   7.5,
   8.5,
   9.5,
   10.5,
   11.5,
   12.5,
   13.5,
   14.5,
   15.5,
   16.5,
   17.5,
   18.5,
   19.5,
   20.5,
   21.5,
   22.5,
   23.5,
   24.5,
   25.5,
   26.5,
   27.5,
   28.5,
   29.5,
   30.5,
   31.5,
   32.5,
   0};
   Double_t _fy1033[35] = {
   1.22802e-312,
   -0.7750188,
   -0.3925669,
   -0.2928498,
   -0.2070924,
   -0.1830524,
   -0.1280032,
   -0.1262679,
   -0.1096289,
   -0.06558224,
   -0.05681625,
   -0.05340132,
   -0.04752113,
   -0.03756,
   -0.03159065,
   -0.03113199,
   -0.02395544,
   -0.01709673,
   -0.001375576,
   0.0001640258,
   0.01017132,
   0.01056379,
   0.01803238,
   0.01953954,
   0.02015159,
   0.02033505,
   0.0231812,
   0.04061694,
   0.04275862,
   0.04588616,
   0.04795404,
   0.05347781,
   0.05730227,
   0.8464727,
   0};
   Double_t _fex1033[35] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t _fey1033[35] = {
   0,
   0,
   0.6105177,
   1.072963,
   1.274131,
   0.9350411,
   0.9915346,
   0.9862834,
   0.9243374,
   0.769056,
   0.9864216,
   0.9937953,
   0.9917567,
   0.9969205,
   0.9819024,
   0.9371645,
   0.9926625,
   0.9931845,
   0.9925671,
   1.004991,
   0.9933467,
   0.9551202,
   0.9932281,
   0.9929675,
   0.9926546,
   0.9909755,
   0.9913131,
   1.098392,
   0.9868992,
   0.9931708,
   0.9930622,
   0.7376817,
   0.7516033,
   0.9909095,
   0.7841002};
   TGraphErrors *gre = new TGraphErrors(35,_fx1033,_fy1033,_fex1033,_fey1033);
   gre->SetName("");
   gre->SetTitle("");
   gre->SetFillColor(1);
   gre->SetMarkerStyle(20);
   gre->SetMarkerSize(1.2);
   
   TH1F *Graph_Graph1033 = new TH1F("Graph_Graph1033","",100,0,35.75);
   Graph_Graph1033->SetMinimum(-1.813084);
   Graph_Graph1033->SetMaximum(2.169243);
   Graph_Graph1033->SetDirectory(0);
   Graph_Graph1033->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1033->SetLineColor(ci);
   Graph_Graph1033->GetXaxis()->SetLabelFont(42);
   Graph_Graph1033->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1033->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1033->GetXaxis()->SetTitleFont(42);
   Graph_Graph1033->GetYaxis()->SetLabelFont(42);
   Graph_Graph1033->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1033->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1033->GetYaxis()->SetTitleFont(42);
   Graph_Graph1033->GetZaxis()->SetLabelFont(42);
   Graph_Graph1033->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1033->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1033->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1033);
   
   gre->Draw("p");
   
   TLegend *leg = new TLegend(0.1,0.4,0.4,0.95,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextFont(72);
   leg->SetTextSize(0.015);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   leg->Draw();
   
   TPaveText *pt = new TPaveText(0.3293574,0.9341608,0.6706426,0.995,"blNDC");
   pt->SetName("title");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetFillStyle(0);
   pt->SetTextFont(42);
   TText *AText = pt->AddText("alpha_MUON_ISO_SYS");
   pt->Draw();
   c1->Modified();
   c1->cd();
   c1->SetSelected(c1);
}
示例#28
0
/** @ingroup FMD_xsec_script
    @param scale 
    @param filename 
    @param var 
    @param medName 
    @param thick 
    @param pdgName 
*/
void
DrawXsection(Bool_t scale=kFALSE, 
	     const char* filename="xsec.root", 
	     const char* var="LOSS", 
	     const char* medName="FMD_Si$", 
	     Double_t thick=.03,
	     const char* pdgName="pi+")
{
  TFile*   file = TFile::Open(filename, "READ");
  TTree*   tree = static_cast<TTree*>(file->Get(Form("%s_%s",medName,
						     pdgName)));
  TLeaf* tb   = tree->GetLeaf("T");
  TLeaf* vb   = tree->GetLeaf(var);
  if (!vb) {
    std::cerr << "Leaf " << var << " not found" << std::endl;
    return;
  }
  Float_t tkine, value;
  tb->SetAddress(&tkine);
  vb->SetAddress(&value);
  Int_t n = tree->GetEntries();

  Float_t xscale = 1;
  Float_t yscale = 1;
  if (scale) {
    TDatabasePDG* pdgDb = TDatabasePDG::Instance();
    TParticlePDG* pdgP  = pdgDb->GetParticle(pdgName);
    if (!pdgP) {
      std::cerr << "Couldn't find particle " << pdgName << std::endl;
      return;
    }
    Double_t m = pdgP->Mass();
    Double_t q = pdgP->Charge() / 3;
    if (m == 0 || q == 0) {
      std::cerr  << "Mass is 0" << std::endl;
      return;
    }
    xscale = 1 / m;
    yscale = 1 / (q * q);
  }
  
  TGraphErrors* graph = new TGraphErrors(n);
  for (Int_t i = 0; i < n; i++) {
    tree->GetEntry(i);
    Double_t x = tkine*xscale;
    Double_t y = value*yscale;
    graph->SetPoint(i, x, y); 
    // 5 sigma
    graph->SetPointError(i, 0, 5 * .1 * y);
  }
  TCanvas* c = new TCanvas("c","c");
  c->SetLogx();
  c->SetLogy();
  graph->SetLineWidth(2);
  graph->SetFillStyle(3001);
  graph->SetFillColor(6);
  graph->Draw("L");
  graph->DrawClone("AL3");
  c->Modified();
  c->Update();
  c->cd();
  c->SaveAs("xsec.C");
  
}
// Better to keep this in a seperate file
TGraphErrors* CMS_7TEV(Double_t scale) {

    //7 TeV measurement at CMS
    TGraphErrors *gre = new TGraphErrors(33);
    gre->SetName("Graph");
    gre->SetTitle("Graph");
    gre->SetFillColor(1);
    gre->SetMarkerStyle(21);
    gre->SetPoint(0,0.15,9.94559);
    gre->SetPointError(0,0,0.4460492);
    gre->SetPoint(1,0.25,6.4274);
    gre->SetPointError(1,0,0.2867568);
    gre->SetPoint(2,0.35,3.69525);
    gre->SetPointError(2,0,0.1654095);
    gre->SetPoint(3,0.45,2.2442);
    gre->SetPointError(3,0,0.1009501);
    gre->SetPoint(4,0.55,1.40735);
    gre->SetPointError(4,0,0.06369867);
    gre->SetPoint(5,0.65,0.920301);
    gre->SetPointError(5,0,0.04193949);
    gre->SetPoint(6,0.75,0.616821);
    gre->SetPointError(6,0,0.0283265);
    gre->SetPoint(7,0.85,0.426732);
    gre->SetPointError(7,0,0.01975661);
    gre->SetPoint(8,0.95,0.299085);
    gre->SetPointError(8,0,0.01397616);
    gre->SetPoint(9,1.1,0.183225);
    gre->SetPointError(9,0,0.00845129);
    gre->SetPoint(10,1.3,0.0995915);
    gre->SetPointError(10,0,0.004670335);
    gre->SetPoint(11,1.5,0.056565);
    gre->SetPointError(11,0,0.002704398);
    gre->SetPoint(12,1.7,0.0337805);
    gre->SetPointError(12,0,0.001650384);
    gre->SetPoint(13,1.9,0.0208494);
    gre->SetPointError(13,0,0.001043639);
    gre->SetPoint(14,2.1,0.01323271);
    gre->SetPointError(14,0,0.0006804352);
    gre->SetPoint(15,2.3,0.00852133);
    gre->SetPointError(15,0,0.0004520424);
    gre->SetPoint(16,2.5,0.00555772);
    gre->SetPointError(16,0,0.0003051332);
    gre->SetPoint(17,2.7,0.00369416);
    gre->SetPointError(17,0,0.0002105437);
    gre->SetPoint(18,2.9,0.00275361);
    gre->SetPointError(18,0,0.0001617788);
    gre->SetPoint(19,3.1,0.001784498);
    gre->SetPointError(19,0,0.0001103706);
    gre->SetPoint(20,3.3,0.001251193);
    gre->SetPointError(20,0,8.105581e-05);
    gre->SetPoint(21,3.5,0.000932109);
    gre->SetPoint(22,3.7,0.00072809);
    gre->SetPointError(22,0,5.106009e-05);
    gre->SetPoint(23,3.9,0.000483879);
    gre->SetPointError(23,0,3.643427e-05);
    gre->SetPoint(24,4.1,0.000397255);
    gre->SetPointError(24,0,3.101453e-05);
    gre->SetPoint(25,4.3,0.000281682);
    gre->SetPointError(25,0,2.426278e-05);
    gre->SetPoint(26,4.5,0.0001898557);
    gre->SetPointError(26,0,1.777722e-05);
    gre->SetPoint(27,4.7,0.0001404168);
    gre->SetPointError(27,0,1.377145e-05);
    gre->SetPoint(28,4.9,0.0001152827);
    gre->SetPointError(28,0,1.228788e-05);
    gre->SetPoint(29,5.1,8.94332e-05);
    gre->SetPointError(29,0,1.021356e-05);
    gre->SetPoint(30,5.3,6.56232e-05);
    gre->SetPointError(30,0,8.759586e-06);
    gre->SetPoint(31,5.5,5.48406e-05);
    gre->SetPointError(31,0,8.112416e-06);
    gre->SetPoint(32,5.7,4.50414e-05);
    gre->SetPointError(32,0,7.518979e-06);

    /*
    gre->SetPoint(33,5.9,3.60633e-05);
    gre->SetPointError(33,0,5.641449e-06);
    gre->SetPoint(34,6.25,2.018451e-05);
    gre->SetPointError(34,0,3.081411e-06);
    gre->SetPoint(35,6.75,1.966985e-05);
    gre->SetPointError(35,0,2.63818e-06);
    gre->SetPoint(36,7.25,1.572381e-05);
    gre->SetPointError(36,0,2.668063e-06);
    gre->SetPoint(37,7.75,8.84664e-06);
    gre->SetPointError(37,0,2.136684e-06);
    gre->SetPoint(38,8.25,1.264757e-05);
    gre->SetPointError(38,0,3.756436e-06);
    gre->SetPoint(39,8.75,6.31772e-06);
    gre->SetPointError(39,0,2.762383e-06);
    gre->SetPoint(40,9.25,5.99949e-06);
    gre->SetPointError(40,0,3.246975e-06);
    gre->SetPoint(41,9.25,5.99949e-06);
    gre->SetPointError(41,0,3.239439e-06);
    /*


    /*
    Double_t x[33], y[33];
    Double_t xerr[33], yerr[33];

    for(Int_t i=0; i<33;i++){
       gre->GetPoint(i,x[i],y[i]);
       gre->SetPoint(i,x[i],scale*y[i]);
       //gre->GetPointError(i,x[i],yerr[i]);
       xerr[i] = 0, yerr[i] = 0;
       gre->SetPointError(i,scale*xerr[i],scale*yerr[i]);
    }
    */
    return gre;
}
示例#30
0
void ttbar_looseLep2Pt_logy()
{
//=========Macro generated from canvas: c1/c1
//=========  (Sun Dec 11 15:16:17 2016) by ROOT version6.06/01
   TCanvas *c1 = new TCanvas("c1", "c1",1,1,1200,1416);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   c1->SetHighLightColor(2);
   c1->Range(0,0,1,1);
   c1->SetFillColor(0);
   c1->SetBorderMode(0);
   c1->SetBorderSize(2);
   c1->SetTickx(1);
   c1->SetTicky(1);
   c1->SetLeftMargin(0.15);
   c1->SetRightMargin(0.05);
   c1->SetTopMargin(0.07);
   c1->SetBottomMargin(0.13);
   c1->SetFrameFillStyle(0);
   c1->SetFrameBorderMode(0);
  
// ------------>Primitives in pad: pad1
   TPad *pad1 = new TPad("pad1", "pad1",0,0.3,1,1);
   pad1->Draw();
   pad1->cd();
   pad1->Range(-93.75,-6.459411,531.25,2.538922);
   pad1->SetFillColor(0);
   pad1->SetBorderMode(0);
   pad1->SetBorderSize(2);
   pad1->SetLogy();
   pad1->SetTickx(1);
   pad1->SetTicky(1);
   pad1->SetLeftMargin(0.15);
   pad1->SetRightMargin(0.05);
   pad1->SetTopMargin(0.07);
   pad1->SetBottomMargin(0);
   pad1->SetFrameFillStyle(0);
   pad1->SetFrameBorderMode(0);
   pad1->SetFrameFillStyle(0);
   pad1->SetFrameBorderMode(0);
   
   THStack *h = new THStack();
   h->SetName("h");
   h->SetTitle("");
   h->SetMinimum(1.61613e-06);
   h->SetMaximum(32.94396);
   
   TH1F *h_stack_8 = new TH1F("h_stack_8","",20,0,500);
   h_stack_8->SetMinimum(3.472076e-07);
   h_stack_8->SetMaximum(81.10342);
   h_stack_8->SetDirectory(0);
   h_stack_8->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#000099");
   h_stack_8->SetLineColor(ci);
   h_stack_8->GetXaxis()->SetLabelFont(42);
   h_stack_8->GetXaxis()->SetLabelOffset(0.007);
   h_stack_8->GetXaxis()->SetTitleSize(0.05);
   h_stack_8->GetXaxis()->SetTickLength(0.025);
   h_stack_8->GetXaxis()->SetTitleFont(42);
   h_stack_8->GetYaxis()->SetTitle("a.u./25 GeV");
   h_stack_8->GetYaxis()->SetLabelFont(42);
   h_stack_8->GetYaxis()->SetLabelOffset(0.007);
   h_stack_8->GetYaxis()->SetTitleSize(0.05);
   h_stack_8->GetYaxis()->SetTickLength(0.025);
   h_stack_8->GetYaxis()->SetTitleOffset(1.5);
   h_stack_8->GetYaxis()->SetTitleFont(42);
   h_stack_8->GetZaxis()->SetLabelFont(42);
   h_stack_8->GetZaxis()->SetLabelOffset(0.007);
   h_stack_8->GetZaxis()->SetTitleSize(0.05);
   h_stack_8->GetZaxis()->SetTickLength(0.025);
   h_stack_8->GetZaxis()->SetTitleFont(42);
   h->SetHistogram(h_stack_8);
   
   
   TH1D *h_looseLep2Pt_QCD__85 = new TH1D("h_looseLep2Pt_QCD__85","",20,0,500);
   h_looseLep2Pt_QCD__85->SetBinContent(1,0.004168645);
   h_looseLep2Pt_QCD__85->SetBinContent(2,0.004299542);
   h_looseLep2Pt_QCD__85->SetBinContent(3,0.001765161);
   h_looseLep2Pt_QCD__85->SetBinContent(4,0.0008868067);
   h_looseLep2Pt_QCD__85->SetBinContent(6,0.0004026872);
   h_looseLep2Pt_QCD__85->SetBinContent(7,6.27175e-05);
   h_looseLep2Pt_QCD__85->SetBinError(1,0.001669574);
   h_looseLep2Pt_QCD__85->SetBinError(2,0.002080688);
   h_looseLep2Pt_QCD__85->SetBinError(3,0.001425843);
   h_looseLep2Pt_QCD__85->SetBinError(4,0.0005754946);
   h_looseLep2Pt_QCD__85->SetBinError(6,0.0004026872);
   h_looseLep2Pt_QCD__85->SetBinError(7,4.443558e-05);
   h_looseLep2Pt_QCD__85->SetEntries(25);
   h_looseLep2Pt_QCD__85->SetStats(0);

   ci = TColor::GetColor("#cccccc");
   h_looseLep2Pt_QCD__85->SetFillColor(ci);
   h_looseLep2Pt_QCD__85->GetXaxis()->SetTitle("Sub-leading lep p_{T} [GeV]");
   h_looseLep2Pt_QCD__85->GetXaxis()->SetLabelFont(42);
   h_looseLep2Pt_QCD__85->GetXaxis()->SetLabelOffset(0.007);
   h_looseLep2Pt_QCD__85->GetXaxis()->SetTitleSize(0.05);
   h_looseLep2Pt_QCD__85->GetXaxis()->SetTickLength(0.025);
   h_looseLep2Pt_QCD__85->GetXaxis()->SetTitleFont(42);
   h_looseLep2Pt_QCD__85->GetYaxis()->SetTitle("a.u./25 GeV");
   h_looseLep2Pt_QCD__85->GetYaxis()->SetLabelFont(42);
   h_looseLep2Pt_QCD__85->GetYaxis()->SetLabelOffset(0.007);
   h_looseLep2Pt_QCD__85->GetYaxis()->SetTitleSize(0.05);
   h_looseLep2Pt_QCD__85->GetYaxis()->SetTickLength(0.025);
   h_looseLep2Pt_QCD__85->GetYaxis()->SetTitleFont(42);
   h_looseLep2Pt_QCD__85->GetZaxis()->SetLabelFont(42);
   h_looseLep2Pt_QCD__85->GetZaxis()->SetLabelOffset(0.007);
   h_looseLep2Pt_QCD__85->GetZaxis()->SetTitleSize(0.05);
   h_looseLep2Pt_QCD__85->GetZaxis()->SetTickLength(0.025);
   h_looseLep2Pt_QCD__85->GetZaxis()->SetTitleFont(42);
   h->Add(h_looseLep2Pt_QCD,"");
   
   TH1D *h_looseLep2Pt_Diboson__86 = new TH1D("h_looseLep2Pt_Diboson__86","",20,0,500);
   h_looseLep2Pt_Diboson__86->SetBinContent(1,0.01174144);
   h_looseLep2Pt_Diboson__86->SetBinContent(2,0.01187664);
   h_looseLep2Pt_Diboson__86->SetBinContent(3,0.004759406);
   h_looseLep2Pt_Diboson__86->SetBinContent(4,0.002930753);
   h_looseLep2Pt_Diboson__86->SetBinContent(5,0.00175143);
   h_looseLep2Pt_Diboson__86->SetBinContent(6,0.0008561466);
   h_looseLep2Pt_Diboson__86->SetBinContent(7,0.000727361);
   h_looseLep2Pt_Diboson__86->SetBinContent(8,0.0006566697);
   h_looseLep2Pt_Diboson__86->SetBinContent(9,0.0001931429);
   h_looseLep2Pt_Diboson__86->SetBinContent(10,0.0004155724);
   h_looseLep2Pt_Diboson__86->SetBinContent(11,0.0002518857);
   h_looseLep2Pt_Diboson__86->SetBinContent(14,0.0002218985);
   h_looseLep2Pt_Diboson__86->SetBinContent(15,0.0002412745);
   h_looseLep2Pt_Diboson__86->SetBinContent(19,0.0001695579);
   h_looseLep2Pt_Diboson__86->SetBinError(1,0.001495699);
   h_looseLep2Pt_Diboson__86->SetBinError(2,0.001560382);
   h_looseLep2Pt_Diboson__86->SetBinError(3,0.0009896295);
   h_looseLep2Pt_Diboson__86->SetBinError(4,0.0007445459);
   h_looseLep2Pt_Diboson__86->SetBinError(5,0.0005817517);
   h_looseLep2Pt_Diboson__86->SetBinError(6,0.00038167);
   h_looseLep2Pt_Diboson__86->SetBinError(7,0.0003371659);
   h_looseLep2Pt_Diboson__86->SetBinError(8,0.0003965161);
   h_looseLep2Pt_Diboson__86->SetBinError(9,0.0001370432);
   h_looseLep2Pt_Diboson__86->SetBinError(10,0.0002946848);
   h_looseLep2Pt_Diboson__86->SetBinError(11,0.0002518857);
   h_looseLep2Pt_Diboson__86->SetBinError(14,0.0002218985);
   h_looseLep2Pt_Diboson__86->SetBinError(15,0.0002412745);
   h_looseLep2Pt_Diboson__86->SetBinError(19,0.0001695579);
   h_looseLep2Pt_Diboson__86->SetEntries(227);
   h_looseLep2Pt_Diboson__86->SetStats(0);

   ci = TColor::GetColor("#9966cc");
   h_looseLep2Pt_Diboson__86->SetFillColor(ci);
   h_looseLep2Pt_Diboson__86->GetXaxis()->SetTitle("Sub-leading lep p_{T} [GeV]");
   h_looseLep2Pt_Diboson__86->GetXaxis()->SetLabelFont(42);
   h_looseLep2Pt_Diboson__86->GetXaxis()->SetLabelOffset(0.007);
   h_looseLep2Pt_Diboson__86->GetXaxis()->SetTitleSize(0.05);
   h_looseLep2Pt_Diboson__86->GetXaxis()->SetTickLength(0.025);
   h_looseLep2Pt_Diboson__86->GetXaxis()->SetTitleFont(42);
   h_looseLep2Pt_Diboson__86->GetYaxis()->SetTitle("a.u./25 GeV");
   h_looseLep2Pt_Diboson__86->GetYaxis()->SetLabelFont(42);
   h_looseLep2Pt_Diboson__86->GetYaxis()->SetLabelOffset(0.007);
   h_looseLep2Pt_Diboson__86->GetYaxis()->SetTitleSize(0.05);
   h_looseLep2Pt_Diboson__86->GetYaxis()->SetTickLength(0.025);
   h_looseLep2Pt_Diboson__86->GetYaxis()->SetTitleFont(42);
   h_looseLep2Pt_Diboson__86->GetZaxis()->SetLabelFont(42);
   h_looseLep2Pt_Diboson__86->GetZaxis()->SetLabelOffset(0.007);
   h_looseLep2Pt_Diboson__86->GetZaxis()->SetTitleSize(0.05);
   h_looseLep2Pt_Diboson__86->GetZaxis()->SetTickLength(0.025);
   h_looseLep2Pt_Diboson__86->GetZaxis()->SetTitleFont(42);
   h->Add(h_looseLep2Pt_Diboson,"");
   
   TH1D *h_looseLep2Pt_ZpLjets__87 = new TH1D("h_looseLep2Pt_ZpLjets__87","",20,0,500);
   h_looseLep2Pt_ZpLjets__87->SetBinContent(1,0.02667925);
   h_looseLep2Pt_ZpLjets__87->SetBinContent(2,0.01473475);
   h_looseLep2Pt_ZpLjets__87->SetBinContent(3,0.003756899);
   h_looseLep2Pt_ZpLjets__87->SetBinContent(4,0.001254256);
   h_looseLep2Pt_ZpLjets__87->SetBinContent(5,0.0004467979);
   h_looseLep2Pt_ZpLjets__87->SetBinContent(6,0.0002317029);
   h_looseLep2Pt_ZpLjets__87->SetBinContent(7,0.0001188745);
   h_looseLep2Pt_ZpLjets__87->SetBinContent(8,5.180996e-05);
   h_looseLep2Pt_ZpLjets__87->SetBinContent(9,3.953698e-05);
   h_looseLep2Pt_ZpLjets__87->SetBinContent(10,5.25799e-05);
   h_looseLep2Pt_ZpLjets__87->SetBinContent(11,8.216096e-06);
   h_looseLep2Pt_ZpLjets__87->SetBinContent(12,1.278228e-05);
   h_looseLep2Pt_ZpLjets__87->SetBinContent(13,9.580175e-06);
   h_looseLep2Pt_ZpLjets__87->SetBinContent(14,1.588075e-06);
   h_looseLep2Pt_ZpLjets__87->SetBinContent(15,1.177547e-05);
   h_looseLep2Pt_ZpLjets__87->SetBinContent(16,1.223887e-06);
   h_looseLep2Pt_ZpLjets__87->SetBinContent(17,7.306459e-07);
   h_looseLep2Pt_ZpLjets__87->SetBinContent(20,1.45491e-06);
   h_looseLep2Pt_ZpLjets__87->SetBinError(1,0.0005258423);
   h_looseLep2Pt_ZpLjets__87->SetBinError(2,0.0003466748);
   h_looseLep2Pt_ZpLjets__87->SetBinError(3,0.0001526343);
   h_looseLep2Pt_ZpLjets__87->SetBinError(4,8.095507e-05);
   h_looseLep2Pt_ZpLjets__87->SetBinError(5,4.333559e-05);
   h_looseLep2Pt_ZpLjets__87->SetBinError(6,3.359842e-05);
   h_looseLep2Pt_ZpLjets__87->SetBinError(7,2.459211e-05);
   h_looseLep2Pt_ZpLjets__87->SetBinError(8,1.436585e-05);
   h_looseLep2Pt_ZpLjets__87->SetBinError(9,1.618837e-05);
   h_looseLep2Pt_ZpLjets__87->SetBinError(10,2.012392e-05);
   h_looseLep2Pt_ZpLjets__87->SetBinError(11,3.870226e-06);
   h_looseLep2Pt_ZpLjets__87->SetBinError(12,6.226944e-06);
   h_looseLep2Pt_ZpLjets__87->SetBinError(13,5.393688e-06);
   h_looseLep2Pt_ZpLjets__87->SetBinError(14,6.993857e-07);
   h_looseLep2Pt_ZpLjets__87->SetBinError(15,7.943273e-06);
   h_looseLep2Pt_ZpLjets__87->SetBinError(16,7.962562e-07);
   h_looseLep2Pt_ZpLjets__87->SetBinError(17,5.208535e-07);
   h_looseLep2Pt_ZpLjets__87->SetBinError(20,1.161384e-06);
   h_looseLep2Pt_ZpLjets__87->SetEntries(24915);
   h_looseLep2Pt_ZpLjets__87->SetStats(0);

   ci = TColor::GetColor("#3399cc");
   h_looseLep2Pt_ZpLjets__87->SetFillColor(ci);
   h_looseLep2Pt_ZpLjets__87->GetXaxis()->SetTitle("Sub-leading lep p_{T} [GeV]");
   h_looseLep2Pt_ZpLjets__87->GetXaxis()->SetLabelFont(42);
   h_looseLep2Pt_ZpLjets__87->GetXaxis()->SetLabelOffset(0.007);
   h_looseLep2Pt_ZpLjets__87->GetXaxis()->SetTitleSize(0.05);
   h_looseLep2Pt_ZpLjets__87->GetXaxis()->SetTickLength(0.025);
   h_looseLep2Pt_ZpLjets__87->GetXaxis()->SetTitleFont(42);
   h_looseLep2Pt_ZpLjets__87->GetYaxis()->SetTitle("a.u./25 GeV");
   h_looseLep2Pt_ZpLjets__87->GetYaxis()->SetLabelFont(42);
   h_looseLep2Pt_ZpLjets__87->GetYaxis()->SetLabelOffset(0.007);
   h_looseLep2Pt_ZpLjets__87->GetYaxis()->SetTitleSize(0.05);
   h_looseLep2Pt_ZpLjets__87->GetYaxis()->SetTickLength(0.025);
   h_looseLep2Pt_ZpLjets__87->GetYaxis()->SetTitleFont(42);
   h_looseLep2Pt_ZpLjets__87->GetZaxis()->SetLabelFont(42);
   h_looseLep2Pt_ZpLjets__87->GetZaxis()->SetLabelOffset(0.007);
   h_looseLep2Pt_ZpLjets__87->GetZaxis()->SetTitleSize(0.05);
   h_looseLep2Pt_ZpLjets__87->GetZaxis()->SetTickLength(0.025);
   h_looseLep2Pt_ZpLjets__87->GetZaxis()->SetTitleFont(42);
   h->Add(h_looseLep2Pt_Z+jets,"");
   
   TH1D *h_looseLep2Pt_WpLjets__88 = new TH1D("h_looseLep2Pt_WpLjets__88","",20,0,500);
   h_looseLep2Pt_WpLjets__88->SetBinContent(1,0.02932453);
   h_looseLep2Pt_WpLjets__88->SetBinContent(2,0.006497682);
   h_looseLep2Pt_WpLjets__88->SetBinContent(3,0.002693998);
   h_looseLep2Pt_WpLjets__88->SetBinContent(4,0.001997142);
   h_looseLep2Pt_WpLjets__88->SetBinContent(5,0.001838293);
   h_looseLep2Pt_WpLjets__88->SetBinContent(6,0.0008665013);
   h_looseLep2Pt_WpLjets__88->SetBinContent(7,0.001024588);
   h_looseLep2Pt_WpLjets__88->SetBinContent(8,0.0007202847);
   h_looseLep2Pt_WpLjets__88->SetBinContent(9,0.0001418163);
   h_looseLep2Pt_WpLjets__88->SetBinContent(10,0.0002837216);
   h_looseLep2Pt_WpLjets__88->SetBinContent(11,0.0001795552);
   h_looseLep2Pt_WpLjets__88->SetBinContent(12,1.395914e-05);
   h_looseLep2Pt_WpLjets__88->SetBinContent(13,1.974067e-05);
   h_looseLep2Pt_WpLjets__88->SetBinContent(14,5.586989e-06);
   h_looseLep2Pt_WpLjets__88->SetBinContent(15,4.838904e-05);
   h_looseLep2Pt_WpLjets__88->SetBinContent(16,8.80718e-06);
   h_looseLep2Pt_WpLjets__88->SetBinContent(17,2.15012e-06);
   h_looseLep2Pt_WpLjets__88->SetBinContent(18,3.517553e-06);
   h_looseLep2Pt_WpLjets__88->SetBinContent(19,3.815246e-07);
   h_looseLep2Pt_WpLjets__88->SetBinContent(20,1.212912e-05);
   h_looseLep2Pt_WpLjets__88->SetBinError(1,0.001351271);
   h_looseLep2Pt_WpLjets__88->SetBinError(2,0.0006213388);
   h_looseLep2Pt_WpLjets__88->SetBinError(3,0.0004390932);
   h_looseLep2Pt_WpLjets__88->SetBinError(4,0.0003469893);
   h_looseLep2Pt_WpLjets__88->SetBinError(5,0.0003545163);
   h_looseLep2Pt_WpLjets__88->SetBinError(6,0.0002163202);
   h_looseLep2Pt_WpLjets__88->SetBinError(7,0.0002255816);
   h_looseLep2Pt_WpLjets__88->SetBinError(8,0.0001927611);
   h_looseLep2Pt_WpLjets__88->SetBinError(9,6.565621e-05);
   h_looseLep2Pt_WpLjets__88->SetBinError(10,0.0001456303);
   h_looseLep2Pt_WpLjets__88->SetBinError(11,9.307131e-05);
   h_looseLep2Pt_WpLjets__88->SetBinError(12,4.209394e-06);
   h_looseLep2Pt_WpLjets__88->SetBinError(13,1.131021e-05);
   h_looseLep2Pt_WpLjets__88->SetBinError(14,3.172661e-06);
   h_looseLep2Pt_WpLjets__88->SetBinError(15,4.146079e-05);
   h_looseLep2Pt_WpLjets__88->SetBinError(16,5.369418e-06);
   h_looseLep2Pt_WpLjets__88->SetBinError(17,8.346041e-07);
   h_looseLep2Pt_WpLjets__88->SetBinError(18,2.861137e-06);
   h_looseLep2Pt_WpLjets__88->SetBinError(19,2.949137e-07);
   h_looseLep2Pt_WpLjets__88->SetBinError(20,6.047119e-06);
   h_looseLep2Pt_WpLjets__88->SetEntries(3309);
   h_looseLep2Pt_WpLjets__88->SetStats(0);

   ci = TColor::GetColor("#66cc66");
   h_looseLep2Pt_WpLjets__88->SetFillColor(ci);
   h_looseLep2Pt_WpLjets__88->GetXaxis()->SetTitle("Sub-leading lep p_{T} [GeV]");
   h_looseLep2Pt_WpLjets__88->GetXaxis()->SetLabelFont(42);
   h_looseLep2Pt_WpLjets__88->GetXaxis()->SetLabelOffset(0.007);
   h_looseLep2Pt_WpLjets__88->GetXaxis()->SetTitleSize(0.05);
   h_looseLep2Pt_WpLjets__88->GetXaxis()->SetTickLength(0.025);
   h_looseLep2Pt_WpLjets__88->GetXaxis()->SetTitleFont(42);
   h_looseLep2Pt_WpLjets__88->GetYaxis()->SetTitle("a.u./25 GeV");
   h_looseLep2Pt_WpLjets__88->GetYaxis()->SetLabelFont(42);
   h_looseLep2Pt_WpLjets__88->GetYaxis()->SetLabelOffset(0.007);
   h_looseLep2Pt_WpLjets__88->GetYaxis()->SetTitleSize(0.05);
   h_looseLep2Pt_WpLjets__88->GetYaxis()->SetTickLength(0.025);
   h_looseLep2Pt_WpLjets__88->GetYaxis()->SetTitleFont(42);
   h_looseLep2Pt_WpLjets__88->GetZaxis()->SetLabelFont(42);
   h_looseLep2Pt_WpLjets__88->GetZaxis()->SetLabelOffset(0.007);
   h_looseLep2Pt_WpLjets__88->GetZaxis()->SetTitleSize(0.05);
   h_looseLep2Pt_WpLjets__88->GetZaxis()->SetTickLength(0.025);
   h_looseLep2Pt_WpLjets__88->GetZaxis()->SetTitleFont(42);
   h->Add(h_looseLep2Pt_W+jets,"");
   
   TH1D *h_looseLep2Pt_TopsPoPLFcP__89 = new TH1D("h_looseLep2Pt_TopsPoPLFcP__89","",20,0,500);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(1,0.09566986);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(2,0.1184424);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(3,0.0578968);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(4,0.02776582);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(5,0.01352875);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(6,0.006884179);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(7,0.003658057);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(8,0.001948227);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(9,0.001021047);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(10,0.000535609);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(11,0.000252071);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(12,0.0001040926);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(13,0.0002597359);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(14,4.685411e-05);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(15,2.316069e-05);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(16,7.098286e-06);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(17,1.098163e-05);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(18,5.405239e-06);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(19,1.254191e-05);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(20,6.416628e-06);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(1,0.001032897);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(2,0.001159746);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(3,0.0008366751);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(4,0.0005883119);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(5,0.0003798421);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(6,0.0002961909);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(7,0.0002252512);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(8,0.0001593319);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(9,9.938102e-05);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(10,9.688184e-05);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(11,3.857011e-05);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(12,2.361438e-05);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(13,0.0001125534);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(14,1.684722e-05);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(15,1.087063e-05);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(16,7.098286e-06);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(17,7.125221e-06);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(18,3.836305e-06);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(19,8.954834e-06);
   h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(20,4.538739e-06);
   h_looseLep2Pt_TopsPoPLFcP__89->SetEntries(45754);
   h_looseLep2Pt_TopsPoPLFcP__89->SetStats(0);

   ci = TColor::GetColor("#cc33cc");
   h_looseLep2Pt_TopsPoPLFcP__89->SetFillColor(ci);
   h_looseLep2Pt_TopsPoPLFcP__89->GetXaxis()->SetTitle("Sub-leading lep p_{T} [GeV]");
   h_looseLep2Pt_TopsPoPLFcP__89->GetXaxis()->SetLabelFont(42);
   h_looseLep2Pt_TopsPoPLFcP__89->GetXaxis()->SetLabelOffset(0.007);
   h_looseLep2Pt_TopsPoPLFcP__89->GetXaxis()->SetTitleSize(0.05);
   h_looseLep2Pt_TopsPoPLFcP__89->GetXaxis()->SetTickLength(0.025);
   h_looseLep2Pt_TopsPoPLFcP__89->GetXaxis()->SetTitleFont(42);
   h_looseLep2Pt_TopsPoPLFcP__89->GetYaxis()->SetTitle("a.u./25 GeV");
   h_looseLep2Pt_TopsPoPLFcP__89->GetYaxis()->SetLabelFont(42);
   h_looseLep2Pt_TopsPoPLFcP__89->GetYaxis()->SetLabelOffset(0.007);
   h_looseLep2Pt_TopsPoPLFcP__89->GetYaxis()->SetTitleSize(0.05);
   h_looseLep2Pt_TopsPoPLFcP__89->GetYaxis()->SetTickLength(0.025);
   h_looseLep2Pt_TopsPoPLFcP__89->GetYaxis()->SetTitleFont(42);
   h_looseLep2Pt_TopsPoPLFcP__89->GetZaxis()->SetLabelFont(42);
   h_looseLep2Pt_TopsPoPLFcP__89->GetZaxis()->SetLabelOffset(0.007);
   h_looseLep2Pt_TopsPoPLFcP__89->GetZaxis()->SetTitleSize(0.05);
   h_looseLep2Pt_TopsPoPLFcP__89->GetZaxis()->SetTickLength(0.025);
   h_looseLep2Pt_TopsPoPLFcP__89->GetZaxis()->SetTitleFont(42);
   h->Add(h_looseLep2Pt_Top (LF),"");
   
   TH1D *h_looseLep2Pt_TopsPoPHFcP__90 = new TH1D("h_looseLep2Pt_TopsPoPHFcP__90","",20,0,500);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(1,0.1041412);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(2,0.1735886);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(3,0.1116258);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(4,0.06454315);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(5,0.03441357);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(6,0.01992067);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(7,0.01014646);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(8,0.005947886);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(9,0.002876054);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(10,0.001475723);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(11,0.0007236292);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(12,0.0004357554);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(13,0.0002249375);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(14,0.0001475853);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(15,0.0001020681);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(16,6.402955e-05);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(17,1.980568e-05);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(18,2.33998e-05);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(20,2.517288e-05);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(1,0.001126128);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(2,0.001474884);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(3,0.001116875);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(4,0.0008934187);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(5,0.0006246887);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(6,0.0005076532);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(7,0.0003555866);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(8,0.000286312);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(9,0.0001737097);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(10,0.0001517557);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(11,6.387877e-05);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(12,5.265571e-05);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(13,3.442087e-05);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(14,2.732865e-05);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(15,2.352865e-05);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(16,1.915664e-05);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(17,1.063003e-05);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(18,1.102394e-05);
   h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(20,1.216417e-05);
   h_looseLep2Pt_TopsPoPHFcP__90->SetEntries(77950);
   h_looseLep2Pt_TopsPoPHFcP__90->SetStats(0);

   ci = TColor::GetColor("#ff9900");
   h_looseLep2Pt_TopsPoPHFcP__90->SetFillColor(ci);
   h_looseLep2Pt_TopsPoPHFcP__90->GetXaxis()->SetTitle("Sub-leading lep p_{T} [GeV]");
   h_looseLep2Pt_TopsPoPHFcP__90->GetXaxis()->SetLabelFont(42);
   h_looseLep2Pt_TopsPoPHFcP__90->GetXaxis()->SetLabelOffset(0.007);
   h_looseLep2Pt_TopsPoPHFcP__90->GetXaxis()->SetTitleSize(0.05);
   h_looseLep2Pt_TopsPoPHFcP__90->GetXaxis()->SetTickLength(0.025);
   h_looseLep2Pt_TopsPoPHFcP__90->GetXaxis()->SetTitleFont(42);
   h_looseLep2Pt_TopsPoPHFcP__90->GetYaxis()->SetTitle("a.u./25 GeV");
   h_looseLep2Pt_TopsPoPHFcP__90->GetYaxis()->SetLabelFont(42);
   h_looseLep2Pt_TopsPoPHFcP__90->GetYaxis()->SetLabelOffset(0.007);
   h_looseLep2Pt_TopsPoPHFcP__90->GetYaxis()->SetTitleSize(0.05);
   h_looseLep2Pt_TopsPoPHFcP__90->GetYaxis()->SetTickLength(0.025);
   h_looseLep2Pt_TopsPoPHFcP__90->GetYaxis()->SetTitleFont(42);
   h_looseLep2Pt_TopsPoPHFcP__90->GetZaxis()->SetLabelFont(42);
   h_looseLep2Pt_TopsPoPHFcP__90->GetZaxis()->SetLabelOffset(0.007);
   h_looseLep2Pt_TopsPoPHFcP__90->GetZaxis()->SetTitleSize(0.05);
   h_looseLep2Pt_TopsPoPHFcP__90->GetZaxis()->SetTickLength(0.025);
   h_looseLep2Pt_TopsPoPHFcP__90->GetZaxis()->SetTitleFont(42);
   h->Add(h_looseLep2Pt_Top (HF),"");
   h->Draw("hist");
   
   TH1D *hsum__91 = new TH1D("hsum__91","",20,0,500);
   hsum__91->SetBinContent(1,0.271725);
   hsum__91->SetBinContent(2,0.3294396);
   hsum__91->SetBinContent(3,0.1824981);
   hsum__91->SetBinContent(4,0.09937792);
   hsum__91->SetBinContent(5,0.05197885);
   hsum__91->SetBinContent(6,0.02916189);
   hsum__91->SetBinContent(7,0.01573805);
   hsum__91->SetBinContent(8,0.009324878);
   hsum__91->SetBinContent(9,0.004271597);
   hsum__91->SetBinContent(10,0.002763206);
   hsum__91->SetBinContent(11,0.001415357);
   hsum__91->SetBinContent(12,0.0005665895);
   hsum__91->SetBinContent(13,0.0005139942);
   hsum__91->SetBinContent(14,0.000423513);
   hsum__91->SetBinContent(15,0.0004266677);
   hsum__91->SetBinContent(16,8.11589e-05);
   hsum__91->SetBinContent(17,3.366807e-05);
   hsum__91->SetBinContent(18,3.232259e-05);
   hsum__91->SetBinContent(19,0.0001824813);
   hsum__91->SetBinContent(20,4.517354e-05);
   hsum__91->SetBinError(1,0.003076049);
   hsum__91->SetBinError(2,0.003284904);
   hsum__91->SetBinError(3,0.002275067);
   hsum__91->SetBinError(4,0.001468607);
   hsum__91->SetBinError(5,0.001000255);
   hsum__91->SetBinError(6,0.0008373727);
   hsum__91->SetBinError(7,0.0005867939);
   hsum__91->SetBinError(8,0.0005494993);
   hsum__91->SetBinError(9,0.0002518041);
   hsum__91->SetBinError(10,0.0003753241);
   hsum__91->SetBinError(11,0.0002787325);
   hsum__91->SetBinError(12,5.819584e-05);
   hsum__91->SetBinError(13,0.0001183642);
   hsum__91->SetBinError(14,0.0002242324);
   hsum__91->SetBinError(15,0.0002463072);
   hsum__91->SetBinError(16,2.113829e-05);
   hsum__91->SetBinError(17,1.283488e-05);
   hsum__91->SetBinError(18,1.201793e-05);
   hsum__91->SetBinError(19,0.0001697944);
   hsum__91->SetBinError(20,1.436954e-05);
   hsum__91->SetEntries(65);
   hsum__91->SetStats(0);

   ci = 1187;
   color = new TColor(ci, 0, 0, 0, " ", 0.99);
   hsum__91->SetFillColor(ci);
   hsum__91->SetFillStyle(3003);
   hsum__91->SetLineWidth(0);
   hsum__91->GetXaxis()->SetTitle("Sub-leading lep p_{T} [GeV]");
   hsum__91->GetXaxis()->SetLabelFont(42);
   hsum__91->GetXaxis()->SetLabelOffset(0.007);
   hsum__91->GetXaxis()->SetTitleSize(0.05);
   hsum__91->GetXaxis()->SetTickLength(0.025);
   hsum__91->GetXaxis()->SetTitleFont(42);
   hsum__91->GetYaxis()->SetTitle("a.u./25 GeV");
   hsum__91->GetYaxis()->SetLabelFont(42);
   hsum__91->GetYaxis()->SetLabelOffset(0.007);
   hsum__91->GetYaxis()->SetTitleSize(0.05);
   hsum__91->GetYaxis()->SetTickLength(0.025);
   hsum__91->GetYaxis()->SetTitleFont(42);
   hsum__91->GetZaxis()->SetLabelFont(42);
   hsum__91->GetZaxis()->SetLabelOffset(0.007);
   hsum__91->GetZaxis()->SetTitleSize(0.05);
   hsum__91->GetZaxis()->SetTickLength(0.025);
   hsum__91->GetZaxis()->SetTitleFont(42);
   hsum__91->Draw("e2 same");
   
   TH1D *h_looseLep2Pt_Data__92 = new TH1D("h_looseLep2Pt_Data__92","",20,0,500);
   h_looseLep2Pt_Data__92->SetBinContent(1,0.2915764);
   h_looseLep2Pt_Data__92->SetBinContent(2,0.3247432);
   h_looseLep2Pt_Data__92->SetBinContent(3,0.1760106);
   h_looseLep2Pt_Data__92->SetBinContent(4,0.0916329);
   h_looseLep2Pt_Data__92->SetBinContent(5,0.04946763);
   h_looseLep2Pt_Data__92->SetBinContent(6,0.02920946);
   h_looseLep2Pt_Data__92->SetBinContent(7,0.01620654);
   h_looseLep2Pt_Data__92->SetBinContent(8,0.008904174);
   h_looseLep2Pt_Data__92->SetBinContent(9,0.004805427);
   h_looseLep2Pt_Data__92->SetBinContent(10,0.002732498);
   h_looseLep2Pt_Data__92->SetBinContent(11,0.001837369);
   h_looseLep2Pt_Data__92->SetBinContent(12,0.001177801);
   h_looseLep2Pt_Data__92->SetBinContent(13,0.0008951286);
   h_looseLep2Pt_Data__92->SetBinContent(14,0.0002826722);
   h_looseLep2Pt_Data__92->SetBinContent(15,0.0001413361);
   h_looseLep2Pt_Data__92->SetBinContent(16,0.0001884481);
   h_looseLep2Pt_Data__92->SetBinContent(17,0.0001413361);
   h_looseLep2Pt_Data__92->SetBinContent(20,4.711203e-05);
   h_looseLep2Pt_Data__92->SetBinError(1,0.003706313);
   h_looseLep2Pt_Data__92->SetBinError(2,0.003911434);
   h_looseLep2Pt_Data__92->SetBinError(3,0.002879621);
   h_looseLep2Pt_Data__92->SetBinError(4,0.002077742);
   h_looseLep2Pt_Data__92->SetBinError(5,0.001526604);
   h_looseLep2Pt_Data__92->SetBinError(6,0.00117308);
   h_looseLep2Pt_Data__92->SetBinError(7,0.000873798);
   h_looseLep2Pt_Data__92->SetBinError(8,0.0006476834);
   h_looseLep2Pt_Data__92->SetBinError(9,0.0004758082);
   h_looseLep2Pt_Data__92->SetBinError(10,0.0003587945);
   h_looseLep2Pt_Data__92->SetBinError(11,0.0002942145);
   h_looseLep2Pt_Data__92->SetBinError(12,0.0002355602);
   h_looseLep2Pt_Data__92->SetBinError(13,0.0002053566);
   h_looseLep2Pt_Data__92->SetBinError(14,0.0001154004);
   h_looseLep2Pt_Data__92->SetBinError(15,8.160043e-05);
   h_looseLep2Pt_Data__92->SetBinError(16,9.422406e-05);
   h_looseLep2Pt_Data__92->SetBinError(17,8.160043e-05);
   h_looseLep2Pt_Data__92->SetBinError(20,4.711203e-05);
   h_looseLep2Pt_Data__92->SetEntries(21226);
   h_looseLep2Pt_Data__92->SetStats(0);
   h_looseLep2Pt_Data__92->SetLineWidth(3);
   h_looseLep2Pt_Data__92->SetMarkerStyle(20);
   h_looseLep2Pt_Data__92->SetMarkerSize(2);
   h_looseLep2Pt_Data__92->GetXaxis()->SetTitle("Sub-leading lep p_{T} [GeV]");
   h_looseLep2Pt_Data__92->GetXaxis()->SetLabelFont(42);
   h_looseLep2Pt_Data__92->GetXaxis()->SetLabelOffset(0.007);
   h_looseLep2Pt_Data__92->GetXaxis()->SetTitleSize(0.05);
   h_looseLep2Pt_Data__92->GetXaxis()->SetTickLength(0.025);
   h_looseLep2Pt_Data__92->GetXaxis()->SetTitleFont(42);
   h_looseLep2Pt_Data__92->GetYaxis()->SetTitle("a.u./25 GeV");
   h_looseLep2Pt_Data__92->GetYaxis()->SetLabelFont(42);
   h_looseLep2Pt_Data__92->GetYaxis()->SetLabelOffset(0.007);
   h_looseLep2Pt_Data__92->GetYaxis()->SetTitleSize(0.05);
   h_looseLep2Pt_Data__92->GetYaxis()->SetTickLength(0.025);
   h_looseLep2Pt_Data__92->GetYaxis()->SetTitleFont(42);
   h_looseLep2Pt_Data__92->GetZaxis()->SetLabelFont(42);
   h_looseLep2Pt_Data__92->GetZaxis()->SetLabelOffset(0.007);
   h_looseLep2Pt_Data__92->GetZaxis()->SetTitleSize(0.05);
   h_looseLep2Pt_Data__92->GetZaxis()->SetTickLength(0.025);
   h_looseLep2Pt_Data__92->GetZaxis()->SetTitleFont(42);
   h_looseLep2Pt_Data__92->Draw("elp same");
   
   TLegend *leg = new TLegend(0.6,0.55,0.88,0.9,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   TLegendEntry *entry=leg->AddEntry("h_looseLep2Pt_Data","Data","ELP");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(20);
   entry->SetMarkerSize(2);
   entry->SetTextFont(42);
   entry=leg->AddEntry("h_looseLep2Pt_Top (HF)","Top (HF)","F");

   ci = TColor::GetColor("#ff9900");
   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("h_looseLep2Pt_Top (LF)","Top (LF)","F");

   ci = TColor::GetColor("#cc33cc");
   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("h_looseLep2Pt_W+jets","W+jets","F");

   ci = TColor::GetColor("#66cc66");
   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("h_looseLep2Pt_Z+jets","Z+jets","F");

   ci = TColor::GetColor("#3399cc");
   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("h_looseLep2Pt_Diboson","Diboson","F");

   ci = TColor::GetColor("#9966cc");
   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("h_looseLep2Pt_QCD","QCD","F");

   ci = TColor::GetColor("#cccccc");
   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();
   
   leg = new TLegend(0.6,0.55,0.88,0.9,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   entry=leg->AddEntry("h_looseLep2Pt_Data","Data","ELP");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(20);
   entry->SetMarkerSize(2);
   entry->SetTextFont(42);
   entry=leg->AddEntry("h_looseLep2Pt_Top (HF)","Top (HF)","F");

   ci = TColor::GetColor("#ff9900");
   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("h_looseLep2Pt_Top (LF)","Top (LF)","F");

   ci = TColor::GetColor("#cc33cc");
   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("h_looseLep2Pt_W+jets","W+jets","F");

   ci = TColor::GetColor("#66cc66");
   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("h_looseLep2Pt_Z+jets","Z+jets","F");

   ci = TColor::GetColor("#3399cc");
   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("h_looseLep2Pt_Diboson","Diboson","F");

   ci = TColor::GetColor("#9966cc");
   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("h_looseLep2Pt_QCD","QCD","F");

   ci = TColor::GetColor("#cccccc");
   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.18,0.85,"CMS");
tex->SetNDC();
   tex->SetTextSize(0.06);
   tex->SetLineWidth(2);
   tex->Draw();
      tex = new TLatex(0.28,0.85,"Preliminary");
tex->SetNDC();
   tex->SetTextFont(52);
   tex->SetTextSize(0.06);
   tex->SetLineWidth(2);
   tex->Draw();
      tex = new TLatex(0.9,0.94,"36.6 fb^{-1} (13 TeV)");
tex->SetNDC();
   tex->SetTextAlign(31);
   tex->SetTextFont(42);
   tex->SetTextSize(0.04);
   tex->SetLineWidth(2);
   tex->Draw();
   pad1->Modified();
   c1->cd();
  
// ------------>Primitives in pad: pad2
   TPad *pad2 = new TPad("pad2", "pad2",0,0.05,1,0.3);
   pad2->Draw();
   pad2->cd();
   pad2->Range(-93.75,-0.8914286,531.25,0.48);
   pad2->SetFillColor(0);
   pad2->SetBorderMode(0);
   pad2->SetBorderSize(2);
   pad2->SetGridy();
   pad2->SetTickx(1);
   pad2->SetTicky(1);
   pad2->SetLeftMargin(0.15);
   pad2->SetRightMargin(0.05);
   pad2->SetTopMargin(0);
   pad2->SetBottomMargin(0.3);
   pad2->SetFrameFillStyle(0);
   pad2->SetFrameBorderMode(0);
   pad2->SetFrameFillStyle(0);
   pad2->SetFrameBorderMode(0);
   
   TH1D *ratio__93 = new TH1D("ratio__93","",20,0,500);
   ratio__93->SetBinContent(1,0.07305694);
   ratio__93->SetBinContent(2,-0.01425564);
   ratio__93->SetBinContent(3,-0.03554857);
   ratio__93->SetBinContent(4,-0.07793492);
   ratio__93->SetBinContent(5,-0.04831219);
   ratio__93->SetBinContent(6,0.00163126);
   ratio__93->SetBinContent(7,0.02976763);
   ratio__93->SetBinContent(8,-0.04511625);
   ratio__93->SetBinContent(9,0.1249721);
   ratio__93->SetBinContent(10,-0.01111317);
   ratio__93->SetBinContent(11,0.2981665);
   ratio__93->SetBinContent(12,1.078755);
   ratio__93->SetBinContent(13,0.741515);
   ratio__93->SetBinContent(14,-0.3325537);
   ratio__93->SetBinContent(15,-0.6687443);
   ratio__93->SetBinContent(16,1.321965);
   ratio__93->SetBinContent(17,3.197927);
   ratio__93->SetBinContent(18,-999);
   ratio__93->SetBinContent(19,-999);
   ratio__93->SetBinContent(20,0.04291213);
   ratio__93->SetBinError(1,0.0001);
   ratio__93->SetBinError(2,0.0001);
   ratio__93->SetBinError(3,0.0001);
   ratio__93->SetBinError(4,0.0001);
   ratio__93->SetBinError(5,0.0001);
   ratio__93->SetBinError(6,0.0001);
   ratio__93->SetBinError(7,0.0001);
   ratio__93->SetBinError(8,0.0001);
   ratio__93->SetBinError(9,0.0001);
   ratio__93->SetBinError(10,0.0001);
   ratio__93->SetBinError(11,0.0001);
   ratio__93->SetBinError(12,0.0001);
   ratio__93->SetBinError(13,0.0001);
   ratio__93->SetBinError(14,0.0001);
   ratio__93->SetBinError(15,0.0001);
   ratio__93->SetBinError(16,0.0001);
   ratio__93->SetBinError(17,0.0001);
   ratio__93->SetBinError(18,0.0001);
   ratio__93->SetBinError(19,0.0001);
   ratio__93->SetBinError(20,0.0001);
   ratio__93->SetMinimum(-0.48);
   ratio__93->SetMaximum(0.48);
   ratio__93->SetEntries(21246);
   ratio__93->SetStats(0);
   ratio__93->SetLineWidth(3);
   ratio__93->SetMarkerStyle(20);
   ratio__93->SetMarkerSize(2);
   ratio__93->GetXaxis()->SetTitle("Sub-leading lep p_{T} [GeV]");
   ratio__93->GetXaxis()->SetLabelFont(43);
   ratio__93->GetXaxis()->SetLabelOffset(0.007);
   ratio__93->GetXaxis()->SetLabelSize(30);
   ratio__93->GetXaxis()->SetTitleSize(40);
   ratio__93->GetXaxis()->SetTickLength(0.025);
   ratio__93->GetXaxis()->SetTitleOffset(5);
   ratio__93->GetXaxis()->SetTitleFont(43);
   ratio__93->GetYaxis()->SetTitle("#frac{Data-Exp}{Exp}");
   ratio__93->GetYaxis()->SetNdivisions(5);
   ratio__93->GetYaxis()->SetLabelFont(43);
   ratio__93->GetYaxis()->SetLabelOffset(0.007);
   ratio__93->GetYaxis()->SetLabelSize(30);
   ratio__93->GetYaxis()->SetTitleSize(40);
   ratio__93->GetYaxis()->SetTickLength(0.025);
   ratio__93->GetYaxis()->SetTitleOffset(2.5);
   ratio__93->GetYaxis()->SetTitleFont(43);
   ratio__93->GetZaxis()->SetLabelFont(42);
   ratio__93->GetZaxis()->SetLabelOffset(0.007);
   ratio__93->GetZaxis()->SetTitleSize(0.05);
   ratio__93->GetZaxis()->SetTickLength(0.025);
   ratio__93->GetZaxis()->SetTitleFont(42);
   ratio__93->Draw("elp");
   
   TH1D *zero__94 = new TH1D("zero__94","",20,0,500);
   zero__94->SetBinError(1,0.003706313);
   zero__94->SetBinError(2,0.003911434);
   zero__94->SetBinError(3,0.002879621);
   zero__94->SetBinError(4,0.002077742);
   zero__94->SetBinError(5,0.001526604);
   zero__94->SetBinError(6,0.00117308);
   zero__94->SetBinError(7,0.000873798);
   zero__94->SetBinError(8,0.0006476834);
   zero__94->SetBinError(9,0.0004758082);
   zero__94->SetBinError(10,0.0003587945);
   zero__94->SetBinError(11,0.0002942145);
   zero__94->SetBinError(12,0.0002355602);
   zero__94->SetBinError(13,0.0002053566);
   zero__94->SetBinError(14,0.0001154004);
   zero__94->SetBinError(15,8.160043e-05);
   zero__94->SetBinError(16,9.422406e-05);
   zero__94->SetBinError(17,8.160043e-05);
   zero__94->SetBinError(20,4.711203e-05);
   zero__94->SetEntries(21246);
   zero__94->SetStats(0);
   zero__94->SetLineWidth(3);
   zero__94->SetMarkerStyle(20);
   zero__94->SetMarkerSize(2);
   zero__94->GetXaxis()->SetTitle("Sub-leading lep p_{T} [GeV]");
   zero__94->GetXaxis()->SetLabelFont(42);
   zero__94->GetXaxis()->SetLabelOffset(0.007);
   zero__94->GetXaxis()->SetTitleSize(0.05);
   zero__94->GetXaxis()->SetTickLength(0.025);
   zero__94->GetXaxis()->SetTitleFont(42);
   zero__94->GetYaxis()->SetTitle("a.u./25 GeV");
   zero__94->GetYaxis()->SetLabelFont(42);
   zero__94->GetYaxis()->SetLabelOffset(0.007);
   zero__94->GetYaxis()->SetTitleSize(0.05);
   zero__94->GetYaxis()->SetTickLength(0.025);
   zero__94->GetYaxis()->SetTitleFont(42);
   zero__94->GetZaxis()->SetLabelFont(42);
   zero__94->GetZaxis()->SetLabelOffset(0.007);
   zero__94->GetZaxis()->SetTitleSize(0.05);
   zero__94->GetZaxis()->SetTickLength(0.025);
   zero__94->GetZaxis()->SetTitleFont(42);
   zero__94->Draw("hist same");
   
   TH1D *sumratioup__95 = new TH1D("sumratioup__95","",20,0,500);
   sumratioup__95->SetBinContent(1,0.01132045);
   sumratioup__95->SetBinContent(2,0.009971187);
   sumratioup__95->SetBinContent(3,0.01246625);
   sumratioup__95->SetBinContent(4,0.014778);
   sumratioup__95->SetBinContent(5,0.01924351);
   sumratioup__95->SetBinContent(6,0.02871463);
   sumratioup__95->SetBinContent(7,0.03728504);
   sumratioup__95->SetBinContent(8,0.05892831);
   sumratioup__95->SetBinContent(9,0.05894846);
   sumratioup__95->SetBinContent(10,0.1358292);
   sumratioup__95->SetBinContent(11,0.1969344);
   sumratioup__95->SetBinContent(12,0.1027125);
   sumratioup__95->SetBinContent(13,0.2302831);
   sumratioup__95->SetBinContent(14,0.5294582);
   sumratioup__95->SetBinContent(15,0.577281);
   sumratioup__95->SetBinContent(16,0.2604556);
   sumratioup__95->SetBinContent(17,0.3812182);
   sumratioup__95->SetBinContent(18,0.3718119);
   sumratioup__95->SetBinContent(19,0.9304757);
   sumratioup__95->SetBinContent(20,0.3180965);
   sumratioup__95->SetBinError(1,0.003076049);
   sumratioup__95->SetBinError(2,0.003284904);
   sumratioup__95->SetBinError(3,0.002275067);
   sumratioup__95->SetBinError(4,0.001468607);
   sumratioup__95->SetBinError(5,0.001000255);
   sumratioup__95->SetBinError(6,0.0008373727);
   sumratioup__95->SetBinError(7,0.0005867939);
   sumratioup__95->SetBinError(8,0.0005494993);
   sumratioup__95->SetBinError(9,0.0002518041);
   sumratioup__95->SetBinError(10,0.0003753241);
   sumratioup__95->SetBinError(11,0.0002787325);
   sumratioup__95->SetBinError(12,5.819584e-05);
   sumratioup__95->SetBinError(13,0.0001183642);
   sumratioup__95->SetBinError(14,0.0002242324);
   sumratioup__95->SetBinError(15,0.0002463072);
   sumratioup__95->SetBinError(16,2.113829e-05);
   sumratioup__95->SetBinError(17,1.283488e-05);
   sumratioup__95->SetBinError(18,1.201793e-05);
   sumratioup__95->SetBinError(19,0.0001697944);
   sumratioup__95->SetBinError(20,1.436954e-05);
   sumratioup__95->SetEntries(85);
   sumratioup__95->SetStats(0);

   ci = 1187;
   color = new TColor(ci, 0, 0, 0, " ", 0.99);
   sumratioup__95->SetFillColor(ci);
   sumratioup__95->SetFillStyle(3003);
   sumratioup__95->GetXaxis()->SetTitle("Sub-leading lep p_{T} [GeV]");
   sumratioup__95->GetXaxis()->SetLabelFont(42);
   sumratioup__95->GetXaxis()->SetLabelOffset(0.007);
   sumratioup__95->GetXaxis()->SetTitleSize(0.05);
   sumratioup__95->GetXaxis()->SetTickLength(0.025);
   sumratioup__95->GetXaxis()->SetTitleFont(42);
   sumratioup__95->GetYaxis()->SetTitle("a.u./25 GeV");
   sumratioup__95->GetYaxis()->SetLabelFont(42);
   sumratioup__95->GetYaxis()->SetLabelOffset(0.007);
   sumratioup__95->GetYaxis()->SetTitleSize(0.05);
   sumratioup__95->GetYaxis()->SetTickLength(0.025);
   sumratioup__95->GetYaxis()->SetTitleFont(42);
   sumratioup__95->GetZaxis()->SetLabelFont(42);
   sumratioup__95->GetZaxis()->SetLabelOffset(0.007);
   sumratioup__95->GetZaxis()->SetTitleSize(0.05);
   sumratioup__95->GetZaxis()->SetTickLength(0.025);
   sumratioup__95->GetZaxis()->SetTitleFont(42);
   sumratioup__95->Draw("hist same");
   
   TH1D *sumratiodown__96 = new TH1D("sumratiodown__96","",20,0,500);
   sumratiodown__96->SetBinContent(1,-0.01132045);
   sumratiodown__96->SetBinContent(2,-0.009971187);
   sumratiodown__96->SetBinContent(3,-0.01246625);
   sumratiodown__96->SetBinContent(4,-0.014778);
   sumratiodown__96->SetBinContent(5,-0.01924351);
   sumratiodown__96->SetBinContent(6,-0.02871463);
   sumratiodown__96->SetBinContent(7,-0.03728504);
   sumratiodown__96->SetBinContent(8,-0.05892831);
   sumratiodown__96->SetBinContent(9,-0.05894846);
   sumratiodown__96->SetBinContent(10,-0.1358292);
   sumratiodown__96->SetBinContent(11,-0.1969344);
   sumratiodown__96->SetBinContent(12,-0.1027125);
   sumratiodown__96->SetBinContent(13,-0.2302831);
   sumratiodown__96->SetBinContent(14,-0.5294582);
   sumratiodown__96->SetBinContent(15,-0.577281);
   sumratiodown__96->SetBinContent(16,-0.2604556);
   sumratiodown__96->SetBinContent(17,-0.3812182);
   sumratiodown__96->SetBinContent(18,-0.3718119);
   sumratiodown__96->SetBinContent(19,-0.9304757);
   sumratiodown__96->SetBinContent(20,-0.3180965);
   sumratiodown__96->SetBinError(1,0.003076049);
   sumratiodown__96->SetBinError(2,0.003284904);
   sumratiodown__96->SetBinError(3,0.002275067);
   sumratiodown__96->SetBinError(4,0.001468607);
   sumratiodown__96->SetBinError(5,0.001000255);
   sumratiodown__96->SetBinError(6,0.0008373727);
   sumratiodown__96->SetBinError(7,0.0005867939);
   sumratiodown__96->SetBinError(8,0.0005494993);
   sumratiodown__96->SetBinError(9,0.0002518041);
   sumratiodown__96->SetBinError(10,0.0003753241);
   sumratiodown__96->SetBinError(11,0.0002787325);
   sumratiodown__96->SetBinError(12,5.819584e-05);
   sumratiodown__96->SetBinError(13,0.0001183642);
   sumratiodown__96->SetBinError(14,0.0002242324);
   sumratiodown__96->SetBinError(15,0.0002463072);
   sumratiodown__96->SetBinError(16,2.113829e-05);
   sumratiodown__96->SetBinError(17,1.283488e-05);
   sumratiodown__96->SetBinError(18,1.201793e-05);
   sumratiodown__96->SetBinError(19,0.0001697944);
   sumratiodown__96->SetBinError(20,1.436954e-05);
   sumratiodown__96->SetEntries(85);
   sumratiodown__96->SetStats(0);

   ci = 1187;
   color = new TColor(ci, 0, 0, 0, " ", 0.99);
   sumratiodown__96->SetFillColor(ci);
   sumratiodown__96->SetFillStyle(3003);
   sumratiodown__96->GetXaxis()->SetTitle("Sub-leading lep p_{T} [GeV]");
   sumratiodown__96->GetXaxis()->SetLabelFont(42);
   sumratiodown__96->GetXaxis()->SetLabelOffset(0.007);
   sumratiodown__96->GetXaxis()->SetTitleSize(0.05);
   sumratiodown__96->GetXaxis()->SetTickLength(0.025);
   sumratiodown__96->GetXaxis()->SetTitleFont(42);
   sumratiodown__96->GetYaxis()->SetTitle("a.u./25 GeV");
   sumratiodown__96->GetYaxis()->SetLabelFont(42);
   sumratiodown__96->GetYaxis()->SetLabelOffset(0.007);
   sumratiodown__96->GetYaxis()->SetTitleSize(0.05);
   sumratiodown__96->GetYaxis()->SetTickLength(0.025);
   sumratiodown__96->GetYaxis()->SetTitleFont(42);
   sumratiodown__96->GetZaxis()->SetLabelFont(42);
   sumratiodown__96->GetZaxis()->SetLabelOffset(0.007);
   sumratiodown__96->GetZaxis()->SetTitleSize(0.05);
   sumratiodown__96->GetZaxis()->SetTickLength(0.025);
   sumratiodown__96->GetZaxis()->SetTitleFont(42);
   sumratiodown__96->Draw("hist same");
   
   Double_t Graph0_fx1008[20] = {
   12.5,
   37.5,
   62.5,
   87.5,
   112.5,
   137.5,
   162.5,
   187.5,
   212.5,
   237.5,
   262.5,
   287.5,
   312.5,
   337.5,
   362.5,
   387.5,
   412.5,
   437.5,
   462.5,
   487.5};
   Double_t Graph0_fy1008[20] = {
   0.07305694,
   -0.01425564,
   -0.03554857,
   -0.07793492,
   -0.04831219,
   0.00163126,
   0.02976763,
   -0.04511625,
   0.1249721,
   -0.01111317,
   0.2981665,
   1.078755,
   0.741515,
   -0.3325537,
   -0.6687443,
   1.321965,
   3.197927,
   -999,
   -999,
   0.04291213};
   Double_t Graph0_fex1008[20] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t Graph0_fey1008[20] = {
   0.01363994,
   0.01187299,
   0.01577891,
   0.02090748,
   0.02936972,
   0.04022648,
   0.05552135,
   0.06945757,
   0.1113888,
   0.1298472,
   0.207873,
   0.415751,
   0.3995309,
   0.2724838,
   0.1912505,
   1.160983,
   2.423674,
   0,
   0,
   1.042912};
   TGraphErrors *gre = new TGraphErrors(20,Graph0_fx1008,Graph0_fy1008,Graph0_fex1008,Graph0_fey1008);
   gre->SetName("Graph0");
   gre->SetTitle("Graph");
   gre->SetFillColor(1);
   gre->SetLineWidth(3);
   
   TH1F *Graph_Graph1008 = new TH1F("Graph_Graph1008","Graph",100,0,535);
   Graph_Graph1008->SetMinimum(-1099.462);
   Graph_Graph1008->SetMaximum(106.0838);
   Graph_Graph1008->SetDirectory(0);
   Graph_Graph1008->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1008->SetLineColor(ci);
   Graph_Graph1008->GetXaxis()->SetLabelFont(42);
   Graph_Graph1008->GetXaxis()->SetLabelOffset(0.007);
   Graph_Graph1008->GetXaxis()->SetTitleSize(0.05);
   Graph_Graph1008->GetXaxis()->SetTickLength(0.025);
   Graph_Graph1008->GetXaxis()->SetTitleFont(42);
   Graph_Graph1008->GetYaxis()->SetLabelFont(42);
   Graph_Graph1008->GetYaxis()->SetLabelOffset(0.007);
   Graph_Graph1008->GetYaxis()->SetTitleSize(0.05);
   Graph_Graph1008->GetYaxis()->SetTickLength(0.025);
   Graph_Graph1008->GetYaxis()->SetTitleFont(42);
   Graph_Graph1008->GetZaxis()->SetLabelFont(42);
   Graph_Graph1008->GetZaxis()->SetLabelOffset(0.007);
   Graph_Graph1008->GetZaxis()->SetTitleSize(0.05);
   Graph_Graph1008->GetZaxis()->SetTickLength(0.025);
   Graph_Graph1008->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1008);
   
   gre->Draw("pe0");
   pad2->Modified();
   c1->cd();
   c1->Modified();
   c1->cd();
   c1->SetSelected(c1);
}