CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

SiStripClusterCollection Class Reference

#include <SiStripClusterCollection.h>

List of all members.

Public Types

typedef std::vector
< SiStripCluster
container
typedef container::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
typedef container::value_type value_type

Public Member Functions

const std::vector< unsigned int > detIDs () const
const Range get (unsigned int detID) const
void put (Range input, unsigned int detID)
 SiStripClusterCollection ()
size_t size () const

Private Attributes

container container_
Registry map_

Detailed Description

Definition at line 9 of file SiStripClusterCollection.h.


Member Typedef Documentation

Definition at line 12 of file SiStripClusterCollection.h.

typedef container::const_iterator SiStripClusterCollection::ContainerIterator

Definition at line 14 of file SiStripClusterCollection.h.

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

Definition at line 16 of file SiStripClusterCollection.h.

Definition at line 15 of file SiStripClusterCollection.h.

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

Definition at line 17 of file SiStripClusterCollection.h.

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

Definition at line 18 of file SiStripClusterCollection.h.

typedef container::value_type SiStripClusterCollection::value_type

Definition at line 13 of file SiStripClusterCollection.h.


Constructor & Destructor Documentation

SiStripClusterCollection::SiStripClusterCollection ( ) [inline]

Definition at line 20 of file SiStripClusterCollection.h.

{}

Member Function Documentation

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

Definition at line 59 of file SiStripClusterCollection.cc.

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

                                                                     {
  // returns vector of detIDs in map

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

  std::vector<unsigned int> output;

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

  return output;

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

Definition at line 41 of file SiStripClusterCollection.cc.

References container_, and map_.

                                                                                          {
  // get RecHits of detID

  SiStripClusterCollection::RegistryIterator returnIndex = map_.find(detID);

  if (returnIndex == map_.end()){
    return Range (container_.end(), container_.end());
  }

  SiStripClusterCollection::IndexRange returnIndexRange = returnIndex->second;

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

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

Definition at line 5 of file SiStripClusterCollection.cc.

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

                                                                                          {
  // put in RecHits of detID
  if (input.first == input.second) return ;

  // store size of vector before put
  SiStripClusterCollection::IndexRange inputRange;
  
  // put in SiStripClusters from input
  bool first = true;
  
  // fill input in temporary vector for sorting
  std::vector<SiStripCluster> temporary;
  SiStripClusterCollection::ContainerIterator sort_begin = input.first;
  SiStripClusterCollection::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
  SiStripClusterCollection::ContainerIterator begin = temporary.begin();
  SiStripClusterCollection::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;

}
size_t SiStripClusterCollection::size ( void  ) const [inline]

Definition at line 25 of file SiStripClusterCollection.h.

References container_.

{ return container_.size(); }

Member Data Documentation

Definition at line 28 of file SiStripClusterCollection.h.

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

Definition at line 29 of file SiStripClusterCollection.h.

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