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