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


C++ TGraphErrors::Draw方法代码示例

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


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

示例1: draw

void draw() {

  gStyle->SetOptStat(0000);

  TGraphErrors* gr = new TGraphErrors("papel_um.txt", "%lg %lg %lg %lg");
  gr->Draw("A");

  gr->GetXaxis()->SetTitle("Diametro (mm)");
  gr->GetYaxis()->SetTitle("Massa (u.m.)");
  gr->SetTitle("Dimensao Fractal - Papel");
  gr->SetMarkerStyle(20);
  gr->SetMarkerSize(gr->GetMarkerSize()/2.);

  TCanvas* c1 = new TCanvas();
  gr->Draw("AP");
  c1->Print("gr1.png");


  TGraphErrors* grlog = new TGraphErrors();
  for (int i=0; i<gr->GetN(); i++) {
    grlog->SetPoint(i, TMath::Log(gr->GetX()[i]), TMath::Log(gr->GetY()[i]));
    grlog->SetPointError(i, gr->GetEX()[i]/gr->GetX()[i], 0.0);
  }
  grlog->Draw("A");
  grlog->GetXaxis()->SetTitle("Logaritmo do diametro (diametro em mm)");
  grlog->GetYaxis()->SetTitle("Logaritmo da massa (massa em unidade arbitraria)");
  grlog->SetTitle("Dimensao Fractal - Papel");
  grlog->SetMarkerStyle(20);
  //  grlog->SetMarkerSize(gr->GetMarkerSize()/2.);
  grlog->Fit("pol1");
  TCanvas* c2 = new TCanvas();
  grlog->Draw("AP");
  c2->Print("gr2.png");

}
开发者ID:rafaellopesdesa,项目名称:OldStuff,代码行数:35,代码来源:draw.C

示例2: plot_mc

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");


}
开发者ID:hep-mirrors,项目名称:h1fitter,代码行数:58,代码来源:plot_pdf.C

示例3: CmpNmuMCData

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();




}
开发者ID:dannielliu,项目名称:KKcross,代码行数:56,代码来源:CmpNmuMCData.C

示例4: spectra_mw

void spectra_mw(const char *prefix = "pt/PhiNsigma_KTPCnsig30_STD2010_00_DEFAULT_00")
{
  TGraphErrors *g = ReadMWGraph(Form("%s/mass", prefix), 1);
  g->Draw("ACP");

  TLatex latex;
  latex.SetTextFont(42);
  latex.SetTextAlign(12);
  latex.SetTextSize(0.03);
  latex.SetTextColor(kBlue+1);
  latex.DrawLatex(1.2, 1.01877, "MC generated");
  latex.SetTextColor(kGreen+1);
  latex.DrawLatex(1.2, 1.01877-0.00015, "MC reconstructed");
  latex.SetTextColor(kRed+1);
  latex.DrawLatex(1.2, 1.01877-2*0.000155, "Real data (uncorrected)");
  latex.SetTextColor(kBlack);
  latex.DrawLatex(1.2, 1.01877-3*0.00016, "Real data (corrected)");
  gPad->Print(Form("%s.pdf", g->GetName()));

  gPad->Clear();
  gPad->SetLogy(0);
  TGraphErrors *g = ReadMWGraph(Form("%s/mass", prefix), 3);
  g->Draw("AP");
  latex.SetTextAlign(22);
  latex.SetTextSize(0.04);
  latex.SetTextColor(kBlack);
  latex.DrawLatex(2.0, 1.0207, "pp @ #sqrt{s} = 2.76 TeV");
  latex.DrawLatex(2.0, 1.0205, "TPC 3.0 #sigma");
  latex.DrawLatex(2.0, 1.0202, "#phi #rightarrow K^{ +}  K^{ -}");
  latex.SetTextSize(0.035);
  latex.DrawLatex(1.7, 1.0182, "uncertainties:  stat. (bars) & syst. (boxes)");
  gPad->Print(Form("%s.pdf", g->GetName()));

  gPad->Clear();
  TGraphErrors *g = ReadMWGraph(Form("%s/width", prefix), 2);
  g->Draw("AP");
  TLatex latex;
  latex.SetTextAlign(22);
  latex.SetTextSize(0.04);
  latex.SetTextColor(kBlack);
  latex.DrawLatex(1.7, 0.0090, "pp @ #sqrt{s} = 2.76 TeV");
  latex.DrawLatex(1.7, 0.0085, "TPC 3.0 #sigma");
  latex.DrawLatex(1.7, 0.0077, "#phi #rightarrow K^{ +}  K^{ -}");
  latex.SetTextSize(0.035);
  latex.DrawLatex(1.7, 0.0007, "uncertainties:  stat. (bars) & syst. (boxes)");
  gPad->Print(Form("%s.pdf", g->GetName()));

  //  gPad->Clear();
  //  gPad->SetLogy();
  //  TGraphErrors *g = ReadPtGraphSys("pt/out.txt");
  //  if (!g) return;
  //  g->Draw("AP");
  //  gPad->Print(Form("%s.pdf", g->GetName()));
}
开发者ID:musinsky,项目名称:bordel,代码行数:54,代码来源:spectra_mw.C

