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) {
14  return (n <= 0) ? 1 : (n * factorial(n - 1));
15 }
16 
17 // hex string to a vector of 64-bit integers
18 bool hexStringToInt64(const std::string& hexString,
19  std::vector<unsigned long long>& vecInt64) {
20 
21  int iVec = 0;
22  size_t initialPos = 0;
23  unsigned long long iValue = 0ULL;
24 
25  do {
26 
27  iValue = 0ULL;
28 
29  if (stringToNumber<unsigned long long> (iValue,
30  hexString.substr(initialPos, 16), std::hex)) {
31 
32  LogTrace("L1GlobalTrigger") << "\n String " << hexString.substr(
33  initialPos, 16) << " converted to hex value 0x" << std::hex
34  << iValue << std::dec << std::endl;
35 
36  vecInt64[iVec] = iValue;
37  } else {
38  LogTrace("L1GlobalTrigger")
39  << "\nstringToNumber failed to convert string "
40  << hexString.substr(initialPos, 16) << std::endl;
41 
42  return false;
43  }
44 
45  initialPos = +16;
46  iVec++;
47  } while (hexString.size() >= (initialPos + 16));
48 
49  return true;
50 }
51 
bool hexStringToInt64(const std::string &hexString, std::vector< unsigned long long > &vecInt64)
int factorial(int n)
factorial function
#define LogTrace(id)