12 int field = vmx - vmn + 1;
13 int nb = std::bit_width(
static_cast<unsigned>(field - 1));
15 m_IDs.push_back(std::move(
id));
23 int vmx = (1 << nb) - 1;
25 m_IDs.push_back(std::move(
id));
32 for (
unsigned int i=0;i<
m_IDs.size();i++)
34 if (
m_IDs[i].fieldName==name)
37 std::cout<<
"HitIdHelper: field "<<name<<
": supplied value "<<n<<
38 " is not within the allowed range ["<<
m_IDs[i].vMin<<
","<<
m_IDs[i].vMax
39 <<
"] : the result of this action is unpredictable "<<std::endl;
49 for (
unsigned int i=0;i<
m_IDs.size();i++)
51 if (
m_IDs[i].fieldName==name)
54 return n+
m_IDs[i].vMin;
57 std::cout<<
"HitIdHelper: field "<<name<<
" not found: returning 0"<<
64 for (
unsigned int i=0;i<
m_IDs.size();i++)
66 std::cout<<
"-- Field "<<
m_IDs[i].fieldName<<
"\t["<<
m_IDs[i].vMin
67 <<
","<<
m_IDs[i].vMax<<
"]\tnBits "<<
m_IDs[i].nBits
68 <<
"\tfirst Bit "<<
m_IDs[i].firstBit<<std::endl;
74 for (
unsigned int i=0;i<8*
sizeof(int);i++)
76 if ((
id & (1u<<i))) std::cout<<
"1";
99 for (
int i=0;i<field;i++)
101 l=value<<(firstbit-1);
108 for (
int i=0;i<field;i++)
int GetFieldValue(const std::string &name, HitID targetID) const
static void UnsetBit(int &i, int bitpos)
static void Print(int id)
static void Store(int &id, int value, int first, int field)
static int Retrieve(int id, int first, int field)
static void SetBit(int &i, int bitpos)
void InitializeField(const std::string &n, int vmn, int vmx)
void SetFieldValue(const std::string &name, int n, HitID &targetID) const