00001
00008 #ifndef STAR_St_tpcdaq_Maker
00009 #define STAR_St_tpcdaq_Maker
00010
00012
00013
00014
00016 #ifndef StMaker_H
00017 #include "StMaker.h"
00018 #endif
00019 #include "TDataSet.h"
00020
00021 class St_raw_row;
00022 class St_raw_pad;
00023 class St_raw_seq;
00024 class St_type_shortdata;
00025 #include "StTpcRawDataEvent.hh"
00026 class StTpcUnpacker;
00027 class StSequence;
00028 class TH1F;
00029 #define MAXROWPADPERSECTOR 400
00030 #define BINRANGE 3
00032 class ZeroSuppressedReader;
00033 class StTrsDetectorReader;
00034 class StTrsZeroSuppressedReader;
00035
00036 typedef struct {
00037 int npad,row[MAXROWPADPERSECTOR],pad[MAXROWPADPERSECTOR];
00038 int nbin,low[BINRANGE],up[BINRANGE];
00039 } tpcdaq_noiseElim;
00040 class St_tpcdaq_Maker : public StMaker {
00041 private:
00042 int mCorrectionMask;
00043 char mMergeSequences;
00044
00045 Char_t *gConfig;
00046 char alreadySet;
00047 char mErr;
00048 StTpcRawDataEvent *mEvent;
00049 void MakeHistograms();
00050 void SetGainCorrectionStuff(int);
00051 float fGain[45][182];
00052 tpcdaq_noiseElim noiseElim[24];
00053
00054 StTrsDetectorReader* mTdr;
00055 StTrsZeroSuppressedReader* mZsr;
00056 Int_t daq_flag;
00057
00058 Int_t GetEventAndDecoder();
00059 protected:
00060 TH1F *m_seq_startTimeBin;
00061 TH1F *m_seq_sequnceLength;
00062 TH1F *m_seq_padNumber;
00063 TH1F *m_seq_padRowNumber;
00064 TH1F *m_pad_numSeq;
00065 TH1F *m_pix_AdcValue;
00066 private:
00067 void PrepareSimulatedData(unsigned int sector,unsigned int *out);
00068 void DAQ100clOutput(const unsigned int *pTPCP);
00069 void DAQ100clTableOut(unsigned int,unsigned int,unsigned int, char,const unsigned int *);
00070 public:
00071 void SetCorrection(int);
00072 int GetCorrection(void);
00073 char SetSequenceMerging(char);
00074 char WhetherToSwap(unsigned int x);
00075 unsigned int Swap4(char,unsigned int x);
00076 unsigned short int Swap2(char,unsigned short int x);
00077 void ExcludeTheseTimeBins(int lo1,int hi1,int lo2,int hi2,int lo3,int hi3);
00078 St_tpcdaq_Maker(const char *name="tpc_raw",char *daqInputFile="undefined");
00079
00080
00081 void OrderTheSequences(int nseq,StSequence *los);
00082
00083 void SeqWrite(St_raw_seq *raw_seq_gen,int rownum,
00084 int startTimeBin,int numberOfBinsInSequence);
00085 void PixelWrite(St_type_shortdata *pixel_data_gen,St_type_shortdata *pixel_indx_gen,
00086 int rownum,unsigned short datum,unsigned short id);
00087 void PadWrite(St_raw_pad *raw_pad_gen,int padR,int padOffset,
00088 int seqOffset,int nseq,int nSeqB4Offset,int pad);
00089 void RowWrite(St_raw_row *raw_row_gen,int rownumber,
00090 int pixSave, int iseqSave,int nPixelThisPadRow,
00091 int nSeqThisPadRow,int offsetIntoPadTable,
00092 int nPadsWithSignal,int pixTblWhere,int ipadrow);
00093 void MkTables(
00094 int isect,
00095 TDataSet *sector,
00096 St_raw_row **raw_row_in,
00097 St_raw_row **raw_row_out,
00098 St_raw_pad **raw_pad_in,
00099 St_raw_pad **raw_pad_out,
00100 St_raw_seq **raw_seq_in,
00101 St_raw_seq **raw_seq_out,
00102 St_type_shortdata **pixel_data_in,
00103 St_type_shortdata **pixel_data_out,
00104 St_type_shortdata **pixel_indx_in,
00105 St_type_shortdata **pixel_indx_out);
00106 char *NameOfSector(int isect);
00107 void PrintErr(int,char);
00108 int Output();
00109 int getSector(Int_t isect);
00110 int getPadList(int whichPadRow,unsigned char **padlist);
00111 int mNseqLo,mNseqHi,mThreshLo,mThreshHi;
00112 void AsicThresholds(float gain,int *nseq,StSequence **lst,UShort_t ***idt);
00113 int getSequences(float gain,int whichPadRow,int pad,int *nseq,StSequence **seqList, UShort_t ***listOfIds);
00114 void SetDAQFlag(Int_t);
00115 void SetNoiseEliminationStuff();
00116 void WriteStructToScreenAndExit();
00117 void SetConfig(Char_t *conf) {gConfig = conf;
00118 printf("St_tpcdaq_Maker::SetConfig, getting data from %s.\n",gConfig);
00119 }
00120 Char_t *GetConfig() {return gConfig;}
00121 virtual void SetMode(Int_t mode=0) {
00122 m_Mode=mode;
00123 if (m_Mode == 1) SetConfig("trs");
00124 else {if (m_Mode == 2) SetConfig("l3"); else SetConfig("daq");}
00125 }
00126 virtual ~St_tpcdaq_Maker();
00127 virtual Int_t Init();
00128 virtual Int_t InitRun(Int_t );
00129 virtual Int_t Make();
00130
00131 virtual const char *GetCVS() const {
00132 static const char cvs[]="Tag $Name: $ $Id: St_tpcdaq_Maker.h,v 1.42 2008/06/20 14:58:08 fisyak Exp $ built "__DATE__" "__TIME__ ;
00133 return cvs;
00134 }
00135
00136 ClassDef(St_tpcdaq_Maker,0)
00137 };
00138
00139 #endif
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272