00001
00002
00003
00004
00005
00006
00007 #ifndef _FCF_CLASS_OLD_EVP_HH_
00008 #define _FCF_CLASS_OLD_EVP_HH_
00009
00010
00011
00012
00013
00014
00015 #define FCF_ONEPAD 1
00016 #define FCF_DOUBLE_PAD 2
00017 #define FCF_DOUBLE_T 4
00018 #define FCF_FALLING 8
00019 #define FCF_ROW_EDGE 16 // touched end of row
00020 #define FCF_BROKEN_EDGE 32 // touches one of the mezzanine edges
00021 #define FCF_DEAD_EDGE 64 // touches a dead pad
00022 #define FCF_IGNORE 128
00023
00024
00025 #define FCF_PARAM1 2 // was 2
00026 #define FCF_MIN_ADC_T 3 // was 3
00027 #define FCF_MIN_ADC_PAD 12 // was 12
00028
00029
00030 #define FCF_GAIN_SHIFT 6 // shift left/righ
00031 #define FCF_GAIN_FACTOR (1<<FCF_GAIN_SHIFT) // 64!!!
00032
00033
00034 #define FCF_WORDS_PER_CLUSTER 2
00035
00036
00037
00038 #if defined(__unix) || defined(__ROOT__)
00039
00040 typedef unsigned int u_int;
00041 typedef unsigned short u_short;
00042 typedef unsigned char u_char;
00043
00044 #define FCF_SIM_ON
00045
00046 #else
00047
00048 #ifdef FCF_ANNOTATE_CLUSTERS
00049 #undef FCF_ANNOTATE_CLUSTERS
00050 #endif
00051
00052 #ifdef FCF_DEBUG_OUTPUT
00053 #undef FCF_DEBUG_OUTPUT
00054 #endif
00055
00056 #ifdef FCF_SIM_ON
00057 #undef FCF_SIM_ON
00058 #endif
00059
00060 #endif
00061
00062 namespace OLDEVP {
00063
00064
00065 struct fcfPixAnnotate {
00066 u_short adc ;
00067 u_short cl_id ;
00068 u_short id_simtrk ;
00069 u_short res ;
00070 } ;
00071
00072
00073
00074 struct FcfSimOutput {
00075 short id_simtrk;
00076 short id_quality;
00077 short cl_id ;
00078 short reserved;
00079 };
00080
00081
00082 #ifdef FCF_ANNOTATE_CLUSTERS
00083 #ifndef FCF_SIM_ON
00084 #define FCF_SIM_ON
00085 #endif
00086
00087 #ifndef __ROOT__
00088
00089 extern struct fcfPixAnnotate fcfPixA[45][182][512] ;
00090
00091 #else
00092 extern struct fcfPixAnnotate pixStruct[183][512] ;
00093
00094 #endif
00095
00096 #endif
00097
00098
00099 class fcfClass {
00100 public:
00101
00102 fcfClass(int det, u_short *table = NULL) ;
00103
00104
00105
00106
00107 int detector ;
00108 u_int maxTimebin ;
00109 u_int maxCPP ;
00110
00111
00112 u_int svtPedestal ;
00113 u_int timebinLo ;
00114 u_int timebinHi ;
00115 u_int chargeMin ;
00116
00117
00118 u_int deconTime ;
00119 u_int deconPad ;
00120
00121 u_int doCuts ;
00122
00123 int param1 ;
00124 int minAdcT ;
00125 int minAdcPad ;
00126
00127
00128 int row ;
00129 int padStart ;
00130 int padStop ;
00131 int padMax ;
00132
00133 u_int *adcOff ;
00134 u_short *cppOff ;
00135 u_int maxClusters ;
00136
00137 short *simIn;
00138 u_int *simOut;
00139
00140
00141 int *t0Corr ;
00142
00143
00144 u_int *gainCorr ;
00145
00146 u_short *startFlags ;
00147
00148
00149 int sb ;
00150 int rb ;
00151 int mz ;
00152
00153
00154
00155 int finder(u_char *adcin, u_short *cppin, u_int *outres) ;
00156
00157
00158 inline int saveRes(struct fcfResx *res_p[], int cou, u_int *output) ;
00159 void set8to10(u_short *extTable) ;
00160
00161 private:
00162 struct fcfResx *resx[2][512] ;
00163
00164 u_short *a8to10 ;
00165 int noADCconversion ;
00166
00167
00168 u_short adc8to10_storage[256] ;
00169
00170 u_int chargeMinCorrect ;
00171 } ;
00172
00173
00174
00175
00176 struct fcfHit {
00177 u_short pad ;
00178 u_short tm ;
00179 u_short f ;
00180 u_short c ;
00181 u_short p1,p2,t1,t2 ;
00182 short id_simtrk;
00183 short id_quality;
00184 short cl_id ;
00185 } ;
00186
00187
00188 class fcfAfterburner {
00189 enum {kMax_fcfHit = 200};
00190 public:
00191 fcfAfterburner();
00192 ~fcfAfterburner() { ; } ;
00193
00194 int burn(u_int *ptr_res[3], u_int *ptr_simu_res[3] = NULL) ;
00195 int next(fcfHit *out) ;
00196 int compare(u_int *p1[3], u_int *p2[3]) ;
00197
00198 void decode(u_int *data, fcfHit *h, u_int *sim = 0) ;
00199 void print_hit(char *, fcfHit *hit) ;
00200
00201 u_int do_swap ;
00202 u_int do_merge ;
00203 u_int do_cuts ;
00204 u_int row ;
00205
00206 void setVerbose(bool v) { verbose = v; };
00207 private :
00208 bool verbose;
00209
00210 u_int last_n, last_i, last_count, last_stage ;
00211 u_int **ptr ;
00212 u_int **ptr_simu ;
00213
00214 u_int edge[4] ;
00215 struct fcfHit broken[4][kMax_fcfHit] ;
00216 u_int cou_broken[4] ;
00217
00218 int output(fcfHit *l) ;
00219 int check_merge(fcfHit *l, fcfHit *r) ;
00220 } ;
00221 }
00222 using namespace OLDEVP;
00223 #endif