本文整理汇总了C++中TGraphErrors::GetListOfFunctions方法的典型用法代码示例。如果您正苦于以下问题:C++ TGraphErrors::GetListOfFunctions方法的具体用法?C++ TGraphErrors::GetListOfFunctions怎么用?C++ TGraphErrors::GetListOfFunctions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TGraphErrors
的用法示例。
在下文中一共展示了TGraphErrors::GetListOfFunctions方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeNice
void makeNice(TString fileName, TString nice = "nicePlot"){
TFile *f = TFile::Open(fileName);
// TFile *f = TFile::Open("out_Parameters_bkg1_3vtx.root");
TGraphErrors * gRgre = (TGraphErrors*)f->Get("gR");
TGraphErrors * gXgre = (TGraphErrors*)f->Get("gX");
TGraphErrors * gYgre = (TGraphErrors*)f->Get("gY");
TGraphErrors * rRgre = (TGraphErrors*)f->Get("rR");
TGraphErrors * rXgre = (TGraphErrors*)f->Get("rX");
TGraphErrors * rYgre = (TGraphErrors*)f->Get("rY");
//=========Macro generated from canvas: c1_n2/c1_n2
//========= (Fri May 27 11:43:08 2011) by ROOT version5.27/06b
TCanvas *c1_n2 = new TCanvas("c1_n2","c1_n2",700,1500);
gStyle->SetOptFit(0);
gStyle->SetOptStat(0);
c1_n2->Range(0,0,1,1);
c1_n2->SetFillColor(0);
c1_n2->SetBorderMode(0);
c1_n2->SetBorderSize(2);
c1_n2->SetTickx(1);
c1_n2->SetTicky(1);
c1_n2->SetLeftMargin(0.13);
c1_n2->SetRightMargin(0.05);
c1_n2->SetTopMargin(0.05);
c1_n2->SetBottomMargin(0.13);
c1_n2->SetFrameFillStyle(0);
c1_n2->SetFrameBorderMode(0);
// ------------>Primitives in pad: c1_n2_1
TPad *c1_n2_1 = new TPad("c1_n2_1", "c1_n2_1",0.01,0.67,0.99,0.99);
c1_n2_1->Draw();
c1_n2_1->cd();
c1_n2_1->Range(-52.68293,-0.03170732,44.87805,0.2121951);
c1_n2_1->SetFillColor(0);
c1_n2_1->SetBorderMode(0);
c1_n2_1->SetBorderSize(2);
c1_n2_1->SetTickx(1);
c1_n2_1->SetTicky(1);
c1_n2_1->SetLeftMargin(0.12);
c1_n2_1->SetRightMargin(0.02);
c1_n2_1->SetTopMargin(0.05);
c1_n2_1->SetBottomMargin(0.2);
c1_n2_1->SetFrameFillStyle(0);
c1_n2_1->SetFrameBorderMode(0);
c1_n2_1->SetFrameFillStyle(0);
c1_n2_1->SetFrameBorderMode(0);
TH1D *PLOTTERX = new TH1D("PLOTTERX","",1,-40,40);
PLOTTERX->SetMinimum(-0.19);
PLOTTERX->SetMaximum(+0.19);
PLOTTERX->SetFillColor(63);
PLOTTERX->SetLineStyle(0);
PLOTTERX->SetMarkerStyle(20);
PLOTTERX->GetXaxis()->SetLabelFont(42);
PLOTTERX->GetXaxis()->SetLabelOffset(0.007);
PLOTTERX->GetXaxis()->SetLabelSize(0.09);
PLOTTERX->GetXaxis()->SetTitleSize(0.1);
PLOTTERX->GetXaxis()->SetTitleOffset(0.9);
PLOTTERX->GetXaxis()->SetTitleFont(42);
PLOTTERX->GetXaxis()->SetTitle("z [cm]");
PLOTTERX->GetYaxis()->SetNdivisions(505);
PLOTTERX->GetYaxis()->SetTitle("x_{0} [cm] ");
PLOTTERX->GetYaxis()->SetLabelFont(42);
PLOTTERX->GetYaxis()->SetLabelOffset(0.007);
PLOTTERX->GetYaxis()->SetLabelSize(0.09);
PLOTTERX->GetYaxis()->SetTitleSize(0.1);
PLOTTERX->GetYaxis()->SetTitleOffset(0.5);
PLOTTERX->GetYaxis()->SetTitleFont(42);
PLOTTERX->GetZaxis()->SetLabelFont(42);
PLOTTERX->GetZaxis()->SetLabelOffset(0.007);
PLOTTERX->GetZaxis()->SetLabelSize(0.05);
PLOTTERX->GetZaxis()->SetTitleSize(0.06);
PLOTTERX->GetZaxis()->SetTitleFont(42);
PLOTTERX->Draw("");
gXgre->SetFillColor(kBlack);
gXgre->SetMarkerStyle(20);
gXgre->SetMarkerColor(kBlack);
gXgre->SetLineColor(kBlack);
gXgre->GetListOfFunctions()->RemoveLast(); //to remove parameters panel...
gXgre->GetListOfFunctions()->RemoveLast(); //...and old fit
gXgre->SetLineWidth(2);
gXgre->Draw("P");
rXgre->SetFillColor(kBlue);
rXgre->SetMarkerStyle(20);
rXgre->SetMarkerColor(kBlue);
rXgre->SetLineColor(kBlue);
rXgre->GetListOfFunctions()->RemoveLast(); //to remove parameters panel...
rXgre->GetListOfFunctions()->RemoveLast(); //...and old fit
rXgre->SetLineWidth(2);
rXgre->Draw("P");
TLatex *CMSPrel = new TLatex(-37.0,PLOTTERX->GetMaximum()-0.025,"CMS Preliminary 2011");
CMSPrel->SetTextSize(0.06);
// CMSPrel->Draw();
//.........这里部分代码省略.........
示例2: BSA_InCoherent_t
//.........这里部分代码省略.........
Graph_Graph1154->GetXaxis()->SetTitleFont(42);
Graph_Graph1154->GetYaxis()->SetLabelFont(42);
Graph_Graph1154->GetYaxis()->SetLabelSize(0.035);
Graph_Graph1154->GetYaxis()->SetTitleSize(0.035);
Graph_Graph1154->GetYaxis()->SetTitleFont(42);
Graph_Graph1154->GetZaxis()->SetLabelFont(42);
Graph_Graph1154->GetZaxis()->SetLabelSize(0.035);
Graph_Graph1154->GetZaxis()->SetTitleSize(0.035);
Graph_Graph1154->GetZaxis()->SetTitleFont(42);
gre->SetHistogram(Graph_Graph1154);
TF1 *myfit1155 = new TF1("myfit","[0]*sin(x*3.1416/180.0)/(1 + [1]*cos(x*3.1416/180.0))",0,369.4943);
myfit1155->SetFillColor(19);
myfit1155->SetFillStyle(0);
myfit1155->SetLineColor(2);
myfit1155->SetLineWidth(2);
myfit1155->SetChisquare(12.03234);
myfit1155->SetNDF(7);
myfit1155->GetXaxis()->SetLabelFont(42);
myfit1155->GetXaxis()->SetLabelSize(0.035);
myfit1155->GetXaxis()->SetTitleSize(0.035);
myfit1155->GetXaxis()->SetTitleFont(42);
myfit1155->GetYaxis()->SetLabelFont(42);
myfit1155->GetYaxis()->SetLabelSize(0.035);
myfit1155->GetYaxis()->SetTitleSize(0.035);
myfit1155->GetYaxis()->SetTitleFont(42);
myfit1155->SetParameter(0,0.2160608);
myfit1155->SetParError(0,0.02670852);
myfit1155->SetParLimits(0,0,0);
myfit1155->SetParameter(1,0.2378828);
myfit1155->SetParError(1,0.2292802);
myfit1155->SetParLimits(1,0,0);
gre->GetListOfFunctions()->Add(myfit1155);
TPaveStats *ptstats = new TPaveStats(0.27,0.74,0.9,0.9,"brNDC");
ptstats->SetName("stats");
ptstats->SetBorderSize(1);
ptstats->SetFillColor(0);
ptstats->SetTextAlign(12);
ptstats->SetTextFont(42);
TText *AText = ptstats->AddText("#chi^{2} / ndf = 12.03 / 7");
AText = ptstats->AddText("p0 = 0.2161 #pm 0.02671 ");
AText = ptstats->AddText("p1 = 0.2379 #pm 0.2293 ");
ptstats->SetOptStat(0);
ptstats->SetOptFit(111);
ptstats->Draw();
gre->GetListOfFunctions()->Add(ptstats);
ptstats->SetParent(gre->GetListOfFunctions());
multigraph->Add(gre,"");
multigraph->Draw("AP");
multigraph->GetXaxis()->SetTitle("#phi [deg.]");
multigraph->GetXaxis()->SetLabelFont(42);
multigraph->GetXaxis()->SetLabelSize(0.035);
multigraph->GetXaxis()->SetTitleSize(0.035);
multigraph->GetXaxis()->SetTitleFont(42);
multigraph->GetYaxis()->SetTitle("A_{LU}");
multigraph->GetYaxis()->SetLabelFont(42);
multigraph->GetYaxis()->SetLabelSize(0.035);
multigraph->GetYaxis()->SetTitleSize(0.035);
multigraph->GetYaxis()->SetTitleFont(42);
gPad->Modified();
multigraph->GetYaxis()->SetRangeUser(-0.35, 0.35);
示例3: if
TGraphErrors *ReadMWGraph(const char *name, Int_t flag)
{
Double_t xreject = 0.49;
TGraphErrors *g = new TGraphErrors(name);
if (g->IsZombie()) return 0;
while (g->GetX()[0] < xreject)
g->RemovePoint(0);
TGraphErrors *g2 = new TGraphErrors(name);
if (g2->IsZombie()) return 0;
while (g2->GetX()[0] < xreject)
g2->RemovePoint(0);
g2->SetMarkerStyle(4);
g2->SetMarkerSize(1.00);
g2->SetMarkerColor(kBlack);
g2->SetLineColor(kBlack);
TGraphErrors *gsys = new TGraphErrors(name, "%lg %lg %lg %*lg %lg");
if (gsys->IsZombie()) return 0;
while (gsys->GetX()[0] < xreject)
gsys->RemovePoint(0);
for (Int_t i = 0; i < gsys->GetN(); i++)
gsys->SetPointError(i, gsys->GetErrorX(i)*0.75, gsys->GetErrorY(i));
gsys->SetFillColor(kGray+2);
gsys->SetLineColor(kGray+2);
gsys->SetFillStyle(3000);
if (flag == 1 || flag == 3) {
TGraphErrors *gt = new TGraphErrors(Form("%s_%s", name, "trues"));
if (gt->IsZombie()) return 0;
while (gt->GetX()[0] < xreject)
gt->RemovePoint(0);
gt->SetMarkerStyle(20);
gt->SetMarkerSize(0.75);
gt->SetMarkerColor(kGreen+1);
gt->SetLineColor(kGreen+1);
TGraphErrors *gbw = new TGraphErrors(Form("%s_%s", name, "gen"));
if (gbw->IsZombie()) return 0;
while (gbw->GetX()[0] < xreject)
gbw->RemovePoint(0);
gbw->SetMarkerStyle(20);
gbw->SetMarkerSize(0.75);
gbw->SetMarkerColor(kBlue+1);
gbw->SetLineColor(kBlue+1);
for (Int_t i = 0; i < g->GetN(); i++) {
g->SetPointError(i, g->GetEX()[i], 0.);
gt->SetPointError(i, gt->GetEX()[i], 0.);
gbw->SetPointError(i, gbw->GetEX()[i], 0.);
}
for (Int_t i = 0; i < g2->GetN(); i++) {
g2->SetPoint(i, g2->GetX()[i], g2->GetY()[i] - gt->GetY()[i] + gbw->GetY()[i]);
g2->SetPointError(i, g2->GetEX()[i], TMath::Sqrt(g2->GetEY()[i]*g2->GetEY()[i] + gt->GetEY()[i]*gt->GetEY()[i] +
gbw->GetEY()[i]*gbw->GetEY()[i]));
// g2->SetPoint(i, g2->GetX()[i], g2->GetY()[i] - gt->GetY()[i] + 1.01947);
// g2->SetPointError(i, g2->GetEX()[i], TMath::Sqrt(g2->GetEY()[i]*g2->GetEY()[i] + gt->GetEY()[i]*gt->GetEY()[i] +
// 7.78680e-06*7.78680e-06));
gsys->SetPoint(i, gsys->GetX()[i], g2->GetY()[i]);
}
}
g->SetTitle();
g->SetName(name);
g->GetXaxis()->SetTitle("p_{T}, GeV/c");
g->SetMarkerStyle(20);
g->SetMarkerSize(0.95);
g->SetMarkerColor(kRed+1);
g->SetLineColor(kRed+1);
const Double_t mass = 1.019455;
const Double_t mass_delta = 0.000020;
const Double_t width = 0.00426;
const Double_t width_delta = 0.00004;
if (flag == 1) { // mass
g->GetYaxis()->SetTitleOffset(1.50);
g->GetYaxis()->SetTitle("mass, GeV/c^{2}");
g->SetMaximum(mass+0.0015);
g->SetMinimum(mass-0.0015);
TBox *box = new TBox(g->GetXaxis()->GetXmin(), mass - mass_delta, g->GetXaxis()->GetXmax(), mass + mass_delta);
box->SetFillColor(kGray+1);
box->SetFillStyle(3001);
g->GetListOfFunctions()->Add(box);
g->GetListOfFunctions()->Add(g2, "CP");
g->GetListOfFunctions()->Add(gt, "CP");
g->GetListOfFunctions()->Add(gbw, "CP");
}
else if (flag == 3) { // mass simple
g2->SetTitle();
g2->SetName(Form("%s_only", name));
g2->GetXaxis()->SetTitle("p_{T}, GeV/c");
g2->SetMarkerStyle(20);
g2->SetMarkerSize(0.75);
g2->SetMarkerColor(kBlack);
g2->SetLineColor(kBlack);
g2->GetYaxis()->SetTitleOffset(1.50);
//.........这里部分代码省略.........
示例4: BSA_InCoherent_xB
//.........这里部分代码省略.........
Graph_Graph1134->GetXaxis()->SetTitleFont(42);
Graph_Graph1134->GetYaxis()->SetLabelFont(42);
Graph_Graph1134->GetYaxis()->SetLabelSize(0.035);
Graph_Graph1134->GetYaxis()->SetTitleSize(0.035);
Graph_Graph1134->GetYaxis()->SetTitleFont(42);
Graph_Graph1134->GetZaxis()->SetLabelFont(42);
Graph_Graph1134->GetZaxis()->SetLabelSize(0.035);
Graph_Graph1134->GetZaxis()->SetTitleSize(0.035);
Graph_Graph1134->GetZaxis()->SetTitleFont(42);
gre->SetHistogram(Graph_Graph1134);
TF1 *myfit1135 = new TF1("myfit","[0]*sin(x*3.1416/180.0)/(1 + [1]*cos(x*3.1416/180.0))",0,365.7873);
myfit1135->SetFillColor(19);
myfit1135->SetFillStyle(0);
myfit1135->SetLineColor(2);
myfit1135->SetLineWidth(2);
myfit1135->SetChisquare(10.13595);
myfit1135->SetNDF(7);
myfit1135->GetXaxis()->SetLabelFont(42);
myfit1135->GetXaxis()->SetLabelSize(0.035);
myfit1135->GetXaxis()->SetTitleSize(0.035);
myfit1135->GetXaxis()->SetTitleFont(42);
myfit1135->GetYaxis()->SetLabelFont(42);
myfit1135->GetYaxis()->SetLabelSize(0.035);
myfit1135->GetYaxis()->SetTitleSize(0.035);
myfit1135->GetYaxis()->SetTitleFont(42);
myfit1135->SetParameter(0,0.1205343);
myfit1135->SetParError(0,0.03387604);
myfit1135->SetParLimits(0,0,0);
myfit1135->SetParameter(1,0.6858633);
myfit1135->SetParError(1,0.2646153);
myfit1135->SetParLimits(1,0,0);
gre->GetListOfFunctions()->Add(myfit1135);
TPaveStats *ptstats = new TPaveStats(0.27,0.74,0.9,0.9,"brNDC");
ptstats->SetName("stats");
ptstats->SetBorderSize(1);
ptstats->SetFillColor(0);
ptstats->SetTextAlign(12);
ptstats->SetTextFont(42);
TText *AText = ptstats->AddText("#chi^{2} / ndf = 10.14 / 7");
AText = ptstats->AddText("p0 = 0.1205 #pm 0.03388 ");
AText = ptstats->AddText("p1 = 0.6859 #pm 0.2646 ");
ptstats->SetOptStat(0);
ptstats->SetOptFit(111);
ptstats->Draw();
gre->GetListOfFunctions()->Add(ptstats);
ptstats->SetParent(gre->GetListOfFunctions());
multigraph->Add(gre,"");
multigraph->Draw("AP");
multigraph->GetXaxis()->SetTitle("#phi [deg.]");
multigraph->GetXaxis()->SetLabelFont(42);
multigraph->GetXaxis()->SetLabelSize(0.035);
multigraph->GetXaxis()->SetTitleSize(0.035);
multigraph->GetXaxis()->SetTitleFont(42);
multigraph->GetYaxis()->SetTitle("A_{LU}");
multigraph->GetYaxis()->SetLabelFont(42);
multigraph->GetYaxis()->SetLabelSize(0.035);
multigraph->GetYaxis()->SetTitleSize(0.035);
multigraph->GetYaxis()->SetTitleFont(42);
gPad->Modified();
multigraph->GetYaxis()->SetRangeUser(-0.35, 0.35);