All branch become 0 in RooDataSet when loading Tree content


I got a weird problem that when I use RooDataSet to load a tree, all branch of all events are the same (0 or center of the RooRealvar range), not correctly imported.

TFile *fin=TFile::Open(“fnew.root”);
TTree tMuMu=(TTree)fin->Get(“DiMuTree”);
RooRealVar SMuMu_mass(“SMuMu_mass”,“SMuMu_mass”,60,120);
RooRealVar SMuMu_pt(“SMuMu_pt”,“SMuMu_pt”,0);
RooRealVar SMuMu_phi(“SMuMu_phi”,“SMuMu_phi”,0);
RooRealVar SMuMu_eta(“SMuMu_eta”,“SMuMu_eta”,0);
RooDataSet RooDS_All(“RooDS_All”,“RooDS_All”,RooArgSet(SMuMu_mass,SMuMu_pt,SMuMu_phi,SMuMu_eta),Import(*tMuMu));

Tree content

SMuMu distribution plotted from tree

SMuMu distribution plotted from RooDataSet

example root file


that’s interesting. Which root version is this?

I tried 6.02/13 , 6.10/09 , and 6.14/09, all of them give the same result.

Can you try 6.18/04 from lxplus?


The problem is the branch names. You need to call the variables

RooRealVar SMuMu_mass(“MuMu_mass”, “MuMu_mass”,60,120);
RooRealVar SMuMu_pt(“MuMu_pt”, “MuMu_pt”,0);

not SMuMu_mass etc.

1 Like

Thanks a lot, it works.

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