00001
00002
00003
00004
00005
00006
00007
00008 #ifndef L2_HIEN_RESULT_2012_H
00009 #define L2_HIEN_RESULT_2012_H
00010
00011 struct L2hienResult2012 {
00012 enum {mySizeChar=164};
00013 enum {maxTowers=40};
00014
00015 unsigned int header;
00016
00017 unsigned int value[maxTowers];
00018 };
00019
00020
00021 inline void
00022 L2hienResult2012_print(L2hienResult2012 *p)
00023 {
00024 if(p==0) {printf("print L2hienResult2012 - NULL pointer ????\n"); return;}
00025 printf("print L2hienResult2012: nTowers=%d, total ADC=%d\n",
00026 (p->header & 0xFF000000)>>24,
00027 (p->header & 0x00FFFFFF));
00028 for (unsigned int i=0;i<L2hienResult2012::maxTowers && i<((p->header & 0xFF000000)>>24);i++)
00029 printf(" L2hienResult2012: %d: ADC=%d\tsoftID=%d\n",
00030 i,
00031 (p->value[i] & 0xFFFF0000)>>16,
00032 (p->value[i] & 0x0000FFFF));
00033 return;
00034 };
00035
00036 inline void
00037 L2hienResult2012_unpackValue(int *ADC, int* softID, unsigned int value)
00038 {
00039 *ADC=(value & 0xFFFF0000)>>16;
00040 *softID=(value & 0x0000FFFF);
00041 return;
00042 };
00043
00044 inline void
00045 L2hienResult2012_unpackAllValues(int* nTowers, int* totalADC, int *ADC, int* softID, L2hienResult2012* result)
00046 {
00047 *nTowers = (result->header & 0xFF000000)>>24;
00048 *totalADC =(result->header & 0x00FFFFFF);
00049 for (int i=0;i<L2hienResult2012::maxTowers && i<*nTowers;i++)
00050 {
00051 ADC[i]=(result->value[i] & 0xFFFF0000)>>16;
00052 softID[i]=(result->value[i] & 0x0000FFFF);
00053 }
00054 return;
00055 };
00056
00057
00058 #endif