CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Attributes
PHGCSimAccumulator Class Reference

#include <PHGCSimAccumulator.h>

Classes

class  const_iterator
 
class  Data
 
class  DetIdSize
 
class  TmpElem
 

Public Member Functions

TmpElem back () const
 
const_iterator begin () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
void emplace_back (unsigned int detId, unsigned short energyIndex, unsigned short sampleIndex, unsigned short data)
 
const_iterator end () const
 
 PHGCSimAccumulator ()=default
 
void reserve (size_t size)
 
void shrink_to_fit ()
 
 ~PHGCSimAccumulator ()=default
 

Private Attributes

std::vector< Datadata_
 
std::vector< DetIdSizedetIdSize_
 

Detailed Description

Definition at line 9 of file PHGCSimAccumulator.h.

Constructor & Destructor Documentation

PHGCSimAccumulator::PHGCSimAccumulator ( )
default
PHGCSimAccumulator::~PHGCSimAccumulator ( )
default

Member Function Documentation

TmpElem PHGCSimAccumulator::back ( ) const
inline

Definition at line 123 of file PHGCSimAccumulator.h.

References data_, and detIdSize_.

123 { return TmpElem(detIdSize_.back().detId(), data_.back()); }
std::vector< Data > data_
std::vector< DetIdSize > detIdSize_
const_iterator PHGCSimAccumulator::begin ( void  ) const
inline

Definition at line 126 of file PHGCSimAccumulator.h.

References cbegin().

126 { return cbegin(); }
const_iterator cbegin() const
const_iterator PHGCSimAccumulator::cbegin ( ) const
inline

Definition at line 125 of file PHGCSimAccumulator.h.

Referenced by begin().

125 { return const_iterator(this); }
const_iterator PHGCSimAccumulator::cend ( ) const
inline

Definition at line 127 of file PHGCSimAccumulator.h.

References data_, and detIdSize_.

Referenced by end().

127 { return const_iterator(this, detIdSize_.size(), data_.size()); }
std::vector< Data > data_
std::vector< DetIdSize > detIdSize_
void PHGCSimAccumulator::emplace_back ( unsigned int  detId,
unsigned short  energyIndex,
unsigned short  sampleIndex,
unsigned short  data 
)
inline

Adds data for a given detId, energyIndex, and sampleIndex.

It is the caller's responsibility to ensure that energyIndex, sampleIndex, and data fit in the space reserved for them in the Data bitfield above.

Definition at line 67 of file PHGCSimAccumulator.h.

References data_, PHGCSimAccumulator::DetIdSize::detId(), and detIdSize_.

67  {
68  if (detIdSize_.empty() || detIdSize_.back().detId() != detId) {
69  detIdSize_.emplace_back(detId);
70  }
71  data_.emplace_back(energyIndex, sampleIndex, data);
72  detIdSize_.back().increaseSize();
73  }
std::vector< Data > data_
std::vector< DetIdSize > detIdSize_
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
const_iterator PHGCSimAccumulator::end ( void  ) const
inline

Definition at line 128 of file PHGCSimAccumulator.h.

References cend().

Referenced by Types.LuminosityBlockRange::cppID(), and Types.EventRange::cppID().

128 { return cend(); }
const_iterator cend() const
void PHGCSimAccumulator::reserve ( size_t  size)
inline

Definition at line 50 of file PHGCSimAccumulator.h.

References data_, and detIdSize_.

50  {
51  detIdSize_.reserve(size);
52  data_.reserve(size);
53  }
size
Write out results.
std::vector< Data > data_
std::vector< DetIdSize > detIdSize_
void PHGCSimAccumulator::shrink_to_fit ( )
inline

Definition at line 55 of file PHGCSimAccumulator.h.

References data_, and detIdSize_.

55  {
56  detIdSize_.shrink_to_fit();
57  data_.shrink_to_fit();
58  }
std::vector< Data > data_
std::vector< DetIdSize > detIdSize_

Member Data Documentation

std::vector<Data> PHGCSimAccumulator::data_
private
std::vector<DetIdSize> PHGCSimAccumulator::detIdSize_
private

Definition at line 131 of file PHGCSimAccumulator.h.

Referenced by back(), cend(), emplace_back(), reserve(), and shrink_to_fit().