RooArgSet for 2D likelihood with RooWorkspace

Dear experts,

Hello, I have a question in RooArgSet with RooWorkspace.
My code is below.

 RooWorkspace *w = new RooWorkspace("w","workspace") ;
 TTree *Etree = new TTree("Etree","Etree");
 int nnevt = Etree->ReadFile("energy.txt","x:y");
 RooRealVar x("x","x",0,10000);
 RooRealVar y("y","y",0.,1.);
 RooDataSet data("data","data", Etree, RooArgSet(x,y));
 
 // plot data and function                                                                                                           
  RooPlot * plot = w->var("x")->frame();
  data.plotOn(plot);
  TCanvas *c_x = new TCanvas("c_x","c_x",800,800);
  plot->Draw();

  // plot data and function                                                                                                           
  RooPlot * dir_plot = w->var("y")->frame();
  data.plotOn(dir_plot);
  TCanvas *c_y = new TCanvas("c_y","c_y",800,800);
  c_y->SetGrid();
  dir_plot->Draw();

In this code, I can make a plot of x variable, but I can’t get a plot of “y”
What’s difference between them? Could you tell me, please?
Thank you so much for your support in advance.

best regards,
Tomo

I don’t see a difference. What’s the output of the macro?

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