本文整理汇总了C++中TGraphErrors::IsZombie方法的典型用法代码示例。如果您正苦于以下问题:C++ TGraphErrors::IsZombie方法的具体用法?C++ TGraphErrors::IsZombie怎么用?C++ TGraphErrors::IsZombie使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TGraphErrors
的用法示例。
在下文中一共展示了TGraphErrors::IsZombie方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calc_dNdY
Double_t calc_dNdY(const char *data_file = "pt_RFE", Bool_t show = kFALSE)
{
TGraphErrors *g = new TGraphErrors(data_file);
if (g->IsZombie()) return;
TF1 *flt = new TF1("flt", LevyTsallis, 0., 5., 4);
flt->SetParameters(2.93483e-02, 2.80382e-01, 8.10224e+00, 1.01944e+00);
flt->FixParameter(3, 1.019445);
Double_t fitmin = 0.25, fitmax = 5.25; // !!!
g->Fit(flt, "Q", "", fitmin, fitmax);
g->Fit(flt, "Q", "", fitmin, fitmax);
g->Fit(flt, "Q", "", fitmin, fitmax);
Double_t first, last;
// !!! bining sensibility !!!
Int_t graph_range[2] = {2, 23}; // [2] = 0.05 - 0.01, [23] = 4.70 + 0.01
// interval 1
first = 0.0; // !!!
last = g->GetX()[graph_range[0]] - g->GetErrorX(graph_range[0]);
Double_t fi1 = flt->Integral(first, last);
// interval 2
first = last;
last = g->GetX()[graph_range[1]] + g->GetErrorX(graph_range[1]);
Double_t fi2 = flt->Integral(first, last);
Double_t gi2 = 0.0;
for (Int_t ip = graph_range[0]; ip <= graph_range[1]; ip++)
gi2 += g->GetY()[ip]*g->GetErrorX(ip)*2.0;
// interval 3
first = last;
last = 30.0; // !!!
Double_t fi3 = flt->Integral(first, last);
Double_t result = fi1 + gi2 + fi3;
if (!show) {
delete g;
delete flt;
return result;
}
Printf("function: %f \t %f \t %f", fi1, fi2, fi3);
Printf("graph: \t \t \t %f", gi2);
Printf("result => %f", result);
g->Draw("AP");
gPad->SetLogy();
return result;
}
示例2: 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);
//.........这里部分代码省略.........