CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PixelDigiCollection.cc
Go to the documentation of this file.
2 #include <iostream>
3 #include <algorithm>
4 
5 void PixelDigiCollection::put(Range input, unsigned int detID) {
6  // put in Digis of detID
7 
8  // store size of vector before put
10 
11  // put in PixelDigis from input
12  bool first = true;
13 
14  // fill input in temporary vector for sorting
15  std::vector<PixelDigi> temporary;
16  PixelDigiCollection::ContainerIterator sort_begin = input.first;
17  PixelDigiCollection::ContainerIterator sort_end = input.second;
18  for ( ;sort_begin != sort_end; ++sort_begin ) {
19  temporary.push_back(*sort_begin);
20  }
21  std::sort(temporary.begin(),temporary.end());
22 
23  // iterators over input
26  for ( ;begin != end; ++begin ) {
27  container_.push_back(*begin);
28  if ( first ) {
29  inputRange.first = container_.size()-1;
30  first = false;
31  }
32  }
33  inputRange.second = container_.size()-1;
34 
35  // fill map
36  map_[detID] = inputRange;
37 
38 }
39 
40 const PixelDigiCollection::Range PixelDigiCollection::get(unsigned int detID) const {
41  // get Digis of detID
42 
43  PixelDigiCollection::IndexRange returnIndexRange = map_[detID];
44 
45  PixelDigiCollection::Range returnRange;
46  returnRange.first = container_.begin()+returnIndexRange.first;
47  returnRange.second = container_.begin()+returnIndexRange.second+1;
48 
49  return returnRange;
50 }
51 
52 const std::vector<unsigned int> PixelDigiCollection::detIDs() const {
53  // returns vector of detIDs in map
54 
57 
58  std::vector<unsigned int> output;
59 
60  for (; begin != end; ++begin) {
61  output.push_back(begin->first);
62  }
63 
64  return output;
65 
66 }
inputRange
Get input source.
const Range get(unsigned int detID) const
std::map< unsigned int, IndexRange >::const_iterator RegistryIterator
std::vector< PixelDigi > container_
#define end
Definition: vmac.h:38
std::pair< ContainerIterator, ContainerIterator > Range
bool first
Definition: L1TdeRCT.cc:79
void put(Range input, unsigned int detID)
tuple input
Definition: collect_tpl.py:10
std::vector< PixelDigi >::const_iterator ContainerIterator
const std::vector< unsigned int > detIDs() const
#define begin
Definition: vmac.h:31
std::pair< unsigned int, unsigned int > IndexRange