CMS 3D CMS Logo

Functions

/data/refman/pasoursint/CMSSW_5_3_0/src/L1Trigger/GlobalTrigger/src/L1GlobalTriggerFunctions.cc File Reference

#include "L1Trigger/GlobalTrigger/interface/L1GlobalTriggerFunctions.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

Go to the source code of this file.

Functions

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

Function Documentation

int factorial ( int  n)

factorial function

Definition at line 13 of file L1GlobalTriggerFunctions.cc.

References factorial().

Referenced by L1GtCaloCondition::evaluateCondition(), L1GtMuonCondition::evaluateCondition(), factorial(), and edm::Lumi3DReWeighting::weight3D_init().

                     {
    return (n <= 0) ? 1 : (n * factorial(n - 1));
}
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 LogTrace.

Referenced by L1GtCorrelationCondition::evaluateCondition().

                                                 {

    int iVec = 0;
    size_t initialPos = 0;
    unsigned long long iValue = 0ULL;

    do {

        iValue = 0ULL;

        if (stringToNumber<unsigned long long> (iValue,
                hexString.substr(initialPos, 16), std::hex)) {

            LogTrace("L1GlobalTrigger") << "\n  String " << hexString.substr(
                    initialPos, 16) << " converted to hex value 0x" << std::hex
                    << iValue << std::dec << std::endl;

            vecInt64[iVec] = iValue;
        } else {
            LogTrace("L1GlobalTrigger")
                    << "\nstringToNumber failed to convert string "
                    << hexString.substr(initialPos, 16) << std::endl;

            return false;
        }

        initialPos = +16;
        iVec++;
    } while (hexString.size() >= (initialPos + 16));

    return true;
}