CMS 3D CMS Logo

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

#include <PMTDSimAccumulator.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 char row, unsigned char column, unsigned short energyIndex, unsigned short sampleIndex, unsigned short data)
 
const_iterator end () const
 
 PMTDSimAccumulator ()=default
 
void reserve (size_t size)
 
void shrink_to_fit ()
 
 ~PMTDSimAccumulator ()=default
 

Private Attributes

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

Detailed Description

Definition at line 9 of file PMTDSimAccumulator.h.

Constructor & Destructor Documentation

PMTDSimAccumulator::PMTDSimAccumulator ( )
default
PMTDSimAccumulator::~PMTDSimAccumulator ( )
default

Member Function Documentation

TmpElem PMTDSimAccumulator::back ( ) const
inline

Definition at line 148 of file PMTDSimAccumulator.h.

References PMTDSimAccumulator::DetIdSize::column(), data_, PMTDSimAccumulator::DetIdSize::detId(), detIdSize_, and PMTDSimAccumulator::DetIdSize::row().

148  {
149  const auto& id = detIdSize_.back();
150  return TmpElem(id.detId(), id.row(), id.column(),
151  data_.back());
152  }
std::vector< Data > data_
std::vector< DetIdSize > detIdSize_
const_iterator PMTDSimAccumulator::begin ( void  ) const
inline

Definition at line 155 of file PMTDSimAccumulator.h.

References cbegin().

155 { return cbegin(); }
const_iterator cbegin() const
const_iterator PMTDSimAccumulator::cbegin ( ) const
inline

Definition at line 154 of file PMTDSimAccumulator.h.

Referenced by begin().

154 { return const_iterator(this); }
const_iterator PMTDSimAccumulator::cend ( ) const
inline

Definition at line 156 of file PMTDSimAccumulator.h.

References data_, and detIdSize_.

Referenced by end().

156 { return const_iterator(this, detIdSize_.size(), data_.size()); }
std::vector< Data > data_
std::vector< DetIdSize > detIdSize_
void PMTDSimAccumulator::emplace_back ( unsigned int  detId,
unsigned char  row,
unsigned char  column,
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 76 of file PMTDSimAccumulator.h.

References PMTDSimAccumulator::DetIdSize::column(), data_, and detIdSize_.

Referenced by mtd_digitizer::saveSimHitAccumulator().

76  {
77  if(detIdSize_.empty() || detIdSize_.back().detId() != detId || detIdSize_.back().row() != row || detIdSize_.back().column() != column) {
78  detIdSize_.emplace_back(detId, row, column);
79  }
80  data_.emplace_back(energyIndex, sampleIndex, data);
81  detIdSize_.back().increaseSize();
82  }
std::vector< Data > data_
std::vector< DetIdSize > detIdSize_
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
const_iterator PMTDSimAccumulator::end ( void  ) const
inline

Definition at line 157 of file PMTDSimAccumulator.h.

References cend().

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

157 { return cend(); }
const_iterator cend() const
void PMTDSimAccumulator::reserve ( size_t  size)
inline

Definition at line 59 of file PMTDSimAccumulator.h.

References data_, and detIdSize_.

Referenced by mtd_digitizer::saveSimHitAccumulator().

59  {
60  detIdSize_.reserve(size);
61  data_.reserve(size);
62  }
size
Write out results.
std::vector< Data > data_
std::vector< DetIdSize > detIdSize_
void PMTDSimAccumulator::shrink_to_fit ( )
inline

Definition at line 64 of file PMTDSimAccumulator.h.

References data_, and detIdSize_.

64  {
65  detIdSize_.shrink_to_fit();
66  data_.shrink_to_fit();
67  }
std::vector< Data > data_
std::vector< DetIdSize > detIdSize_

Member Data Documentation

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

Definition at line 160 of file PMTDSimAccumulator.h.

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