THnSparse

From: <davidesgalaberna_at_libero.it>
Date: Tue, 19 Jan 2010 16:26:23 +0100


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:26:26 CET

This archive was generated by hypermail 2.2.0 : Tue Jan 19 2010 - 17:50:01 CET