Subversion Repositories f9daq

Rev

Rev 234 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 234 Rev 264
Line 6... Line 6...
6
#  include <string.h>
6
#  include <string.h>
7
#endif /* _CVI_ */
7
#endif /* _CVI_ */
8
 
8
 
9
#include "H2D.h"
9
#include "H2D.h"
10
 
10
 
11
#define H2DMAX 500
-
 
-
 
11
 
12
H2D *h2[H2DMAX];
12
H2D *h2[H2DMAX];
13
//int Printf(char *format, ...);
13
//int Printf(char *format, ...);
14
 
14
 
15
int _VI_FUNC  H2D_Clear(int h2d) {
15
int _VI_FUNC  H2D_Clear(int h2d) {
16
  if (!h2[h2d]) return -1;
16
  if (!h2[h2d]) return -1;
Line 51... Line 51...
51
      xmin= H2D_GetMinY(h);
51
      xmin= H2D_GetMinY(h);
52
      dx = H2D_GetStepY(h);
52
      dx = H2D_GetStepY(h);
53
      break;
53
      break;
54
    default:
54
    default:
55
      return -1;
55
      return -1;
56
  }
56
  }
57
  if (dx<1e-10) return -1;
57
  if (dx<1e-10) return -1;
58
  if (value<xmin) return -1;
58
  if (value<xmin) return -1;
59
  bin = (int)((value-xmin)/dx);
59
  bin = (int)((value-xmin)/dx);
60
  if (bin>=nx) return -1;                                                  
60
  if (bin>=nx) return -1;                                                  
61
  else return bin;
61
  else return bin;
Line 126... Line 126...
126
  h2[h2d]->data = (double *) malloc(h2[h2d]->size);
126
  h2[h2d]->data = (double *) malloc(h2[h2d]->size);
127
  h2[h2d]->len=sizeof(H2D)-sizeof(double *)+h2[h2d]->size;
127
  h2[h2d]->len=sizeof(H2D)-sizeof(double *)+h2[h2d]->size;
128
  H2D_Clear(h2d);
128
  H2D_Clear(h2d);
129
  H2D_Print(h2d);
129
  H2D_Print(h2d);
130
//Printf("InitH2D 0x%x\n", h2d );
130
//Printf("InitH2D 0x%x\n", h2d );
131
  return  0;
131
  return  h2d;
132
}
132
}
133
 
133
 
134
double _VI_FUNC  H2D_GetXBinCenter(int h2d,int xbin) {
134
double _VI_FUNC  H2D_GetXBinCenter(int h2d,int xbin) {
135
  return h2[h2d]->minx+(xbin+0.5)*h2[h2d]->stepx;
135
  return h2[h2d]->minx+(xbin+0.5)*h2[h2d]->stepx;
136
}
136
}