Hi,
there is no working overload of THnSparse::Draw() yet; it's simply not implemented yet. Check e.g. $ROOTSYS/tutorials/tree/drawsparse.C <http://root.cern.ch/root/html/tutorials/tree/drawsparse.C.html> for how to draw it. Or project it to a TH1/2/3 and draw that.
Cheers, Axel.
On 2010-01-19 16:26, davidesgalaberna_at_libero.it wrote:
> I have some problem with the class THnSparse:
>
> It compiles right but it doesn't
> draw the histogram or when i open it from a .hist file
> it does segmentation
> fault.
>
> I used the following code about the THnSparse:
>
> #include<THnSparse.h>
>
> #include "TArrayI.h"
>
> THnSparseD *h_SumPx_nSparse;
>
> Int_t bins[4]=
> {100,100,100,100};
> // declaration of a THnSparse
> Double_t min[4]={-200.,-200.,-200.,-200.};
>
> Double_t max[4]={200.,200.,200.,200.};
> h_SumPx_nSparse = new
> THnSparseD("h_SumPx_nSparse","h_SumPx_nSparse",4,bins,min,max);
>
>
>
> Double_t
> *SumPx_sparse = new Double_t[4];
>
> for(i=0;i<4;i++)
> {
>
> SumPx_sparse[i]= SumPx; // SumPx is a double variable
> }
>
> h_SumPx_nSparse->Fill(SumPx_sparse,1);
>
>
> TCanvas
> *H1 = new TCanvas("H1","H1",100,10,600,400);
> h_SumPx_nSparse -> Draw();
>
>
> I
> think the problem is the filling but i don't know why.
>
>
> Thanks,
> Davide
>
>
>
Received on Tue Jan 19 2010 - 16:31:12 CET
This archive was generated by hypermail 2.2.0 : Tue Jan 19 2010 - 23:50:02 CET