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 141 of file PMTDSimAccumulator.h.

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

141  {
142  const auto& id = detIdSize_.back();
143  return TmpElem(id.detId(), id.row(), id.column(), data_.back());
144  }
std::vector< Data > data_
std::vector< DetIdSize > detIdSize_
const_iterator PMTDSimAccumulator::begin ( void  ) const
inline

Definition at line 147 of file PMTDSimAccumulator.h.

References cbegin().

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

Definition at line 146 of file PMTDSimAccumulator.h.

Referenced by begin().

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

Definition at line 148 of file PMTDSimAccumulator.h.

References data_, and detIdSize_.

Referenced by end().

148 { 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 71 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 ||
78  detIdSize_.back().column() != column) {
79  detIdSize_.emplace_back(detId, row, column);
80  }
81  data_.emplace_back(energyIndex, sampleIndex, data);
82  detIdSize_.back().increaseSize();
83  }
std::vector< Data > data_
std::vector< DetIdSize > detIdSize_
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
const_iterator PMTDSimAccumulator::end ( void  ) const
inline

Definition at line 149 of file PMTDSimAccumulator.h.

References cend().

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

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

Definition at line 54 of file PMTDSimAccumulator.h.

References data_, and detIdSize_.

Referenced by mtd_digitizer::saveSimHitAccumulator().

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

Definition at line 59 of file PMTDSimAccumulator.h.

References data_, and detIdSize_.

59  {
60  detIdSize_.shrink_to_fit();
61  data_.shrink_to_fit();
62  }
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 152 of file PMTDSimAccumulator.h.

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