5 #include "fcs_trg_base.h"
19 static u_int ETbTdep[4][4];
20 static u_int ETbTadr[4][4];
24 for(
int r=0; r<4; r++){
25 printf(
"Ecal r=%2d : ",r);
26 for(
int c=0; c<4; c++){
27 ETbTdep[r][c]= c/2 + (r/4);
28 ETbTadr[r][c]= c%2 + (r%4)*2;
29 printf(
"%2d-%1d ",ETbTdep[r][c],ETbTadr[r][c]);
36 u_int hsum=hcal[0].d[0]+hcal[0].d[2]+hcal[0].d[4]+hcal[0].d[6];
37 if(fcs_trgDebug>=2) printf(
"Hcal sum=%5d\n",hsum);
47 for(
int r=0; r<3; r++){
48 if(fcs_trgDebug>=2) printf(
"E4x4 ");
49 for(
int c=0; c<3; c++){
51 = ecal[ETbTdep[r ][c ]].d[ETbTadr[r ][c ]]
52 + ecal[ETbTdep[r ][c+1]].d[ETbTadr[r ][c+1]]
53 + ecal[ETbTdep[r+1][c ]].d[ETbTadr[r+1][c ]]
54 + ecal[ETbTdep[r+1][c+1]].d[ETbTadr[r+1][c+1]];
61 u_int sum = esum[r][c] + h;
65 ratio[r][c] = float(esum[r][c]) / float(sum);
73 if(h128 < esum[r][c] * EM_HERATIO_THR){
77 if((pres[0].d[0] & (1<<r))==0) {GAM1 |= (1<<r);}
78 else {ELE1 |= (1<<r);}
83 if((pres[0].d[0] & (1<<r))==0) {GAM2 |= (1<<r);}
84 else {ELE2 |= (1<<r);}
88 if(h128 > esum[r][c] * HAD_HERATIO_THR){
89 if(sum > HADTHR1) HAD1 |= (1<<r);
90 if(sum > HADTHR2) HAD2 |= (1<<r);
93 if(fcs_trgDebug>=2) printf(
"%5d %3.2f ",esum[r][c],ratio[r][c]);
95 if(fcs_trgDebug>=2) printf(
"\n");
100 etot= esum[ 0][0]+esum[ 0][2]
101 + esum[ 2][0]+esum[ 2][2];
104 u_int jet = hsum + etot;
105 if(etot > JETTHR1) JP1 = 1;
106 if(jet > JETTHR2) JP2 = 1;
108 if(fcs_trgDebug>=2) printf(
"Jet = %4d + %4d = %3d\n",etot,hsum,jet);
111 output[0].d[0] = 0x80 | (EM1 + (EM2 <<3));
112 output[0].d[1] = GAM1 + (GAM2<<3);
113 output[0].d[2] = ELE1 + (ELE2<<3);
114 output[0].d[3] = HAD1 + (HAD2<<3);
115 output[0].d[4] = JP1 + (JP2 <<1);
116 output[0].d[5] = pres[0].d[0] ;
117 output[0].d[6] = pres[0].d[1] ;
118 output[0].d[7] = pres[0].d[7] ;
121 for(
int i=0;i<4;i++) {
122 for(
int j=0;j<8;j++) {
123 printf(
"PRES %d %d = 0x%X\n",i,j,pres[i].d[j]) ;
128 printf(
"FCS STG2 NS=%1d output = %02x %02x %02x %02x %02x\n",
129 geo.ns,output[0].d[0],output[0].d[1],output[0].d[2],output[0].d[3],output[0].d[4]);