StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
DSMAlgo_BC101_2014_b.cc
1 #include "DSMAlgo_BC101_2014_b.hh"
2 
3 void DSMAlgo_BC101_2014_b::operator()(DSM& dsm)
4 {
5  // INPUT:
6 
7  // ----------------------------------------------------------------------
8  // BC101 - ch0 - BE001 | B101 - ch1 - BW001 |
9  // ch2 - BE002 | ch3 - BW002 |
10  // ch4 - BE003 - JP1 (0-15) | ch5 - BW003 - JP1 (0-15) |
11  // ----------------------------------------------------------------------
12  // BC102 - ch0 - BE003 - JP6 (16-31) | B102 - ch1 - BW003 - JP6 (16-31) |
13  // ch2 - BE004 | ch3 - BW004 |
14  // ch4 - BE005 | ch5 - BW005 |
15  // ----------------------------------------------------------------------
16 
17  // From each channel:
18 
19  // (0-8) Unused
20  // (9) TP threshold bit
21  // (10) HT.TP threshold bit
22  // (11-15) HT threshold bits
23 
24  // REGISTERS:
25 
26  // R0: BEMC-DAQ10k-HT-Sel (3)
27  int r0 = dsm.registers[0];
28 
29  int upperHT = 0;
30  int lowerHT = 0;
31 
32  int upperTP = 0;
33  int lowerTP = 0;
34 
35  int upperHTTP = 0;
36  int lowerHTTP = 0;
37 
38  for(int iichn = 0; iichn < 3; iichn++){
39  lowerHT |= dsm.channels[iichn] >> 10 & 0x3f;
40  lowerTP |= dsm.channels[iichn] >> 8 & 0x1;
41  lowerHTTP |= dsm.channels[iichn] >> 9 & 0x1;
42 
43  upperHT |= dsm.channels[iichn+3] >> 10 & 0x3f;
44  upperTP |= dsm.channels[iichn+3] >> 8 & 0x1;
45  upperHTTP |= dsm.channels[iichn+3] >> 9 & 0x1;
46  }
47 
48  int daq10kSel[6];
49  int DAQ10k = 0;
50 
51  for(int ichn = 0; ichn < 6; ichn++){
52  daq10kSel[ichn] = 0;
53  daq10kSel[ichn] = dsm.channels[ichn] >> (10 + r0) & 0x1;
54  DAQ10k |= daq10kSel[ichn];
55  }
56 
57  int HT = 0;
58  int TP = 0;
59  int HTTP = 0;
60 
61  HT = lowerHT | upperHT;
62  TP = lowerTP | upperTP;
63  HTTP = lowerHTTP | upperHTTP;
64 
65  // OUTPUT (16+16):
66  // To EM201
67  // (0-7) Unused
68  // (8) DAQ10k test bit
69  // (9) TP threshold bit
70  // (10) HT.TP threshold bit
71  // (11-15) HT threshold bits
72  // To EM202
73  // (16-21) DAQ10k HT bits
74  // (22-31) Unused
75 
76  int out = 0;
77  out |= DAQ10k << 7;
78  out |= TP << 8;
79  out |= HTTP << 9;
80  out |= HT << 10;
81 
82  out |= daq10kSel[0] << 16;
83  out |= daq10kSel[1] << 17;
84  out |= daq10kSel[2] << 18;
85  out |= daq10kSel[3] << 19;
86  out |= daq10kSel[4] << 20;
87  out |= daq10kSel[5] << 21;
88 
89  dsm.output = out;
90 
91 }
Definition: DSM.hh:16