TH1 definition

hi,
I need to define a 2D array of Histograms TH1 and to fill them inside a loop:
declaration:

" TH1F * histo[x][y]. "

then I define the TH’s in a dedicated loop :


for (loops over i , j )
name_histo[ i ][ j ]=newTH1F(”","",int nbin,int a,int b);
[…filing histo…]
"
I think it works cous I print the canvas in a .gif file and it shows the histos Drawn just the way I want BUT they are EMPTY!!!
I think the problem in inside […] where i fill the Histos.
I try to do it using :

a) histo-name[i][j]->Draw(“variable_to _put_in_the_histo>>name_histo[][]”);

b) double var = inputfile->GetVariable();
histo_name[i][j]->Fill(var);

but i get always empty histos.

anyone can help me?thanks

Hi Andreap85,

Can you post a working version of your macro that we can try to run ourselves and see where it goes wrong?

Joe

thanks Joe, I solved the problem!
the condition of the loop were wrong so at the moment of filling histograms in the last turn of the loop it filled the dimension “n+1” of the array[n]!!! that obviously do not exist

thanks again for interest :wink:

Andrea

Also, in the future try posting in the ROOT support forum - this one is meant for fun not necessarily for help with issues, better chance of getting help over there.

ok tnks
8)