00001 #ifndef StRTSClientFCFMaker_H
00002 #define StRTSClientFCFMaker_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 #include <StMaker.h>
00078 #include "tables/St_raw_sec_m_Table.h"
00079 #include "tables/St_raw_pad_Table.h"
00080 #include "tables/St_raw_row_Table.h"
00081 #include "tables/St_raw_seq_Table.h"
00082 #include "tables/St_tcl_tphit_Table.h"
00083 #include "tables/St_type_shortdata_Table.h"
00084 #include <St_DataSet.h>
00085
00086 #include <fcfClass.hh>
00087
00088 #define FCF_MAX_PADS_EVER 256
00089 #define FCF_MAX_TIMEBINS_EVER 512
00090 #define FCF_MAX_CLUSTERS 6000
00091
00092 #define FCF_MAX_PADROWS 45
00093 #define FCF_MAX_PADS 184
00094 #define FCF_MAX_SEQ 32
00095
00096 class St_tss_tsspar;
00097 class StEvent;
00098 class StTpcCoordinateTransform;
00099 class StTpcHitCollection;
00100 typedef u_int* j_uintptr;
00101
00102 struct croat_out_s {
00103 u_int v[45][(FCF_MAX_CLUSTERS + 2) * 2];
00104 };
00105 struct daq_out_s {
00106 u_int v[6][3][(FCF_MAX_CLUSTERS + 2) * 2 * 6];
00107 };
00108 struct resptr_s {
00109 j_uintptr v[45][3];
00110 };
00111
00112 typedef croat_out_s croat_out_t;
00113 typedef daq_out_s daq_out_t;
00114 typedef resptr_s resptr_t;
00115
00116 struct t0_corr_s {
00117 int v[24][45][FCF_MAX_PADS_EVER+1];
00118 };
00119 struct gain_corr_s {
00120 u_int v[24][45][FCF_MAX_PADS_EVER+1];
00121 };
00122
00123 typedef t0_corr_s t0_corr_t;
00124 typedef gain_corr_s gain_corr_t;
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149 struct StDaqClfcpp {
00150 unsigned short start_bin;
00151 unsigned short length;
00152 unsigned int offset;
00153 };
00154
00155 struct StDaqClfCppRow {
00156 StDaqClfcpp r[FCF_MAX_PADS][FCF_MAX_SEQ];
00157 };
00158
00159 class StRTSClientFCFMaker:public StMaker
00160 {
00161 private:
00162 bool ignoreFileClusters;
00163 bool ignoreRawData;
00164 bool m_EastOff;
00165 bool m_WestOff;
00166
00167 StDaqClfCppRow cpp[FCF_MAX_PADROWS];
00168
00169 short croat_trk[FCF_MAX_PADS_EVER+1][FCF_MAX_TIMEBINS_EVER];
00170 unsigned short croat_adc[FCF_MAX_PADS_EVER+1][FCF_MAX_TIMEBINS_EVER];
00171 unsigned short croat_cpp[FCF_MAX_PADS_EVER+1][64];
00172 unsigned int croat_adcOff[FCF_MAX_PADS_EVER+1];
00173 unsigned short croat_cppOff[FCF_MAX_PADS_EVER+1];
00174
00175 t0_corr_t *t0Corr;
00176 gain_corr_t *gainCorr;
00177 unsigned short startFlags[FCF_MAX_PADS_EVER+1];
00178
00179 Int_t BuildCPP(int nrows,
00180 raw_row_st *row,
00181 raw_pad_st *pad,
00182 raw_seq_st *seq,
00183 int sector);
00184
00185 StDaqClfCppRow *GetCPPRow(int r, int i, StDaqClfCppRow *storage);
00186
00187 void saveCluster(int cl_x, int cl_t, int cl_f, int cl_c, int p1, int p2, int t1, int t2, int r, int sector, int cl_id, int id_simtrk, int id_quality);
00188 void fillStEvent(tcl_tphit_st *hit);
00189 void filltphit(tcl_tphit_st *hit);
00190
00191 void getCorrections(int sector, int row);
00192
00193
00194
00195 double lxFromPad(int row, double pad);
00196 double lyFromRow(int row);
00197 double lzFromTB(double TB,int sector,int row,int pad);
00198
00199 double mDp;
00200 double mDt;
00201 double mDperp;
00202
00203
00204 int splitRows;
00205 int doT0Corrections;
00206 int doGainCorrections;
00207 int doZeroTruncation;
00208 int fillDeconFlag;
00209
00210 int clustercount;
00211 int hasSim;
00212
00213 St_tcl_tphit *mT_tphit;
00214 StEvent *mStEvent;
00215 StTpcHitCollection *mTpcHitColl;
00216
00217 StTpcCoordinateTransform *mCTransform;
00218 fcfClass *fcf;
00219
00220
00221 St_tss_tsspar *m_tsspar;
00222
00223 public:
00224
00225 void SetMode(Int_t mode);
00226
00227 StRTSClientFCFMaker(const char *name="tpc_hits");
00228 ~StRTSClientFCFMaker() ;
00229
00230 Int_t Init() ;
00231 Int_t Make() ;
00232 Int_t InitRun(int run) ;
00233
00234 void EastOff() {
00235 printf("<FCFMaker> Setting East TPC Off\n");
00236 m_EastOff = true;
00237 }
00238
00239 void WestOff() {
00240 printf("<FCFMaker> Setting West TPC Off\n");
00241 m_WestOff = true;
00242 }
00243
00244 void AllOn() {
00245 printf("<FCFMaker> Setting East&West TPC On\n");
00246 m_WestOff = false;
00247 m_EastOff = false;
00248 }
00249
00250 int runClusterFinder(j_uintptr *result_mz_ptr,
00251 u_int *result_buff,
00252 int sector,
00253 int row,
00254 StDaqClfCppRow *cppRow,
00255 unsigned short *adc,
00256 unsigned short *trk,
00257 u_int *simu_result_buff,
00258 j_uintptr *simu_mz_ptr);
00259
00260 int build_croat_clusters(u_int sector, croat_out_t *croat_out, resptr_t *croat_res, croat_out_t *simu_out, resptr_t *simu_res);
00261 int build_daq_file_clusters(u_int sector, daq_out_t *, resptr_t *);
00262
00263 int anyRawDataInFile();
00264 int anyClustersInFile();
00265 u_int *getMZCLD(u_int hsector, u_int rb, u_int mz, u_int *len);
00266
00267 bool checkSwap(int x);
00268 u_int swap32(bool test, u_int x);
00269
00270
00271 virtual const char *GetCVS() const
00272 {
00273 static const char cvs[]="Tag $Name: $Id: built "__DATE__" "__TIME__ ; return cvs;
00274 }
00275
00276 ClassDef(StRTSClientFCFMaker, 1)
00277 };
00278
00279 #endif