Rev 248 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 248 | Rev 264 | ||
---|---|---|---|
Line 8... | Line 8... | ||
8 | 8 | ||
9 | #include "H3D.h" |
9 | #include "H3D.h" |
10 | #include "H2D.h" |
10 | #include "H2D.h" |
11 | #include "H1D.h" |
11 | #include "H1D.h" |
12 | 12 | ||
13 | #define H3DMAX 500 |
- | |
- | 13 | ||
14 | H3D *h3[H3DMAX]; |
14 | H3D *h3[H3DMAX]; |
15 | //int Printf(char *format, ...); |
15 | //int Printf(char *format, ...); |
16 | 16 | ||
17 | int _VI_FUNC H3D_Clear(int h3d) { |
17 | int _VI_FUNC H3D_Clear(int h3d) { |
18 | if (!h3[h3d]) return -1; |
18 | if (!h3[h3d]) return -1; |
Line 167... | Line 167... | ||
167 | printf("3D Histogram %d does not exist!\n",histogram); |
167 | printf("3D Histogram %d does not exist!\n",histogram); |
168 | return -1; |
168 | return -1; |
169 | } |
169 | } |
170 | 170 | ||
171 | int hid=499; |
171 | int hid=499; |
- | 172 | int i=0; |
|
- | 173 | int j=0; |
|
172 | switch (direction){ |
174 | switch (direction){ |
173 | case 0:// xy |
175 | case 0:// xy |
174 | H2D_Init(hid,"projectionXY","projectionXY", |
176 | H2D_Init(hid,"projectionXY","projectionXY", |
175 | H3D_GetNbinsX(histogram), H3D_GetMinX(histogram),H3D_GetMaxX(histogram), |
177 | H3D_GetNbinsX(histogram), H3D_GetMinX(histogram),H3D_GetMaxX(histogram), |
176 | H3D_GetNbinsY(histogram), H3D_GetMinY(histogram),H3D_GetMaxY(histogram) |
178 | H3D_GetNbinsY(histogram), H3D_GetMinY(histogram),H3D_GetMaxY(histogram) |
177 | ); |
179 | ); |
178 | for ( |
180 | for (i=0; i < H3D_GetNbinsX(histogram); i++ ) |
179 | for ( |
181 | for (j=0; j < H3D_GetNbinsY(histogram); j++ ) |
180 | H2D_SetBinContent(hid,i,j,H3D_GetBinContent(histogram,i,j,slice)); |
182 | H2D_SetBinContent(hid,i,j,H3D_GetBinContent(histogram,i,j,slice)); |
181 | break; |
183 | break; |
182 | case 1:// xz |
184 | case 1:// xz |
183 | H2D_Init(hid,"projectionXZ","projectionXZ", |
185 | H2D_Init(hid,"projectionXZ","projectionXZ", |
184 | H3D_GetNbinsX(histogram), H3D_GetMinX(histogram),H3D_GetMaxX(histogram), |
186 | H3D_GetNbinsX(histogram), H3D_GetMinX(histogram),H3D_GetMaxX(histogram), |
185 | H3D_GetNbinsZ(histogram), H3D_GetMinZ(histogram),H3D_GetMaxZ(histogram) |
187 | H3D_GetNbinsZ(histogram), H3D_GetMinZ(histogram),H3D_GetMaxZ(histogram) |
186 | ); |
188 | ); |
187 | for ( |
189 | for (i=0; i < H3D_GetNbinsX(histogram); i++ ) |
188 | for ( |
190 | for (j=0; j < H3D_GetNbinsZ(histogram); j++ ) |
189 | H2D_SetBinContent(hid,i,j,H3D_GetBinContent(histogram,i,slice,j)); |
191 | H2D_SetBinContent(hid,i,j,H3D_GetBinContent(histogram,i,slice,j)); |
190 | break; |
192 | break; |
191 | case 2:// yz |
193 | case 2:// yz |
192 | default: |
194 | default: |
193 | H2D_Init(hid,"projectionYZ","projectionYZ", |
195 | H2D_Init(hid,"projectionYZ","projectionYZ", |
194 | H3D_GetNbinsY(histogram), H3D_GetMinY(histogram),H3D_GetMaxY(histogram), |
196 | H3D_GetNbinsY(histogram), H3D_GetMinY(histogram),H3D_GetMaxY(histogram), |
195 | H3D_GetNbinsZ(histogram), H3D_GetMinZ(histogram),H3D_GetMaxZ(histogram) |
197 | H3D_GetNbinsZ(histogram), H3D_GetMinZ(histogram),H3D_GetMaxZ(histogram) |
196 | ); |
198 | ); |
197 | for ( |
199 | for (i=0; i < H3D_GetNbinsY(histogram); i++ ) |
198 | for ( |
200 | for (j=0; j < H3D_GetNbinsZ(histogram); j++ ) |
199 | H2D_SetBinContent(hid,i,j,H3D_GetBinContent(histogram,slice,i,j)); |
201 | H2D_SetBinContent(hid,i,j,H3D_GetBinContent(histogram,slice,i,j)); |
200 | 202 | ||
201 | break; |
203 | break; |
202 | } |
204 | } |
203 | return hid; |
205 | return hid; |