00001 #ifndef L2adc2energy_H
00002 #define L2adc2energy_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 L2adc2energyAlgo : 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
00080
00081 int eve_ID;
00082 int eve_patchEne[cl2jetMaxEtaBins*cl2jetMaxPhiBins];
00083 int eve_phiEne[cl2jetMaxPhiBins+cl2jet_par_mxPhiBin-1];
00084
00085
00086 void createHisto();
00087 void clearEvent();
00088 int projectAdc( ushort *rawAdc, int nRdo,
00089 ushort *thr, ushort *ped, ushort *gainCorr,
00090 ushort *phiBin, ushort *patchBin,
00091 L2Histo *hHot );
00092
00093
00094 void dumpPatchEneA();
00095 void finishRunHisto();
00096 bool paramsChanged( int *rc_ints, float *rc_floats);
00097
00098 public:
00099 L2adc2energyAlgo(const char* name, L2EmcDb* db, char* outDir, int resOff);
00100
00101 int initRun( int runNo, int *rc_ints, float *rc_floats);
00102 bool doEvent(int L0trg, int inpEveId, TrgDataType* trgData,
00103 int bemcIn, ushort *bemcData,
00104 int eemcIn, ushort *eemcData);
00105 void finishRun();
00106 };
00107
00108 #endif
00109
00110
00111
00112
00113
00114
00115
00116
00117