StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
L2hienResult2012.h
1 //
2 // Jan Balewski ,MIT
3 // Example container for results from L2-algo
4 //
5 // L2Result must have a size N*4 char,
6 //
7 
8 #ifndef L2_HIEN_RESULT_2012_H
9 #define L2_HIEN_RESULT_2012_H
10 
12  enum {mySizeChar=164};// negotiate size w/ John before extending
13  enum {maxTowers=40};
14 
15  unsigned int header;//contains total Ntowers (from left, bits [0,7], total ADC [8,31].
16 
17  unsigned int value[maxTowers]; //up to maxTowers ped-subtracted ADC , softID pairs
18 };
19 
20 //...................................
21 inline void
22 L2hienResult2012_print(L2hienResult2012 *p)
23 {
24  if(p==0) {printf("print L2hienResult2012 - NULL pointer ????\n"); return;}
25  printf("print L2hienResult2012: nTowers=%d, total ADC=%d\n",
26  (p->header & 0xFF000000)>>24,
27  (p->header & 0x00FFFFFF));
28  for (unsigned int i=0;i<L2hienResult2012::maxTowers && i<((p->header & 0xFF000000)>>24);i++)
29  printf(" L2hienResult2012: %d: ADC=%d\tsoftID=%d\n",
30  i,
31  (p->value[i] & 0xFFFF0000)>>16,
32  (p->value[i] & 0x0000FFFF));
33  return;
34 };
35 
36 inline void
37 L2hienResult2012_unpackValue(int *ADC, int* softID, unsigned int value)
38 {
39  *ADC=(value & 0xFFFF0000)>>16;
40  *softID=(value & 0x0000FFFF);
41  return;
42 };
43 
44 inline void
45 L2hienResult2012_unpackAllValues(int* nTowers, int* totalADC, int *ADC, int* softID, L2hienResult2012* result)
46 {
47  *nTowers = (result->header & 0xFF000000)>>24;
48  *totalADC =(result->header & 0x00FFFFFF);
49  for (int i=0;i<L2hienResult2012::maxTowers && i<*nTowers;i++)
50  {
51  ADC[i]=(result->value[i] & 0xFFFF0000)>>16;
52  softID[i]=(result->value[i] & 0x0000FFFF);
53  }
54  return;
55 };
56 
57 
58 #endif