StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
fms_fm006_2011_a.cc
1 //
2 // Pibero Djawotho <pibero@tamu.edu>
3 // Texas A&M University
4 // 14 Jan 2011
5 //
6 
7 #include "qt32b_fms_2009_a.hh"
8 #include "fms_fm006_2011_a.hh"
9 
10 void fms_fm006_2011_a(Board& fm006, int t){
11  int I[4], J[4], htadc, htid;
12 
13  getQtSumAndHighTower((int*)fm006.channels[t],I,J,htadc,htid);
14 
15  // High tower thresholds
16  const int R0 = fm006.registers[0];
17  const int R1 = fm006.registers[1];
18 
19  // Compare the HT inputs from QT boards I and J to two HT
20  // thresholds. OR the results together, then output the HT0 and HT1
21  // results to the Layer-1 DSM (2 bits)
22  int HT0 = htadc > R0;
23  int HT1 = htadc > R1;
24 
25  // Form the following 3 7-bit sums:
26  int SumI = I[0]+I[1]+I[2]+I[3];
27  int SumIJ = I[2]+I[3]+J[0]+J[1];
28  int SumJ = J[0]+J[1]+J[2]+J[3];
29 
30  // Extract the low-order 5 bits from each of the 7-bit sums. If
31  // either of the two high-order bits is 1, set the result to 11111.
32  if (SumI > 31) SumI = 31;
33  if (SumIJ > 31) SumIJ = 31;
34  if (SumJ > 31) SumJ = 31;
35 
36  // Output the resulting 3 5-bit sums to the Layer-1 DSM (30 bits)
37  fm006.output[t] = SumJ << 15 | SumIJ << 20 | SumI << 25 | HT0 << 30 | HT1 << 31;
38 }
Definition: Board.hh:14