I have a question concerning the handling of over- and underflow when using a RooDataHist. My ROOT version is 6.18, but I also tested the behaviour with 6.20.
I am importing a TH2D histogram via RooDataHist and plot the projection of the RooDataHist on the x axis.
It seems to me like this projection does not account for over- and underlow bins that are present in the initial TH2D.
To illustrate this behaviour, I can alternatively first create a projection of the TH2D on the x axis via the method Projectionx(), giving me a TH1D which fully accounts for the over- and underflow. I then import this TH1D via RooDataHist and compare it to the first projection.
Please find a simplified test example below:
TH2D *h2 = new TH2D("h2", "", 2, 0, 2, 2, 0, 2); h2->Fill(0.5, 0.5); h2->Fill(1.5, 1.5); h2->Fill(0.5, -1); h2->Fill(0.5, -1); RooRealVar x("x", "x", -10, 10); RooRealVar y("y", "y", -10, 10); RooDataHist *dataHist = new RooDataHist("dataHist", "dataHist", RooArgList(x, y), h2); TH1D *h1_x = h2->ProjectionX("projX"); RooDataHist *dataHist_x = new RooDataHist("dataHist_x", "dataHist_x", x, h1_x); RooPlot* frame = x.frame(); dataHist->plotOn(frame); dataHist_x->plotOn(frame, LineColor(kRed+2)); frame->Draw();
The 2 points in the x-y space at (0.5, -1) are not visible in the projection of the 2D RooDataHist.
Do I need to specify an additional option when calling plotOn() to account for the over- and underflow? Can I assume that the over- and underflow is in principle correctly accounted for when importing a 2D histogram through RooDataHist?
Your help is highly appreciated.