#include <AlCaRecoTriggerBits.h>
Public Member Functions | |
AlCaRecoTriggerBits () | |
std::string | compose (const std::vector< std::string > &paths) const |
Compose several paths into one string : | |
std::vector< std::string > | decompose (const std::string &concatPaths) const |
Decompose one value of map from concatenated string. | |
~AlCaRecoTriggerBits () | |
Public Attributes | |
std::map< std::string, std::string > | m_alcarecoToTrig |
Static Public Attributes | |
static const std::string::value_type | delimeter_ = ';' |
Delimeter for composing paths to one string in DB: |
Definition at line 7 of file AlCaRecoTriggerBits.h.
AlCaRecoTriggerBits::AlCaRecoTriggerBits | ( | ) |
Definition at line 4 of file AlCaRecoTriggerBits.cc.
{}
AlCaRecoTriggerBits::~AlCaRecoTriggerBits | ( | ) |
Definition at line 5 of file AlCaRecoTriggerBits.cc.
{}
std::string AlCaRecoTriggerBits::compose | ( | const std::vector< std::string > & | paths | ) | const |
Compose several paths into one string :
Definition at line 10 of file AlCaRecoTriggerBits.cc.
References delimeter_, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by AlCaRecoTriggerBitsRcdUpdate::addTriggerLists().
{ std::string mergedPaths; for (std::vector<std::string>::const_iterator iPath = paths.begin(); iPath != paths.end(); ++iPath) { if (iPath != paths.begin()) mergedPaths += delimeter_; if (iPath->find(delimeter_) != std::string::npos) { // What to do in CondFormats? // cms::Exception? std::cerr? edm::LogError? } mergedPaths += *iPath; } // Special case: DB cannot store empty strings, see e.g. // https://hypernews.cern.ch/HyperNews/CMS/get/database/674.html , // so choose delimeter_ for that - it cannot appear in a path anyway. if (mergedPaths.empty()) mergedPaths = delimeter_; return mergedPaths; }
std::vector< std::string > AlCaRecoTriggerBits::decompose | ( | const std::string & | concatPaths | ) | const |
Decompose one value of map from concatenated string.
Definition at line 32 of file AlCaRecoTriggerBits.cc.
References delimeter_, and query::result.
Referenced by AlCaRecoTriggerBitsRcdRead::printMap().
{ // decompose 's' into its parts that are separated by 'delimeter_' // (similar as in // Alignment/CommonAlignmentAlgorithm/src/AlignmentParameterSelector.cc) std::vector<std::string> result; if (!(s.size() == 1 && s[0] == delimeter_)) { // delimeter_ only indicates an empty list as DB cannot store empty strings std::string::size_type previousPos = 0; while (true) { const std::string::size_type delimiterPos = s.find(delimeter_, previousPos); if (delimiterPos == std::string::npos) { result.push_back(s.substr(previousPos)); // until end break; } result.push_back(s.substr(previousPos, delimiterPos - previousPos)); previousPos = delimiterPos + 1; // +1: skip delim } } return result; }
const std::string::value_type AlCaRecoTriggerBits::delimeter_ = ';' [static] |
Delimeter for composing paths to one string in DB:
Definition at line 17 of file AlCaRecoTriggerBits.h.
Referenced by compose(), and decompose().
std::map<std::string,std::string> AlCaRecoTriggerBits::m_alcarecoToTrig |
Definition at line 19 of file AlCaRecoTriggerBits.h.
Referenced by AlCaRecoTriggerBitsRcdUpdate::addTriggerLists(), AlCaRecoTriggerBitsRcdUpdate::analyze(), and AlCaRecoTriggerBitsRcdRead::printMap().