当前位置: 首页>>代码示例>>C++>>正文


C++ TLegend::SetTextSizePixels方法代码示例

本文整理汇总了C++中TLegend::SetTextSizePixels方法的典型用法代码示例。如果您正苦于以下问题:C++ TLegend::SetTextSizePixels方法的具体用法?C++ TLegend::SetTextSizePixels怎么用?C++ TLegend::SetTextSizePixels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TLegend的用法示例。


在下文中一共展示了TLegend::SetTextSizePixels方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: makePrettyTurnOn

void makePrettyTurnOn()
{
  const char *type = "hydjet_276_jets_gen";
  TFile *inFile = TFile::Open(Form("hist_%s.root",type));

  const Int_t THRESHOLDS = 4;
  //const Double_t L1_THRESHOLD[THRESHOLDS] = {2, 5, 12, 20};
  const Double_t L1_THRESHOLD[THRESHOLDS] = {16, 36, 52, 80};
  const Int_t COLORS[THRESHOLDS] = {kBlack, kRed, kBlue, kGreen+3};//, kMagenta+3};
  //const char* LABELS[2] = {"central", "periph"};
  TGraphAsymmErrors *asymm[THRESHOLDS];//[2];

  for(int i = 0; i < THRESHOLDS; i++)
  {
    //for(int j = 0; j < 2; j++)
    {
      asymm[i] = (TGraphAsymmErrors*)inFile->Get(Form("asymm_pt_%d_0",(int)L1_THRESHOLD[i]));
      asymm[i]->SetMarkerColor(COLORS[i]);
      asymm[i]->SetLineColor(COLORS[i]);
    }
    //asymm[i][1]->SetMarkerStyle(25);
  }

  const int nBins = 75;
  const double maxPt = 300;

  TH1D *hEmpty = new TH1D("hEmpty",Form(";Gen Jet p_{T} (GeV);Efficiency"),nBins,0,maxPt);

  TCanvas *c1 = new TCanvas();
  hEmpty->SetMinimum(0);
  hEmpty->SetMaximum(1.2);
  hEmpty->Draw();
  //c1->SetLogy();

  TLine *line = new TLine(0,1,maxPt,1);
  line->Draw();

  for(int i = 0; i < THRESHOLDS; i++)
  {
    //for(int j = 0; j < 2; j++)
    {
      asymm[i]->Draw("p");
    }
  }

  TLegend *leg = new TLegend(0.55,0.2,0.9,0.5);
  leg->SetFillColor(0);
  leg->SetTextFont(42);
  leg->SetTextSizePixels(18);

  for(int i = 0; i < THRESHOLDS; i++)
  {
    //for(int j = 0; j < 2; j++)
    {
      leg->AddEntry(asymm[i], Form("L1_SingleJet%d", (int)L1_THRESHOLD[i]), "lp");
    }
  }

  leg->Draw();

  c1->SaveAs(Form("%s_turnon.pdf",type));

}
开发者ID:richard-cms,项目名称:L1macros,代码行数:63,代码来源:makePrettyTurnOn.C

示例2: ptPlots


