Hi Rosario, This problem had already been reported to roottalk and fixed in the current development version 2.24/02 on the web. Here is thye extract from the release notes: // // 05/04/2000 08.36.47 by Rene Brun // - Fix a problem in TH2::ProfileY (thanks Gerco Onderwater). When creating a profile along the y-axis from a 2D histo, the number of bins in the profile are incorrect (as a matter of fact, the number of bins on the x-axis of the original 2d histo is used). Rene Brun On Mon, 10 Apr 2000, Rosario Turrisi wrote: > Dear Rooters, > I am building profile histograms from a 2D > via myhist->ProfileY method. > Then I need to access the information stored, > i.e. the mean and RMS, what I am not able to do > by the usual 1D-hist methods, as I supposed it was meant. > It seems that in any case ProfileY builds a histogram > with NbinsX as the original 2D, no matter if I do ProfileY or -X. > It seems also that, when NbinsX>NbinsY, it puts the points > corresponding to neighboring (Y) bins every NbinsX/NbinsY bins... > For the sake of clarity, I include here the macro wishing > to do this job: > > void makermsplot() { > TFile* p = new TFile("fitvertexs-200.root","UPDATE"); > TH2D* d0vsphi=(TH2D*)p->Get("d0vsphi"); > Int_t nbins=(Int_t)d0vsphi->GetNbinsY(); > Int_t modbins=(Int_t)d0vsphi->GetNbinsX(); > Float_t xlow = (Float_t)d0vsphi->GetYaxis()->GetXmin(); > Float_t xup = (Float_t)d0vsphi->GetYaxis()->GetXmax(); > TH1F *hres = new TH1F("hres","res vs phi",nbins,xlow,xup); > d0vsphi->ProfileY("profy",1,1000,"s"); > for (Int_t i=1; i<=nbins; i++) { > Int_t newbin = > (Int_t)((Float_t)i*(Float_t)modbins/(Float_t)nbins)-15; // here I tried > empirically to get the filled bins... > Float_t cont= profy->GetBinError(newbin); > Float_t xb = (Float_t)i; > // hres->Fill(xb,cont); > } > // hres->Draw(); > //cin>>xb; > p->Close(); > return; > } > > > Any suggestion? > Thanks in advance! > Rosario > > -- > ----------------------------------------------------- > Rosario Turrisi > Dipartimento di Fisica dell'Universita' e INFN > via Marzolo, 8 - Padova > tel. +39-049-8277106 > fax +39-049-8762641 > > **** ALICE & NA57 Collaboration **** > > 'Il faut decider si on veut etre Cesar a Rome > ou un reveur au milieu du desert' > Marguerite Yourcenar > ----------------------------------------------------- >
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:23 MET