RooAbsData::fillHistogram problem

Dear Rooters,

I have a question about the function mentioned in the title. I was trying to fit a custom-binned TH2F histogram by it returns an error:

[#0] ERROR:InputArguments – RooDataSet::data2:fillHistogram: plotVars has the wrong dimension
terminate called after throwing an instance of 'DifferentDimension’
what(): std::exception

In the function description it says that it is possible to fill 2D histograms if you treat them as TH1, but I have never done this. Can anybody explain how to make my code work? Here is the relevant piece of it:

TH2F * RealDataHist2D = (TH2F*)MCHist->Clone("IsoHistRealData2D");

I called RealDataHist2D->GetDimension(); and it returns 1 instead of 2. Can anybody explain this?
I know that TH2F can be treated as 1D, but it is nt helpful here.
RooArgList(Lb_ETA,Lb_PT).getSize() returns 2, so that’s fine.



The problem here is in MCHist. Are you sure is a 2D histogram ,i.e. a TH2D class ?
I would use dynamic_cast instead of C-cast to be sure


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