CMS 3D CMS Logo

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

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 18 of file L1GlobalTriggerFunctions.cc.

References TauDecayModes::dec, and LogTrace.

Referenced by L1GtCorrelationCondition::evaluateCondition().

19  {
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 }
#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 
29 }
double f[11][100]
def fail(errstr="")
#define str(s)