CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
l1t::PhysicsToBitConverter Class Reference

#include <PhysicsToBitConverter.h>

Public Member Functions

int BuildDecimalValue (int firstbit, int bitlength, int linkid)
 
void Convert ()
 
void Extract32bitwords ()
 
int Get32bitWordLinkEven (int index)
 
int Get32bitWordLinkOdd (int index)
 
int GetHFEt (int region)
 
int GetHFFg (int region)
 
int GetIECard (int cand)
 
int GetIEEt (int cand)
 
int GetIEReg (int cand)
 
int GetNECard (int cand)
 
int GetNEEt (int cand)
 
int GetNEReg (int cand)
 
int GetObject (rctDataBase::rctObjectType t, int firstindex, int secondindex=-1)
 
int GetRCEt (int card, int region)
 
int GetRCHad (int card, int region)
 
int GetRCOf (int card, int region)
 
int GetRCTau (int card, int region)
 
 PhysicsToBitConverter ()
 
int ReadBitInInt (int bit, int value)
 
void Set32bitWordLinkEven (int index, uint32_t value)
 
void Set32bitWordLinkOdd (int index, uint32_t value)
 
void SetHFEt (int value, int region)
 
void SetHFFg (int value, int region)
 
void SetIECard (int value, int cand)
 
void SetIEEt (int value, int cand)
 
void SetIEReg (int value, int cand)
 
void SetNECard (int value, int cand)
 
void SetNEEt (int value, int cand)
 
void SetNEReg (int value, int cand)
 
void SetObject (rctDataBase::rctObjectType t, int value, int firstindex, int secondindex=-1)
 
void SetRCEt (int value, int card, int region)
 
void SetRCHad (int value, int card, int region)
 
void SetRCOf (int value, int card, int region)
 
void SetRCTau (int value, int card, int region)
 
 ~PhysicsToBitConverter ()
 

Private Attributes

int bitsLink [2][192]
 
rctDataBase databaseobject
 
int words32bitLink [2][6]
 

Detailed Description

Definition at line 21 of file PhysicsToBitConverter.h.

Constructor & Destructor Documentation

l1t::PhysicsToBitConverter::PhysicsToBitConverter ( )

Definition at line 5 of file PhysicsToBitConverter.cc.

References bitsLink, funct::m, gen::n, and words32bitLink.

5  {
6  for (int m=0;m<2;m++){
7  for (int n=0;n<6;n++){
8  words32bitLink[m][n]=0;
9  }
10  }
11  for (int m=0;m<2;m++){
12  for (int n=0;n<192;n++){
13  bitsLink[m][n]=0;
14  }
15  }
16  }
l1t::PhysicsToBitConverter::~PhysicsToBitConverter ( )
inline

Definition at line 33 of file PhysicsToBitConverter.h.

33 { }

Member Function Documentation

int l1t::PhysicsToBitConverter::BuildDecimalValue ( int  firstbit,
int  bitlength,
int  linkid 
)

Definition at line 70 of file PhysicsToBitConverter.cc.

References bitsLink, counter, and funct::m.

Referenced by Extract32bitwords(), Get32bitWordLinkOdd(), and GetObject().

70  {
71 
72  int myvalue=0;
73  int counter=0;
74 
75  for (int m=firstbit;m<firstbit+bitlength;m++){
76  myvalue|=(bitsLink[linkid][m]&(0x1)) << counter;
77  counter++;
78  }
79  return myvalue;
80  }
static std::atomic< unsigned int > counter
void l1t::PhysicsToBitConverter::Convert ( )

Definition at line 18 of file PhysicsToBitConverter.cc.

References bitsLink, ReadBitInInt(), and words32bitLink.

Referenced by Get32bitWordLinkOdd(), l1t::stage1::unpack_em(), and l1t::stage1::unpack_region().

