CMS 3D CMS Logo

PixelDigiCollection.cc

Go to the documentation of this file.
00001 #include "DataFormats/SiPixelDigi/interface/PixelDigiCollection.h"
00002 #include <iostream>
00003 
00004 void PixelDigiCollection::put(Range input, unsigned int detID) {
00005   // put in Digis of detID
00006 
00007   // store size of vector before put
00008   IndexRange inputRange;
00009 
00010   // put in PixelDigis from input
00011   bool first = true;
00012 
00013   // fill input in temporary vector for sorting
00014   std::vector<PixelDigi> temporary;
00015   PixelDigiCollection::ContainerIterator sort_begin = input.first;
00016   PixelDigiCollection::ContainerIterator sort_end = input.second;
00017   for ( ;sort_begin != sort_end; ++sort_begin ) {
00018     temporary.push_back(*sort_begin);
00019   }
00020   std::sort(temporary.begin(),temporary.end());
00021 
00022   // iterators over input
00023   PixelDigiCollection::ContainerIterator begin = temporary.begin();
00024   PixelDigiCollection::ContainerIterator end = temporary.end();
00025   for ( ;begin != end; ++begin ) {
00026     container_.push_back(*begin);
00027     if ( first ) {
00028       inputRange.first = container_.size()-1;
00029       first = false;
00030     }
00031   }
00032   inputRange.second = container_.size()-1;
00033   
00034   // fill map
00035   map_[detID] = inputRange;
00036 
00037 }
00038 
00039 const PixelDigiCollection::Range PixelDigiCollection::get(unsigned int detID) const {
00040   // get Digis of detID
00041 
00042   PixelDigiCollection::IndexRange returnIndexRange = map_[detID];
00043 
00044   PixelDigiCollection::Range returnRange;
00045   returnRange.first  = container_.begin()+returnIndexRange.first;
00046   returnRange.second = container_.begin()+returnIndexRange.second+1;
00047 
00048   return returnRange;
00049 }
00050 
00051 const std::vector<unsigned int> PixelDigiCollection::detIDs() const {
00052   // returns vector of detIDs in map
00053 
00054   PixelDigiCollection::RegistryIterator begin = map_.begin();
00055   PixelDigiCollection::RegistryIterator end   = map_.end();
00056 
00057   std::vector<unsigned int> output;
00058 
00059   for (; begin != end; ++begin) {
00060     output.push_back(begin->first);
00061   }
00062 
00063   return output;
00064 
00065 }

Generated on Tue Jun 9 17:31:41 2009 for CMSSW by  doxygen 1.5.4