StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
DSMAlgo_BE001_2014_b.cc
1 #include "DSM.hh"
2 //#include "sumTriggerPatchChannels.hh"
3 #include "DSMAlgo_BE001_2014_b.hh"
4 #include "TString.h"
5 
6 void DSMAlgo_BE001_2014_b::operator()(DSM& dsm)
7 {
8  unsigned int highTowerBits[10][6];
9  unsigned int trigPatchBits[10];
10 
11  //Printf("DSM register 6 %d", dsm.registers[6]);
12  for(int ichn = 0; ichn < 10; ichn++){
13  unsigned int ht = dsm.channels[ichn] & 0x3f;
14  for(int ireg = 0; ireg < 6; ireg++){
15  highTowerBits[ichn][ireg] = ht > dsm.registers[ireg];
16  }
17  unsigned int tp = dsm.channels[ichn] >> 6 & 0x3f;
18  trigPatchBits[ichn] = tp > dsm.registers[6];
19  }
20 
21  unsigned int htBits[6];
22  for(int ireg = 0; ireg < 6; ireg++){
23  htBits[ireg] = 0;
24  for(int ichn = 0; ichn < 10; ichn++){
25  htBits[ireg] |= highTowerBits[ichn][ireg];
26  }
27  }
28  unsigned int tpBits = 0;
29  for(int ichn = 0; ichn < 10; ichn++){
30  tpBits |= trigPatchBits[ichn];
31  }
32  unsigned int httpBits = 0;
33  for(int ichn = 0; ichn < 10; ichn++){
34  httpBits |= (highTowerBits[ichn][5] & trigPatchBits[ichn]);
35  }
36 
37  // OUTPUT (16):
38 
39  // (0-8) Unused
40  // (9) TP threshold bit
41  // (10) HT.TP threshold bit
42  // (11-15) HT threshold bits
43 
44  int out = 0;
45 
46  out |= tpBits << 8;
47  out |= httpBits << 9;
48  out |= htBits[0] << 10;
49  out |= htBits[1] << 11;
50  out |= htBits[2] << 12;
51  out |= htBits[3] << 13;
52  out |= htBits[4] << 14;
53  out |= htBits[5] << 15;
54 
55  dsm.output = out;
56 }
Definition: DSM.hh:16