CMS 3D CMS Logo

AlCaRecoTriggerBits.cc
Go to the documentation of this file.
2 
5 
7 
8 //_____________________________________________________________________
9 std::string AlCaRecoTriggerBits::compose(const std::vector<std::string> &paths) const {
10  std::string mergedPaths;
11  for (std::vector<std::string>::const_iterator iPath = paths.begin(); iPath != paths.end(); ++iPath) {
12  if (iPath != paths.begin())
13  mergedPaths += delimeter_;
14  if (iPath->find(delimeter_) != std::string::npos) {
15  // What to do in CondFormats?
16  // cms::Exception? std::cerr? edm::LogError?
17  }
18  mergedPaths += *iPath;
19  }
20 
21  // Special case: DB cannot store empty strings, see e.g.
22  // https://hypernews.cern.ch/HyperNews/CMS/get/database/674.html ,
23  // so choose delimeter_ for that - it cannot appear in a path anyway.
24  if (mergedPaths.empty())
25  mergedPaths = delimeter_;
26 
27  return mergedPaths;
28 }
29 
30 //_____________________________________________________________________
31 std::vector<std::string> AlCaRecoTriggerBits::decompose(const std::string &s) const {
32  // decompose 's' into its parts that are separated by 'delimeter_'
33  // (similar as in
34  // Alignment/CommonAlignmentAlgorithm/src/AlignmentParameterSelector.cc)
35 
36  std::vector<std::string> result;
37  if (!(s.size() == 1 && s[0] == delimeter_)) {
38  // delimeter_ only indicates an empty list as DB cannot store empty strings
39  std::string::size_type previousPos = 0;
40  while (true) {
41  const std::string::size_type delimiterPos = s.find(delimeter_, previousPos);
42  if (delimiterPos == std::string::npos) {
43  result.push_back(s.substr(previousPos)); // until end
44  break;
45  }
46  result.push_back(s.substr(previousPos, delimiterPos - previousPos));
47  previousPos = delimiterPos + 1; // +1: skip delim
48  }
49  }
50 
51  return result;
52 }
AlCaRecoTriggerBits.h
alignCSCRings.s
s
Definition: alignCSCRings.py:92
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
AlCaRecoTriggerBits::decompose
std::vector< std::string > decompose(const std::string &concatPaths) const
Decompose one value of map from concatenated string.
Definition: AlCaRecoTriggerBits.cc:31
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
AlCaRecoTriggerBits::AlCaRecoTriggerBits
AlCaRecoTriggerBits()
Definition: AlCaRecoTriggerBits.cc:3
AlCaRecoTriggerBits::~AlCaRecoTriggerBits
~AlCaRecoTriggerBits()
Definition: AlCaRecoTriggerBits.cc:4
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
AlCaRecoTriggerBits::delimeter_
static const std::string::value_type delimeter_
Delimeter for composing paths to one string in DB:
Definition: AlCaRecoTriggerBits.h:19
Skims_PA_cff.paths
paths
Definition: Skims_PA_cff.py:18
mps_fire.result
result
Definition: mps_fire.py:311
AlCaRecoTriggerBits::compose
std::string compose(const std::vector< std::string > &paths) const
Compose several paths into one string :
Definition: AlCaRecoTriggerBits.cc:9