StTriggerUtilities/StDSMUtilities/DSMAlgo_EM201_2009.cc

00001 // 00002 // Pibero Djawotho <pibero@comp.tamu.edu> 00003 // Texas A&M University Cyclotron Institute 00004 // 7 Jan 2009 00005 // 00006 00007 #include "DSM.hh" 00008 #include "DSMAlgo_EM201_2009.hh" 00009 00010 int DSMAlgo_EM201_2009::ajpBarrel(const DSM& dsm, int offset) const 00011 { 00012 int jpBits[6]; 00013 00014 // BC101-106 00015 00016 for (int ch = 0; ch < 6; ++ch) 00017 jpBits[ch] = dsm.channels[ch] >> offset & 0x3; 00018 00019 return (jpBits[0] && jpBits[1] || 00020 jpBits[1] && jpBits[2] || 00021 jpBits[2] && jpBits[3] || 00022 jpBits[3] && jpBits[4] || 00023 jpBits[4] && jpBits[5] || 00024 jpBits[5] && jpBits[0]); 00025 } 00026 00027 int DSMAlgo_EM201_2009::ajpEndcap(const DSM& dsm) const 00028 { 00029 int jpBits[6]; 00030 00031 // EE101 00032 00033 jpBits[0] = dsm.channels[6] & 0x3; // JPA (4 o'clock) 00034 jpBits[1] = dsm.channels[6] >> 2 & 0x3; // JPB (6 o'clock) 00035 jpBits[2] = dsm.channels[6] >> 4 & 0x3; // JPC (8 o'clock) 00036 00037 // EE102 00038 00039 jpBits[3] = dsm.channels[7] & 0x3; // JPA (10 o'clock) 00040 jpBits[4] = dsm.channels[7] >> 2 & 0x3; // JPB (12 o'clock) 00041 jpBits[5] = dsm.channels[7] >> 4 & 0x3; // JPC (2 o'clock) 00042 00043 return (jpBits[0] && jpBits[1] || 00044 jpBits[1] && jpBits[2] || 00045 jpBits[2] && jpBits[3] || 00046 jpBits[3] && jpBits[4] || 00047 jpBits[4] && jpBits[5] || 00048 jpBits[5] && jpBits[0]); 00049 } 00050 00051 void DSMAlgo_EM201_2009::operator()(DSM& dsm) 00052 { 00053 // INPUT: 00054 00055 // EM201 - ch0 - BEMC BC101 - 10' - JP0 & JP6 (West & East) 00056 // ch1 - BEMC BC102 - 12' - JP1 & JP7 00057 // ch2 - BEMC BC103 - 2' - JP2 & JP8 00058 // ch3 - BEMC BC104 - 4' - JP3 & JP9 00059 // ch4 - BEMC BC105 - 6' - JP4 & JP10 00060 // ch5 - BEMC BC106 - 8' - JP5 & JP11 00061 // ch6 - EEMC EE101 - 4', 6' and 8' - JP3, JP4 & JP5 00062 // ch7 - EEMC EE102 - 10', 12' and 2' - JP0, JP1 & JP2 00063 00064 // From BC101-106 (16): 00065 00066 // (0-1) JPX (east, -1 < eta < 0) threshold bits (2) 00067 // (2-3) JPY (middle, -0.6 < eta < 0.4) threshold bits (2) 00068 // (4-5) JPZ (west, 0 < eta < 1) threshold bits (2) 00069 // (6-11) JPpartial (0.4 < eta < 1) sum (6) 00070 // (12-15) HT bits (4) 00071 00072 // From EE101 (16): 00073 00074 // (0-1) JPA (4 o'clock) threshold bits (2) 00075 // (2-3) JPB (6 o'clock) threshold bits (2) 00076 // (4-5) JPC (8 o'clock) threshold bits (2) 00077 // (6-11) Selected partial jet patch sum (6) 00078 // (12-13) Partial jet patch ID (1=A, 2=B, 3=C) (2) 00079 // (14-15) HT bits (2) 00080 00081 // From EE102 (16): 00082 00083 // (0-1) JPA (10 o'clock) threshold bits (2) 00084 // (2-3) JPB (12 o'clock) threshold bits (2) 00085 // (4-5) JPC (2 o'clock) threshold bits (2) 00086 // (6-11) Selected partial jet patch sum (6) 00087 // (12-13) Partial jet patch ID (1=A, 2=B, 3=C) (2) 00088 // (14-15) HT bits (2) 00089 00090 // REGISTERS: 00091 00092 // R0: Hybrid jet patch threshold-0 00093 // R1: Hybrid jet patch threshold-1 00094 // R2: Hybrid jet patch threshold-2 00095 00096 // ACTION: 00097 00098 // Complete hybrid jet patches using partial jet patch ID from EEMC 00099 00100 int jpSum1 = dsm.channels[6] >> 6 & 0x3f; // Partial sum from EE101 00101 int jpSum2 = dsm.channels[7] >> 6 & 0x3f; // Partial sum from EE102 00102 00103 int jpId1 = dsm.channels[6] >> 12 & 0x3; // Partial jet patch ID from EE101 00104 int jpId2 = dsm.channels[7] >> 12 & 0x3; // Partial jet patch ID from EE102 00105 00106 switch (jpId1) { 00107 case 1: jpSum1 += dsm.channels[3] >> 6 & 0x3f; break; // Add partial sum from BC104 (4') 00108 case 2: jpSum1 += dsm.channels[4] >> 6 & 0x3f; break; // Add partial sum from BC105 (6') 00109 case 3: jpSum1 += dsm.channels[5] >> 6 & 0x3f; break; // Add partial sum from BC106 (8') 00110 } 00111 00112 switch (jpId2) { 00113 case 1: jpSum2 += dsm.channels[0] >> 6 & 0x3f; break; // Add partial sum from BC101 (10') 00114 case 2: jpSum2 += dsm.channels[1] >> 6 & 0x3f; break; // Add partial sum from BC102 (12') 00115 case 3: jpSum2 += dsm.channels[2] >> 6 & 0x3f; break; // Add partial sum from BC103 (2') 00116 } 00117 00118 // Combine (OR) the HT bits from the six BEMC layer 1 DSM's 00119 00120 int htBitsBarrel = 0; 00121 00122 for (int ch = 0; ch < 6; ++ch) 00123 htBitsBarrel |= dsm.channels[ch] >> 12 & 0xf; 00124 00125 // Combine (OR) the HT bits from the two EEMC layer 1 DSM's 00126 00127 int htBitsEndcap = 0; 00128 00129 for (int ch = 6; ch < 8; ++ch) 00130 htBitsEndcap |= dsm.channels[ch] >> 14 & 0x3; 00131 00132 // Combine (OR) the JP bits for the BEMC and EEMC separately 00133 00134 int jpBitsBarrel = 0; 00135 00136 for (int ch = 0; ch < 6; ++ch) { 00137 int jpx = dsm.channels[ch] & 0x3; 00138 int jpy = dsm.channels[ch] >> 2 & 0x3; 00139 int jpz = dsm.channels[ch] >> 4 & 0x3; 00140 00141 if (jpx > jpBitsBarrel) jpBitsBarrel = jpx; 00142 if (jpy > jpBitsBarrel) jpBitsBarrel = jpy; 00143 if (jpz > jpBitsBarrel) jpBitsBarrel = jpz; 00144 } 00145 00146 int bjp1 = jpBitsBarrel > 1; 00147 int bjp2 = jpBitsBarrel > 2; 00148 00149 int jpBitsEndcap = 0; 00150 00151 for (int ch = 6; ch < 8; ++ch) { 00152 int jpa = dsm.channels[ch] & 0x3; 00153 int jpb = dsm.channels[ch] >> 2 & 0x3; 00154 int jpc = dsm.channels[ch] >> 4 & 0x3; 00155 00156 if (jpa > jpBitsEndcap) jpBitsEndcap = jpa; 00157 if (jpb > jpBitsEndcap) jpBitsEndcap = jpb; 00158 if (jpc > jpBitsEndcap) jpBitsEndcap = jpc; 00159 } 00160 00161 int ejp1 = jpBitsEndcap > 1; 00162 int ejp2 = jpBitsEndcap > 2; 00163 00164 // Compare the two completed hybrid jet patches to three thresholds 00165 // and combine (OR) the results with the BEMC-only and EEMC-only bits 00166 00167 int jpBits = 0; 00168 00169 for (int reg = 0; reg < 3; ++reg) 00170 if (jpSum1 > dsm.registers[reg] || jpSum2 > dsm.registers[reg]) ++jpBits; 00171 00172 if (jpBitsBarrel > jpBits) jpBits = jpBitsBarrel; 00173 if (jpBitsEndcap > jpBits) jpBits = jpBitsEndcap; 00174 00175 int jp1 = jpBits > 1; 00176 int jp2 = jpBits > 2; 00177 00178 // Adjacent jet patch logic 00179 00180 int ajpx = ajpBarrel(dsm, 0); 00181 int ajpy = ajpBarrel(dsm, 2); 00182 int ajpz = ajpBarrel(dsm, 4); 00183 int bajp = ajpx || ajpy || ajpz; 00184 int eajp = ajpEndcap(dsm); 00185 int ajp = bajp || eajp; 00186 00187 // OUTPUT (15): 00188 00189 // (0:3) Barrel HT bits (4) 00190 // (4:5) Endcap HT bits (2) 00191 // (6) JP1, unified over the BEMC+EEMC (1) 00192 // (7) JP2, unified over the BEMC+EEMC (1) 00193 // (8) BJP1 for the 18 BEMC-only patches (1) 00194 // (9) BJP2 for the 18 BEMC-only patches (1) 00195 // (10) EJP1 for the 6 EEMC-only patches (1) 00196 // (11) EJP2 for the 6 EEMC-only patches (1) 00197 // (12) AJP for BEMC and EEMC but NOT the boundary (1) 00198 // (13) BAJP for the BEMC-only patches (1) 00199 // (14) EAJP for the EEMC-only patches (1) 00200 00201 int out = 0; 00202 00203 out |= htBitsBarrel; 00204 out |= htBitsEndcap << 4; 00205 out |= jp1 << 6; 00206 out |= jp2 << 7; 00207 out |= bjp1 << 8; 00208 out |= bjp2 << 9; 00209 out |= ejp1 << 10; 00210 out |= ejp2 << 11; 00211 out |= ajp << 12; 00212 out |= bajp << 13; 00213 out |= eajp << 14; 00214 00215 dsm.output = out; 00216 00217 // INFO 00218 00219 dsm.info[0] = jpSum1; 00220 dsm.info[1] = jpSum2; 00221 }

Generated on Sun Mar 15 04:55:28 2009 for StRoot by doxygen 1.3.7