Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:20:00

0001 // this class header
0002 #include "L1Trigger/GlobalTrigger/interface/L1GlobalTriggerFunctions.h"
0003 
0004 // system include files
0005 
0006 // user include files
0007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0008 
0009 // methods
0010 
0011 // factorial function
0012 
0013 int factorial(int n) { return (n <= 0) ? 1 : (n * factorial(n - 1)); }
0014 
0015 // hex string to a vector of 64-bit integers
0016 bool hexStringToInt64(const std::string &hexString, std::vector<unsigned long long> &vecInt64) {
0017   int iVec = 0;
0018   size_t initialPos = 0;
0019   unsigned long long iValue = 0ULL;
0020 
0021   do {
0022     iValue = 0ULL;
0023 
0024     if (stringToNumber<unsigned long long>(iValue, hexString.substr(initialPos, 16), std::hex)) {
0025       LogTrace("L1GlobalTrigger") << "\n  String " << hexString.substr(initialPos, 16) << " converted to hex value 0x"
0026                                   << std::hex << iValue << std::dec << std::endl;
0027 
0028       vecInt64[iVec] = iValue;
0029     } else {
0030       LogTrace("L1GlobalTrigger") << "\nstringToNumber failed to convert string " << hexString.substr(initialPos, 16)
0031                                   << std::endl;
0032 
0033       return false;
0034     }
0035 
0036     initialPos = +16;
0037     iVec++;
0038   } while (hexString.size() >= (initialPos + 16));
0039 
0040   return true;
0041 }