00001
00002
00003
00004
00005 #include "St2009WMaker.h"
00006 #include "StEmcUtil/geometry/StEmcGeom.h"
00007 #include <StMuDSTMaker/COMMON/StMuDstMaker.h>
00008
00009
00010
00011 bool
00012 St2009WMaker::passes_L0(){
00013
00014
00015
00016
00017
00018
00019
00020 StMuEvent* muEve = mMuDstMaker->muDst()->event();
00021 for (int m=0;m<300;m++)
00022 if(muEve->emcTriggerDetector().highTower(m)>par_l0emulAdcThresh) return true;
00023 return false;
00024 }
00025
00026
00027
00028 bool
00029 St2009WMaker::passes_L2(){
00030
00031
00032
00033
00034
00035
00036
00037 for (int i=0;i<mxBtow;i++)
00038 if (wEve.bemc.statTile[0][i]==0) {
00039 float adc = wEve.bemc.adcTile[0][i];
00040 float ET = adc*60./4096.;
00041 if (ET>par_l2emulSeedThresh) {
00042
00043 int iEta,iPhi;
00044 if( L2algoEtaPhi2IJ(positionBtow[i].Eta(),positionBtow[i].Phi(),iEta,iPhi)) continue;
00045
00046 float maxET=0;
00047
00048
00049 int I0=iEta-1; int J0=iPhi-1;
00050 for(int I=I0;I<=I0+1;I++){
00051 for(int J=J0;J<=J0+1;J++) {
00052 WeveCluster CL;CL.iEta=I;CL.iPhi=J;
00053 for(int i=I;i<I+2;i++){
00054 if(i<0) continue;
00055 if(i>=mxBTetaBin) continue;
00056 for(int j=J;j<J+2;j++) {
00057 int jj=(j+mxBTphiBin)%mxBTphiBin;
00058
00059 int softID = mapBtowIJ2ID[ i+ jj*mxBTetaBin];
00060 float adc = wEve.bemc.adcTile[kBTow][softID-1];
00061 if(adc<=0) continue;
00062 float ET = adc*60./4096.;
00063 CL.nTower++;
00064 CL.ET+=ET;
00065 CL.adcSum+=adc;
00066 }
00067 }
00068
00069 if(maxET>CL.ET) continue;
00070 maxET=CL.ET;
00071 }
00072 }
00073
00074
00075 if(maxET>par_l2emulClusterThresh) return true;
00076 }
00077 }
00078 return false;
00079
00080 }
00081
00082 void
00083 St2009WMaker::patchToEtaPhi(int patch, int*eta, int*phi)
00084 {
00085 if (patch<0 || patch>299)
00086 {
00087 printf("patchToEtaPhi p=%d, out of range. Eta phi not defined.\n",patch);
00088 return;
00089 }
00090 if (patch<150)
00091 {
00092 int m=14-patch/10;
00093 int n=patch%10;
00094 *eta=n/2+5;
00095 *phi=n%2+m*2;
00096 }
00097 else
00098 {
00099 int m=29-patch/10;
00100 int n=patch%10;
00101 *eta=4-n/2;
00102 *phi=1-n%2+m*2;
00103 }
00104 return;
00105 }
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125