コード例 #1
0
TGraphErrors* GetGraph(std::string fname)
{
    TGraphErrors* gr = NULL;

    std::string fGrName = "mygraph";

    TFile *f = new TFile(fname.data());
    if (!f->IsOpen())
    {
        std::cerr << "Failed to open " << fname << std::endl;
        return gr;
    }

    TObject *obj = 0;
    while (gr==0 || fGrName.empty())
    {
        std::cout << "\n";  gDirectory->ls();

        std::cout << "\nEnter selection : ";
        std::getline(std::cin, fGrName);
        gDirectory->GetObject(fGrName.data(), obj);
        if (dynamic_cast<TDirectory*>(obj))
        {
            (dynamic_cast<TDirectory*>(obj))->cd();
        }
        else
        {
            gr = dynamic_cast<TGraphErrors*>(obj);
        }

        std::cout << "fGrName=" << fGrName << std::endl;
        std::cout << "gr=" << std::hex << gr << std::dec << std::endl;
    }

    if (gr!=NULL)
    {

        TGraphErrors* tgr = (TGraphErrors*) gr->Clone("mygraph_0");
        gr=tgr;
//        gr->SetDirectory(0);
    }

    return gr;
}
コード例 #2
0
ファイル: plotResoVsIC.C プロジェクト: J-C-Wright/PFCal
int plotResoVsIC(){

  SetTdrStyle();


  const unsigned nIC = 10;
  const unsigned ICval[nIC] = {0,1,2,3,4,5,10,15,20,50};


  std::ostringstream label;
  TFile *fcalib[nIC];
  
  TGraphErrors *constant = new TGraphErrors();
  constant->SetName("constant");
  constant->SetTitle(";intercalib. smearing");
  constant->SetMarkerStyle(20);
  constant->SetMarkerColor(1);
  constant->SetLineColor(1);
  TGraphErrors *constantSR7 =  new TGraphErrors();
  constantSR7->SetName("constantSR7");
  constantSR7->SetTitle(";intercalib. smearing");
  constantSR7->SetMarkerStyle(23);
  constantSR7->SetMarkerColor(2);
  constantSR7->SetLineColor(2);

  TGraphErrors *noise = (TGraphErrors *) constant->Clone("noise");
  TGraphErrors *sampling = (TGraphErrors *) constant->Clone("sampling");
  TGraphErrors *samplingSR7 = (TGraphErrors *) constantSR7->Clone("samplingSR7");

  TCanvas *mycReso = new TCanvas("mycReso","mycReso",1500,1000);
  mycReso->Divide(2,5);
  TCanvas *mycR = new TCanvas("mycR","Sampling",1500,1000);
  TCanvas *mycC = new TCanvas("mycC","Constant",1500,1000);
  TCanvas *mycN = new TCanvas("mycN","Noise",1500,1000);

  gStyle->SetOptFit(1111);
  gStyle->SetOptStat(0);

  gStyle->SetStatW(0.2);
  gStyle->SetStatH(0.5);

  TLatex lat;
  char buf[500];

  TGraphErrors *gr[nIC][2];
  double x0,y0;
  double x0_7,y0_7;

  for (unsigned ic(0);ic<nIC;++ic){//loop on intercalib
    label.str("");
    label << "PLOTS/CalibReso";
    label << "_vsE";
    label << "_IC" << ICval[ic];
    label << ".root";
    fcalib[ic] = TFile::Open(label.str().c_str());
    if (!fcalib[ic]) {
      std::cout << " -- failed to open file: " << label.str() << std::endl;
      continue;
    }
    else {
      std::cout << " -- file " << label.str() << " successfully opened." << std::endl;
    }
    fcalib[ic]->cd("SR2");
    gr[ic][0] = (TGraphErrors *)gDirectory->Get("resoRecoFit2eta21pu1");
    fcalib[ic]->cd("SR7");
    gr[ic][1] = (TGraphErrors *)gDirectory->Get("resoRecoFit7eta21pu1");


    TF1 *fit = gr[ic][0]->GetFunction("reso");
    TF1 *fit7 = gr[ic][1]->GetFunction("reso");
    mycReso->cd(ic+1);
    gr[ic][0]->Draw("APE");
    fit->SetLineColor(6);
    fit->Draw("same");
    lat.SetTextSize(0.1);
    sprintf(buf,"Single #gamma, #eta=2.1, 3#times3 cm^{2}");
    lat.DrawLatexNDC(0.2,0.8,buf);
    sprintf(buf,"ICsmear = %d %%",ICval[ic]);
    lat.DrawLatexNDC(0.2,0.7,buf);

    double cval = sqrt(pow(fit->GetParameter(1),2)-pow(y0,2));
    constant->SetPoint(ic,ICval[ic]/100.,cval);
    constant->SetPointError(ic,0,fit->GetParameter(1)*fit->GetParError(1)/cval);
    noise->SetPoint(ic,ICval[ic]/100.,fit->GetParameter(2));
    noise->SetPointError(ic,0,fit->GetParError(2));
    sampling->SetPoint(ic,ICval[ic]/100.,fit->GetParameter(0));
    sampling->SetPointError(ic,0,fit->GetParError(0));
    cval = sqrt(pow(fit7->GetParameter(1),2)-pow(y0_7,2));
    constantSR7->SetPoint(ic,ICval[ic]/100.,cval);
    constantSR7->SetPointError(ic,0,fit7->GetParameter(1)*fit7->GetParError(1)/cval);    
    //constantSR7->SetPoint(ic,ICval[ic]/100.,fit7->GetParameter(1));
    //constantSR7->SetPointError(ic,0,fit7->GetParError(1));
    samplingSR7->SetPoint(ic,ICval[ic]/100.,fit7->GetParameter(0));
    samplingSR7->SetPointError(ic,0,fit7->GetParError(0));

    if (ic==0) {
      constant->GetPoint(0,x0,y0);
      constantSR7->GetPoint(0,x0_7,y0_7);
      cval = sqrt(pow(fit->GetParameter(1),2)-pow(y0,2));
      constant->SetPoint(ic,ICval[ic]/100.,cval);
      constant->SetPointError(ic,0,fit->GetParameter(1)*fit->GetParError(1)/cval);
      cval = sqrt(pow(fit7->GetParameter(1),2)-pow(y0_7,2));
      constantSR7->SetPoint(ic,ICval[ic]/100.,cval);
      constantSR7->SetPointError(ic,0,fit7->GetParameter(1)*fit7->GetParError(1)/cval);
    }

  }

  mycReso->Update();
  mycReso->Print("PLOTS/ResolutionFitvsIC.pdf");
  
  TLegend *leg = new TLegend(0.6,0.6,0.8,0.8);
  leg->SetFillColor(10);
  leg->AddEntry(sampling,"3#times3 cm^{2}","P");
  leg->AddEntry(samplingSR7,"All detector","P");
  mycR->cd();
  gPad->SetGridy(1);
  sampling->GetYaxis()->SetTitle("Sampling term (GeV^{1/2})");
  sampling->SetMinimum(0.2);
  sampling->SetMaximum(0.3);
  sampling->Draw("APE");
  samplingSR7->Draw("PEsame");
  lat.SetTextSize(0.04);
  sprintf(buf,"Single #gamma, #eta=2.1");
  lat.DrawLatexNDC(0.2,0.87,buf);
  lat.DrawLatexNDC(0.01,0.01,"HGCAL G4 standalone");

  leg->Draw("same");
  mycR->Update();

  mycR->Print("PLOTS/SamplingvsIC.pdf");

  mycC->cd();
  gPad->SetLogx(1);
  gPad->SetGridy(1);
  gStyle->SetOptFit(0);
  //gStyle->SetStatH(0.1);
  //gStyle->SetStatW(0.2);

  constant->GetYaxis()->SetTitle("Constant from intercalib.");
  constant->SetMinimum(0);
  constant->SetMaximum(0.08);
  constant->Draw("APE");
  //constantSR7->Draw("PEsame");
  sprintf(buf,"Single #gamma, #eta=2.1");
  lat.DrawLatexNDC(0.2,0.87,buf);
  lat.DrawLatexNDC(0.01,0.01,"HGCAL G4 standalone");

  TF1 *BE = new TF1("BE","sqrt([0]*[0] + pow(x*1/sqrt([1]),2))",0,1);
  BE->SetParameters(0,30);
  //  BE->SetParLimits(0,1,1);
  BE->FixParameter(0,0);
  BE->SetLineColor(1);
  constant->Fit("BE","BI");

  lat.SetTextColor(1);
  //sprintf(buf,"c #propto c_{0} #oplus #frac{x}{#sqrt{n}}, n=%3.1f #pm %3.1f",BE->GetParameter(1),BE->GetParError(1));
  sprintf(buf,"c_{ic}=#frac{x}{#sqrt{n}}, n=%3.1f #pm %3.1f",BE->GetParameter(1),BE->GetParError(1));
  lat.DrawLatexNDC(0.2,0.77,"c=c_{0} #oplus c_{ic}");
  lat.DrawLatexNDC(0.2,0.67,buf);

  //BE->SetParameter(0,y0_7);
  //constantSR7->Fit("BE","BI","same");
  //BE->SetLineColor(2);
  //BE->Draw("same");
  //lat.SetTextColor(2);
  //sprintf(buf,"c #propto c_{0} #oplus #frac{x}{#sqrt{n}}, n=%3.1f #pm %3.1f",BE->GetParameter(1),BE->GetParError(1));
  //lat.DrawLatexNDC(0.2,0.6,buf);
  //lat.SetTextColor(1);

  //leg->Draw("same");
  mycC->Update();
  mycC->Print("PLOTS/ConstantvsIC.pdf");


  mycN->cd();
  noise->GetYaxis()->SetTitle("Noise term (GeV)");
  noise->Draw("APE");
  sprintf(buf,"Single #gamma, #eta=2.1, 3#times3 cm^{2}");
  lat.DrawLatexNDC(0.2,0.87,buf);
  lat.DrawLatexNDC(0.01,0.01,"HGCAL G4 standalone");
  mycN->Print("PLOTS/NoisevsIC.pdf");

  




  return 0;

}//main
コード例 #3
0
ファイル: Drawmethodcomp.C プロジェクト: XuQiao/HI
void Drawmethodcomp(){ 
 const int nDil = 8;
 const double centDil[nDil+1] = {1.0,0.7,0.6,0.5,0.4,0.3,0.2,0.1,0};
 double centDilbin[nDil];
for(int i=0;i<nDil;i++)
  centDilbin[i]=0.29+i+N-1-nDil;
 const double NpartDil[nDil] = {8.75,30.51,53.30,86.23,130.06,187.35,261.49,355.45};
 const double NpartDilerr[nDil] = {1.13,3.02,3.95,4.35,4.60,4.44,3.96,2.83};
 const double NcollDil[nDil] = {8.01,38.86,86.85,175.76,326.06,563.21,926.79,1484.49};
 const double NcollDilerr[nDil] = {1.41,6.41,12.48,21.13,34.27,52.66,81.37,120.0};
 TGraphErrors *graphNpartDil = new TGraphErrors(nDil,centDilbin,NpartDil,0,NpartDilerr);
 TGraphErrors *graphNcollDil = new TGraphErrors(nDil,centDilbin,NcollDil,0,NcollDilerr);
 TCanvas *c1 = new TCanvas("c1","c1",1,1,550,460);
 c1->SetLogy();
  c1->SetFillColor(10);
  c1->SetFrameFillColor(0);
  c1->SetFrameBorderSize(0);
  c1->SetFrameBorderMode(0);
  c1->SetLeftMargin(0.15);
  c1->SetBottomMargin(0.15);
  c1->SetTopMargin(0.02);
  c1->SetRightMargin(0.02);
  gStyle->SetOptStat(0);
  c1->SetTicks(-1);

	N=N-1;
 TString str="Ncoll";
 TH1D* hist = new TH1D("","",N,0,N);
 hist->GetXaxis()->SetNdivisions(502);
if(method==0)
 hist->SetXTitle("Centrality");
else
 hist->SetXTitle("HF #Sigma E_{T} |#eta|>3");
 hist->SetYTitle(Form("<%s> and systematic errors",str.Data()));
 hist->SetMinimum(1);
 hist->SetMaximum(3999.99);
 hist->GetXaxis()->CenterTitle(0);
 hist->GetYaxis()->CenterTitle(1);
 hist->GetYaxis()->SetTitleOffset(1.1);
 hist->GetXaxis()->SetTitleOffset(1.1);
 hist->GetXaxis()->SetTitleSize(0.056);
 hist->GetYaxis()->SetTitleSize(0.056);
 hist->GetXaxis()->SetLabelSize(0.05);
 hist->GetYaxis()->SetLabelSize(0.05);
hist->GetXaxis()->SetLabelOffset(99);
hist->Draw();
	
	TFile *f=TFile::Open(outG);
	TGraphErrors* graph = (TGraphErrors*)f->Get(Form("std/%s_graph",str.Data()));
//	TGraphErrors* Gri055_graph = (TGraphErrors*)f->Get(Form("Gri055/%s_graph",str.Data()));
//	TGraphErrors* Gri101_graph = (TGraphErrors*)f->Get(Form("Gri101/%s_graph",str.Data()));
        TVectorD *centbin = (TVectorD*)f->Get(Form("std/G0/centbin"));
        TVectorD *kpoint = (TVectorD*)f->Get(Form("std/G0/kpoint"));

	TFile *f1=TFile::Open(Form("../../OneComp/double_side/%s",outG.Data()));
	TGraphErrors* graph1 = (TGraphErrors*)f1->Get(Form("std/%s_graph",str.Data()));
//	TGraphErrors* Gri055_graph = (TGraphErrors*)f->Get(Form("Gri055/%s_graph",str.Data()));
//	TGraphErrors* Gri101_graph = (TGraphErrors*)f->Get(Form("Gri101/%s_graph",str.Data()));
        TVectorD *centbin1 = (TVectorD*)f1->Get(Form("std/G0/centbin"));
        TVectorD *kpoint1 = (TVectorD*)f1->Get(Form("std/G0/kpoint"));

graph->SetTitle("g1");
graph->SetMarkerStyle(20);
graph->SetMarkerColor(1);
graph->SetLineColor(1);
graph->SetLineWidth(2);
graph->SetMarkerSize(1.2);
graph->Draw("Psameez");

graph1->SetMarkerStyle(24);
graph1->SetMarkerColor(4);
graph1->SetLineColor(4);
graph1->SetLineWidth(2);
graph1->SetMarkerSize(1.2);
graph1->Draw("Psameez");
/*
Gri055_graph->SetTitle("g2");
Gri055_graph->SetMarkerStyle(33);
Gri055_graph->SetMarkerColor(2);
Gri055_graph->SetLineColor(2);
Gri055_graph->SetLineWidth(2);
Gri055_graph->SetMarkerSize(1.2);
Gri055_graph->Draw("Psameez");

Gri101_graph->SetTitle("g3");
Gri101_graph->SetMarkerStyle(34);
Gri101_graph->SetMarkerColor(4);
Gri101_graph->SetLineColor(4);
Gri101_graph->SetLineWidth(2);
Gri101_graph->SetMarkerSize(1.2);
Gri101_graph->Draw("Psameez");
*/
 graphNpartDil->SetMarkerSize(1.2);
 graphNpartDil->SetLineColor(2);
 graphNpartDil->SetLineWidth(2);
 graphNpartDil->SetMarkerStyle(33);
 graphNpartDil->SetMarkerColor(2);
 graphNcollDil->SetMarkerSize(1.2);
 graphNcollDil->SetLineColor(2);
 graphNcollDil->SetLineWidth(2);
 graphNcollDil->SetMarkerStyle(33);
 graphNcollDil->SetMarkerColor(2);
if(str=="Npart") graphNpartDil->Draw("Psame");
if(str=="Ncoll") graphNcollDil->Draw("Psame");
std::vector<TString> label(N);
for(int i=0;i<N;i++)
        if(method==0)label[i] = Form("%.2f-%.2f%%",(*centbin)[i]*100,(*centbin)[i+1]*100);
        else label[i] = Form("%.2f-%.2f",(*kpoint)[i],(*kpoint)[i+1]);

    TLatex *tex1= new TLatex(0.2,0.9,"CMS Preliminary PbPb #sqrt{s_{NN}} = 2.76 TeV");
    tex1->SetNDC();
    tex1->SetTextColor(1);
    tex1->SetTextFont(42);
    tex1->SetTextSize(0.05);
    tex1->Draw();

double y = gPad->GetUymin();
// - 0.2*h->GetYaxis()->GetBinWidth(1);
   TText t;
   t.SetTextAngle(45);
   t.SetTextSize(0.03);
   t.SetTextAlign(33);
   for (int i=0;i<N;i++) {
      double x = hist->GetXaxis()->GetBinCenter(i+1);
      t.DrawText(x,y,label[i]);
   }
TLegend *leg0 = new TLegend(0.18,0.70,0.50,0.85);
    leg0->SetFillColor(10);
    leg0->SetBorderSize(0);
    leg0->SetTextFont(42);
    leg0->SetTextSize(0.047);
    leg0->AddEntry(graph,"From Ancestor fitting","p");
    leg0->AddEntry(graph1,"From One Comp fitting","p");
//    leg0->AddEntry(Gri055_graph,"Gribov #Omega=0.55","p");
//    leg0->AddEntry(Gri101_graph,"Gribov #Omega=1.01","p");
 if(str=="Npart")   leg0->AddEntry(graphNpartDil,"Npart from run I","p");
 if(str=="Ncoll")   leg0->AddEntry(graphNcollDil,"Ncoll from run I","p");
	leg0->Draw();	
c1->SaveAs(Form("%sGri.png",str.Data()));
c1->SaveAs(Form("%sGri.pdf",str.Data()));


 TCanvas *c2 = new TCanvas("c2","c2",1,1,550,460);
  c2->SetFillColor(10);
  c2->SetFrameFillColor(0);
  c2->SetFrameBorderSize(0);
  c2->SetFrameBorderMode(0);
  c2->SetLeftMargin(0.15);
  c2->SetBottomMargin(0.15);
  c2->SetTopMargin(0.02);
  c2->SetRightMargin(0.02);
  c2->SetTicks(-1);
c2->cd();
TGraphErrors* fdvf1 = (TGraphErrors*)graph->Clone("fdvf1");
TGraphErrors* f1dvDil = (TGraphErrors*)graph->Clone("f1dvDil");
TGraphErrors* fdvDil = (TGraphErrors*)graph->Clone("fdvDil");
TGraphErrors* Dilsys = (TGraphErrors*)graph->Clone("Dilsys");
TGraphErrors* Dilsys2 = (TGraphErrors*)graph->Clone("Dilsys2");
for(int ip = 0;ip<fdvf1->GetN();ip++){
    double x = graph->GetX()[ip];
    double ey = graph->GetEY()[ip];
    double y = graph->GetY()[ip];
    double ey1 = graph1->GetEY()[ip];
    double y1 = graph1->GetY()[ip];
    double eyNcoll = graphNcollDil->GetEY()[ip];
    double yNcoll = graphNcollDil->GetY()[ip];
    double eyNpart = graphNpartDil->GetEY()[ip];
    double yNpart = graphNpartDil->GetY()[ip];
    if(y1!=0 && y!=0){
        fdvf1->SetPoint(ip,x,y/y1);
        fdvf1->SetPointError(ip,0,y/y1*sqrt((ey/y)**2+(ey1/y1)**2));
        if(str=="Ncoll"){
        fdvDil->SetPoint(ip,x,y/yNcoll);
        double yerr = y/yNcoll*sqrt((ey/y)**2+(eyNcoll/yNcoll)**2);
        fdvDil->SetPointError(ip,0,0);
        f1dvDil->SetPoint(ip,x,y1/yNcoll);
        double y1err = y1/yNcoll*sqrt((ey1/y1)**2+(eyNcoll/yNcoll)**2);
        f1dvDil->SetPointError(ip,0,0);
        Dilsys->SetPoint(ip,x,1.);
        Dilsys->SetPointError(ip,0,TMath::Max(fabs(y1/yNcoll-1),fabs(y/yNcoll-1)));
        Dilsys2->SetPoint(ip,x,1.);
        Dilsys2->SetPointError(ip,0,TMath::Max(yerr,y1err));
        }
        else if(str=="Npart"){
        fdvDil->SetPoint(ip,x,y/yNpart);
        double yerr = y/yNpart*sqrt((ey/y)**2+(eyNcoll/yNpart)**2);
        fdvDil->SetPointError(ip,0,0);
        f1dvDil->SetPoint(ip,x,y1/yNpart);
        double y1err = y1/yNpart*sqrt((ey1/y1)**2+(eyNcoll/yNcoll)**2);
        f1dvDil->SetPointError(ip,0,0);
        Dilsys->SetPoint(ip,x,1.);
        Dilsys->SetPointError(ip,0,TMath::Max(fabs(y1/yNpart-1),fabs(y/yNpart-1)));
        Dilsys2->SetPoint(ip,x,1.);
        Dilsys2->SetPointError(ip,0,TMath::Max(yerr,y1err));
        }
}
}
hist->SetMinimum(0.5);
hist->SetMaximum(1.5);
hist->SetYTitle(Form("<%s> ratio",str.Data()));
hist->Draw();
fdvf1->SetMarkerStyle(20);
fdvf1->SetMarkerColor(1);
fdvf1->SetLineColor(1);
fdvf1->SetLineWidth(2);
fdvf1->SetMarkerSize(1.4);
//fdvf1->Draw("Psameez");
f1dvDil->SetMarkerStyle(24);
f1dvDil->SetMarkerColor(2);
f1dvDil->SetLineColor(2);
f1dvDil->SetLineWidth(2);
f1dvDil->SetMarkerSize(1.4);
fdvDil->SetMarkerStyle(20);
fdvDil->SetMarkerColor(4);
fdvDil->SetLineColor(4);
fdvDil->SetLineWidth(2);
fdvDil->SetMarkerSize(1.4);
Dilsys->SetFillColor(kYellow+2);
Dilsys2->SetFillColor(kYellow+1);
//Dilsys2->Draw("e3same");
Dilsys->Draw("e3same");
fdvDil->Draw("Psameez");
f1dvDil->Draw("Psameez");
tex1->Draw();
TLine *l = new TLine(0,1,N,1);
l->SetLineStyle(2);
l->SetLineWidth(3);
l->Draw("same");
TLegend *leg1 = new TLegend(0.38,0.72,0.75,0.86);
    leg1->SetFillColor(10);
    leg1->SetBorderSize(0);
    leg1->SetTextFont(42);
    leg1->SetTextSize(0.04);
    //leg1->AddEntry(fdvf1,"Ancestor fitting/One Comp fitting","p");
    leg1->AddEntry(f1dvDil,"One Component fitting/Run I fitting","p");
    leg1->AddEntry(fdvDil,"Two Component fitting/Run I fitting","p");
    leg1->AddEntry(Dilsys,"RunI fitting systematics","f");
  //  leg1->AddEntry(Dilsys2,"RunI fitting ratio systematics","f");
    double y = gPad->GetUymin()+0.5;
   for (int i=0;i<N;i++) {
      double x = hist->GetXaxis()->GetBinCenter(i+1);
      t.DrawText(x,y,label[i]);
   }
   leg1->Draw();
c2->SaveAs(Form("%sGriratio.png",str.Data()));
c2->SaveAs(Form("%sGriratio.pdf",str.Data()));
}
コード例 #4
0
ファイル: apt_all.C プロジェクト: CmsHI/CVS_ASYoon
void apt_all(){
//=========Macro generated from canvas: MyCanvas/My Canvas
//=========  (Thu Dec  3 18:47:52 2009) by ROOT version5.25/04
   
   gROOT->Reset();
   gROOT->ProcessLine(".x rootlogon.C");

   gStyle->SetTitleYOffset(1.5);
   TCanvas *MyCanvas = new TCanvas("MyCanvas", "My Canvas",0,0,550,600);

   MyCanvas->SetLogx();

   double msize = 2;

   TH1D *hDist = new TH1D("hDist","hDist",20,9,10000);
   hDist->GetXaxis()->SetRange(1,20);
   hDist->SetMinimum(0.3);
   //hDist->SetMaximum(0.7);
   hDist->SetMaximum(0.6);  
   hDist->SetLineStyle(0);
   hDist->GetXaxis()->SetTitle("#sqrt{s} [GeV]");
   hDist->GetYaxis()->SetTitle("#LTp_{T}#GT [GeV/c]");
   hDist->GetXaxis()->CenterTitle();
   hDist->GetYaxis()->CenterTitle();
   hDist->GetYaxis()->SetNdivisions(510);
   hDist->Draw("");
   
   // Fit function                                                                                                                                 
   //TF1 *func = new TF1("func","0.426-0.0198*log(x^2)+0.00156*log(x^2)^2",18,100000); 
   //TF1 *func = new TF1("func","0.430-0.0207*log(x^2)+0.00161*log(x^2)^2",18,100000); 
   TF1 *func = new TF1("func","0.425-0.0197*log(x^2)+0.00156*log(x^2)^2",18,100000);
   func->SetLineColor(1);
   func->SetLineWidth(2.0);
   func->Draw("same");


   // ============================= ISR
   // OK, from http://www.slac.stanford.edu/spires/find/hep/www?j=NUPHA,B84,269

   TGraphErrors *gre = new TGraphErrors(4);
   gre->SetName("Graph");
   gre->SetTitle("Graph");

   gre->SetMarkerStyle(28);
   gre->SetMarkerSize(msize);

   gre->SetPoint(0,23.32,0.362);// plab = 289
   gre->SetPointError(0,0,0.004);  // errors are not verified! 
   gre->SetPoint(1,30.59,0.364);// plab = 498
   gre->SetPointError(1,0,0.00497238);
   gre->SetPoint(2,44.61,0.366); // plab = 1060
   gre->SetPointError(2,0,0.00478821);
   gre->SetPoint(3,53.06,0.368); // plab = 1500
   gre->SetPointError(3,0,0.00497238);

   
   TH1F *Graph1 = new TH1F("Graph1","Graph",100,19.03788,56.0634);
   Graph1->SetMinimum(0.3551011);
   Graph1->SetMaximum(0.374549);

   gre->SetHistogram(Graph1);
   gre->Draw("pz");

   TGraph* gre01 = gre->Clone("gre01");
   gre01->SetMarkerStyle(0);
   //   gre01->Draw("pzsame");

   // ============================= UA1  
   // OK, from  http://dx.doi.org/10.1016/0550-3213(90)90493-W

   gre = new TGraphErrors(7);
   gre->SetName("Graph");
   gre->SetTitle("Graph");

   gre->SetMarkerStyle(3);
   gre->SetMarkerSize(msize);
   gre->SetPoint(0,200,0.392);
   gre->SetPointError(0,0,0.003);
   gre->SetPoint(1,260,0.404);
   gre->SetPointError(1,0,0.004);
   gre->SetPoint(2,380,0.408);
   gre->SetPointError(2,0,0.004);
   gre->SetPoint(3,500,0.419);
   gre->SetPointError(3,0,0.004);
   gre->SetPoint(4,620,0.426);
   gre->SetPointError(4,0,0.004);
   gre->SetPoint(5,790,0.435);
   gre->SetPointError(5,0,0.004);
   gre->SetPoint(6,900,0.447);
   gre->SetPointError(6,0,0.003);
   
   TH1F *Graph2 = new TH1F("Graph2","Graph",100,131.4964,972.7974);
   Graph2->SetMinimum(0.3826521);
   Graph2->SetMaximum(0.4560221);

   gre->SetHistogram(Graph2);
   gre->Draw("pz");
   
   TGraph* gre02 = gre->Clone("gre02");
   gre02->SetMarkerStyle(0);
   //   gre02->Draw("pzsame");

   // ============================= E735?
   // OK, from https://twiki.cern.ch/twiki/pub/CMS/DNdEtaBib/e735numbers.pdf
   gre = new TGraphErrors(4);
   gre->SetName("Graph");
   gre->SetTitle("Graph");

   gre->SetMarkerStyle(22);
   gre->SetMarkerSize(msize);
   gre->SetPoint(0,300,0.393);
   gre->SetPointError(0,0,0.01);
   gre->SetPoint(1,540,0.430);
   gre->SetPointError(1,0,0.01);
   gre->SetPoint(2,900,0.448);
   gre->SetPointError(2,0,0.01);
   gre->SetPoint(3,1800,0.468);
   gre->SetPointError(3,0,0.01);

   TH1F *Graph3 = new TH1F("Graph3","Graph",100,148.0787,1967.778);
   Graph3->SetMinimum(0.3734073);
   Graph3->SetMaximum(0.4869985);

   gre->SetHistogram(Graph3);
   gre->Draw("pz");

   TGraph* gre03 = gre->Clone("gre03");
   gre03->SetMarkerStyle(0);
   gre03->Draw("pzsame");
   
   // ============================= CDF
   // OK, from http://www.slac.stanford.edu/spires/find/hep/www?j=PRLTA,61,1819

   gre = new TGraphErrors(2);
   gre->SetName("Graph");
   gre->SetTitle("Graph");

   gre->SetMarkerStyle(21);
   gre->SetMarkerSize(msize);

   gre->SetPoint(0,630,0.432);
   gre->SetPointError(0,0,0.004);
   gre->SetPoint(1,1800,0.495);
   gre->SetPointError(1,0,0.014);
   
   TH1F *Graph4 = new TH1F("Graph4","Graph",100,518.0436,1936.249);
   Graph4->SetMinimum(0.4196686);
   Graph4->SetMaximum(0.5173485);
   gre->SetHistogram(Graph4);
   
   gre->Draw("pz");
   
   TGraph* gre04 = gre->Clone("gre04");
   gre04->SetMarkerStyle(0);
   gre04->Draw("pzsame");

   // ============================= CMS?
   gre = new TGraphErrors(1);
   gre->SetName("Graph");
   gre->SetTitle("Graph");

   gre->SetMarkerStyle(20);
   gre->SetMarkerSize(msize);
   gre->SetMarkerColor(kRed+2);
   gre->SetLineColor(kRed+2);

   /*
   gre->SetPoint(0,900,0.44);
   gre->SetPointError(0,0,0.018);
   */
   
   //Now real measurement
   Float_t cmsSysError = 0.028;
   gre->SetPoint(0,900,0.46);
   //gre->SetPointError(0,0,0.46*cmsSysError);
   // updated to sqrt (0.01*0.01+0.46*0.46*0.028*0.028) , where 0.01 is stat err. 
   gre->SetPointError(0,0,0.0163); 
   gre->SetPoint(1,2360,0.50);
   //gre->SetPointError(1,0,0.50*cmsSysError);
   gre->SetPointError(1,0,0.0172);

   TGraph* greOnT = gre->Clone("greOnT");
   greOnT->SetMarkerStyle(0);
   greOnT->SetLineWidth(2);
   greOnT->Draw("PZsame");

   TGraph* greOnT2 = gre->Clone("cmsnsd05");
   gStyle->SetEndErrorSize(3);
   greOnT2->SetMarkerStyle(0);
   greOnT2->Draw("||");

   
   TH1F *Graph5 = new TH1F("Graph5","Graph",100,899.9,901.1);
   Graph5->SetMinimum(0.4184);
   Graph5->SetMaximum(0.4616);
   gre->SetHistogram(Graph5);
   gre->SetMarkerSize(msize*1.2);
   gre->Draw("pz");
   
   TGraph* gre05 = gre->Clone("gre05");
   gre05->SetMarkerStyle(0);
   //   gre05->Draw("pzsame");
   
   /*
   // Fit function
   //TF1 *func = new TF1("func","0.426-0.0198*log(x^2)+0.00156*log(x^2)^2",18,100000);
   //TF1 *func = new TF1("func","0.430-0.0207*log(x^2)+0.00161*log(x^2)^2",18,100000);  
   TF1 *func = new TF1("func","0.425-0.0197*log(x^2)+0.00156*log(x^2)^2",18,100000);  
   func->SetLineColor(1);
   func->SetLineWidth(1.5);
   func->Draw("same");
   */

   TLegend *leg = new TLegend(0.25,0.90-0.045*5,0.5,0.90,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextFont(62);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(0);
   leg->SetTextSize(0.03);

   TLegendEntry *entry=leg->AddEntry("Graph1","ISR inel.","P");
   entry->SetMarkerStyle(28);
   entry->SetMarkerSize(msize);
   entry=leg->AddEntry("Graph2","UA1 NSD","P");
   entry->SetMarkerStyle(3);   
   entry->SetMarkerSize(msize);   

   entry=leg->AddEntry("Graph3","E735 NSD","P");
   entry->SetMarkerStyle(22);   
   entry->SetMarkerSize(msize); 

   entry=leg->AddEntry("Graph4","CDF NSD","P");
   entry->SetMarkerStyle(21);    
   entry->SetMarkerSize(msize);    

   entry=leg->AddEntry("Graph5","CMS NSD (|#eta|<2.4)","P");
   entry->SetMarkerStyle(20);  
   entry->SetMarkerColor(kRed+2);
   entry->SetMarkerSize(msize*1.0);  
   leg->Draw();  

   TLegend *leg2 = new TLegend(0.35,0.20,0.91,0.26,NULL,"brNDC");
   //TLegend *leg2 = new TLegend(0.411,0.18,0.91,0.33,NULL,"brNDC");     
   leg2->SetBorderSize(0);
   leg2->SetTextFont(62);
   leg2->SetTextSize(0.035);
   leg2->SetLineColor(1);
   leg2->SetLineStyle(1);
   leg2->SetLineWidth(1);
   leg2->SetFillColor(0);
   leg2->SetFillStyle(0);
   leg2->SetMargin(0.15);
   leg2->SetTextSize(0.03);

   //   TLegendEntry *entry=leg2->AddEntry("func","0.40 - 0.015 #times ln(s) + 0.001325 #times ln^{2}(s)","l");
   //TLegendEntry *entry=leg2->AddEntry("func","0.40 - 0.015 ln(s) + 0.001325 ln^{2}(s)","l");
   TLegendEntry *entry=leg2->AddEntry("func","0.425 - 0.0197 ln(s) + 0.00156 ln^{2}(s)","l");
   //TLegendEntry *entry=leg2->AddEntry("func","0.430 - 0.0207 ln(s) + 0.00161 ln^{2}(s)","l");


   entry->SetTextSize(0.03);
   entry->SetMarkerSize(0);
   leg2->Draw();

   printFinalCanvases(MyCanvas,"apt_all");

}
コード例 #5
0
ファイル: fsr.C プロジェクト: errai-/jetscripts
void fsr(int ins = -1, double pt = 200., std::string sample = "dijet") {

  setTDRStyle();

  TDirectory *curdir = gDirectory;

  const char *cs = sample.c_str();
  map<string, const char *> title;
  title["dijet"] = "Dijet";
  title["gamjet"] = "#gamma+jet";

  TFile *fp8 = new TFile("alphafracs_p8.root","READ");
  assert(fp8 && !fp8->IsZombie());

  TFile *fp6 = new TFile("alphafracs_p6.root","READ");
  assert(fp6 && !fp6->IsZombie());

  TFile *fhw = new TFile("alphafracs_hwpp.root","READ");
  assert(fhw && !fhw->IsZombie());

  curdir->cd();

  TProfile *p8_10 = (TProfile*)fp8->Get("prof10"); assert(p8_10);
  TProfile *p8_15 = (TProfile*)fp8->Get("prof15"); assert(p8_15);
  TProfile *p8_20 = (TProfile*)fp8->Get("prof20"); assert(p8_20);
  TProfile *p8_30 = (TProfile*)fp8->Get("prof30"); assert(p8_30);
  TH1D *h8_0 = p8_10->ProjectionX("h8_10");

  TProfile *p6_10 = (TProfile*)fp6->Get("prof10"); assert(p6_10);
  TProfile *p6_15 = (TProfile*)fp6->Get("prof15"); assert(p6_15);
  TProfile *p6_20 = (TProfile*)fp6->Get("prof20"); assert(p6_20);
  TProfile *p6_30 = (TProfile*)fp6->Get("prof30"); assert(p6_30);
  TH1D *h6_0 = p6_10->ProjectionX("h6_10");

  TProfile *hw_10 = (TProfile*)fhw->Get("prof10"); assert(hw_10);
  TProfile *hw_15 = (TProfile*)fhw->Get("prof15"); assert(hw_15);
  TProfile *hw_20 = (TProfile*)fhw->Get("prof20"); assert(hw_20);
  TProfile *hw_30 = (TProfile*)fhw->Get("prof30"); assert(hw_30);
  TH1D *hw_0 = hw_10->ProjectionX("hw_10");

  TH1D *dt_0 = (TH1D*)hw_0->Clone("dt_0");
  TH1D *dt_10 = hw_10->ProjectionX("dt_10");
  TH1D *dt_15 = hw_15->ProjectionX("dt_15");
  TH1D *dt_20 = hw_20->ProjectionX("dt_20");
  TH1D *dt_30 = hw_30->ProjectionX("dt_30");

  const int ns = 3;//4;
  const int np = 5;
  TH1D* ps[ns][np] = {{h8_0, p8_10, p8_15, p8_20, p8_30},
		      {h6_0, p6_10, p6_15, p6_20, p6_30},
		      {hw_0, hw_10, hw_15, hw_20, hw_30}};//,
  //{dt_0, dt_10, dt_15, dt_20, dt_30}};
  double alpha[np] = {0, 0.10, 0.15, 0.20, 0.30};
  int markers[ns][2] = {{kFullSquare, kFullCircle},
			{kOpenSquare, kOpenCircle},
			{kOpenDiamond, kOpenStar}};//,
  //{kDot, kDot}};
  int colors[np] = {kBlack, kRed, kOrange+2, kGreen+2, kBlue};

  assert(ins>=-1 && ins<ns);

  // Approximate data as 1:1 mixture of P6 and Herwig++
  /*
  double whw = 0.5;
  for (int j = 0; j != np; ++j) {
    for (int k = 1; k != hw_0->GetNbinsX()+1; ++k) {
      ps[ns-1][j]->SetBinContent(k, (1-whw)*ps[1][j]->GetBinContent(k) +
				 whw*ps[2][j]->GetBinContent(k));
      ps[ns-1][j]->SetBinError(k, (1-whw)*ps[1][j]->GetBinError(k) +
			       whw*ps[2][j]->GetBinError(k));
    }
  }
  */

  TGraphErrors *gas[ns];
  TGraphErrors *ga = new TGraphErrors(4);
  TF1 *f1 = new TF1("f1","[0]+[1]*x",0,0.35);
  
  for (int i = 0; i != ns; ++i) {
    for (int k = 1; k != p8_10->GetNbinsX()+1; ++k) {
      for (int j = 1; j != np; ++j) {
	ga->SetPoint(j, alpha[j], ps[i][j]->GetBinContent(k));
	ga->SetPointError(j, 0., ps[i][j]->GetBinError(k));
      }
      ga->Fit(f1, "QRN");
      ps[i][0]->SetBinContent(k, f1->GetParameter(0));
      ps[i][0]->SetBinError(k, f1->GetParError(0));

      if (p8_10->FindBin(pt)==k) {
	gas[i] = (TGraphErrors*)ga->Clone(Form("ga_%d",i));
      }
    }
  }

  TH1D *h = new TH1D("h",";p_{T,parton} (GeV);"
		     "#LTp_{T,gen} / p_{T,parton}#GT", 100, 0, 900);
  h->SetMaximum(1.06);//1.03);
  h->SetMinimum(0.91);//0.96);

  TLatex *tex = new TLatex();
  tex->SetNDC(); tex->SetTextSize(0.045);

  extraText = "Simulation";
  //extraText2 = "Preliminary";
  if (ins==0) lumi_13TeV = "Pythia8";
  if (ins==1) lumi_13TeV = "Pythia6";
  if (ins==2) lumi_13TeV = "Herwig++";
  if (ins==-1) lumi_13TeV = "Herwig++ / Pythia8 / Pythia6";

  TCanvas *c1 = tdrCanvas("c1",h,2,0,kSquare);
  tex->DrawLatex(0.18,0.87,title[cs]);
  tex->DrawLatex(0.18,0.80,"Anti-k_{T} R=0.5");
  tex->DrawLatex(0.18,0.75,"|#eta| < 1.3");
  tex->DrawLatex(0.0,0.01,"#copyright Hannu Siikonen");

  for (int i = 0; i != ns; ++i) {
    for (int j = 0; j != np; ++j) {
      if ((ins == -1 && (j==0 || j==np-1)) || i == ins)
	tdrDraw(ps[i][j], "P", markers[i][j==0 ? 0 : 1], colors[j]);
    }
  }
  //tdrDraw(h8_0,"P",kFullSquare,kBlack);
  //tdrDraw(p8_10,"P",kFullCircle,kRed);
  //tdrDraw(p8_15,"P",kFullCircle,kOrange+2);
  //tdrDraw(p8_20,"P",kFullCircle,kGreen+1);
  //tdrDraw(p8_30,"P",kFullCircle,kBlue);

  TF1 *f2 = new TF1("f2","[0] + [1]*pow(x,[2])",100,840);
  f2->SetParameters(1,-0.1,-0.5);
  for (int i = 0; i != ns; ++i) {
    for (int j = 0; j != np; ++j) {
      ps[i][j]->Fit(f2,"QRN");
      f2->SetLineColor(ps[i][j]->GetMarkerColor());
      if ((ins == -1 && (j==0 || j==np-1)) || i == ins)
	f2->DrawClone("SAME");
    }
  }

  if (ins!=-1) {
    TLegend *leg = tdrLeg(0.70,0.65,0.90,0.90);
    leg->AddEntry(ps[ins][0],"#alpha_{max}#rightarrow0","PL");
    leg->AddEntry(ps[ins][1],"#alpha<0.10","PL");
    leg->AddEntry(ps[ins][2],"#alpha<0.15","PL");
    leg->AddEntry(ps[ins][3],"#alpha<0.20","PL");
    leg->AddEntry(ps[ins][4],"#alpha<0.30","PL");
  }
  if (ins==-1) {
    TLegend *ll = tdrLeg(0.50,0.70,0.70,0.90);
    ll->SetHeader("#alpha#rightarrow0");
    ll->AddEntry(ps[0][0],"","PL");
    ll->AddEntry(ps[1][0],"","PL");
    ll->AddEntry(ps[2][0],"","PL");
    //ll->AddEntry(ps[3][0],"","PL");
    TLegend *lr = tdrLeg(0.60,0.70,0.80,0.90);
    lr->SetHeader("#alpha<0.30");
    lr->AddEntry(ps[0][np-1],"   Pythia 8","PL");
    lr->AddEntry(ps[1][np-1],"   Pythia 6","PL");
    lr->AddEntry(ps[2][np-1],"   Herwig++","PL");
    //lr->AddEntry(ps[3][np-1],"   \"DATA\"","PL");
  }

  c1->SaveAs(Form("pdf/fsr_ins%d_%s.pdf",ins,cs));


  TH1D *h2 = new TH1D("h2",";#alpha_{max};#LTp_{T,gen} / p_{T,parton}#GT",
		      10,0,0.4);
  h2->SetMinimum(0.91);
  h2->SetMaximum(1.05);

  lumi_13TeV = "Herwig++ / Pythia8 / Pythia6";  
  TCanvas *c2 = tdrCanvas("c2",h2,2,0,kSquare);
  tex->DrawLatex(0.18,0.87,title[cs]);
  tex->DrawLatex(0.18,0.80,"Anti-k_{T} R=0.5");
  tex->DrawLatex(0.18,0.75,"|#eta| < 1.3");
  tex->DrawLatex(0.0,0.01,"#copyright Hannu Siikonen");

  TF1 *f3 = new TF1("f3","[0]+[1]*x+[2]*x*x",0,0.35);
  f3->SetLineStyle(kDashed);

  for (int i = 0; i != ns; ++i) {
    
    tdrDraw(gas[i], "P", markers[i][1], colors[i]);

    gas[i]->Fit(f1,"QRN");
    f1->SetLineColor(gas[i]->GetLineColor());
    f1->DrawClone("SAME");

    gas[i]->Fit(f3,"QRN");
    f3->SetLineColor(gas[i]->GetLineColor());
    f3->DrawClone("SAME");
  }

  int ipt = dt_0->FindBin(pt);
  double ptmin = dt_0->GetBinLowEdge(ipt);
  double ptmax = dt_0->GetBinLowEdge(ipt+1);
  tex->DrawLatex(0.18, 0.18, Form("%1.0f<p_{T}<%1.0f GeV",
				  ptmin, ptmax));

  TLegend *leg = tdrLeg(0.70,0.70,0.90,0.90);
  leg->AddEntry(gas[0], "Pythia 8", "PL");
  leg->AddEntry(gas[1], "Pythia 6", "PL");
  leg->AddEntry(gas[2], "Herwig++", "PL");
  //leg->AddEntry(gas[3], "\"DATA\"", "PL");

  c2->SaveAs(Form("pdf/fsr_vsalpha_%s.pdf",cs));
}
コード例 #6
0
ファイル: drawAvsB.C プロジェクト: miquork/jecsys
// Determine sensitivity to tracker dynamic inefficiency
// by studying ratio of jet responses in Runs G and F (and BCD / F, E / F)
void drawAvsB() {

  setTDRStyle();

  string epocha = "BCD";//"BCD";//"H";//"F";//"BCD";//"F";//"E";//"BCD";//"F";
  string epochb = "GH";//"G";//"BCD";//"G";//"E";//"E";//"F";//"G";

  // Add the rest as well
  string epocha2 = "";//"EF";
  string epochb2 = "";//"G";

  string type = "data";

  vector<string> methods;
  methods.push_back("mpfchs1");
  methods.push_back("ptchs");
  bool nozjptb = false;
  bool nogjmpf = false;
  bool nogjptb = true;
  bool mjvsjes = false;
  
  vector<string> samples;
  samples.push_back("zeejet");
  samples.push_back("zmmjet");
  samples.push_back("gamjet");
  //samples.push_back("multijet");

  cout << "draw"<<epocha<<"vs"<<epochb<<endl;
  const char *ct = type.c_str();
  const char *pa = epocha.c_str();
  const char *pb = epochb.c_str();

  const char *pa2 = epocha2.c_str();
  const char *pb2 = epochb2.c_str();

  TFile *fg = new TFile(Form("rootfiles/jecdata%s.root",pb),"READ");
  assert(fg && !fg->IsZombie());

  TFile *ff = new TFile(Form("rootfiles/jecdata%s.root",pa),"READ");
  assert(ff && !ff->IsZombie());

  TFile *fg2(0), *ff2(0);
  if (epochb2!="") fg2 = new TFile(Form("rootfiles/jecdata%s.root",pb2),"READ");
  if (epocha2!="") ff2 = new TFile(Form("rootfiles/jecdata%s.root",pa2),"READ");

  TH1D *h = new TH1D("h",
		     Form(";p_{T,ref} (GeV);%s ratio (%s / %s)",
			  (type=="ratio" ? "Data/MC" :
			   type=="data" ? "Data/data" : "MC/MC"),
			  (epocha + (epocha2!="" ? "+"+epocha2 : "")).c_str(),
			  (epochb + (epochb2!="" ? "+"+epochb2 : "")).c_str()),
		     3470,30,3500);
  h->SetMinimum(0.90);
  h->SetMaximum(1.15);
  h->GetXaxis()->SetMoreLogLabels();
  h->GetXaxis()->SetNoExponent();

  if (epocha=="F" && epochb=="G")
    lumi_13TeV = "Run2016F+G, 3.1+7.1 fb^{-1}";
  if (epocha=="BCD" && epochb=="G")
    lumi_13TeV = "Run2016BCD+H, 12.9+8.8 fb^{-1}";
  if (epocha=="BCD" && epochb=="G")
    lumi_13TeV = "Run2016BCD+FearlyGH, 12.9+16.8 fb^{-1}";
  if (epocha=="BCD" && epochb=="F")
    lumi_13TeV = "Run2016BCD+F, 13+3.1 fb^{-1}";
  if (epocha=="BCD" && epochb=="E")
    lumi_13TeV = "Run2016BCD+E, 13+4.0 fb^{-1}";
  if (epocha=="E" && epochb=="F")
    lumi_13TeV = "Run2016E+F, 4.0+3.1 fb^{-1}";
  if (epocha=="F" && epochb=="E")
    lumi_13TeV = "Run2016E+F, 4.0+3.1 fb^{-1}";

  if ((epocha=="BCDEF" && epochb=="GH") ||
      (epocha=="BCD" && epocha2=="EF" && epochb=="H" && epochb2=="G")) 
    lumi_13TeV = "Run2016BCDEF+GH, 19.7+16.8 fb^{-1}";
  if (epocha=="EF" && epochb=="BCD")
    lumi_13TeV = "Run2016BCD+EF, 12.9+6.8 fb^{-1}";
  if (epocha=="H" && epochb=="G")
    lumi_13TeV = "Run2016G+H, 8.0+8.8 fb^{-1}";

  if ((epocha=="BCD" && epocha2=="EF" && epochb=="G" && epochb2=="H")) 
    lumi_13TeV = "Run2016BCDFearly+FlateGH, 19.7+16.8 fb^{-1}";

  if ((epocha=="BCD" && epocha2=="" && ((epochb=="GH" && epochb2=="") ||
					(epochb=="G" && epochb2=="H"))))
    lumi_13TeV = "Run2016BCD+FlateGH, 12.9+16.8 fb^{-1}";
  if ((epocha=="EF" && epocha2=="" && ((epochb=="GH" && epochb2=="") ||
				       (epochb=="G" && epochb2=="H"))))
    lumi_13TeV = "Run2016EF+FlateGH, 6.8+16.8 fb^{-1}";

  if ((epocha=="EF" && epocha2=="" && epochb=="G" && epochb2=="H")) 
    lumi_13TeV = "Run2016EFearly+FlateGH, 6.8+16.8 fb^{-1}";


  TCanvas *c1 = tdrCanvas("c1",h,4,11,true);
  c1->SetLogx();

  TLatex *tex = new TLatex();
  tex->SetNDC(); tex->SetTextSize(0.045);

  TMultiGraph *mg = new TMultiGraph();
  string s = "draw"+epocha+(epocha2!="" ? "p" + epocha2 : "")
    +"vs"+epochb+(epochb2!="" ? "p" + epochb2 : "");

  TGraphErrors *gmjb(0), *gmpf(0);

  for (unsigned int im = 0; im != methods.size(); ++im) {
    const char *cm = methods[im].c_str();

    tex->DrawLatex(0.20,0.75-0.06*im,cm);
    s += "_" + methods[im];

  for (unsigned int is = 0; is != samples.size(); ++is) {

    const char *cs = samples[is].c_str();
    TGraphErrors *gg = (TGraphErrors*)fg->Get(Form("%s/eta00-13/%s_%s_a30",ct,cm,cs));
    cout << cm << " " << cs << endl << flush;
    assert(gg);
    if (fg2) {
      TGraphErrors *gg2 = (TGraphErrors*)fg2->Get(Form("%s/eta00-13/%s_%s_a30",ct,cm,cs));
      assert(gg2);
      gg = addGraph(gg,gg2);
    }
    
    TGraphErrors *gf = (TGraphErrors*)ff->Get(Form("%s/eta00-13/%s_%s_a30",ct,cm,cs));
    assert(gf);
    if (ff2) {
      TGraphErrors *gf2 = (TGraphErrors*)ff2->Get(Form("%s/eta00-13/%s_%s_a30",ct,cm,cs));
      assert(gf2);
      gf = addGraph(gf,gf2);
    }
    
    if (!(gf->GetN()==gg->GetN())) {

      // Remove highest pT point is that is the offender (BCD vs GH)
      if (gg->GetN()>gf->GetN() &&
	  fabs(gg->GetX()[gg->GetN()-1]/gf->GetX()[gf->GetN()-1]-1)>0.1 &&
	  fabs(gg->GetX()[gg->GetN()-2]/gf->GetX()[gf->GetN()-1]-1)<0.1) {
	cout << "Remove point B(N-1)" << endl;
	gg->RemovePoint(gg->GetN()-1);
      }
      else {
	cout << "sample " << samples[is] << " method " << methods[im]
	     << " gf->N: " << gf->GetN() << " gg->N: " << gg->GetN() << endl;
	cout << " x_gf(N-1)=" << gf->GetX()[gf->GetN()-1]
	     << " x_gg(N-1)=" << gg->GetX()[gg->GetN()-1]
	     << " x_gg(N-2)=" << gg->GetX()[gg->GetN()-2] << endl;
      }

      assert(gf->GetN()==gg->GetN());
    }

    TGraphErrors *g = (TGraphErrors*)gg->Clone(Form("ge_%s_%s",cm,cs));
    for (int i = 0; i != g->GetN(); ++i) {
      double yg = gg->GetY()[i];
      double yf = gf->GetY()[i];
      g->SetPoint(i, gg->GetX()[i], yf / yg);
      double ex = gg->GetEX()[i];
      double eg = gg->GetEY()[i];
      double ef = gf->GetEY()[i];
      g->SetPointError(i, ex, yf/yg*sqrt(pow(eg/yg,2)+pow(ef/yf,2)));
    }
    //g->Draw(is==0 ? "AP" : "SAMEP");
    g->SetLineWidth(1+is);
    g->Draw("SAMEPZ");

    if (samples[is]=="gamjet" && methods[im]=="mpfchs1" && nogjmpf) {
      tex->SetTextColor(kBlue);
      tex->DrawLatex(0.20,0.63,"#gamma+jet MPF excl. from fit");
      tex->SetTextColor(kBlack);
    }
    else if (samples[is]=="gamjet" && methods[im]=="ptchs" && nogjptb) {
      tex->SetTextColor(kBlue);
      tex->DrawLatex(0.20,0.63,"#gamma+jet p_{T}^{bal} excl. from fit");
      tex->SetTextColor(kBlack);
    }
    else if ((samples[is]=="zmmjet" || samples[is]=="zeejet") &&
	     methods[im]=="ptchs" && nozjptb) {
      tex->SetTextColor(kRed);
      tex->DrawLatex(0.20,0.63,"Z+jet p_{T}^{bal} excl. from fit");
      tex->SetTextColor(kBlack);
    }
    else if (samples[is]=="multijet") {
      g->SetMarkerColor(kGray+1);
      g->SetLineColor(kGray+1);
      if (methods[im]=="ptchs") gmjb = g;
      if (methods[im]=="mpfchs1") gmpf = g;
    }
    else
      mg->Add(g);
  } // for is
  } // for im
  
  if (nogjmpf) s += "_nogjmpf";
  if (nogjptb) s += "_nogptb";
  if (nozjptb) s += "_nozptb";
  if (mjvsjes) {
    s += "_mjvsjes";
    tex->SetTextColor(kBlack);
    tex->DrawLatex(0.20,0.58,"Multijet vs JES fit");
  }

  TF1 *fjes = new TF1("fjes",jesFit,30,2200,2);
  fjes->SetParameters(0.99,0.05);
  mg->Fit(fjes,"RN");
  fjes->SetLineColor(kBlack);
  fjes->SetLineStyle(kDashed);
  fjes->SetLineWidth(2);
  fjes->SetRange(10.,3500.);
  fjes->Draw("SAME");
  
  //TF1 *ft = new TF1("ft","1-[0]-[1]*pow(x,[2]) + ([3]+[4]*log(x))/x",30,2200);
  //ft->SetParameters(0,0.05,-0.5,1,0.1);
  //ft->FixParameter(3,0);

  // Logarithmic sigmoid
  //TF1 *ft = new TF1("ft","[0]+(1-[0])/(1. + exp(-(log(x)-log(abs([1])))"
  //	       "/(log(abs([2])+abs([1]))-log(abs([1])))))", 30,2200);
  //ft->SetParameters(0.98, 150, 50);
  TF1 *ft = new TF1("ft","[0]+(1-[0])/(1. + exp(-(log(x)-[1])/[2]))",30,2200);
  //ft->SetParameters(0.98,log(145),log(190)-log(145));
  //ft->SetParameters(0.982,4.967,0.271);
  //ft->SetParameters(0.976,5.040,0.370); // ENDCAP
  //ft->SetParameters(0.985,5.0,0.3);
  ft->SetParameters(0.985,5.025,0.3);
  //ft->FixParameter(1,5.03); // semi-weighted average of BCD and EF
  //ft->FixParameter(2,0.395); // combined fit to BCD+EF / G+H 

  // ( 12.9*5.055+6.8*5.000)/(12.9+6.8)
  ft->FixParameter(1,5.036); // semi-weighted average of BCD/GH and EF/GH
  // ( 12.9*0.344 + 6.8*0.455)/(12.9+6.8)
  ft->FixParameter(2,0.391); // combined fit to BCD+EF / GH 

  // Log-sigmoid + powerlaw
  //TF1 *ft = new TF1("ft","[0]+(1-[0])/(1. + exp(-(log(x)-[1])/[2]))"
  //	       "*(1-[3]*pow(x,[4]))",30,2200);
  //ft->SetParameters(0.982,4.967,0.271,0.1,-0.2);
  // Double powerlaw
  //TF1 *ft = new TF1("ft","[4]-[0]*pow(x,[1])-[2]*pow(x,[3])",30,2200);
  //ft->SetParameters(0.05,-0.15,0.01,-0.3,1);
  

  mg->Fit(ft,"RN");
  ft->SetLineColor(kBlue);
  ft->SetLineWidth(2);
  ft->SetRange(10.,3500.);
  ft->Draw("SAME");

  // Map multijet with response ratio
  if (gmpf) { // we have multijet available
    TGraphErrors *gmpf2 = (TGraphErrors*)gmpf->Clone("gmpf2");
    gmpf2->SetMarkerColor(kBlack);//kGray+1);
    gmpf2->SetLineColor(kBlack);//kGray+1);
    for (int i = 0; i != gmpf->GetN(); ++i) {
      if (mjvsjes) {
	gmpf2->SetPoint(i, 0.4*gmpf->GetX()[i],
			fjes->Eval(gmpf->GetX()[i])/gmpf->GetY()[i]);
	gmpf2->SetPointError(i, 0.4*gmpf->GetEX()[i],
			     gmpf->GetEY()[i]);
      }
      else {
	gmpf2->SetPoint(i, 0.4*gmpf->GetX()[i],
			ft->Eval(gmpf->GetX()[i])/gmpf->GetY()[i]);
	gmpf2->SetPointError(i, 0.4*gmpf->GetEX()[i],
			     gmpf->GetEY()[i]);
      }
    }
    gmpf2->Draw("SAMEPz");
  } // multijet

  tex->SetTextColor(kBlue);
  tex->DrawLatex(0.50,0.85,Form("#chi^{2} / NDF = %1.1f / %d",
				ft->GetChisquare(),
				ft->GetNDF()));
  tex->SetTextColor(kBlack);
  tex->SetTextSize(0.040);
  tex->DrawLatex(0.50,0.80,Form("(#chi^{2} / NDF = %1.1f / %d)",
				fjes->GetChisquare(),
				fjes->GetNDF()));


  tex->SetTextColor(kBlue-9);
  tex->SetTextSize(0.030);
  tex->DrawLatex(0.20,0.25,ft->GetExpFormula());
  tex->DrawLatex(0.20,0.20,
		 Form("p_{0}=%1.3f#pm%1.3f"
		      ", p_{1}=%1.3f#pm%1.3f"
		      ", p_{2}=%1.3f#pm%1.3f",
		      ft->GetParameter(0),ft->GetParError(0),
		      ft->GetParameter(1),ft->GetParError(1),
		      ft->GetParameter(2),ft->GetParError(2)));
  if (ft->GetNpar()>3)
    tex->DrawLatex(0.20,0.17,
		   Form("p_{3}=%1.3f#pm%1.3f"
			", p_{4}=%1.3f#pm%1.3f",
			ft->GetParameter(3),ft->GetParError(3),
			ft->GetParameter(4),ft->GetParError(4)));

  c1->SaveAs(Form("pdf/%s.pdf",s.c_str()));

  for (int i = 0; i != ft->GetNpar(); ++i) {
    cout << Form("%s%1.4g",i==0 ? "{" : ", ",ft->GetParameter(i));
  }
  cout << "}" << endl;
    

}