StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
DSMAlgo_BE003_2014_b.cc
1 
2 #include "DSM.hh"
3 //#include "sumTriggerPatchChannels.hh"
4 #include "DSMAlgo_BE003_2014_b.hh"
5 #include "TString.h"
6 
7 void DSMAlgo_BE003_2014_b::operator()(DSM& dsm)
8 {
9  // INPUT:
10 
11  // 10 x 12-bit BEMC channels
12  // (5-0) high-tower
13  // (11-6) trigger-patch
14 
15  // REGISTERS:
16 
17  // R0: BEMC-High-Tower-Th0 (6)
18  // R1: BEMC-High-Tower-Th1 (6)
19  // R2: BEMC-High-Tower-Th2 (6)
20  // R3: BEMC-High-Tower-Th3 (6)
21  // R4: BEMC-High-Tower-Th4 (6)
22  // R5: BEMC-High-Tower-UPC (6)
23  // R6: BEMC-Trig-Patch-UPC (6)
24  //Printf("BE003: register 5 and 6: %d and %d", dsm.registers[5], dsm.registers[6]);
25  unsigned int highTowerBits[10][6];
26  unsigned int trigPatchBits[10];
27 
28  for(int ichn = 0; ichn < 10; ichn++){
29  unsigned int ht = dsm.channels[ichn] & 0x3f;
30  for(int ireg = 0; ireg < 6; ireg++){
31  highTowerBits[ichn][ireg] = ht > dsm.registers[ireg];
32  }
33  unsigned int tp = dsm.channels[ichn] >> 6 & 0x3f;
34  trigPatchBits[ichn] = tp > dsm.registers[5];
35  }
36 
37  unsigned int evenhtBits[6];
38  unsigned int oddhtBits[6];
39 
40  for(int ireg = 0; ireg < 6; ireg++){
41  evenhtBits[ireg] = 0;
42  oddhtBits[ireg] = 0;
43 
44  for(int iichn = 0; iichn < 5; iichn++){
45  evenhtBits[ireg] |= highTowerBits[2*iichn][ireg];
46  oddhtBits[ireg] |= highTowerBits[2*iichn+1][ireg];
47  }
48  }
49 
50  unsigned int eventpBits = 0;
51  unsigned int oddtpBits = 0;
52 
53  for(int iichn = 0; iichn < 5; iichn++){
54  eventpBits |= trigPatchBits[2*iichn];
55  oddtpBits |= trigPatchBits[2*iichn+1];
56  }
57 
58  unsigned int evenhttpBits = 0;
59  unsigned int oddhttpBits = 0;
60  for(int iichn = 0; iichn < 5; iichn++){
61  evenhttpBits |= (highTowerBits[2*iichn][5] & trigPatchBits[2*iichn]);
62  oddhttpBits |= (highTowerBits[2*iichn+1][5] & trigPatchBits[2*iichn+1]);
63  }
64 
65  // OUTPUT (16):
66 
67  // (0-8) Unused
68  // (9) TP threshold bit odd channels
69  // (10) HT.TP threshold bit odd channels
70  // (11-15) HT threshold bits odd channels
71  // (16-24) Unused
72  // (25) TP threshold bit even channels
73  // (26) HT.TP threshold bit even channels
74  // (27-31) HT threshold bit even channels
75  int out = 0;
76 
77  out |= oddtpBits << 8;
78  out |= oddhttpBits << 9;
79  out |= oddhtBits[0] << 10;
80  out |= oddhtBits[1] << 11;
81  out |= oddhtBits[2] << 12;
82  out |= oddhtBits[3] << 13;
83  out |= oddhtBits[4] << 14;
84  out |= oddhtBits[5] << 15;
85 
86  out |= eventpBits << 24;
87  out |= evenhttpBits << 25;
88  out |= evenhtBits[0] << 26;
89  out |= evenhtBits[1] << 27;
90  out |= evenhtBits[2] << 28;
91  out |= evenhtBits[3] << 29;
92  out |= evenhtBits[4] << 30;
93  out |= evenhtBits[5] << 31;
94 
95  dsm.output = out;
96 }
Definition: DSM.hh:16