00001 #ifndef _DAQ100_DECISION_H_
00002 #define _DAQ100_DECISION_H_
00003
00004 #include <daqModes.h>
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 extern inline int daq100Decision(int t, u_int daq_cmd, u_int run_type, u_int cl_run, u_int zero_wr)
00015 {
00016 int fmt, proc, hlt ;
00017
00018 proc = 0 ;
00019 fmt = 0 ;
00020 hlt = 0 ;
00021
00022 if(run_type == RUN_TYPE_DAQCHECK) return 1 ;
00023 if((t <= 0) || (t>=4096)) return 1 ;
00024
00025
00026 if(run_type != RUN_TYPE_PED) {
00027 if(cl_run == 0) proc = 0 ;
00028 else if((t % cl_run)==0) proc = 1 ;
00029
00030
00031
00032 }
00033
00034
00035 if(daq_cmd & DAQCMD_FMT_ONLY) {
00036 fmt = 1 ;
00037 }
00038 else {
00039 if(zero_wr == 0) fmt = 0 ;
00040 else if((t % zero_wr)==0) fmt = 1 ;
00041 }
00042
00043
00044
00045 switch(run_type) {
00046 case RUN_TYPE_PULSER :
00047
00048 fmt = 1 ;
00049 break ;
00050 }
00051
00052
00053
00054
00055 if(run_type == RUN_TYPE_PHYS) {
00056 if(proc) hlt = 1 ;
00057 }
00058
00059 return (hlt << 2) | (proc << 1) | fmt ;
00060
00061 }
00062
00063 #endif