//.........这里部分代码省略.........

    single1->SetStats(kFALSE);
    single1->SetTitle("");
    single1->GetYaxis()->SetTitleOffset(1.50);
    single1->GetYaxis()->SetLabelSize(0.05);
    single1->GetYaxis()->SetTitleSize(0.06);
    single1->GetYaxis()->SetTitleFont(42);
    single1->GetYaxis()->SetLabelFont(42);
    single1->GetYaxis()->SetTitle("Counts / 8 MeV/c^{2}");
    single1->GetXaxis()->SetRangeUser(0.61, 1.09);
    single1->GetXaxis()->SetLabelSize(0.05);
    single1->GetXaxis()->SetTitleSize(0.06);
    single1->GetXaxis()->SetLabelFont(42);
    single1->GetXaxis()->SetTitleFont(42);
    single1->GetXaxis()->SetTitle("K^{-}#pi^{+} invariant mass (GeV/c^{2})");
    single1->Draw("E Y+");
    single2->SetStats(kFALSE);
    single2->GetXaxis()->SetRangeUser(0.61, 1.09);
    single2->Draw("SAME E2");
    fit1->Draw("SAME");
    fit2->Draw("SAME");
    fit3->Draw("SAME");
    fit5->Draw("SAME");
    exec1->Draw();
    single1->Draw("E SAME");
    exec2->Draw();
    //fit7->Draw("SAME");

    TPaveText *text = new TPaveText(0.3715, 0.7592, 0.6586, 0.8901, "NDC");
    text->AddText("Reconstructed #bar{K}*^{0}");
    text->AddText("2.0 < p_{T} < 2.2 GeV/c");
    text->SetBorderSize(0);
    text->SetFillStyle(0);
    text->GetLine(1)->SetTextSizePixels(28);
    text->GetLine(0)->SetTextSizePixels(32);
  
    text->Draw();

    //Do DECAY part
    cSingle->cd(1)->SetMargin(0.1727, 0.0, 0.1326, 0.0977);
    cSingle->cd(1)->SetTicks(0,1);
    TLegend *singleLegend = new TLegend(0.2048, 0.4223, 0.5884, 0.7400);
    singleLegend->AddEntry(fit1, "Mass Dep. Width", "l");
    singleLegend->AddEntry(fit2, "#splitline{Mass Dep. Width}{+5% Error}", "l");
    singleLegend->AddEntry(fit3, "#splitline{Simple Width}{+5% Error}", "l");
    singleLegend->AddEntry(fit5, "#splitline{Fixed #Gamma = 50 MeV/c^{2}}{+5% Error}", "l");
    singleLegend->SetTextSizePixels(20);

    TLegend *singleLegend2 = new TLegend(0.2430, 0.3351, 0.4940, 0.3892);
    singleLegend2->AddEntry(single2, "#splitline{Added Error}{(5% of peak bin)}", "f");
    singleLegend2->SetFillStyle(0);
    singleLegend2->SetBorderSize(0);
    singleLegend2->SetTextSizePixels(20); 

    decaysingle1->SetStats(kFALSE);
    decaysingle1->SetTitle("");
    decaysingle1->GetYaxis()->SetTitleOffset(1.50);
    decaysingle1->GetYaxis()->SetLabelSize(0.05);
    decaysingle1->GetYaxis()->SetTitleSize(0.06);
    decaysingle1->GetYaxis()->SetTitleFont(42);
    decaysingle1->GetYaxis()->SetLabelFont(42);
    decaysingle1->GetYaxis()->SetTitle("Counts / 8 MeV/c^{2}");
    decaysingle1->GetXaxis()->SetRangeUser(0.61, 1.09);
    decaysingle1->GetXaxis()->SetLabelSize(0.05);
    decaysingle1->GetXaxis()->SetTitleSize(0.06);
    decaysingle1->GetXaxis()->SetTitleFont(42);
开发者ID:gyronaut,项目名称:utaustin,代码行数:67,代码来源:ptPlots.C

示例3: alicePlots

