4 #include "tpxFCF_flags.h"
7 #define FCF_ADC_NOISE 4
8 #define FCF_ADC_MIN 4 // we additionally can kill 1d sequences where the maximum is below this
9 #define FCF_MIN_WIDTH 1
10 #define FCF_MIN_ADC_PAD_C 180
14 #define TPC_GG_OPEN 22
15 #define TPC_FF_CLOSE 380
18 #define FCF_MAX_CL 64 // max 1D clusters per pad
21 #define FCF_V_FY08 0x0000 // used in the FY08 run; has the /32 "bug"
22 #define FCF_V_FY09 0x0001 // /32 bug fixed
24 #define FCF_2D_V_FY13 0x1000 // first version of FCF_2D!
30 #define FCF_DO_DOUBLE // timebins, pads, averages are double instead of u_int
35 typedef float fcf_type;
41 typedef int fcf_short ;
43 typedef short fcf_short ;
76 unsigned short track_id ;
92 void config(
unsigned int rb_mask,
int modes=0,
int rows=0,
unsigned char *rowlen=0) ;
95 void apply_gains(
int sector,
tpxGain *gains) ;
100 int stage2(
unsigned int *outbuff,
int max_bytes) ;
105 char run_compatibility ;
109 static int fcf_decode(
unsigned int *p_buff,
daq_cld *dc,
unsigned short version=0) ;
110 static int fcf_decode(
unsigned int *p_buff,
daq_sim_cld *sdc,
unsigned short version=0) ;
111 static int afterburner(
int cou,
daq_cld *store[]) ;
112 static char *fcf_flags(u_char flags) ;
115 void config2(
int sec,
int rdo,
int modes=0,
int rows=0,
unsigned char *rowlen=0) ;
116 void apply_gains2(
tpxGain *gains) ;
117 void start_evt2(
int sec1,
int rdo1) ;
118 void set_id(
int id) {
124 const char *GetCVS()
const {
125 static const char cvs[]=
"Tag $Name: $: $Id: tpxFCF.h,v 1.18 2016/01/12 16:20:23 tonko Exp $: built " __DATE__
" " __TIME__ ;
return cvs;
132 inline int is_pad_valid(
int row,
int pad)
136 if(ss->f & FCF_KILLED_PAD)
return 0 ;
140 inline void event_debug()
142 for(
int r=1;r<=row_count;r++) {
143 if(gain_storage[sector-1][r] == 0) continue ;
145 for(
int p=1;p<=tpx_rowlen[r];p++) {
148 stage1 *s1 = get_working(r,p) ;
150 LOG(TERR,
"S %2d: RP %d:%d : gain %f, t0 %f, flags 0x%X, count %d",sector,
151 r,p,ss->g,ss->t0,ss->f,s1->count) ;
158 unsigned char *tpx_rowlen ;
173 if(gain_storage[s][row]==0)
return 0 ;
175 return gain_storage[s][row] + (pad-1) ;
182 unsigned int *loc_buff ;
184 int cur_row_clusters ;
193 unsigned short count ;
201 struct stage1 *storage ;
205 inline struct stage1 *get_stage1(
int row,
int pad)
207 if(row_ix[row] < 0)
return 0 ;
209 return storage + row_ix[row] + (pad-1) ;
221 static const int max_tot_count = 2000 ;
225 struct stage1 *working_storage[24][256] ;
227 inline struct stage1 *get_working(
int row,
int pad)
232 if(working_storage[s][row]==0) {
233 int bytes = tpx_rowlen[row] *
sizeof(stage1) ;
235 working_storage[s][row] = (stage1 *) valloc(bytes) ;
238 return working_storage[s][row] + (pad-1) ;
243 unsigned int do_version ;
244 unsigned int read_version ;