ca2004
March 23, 2010, 1:51pm
1
Hi,
I am plotting a data file using TGraph2D:
TGraph2D *g = new TGraph2D("resultado.dat");
g->Draw("surf1z");
gStyle->SetPalette(1.);
and I am getting a graph with a peak value of approximately 20000 (this is consistent with the highest value in the data file).
But when I set the parameters SetNpx and SetNpy:
g->SetNpx(14.);
g->SetNpy(14.);
The peak value is approximately 12000, using the same data file.
anyone knows what is happening ??, I wish your help.
Thanks
Manuel
P. S: Anyone knows how to load an image in this forum.
couet
March 23, 2010, 2:14pm
2
Which ROOT version are you using ?
This should be fixed now …
ca2004
March 23, 2010, 2:20pm
3
I use the ROOT Version 5.26/00 14 December 2009
couet
March 23, 2010, 2:25pm
4
That’s quite recent.
Can you send an example showing the problem ?
ca2004
March 23, 2010, 2:30pm
5
In this case, I need to send an image, but I don’t know how to load an image in this forum.
Do you know??
couet
March 23, 2010, 2:32pm
6
I do not need an image I need a macro (with may be a data file) reproducing the problem.
ca2004
March 23, 2010, 2:47pm
7
well,
I use the code:
[code] TGraph2D *g = new TGraph2D(“resultado.dat”);
g->SetTitle(“Fonte simulada”);
g->GetXaxis()->SetTitle(“Pixel-X”);
g->GetXaxis()->CenterTitle();
g->GetXaxis()->SetTitleOffset(1.5);
g->GetXaxis()->SetNdivisions(13.);
g->GetYaxis()->SetTitle(“Pixel-Y”);
g->GetYaxis()->CenterTitle();
g->GetYaxis()->SetTitleOffset(1.5);
g->GetYaxis()->SetNdivisions(13.);
g->GetZaxis()->SetTitle(“Contagem”);
g->GetZaxis()->CenterTitle();
g->GetZaxis()->SetTitleOffset(1.4);
g->Draw(“surf1z”);
gStyle->SetPalette(1.);
[/code]
where the data file “resultado.dat” is :
1 1 221
2 1 159
3 1 5
4 1 257
5 1 125
6 1 -53
7 1 -33
8 1 -111
9 1 -121
10 1 -41
11 1 -149
12 1 -187
13 1 -109
1 2 175
2 2 -21
3 2 -43
4 2 31
5 2 165
6 2 -297
7 2 -175
8 2 -73
9 2 -185
10 2 -129
11 2 -59
12 2 149
13 2 233
1 3 81
2 3 25
3 3 135
4 3 131
5 3 -1
6 3 -81
7 3 -105
8 3 121
9 3 -25
10 3 211
11 3 109
12 3 9
13 3 37
1 4 19
2 4 123
3 4 -135
4 4 229
5 4 37
6 4 -39
7 4 25
8 4 65
9 4 -81
10 4 91
11 4 171
12 4 -305
13 4 -189
1 5 127
2 5 65
3 5 -155
4 5 -135
5 5 185
6 5 3
7 5 207
8 5 -21
9 5 95
10 5 83
11 5 137
12 5 -61
13 5 -111
1 6 125
2 6 -55
3 6 -27
4 6 5
5 6 -7
6 6 133
7 6 41
8 6 -65
9 6 -243
10 6 75
11 6 -207
12 6 99
13 6 -127
1 7 -17
2 7 -303
3 7 -93
4 7 -135
5 7 19
6 7 -37
7 7 21711
8 7 245
9 7 -53
10 7 -53
11 7 149
12 7 21
13 7 229
1 8 -107
2 8 -341
3 8 49
4 8 -75
5 8 159
6 8 -79
7 8 39
8 8 29
9 8 -71
10 8 127
11 8 -173
12 8 37
13 8 -63
1 9 79
2 9 -3
3 9 -73
4 9 123
5 9 -117
6 9 113
7 9 203
8 9 9
9 9 75
10 9 325
11 9 71
12 9 -97
13 9 -97
1 10 79
2 10 243
3 10 -179
4 10 23
5 10 189
6 10 -139
7 10 125
8 10 93
9 10 1
10 10 -209
11 10 -129
12 10 -183
13 10 205
1 11 9
2 11 165
3 11 55
4 11 -225
5 11 139
6 11 -185
7 11 -89
8 11 -153
9 11 115
10 11 89
11 11 75
12 11 215
13 11 221
1 12 5
2 12 -151
3 12 -117
4 12 155
5 12 41
6 12 -199
7 12 -91
8 12 37
9 12 -93
10 12 -123
11 12 -101
12 12 -93
13 12 -75
1 13 -131
2 13 129
3 13 11
4 13 -27
5 13 -3
6 13 -71
7 13 -249
8 13 139
9 13 -149
10 13 121
11 13 15
12 13 -59
13 13 189
I am getting a graph with a peak value of approximately 20000, consistent with the highest value in the data file.
But when I add the parameters to the code above:
g->SetNpx(14.);
g->SetNpy(14.);
The highest value of the peak in the graph changes, now is the approximately 12000 and I don`t know what is happening.
couet
March 23, 2010, 2:59pm
8
What you see is normal.
When you plot using the option surf1 you are not plotting the graph2d directly but an histogram filled according to the triangle sitting above each bin.
Going to less bin you are losing precision and some triangle are not use. Specially in region which high gradient like peaks.
To plot the graph2d directly use the TRI, TRI1 … etc options
ca2004
March 23, 2010, 3:57pm
9
Thank you very much, your suggestion work…
Manuel