00001
00002
00003
00004 #ifndef STAR_StEemcTriggerSimu
00005 #define STAR_StEemcTriggerSimu
00006
00007 #include <TObject.h>
00008 #include <vector>
00009 #include <map>
00010
00011 using std::vector;
00012 using std::map;
00013
00014 #include "StTriggerUtilities/StVirtualTriggerSimu.h"
00015
00016 class StEEmcDb;
00017 class EEfeeTPTree;
00018 class EEdsm0Tree;
00019 class EEdsm1Tree;
00020 class EMCdsm2Tree;
00021 class EEdsm3;
00022 class EemcHttpInfo;
00023 class TH1;
00024 class TObjArray;
00025
00026
00027
00028 class DSMLayer_E001_2009;
00029 class DSMLayer_E101_2009;
00030
00031
00032
00033 class StEemcTriggerSimu : public StVirtualTriggerSimu {
00034 public:
00035 enum {kOnlyAdc=0,kAdcAndTrig, kAdcCompareTrig};
00036 void setConfig(int x) {mConfig=x;}
00037
00038 private:
00039 StEEmcDb *mDbE;
00040 int * mBemcEsum5bit;
00041 int * mExternDsmSetup;
00042 TString mSetupPath;
00043
00044 int mConfig;
00045 int mPedMode;
00046 TString mPedFile;
00047 enum {nThr=3};
00048 int mHTthr[nThr], mTPthr[nThr],mHTTPthrSelc;
00049
00050 int eveId;
00051 int nInpEve;
00052 bool mDumpEve;
00053 void getEemcAdc();
00054 static int computePed4(float ped);
00055 void getDsm0123inputs();
00056
00057 enum {mxAH=1000};
00058 TObjArray *mHList;
00059 TH1* hA[mxAH];
00060 void initHisto();
00061
00062
00063 enum {mxCr=6, mxChan=128};
00064 int getRdo(int crate, int chan) const { return (crate-1)*mxChan+chan; }
00065 int getCrate(int rdo) const { return rdo/mxChan+1; }
00066 int getChannel(int rdo) const { return rdo%mxChan; }
00067 int rawAdc [mxCr*mxChan];
00068 int feePed [mxCr*mxChan];
00069 int feeMask[mxCr*mxChan];
00070 int highTowerMask[90];
00071 int patchSumMask[90];
00072 float ped[mxCr*mxChan];
00073
00074 public:
00075
00076 enum { kOnline, kOffline, kLocal };
00077 void setPedMode(int pedmode) { mPedMode = pedmode; }
00078 void setPedFile(const char* pedfile) { mPedFile = pedfile; }
00079
00080
00081 EEfeeTPTree *feeTPTreeADC;
00082 EEdsm0Tree * dsm0TreeADC;
00083 EEdsm1Tree * dsm1TreeADC;
00084 EMCdsm2Tree * dsm2TreeADC;
00085
00086
00087
00088 private:
00089 DSMLayer_E001_2009* mE001;
00090 DSMLayer_E101_2009* mE101;
00091
00092 void get2009_DSMLayer0();
00093 void get2009_DSMLayer1();
00094
00095
00096 public:
00097 DSMLayer_E001_2009* get2009_DSMLayer0_Result() { return mE001; };
00098 DSMLayer_E101_2009* get2009_DSMLayer1_Result() { return mE101; };
00099
00100
00101
00102 vector<int> mTriggerIds;
00103
00104 private:
00105
00106 EEdsm0Tree *dsm0TreeTRG;
00107 EEdsm1Tree *dsm1TreeTRG;
00108 EMCdsm2Tree *dsm2TreeTRG;
00109 EEdsm3 *dsm3TRG;
00110 private:
00111
00112
00113 void compareTRG0_TRG1();
00114 void compareTRG1_TRG2();
00115 void compareTRG2_TRG3();
00116
00117 void compareADCfee_TRG0();
00118 void compareADC0_TRG1();
00119 void compareADC1_TRG2();
00120 void compareADC2_TRG3();
00121
00122 void DSM2EsumSpectra();
00123
00124 public:
00125
00126 StEemcTriggerSimu();
00127 virtual ~StEemcTriggerSimu();
00128 void Init();
00129 void InitRun(int runnumber);
00130 void setDsmSetup(int *x){ mExternDsmSetup=x;}
00131 void setSetupPath(char *x) { mSetupPath=x;}
00132 void Clear();
00133 void Make();
00134 bool isCorrupted() const;
00135 void getEemcFeeMask();
00136 void setHList(TObjArray * x){mHList=x;}
00137 void addTriggerList(vector<int>& trgList);
00138 StTriggerSimuDecision triggerDecision(int trigId);
00139 const vector<int>& triggerIds() const { return mTriggerIds; }
00140 void connectBemcL0(int *x) { mBemcEsum5bit=x;};
00141 bool getHttpInfo(int tpId, EemcHttpInfo &httpInfo);
00142
00143 int endcapJetPatchTh(int i) const;
00144 int endcapHighTowerTh(int i) const;
00145
00146 int endcapJetPatchAdc(int jp) const;
00147 int endcapHighTowerAdc(int towerId) const { return 0; }
00148
00149 int getOutHT(int tp) const;
00150 int getOutTPsum(int tp) const;
00151 int getEndcapHighTower(int tp) const { return getOutHT(tp); }
00152 int getEndcapPatchSum(int tp) const { return getOutTPsum(tp); }
00153
00154
00155 void fillStEmcTriggerDetector();
00156
00157 ClassDef(StEemcTriggerSimu, 1)
00158 };
00159
00160
00161 #endif
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