StTriggerUtilities/StDSMUtilities/DSMAlgo_EM201_2009.cc
00001
00002
00003
00004
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
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
00032
00033 jpBits[0] = dsm.channels[6] & 0x3;
00034 jpBits[1] = dsm.channels[6] >> 2 & 0x3;
00035 jpBits[2] = dsm.channels[6] >> 4 & 0x3;
00036
00037
00038
00039 jpBits[3] = dsm.channels[7] & 0x3;
00040 jpBits[4] = dsm.channels[7] >> 2 & 0x3;
00041 jpBits[5] = dsm.channels[7] >> 4 & 0x3;
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
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 int jpSum1 = dsm.channels[6] >> 6 & 0x3f;
00101 int jpSum2 = dsm.channels[7] >> 6 & 0x3f;
00102
00103 int jpId1 = dsm.channels[6] >> 12 & 0x3;
00104 int jpId2 = dsm.channels[7] >> 12 & 0x3;
00105
00106 switch (jpId1) {
00107 case 1: jpSum1 += dsm.channels[3] >> 6 & 0x3f; break;
00108 case 2: jpSum1 += dsm.channels[4] >> 6 & 0x3f; break;
00109 case 3: jpSum1 += dsm.channels[5] >> 6 & 0x3f; break;
00110 }
00111
00112 switch (jpId2) {
00113 case 1: jpSum2 += dsm.channels[0] >> 6 & 0x3f; break;
00114 case 2: jpSum2 += dsm.channels[1] >> 6 & 0x3f; break;
00115 case 3: jpSum2 += dsm.channels[2] >> 6 & 0x3f; break;
00116 }
00117
00118
00119
00120 int htBitsBarrel = 0;
00121
00122 for (int ch = 0; ch < 6; ++ch)
00123 htBitsBarrel |= dsm.channels[ch] >> 12 & 0xf;
00124
00125
00126
00127 int htBitsEndcap = 0;
00128
00129 for (int ch = 6; ch < 8; ++ch)
00130 htBitsEndcap |= dsm.channels[ch] >> 14 & 0x3;
00131
00132
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
00165
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
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
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
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
00218
00219 dsm.info[0] = jpSum1;
00220 dsm.info[1] = jpSum2;
00221 }
Generated on Sun Mar 15 04:55:28 2009 for StRoot by
1.3.7