00001
00002
00003
00004
00005
00006
00007 #include "DSMAlgo_BC101_2009.hh"
00008
00009 void DSMAlgo_BC101_2009::operator()(DSM& dsm)
00010 {
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 int jpx = 0;
00038 int jpy = 0;
00039 int jpz = 0;
00040 int jpPartial = 0;
00041
00042 int highTowerBits = 0;
00043
00044
00045
00046 for (int ch = 0; ch <= 4; ch += 2) {
00047 int lowEtaSum = dsm.channels[ch] & 0x3f;
00048 int highEtaSum = dsm.channels[ch] >> 6 & 0x3f;
00049 jpx += lowEtaSum + highEtaSum;
00050 jpy += lowEtaSum;
00051 highTowerBits |= dsm.channels[ch] >> 12 & 0xf;
00052 }
00053
00054
00055
00056 for (int ch = 1; ch <= 5; ch += 2) {
00057 int lowEtaSum = dsm.channels[ch] & 0x3f;
00058 int highEtaSum = dsm.channels[ch] >> 6 & 0x3f;
00059 jpy += lowEtaSum;
00060 jpz += lowEtaSum + highEtaSum;
00061 jpPartial += highEtaSum;
00062 highTowerBits |= dsm.channels[ch] >> 12 & 0xf;
00063 }
00064
00065
00066 if (jpPartial > 63) jpPartial = 63;
00067
00068
00069
00070
00071
00072 int jpxBits = 0;
00073 int jpyBits = 0;
00074 int jpzBits = 0;
00075
00076 for (int reg = 0; reg < 3; ++reg) {
00077 if (jpx > dsm.registers[reg]) ++jpxBits;
00078 if (jpy > dsm.registers[reg]) ++jpyBits;
00079 if (jpz > dsm.registers[reg]) ++jpzBits;
00080 }
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090 int out = 0;
00091
00092 out |= jpxBits;
00093 out |= jpyBits << 2;
00094 out |= jpzBits << 4;
00095 out |= jpPartial << 6;
00096 out |= highTowerBits << 12;
00097
00098 dsm.output = out;
00099
00100
00101
00102 dsm.info[0] = jpx;
00103 dsm.info[1] = jpy;
00104 dsm.info[2] = jpz;
00105 }