CMS 3D CMS Logo

PhysicsToBitConverter.cc
Go to the documentation of this file.
2 
3 namespace l1t {
5  for (int m = 0; m < 2; m++) {
6  for (int n = 0; n < 6; n++) {
7  words32bitLink[m][n] = 0;
8  }
9  }
10  for (int m = 0; m < 2; m++) {
11  for (int n = 0; n < 192; n++) {
12  bitsLink[m][n] = 0;
13  }
14  }
15  }
16 
18  for (int iword = 0; iword < 6; iword++) {
19  for (int ibit = 0; ibit < 32; ibit++) {
20  //bitsLink[0].push_back(ReadBitInInt(ibit,words32bitLink[0][iword]));
21  //bitsLink[1].push_back(ReadBitInInt(ibit,words32bitLink[1][iword]));
22  bitsLink[0][ibit + iword * 32] = ReadBitInInt(ibit, words32bitLink[0][iword]);
23  bitsLink[1][ibit + iword * 32] = ReadBitInInt(ibit, words32bitLink[1][iword]);
24  }
25  }
26  }
27 
29  //link,words
30 
31  for (int ilink = 0; ilink < 2; ilink++) {
32  for (int iword = 0; iword < 6; iword++) {
33  words32bitLink[ilink][iword] = BuildDecimalValue(iword * 32, 32, ilink);
34  }
35  }
36  }
37 
39  int mystart = databaseobject.GetIndices(t, firstindex, secondindex);
40  int mylength = databaseobject.GetLength(t);
41  int mylink = databaseobject.GetLink(t);
42 
43  return BuildDecimalValue(mystart, mylength, mylink);
44  }
45 
47  int mystart = databaseobject.GetIndices(t, firstindex, secondindex);
48  int mylength = databaseobject.GetLength(t);
49  int mylink = databaseobject.GetLink(t);
50 
51  if (value > (pow(2, mylength) - 1))
52  std::cout << "The value you are trying to set has more bins than expected " << std::endl;
53  for (int i = 0; i < mylength; i++)
54  bitsLink[mylink][i + mystart] = (value >> i) & 0x1;
55  }
56 
58  std::bitset<32> foo(value);
59  return foo[bit];
60  }
61 
62  int PhysicsToBitConverter::BuildDecimalValue(int firstbit, int bitlength, int linkid) {
63  int myvalue = 0;
64  int counter = 0;
65 
66  for (int m = firstbit; m < firstbit + bitlength; m++) {
67  myvalue |= (bitsLink[linkid][m] & (0x1)) << counter;
68  counter++;
69  }
70  return myvalue;
71  }
72 } // namespace l1t
counter
Definition: counter.py:1
mps_fire.i
i
Definition: mps_fire.py:355
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
dqmiodumpindices.firstindex
firstindex
Definition: dqmiodumpindices.py:25
gather_cfg.cout
cout
Definition: gather_cfg.py:144
l1t::PhysicsToBitConverter::Extract32bitwords
void Extract32bitwords()
Definition: PhysicsToBitConverter.cc:28
l1t::PhysicsToBitConverter::ReadBitInInt
int ReadBitInInt(int bit, int value)
Definition: PhysicsToBitConverter.cc:57
PhysicsToBitConverter.h
l1t::PhysicsToBitConverter::GetObject
int GetObject(rctDataBase::rctObjectType t, int firstindex, int secondindex=-1)
Definition: PhysicsToBitConverter.cc:38
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
OrderedSet.t
t
Definition: OrderedSet.py:90
l1t::PhysicsToBitConverter::SetObject
void SetObject(rctDataBase::rctObjectType t, int value, int firstindex, int secondindex=-1)
Definition: PhysicsToBitConverter.cc:46
l1t::PhysicsToBitConverter::databaseobject
rctDataBase databaseobject
Definition: PhysicsToBitConverter.h:25
l1t
delete x;
Definition: CaloConfig.h:22
l1t::rctDataBase::GetIndices
int GetIndices(rctObjectType t, int firstindex, int secondindex=-1)
Definition: rctDataBase.h:54
value
Definition: value.py:1
counter
static std::atomic< unsigned int > counter
Definition: SharedResourceNames.cc:15
l1t::rctDataBase::GetLink
int GetLink(rctObjectType t)
Definition: rctDataBase.h:40
l1t::PhysicsToBitConverter::words32bitLink
int words32bitLink[2][6]
Definition: PhysicsToBitConverter.h:22
l1t::rctDataBase::rctObjectType
rctObjectType
Definition: rctDataBase.h:12
l1t::PhysicsToBitConverter::bitsLink
int bitsLink[2][192]
Definition: PhysicsToBitConverter.h:24
l1t::rctDataBase::GetLength
int GetLength(rctObjectType t)
Definition: rctDataBase.h:38
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
l1t::PhysicsToBitConverter::Convert
void Convert()
Definition: PhysicsToBitConverter.cc:17
l1t::PhysicsToBitConverter::PhysicsToBitConverter
PhysicsToBitConverter()
Definition: PhysicsToBitConverter.cc:4
l1t::PhysicsToBitConverter::BuildDecimalValue
int BuildDecimalValue(int firstbit, int bitlength, int linkid)
Definition: PhysicsToBitConverter.cc:62