CMS 3D CMS Logo

APVCyclePhaseCollection.cc
Go to the documentation of this file.
1 #include <cstring>
2 #include <set>
4 
5 const int APVCyclePhaseCollection::getPhase(const std::string partition) const {
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 }
APVCyclePhaseCollection::multiphase
Definition: APVCyclePhaseCollection.h:21
phases
std::vector< int > phases
Definition: compareAlignments.cc:30
APVCyclePhaseCollection::invalid
Definition: APVCyclePhaseCollection.h:21
APVCyclePhaseCollection::empty
Definition: APVCyclePhaseCollection.h:21
APVCyclePhaseCollection::_apvmap
std::map< std::string, int > _apvmap
Definition: APVCyclePhaseCollection.h:24
APVCyclePhaseCollection::getPhases
const std::vector< int > getPhases(const std::string partition) const
Definition: APVCyclePhaseCollection.cc:23
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiPixelPI::phase
phase
Definition: SiPixelPayloadInspectorHelper.h:39
APVCyclePhaseCollection.h
APVCyclePhaseCollection::getPhase
const int getPhase(const std::string partition) const
Definition: APVCyclePhaseCollection.cc:5
APVCyclePhaseCollection::nopartition
Definition: APVCyclePhaseCollection.h:21