CMS 3D CMS Logo

L1GlobalTriggerFunctions.cc
Go to the documentation of this file.
1 // this class header
3 
4 // system include files
5 
6 // user include files
8 
9 // methods
10 
11 // factorial function
12 
13 int factorial(int n) { return (n <= 0) ? 1 : (n * factorial(n - 1)); }
14 
15 // hex string to a vector of 64-bit integers
16 bool hexStringToInt64(const std::string &hexString,
17  std::vector<unsigned long long> &vecInt64) {
18 
19  int iVec = 0;
20  size_t initialPos = 0;
21  unsigned long long iValue = 0ULL;
22 
23  do {
24 
25  iValue = 0ULL;
26 
27  if (stringToNumber<unsigned long long>(
28  iValue, hexString.substr(initialPos, 16), std::hex)) {
29 
30  LogTrace("L1GlobalTrigger")
31  << "\n String " << hexString.substr(initialPos, 16)
32  << " converted to hex value 0x" << std::hex << iValue << std::dec
33  << std::endl;
34 
35  vecInt64[iVec] = iValue;
36  } else {
37  LogTrace("L1GlobalTrigger")
38  << "\nstringToNumber failed to convert string "
39  << hexString.substr(initialPos, 16) << std::endl;
40 
41  return false;
42  }
43 
44  initialPos = +16;
45  iVec++;
46  } while (hexString.size() >= (initialPos + 16));
47 
48  return true;
49 }
bool hexStringToInt64(const std::string &hexString, std::vector< unsigned long long > &vecInt64)
int factorial(int n)
factorial function
#define LogTrace(id)