00001 #ifndef L2JETALGO2006_H
00002 #define L2JETALGO2006_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 class L2Histo;
00014 #ifdef IS_REAL_L2 //in l2-ana environmen
00015 #include "L2VirtualAlgo.h"
00016 #else
00017 #include "StTriggerUtilities/L2Emulator/L2algoUtil/L2VirtualAlgo.h"
00018 #endif
00019
00020 class L2jetAlgo2006 : public L2VirtualAlgo {
00021 public:
00022
00023 #define MaxBtowRdo (L2EmcDb::BTOW_MAXFEE*L2EmcDb::BTOW_DATSIZE)
00024 #define MaxEtowRdo (L2EmcDb::ETOW_MAXFEE*L2EmcDb::ETOW_DATSIZE)
00025
00026 enum {cl2jetMaxEtaBins=15, cl2jetMaxPhiBins=30};
00027
00028
00029
00030
00031 enum {cl2jet_par_mxPhiBin=3, cl2jet_par_mxEtaBin=3};
00032 private:
00033
00034
00035 float par_maxADC;
00036 float par_maxEt;
00037 unsigned short par_adcMask,par_pedOff;
00038 int par_hotTwEtThr;
00039
00040
00041 int par_useBtowEast;
00042 int par_useBtowWest;
00043 int par_useEndcap;
00044 int par_minPhiBinDiff;
00045 int par_cutTag;
00046 float par_energyScale;
00047 float par_diJetThrHigh;
00048 float par_diJetThrLow;
00049 float par_oneJetThr;
00050 float par_rndAccProb;
00051 int par_rndAccThr;
00052 int par_dbg;
00053 int *raw_ints;
00054 float *raw_floats;
00055
00056
00057 enum { mxHA=128, mxJ=2};
00058 L2Histo *hA[mxHA];
00059 long run_startUnix;
00060 int run_number;
00061
00062
00063 int run_nEventOneJet, run_nEventDiJet, run_nEventRnd;
00064
00065
00066 unsigned short db_btowThr[MaxBtowRdo];
00067 unsigned short db_btowPedS[MaxBtowRdo];
00068 unsigned short db_btowGainCorr[MaxBtowRdo];
00069 unsigned short db_btowL2PhiBin[MaxBtowRdo];
00070 unsigned short db_btowL2PatchBin[MaxBtowRdo];
00071
00072
00073 unsigned short db_etowThr[MaxEtowRdo];
00074 unsigned short db_etowPedS[MaxEtowRdo];
00075 unsigned short db_etowGainCorr[MaxEtowRdo];
00076 unsigned short db_etowL2PhiBin[MaxEtowRdo];
00077 unsigned short db_etowL2PatchBin[MaxEtowRdo];
00078
00079 class L2Jet {
00080 public:
00081
00082
00083
00084 int iphiBin;
00085 float fphiBin;
00086 int ietaBin;
00087 float fetaBin;
00088 int iene;
00089 float phiRad;
00090 float eneGeV;
00091
00092 L2Jet(){};
00093 void clear(){
00094 iphiBin=ietaBin=iene=0;
00095 fphiBin=fetaBin=phiRad=eneGeV=0.;
00096 }
00097 };
00098
00099
00100 TrgDataType* eve_TrigData;
00101 int eve_ID;
00102 int eve_patchEne[cl2jetMaxEtaBins*cl2jetMaxPhiBins];
00103 int eve_phiEne[cl2jetMaxPhiBins+cl2jet_par_mxPhiBin-1];
00104 L2Jet * eve_Jet[mxJ];
00105
00106
00107 void createHisto();
00108 void clearEvent();
00109 int projectAdc( ushort *rawAdc, int nRdo,
00110 ushort *thr, ushort *ped, ushort *gainCorr,
00111 ushort *phiBin, ushort *patchBin,
00112 L2Histo *hHot );
00113 int scanPhi();
00114 void scanEta(int iJ);
00115 void weightedPhi(int iJ);
00116 void dumpPatchEneA();
00117 void finishRunHisto();
00118 bool paramsChanged( int *rc_ints, float *rc_floats);
00119
00120 public:
00121 L2jetAlgo2006(const char* name, L2EmcDb* db, char* outDir, int resOff);
00122
00123 int initRun( int runNo, int *rc_ints, float *rc_floats);
00124 bool doEvent(int L0trg, int inpEveId, TrgDataType* trgData,
00125 int bemcIn, ushort *bemcData,
00126 int eemcIn, ushort *eemcData);
00127 void finishRun();
00128 };
00129
00130 #endif
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162