18  {
19 
20  for (int iword=0;iword<6;iword++){
21  for (int ibit=0;ibit<32;ibit++){
22  //bitsLink[0].push_back(ReadBitInInt(ibit,words32bitLink[0][iword]));
23  //bitsLink[1].push_back(ReadBitInInt(ibit,words32bitLink[1][iword]));
24  bitsLink[0][ibit+iword*32]=ReadBitInInt(ibit,words32bitLink[0][iword]);
25  bitsLink[1][ibit+iword*32]=ReadBitInInt(ibit,words32bitLink[1][iword]);
26 
27  }
28  }
29  }
int ReadBitInInt(int bit, int value)
void l1t::PhysicsToBitConverter::Extract32bitwords ( )

Definition at line 31 of file PhysicsToBitConverter.cc.

References BuildDecimalValue(), and words32bitLink.

Referenced by Get32bitWordLinkOdd(), and l1t::stage1::RCTEmRegionPacker::pack().

31  {
32  //link,words
33 
34  for (int ilink=0;ilink<2;ilink++){
35  for (int iword=0;iword<6;iword++){
36  words32bitLink[ilink][iword]=BuildDecimalValue(iword*32,32,ilink);
37  }
38  }
39  }
int BuildDecimalValue(int firstbit, int bitlength, int linkid)
int l1t::PhysicsToBitConverter::Get32bitWordLinkEven ( int  index)
inline
int l1t::PhysicsToBitConverter::Get32bitWordLinkOdd ( int  index)
inline
int l1t::PhysicsToBitConverter::GetHFEt ( int  region)
inline

Definition at line 50 of file PhysicsToBitConverter.h.

References GetObject(), and l1t::rctDataBase::HFEt.

Referenced by l1t::stage1::unpack_region().

50 {return GetObject(rctDataBase::HFEt,region);}
int GetObject(rctDataBase::rctObjectType t, int firstindex, int secondindex=-1)
int l1t::PhysicsToBitConverter::GetHFFg ( int  region)
inline

Definition at line 53 of file PhysicsToBitConverter.h.

References GetObject(), and l1t::rctDataBase::HFFg.

Referenced by l1t::stage1::unpack_region().

53 {return GetObject(rctDataBase::HFFg,region);}
int GetObject(rctDataBase::rctObjectType t, int firstindex, int secondindex=-1)
int l1t::PhysicsToBitConverter::GetIECard ( int  cand)
inline

Definition at line 58 of file PhysicsToBitConverter.h.

References GetObject(), and l1t::rctDataBase::IECard.

Referenced by l1t::stage1::unpack_em().

int GetObject(rctDataBase::rctObjectType t, int firstindex, int secondindex=-1)
int l1t::PhysicsToBitConverter::GetIEEt ( int  cand)
inline

Definition at line 59 of file PhysicsToBitConverter.h.

References GetObject(), and l1t::rctDataBase::IEEt.

Referenced by l1t::stage1::unpack_em().

int GetObject(rctDataBase::rctObjectType t, int firstindex, int secondindex=-1)
int l1t::PhysicsToBitConverter::GetIEReg ( int  cand)
inline

Definition at line 57 of file PhysicsToBitConverter.h.

References GetObject(), and l1t::rctDataBase::IEReg.

Referenced by l1t::stage1::unpack_em().

int GetObject(rctDataBase::rctObjectType t, int firstindex, int secondindex=-1)
int l1t::PhysicsToBitConverter::GetNECard ( int  cand)
inline

Definition at line 55 of file PhysicsToBitConverter.h.

References GetObject(), and l1t::rctDataBase::NECard.

Referenced by l1t::stage1::unpack_em().

int GetObject(rctDataBase::rctObjectType t, int firstindex, int secondindex=-1)
int l1t::PhysicsToBitConverter::GetNEEt ( int  cand)
inline

Definition at line 56 of file PhysicsToBitConverter.h.

References GetObject(), and l1t::rctDataBase::NEEt.

Referenced by l1t::stage1::unpack_em().

