Rev 209 | Rev 248 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 209 | Rev 221 | ||
|---|---|---|---|
| Line 144... | Line 144... | ||
| 144 | 144 | ||
| 145 | h3[h3d]->minx = minx; |
145 | h3[h3d]->minx = minx; |
| 146 | h3[h3d]->miny = miny; |
146 | h3[h3d]->miny = miny; |
| 147 | h3[h3d]->minz = minz; |
147 | h3[h3d]->minz = minz; |
| 148 | 148 | ||
| 149 | h3[h3d]->stepx = (nx>1)?(maxx-minx)/(nx |
149 | h3[h3d]->stepx = (nx>1)?(maxx-minx)/(nx):0; |
| 150 | h3[h3d]->stepy = (nx>1)?(maxy-miny)/(ny |
150 | h3[h3d]->stepy = (nx>1)?(maxy-miny)/(ny):0; |
| 151 | h3[h3d]->stepz = (nx>1)?(maxz-minz)/(nz |
151 | h3[h3d]->stepz = (nx>1)?(maxz-minz)/(nz):0; |
| 152 | 152 | ||
| 153 | h3[h3d]->size = h3[h3d]->nx*h3[h3d]->ny*h3[h3d]->nz*sizeof(double); |
153 | h3[h3d]->size = h3[h3d]->nx*h3[h3d]->ny*h3[h3d]->nz*sizeof(double); |
| 154 | h3[h3d]->data = (double *) malloc(h3[h3d]->size); |
154 | h3[h3d]->data = (double *) malloc(h3[h3d]->size); |
| 155 | h3[h3d]->len=sizeof(H3D)-sizeof(double *)+h3[h3d]->size; |
155 | h3[h3d]->len=sizeof(H3D)-sizeof(double *)+h3[h3d]->size; |
| 156 | H3D_Clear(h3d); |
156 | H3D_Clear(h3d); |
| Line 202... | Line 202... | ||
| 202 | } |
202 | } |
| 203 | return hid; |
203 | return hid; |
| 204 | } |
204 | } |
| 205 | 205 | ||
| 206 | double _VI_FUNC H3D_GetMaxX(int h){ |
206 | double _VI_FUNC H3D_GetMaxX(int h){ |
| 207 | return h3[h]->minx+(h3[h]->nx |
207 | return h3[h]->minx+(h3[h]->nx)*h3[h]->stepx; |
| 208 | } |
208 | } |
| 209 | 209 | ||
| 210 | double _VI_FUNC H3D_GetMaxY(int h){ |
210 | double _VI_FUNC H3D_GetMaxY(int h){ |
| 211 | return h3[h]->miny+(h3[h]->ny |
211 | return h3[h]->miny+(h3[h]->ny)*h3[h]->stepy; |
| 212 | } |
212 | } |
| 213 | 213 | ||
| 214 | double _VI_FUNC H3D_GetMaxZ(int h){ |
214 | double _VI_FUNC H3D_GetMaxZ(int h){ |
| 215 | return h3[h]->minz+(h3[h]->nz |
215 | return h3[h]->minz+(h3[h]->nz)*h3[h]->stepz; |
| 216 | } |
216 | } |
| 217 | 217 | ||
| 218 | double _VI_FUNC H3D_GetXBinCenter(int h3d,int xbin) { |
218 | double _VI_FUNC H3D_GetXBinCenter(int h3d,int xbin) { |
| 219 | return h3[h3d]->minx+xbin*h3[h3d]->stepx; |
219 | return h3[h3d]->minx+(xbin+0.5)*h3[h3d]->stepx; |
| 220 | } |
220 | } |
| 221 | 221 | ||
| 222 | double _VI_FUNC H3D_GetYBinCenter(int h3d,int ybin) { |
222 | double _VI_FUNC H3D_GetYBinCenter(int h3d,int ybin) { |
| 223 | return h3[h3d]->miny+ybin*h3[h3d]->stepy; |
223 | return h3[h3d]->miny+(ybin+0.5)*h3[h3d]->stepy; |
| 224 | } |
224 | } |
| 225 | 225 | ||
| 226 | double _VI_FUNC H3D_GetZBinCenter(int h3d,int zbin) { |
226 | double _VI_FUNC H3D_GetZBinCenter(int h3d,int zbin) { |
| 227 | return h3[h3d]->minz+zbin*h3[h3d]->stepz; |
227 | return h3[h3d]->minz+(zbin+0.5)*h3[h3d]->stepz; |
| 228 | } |
228 | } |
| 229 | 229 | ||
| 230 | 230 | ||
| 231 | int _VI_FUNC H3D_Write2File(int h3d,FILE *fp) { |
231 | int _VI_FUNC H3D_Write2File(int h3d,FILE *fp) { |
| 232 | 232 | ||
| Line 390... | Line 390... | ||
| 390 | 390 | ||
| 391 | 391 | ||
| 392 | 392 | ||
| 393 | if (H3D_GetNbinsY(histogram)==1|| H3D_GetNbinsX(histogram)==1) { |
393 | if (H3D_GetNbinsY(histogram)==1|| H3D_GetNbinsX(histogram)==1) { |
| 394 | if (H3D_GetNbinsY(histogram)==1) { |
394 | if (H3D_GetNbinsY(histogram)==1) { |
| 395 | H1D_Init(499,"projection","projection", H3D_GetNbinsX(histogram), H3D_GetMinX(histogram), |
395 | H1D_Init(499,"projection","projection", H3D_GetNbinsX(histogram), H3D_GetMinX(histogram),H3D_GetMaxX(histogram)); |
| 396 | for (int i=0; i < H3D_GetNbinsX(histogram); i++ ) H1D_SetBinContent(499,i,H3D_GetBinContent(histogram,i,0,slice)); |
396 | for (int i=0; i < H3D_GetNbinsX(histogram); i++ ) H1D_SetBinContent(499,i,H3D_GetBinContent(histogram,i,0,slice)); |
| 397 | } else { |
397 | } else { |
| 398 | H1D_Init(499,"projection","projection", H3D_GetNbinsY(histogram), H3D_GetMinY(histogram), |
398 | H1D_Init(499,"projection","projection", H3D_GetNbinsY(histogram), H3D_GetMinY(histogram),H3D_GetMaxY(histogram)); |
| 399 | for (int i=0; i < H3D_GetNbinsY(histogram); i++ ) H1D_SetBinContent(499,i,H3D_GetBinContent(histogram,0,i,slice)); |
399 | for (int i=0; i < H3D_GetNbinsY(histogram); i++ ) H1D_SetBinContent(499,i,H3D_GetBinContent(histogram,0,i,slice)); |
| 400 | } |
400 | } |
| 401 | H1D_Draw(499, panel, control, plothandle); |
401 | H1D_Draw(499, panel, control, plothandle); |
| 402 | } else { |
402 | } else { |
| 403 | 403 | ||
| Line 407... | Line 407... | ||
| 407 | H3D_GetSliceXYData(histogram, slice), |
407 | H3D_GetSliceXYData(histogram, slice), |
| 408 | H3D_GetNbinsX(histogram), |
408 | H3D_GetNbinsX(histogram), |
| 409 | H3D_GetNbinsY(histogram), |
409 | H3D_GetNbinsY(histogram), |
| 410 | VAL_DOUBLE, |
410 | VAL_DOUBLE, |
| 411 | H3D_GetStepY(histogram), |
411 | H3D_GetStepY(histogram), |
| 412 |
|
412 | H3D_GetYBinCenter(histogram,0), |
| 413 | H3D_GetStepX(histogram), |
413 | H3D_GetStepX(histogram), |
| 414 |
|
414 | H3D_GetXBinCenter(histogram,0), |
| 415 | colormap->array, |
415 | colormap->array, |
| 416 | colormap->HiColor, |
416 | colormap->HiColor, |
| 417 | colormap->numberofColors, 1, 0); |
417 | colormap->numberofColors, 1, 0); |
| 418 | } |
418 | } |
| 419 | ProcessSystemEvents (); |
419 | ProcessSystemEvents (); |