示例5: plotObsScanCheck

///
/// 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);
}
开发者ID:KonstantinSchubert,项目名称:gammacombo,代码行数:54,代码来源:ParameterEvolutionPlotter.cpp

示例6: DrawClus

void DrawClus(bool Flag_err,TTree* tree,Double_t *errx,char* varToPlot, char* cond, Int_t kColor, Int_t kMarker, char* Title,char* xTitle,char* yTitle, TLegend *leg, char* cLeg,Double_t downlim,Double_t uplim){
  TGraphErrors* g;
  
  tree->Draw(varToPlot, cond,"goff");
  cout << tree->GetSelectedRows() << endl;
  if(tree->GetSelectedRows()){
    if(Flag_err)
      g=new TGraphErrors(tree->GetSelectedRows(),tree->GetV1(),tree->GetV2(),errx,tree->GetV3());
    else
      g=new TGraphErrors(tree->GetSelectedRows(),tree->GetV1(),tree->GetV2(),errx,errx);
    g->SetMarkerStyle(kMarker);
    g->SetMarkerSize(0.9);
    g->SetMarkerColor(kColor);
    g->SetTitle(Title);
    g->GetXaxis()->SetTitle(xTitle);
    g->GetXaxis()->CenterTitle();
    g->GetYaxis()->SetTitle(yTitle);
    g->GetYaxis()->CenterTitle();
    g->GetYaxis()->SetRangeUser(downlim,uplim);
    g->Draw("Ap");
    leg->AddEntry(g, cLeg,"p");
  }else{
    cout << "NO rows selected for leave " << varToPlot << endl;
  }
}
开发者ID:Andrej-CMS,项目名称:cmssw,代码行数:25,代码来源:PlotMacro.cpp

示例7: gerrors

void gerrors() {
   //Draw a graph with error bars
   // To see the output of this macro, click begin_html <a href="gif/gerrors.gif">here</a>. end_html
   //Author: Rene Brun
   
   TCanvas *c1 = new TCanvas("c1","A Simple Graph with error bars",200,10,700,500);

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

   const Int_t n = 10;
   Float_t x[n]  = {-0.22, 0.05, 0.25, 0.35, 0.5, 0.61,0.7,0.85,0.89,0.95};
   Float_t y[n]  = {1,2.9,5.6,7.4,9,9.6,8.7,6.3,4.5,1};
   Float_t ex[n] = {.05,.1,.07,.07,.04,.05,.06,.07,.08,.05};
   Float_t ey[n] = {.8,.7,.6,.5,.4,.4,.5,.6,.7,.8};
   TGraphErrors *gr = new TGraphErrors(n,x,y,ex,ey);
   gr->SetTitle("TGraphErrors Example");
   gr->SetMarkerColor(4);
   gr->SetMarkerStyle(21);
   gr->Draw("ALP");

   c1->Update();
}
开发者ID:My-Source,项目名称:root,代码行数:25,代码来源:gerrors.C

示例8: PlotMultiplicity

