ATLAS Offline Software
Loading...
Searching...
No Matches
LArFebHeader.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
6
8
9//Constructor
11
12}
13
14int LArFebHeader::degray(unsigned int x)
15{ // like explained in: http://mathworld.wolfram.com/GrayCode.html
16
17 int i,j,sum;
18
19 if ( x==138 ) return 141;
20 else if ( x== 136 ) return 142;
21 else if ( x== 128 ) return 143;
22 else {
23 for (i=0; i<32; i++)
24 {
25 sum=0;
26 for (j=i+1; j<32; j++)
27 {
28 sum += (x>>j)&0x1;
29 }
30 // printf("x=%8x sum=%d\n",x,sum );
31
32 if (sum%2) {
33 if (x&(1<<i))
34 {
35 unsigned int tmp1,tmp2=0;
36 if (i < 31)
37 tmp1 = (x>>(i+1))<<(i+1);
38 else
39 tmp1 = 0;
40 if (i>0)
41 tmp2 = x & ((1u<<i)-1);
42 // printf("tmp1 =%x tmp2=%x\n",tmp1,tmp2 );
43
44 x=tmp1|tmp2;
45 }
46 else
47 x |= (1<<i);
48 }
49 }
50 return x;
51 }
52}
#define x
LArFebHeader()
for ROOT I/O
static int degray(unsigned int x)
like explained in: http://mathworld.wolfram.com/GrayCode.html
const HWIdentifier m_FEBId
Feb Identifier.