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 
7  int phase = empty;
8 
9  for(std::map<std::string,int>::const_iterator it=_apvmap.begin();it!=_apvmap.end();it++) {
10  if(strstr(it->first.c_str(),partition.c_str())==it->first.c_str() || strcmp(partition.c_str(),"All")==0 ) {
11  if(phase==empty ) {
12  phase = it->second;
13  }
14  else if(phase!=it->second) {
15  return multiphase;
16  }
17  }
18  }
19 
20  if(phase==empty) return nopartition;
21  return phase;
22 
23 
24 }
25 
26 const std::vector<int> APVCyclePhaseCollection::getPhases(const std::string partition) const {
27 
28  std::set<int> phasesset;
29 
30  for(std::map<std::string,int>::const_iterator it=_apvmap.begin();it!=_apvmap.end();it++) {
31  if(strstr(it->first.c_str(),partition.c_str())==it->first.c_str() || strcmp(partition.c_str(),"Any")==0 ) {
32  if(it->second>=0 ) {
33  phasesset.insert(it->second);
34  }
35  }
36  }
37 
38  std::vector<int> phases;
39 
40  for(std::set<int>::const_iterator phase=phasesset.begin();phase!=phasesset.end();++phase) {
41  if(*phase!=empty && *phase!=invalid) {
42  phases.push_back(*phase);
43  }
44  }
45 
46  return phases;
47 
48 
49 }
50 
const int getPhase(const std::string partition) const
const std::vector< int > getPhases(const std::string partition) const
std::vector< int > phases
std::map< std::string, int > _apvmap