00001
00078
00079
00080
00081
00082
00083
00084 #ifndef _SCIND_H
00085 #define _SCIND_H
00086
00087 #include <stdio.h>
00088
00090 #include "iocount.h"
00091
00096 namespace sc {
00097
00100 enum scwhat {
00101 HEAD,
00102 DSI,
00103 DESI,
00104 AFLUX,
00105 MOM
00106 } ;
00107
00110 inline int napcomb(int a) { return ((a)*(a)+(a))/2 ; }
00111
00114
00115
00116
00117
00118
00119
00139 const char * apername(int nchan, int index) ;
00140
00141
00155 int ind_seqnum(int nchan, const char * name) ;
00156
00199 void init(int maxndata, int maxnmeas, int nchan) ;
00200
00201
00232 void chan_init(int chan, double bkgr, double deadtime = -1, double nonpois = -1,
00233 count_t * data = 0) ;
00234
00235
00384 void compute(int ndata, int * ncorr, double microexp, bool isgen) ;
00385
00386
00395 int getcurmeas() ;
00396
00397
00407 void again() ;
00408
00409
00423 void done() ;
00424
00472 void writeidx(FILE * f, scwhat what, const char * stamp,
00473 const char * suffix = 0) ;
00474
00475
00521 void avgmatrix(double ** matrix, int ncol, int nrow,
00522 signed char * rowselect, signed char select,
00523 double * avg, double * err2, int lag) ;
00524
00525
00550 void average(bool isgen, int lag) ;
00551
00552
00583 void writeavgidx(FILE * f, scwhat what, bool isgen, const char * stamp) ;
00584
00585
00611 void writeavgflux(FILE * f, scwhat what, bool isgen, const char * stamp,
00612 bool write_nonpois = false) ;
00613
00614
00664 void writemom(FILE * f, scwhat what, const char * stamp,
00665 const char * suffix = 0) ;
00666
00667
00681 double getidx(int meas, scwhat what, int i) ;
00682
00683
00694 double * getidxptr(int meas, scwhat what) ;
00695
00710 double getavgidx(scwhat what, bool isgen, int i) ;
00711
00712
00724 double * getavgidxptr(scwhat what, bool isgen) ;
00725
00737 double geter2idx(scwhat what, bool isgen, int i) ;
00738
00739
00751 double * geter2idxptr(scwhat what, bool isgen) ;
00752
00761 double getmean(bool iscor, int i) ;
00762
00763
00775 double getavgflux(bool isgen, int i) ;
00776
00777
00791 double geter2flux(bool isgen, int i) ;
00792
00793
00803 double getsig(int lag, int i) ;
00804
00805
00871 void stattest(int ndata, double microexp) ;
00872
00873
00874
00983 void statflux(int ndata, int * ncorr, double microexp, int k,
00984 bool isfilt=false, double * nonpois = 0, double * avg = 0, double * er2 = 0) ;
00985
00986
00987
00990 const int DESIBIN = 3 ;
00991
00994 const char IDXFMT[] = "%s%7.4f" ;
00996 const char IDXDLM[] = " " ;
00997
01000 const char FLXFMT[] = "%s%7.2f" ;
01002 const char FLXDLM[] = " " ;
01003
01006 const char MOMFMT[] = "%s%7.0f" ;
01008 const char MOMDLM[] = "\t" ;
01009
01011 const int MODENORM = 0 ;
01013 const int MODEGEN = 1 ;
01015 const int MODENO = -1 ;
01016
01018 const int MAXLAG =0 ;
01019
01020 }
01021
01022 #endif