Plot with error from TTree

I have a TTree called bbn with different kind of data (my “x” axis and several “y” and “yerror” to be plotted separately, but not in the form of branches) I tried using different methods found on this forum to plot the central data as a line inside a filled error zone. None seems to work for me.
I’m currently trying this (code below), but it doesn’t draw anything except for the axis, and instead gives me:
Error: Can’t call TGraph::TGraph(N,bbn->GetV3(),bbn->GetV2(),bbn->GetV1()) in current scope plotBBN.c:83:
Can someone help me fix my code ?
Thanks in advance for your help

gROOT->SetStyle("Plain");
TCanvas* c = new TCanvas();	
TH1F *h = new TH1F("h","Relative abondance",100,1e-10,1e-9);
h->SetMaximum(0.26);
h->SetMinimum(0.22);
h->GetXaxis()->SetTitle("#eta");
h->GetXaxis()->CenterTitle(true);
h->SetLabelOffset(100.,"y");
h->Draw();

Long64_t N = tree->Draw("eta:Yp:sigma_Yp","","goff");
TGraph *gr = new TGraph(N,bbn->GetV3(),bbn->GetV2(),bbn->GetV1());
gr->Draw("alp");
1 Like

It worked perfectly !
Thank you a lot.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.