00001 #ifndef L2HISTO_h
00002 #define L2HISTO_h
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 class L2Histo {
00015 private:
00016 enum {mxTx=200, version=12};
00017 struct Head {
00018 int ver;
00019 char title[mxTx];
00020 int hid,nBin,nBinX,nBinY;
00021 int nUnder,nOver;
00022 unsigned int dataSize;
00023 } head;
00024 int *data;
00025 char y2c(float val);
00026 void set( int id, const char *tit, int mxBinX, int mxBinY );
00027
00028 public:
00029 L2Histo();
00030
00031
00032 L2Histo( int id, const char *tit, int mxBinX, int mxBinY ) {
00033 set(id, tit,mxBinX ,mxBinY); }
00034 L2Histo( int id, const char *tit, int mxBin) {
00035 set(id, tit, mxBin,1 ); }
00036 void setTitle(const char *tit);
00037
00038 void print( int flag, FILE *fd=stdout);
00039 void printCSV( FILE *fd=stdout);
00040 void fill ( int binX);
00041 void fill ( int binX, int binY);
00042 void fillW( int binX, int w);
00043 void fillW( int binX, int binY, int w);
00044 void write(FILE *fd, int dbg=0);
00045 int read(FILE *fd, int dbg=0);
00046 void reset();
00047 int getNbin(){return head.nBin;}
00048 int getNbinX(){return head.nBinX;}
00049 bool is1D(){return head.nBinY==1;}
00050 bool is2D(){return head.nBinY>1;}
00051 int getId(){return head.hid;}
00052 int getNunder(){return head.nUnder;}
00053 int getNover(){return head.nOver;}
00054 bool findMax( int *iMax, int *iFWHM);
00055 bool findMean( int *iMean, int *iRMS);
00056
00057 void printPed( FILE *fd, int x0, int maxBin,char term='\n');
00058 const int *getData(){ return data; };
00059 const char *getTitle(){ return head.title; }
00060 };
00061
00062
00063 #endif
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088