CMS 3D CMS Logo

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