CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

PixelDigiCollection Class Reference

#include <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 int > detIDs () 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.

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.

{}

Member Function Documentation

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

Definition at line 52 of file PixelDigiCollection.cc.

References begin, end, map_, and convertSQLitetoXML_cfg::output.

                                                                {
  // returns vector of detIDs in map

  PixelDigiCollection::RegistryIterator begin = map_.begin();
  PixelDigiCollection::RegistryIterator end   = map_.end();

  std::vector<unsigned int> output;

  for (; begin != end; ++begin) {
    output.push_back(begin->first);
  }

  return output;

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

Definition at line 40 of file PixelDigiCollection.cc.

References container_, and map_.

                                                                                {
  // get Digis of detID

  PixelDigiCollection::IndexRange returnIndexRange = map_[detID];

  PixelDigiCollection::Range returnRange;
  returnRange.first  = container_.begin()+returnIndexRange.first;
  returnRange.second = container_.begin()+returnIndexRange.second+1;

  return returnRange;
}
void PixelDigiCollection::put ( Range  input,
unsigned int  detID 
)

Definition at line 5 of file PixelDigiCollection.cc.

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

                                                             {
  // put in Digis of detID

  // store size of vector before put
  IndexRange inputRange;

  // put in PixelDigis from input
  bool first = true;

  // fill input in temporary vector for sorting
  std::vector<PixelDigi> temporary;
  PixelDigiCollection::ContainerIterator sort_begin = input.first;
  PixelDigiCollection::ContainerIterator sort_end = input.second;
  for ( ;sort_begin != sort_end; ++sort_begin ) {
    temporary.push_back(*sort_begin);
  }
  std::sort(temporary.begin(),temporary.end());

  // iterators over input
  PixelDigiCollection::ContainerIterator begin = temporary.begin();
  PixelDigiCollection::ContainerIterator end = temporary.end();
  for ( ;begin != end; ++begin ) {
    container_.push_back(*begin);
    if ( first ) {
      inputRange.first = container_.size()-1;
      first = false;
    }
  }
  inputRange.second = container_.size()-1;
  
  // fill map
  map_[detID] = inputRange;

}

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().