#ifndef _H2D_H_
 
#define _H2D_H_
 
 
 
 
 
#ifdef _CVI_ 
 
#include <cvidef.h>
 
#include <ivi.h>
 
#include <userint.h>
 
#include "toolbox.h"
 
 
 
#ifndef _HCOLORMAP_
 
#define _HCOLORMAP_ 
 
typedef struct {
 
  ColorMapEntry *array;
 
  int numberofColors;
 
  int HiColor;
 
} HColorMap;
 
#endif
 
 
 
HColorMap _VI_FUNC  *H2D_GetColorMap(void);
 
 
 
#else
 
#define _VI_FUNC
 
#endif
 
 
 
#include <stdio.h>
 
 
 
 
 
 
 
 
 
#ifdef __CINT__
 
#define HALIGN 41
 
#else
 
#define HALIGN 40
 
#endif
 
 
 
 
 
/* 2d histogramming */
 
#define H2DMAX 500 
 
#define H2D_ID 0x10
 
#pragma pack(4)
 
typedef struct {
 
  unsigned int id,len;
 
  unsigned int nx;
 
  unsigned int ny;
 
  int nentries;
 
  unsigned int size;   // 6*4
 
  double min;
 
  double max;
 
  double minx;
 
  double miny;
 
  double stepx;
 
  double stepy;  // 6*8
 
  char name[20];
 
  char title[100];
 
  char titlex[40];
 
  char titley[HALIGN]; // 196
 
  double *data;
 
} H2D;
 
#pragma pack()
 
 
 
double _VI_FUNC H2D_GetYBinCenter(int h2d,int ybin);
 
double _VI_FUNC H2D_GetXBinCenter(int h2d,int xbin);
 
 
 
int _VI_FUNC  H2D_Clear(int h2d);
 
int _VI_FUNC  H2D_Print(int h2d);
 
int _VI_FUNC  H2D_Exist(int h2d);
 
int _VI_FUNC  H2D_CalculateBin(int h2d, int axis, double value);
 
int _VI_FUNC  H2D_GetBin(int h2d,int x, int y);
 
int _VI_FUNC  H2D_Fill(int h2d,double x, double y, double val);
 
int _VI_FUNC  H2D_SetBinContent(int h2d,int x, int y, double val);
 
double _VI_FUNC H2D_GetBinContent(int h2d,int atx, int aty);
 
int _VI_FUNC  H2D_Init(int h2d,const char *name,const char *title,int nx, double minx, double maxx, int ny, double miny, double maxy);
 
int _VI_FUNC  H2D_Write(int h2d,const char *fname,const char*opt);
 
int _VI_FUNC  H2D_Write2File(int h2d,FILE *fp);
 
int _VI_FUNC  H2D_SetTitle(int h2d,const char *title);
 
int _VI_FUNC  H2D_SetTitleX(int h2d,const char *title);
 
int _VI_FUNC  H2D_SetTitleY(int h2d,const char *title);
 
int _VI_FUNC  H2D_SetName(int h2d,const char *title);
 
 
 
int _VI_FUNC  H2D_GetNbinsY(int h);
 
int _VI_FUNC  H2D_GetNbinsX(int h);
 
double _VI_FUNC H2D_GetMinY(int h);
 
double _VI_FUNC H2D_GetMinX(int h);
 
double  _VI_FUNC H2D_GetMaxX(int h);
 
double  _VI_FUNC H2D_GetMaxY(int h);
 
double _VI_FUNC H2D_GetStepY(int h);
 
double _VI_FUNC H2D_GetStepX(int h);
 
double _VI_FUNC H2D_GetMin(int h);
 
double _VI_FUNC H2D_GetMax(int h);
 
double * _VI_FUNC H2D_GetData(int h);
 
 
 
 
 
int _VI_FUNC  H2D_SetRangeColors(double min, double max);
 
int _VI_FUNC  H2D_Draw(int histogram,int panel, int control, int *plothandle);
 
 
 
 
 
#endif /* _H2D_H_ */