Problem with 2-dim array

I have the following problem.

I have created tree (tr_inv) with some branches. One of these branches (ph_m) is branch which contain 2-dim arrays. When I try to display this branch by using method Draw(): tr_inv->Draw(“ph_m”); it gives me wrong picture. But If instead I type tr_inv->Draw(“ph_m[1][2]”) it works correctly.

I want ROOT to display me Histogram of all entries of ph_m. By the way in case of 1-dim array this problem does not appear.

Thanks in advance, P.

Show here how you define the “ph_m” array in your c++ source code and how you define the tree branch (which “encapsulates” it).
Also, which ROOT version exactly and on what operating system and compiler are you using.

ROOT 6.06/02
Linux, gcc;

	 Float_t ph_m[5][5]
	  ...
	TTree *tr_inv = new TTree("tr_inv", "invariant_mass");
          tr_inv->Branch("pi_m", &pi_m, "pi_m/F");
          tr_inv->Branch("ph_m", &ph_m, "ph_m[5][5]/F");
          ...

P.S. About compiler : I use root ==> .L name.cpp

The same thing if I use StartViewer() or TBrowser() methods.

Hi,

Can you show how the result you get is not what you expect?

Cheers, Axel.

Try with:

Check root.cern.ch/root/htmldoc/guide … planations

This is what I expect:
right_pic.pdf (14 KB)

And This is what I got

By the way, Number of entries for example is right but it is clear that Histo is totally wrong.
wrong_pic.pdf (14.1 KB)

[quote=“ferhue”]Try with:

Check root.cern.ch/root/htmldoc/guide … planations[/quote]

Does not work how you can see.

It seems you have huge values somewhere, of the order of 4e26, which you need to get rid of.
Try:
TH1D *h = new TH1D(“h”, “h”, 100, 0, 1e7);
tr_inv->Draw(“ph_m >> h”);
or add a cut.

[quote=“Pepe Le Pew”]It seems you have huge values somewhere, of the order of 4e26, which you need to get rid of.
Try:
TH1D *h = new TH1D(“h”, “h”, 100, 0, 1e7);
tr_inv->Draw(“ph_m >> h”);
or add a cut.[/quote]
Do not sure you right. You can see that if I draw just sum of array it works without any “singularities”.

No, I think you did not plot the sum of arrays.

If your title is correct, you forgot to sum for example element [0][0]. The “singularity” should be in one of the elements you did not sum.

OK. I think I have an idea what is this problem caused by. I have declared ph_m as 2-dim array but do not initialized every ph_m[i][j], and etc. In other words, I do not differentiate [i][j] and [j][i] and do not fill ph_m[k][k].

Whatever thank you for your replies.

[quote=“ferhue”]No, I think you did not plot the sum of arrays.

If your title is correct, you forgot to sum for example element [0][0]. The “singularity” should be in one of the elements you did not sum.[/quote]

Yes, You are right. I did not see your message when I wrote my last reply. Thx.