CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2/src/L1Trigger/GlobalTrigger/src/L1GlobalTriggerFunctions.cc

Go to the documentation of this file.
00001 // this class header
00002 #include "L1Trigger/GlobalTrigger/interface/L1GlobalTriggerFunctions.h"
00003 
00004 // system include files
00005 
00006 // user include files
00007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00008 
00009 // methods
00010 
00011 // factorial function
00012 
00013 int factorial(int n) {
00014     return (n <= 0) ? 1 : (n * factorial(n - 1));
00015 }
00016 
00017 // hex string to a vector of 64-bit integers
00018 bool hexStringToInt64(const std::string& hexString,
00019         std::vector<unsigned long long>& vecInt64) {
00020 
00021     int iVec = 0;
00022     size_t initialPos = 0;
00023     unsigned long long iValue = 0ULL;
00024 
00025     do {
00026 
00027         iValue = 0ULL;
00028 
00029         if (stringToNumber<unsigned long long> (iValue,
00030                 hexString.substr(initialPos, 16), std::hex)) {
00031 
00032             LogTrace("L1GlobalTrigger") << "\n  String " << hexString.substr(
00033                     initialPos, 16) << " converted to hex value 0x" << std::hex
00034                     << iValue << std::dec << std::endl;
00035 
00036             vecInt64[iVec] = iValue;
00037         } else {
00038             LogTrace("L1GlobalTrigger")
00039                     << "\nstringToNumber failed to convert string "
00040                     << hexString.substr(initialPos, 16) << std::endl;
00041 
00042             return false;
00043         }
00044 
00045         initialPos = +16;
00046         iVec++;
00047     } while (hexString.size() >= (initialPos + 16));
00048 
00049     return true;
00050 }
00051