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
 
 PHGCSimAccumulator (unsigned int detId)
 
void reserve (size_t size)
 
void shrink_to_fit ()
 
 ~PHGCSimAccumulator ()=default
 

Private Attributes

std::vector< Datadata_
 
std::vector< DetIdSizedetIdSize_
 
unsigned short detSubdetId_ = 0
 

Detailed Description

Definition at line 9 of file PHGCSimAccumulator.h.

Constructor & Destructor Documentation

PHGCSimAccumulator::PHGCSimAccumulator ( )
default
PHGCSimAccumulator::PHGCSimAccumulator ( unsigned int  detId)
inline

Definition at line 59 of file PHGCSimAccumulator.h.

References ~PHGCSimAccumulator().

static const int kSubdetOffset
Definition: DetId.h:23
unsigned short detSubdetId_
PHGCSimAccumulator::~PHGCSimAccumulator ( )
default

Referenced by PHGCSimAccumulator().

Member Function Documentation

TmpElem PHGCSimAccumulator::back ( ) const
inline

Definition at line 146 of file PHGCSimAccumulator.h.

References data_, PHGCSimAccumulator::DetIdSize::detIdSize_, detSubdetId_, and DetId::kSubdetOffset.

146  {
147  return TmpElem((detSubdetId_ << DetId::kSubdetOffset) | detIdSize_.back().detIdDetails(),
148  data_.back());
149  }
std::vector< Data > data_
static const int kSubdetOffset
Definition: DetId.h:23
unsigned short detSubdetId_
std::vector< DetIdSize > detIdSize_
const_iterator PHGCSimAccumulator::begin ( void  ) const
inline

Definition at line 152 of file PHGCSimAccumulator.h.

References cbegin().

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

Definition at line 151 of file PHGCSimAccumulator.h.

Referenced by begin().

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

Definition at line 153 of file PHGCSimAccumulator.h.

References data_, and PHGCSimAccumulator::DetIdSize::detIdSize_.

Referenced by end().

153 { 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 79 of file PHGCSimAccumulator.h.

References data_, PHGCSimAccumulator::DetIdSize::detIdMask, PHGCSimAccumulator::DetIdSize::detIdSize_, detSubdetId_, and DetId::kSubdetOffset.

79  {
80  assert( (detId >> DetId::kSubdetOffset) == detSubdetId_ );
81 
82  if(detIdSize_.empty() || detIdSize_.back().detIdDetails() != (detId & DetIdSize::detIdMask)) {
83  detIdSize_.emplace_back(detId);
84  }
85  data_.emplace_back(energyIndex, sampleIndex, data);
86  detIdSize_.back().increaseSize();
87  }
std::vector< Data > data_
static const int kSubdetOffset
Definition: DetId.h:23
static constexpr unsigned detIdMask
unsigned short detSubdetId_
std::vector< DetIdSize > detIdSize_
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
const_iterator PHGCSimAccumulator::end ( void  ) const
inline

Definition at line 154 of file PHGCSimAccumulator.h.

References cend().

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

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

Definition at line 62 of file PHGCSimAccumulator.h.

References data_, and PHGCSimAccumulator::DetIdSize::detIdSize_.

62  {
63  detIdSize_.reserve(size);
64  data_.reserve(size);
65  }
size
Write out results.
std::vector< Data > data_
std::vector< DetIdSize > detIdSize_
void PHGCSimAccumulator::shrink_to_fit ( )
inline

Definition at line 67 of file PHGCSimAccumulator.h.

References data_, and PHGCSimAccumulator::DetIdSize::detIdSize_.

67  {
68  detIdSize_.shrink_to_fit();
69  data_.shrink_to_fit();
70  }
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 157 of file PHGCSimAccumulator.h.

unsigned short PHGCSimAccumulator::detSubdetId_ = 0
private

Definition at line 159 of file PHGCSimAccumulator.h.

Referenced by back(), and emplace_back().