int GetObject(rctDataBase::rctObjectType t, int firstindex, int secondindex=-1)
int l1t::PhysicsToBitConverter::GetNEReg ( int  cand)
inline

Definition at line 54 of file PhysicsToBitConverter.h.

References GetObject(), and l1t::rctDataBase::NEReg.

Referenced by l1t::stage1::unpack_em().

int GetObject(rctDataBase::rctObjectType t, int firstindex, int secondindex=-1)
int l1t::PhysicsToBitConverter::GetObject ( rctDataBase::rctObjectType  t,
int  firstindex,
int  secondindex = -1 
)

Definition at line 42 of file PhysicsToBitConverter.cc.

References BuildDecimalValue(), databaseobject, l1t::rctDataBase::GetIndices(), l1t::rctDataBase::GetLength(), and l1t::rctDataBase::GetLink().

Referenced by Get32bitWordLinkOdd(), GetHFEt(), GetHFFg(), GetIECard(), GetIEEt(), GetIEReg(), GetNECard(), GetNEEt(), GetNEReg(), GetRCEt(), GetRCHad(), GetRCOf(), and GetRCTau().

43  {
44  int mystart = databaseobject.GetIndices(t,firstindex,secondindex);
45  int mylength = databaseobject.GetLength(t);
46  int mylink = databaseobject.GetLink(t);
47 
48  return BuildDecimalValue(mystart, mylength, mylink);
49  }
int GetLength(rctObjectType t)
Definition: rctDataBase.h:53
int GetLink(rctObjectType t)
Definition: rctDataBase.h:58
int BuildDecimalValue(int firstbit, int bitlength, int linkid)
int GetIndices(rctObjectType t, int firstindex, int secondindex=-1)
Definition: rctDataBase.h:73
int l1t::PhysicsToBitConverter::GetRCEt ( int  card,
int  region 
)
inline

Definition at line 49 of file PhysicsToBitConverter.h.

References GetObject(), and l1t::rctDataBase::RCEt.

Referenced by l1t::stage1::unpack_region().

49 {return GetObject(rctDataBase::RCEt,card,region);}
int GetObject(rctDataBase::rctObjectType t, int firstindex, int secondindex=-1)
int l1t::PhysicsToBitConverter::GetRCHad ( int  card,
int  region 
)
inline

Definition at line 60 of file PhysicsToBitConverter.h.

References GetObject(), and l1t::rctDataBase::RCHad.

Referenced by l1t::stage1::unpack_region().

60 {return GetObject(rctDataBase::RCHad,card,region);}
int GetObject(rctDataBase::rctObjectType t, int firstindex, int secondindex=-1)
int l1t::PhysicsToBitConverter::GetRCOf ( int  card,
int  region 
)
inline

Definition at line 52 of file PhysicsToBitConverter.h.

References GetObject(), and l1t::rctDataBase::RCOf.

Referenced by l1t::stage1::unpack_region().

52 {return GetObject(rctDataBase::RCOf,card,region);}
int GetObject(rctDataBase::rctObjectType t, int firstindex, int secondindex=-1)
int l1t::PhysicsToBitConverter::GetRCTau ( int  card,
int  region 
)
inline

Definition at line 51 of file PhysicsToBitConverter.h.

References GetObject(), and l1t::rctDataBase::RCTau.

Referenced by l1t::stage1::unpack_region().

51 {return GetObject(rctDataBase::RCTau,card,region);}
int GetObject(rctDataBase::rctObjectType t, int firstindex, int secondindex=-1)
int l1t::PhysicsToBitConverter::ReadBitInInt ( int  bit,
int  value 
)

Definition at line 63 of file PhysicsToBitConverter.cc.

Referenced by Convert(), and Get32bitWordLinkOdd().

