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

◆ factorial()

int factorial ( int  n)

◆ hexStringToInt64()

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.

16  {
17  int iVec = 0;
18  size_t initialPos = 0;
19  unsigned long long iValue = 0ULL;
20 
21  do {
22  iValue = 0ULL;
23 
24  if (stringToNumber<unsigned long long>(iValue, hexString.substr(initialPos, 16), std::hex)) {
25  LogTrace("L1GlobalTrigger") << "\n String " << hexString.substr(initialPos, 16) << " converted to hex value 0x"
26  << std::hex << iValue << std::dec << std::endl;
27 
28  vecInt64[iVec] = iValue;
29  } else {
30  LogTrace("L1GlobalTrigger") << "\nstringToNumber failed to convert string " << hexString.substr(initialPos, 16)
31  << std::endl;
32 
33  return false;
34  }
35 
36  initialPos = +16;
37  iVec++;
38  } while (hexString.size() >= (initialPos + 16));
39 
40  return true;
41 }

References TauDecayModes::dec, and LogTrace.

Referenced by L1GtCorrelationCondition::evaluateCondition().

◆ stringToNumber()

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.

23  {
24  std::istringstream iss(str);
25  return !(iss >> f >> tmpl).fail();
26 }

References f, and str.

dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
factorial
int factorial(int n)
factorial function
Definition: L1GlobalTriggerFunctions.cc:13
str
#define str(s)
Definition: TestProcessor.cc:51
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:224
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143