本文整理汇总了C++中TGraphErrors::SetMarkerStyle方法的典型用法代码示例。如果您正苦于以下问题:C++ TGraphErrors::SetMarkerStyle方法的具体用法?C++ TGraphErrors::SetMarkerStyle怎么用?C++ TGraphErrors::SetMarkerStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TGraphErrors
的用法示例。
在下文中一共展示了TGraphErrors::SetMarkerStyle方法的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");
}
示例2: 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;
}
}
示例3: 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();
}
示例4: createTgr
//==========================================
//==========================================
void createTgr(TString fname) {
outH=new TFile(fname,"RECREATE");
assert(outH->IsOpen());
printf("save outH -->%s\n", fname.Data());
char *ampTit[mxAmp]={"An", "AnYell", "A#Sigma", "A#Delta"};
int ampCol[mxAmp]={kBlue, kYellow, kGreen, kMagenta};
int ic,iam;
for (ic=0;ic<totC;ic++) {
for (iam=0;iam<mxAmp;iam++) {
char name[100];
sprintf(name,"%s*%s",ampL[iam],tCutL[ic]);
//printf("ic=%d iam=%d name=%s=\n",ic,iam,name);
TGraphErrors *gr =new TGraphErrors;
gr->SetName(name);
gr->SetTitle(ampTit[iam]);
gr->SetMarkerColor(ampCol[iam]);
gr->SetMarkerSize(0.8);
gr->SetMarkerStyle(21);
assert(nGr<mxGr);
grL[nGr++]=gr;
}
}
}
示例5: Printf
//______________________________________________________________________________
TGraphErrors *GraphRatio(TGraphErrors *g1,TGraphErrors *g2)
{
Int_t n = g1->GetN();
if (n != g2->GetN()) {
Printf("!!!!!!!!!!!!!!!!");
return 0;
}
TGraphErrors *g = new TGraphErrors(n);
g->SetMarkerStyle(20);
g->GetXaxis()->SetTitle("p_{t}, GeV/c");
g->SetTitle(Form("#frac{%s}{%s}", g1->GetTitle(), g2->GetTitle()));
Double_t x, y1, y2;
Double_t c0, c1, c12, e0, e1;
Double_t *ex = g1->GetEX();
Double_t *ey = g1->GetEY();
for (Int_t i = 0; i < n; i++) {
g1->GetPoint(i, x, y1);
g2->GetPoint(i, x, y2);
if (TMath::Abs(y2) < 1.E-12) y2 = 1.0;
c0 = y1;
c1 = y2;
c12 = c1*c1;
e0 = g1->GetErrorY(i);
e1 = g2->GetErrorY(i);
g->SetPoint(i, x, y1/y2);
g->SetPointError(i, ex[i], (e0*e0*c1*c1 + e1*e1*c0*c0)/(c12*c12));
}
return g;
}
示例6: 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;
}
示例7: 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");
}
示例8: TGraphErrors
void ExpManager::GetSim1DGraphZ(TString NameTitle, double xmin, double xmax, double ymin, double ymax, TString grid ){ // do the same thing as for the polar interpolation
TGraphErrors *fGraph = new TGraphErrors(); //= new TGraph2DErrors(np, x_array, y_array, bz_array, ex, ey, ez);
fGraph->SetTitle("Simulated Data;Z (mm);Magnetic Field (mT)");
fGraph->SetMarkerSize(1.2);
fGraph->SetMarkerStyle(20);
fGraph->SetMarkerColor(kBlue);
fGraph->SetLineColor(kBlue);
fGraph->SetLineWidth(2);
int graph_counter = 0 ;
for (unsigned i=0; i< fExpY.size(); i++) {
//cout << " X " << fExpX.at(i) ;
if( (fExpX.at(i) >= xmin && fExpX.at(i) <= xmax) && (fExpY.at(i) >= ymin && fExpY.at(i) <= ymax) && fGrid.at(i)==grid ){
fGraph->SetPoint(graph_counter,fExpZ.at(i),fSimB.at(i));
fGraph->SetPointError(graph_counter,fExpZErr.at(i),0);
graph_counter++;
}
}
fGraph->SetTitle(NameTitle+Form(" Simulated Data : %.2f < X < %.2f mm __ %.2f < Y < %.2f mm;Z (mm);Magnetic Field (mT)",xmin,xmax,ymin,ymax));
fGraph->SetName(NameTitle+Form("_Sim_X_%.2f_%.2fmm_Y_%.2f_%.2fmm",xmin,xmax,ymin,ymax));
fGraph->Write();
}
示例9: 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;
}
}
示例10: TGraphErrors
//______________________________________________________________________________
// Construct a graph from vectors and y error vector
TGraphErrors *LoadGraphFromVectorsWithError(vector<double> xVector, vector<double> yVector, vector<double> yErrorVector, string xTitle, string yTitle)
{
int n = xVector.size();
if ((xVector.size() == yVector.size()) &&
(yVector.size() == yErrorVector.size()))
{
//Create a graph
TGraphErrors *gr = new TGraphErrors(n, &xVector[0], &yVector[0], 0, &yErrorVector[0]);
gr->SetTitle("");
gr->SetMarkerStyle(20);
gr->SetMarkerSize(1.2);
gr->SetLineWidth(2);
gr->GetXaxis()->SetTitle(xTitle.c_str());
gr->GetXaxis()->CenterTitle();
gr->GetYaxis()->SetTitle(yTitle.c_str());
gr->GetYaxis()->CenterTitle();
return gr;
delete gr;
}
else
{
TGraphErrors *gr0 = new TGraphErrors();
return gr0;
delete gr0;
}
}
示例11: 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");
}
示例12: add_point
void add_point( double coefover, double sigma, double dsigma ){//============================================================
TGraphErrors *fisig;
if ( gROOT->GetListOfSpecials()->FindObject("fisig")!=NULL ){
fisig=(TGraphErrors*) gROOT->GetListOfSpecials()->FindObject("fisig");
printf("fisig exists\n%s","");
}else{
printf("\n\n NO fisig exists NONONO \n\n\n%s","");
fisig=new TGraphErrors();
fisig->SetTitle("fisig");
fisig->SetName("fisig");
gROOT->GetListOfSpecials()->Add( fisig );// TRICK TO KEEP IT
gDirectory->Add( fisig );
fisig->SetMarkerStyle(7);
}
int n=fisig->GetN();
fisig->SetPoint(n,coefover,sigma);
fisig->SetPointError(n,0.0,dsigma);
// fisig->Print(); // too many data
char text[100];
sprintf(text,"%.3f ... %d",coefover, fisig->GetN() );
// TText *t=new TText(from,0,text );
// t->SetTextSize(0.08);t->Draw();
}//============================================================
示例13: 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");
}
示例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");
}
示例15: Draw_CMS_Y1S_RaaVsRap
void Draw_CMS_Y1S_RaaVsRap(TLegend *lgd)
{
const int nbinsRap=6;
Double_t RapCMS[nbinsRap]={0.2,0.6,1.0,1.4,1.8,2.2};
Double_t ErrRapCMS[nbinsRap]={0};
Double_t RaaRapCMS[nbinsRap] = {0.402,0.377,0.452,0.461,0.466,0.35};
Double_t RaaRapStatErrCMS[nbinsRap] = {0.025,0.025,0.030,0.034,0.039,0.053};
Double_t RaaRapSystErrCMS[nbinsRap] = {0.0404,0.038,0.046,0.0466,0.0484,0.0373};
TGraphErrors *grRaaRapCMS = new TGraphErrors(nbinsRap, RapCMS, RaaRapCMS, ErrRapCMS, RaaRapStatErrCMS);
grRaaRapCMS->SetMarkerStyle(20);
grRaaRapCMS->SetMarkerColor(4);
grRaaRapCMS->GetYaxis()->SetRangeUser(0,3.0);
grRaaRapCMS->GetXaxis()->SetTitle("p_{T}(GeV/c)");
grRaaRapCMS->GetYaxis()->SetTitle("R_{AA}");
TAxis *Xaxis2 = grRaaRapCMS->GetXaxis();
Xaxis2->SetLimits(0.,2.4);
grRaaRapCMS->Draw("AP");
TLine *lh4 = new TLine(0.0,1.0,20.0,1.0);
lh4->SetLineColor(1);
lh4->SetLineStyle(1);
lh4->SetLineWidth(2);
lh4->Draw("same");
TLatex *tb= new TLatex;
tb->SetNDC();
tb->SetTextAlign(12);
tb->SetTextColor(1);
tb->SetTextSize(0.040);
//tb->DrawLatex(0.55,0.22,"PbPb #sqrt{s_{NN}} = 2.76 TeV");
//tb->DrawLatex(0.55,0.16,"#varUpsilon #rightarrow #mu^{+} #mu^{-}, p_{T}^{#varUpsilon} > 0.0 GeV/c");
TBox *RaaRapCMSSys[nbinsRap];
for(int j=0;j<nbinsRap;j++){
RaaRapCMSSys[j] = new TBox(RapCMS[j]-0.1, RaaRapCMS[j]-RaaRapSystErrCMS[j], RapCMS[j]+0.1, RaaRapCMS[j]+RaaRapSystErrCMS[j]);
}
for(int j=0;j<nbinsRap;j++){
RaaRapCMSSys[j]->SetFillStyle(0000);
RaaRapCMSSys[j]->SetLineColor(4);
RaaRapCMSSys[j]->Draw("same");
}
TBox *CMSGlobalSysRap;
CMSGlobalSysRap = new TBox(18-0.2, 1 - 0.083, 18+0.2, 1 + 0.083);
CMSGlobalSysRap->SetFillStyle(3001);
CMSGlobalSysRap->SetLineColor(4);
CMSGlobalSysRap->SetFillColor(4);
//CMSGlobalSysRap->Draw("same");
lgd->AddEntry(grRaaRapCMS,"CMS Data", "P");
}