CMS 3D CMS Logo

Functions
L1GlobalTriggerFunctions.h File Reference
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
#include <sstream>

Go to the source code of this file.

Functions

int factorial (int n)
 factorial function More...
 
bool hexStringToInt64 (const std::string &, std::vector< unsigned long long > &)
 
template<class T >
bool stringToNumber (T &tmpl, const std::string &str, std::ios_base &(*f)(std::ios_base &))
 

Function Documentation

int factorial ( int  n)
bool hexStringToInt64 ( const std::string &  ,
std::vector< unsigned long long > &   
)

convert a hex string to a vector of 64-bit integers, with the vector size depending on the string size return false in case of error

Definition at line 16 of file L1GlobalTriggerFunctions.cc.

References TauDecayModes::dec, and LogTrace.

Referenced by L1GtCorrelationCondition::evaluateCondition().

17  {
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 }
#define LogTrace(id)
template<class T >
bool stringToNumber ( T tmpl,
const std::string &  str,
std::ios_base &(*)(std::ios_base &)  f 
)

convert a string to a integer-type number the third parameter of stringToNumber should be one of std::hex, std::dec or std::oct

Definition at line 23 of file L1GlobalTriggerFunctions.h.

References f, and cmsPerfPublish::fail().

24  {
25 
26  std::istringstream iss(str);
27  return !(iss >> f >> tmpl).fail();
28 }
double f[11][100]
def fail(errstr="")
#define str(s)