ATLAS Offline Software
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
10 LArFebHeader::LArFebHeader(const HWIdentifier febid):m_FEBId(febid) {
11 
12 }
13 
14 int 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 }
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
LArFebHeader::degray
static int degray(unsigned int x)
like explained in: http://mathworld.wolfram.com/GrayCode.html
Definition: LArFebHeader.cxx:14
DeMoUpdate.tmp2
string tmp2
Definition: DeMoUpdate.py:1168
HWIdentifier
Definition: HWIdentifier.h:13
x
#define x
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
lumiFormat.i
int i
Definition: lumiFormat.py:85
LArFebHeader::LArFebHeader
LArFebHeader()
for ROOT I/O
Definition: LArFebHeader.cxx:7
LArFebHeader.h