CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CTPPSPixelDigiCollection.cc
Go to the documentation of this file.
2 
3 #include <algorithm>
4 
5 void CTPPSPixelDigiCollection::put(Range input, unsigned int detID) {
7 
10 
12  std::vector<CTPPSPixelDigi> temporary;
13 
14  auto sort_begin = input.first;
15  auto sort_end = input.second;
16 
17  temporary.insert(std::end(temporary), sort_begin, sort_end);
18 
19  std::sort(temporary.begin(), temporary.end());
20 
21  inputRange.first = container_.size();
22  container_.insert(std::end(container_), std::begin(temporary), std::end(temporary));
23  inputRange.second = container_.size() - 1;
24 
26  map_[detID] = inputRange;
27 }
28 
31 
32  auto found = map_.find(detID);
33  CTPPSPixelDigiCollection::IndexRange returnIndexRange{};
34  if (found != map_.end()) {
35  returnIndexRange = found->second;
36  }
37 
39  returnRange.first = container_.begin() + returnIndexRange.first;
40  returnRange.second = container_.begin() + returnIndexRange.second + 1;
41 
42  return returnRange;
43 }
44 
45 const std::vector<unsigned int> CTPPSPixelDigiCollection::detIDs() const {
47 
48  auto begin = map_.begin();
49  auto end = map_.end();
50 
51  std::vector<unsigned int> output;
52  output.reserve(12);
53 
54  for (; begin != end; ++begin) {
55  output.push_back(begin->first);
56  }
57 
58  return output;
59 }
std::vector< CTPPSPixelDigi > container_
static std::string const input
Definition: EdmProvDump.cc:47
std::pair< ContainerIterator, ContainerIterator > Range
const std::vector< unsigned int > detIDs() const
const Range get(unsigned int detID) const
tuple inputRange
Definition: pileupCalc.py:168
string end
Definition: dataset.py:937
std::pair< unsigned int, unsigned int > IndexRange
void put(Range input, unsigned int detID)