Hi Rooters, I noticed some odd behaviour in TH2::ProjectionX/Y and TH2::ProfileX/Y. See the example below: TH2C* h = new TH2C("h","h",1,0,1,1,0,1) h->Fill(0.5,-0.5) h->Draw(); // no counts here h->ProjectionX()->Draw(); // but there is one here This seems a case of "what you don't see, is what you get", because the overflow bins are used to make a projection or profile, but NOT to plot. I can imagine that there are cases where you want to have this sort of behaviour, but in general it seems dangerous, because you only know about the overflow bins if you look at the statistics. It cost me a few days to figure out why in the world my results changed in what I thought were identical situations. I found that I was sometimes using ProfileX() and other times ProfileX(1,h->GetNbinsY()), which I expected to yield identical results. The problem is in here: TH1D *TH2::ProjectionX(const char *name, Int_t firstybin, Int_t lastybin, Option_t *option) { .... stuff removed here ... Int_t nx = fXaxis.GetNbins(); Int_t ny = fYaxis.GetNbins(); if (firstybin < 0) firstybin = 0; <==== shouldn't this be 1 if (lastybin > ny) lastybin = ny+1; <== and this ny? and similar pieces for the other Pro's (all versions of root I checked have this). Perhaps this was by design, in which case I will be more careful (and looking for some documentation ....). Greetings, -- Gerco Dr. C.J.G. Onderwater Nuclear Physics Laboratory 401B Loomis Laboratory of Physics University of Illinois at Urbana-Champaign 1110 West Green Street Urbana, IL 61801-3080 Phone : (217) 244-7363 Fax : (217) 333-1215 E-mail: onderwat@uiuc.edu
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:52 MET