void alicePlots(){
    
    TFile* alice = new TFile("~/Downloads/HEPData-ins1288320-v1-root.root");
    alice->cd("Table 16");
    TGraph* aliceData = Graph1D_y1;
    TH1F* hist = Hist1D_y1;
    TH1F* stat = Hist1D_y1_e1;
    TH1F* syst = Hist1D_y1_e2;
    TGraphAsymmErrors* graph2 = (TGraphAsymmErrors*)aliceData->Clone("graph2");

    Int_t numPts = aliceData->GetN();
    Double_t x, y;
    for(int i = 0; i<numPts; i++){
        aliceData->GetPoint(i, x, y);
        aliceData->SetPoint(i, x, (y - 0.89581));
        graph2->SetPoint(i, x, (y- 0.89581));
        hist->SetBinContent(i+1, hist->GetBinContent(i+1) - 0.89581);
        hist->SetBinError(i+1, stat->GetBinContent(i+1));
        graph2->SetPointEXhigh(i, 0.1);
        graph2->SetPointEXlow(i, 0.1);
    }

    graph2->SetLineColor(kBlue-10);
    graph2->SetLineWidth(2);
    graph2->SetMarkerColor(kBlue-10);
    graph2->SetFillColor(kBlue-10);
    hist->SetLineColor(kBlue-2);
    hist->SetLineWidth(2);

    aliceData->SetTitle("");
    aliceData->GetYaxis()->SetTitle("Mass - Vacuum Mass (GeV/c^{2})");
    aliceData->GetYaxis()->SetTitleSize(0.06);
    aliceData->GetYaxis()->SetLabelSize(0.04);
    aliceData->GetYaxis()->SetTitleOffset(1.65);
    aliceData->GetYaxis()->SetTitleFont(42);
    aliceData->GetYaxis()->SetLabelFont(42);
    aliceData->GetXaxis()->SetTitle("p_{T} (GeV/c)");
    aliceData->GetXaxis()->SetTitleSize(0.06);
    aliceData->GetXaxis()->SetLabelSize(0.05);
    aliceData->GetXaxis()->SetTitleFont(42);
    aliceData->GetXaxis()->SetLabelFont(42);
    aliceData->SetMarkerStyle(29);
    aliceData->SetMarkerSize(2.5);
    aliceData->SetMarkerColor(kBlue-2);
    aliceData->SetLineColor(kBlue-2);

    aliceData->GetYaxis()->SetRangeUser(-0.02, 0.015);
    aliceData->GetXaxis()->SetRangeUser(0, 5);

    TFile* phsd = new TFile("~/utaustin/resonancefits/finalplotting/20170721_KKbarAdded2_fixedwidth42_recon_pf100_scaled_error05.root");
    TH1D* mass = phsd->Get("kstar0mass");
    mass->SetName("mass");
    mass->SetMarkerStyle(26);
    mass->SetMarkerSize(2.5);
    mass->SetMarkerColor(2);
    mass->SetLineColor(2);

    TF1* line = new TF1("line", "[0]", 0.0, 5.0);
    line->SetParameter(0, 0.0);
    line->SetLineColor(1);
    line->SetLineStyle(7);
    line->SetLineWidth(3);

    for(int j = 0; j<mass->GetNbinsX(); j++){
        mass->SetBinContent(j+1, (mass->GetBinContent(j+1) - 0.892));
    }


    TFile* phsd2 = new TFile("~/utaustin/resonancefits/finalplotting/20170616_KKbarAdded2_fixedwidth_recon_pf100_scaled_error05.root");
    TH1D* mass2 = phsd2->Get("kstar0mass");
    mass2->SetName("mass2");
    mass2->SetMarkerStyle(22);
    mass2->SetMarkerSize(2.5);
    mass2->SetMarkerColor(2);
    mass2->SetLineColor(2);
    for(int j = 0; j<mass2->GetNbinsX(); j++){
        mass2->SetBinContent(j+1, (mass2->GetBinContent(j+1) - 0.892));
    }



    TExec *exec1 = new TExec("exec1", "gStyle->SetErrorX(0.1)");
    TExec *exec2 = new TExec("exec2", "gStyle->SetErrorX(0.5)");
    
    TCanvas *c = new TCanvas ("c", "c", 50, 50, 650, 600);
    c->cd()->SetMargin(0.1997, 0.0369, 0.1396, 0.0681);
    aliceData->Draw("APX");
    //exec1->Draw();
    graph2->Draw("SAME P2");
    //exec2->Draw();
    hist->Draw("SAME E1");
    line->Draw("SAME");
    mass2->Draw("SAME P E1");
    mass->Draw("SAME P E1");
    aliceData->Draw("SAME PX");
    

    TLegend* legend = new TLegend(0.5836, 0.1815, 0.9489, 0.3438);
    legend->SetMargin(0.2);
    legend->SetTextSizePixels(20);
//.........这里部分代码省略.........
开发者ID:gyronaut,项目名称:utaustin,代码行数:101,代码来源:alicePlots.C

示例4: makePrettyTurnOn_tracks

void makePrettyTurnOn_tracks()
{
  TFile *inFile = TFile::Open("hist_out_tracks.root");
  TGraphAsymmErrors *asymm_pt_0_cen = (TGraphAsymmErrors*)inFile->Get("asymm_pt_0_cen");
  TGraphAsymmErrors *asymm_pt_15_cen = (TGraphAsymmErrors*)inFile->Get("asymm_pt_15_cen");
  TGraphAsymmErrors *asymm_pt_30_cen = (TGraphAsymmErrors*)inFile->Get("asymm_pt_30_cen");
  TGraphAsymmErrors *asymm_pt_60_cen = (TGraphAsymmErrors*)inFile->Get("asymm_pt_60_cen");
  TGraphAsymmErrors *asymm_pt_0_periph = (TGraphAsymmErrors*)inFile->Get("asymm_pt_0_periph");
  TGraphAsymmErrors *asymm_pt_15_periph = (TGraphAsymmErrors*)inFile->Get("asymm_pt_15_periph");
  TGraphAsymmErrors *asymm_pt_30_periph = (TGraphAsymmErrors*)inFile->Get("asymm_pt_30_periph");
  TGraphAsymmErrors *asymm_pt_60_periph = (TGraphAsymmErrors*)inFile->Get("asymm_pt_60_periph");


  asymm_pt_0_cen->SetMarkerColor(1);
  asymm_pt_0_cen->SetLineColor(1);
  asymm_pt_15_cen->SetMarkerColor(kBlue);
  asymm_pt_15_cen->SetLineColor(kBlue);
  asymm_pt_30_cen->SetMarkerColor(kRed);
  asymm_pt_30_cen->SetLineColor(kRed);
  asymm_pt_60_cen->SetMarkerColor(kOrange);
  asymm_pt_60_cen->SetLineColor(kOrange);

  asymm_pt_0_periph->SetMarkerColor(1);
  asymm_pt_0_periph->SetLineColor(1);
  asymm_pt_15_periph->SetMarkerColor(kBlue);
  asymm_pt_15_periph->SetLineColor(kBlue);
  asymm_pt_30_periph->SetMarkerColor(kRed);
  asymm_pt_30_periph->SetLineColor(kRed);
  asymm_pt_60_periph->SetMarkerColor(kOrange);
  asymm_pt_60_periph->SetLineColor(kOrange);

  asymm_pt_0_periph->SetMarkerStyle(24);
  asymm_pt_15_periph->SetMarkerStyle(24);
  asymm_pt_30_periph->SetMarkerStyle(24);
  asymm_pt_60_periph->SetMarkerStyle(24);


  const int nBins = 100;
  const double maxPt = 120;

  TH1D *hEmpty = new TH1D("hEmpty",";Offline max track p_{T} (GeV);Efficiency",nBins,10,maxPt);

  TCanvas *c1 = new TCanvas();
  hEmpty->SetMinimum(0);
  hEmpty->SetMaximum(1.2);
  hEmpty->Draw();
  //c1->SetLogy();

  asymm_pt_0_cen->Draw("p");
  asymm_pt_15_cen->Draw("p");
  asymm_pt_30_cen->Draw("p");
  asymm_pt_60_cen->Draw("p");
  asymm_pt_0_periph->Draw("p");
  asymm_pt_15_periph->Draw("p");
  asymm_pt_30_periph->Draw("p");
  asymm_pt_60_periph->Draw("p");

  TLegend *leg = new TLegend(0.6,0.2,0.9,0.5,"L1 Threshold (GeV)");
  leg->SetFillColor(0);
  leg->SetTextFont(42);
  leg->SetTextSizePixels(20);

  leg->AddEntry(asymm_pt_0_cen,"0 cen","lp");
  leg->AddEntry(asymm_pt_15_cen,"15 cen","lp");
  leg->AddEntry(asymm_pt_30_cen,"30 cen","lp");
  leg->AddEntry(asymm_pt_60_cen,"60 cen","lp");

  leg->AddEntry(asymm_pt_0_periph,"0 periph","lp");
  leg->AddEntry(asymm_pt_15_periph,"15 periph","lp");
  leg->AddEntry(asymm_pt_30_periph,"30 periph","lp");
  leg->AddEntry(asymm_pt_60_periph,"60 periph","lp");

  leg->Draw();

  c1->SaveAs("minbiasHI_trkturnon_hisub.pdf");

}
开发者ID:richard-cms,项目名称:L1macros,代码行数:77,代码来源:makePrettyTurnOn_tracks.C

示例5: plotCentrality


//.........这里部分代码省略.........
	profilel1CentralityVsofflineCentrality->GetYaxis()->SetTitle("L1 Centrality (bins of 0.5%)");
	profilel1CentralityVsofflineCentrality->SetMarkerStyle(21);
	profilel1CentralityVsofflineCentrality->SetMarkerSize(0.6);
	profilel1CentralityVsofflineCentrality->GetXaxis()->SetTitleOffset(1.2);
	profilel1CentralityVsofflineCentrality->GetYaxis()->SetTitleOffset(1.2);
	profilel1CentralityVsofflineCentrality->Draw();
	profilel1CentralityVsofflineCentrality->Fit("f3");

	const Int_t COLORS[NBINSCentrality] = {kViolet+1,kRed+1,kBlue+1,kGreen+1,1,30};

	TCanvas *canvasranges=new TCanvas("canvasranges","canvasranges",600,500);
	canvasranges->cd();

	hOffline[0]->SetMaximum(300);
	hOffline[0]->GetXaxis()->SetRangeUser(-10,210.);
	hOffline[0]->GetYaxis()->SetTitleOffset(1.5);

	for(int j=0;j<NBINSCentrality;j++){

		hOffline[j]->Sumw2();
		hOffline[j]->SetMarkerStyle(0);
		hOffline[j]->SetLineColor(COLORS[j]);
		hOffline[j]->SetFillStyle(3325);
		hOffline[j]->SetFillColor(COLORS[j]);
	}
	for(int j=0;j<NBINSCentrality;j++){
		hOffline[j]->Draw("same hist e");

	}

	TLegend *leg = new TLegend(0.340604,0.5940803,0.8741611,0.8816068,"L1 centrality threshold");
	leg->SetFillColor(0);
	leg->SetTextFont(42);
	leg->SetTextSizePixels(20);


	leg->AddEntry(hOffline[0],Form("0  < L1cen < %d",limit[0]),"lp");
	leg->AddEntry(hOffline[1],Form("%d < L1cen < %d",limit[0],limit[1]),"lp");
	leg->AddEntry(hOffline[2],Form("%d < L1cen < %d",limit[1],limit[2]),"lp");
	leg->AddEntry(hOffline[3],Form("%d < L1cen < %d",limit[2],limit[3]),"lp");
	leg->AddEntry(hOffline[4],Form("%d< L1cen < %d", limit[3],limit[4]),"lp");
	leg->AddEntry(hOffline[5],Form("%d< L1cen < 200",limit[4]),"lp");
	leg->Draw();  

	double Etsum[NBINSCentrality];

	for (int m=0;m<NBINSCentrality-1;m++){

		Etsum[m]=fprofileofflinel1EtsumVsCentrality_Calibration->Eval(limit[m]);
	}

	cout<<"***************************"<<endl;
	cout<<"LUT for centrality ranges"<<endl;
	cout<<"Centrality 0-5% = E_{T} sum > "<<Etsum[0]<<endl;
	cout<<"Centrality 5-10% ="<<Etsum[1]<<"<E_{T} sum <"<<Etsum[0]<<endl;
	cout<<"Centrality 10-30% ="<<Etsum[2]<<"<E_{T} sum <"<<Etsum[1]<<endl;
	cout<<"Centrality 30-50% ="<<Etsum[3]<<"<E_{T} sum <"<<Etsum[2]<<endl;
	cout<<"Centrality 50-90% ="<<Etsum[4]<<"<E_{T} sum <"<<Etsum[3]<<endl;
	cout<<"Centrality "<<(int)(limit[4]/2)<<"-100% =  E_{T} sum <"<<Etsum[4]<<endl;


	if(!isdata){

		TH1D *hNcoll[NBINSCentrality];

		for(int i = 0; i < NBINSCentrality; ++i){
开发者ID:ginnocen,项目名称:NewMacroCentrality,代码行数:67,代码来源:plotCentrality.C

示例6: plotTurnOn

void plotTurnOn(TString inFileName, TString outFileTag)
{
  TFile *inFile = TFile::Open(inFileName);

  const Int_t THRESHOLDS = 4;
  const Double_t L1_THRESHOLD[THRESHOLDS] = {4, 12, 20, 29};
  const Int_t COLORS[THRESHOLDS] = {kBlack, kRed, kBlue, kGreen+3};//, kMagenta+3};
  TGraphAsymmErrors *asymm[THRESHOLDS];//[2];

  for(int i = 0; i < THRESHOLDS; i++)
  {
    //for(int j = 0; j < 2; j++)
    {
      asymm[i] = (TGraphAsymmErrors*)inFile->Get(Form("asymm_pt_%d_0",(int)L1_THRESHOLD[i]));
      asymm[i]->SetMarkerColor(COLORS[i]);
      asymm[i]->SetLineColor(COLORS[i]);
    }
    //asymm[i][1]->SetMarkerStyle(25);
  }

  // these values MUST MATCH those used in makeTurnOn.C
  const int nBins = 200;
  const double maxPt = 200;

  TH1D *hEmpty = new TH1D("hEmpty",Form(";Photon p_{T} (GeV);Efficiency"),nBins,0,maxPt);

  TCanvas *c1 = new TCanvas();
  hEmpty->SetMinimum(0);
  hEmpty->SetMaximum(1.2);
  hEmpty->Draw();
  //c1->SetLogy();

  TLine *line = new TLine(0,1,maxPt,1);
  line->Draw();

  for(int i = 0; i < THRESHOLDS; i++)
  {
    //for(int j = 0; j < 2; j++)
    {
      asymm[i]->Draw("p");
    }
  }

  TLegend *leg = new TLegend(0.55,0.2,0.9,0.5,"|#eta| < 2");
  leg->SetFillColor(0);
  leg->SetTextFont(42);
  leg->SetTextSizePixels(18);

  for(int i = 0; i < THRESHOLDS; i++)
  {
    //for(int j = 0; j < 2; j++)
    {
      leg->AddEntry(asymm[i], Form("L1_BarrelRegion%d", (int)L1_THRESHOLD[i]), "lp");
    }
  }

  leg->Draw();

  c1->SaveAs(Form("%s_turnon.pdf",outFileTag.Data()));

}
开发者ID:ginnocen,项目名称:L1EmulatorMacros,代码行数:61,代码来源:plotTurnOn_photons.C

示例7: energyHistoCompare


//.........这里部分代码省略.........
        pass4[bcNum]->Draw("P SAME");
        legend->AddEntry(pass4[bcNum], "Current OADB Calibration", "p");
    }

    for(int nfile=0; nfile<6; nfile++){
        check[nfile][bcNum]->SetMarkerStyle(3);
        check[nfile][bcNum]->SetMarkerSize(0.6);
        int color = nfile+2;
        check[nfile][bcNum]->SetMarkerColorAlpha(color, 0.3);

        switch(nfile){
            case 0 : legend->AddEntry((TH1F*)check[nfile][bcNum], "1000MeV / 400MeV", "p");
                     break;
            case 1 : legend->AddEntry((TH1F*)check[nfile][bcNum], "1000MeV / 200MeV", "p");
                     break;
            case 2 : legend->AddEntry((TH1F*)check[nfile][bcNum], "800MeV / 400MeV", "p");
                     break;
            case 3 : legend->AddEntry((TH1F*)check[nfile][bcNum], "800MeV / 200MeV", "p");
                     break;
            case 4 : legend->AddEntry((TH1F*)check[nfile][bcNum], "400MeV / 400MeV", "p");
                     break;
            case 5 : legend->AddEntry((TH1F*)check[nfile][bcNum], "400MeV / 200MeV", "p");
                     break;
            default: break;
        }
        check[nfile][bcNum]->SetTitle(Form("Calibration for Different Cluster/Cell Energy Cuts for LHC%s BC%d", dataset.c_str(), bcNum));
        check[nfile][bcNum]->GetXaxis()->SetTitle("Cell AbsID");
        check[nfile][bcNum]->GetXaxis()->SetRangeUser(0,11650);
        check[nfile][bcNum]->GetYaxis()->SetTitle("Calibrated Offset (ns)");
        check[nfile][bcNum]->GetYaxis()->SetRangeUser(550,650);
        check[nfile][bcNum]->SetStats(kFALSE);
        check[nfile][bcNum]->Draw("P SAME");
    }
    legend->SetTextSizePixels(10);
    legend->Draw();

    //draw just OADB 1000/400 MeV cut on same plot

    TCanvas* c400 = new TCanvas("Calibration Offsets 1000MeV/400MeV BC0", "calibrationoffsets400bc0", 1000,600);
    c400->cd();

    TLegend *legend400 = new TLegend(0.1,0.7,0.3,0.9);
    legend400->SetHeader("Calibration for Cluster/Cell energy cuts");



    nfile=0;    
    int color = nfile+2;
    if(strcmp("13g", dataset.c_str())==0){
        pass1[bcNum]->SetTitle(Form("Time Calibration for LHC%s BC%d", dataset.c_str(), bcNum));
        pass1[bcNum]->Draw("P SAME");
        legend400->AddEntry((TH1F*)pass1[bcNum], "OADB Calibration", "p");
    }else{
        pass4[bcNum]->SetTitle(Form("Time Calibration for LHC%s BC%d", dataset.c_str(), bcNum));
        pass4[bcNum]->Draw("P SAME");
        legend400->AddEntry((TH1F*)pass4[bcNum], "OADB Calibration", "p");
    }

    legend400->AddEntry((TH1F*)check[nfile][bcNum], "1000MeV / 400MeV", "p");
    check[nfile][bcNum]->SetTitle(Form("Time Calibration for LHC%s BC%d", dataset.c_str(), bcNum));
    check[nfile][bcNum]->GetYaxis()->SetRangeUser(550,650);
    check[nfile][bcNum]->GetXaxis()->SetRangeUser(0,11650);
    check[nfile][bcNum]->Draw("P SAME");

    legend400->SetTextSizePixels(12);
    legend400->Draw();
开发者ID:gyronaut,项目名称:utaustin,代码行数:67,代码来源:energyHistoCompare.C

示例8: plotTurnOn


//.........这里部分代码省略.........
  // // 				      "2x2 jets, L1_48, 107Hz"};
  // // const Double_t L1_THRESHOLD[INPUTFILES] = {60, 28, 28, 48};
  // const TString labels[INPUTFILES] = {"zeroWalls, L1_40, 276Hz",
  // 				      "sigma subtracted, L1_24, 280Hz",
  // 				      "1x1 jets +ZW, L1_20, 270Hz",
  // 				      "2x2 jets +ZW, L1_32, 272Hz"};
  // const Double_t L1_THRESHOLD[INPUTFILES] = {40, 24, 20, 32};


  // TString outFileTag = "Hydjet502_200Hz";
  // TString inFileName[INPUTFILES] = {"hist_Hydjet502_zeroWalls.root",
  // 				    "hist_Hydjet502_sigmaSubtraction.root",
  // 				    "hist_Hydjet502_oneByOneAndzeroWalls.root",
  // 				    "hist_Hydjet502_twoByTwoANDzeroWalls.root"
  // };
  // // TString labels[INPUTFILES] = {"zeroWalls, L1_80, 150Hz",
  // // 				"sigma subtracted, L1_36, 163Hz",
  // // 				"1x1 jets, L1_36, 167Hz",
  // // 				"2x2 jets, L1_88, 155Hz"};
  // // const Double_t L1_THRESHOLD[INPUTFILES] = {80, 36, 36, 64};

  // TString outFileTag = "Photon502_60GeV";
  // TString inFileName[INPUTFILES] = {"hist_Photon502_isophoton_regions.root",
  // 				    "hist_Photon502_isophotons_eta1.44_2x2jets.root",
  // 				    "hist_Photon502_isophotons_eta1.44_3x3jets.root",
  // 				    "hist_Photon502_isophotons_noHoEorFG_emcands.root"};
  // TString labels[INPUTFILES] = {"Single Regions 50GeV, |#eta| < 1.74",
  // 				"2x2 Jets 48GeV, |#eta| < 1.74",
  // 				"3x3 Jets 48GeV, |#eta| < 1.74",
  // 				"EG cands 50GeV"};
  // const Double_t L1_THRESHOLD[INPUTFILES] = {50, 48, 48,50};

  TString outFileTag = "Photon502_40GeV";
  TString inFileName[INPUTFILES] = {"hist_Photon502_isophoton_regions.root",
  				    "hist_Photon502_isophotons_eta1.44_2x2jets.root",
  				    "hist_Photon502_isophotons_eta1.44_3x3jets.root",
				    "hist_Photon502_isophotons_noHoEorFG_emcands.root"};
  TString labels[INPUTFILES] = {"Single Regions 20GeV, |#eta| < 1.74",
  				"2x2 Jets 24GeV, |#eta| < 1.74",
  				"3x3 Jets 28GeV, |#eta| < 1.74",
  				"EG cands 32GeV"};
  const Double_t L1_THRESHOLD[INPUTFILES] = {20, 24, 28,32};

  TFile *inFile[INPUTFILES];
  const Int_t COLORS[INPUTFILES] = {kBlack, kRed, kBlue, kGreen+3};//, kMagenta+3};
  TGraphAsymmErrors *asymm[INPUTFILES];//[2];

  for(int i = 0; i < INPUTFILES; i++)
  {
    //for(int j = 0; j < 2; j++)
    {
      inFile[i] = TFile::Open(inFileName[i]);
      asymm[i] = (TGraphAsymmErrors*)inFile[i]->Get(Form("asymm_pt_%d_0",(int)L1_THRESHOLD[i]));
      asymm[i]->SetMarkerColor(COLORS[i]);
      asymm[i]->SetLineColor(COLORS[i]);
    }
    //asymm[i][1]->SetMarkerStyle(25);
  }

  // these values MUST MATCH those used in makeTurnOn.C
  const int nBins = 75;
  const double maxPt = 200;

  TH1D *hEmpty = new TH1D("hEmpty",Form(";Isolated Photon p_{T} (GeV);Efficiency"),nBins,0,maxPt);

  TCanvas *c1 = new TCanvas();
  hEmpty->SetMinimum(0);
  hEmpty->SetMaximum(1.2);
  hEmpty->Draw();
  //c1->SetLogy();

  TLine *line = new TLine(0,1,maxPt,1);
  line->Draw();

  for(int i = 0; i < INPUTFILES; i++)
  {
    //for(int j = 0; j < 2; j++)
    {
      asymm[i]->Draw("p");
    }
  }

  TLegend *leg = new TLegend(0.55,0.2,0.9,0.5,"|#eta| < 1.44");
  leg->SetFillColor(0);
  leg->SetTextFont(42);
  leg->SetTextSizePixels(18);

  for(int i = 0; i < INPUTFILES; i++)
  {
    //for(int j = 0; j < 2; j++)
    {
      leg->AddEntry(asymm[i], Form("%s", labels[i].Data()), "lp");
    }
  }

  leg->Draw();

  c1->SaveAs(Form("%s_turnon.pdf",outFileTag.Data()));

}
开发者ID:ginnocen,项目名称:L1EmulatorMacros,代码行数:101,代码来源:plotTurnOn_multiMethods.C

示例9: massPlotsbar


//.........这里部分代码省略.........
    mass6->SetMarkerColor(3);

    TFile *file7 = new TFile("20170522_Kstar0_reconfixedwidth70_pf160_scaled.root");
    TH1D* mass7 = file7->Get("kstar0mass");
    mass7->SetName("fw70Error05");
    mass7->SetMarkerStyle(22);
    mass7->SetMarkerSize(1.5);
    mass7->SetMarkerColor(kRed+3);
    TH1D* width7 = file7->Get("kstar0collWidth");
    width7->SetName("fw70Width05");
    width7->SetTitle("Fit Width for K*^{0}");
    width7->SetMarkerStyle(22);
    width7->SetMarkerSize(1.5);
    width7->SetMarkerColor(kRed+3);
    width7->SetLineColor(2);
    TF1* fit7 = file7->Get("fitPTbin2100particle5");
    fit7->SetLineColor(kRed+3);
    fit7->SetLineStyle(3);
    fit7->SetLineWidth(3);
*/
   


    TCanvas *cMass = new TCanvas("cMass", "cMass", 50, 50, 600, 600);

    TF1 *pdg = new TF1("pdg", "[0]", 0.0, 4.0);
    pdg->SetParameter(0, 0.892);
    pdg->SetLineStyle(7);
    pdg->SetLineColor(1);
    pdg->SetLineWidth(4);

    TPaveText *pdgtext = new TPaveText(0.5520, 0.5637, 0.8322, 0.6946, "NDC");
    pdgtext->AddText("PHSD vacuum mass");
    pdgtext->SetTextSizePixels(32);
    pdgtext->SetBorderSize(0);
    pdgtext->SetTextFont(42);
    pdgtext->SetFillStyle(0);

    cMass->cd();
    TLegend* legend = new TLegend(0.1611,0.6370,0.4832,0.8935);
    legend->AddEntry(mass1, "Mass Dep. Width", "lpe");
    legend->AddEntry(mass2, "Mass Dep. Width (+5% Error)", "lpe");
    legend->AddEntry(mass3, "Simple Width (+5% Error)", "lpe");
    legend->AddEntry(mass5, "Fixed Vacuum Width (+5% Error)", "lpe");
    legend->SetMargin(0.1);
    legend->SetTextSizePixels(28);
    //legend->AddEntry(mass7, "Fixed Width (70 MeV/c^{2}), 5% Error", "lpe");

    mass1->GetYaxis()->SetRangeUser(0.87, 0.91);
    mass1->GetYaxis()->SetLabelSize(0.06);
    mass1->GetYaxis()->SetTitleOffset(1.3);
    mass1->GetYaxis()->SetTitleSize(0.07);
    mass1->GetYaxis()->SetTitleFont(42);
    mass1->GetYaxis()->SetLabelFont(42);
    mass1->GetXaxis()->SetLabelSize(0.06);
    mass1->GetXaxis()->SetTitleSize(0.07);
    mass1->GetXaxis()->SetLabelFont(42);
    mass1->GetXaxis()->SetTitleFont(42);
    mass1->SetTitle("");
    mass1->Draw("P E1");
    mass3->Draw("SAME P E1");
    //mass4->Draw("SAME");
    mass5->Draw("SAME P E1");
    mass2->Draw("SAME P E1");
    pdg->Draw("SAME");
    pdgtext->Draw("SAME");
开发者ID:gyronaut,项目名称:utaustin,代码行数:67,代码来源:massPlotsbar.C

示例10: generatePlots

void generatePlots(Files *inputs, const string &path)
{
    Files::const_iterator first_source = inputs->begin();
    TDirectory *folder = dynamic_cast<TDirectory *>(first_source->second->Get(path.c_str()));
    if (!folder)
    {
        cerr << "Failed to extract folder: " << path << endl;

        return;
    }
    //
    //gain time, do not add the objects in the list in memory
    //
    Bool_t status = TH1::AddDirectoryStatus();
    TH1::AddDirectory(kFALSE);

    // loop over all keys in this directory
    TIter nextkey(folder->GetListOfKeys() );

    for(TKey *key, *oldkey=0; key = (TKey*) nextkey(); )
    {
        //keep only the highest cycle number for each key
        if (oldkey
            && !strcmp(oldkey->GetName(), key->GetName()))

            continue;

        // read object from first source file
        //
        TObject *obj = key->ReadObj();

        if ( obj->IsA()->InheritsFrom(TH1::Class()))
        {
            cout << obj->GetName() << endl;

            TCanvas *canvas = new TCanvas();

            canvas->SetWindowSize(640, 480);

            THStack *stack = new THStack();
            TLegend  *legend = new TLegend(.6, .98, .98, .58);
            legend->SetBorderSize(1);
            legend->SetLineStyle(1);
            legend->SetTextFont(43);
            legend->SetTextSizePixels(12);
            legend->SetFillColor(0);

            TH1 *h1 = dynamic_cast<TH1*>(obj);
            legend->AddEntry(h1, style(h1, first_source->first).c_str(), "pl");
            h1->Scale(1.0 / h1->Integral());

            stack->Add(h1);

            // loop over all source files and add the content of the
            // correspondant histogram to the one pointed to by "h1"
            for(Files::const_iterator input = ++inputs->begin();
                    inputs->end() != input;
                    ++input)
            {
                TH1 *h2 = dynamic_cast<TH1*>(input->second->Get((path + "/" + obj->GetName()).c_str()));
                if (!h2)
                {
                    cerr << "Failed to extract plot from input: " << endl;

                    continue;
                }

                h2->Scale(1. / h2->Integral());
                legend->AddEntry(h2, style(h2, input->first).c_str(), "pl");
                stack->Add(h2);
            }

            stack->Draw("h nostack");
            legend->Draw();
            stack->GetXaxis()->SetTitle(h1->GetXaxis()->GetTitle());

            canvas->Update();
        } else {
            // object is of no type that we know or can handle
            //
            cout << "Unknown object type, name: "
                << obj->GetName() << " title: " << obj->GetTitle() << endl;
        }
    }

    // save modifications to target file
    TH1::AddDirectory(status);
}
开发者ID:skhal,项目名称:bsm_mc,代码行数:88,代码来源:plot.cpp


注:本文中的TLegend::SetTextSizePixels方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。