00001 #ifndef L2eemcGamma2012_H
00002 #define L2eemcGamma2012_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifdef IS_REAL_L2 //in l2-ana environment
00019 #include "L2VirtualAlgo2012.h"
00020 #else
00021 #include "StTriggerUtilities/L2Emulator/L2algoUtil/L2VirtualAlgo2012.h"
00022 #endif
00023
00024 #include "L2gammaResult2012.h"
00025
00026 class L2eemcGamma2012 ;
00027 class L2Histo;
00028 class L2EmcGeom2012;
00029
00030
00031 class L2eemcGammaEvent2012 {
00032 public:
00033 enum {mxClust=50};
00034 enum {kDataFresh=0};
00035 private:
00036 friend class L2eemcGamma2012 ;
00037 int isFresh;
00038 int size;
00039 float clusterET[mxClust];
00040 float clusterEta[mxClust];
00041 float clusterPhi[mxClust];
00042 unsigned short int clusterSeedTow[mxClust];
00043 unsigned short int clusterQuad[mxClust];
00044 unsigned short int clusterSeedRank[mxClust];
00045 L2gammaResult2012 resultBlob;
00046 };
00047
00048 class L2eemcGamma2012 : public L2VirtualAlgo2012 {
00049
00050
00051
00052
00053
00054
00055
00056 public:
00057 enum {mxEtow=(EtowGeom::mxEtaBin) * (EtowGeom::mxPhiBin)};
00058 private:
00059
00060
00061 int par_dbg;
00062 float par_seedEtThres;
00063 float par_clusterEtThres;
00064 float par_eventEtThres;
00065
00066
00067
00068 L2EmcGeom2012 *mGeom;
00069 int mRdo2tower[mxEtow];
00070 int mTower2rdo[mxEtow];
00071
00072
00073
00074 float wrkEtow_et[mxEtow];
00075 int wrkEtow_tower_index[mxEtow];
00076 int wrkEtow_tower_seed[mxEtow];
00077 int wrkEtow_tower_seed_size;
00078
00079 L2eemcGammaEvent2012 mEtow[L2eventStream2012::mxToken];
00080
00081 float etow_et[mxEtow];
00082 int etow_used[mxEtow];
00083 int etow_tower_seed[mxEtow];
00084 int etow_tower_seed_size;
00085 float etow_clusterET[mxEtow];
00086 int etow_clusterET_size;
00087
00088
00089 struct mCluster {
00090 int seedTower;
00091 int seedRank;
00092 int quadrant;
00093 float ETsum;
00094 };
00095
00096 mCluster towerCluster[mxEtow];
00097
00098
00099
00100
00101 void createHisto();
00102 void clearEvent(int token);
00103 void clearEvent();
00104 int countNonZeroTow(int phi, int eta);
00105 float sumET(int phi, int eta);
00106 void flagUsed(int phi, int eta);
00107 void averageEtaPhi(int phi, int eta, float *avePhi, float *aveEta);
00108 void quickSort(int array[], int start, int end);
00109 void swap(int array[], int index1, int index2);
00110
00111 public:
00112 L2eemcGamma2012(const char* name, const char *uid, L2EmcDb2012* db, L2EmcGeom2012 *geo, char* outDir, int resOff);
00113 int initRunUser( int runNo, int *rc_ints, float *rc_floats);
00114 void finishRunUser();
00115 void computeUser(int token);
00116 bool decisionUser(int token, int *myL2Result);
00117
00118 void print1(int token);
00119 void print2();
00120 void print3();
00121 void print4(int token, int hitSize);
00122
00123 };
00124
00125 #endif
00126
00127
00128
00129
00130
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