CMS 3D CMS Logo

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 }
29 
32 
33  auto found = map_.find(detID);
34  CTPPSPixelDigiCollection::IndexRange returnIndexRange{};
35  if(found != map_.end()) {
36  returnIndexRange = found->second;
37  }
38 
40  returnRange.first = container_.begin()+returnIndexRange.first;
41  returnRange.second = container_.begin()+returnIndexRange.second+1;
42 
43  return returnRange;
44 }
45 
46 const std::vector<unsigned int> CTPPSPixelDigiCollection::detIDs() const {
48 
49  auto begin = map_.begin();
50  auto end = map_.end();
51 
52  std::vector<unsigned int> output;
53  output.reserve(12);
54 
55  for (; begin != end; ++begin) {
56  output.push_back(begin->first);
57  }
58 
59  return output;
60 
61 }
std::vector< CTPPSPixelDigi > container_
static std::string const input
Definition: EdmProvDump.cc:45
#define end
Definition: vmac.h:39
std::pair< ContainerIterator, ContainerIterator > Range
const std::vector< unsigned int > detIDs() const
const Range get(unsigned int detID) const
#define begin
Definition: vmac.h:32
inputRange
Get input source.
std::pair< unsigned int, unsigned int > IndexRange
void put(Range input, unsigned int detID)