Hi all,
I am new root user. I got a task to create multigraph and put two graphs on one canvas. It is ok, there is however one problem I did not manage to solve although I have been looking through this forum.
I need to remove one point that is a garbage, how can I do it in my code?
//Declaring fiiting function ********************************************
Double_t fitfunction(Double_t x, Double_t par)
{
return par[0]+par[1]/pow(x[0],par[2])+par[3]/pow(x[0],pow(2,par[4]));
}
//*********************************************************************
int new_fit()
{
TFile *f = new TFile(“PlotList_GE11_IV_Gas_Comparison_R10_21_AND_R340_352_unswapped.root”);
f->cd(“Comp_GE11_IV_Gas_Comparison/timeResp/10_21”);
TGraphErrors *gr1 = (TGraphErrors*)gDirectory->Get("graph_Comp_GE11_IV_Gas_Comparison_10_21");
f->cd("Comp_GE11_IV_Gas_Comparison/timeResp/340_352");
TGraphErrors *gr2 = (TGraphErrors*)gDirectory->Get("graph_Comp_GE11_IV_Gas_Comparison_340_352");
//Creating canvas
TCanvas *c1 = new TCanvas("c1","Fitted points",800,600);
c1->SetGridx();
c1->SetGridy();
//Creating multigraph
TMultiGraph *mg = new TMultiGraph();
//mg->SetTitle("Time response vs. gain");
gr1->SetMarkerColor(2);
gr1->SetMarkerStyle(22);
gr1->SetMinimum(0);
gr1->SetMaximum(30);
gr2->SetMarkerColor(4);
gr2->SetMarkerStyle(25);
gr2->SetMinimum(0);
gr2->SetMaximum(30);
mg->Add(gr1);
//mg->Add(gr2);
mg->Draw("AP");
}
The problem is in one of two graphs. One point has got really big uncertainities and is far far away from others. I should treat it as a garbage.
So what I can do is either:
-
remove this point - how?
-
set Y axis range of plotting. - how?
Other task id to fit these points but this is something I have been doing before, so I will manage to do it.
Thank you very much for any responses.