CMS 3D CMS Logo

APVCyclePhaseCollection.cc
Go to the documentation of this file.
1 #include <cstring>
2 #include <set>
4 
6  int phase = empty;
7 
8  for (std::map<std::string, int>::const_iterator it = _apvmap.begin(); it != _apvmap.end(); it++) {
9  if (strstr(it->first.c_str(), partition.c_str()) == it->first.c_str() || strcmp(partition.c_str(), "All") == 0) {
10  if (phase == empty) {
11  phase = it->second;
12  } else if (phase != it->second) {
13  return multiphase;
14  }
15  }
16  }
17 
18  if (phase == empty)
19  return nopartition;
20  return phase;
21 }
22 
23 const std::vector<int> APVCyclePhaseCollection::getPhases(const std::string partition) const {
24  std::set<int> phasesset;
25 
26  for (std::map<std::string, int>::const_iterator it = _apvmap.begin(); it != _apvmap.end(); it++) {
27  if (strstr(it->first.c_str(), partition.c_str()) == it->first.c_str() || strcmp(partition.c_str(), "Any") == 0) {
28  if (it->second >= 0) {
29  phasesset.insert(it->second);
30  }
31  }
32  }
33 
34  std::vector<int> phases;
35 
36  for (std::set<int>::const_iterator phase = phasesset.begin(); phase != phasesset.end(); ++phase) {
37  if (*phase != empty && *phase != invalid) {
38  phases.push_back(*phase);
39  }
40  }
41 
42  return phases;
43 }
std::map< std::string, int > _apvmap
const std::vector< int > getPhases(const std::string partition) const
std::vector< int > phases
const int getPhase(const std::string partition) const