63  {
64 
65  std::bitset<32> foo(value);
66  return foo[bit];
67 
68  }
Definition: value.py:1
void l1t::PhysicsToBitConverter::Set32bitWordLinkEven ( int  index,
uint32_t  value 
)
inline
void l1t::PhysicsToBitConverter::Set32bitWordLinkOdd ( int  index,
uint32_t  value 
)
inline
void l1t::PhysicsToBitConverter::SetHFEt ( int  value,
int  region 
)
inline

Definition at line 63 of file PhysicsToBitConverter.h.

References l1t::rctDataBase::HFEt, and SetObject().

Referenced by l1t::stage1::RCTEmRegionPacker::pack().

Definition: value.py:1
void SetObject(rctDataBase::rctObjectType t, int value, int firstindex, int secondindex=-1)
void l1t::PhysicsToBitConverter::SetHFFg ( int  value,
int  region 
)
inline

Definition at line 66 of file PhysicsToBitConverter.h.

References l1t::rctDataBase::HFFg, and SetObject().

Referenced by l1t::stage1::RCTEmRegionPacker::pack().

Definition: value.py:1
void SetObject(rctDataBase::rctObjectType t, int value, int firstindex, int secondindex=-1)
void l1t::PhysicsToBitConverter::SetIECard ( int  value,
int  cand 
)
inline

Definition at line 71 of file PhysicsToBitConverter.h.

References l1t::rctDataBase::IECard, and SetObject().

Referenced by l1t::stage1::RCTEmRegionPacker::pack().

Definition: value.py:1
void SetObject(rctDataBase::rctObjectType t, int value, int firstindex, int secondindex=-1)
void l1t::PhysicsToBitConverter::SetIEEt ( int  value,
int  cand 
)
inline

Definition at line 72 of file PhysicsToBitConverter.h.

References l1t::rctDataBase::IEEt, and SetObject().

Referenced by l1t::stage1::RCTEmRegionPacker::pack().

Definition: value.py:1
void SetObject(rctDataBase::rctObjectType t, int value, int firstindex, int secondindex=-1)
void l1t::PhysicsToBitConverter::SetIEReg ( int  value,
int  cand 
)
inline

Definition at line 70 of file PhysicsToBitConverter.h.

References l1t::rctDataBase::IEReg, and SetObject().

Referenced by l1t::stage1::RCTEmRegionPacker::pack().

Definition: value.py:1
void SetObject(rctDataBase::rctObjectType t, int value, int firstindex, int secondindex=-1)
void l1t::PhysicsToBitConverter::SetNECard ( int  value,
int  cand 
)
inline

Definition at line 68 of file PhysicsToBitConverter.h.

References l1t::rctDataBase::NECard, and SetObject().

Referenced by l1t::stage1::RCTEmRegionPacker::pack().

Definition: value.py:1
void SetObject(rctDataBase::rctObjectType t, int value, int firstindex, int secondindex=-1)
void l1t::PhysicsToBitConverter::SetNEEt ( int  value,
int  cand 
)
inline

Definition at line 69 of file PhysicsToBitConverter.h.

References l1t::rctDataBase::NEEt, and SetObject().

Referenced by l1t::stage1::RCTEmRegionPacker::pack().

Definition: value.py:1
void SetObject(rctDataBase::rctObjectType t, int value, int firstindex, int secondindex=-1)
void l1t::PhysicsToBitConverter::SetNEReg ( int  value,
int  cand 
)
inline

Definition at line 67 of file PhysicsToBitConverter.h.

References l1t::rctDataBase::NEReg, and SetObject().

Referenced by l1t::stage1::RCTEmRegionPacker::pack().

Definition: value.py:1
void SetObject(rctDataBase::rctObjectType t, int value, int firstindex, int secondindex=-1)
void l1t::PhysicsToBitConverter::SetObject ( rctDataBase::rctObjectType  t,
int  value,
int  firstindex,
int  secondindex = -1 
)

Definition at line 51 of file PhysicsToBitConverter.cc.

