CMS 3D CMS Logo

PixelDigiCollection Class Reference

#include <DataFormats/SiPixelDigi/interface/PixelDigiCollection.h>

List of all members.

Public Types

typedef std::vector< PixelDigi >
::const_iterator 
ContainerIterator
typedef std::pair< unsigned
int, unsigned int
IndexRange
typedef std::pair
< ContainerIterator,
ContainerIterator
Range
typedef std::map< unsigned int,
IndexRange
Registry
typedef std::map< unsigned int,
IndexRange >::const_iterator 
RegistryIterator

Public Member Functions

const std::vector< unsigned intdetIDs () const
const Range get (unsigned int detID) const
 PixelDigiCollection ()
void put (Range input, unsigned int detID)

Private Attributes

std::vector< PixelDigicontainer_
Registry map_


Detailed Description

Definition at line 9 of file PixelDigiCollection.h.


Member Typedef Documentation

typedef std::vector<PixelDigi>::const_iterator PixelDigiCollection::ContainerIterator

Definition at line 13 of file PixelDigiCollection.h.

typedef std::pair<unsigned int, unsigned int> PixelDigiCollection::IndexRange

Definition at line 15 of file PixelDigiCollection.h.

typedef std::pair<ContainerIterator, ContainerIterator> PixelDigiCollection::Range

Definition at line 14 of file PixelDigiCollection.h.

typedef std::map<unsigned int, IndexRange> PixelDigiCollection::Registry

Definition at line 16 of file PixelDigiCollection.h.

typedef std::map<unsigned int, IndexRange>::const_iterator PixelDigiCollection::RegistryIterator

Definition at line 17 of file PixelDigiCollection.h.


Constructor & Destructor Documentation

PixelDigiCollection::PixelDigiCollection (  )  [inline]

Definition at line 19 of file PixelDigiCollection.h.

00019 {}


Member Function Documentation

const std::vector< unsigned int > PixelDigiCollection::detIDs (  )  const

Definition at line 51 of file PixelDigiCollection.cc.

References begin, end, map_, and output().

00051                                                                 {
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 }

const PixelDigiCollection::Range PixelDigiCollection::get ( unsigned int  detID  )  const

Definition at line 39 of file PixelDigiCollection.cc.

References container_, and map_.

00039                                                                                 {
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 }

void PixelDigiCollection::put ( Range  input,
unsigned int  detID 
)

Definition at line 4 of file PixelDigiCollection.cc.

References begin, container_, end, first, map_, and python::multivaluedict::sort().

00004                                                              {
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 }


Member Data Documentation

std::vector<PixelDigi> PixelDigiCollection::container_ [mutable, private]

Definition at line 26 of file PixelDigiCollection.h.

Referenced by get(), and put().

Registry PixelDigiCollection::map_ [mutable, private]

Definition at line 27 of file PixelDigiCollection.h.

Referenced by detIDs(), get(), and put().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:30:01 2009 for CMSSW by  doxygen 1.5.4