Hello,
I have a tree from which I need to fill a 2-d histogram.
This is the tree content:
tree->Scan();
[ul][color=darkblue]
- Row * nsensor * temp *
-
0 * 1 * 25.799999 *
-
1 * 2 * 26.799999 *
-
2 * 3 * 25.700000 *
-
3 * 4 * 23.899999 *
-
4 * 5 * 25.299999 *
-
5 * 6 * 24.100000 *
-
6 * 7 * 24.600000 *
-
7 * 8 * 25.100000 *
-
8 * 9 * 24.899999 *
-
9 * 10 * 23.899999 *
[/color][/ul]
So, if you look at the “nsensor” variable, you’ll see that it assumes integer values from 1 to 10.
I project the contents of the tree in a histogram:
TH2F* h2 = new TH2F("h2","Temperature",12,0.,12.,50,22.,28.);
tree->Project("h2","temp:nsensor");
h2->SetMarkerStyle(28);
h2->Draw();
and this is what I get:
Now, the values on the x axis should correspond to the (integer) values of nsensor, while they do not.
So I assume I am not doing the right thing. What should I do instead?
Maybe use TGraph? Then, how?
I can add that if I simply [color=green]tree->Draw(“temp:nsensor”)[/color], the plot looks correct.
Thanks for any help you can give me!