References gather_cfg::cout, databaseobject, l1t::rctDataBase::GetIndices(), l1t::rctDataBase::GetLength(), l1t::rctDataBase::GetLink(), mps_fire::i, funct::pow(), and globals_cff::x1.

Referenced by Get32bitWordLinkOdd(), SetHFEt(), SetHFFg(), SetIECard(), SetIEEt(), SetIEReg(), SetNECard(), SetNEEt(), SetNEReg(), SetRCEt(), SetRCHad(), SetRCOf(), and SetRCTau().

52  {
53  int mystart = databaseobject.GetIndices(t,firstindex,secondindex);
54  int mylength = databaseobject.GetLength(t);
55  int mylink = databaseobject.GetLink(t);
56 
57  if(value>(pow(2,mylength)-1)) std::cout<<"The value you are trying to set has more bins than expected "<<std::endl;
58  for (int i=0;i<mylength;i++) bitsLink[mylink][i+mystart]=(value>>i)&0x1;
59 
60  }
int GetLength(rctObjectType t)
Definition: rctDataBase.h:53
int GetLink(rctObjectType t)
Definition: rctDataBase.h:58
Definition: value.py:1
int GetIndices(rctObjectType t, int firstindex, int secondindex=-1)
Definition: rctDataBase.h:73
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void l1t::PhysicsToBitConverter::SetRCEt ( int  value,
int  card,
int  region 
)
inline

Definition at line 62 of file PhysicsToBitConverter.h.

References l1t::rctDataBase::RCEt, and SetObject().

Referenced by l1t::stage1::RCTEmRegionPacker::pack().

62 {SetObject(rctDataBase::RCEt,value,card,region);}
Definition: value.py:1
void SetObject(rctDataBase::rctObjectType t, int value, int firstindex, int secondindex=-1)
void l1t::PhysicsToBitConverter::SetRCHad ( int  value,
int  card,
int  region 
)
inline

Definition at line 73 of file PhysicsToBitConverter.h.

References l1t::rctDataBase::RCHad, and SetObject().

Referenced by l1t::stage1::RCTEmRegionPacker::pack().

73 {SetObject(rctDataBase::RCHad,value,card,region);}
Definition: value.py:1
void SetObject(rctDataBase::rctObjectType t, int value, int firstindex, int secondindex=-1)
void l1t::PhysicsToBitConverter::SetRCOf ( int  value,
int  card,
int  region 
)
inline

Definition at line 65 of file PhysicsToBitConverter.h.

References l1t::rctDataBase::RCOf, and SetObject().

Referenced by l1t::stage1::RCTEmRegionPacker::pack().

65 {SetObject(rctDataBase::RCOf,value,card,region);}
Definition: value.py:1
void SetObject(rctDataBase::rctObjectType t, int value, int firstindex, int secondindex=-1)
void l1t::PhysicsToBitConverter::SetRCTau ( int  value,
int  card,
int  region 
)
inline

Definition at line 64 of file PhysicsToBitConverter.h.

References l1t::rctDataBase::RCTau, and SetObject().

Referenced by l1t::stage1::RCTEmRegionPacker::pack().

64 {SetObject(rctDataBase::RCTau,value,card,region);}
Definition: value.py:1
void SetObject(rctDataBase::rctObjectType t, int value, int firstindex, int secondindex=-1)

Member Data Documentation

int l1t::PhysicsToBitConverter::bitsLink[2][192]
private

Definition at line 26 of file PhysicsToBitConverter.h.

Referenced by BuildDecimalValue(), Convert(), and PhysicsToBitConverter().

rctDataBase l1t::PhysicsToBitConverter::databaseobject
private

Definition at line 27 of file PhysicsToBitConverter.h.

Referenced by GetObject(), and SetObject().

int l1t::PhysicsToBitConverter::words32bitLink[2][6]
private

Definition at line 24 of file PhysicsToBitConverter.h.

Referenced by Convert(), Extract32bitwords(), and PhysicsToBitConverter().