void TMRCScanner::PlotMultiplicity(int opt){
	
	ffile = new TFile(foutfile);
	if (ffile->IsOpen()) {
		ftree = (TTree*) ffile->Get("T"); 
		ftree->SetMarkerStyle(23);
		
		switch (opt) {
			case 0:
				ftree->Draw("HitMultMean:HitMultMeanErr:DAC","","goff");
				break;
			case 1:
				ftree->Draw("HitMultRMS:HitMultRMSErr:DAC","","goff");
				break;				
			default:
				break;
		}
		
		TGraphErrors *gr = new TGraphErrors(ftree->GetSelectedRows(),ftree->GetV3(), ftree->GetV1(),NULL,ftree->GetV2());
		gr->SetTitle("TGraphErrors Example");
		gr->SetMarkerColor(4);
		gr->SetMarkerStyle(21);
		gr->Draw("ALP");
		
	}else {
		printf("File %s not opened \n",foutfile);
	}
	delete ffile;
}
开发者ID:andrea-celentano,项目名称:Maroc,代码行数:29,代码来源:TMRCScanner_safe.cpp

示例9: plotV2vstheta

void plotV2vstheta(){
    gStyle->SetOptFit(1);
    gStyle->SetOptStat(0);
    gStyle->SetOptTitle(0);
    gStyle->SetErrorX(0);
    int xbin = 0;
    TFile *f = new TFile("mergedV_Prod.root");
    TVectorD *vecV = (TVectorD*)f->Get(Form("D_%d/V"));
    TVectorD *vecdeltaV = (TVectorD*)f->Get(Form("D_%d/deltaV"));
    TVectorD *vecVmean = (TVectorD*)f->Get(Form("Vmean"));
    double *V = vecV->GetMatrixArray();
    double *deltaV = vecdeltaV->GetMatrixArray();
    double *Vmean = vecVmean->GetMatrixArray();
    double theta[ntheta];
    for(int itheta=0;itheta<ntheta;itheta++){
        theta[itheta]=itheta*TMath::Pi()/ntheta/nn;
    }
    TH1D *hFrame = new TH1D("","",300,-1,2);
    hFrame->GetXaxis()->SetTitle("#theta");
    hFrame->GetYaxis()->SetTitle("referenceV_{2}");	
    hFrame->GetXaxis()->SetTitleSize(0.04);
    hFrame->GetYaxis()->SetTitleSize(0.04);
    hFrame->GetXaxis()->SetRangeUser(-0.1,1.5);
    hFrame->SetMaximum(0.055);
    hFrame->SetMinimum(0.045);
    hFrame->Draw();
    TGraphErrors *gr = new TGraphErrors(ntheta,theta,V,0,deltaV);
    gr->SetMarkerSize(1.2);
    gr->SetMarkerStyle(20);
    gr->Draw("Psame");
    TLine *l = new TLine(0,inV2,1.4,inV2);
    l->SetLineStyle(2);
    l->Draw("same");
    c1->Print("V2vstheta.png");
}
开发者ID:XuQiao,项目名称:HI,代码行数:35,代码来源:plotV2vstheta.C

示例10: LSF

void LSF() {
  float x[100], y[100], ex[100], ey[100];
  char filename[80];
  printf("Enter filename.\n");
  scanf("%s",filename);

  FILE *f = fopen(filename,"r");
  if (f == NULL) {
    sprintf(line,"File %s not found.\n",filename);
    printf(line);
    return;
  }

  // Read data
  int i = 0;
  while (fscanf(f,"%f %f %f",&(x[i]),&(y[i]),&(ey[i])) == 3 ) {
    i++;
  }

  printf("Read %d data points.\n",i);

  TGraphErrors *tge = new TGraphErrors(i,x,y,ex,ey); 
  tge->SetMarkerStyle(20);
  tge->SetMarkerColor(kBlue);
  tge->SetLineColor(kBlue);

  c1 = new TCanvas("c1","c1",600,600);

  tge->Draw("AP");
  tge->Fit("pol1");
}
开发者ID:joshaw,项目名称:year3physics,代码行数:31,代码来源:LSF.C

示例11: DrawSame

