StTriggerUtilities/StDSMUtilities/DSMAlgo_BC101_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 "DSMAlgo_BC101_2009.hh" 00008 00009 void DSMAlgo_BC101_2009::operator()(DSM& dsm) 00010 { 00011 // INPUT: 00012 00013 // ---------------------------------------------------------------------- 00014 // BC101 - ch0 - BE001 | B101 - ch1 - BW001 | 00015 // ch2 - BE002 | ch3 - BW002 | 00016 // ch4 - BE003 - JP1 (0-15) | ch5 - BW003 - JP1 (0-15) | 00017 // ---------------------------------------------------------------------- 00018 // BC102 - ch0 - BE003 - JP6 (16-31) | B102 - ch1 - BW003 - JP6 (16-31) | 00019 // ch2 - BE004 | ch3 - BW004 | 00020 // ch4 - BE005 | ch5 - BW005 | 00021 // ---------------------------------------------------------------------- 00022 00023 // From each channel: 00024 00025 // (0-5) TP sum for low-eta group (6) 00026 // (6-11) TP sum for high-eta group (6) 00027 // (12-15) HT bits (4) 00028 00029 // REGISTERS: 00030 00031 // R0: BEMC-Jet-Patch-Th0 (9) 00032 // R1: BEMC-Jet-Patch-Th1 (9) 00033 // R2: BEMC-Jet-Patch-Th2 (9) 00034 00035 // ACTION: 00036 00037 int jpx = 0; // East (-1 < eta < 0) 00038 int jpy = 0; // Middle (-0.6 < eta < 0.4) 00039 int jpz = 0; // West (0 < eta < 1) 00040 int jpPartial = 0; // Partial (0.4 < eta < 1) 00041 00042 int highTowerBits = 0; 00043 00044 // East (ch0/2/4 - even channels) 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 // West (ch1/3/5 - odd channels) 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 // If overflow, set JPpartial sum to max 00066 if (jpPartial > 63) jpPartial = 63; 00067 00068 // Compare each jet patch sum to three thresholds 00069 // and then pack results for each jet patch into 00070 // 2-bit integer. 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 // OUTPUT (16): 00083 00084 // (0-1) JPX threshold bits (2) 00085 // (2-3) JPY threshold bits (2) 00086 // (4-5) JPZ threshold bits (2) 00087 // (6-11) JPpartial sum (6) 00088 // (12-15) HT bits (4) 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 // INFO: 00101 00102 dsm.info[0] = jpx; 00103 dsm.info[1] = jpy; 00104 dsm.info[2] = jpz; 00105 }

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