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 135 of file PHGCSimAccumulator.h.

References data_, and detIdSize_.

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

Definition at line 141 of file PHGCSimAccumulator.h.

References cbegin().

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

Definition at line 140 of file PHGCSimAccumulator.h.

Referenced by begin().

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

Definition at line 142 of file PHGCSimAccumulator.h.

References data_, and detIdSize_.

Referenced by end().

142 { 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 70 of file PHGCSimAccumulator.h.

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

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

Definition at line 143 of file PHGCSimAccumulator.h.

References cend().

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

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

Definition at line 53 of file PHGCSimAccumulator.h.

References data_, and detIdSize_.

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

Definition at line 58 of file PHGCSimAccumulator.h.

References data_, and detIdSize_.

58  {
59  detIdSize_.shrink_to_fit();
60  data_.shrink_to_fit();
61  }
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 146 of file PHGCSimAccumulator.h.

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