void DrawSame(char* varToPlot, char* cond, Int_t kColor,TLegend* leg,char* cLeg)
{
  TGraphErrors *g;
  TIFTree->Draw(varToPlot,cond,"goff");
  
  Int_t nSel=TIFTree->GetSelectedRows();
  if ( nSel ) {
    
    Double_t *ErrX= new Double_t[nSel];
    for ( Int_t i=0; i<nSel; i++) ErrX[i]=0;
    
    g = new TGraphErrors(TIFTree->GetSelectedRows(), TIFTree->GetV1(),  TIFTree->GetV2(), ErrX, TIFTree->GetV3());
    
    g->SetMarkerStyle(21);
    g->SetMarkerSize(0.5);
    g->SetMarkerColor(kColor);
    g->SetLineColor(kColor);
    g->Draw("SP"); //draw graph in current pad
    
    //    g->GetYaxis()->SetRangeUser(40., 100.);
    leg->AddEntry(g,cLeg);
    leg->Draw();
    delete[] ErrX;
  }
  else {
    cout << "NO rows selected " << endl;
  }
}
开发者ID:aashaqshah,项目名称:cmssw-1,代码行数:28,代码来源:plotMacro_Off.C

示例12: bestFit

TGraphErrors bestFit(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);
  graph.SetPoint(0, constTerm, alpha);
  graph.SetPointError(0,0, 0);
  iPoint++;

  graph.Set(iPoint);
  tree->ResetBranchAddresses();
  graph.Draw("A P");
//   graph.SetFillColor(kBlue);
//   graph.SetLineColor(kYellow);
//   graph.GetXaxis()->SetTitle("Energy [GeV]");
//   graph.GetYaxis()->SetTitle("Additional smearing [%]");
  return graph;
}
开发者ID:alexeyfinkel,项目名称:ECALELF,代码行数:27,代码来源:mcmcDraw.C

示例13: g

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;
}
开发者ID:alexeyfinkel,项目名称:ECALELF,代码行数:34,代码来源:mcmcDraw.C

示例14: Draw_ALICEMid_JPsi_RaaVsNpart

void Draw_ALICEMid_JPsi_RaaVsNpart(TLegend *lgd)
{
  //ALICE MID rapidity
  int nbinsALICEMid=3;
  Double_t NPartALICEMid[3]={357,193,46};
  Double_t ErrNPartALICEMid[3]={0};
  Double_t RaaALICEMid[3] = {0.82,0.65,0.73}; 
  Double_t SystErrALICEMid[3] = {0.15,0.10,0.16};
  
  TGraphErrors *grRaaALICEMid = new TGraphErrors(nbinsALICEMid, NPartALICEMid, RaaALICEMid, ErrNPartALICEMid, SystErrALICEMid);  
  grRaaALICEMid->SetMarkerStyle(20);
  grRaaALICEMid->SetMarkerColor(2);
  //grRaaALICEMid->SetLineColor(2);
  grRaaALICEMid->GetYaxis()->SetRangeUser(0,1.5);
  
  TAxis *Xaxis = grRaaALICEMid->GetXaxis();
  Xaxis->SetLimits(0.,430.0);
  grRaaALICEMid->GetXaxis()->SetTitle("N_{Part}");
  grRaaALICEMid->GetYaxis()->SetTitle("R_{AA}");
  
  grRaaALICEMid->Draw("Psame");
  
  //TLatex *tb= new TLatex;
  //tb->SetNDC(); 
  //tb->SetTextAlign(12);
  //tb->SetTextColor(1);
  //tb->SetTextSize(0.040);
  //tb->DrawLatex(0.55,0.90,"PbPb #sqrt{s_{NN}} = 2.76 TeV");
  //tb->DrawLatex(0.22,0.16,"J/#psi #rightarrow #mu^{+} #mu^{-}, p_{T}^{J/#psi} > 0.0 GeV/c");  
  //tb->DrawLatex(0.55,0.85,"p_{T}^{J/#psi} > 0.0 GeV/c");  
  
  TLine *lh3 = new TLine(0.0,1.0,420,1.0);
  lh3->SetLineColor(1);
  lh3->SetLineStyle(1);
  lh3->SetLineWidth(1.5);
  lh3->Draw("same");
    
  TBox *RaaJPsiALICEMidSys[12];
  for(int j=0;j<3;j++){
    RaaJPsiALICEMidSys[j] = new TBox(NPartALICEMid[j]-3,  RaaALICEMid[j]-SystErrALICEMid[j], NPartALICEMid[j]+3, RaaALICEMid[j]+SystErrALICEMid[j]);
  }
  
  for(int j=0;j<3;j++){
    RaaJPsiALICEMidSys[j]->SetFillStyle(0000);
    RaaJPsiALICEMidSys[j]->SetLineColor(2);
    RaaJPsiALICEMidSys[j]->Draw("same"); 
  }
  
  TBox *ALICEMidGlobalSysJPsi;
  ALICEMidGlobalSysJPsi = new TBox(385-5, 1 - 0.26, 385+5, 1 + 0.26);
  
  ALICEMidGlobalSysJPsi->SetFillStyle(3001);
  ALICEMidGlobalSysJPsi->SetLineColor(2);
  ALICEMidGlobalSysJPsi->SetFillColor(2);
  ALICEMidGlobalSysJPsi->Draw("same"); 

  lgd->AddEntry(grRaaALICEMid,"ALICE Data p_{T}^{J/#psi} > 0.0 GeV/c, |y^{J/#psi}| #leq 1.0","P");
  
}
开发者ID:vineetsalar,项目名称:JPsiProduction,代码行数:59,代码来源:AbDrawData.C

示例15: Draw_ALICEFor_JPsi_RaaVsNpart

void Draw_ALICEFor_JPsi_RaaVsNpart(TLegend *lgd)
{
  int nbinsALICE=9;
  Double_t NPartALICE[10]={357,262,187,128,86,53,30,16,8};
  Double_t ErrNPartALICE[10]={0};
  Double_t RaaALICE[10] = {0.47,0.48,0.51,0.51,0.52,0.61,0.70,0.74,0.94}; 
  Double_t SystErrALICE[10] = {0.03,0.02,0.02,0.02,0.03,0.05,0.06,0.09,0.1};
  
  TGraphErrors *grRaaALICE = new TGraphErrors(nbinsALICE, NPartALICE, RaaALICE, ErrNPartALICE, SystErrALICE);  
  grRaaALICE->SetMarkerStyle(20);
  grRaaALICE->SetMarkerColor(4);
  grRaaALICE->GetYaxis()->SetRangeUser(0,1.7);
  
  TAxis *Xaxis2 = grRaaALICE->GetXaxis();
  Xaxis2->SetLimits(0.,430.0);
  
  grRaaALICE->GetXaxis()->SetTitle("N_{Part}");
  grRaaALICE->GetYaxis()->SetTitle("R_{AA}");

  grRaaALICE->Draw("AP");
 
  TLine *lh3 = new TLine(0.0,1.0,420,1.0);
  lh3->SetLineColor(1);
  lh3->SetLineStyle(1);
  lh3->SetLineWidth(1.5);
  lh3->Draw("same");
 
  //TLatex *tb= new TLatex;
  //tb->SetNDC(); 
  //tb->SetTextAlign(12);
  //tb->SetTextColor(1);
  //tb->SetTextSize(0.040);
  //tb->DrawLatex(0.22,0.22,"PbPb #sqrt{s_{NN}} = 2.76 TeV");
  //tb->DrawLatex(0.22,0.16,"J/#psi #rightarrow #mu^{+} #mu^{-}, p_{T}^{J/#psi} > 0.0 GeV/c");  
   
  
  TBox *RaaJPsiALICESys[12];
  for(int j=0;j<9;j++){
    RaaJPsiALICESys[j] = new TBox(NPartALICE[j]-3,  RaaALICE[j]-SystErrALICE[j], NPartALICE[j]+3, RaaALICE[j]+SystErrALICE[j]);
  }
  
  for(int j=0;j<9;j++){
    RaaJPsiALICESys[j]->SetFillStyle(0000);
    RaaJPsiALICESys[j]->SetLineColor(4);
    RaaJPsiALICESys[j]->Draw("same"); 
  }
  
  TBox *ALICEGlobalSysJPsi;
  ALICEGlobalSysJPsi = new TBox(400-5, 1 - 0.14, 400+5, 1 + 0.14);
  ALICEGlobalSysJPsi->SetFillStyle(3001);
  ALICEGlobalSysJPsi->SetLineColor(4);
  ALICEGlobalSysJPsi->SetFillColor(4);
  ALICEGlobalSysJPsi->Draw("same"); 

  Draw_ALICEMid_JPsi_RaaVsNpart(lgd);

  lgd->AddEntry(grRaaALICE,"ALICE Data p_{T}^{J/#psi} > 0.0 GeV/c, 2.5 #leq y^{J/#psi} #leq 4.0","P");

}
开发者ID:vineetsalar,项目名称:JPsiProduction,代码行数:59,代码来源:AbDrawData.C


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