CMS 3D CMS Logo

edm::DataFrameContainer Class Reference

an optitimized container that linearized a "vector of vector". More...

#include <DataFormats/Common/interface/DataFrameContainer.h>

Inheritance diagram for edm::DataFrameContainer:

EcalDigiCollection EBDigiCollection EEDigiCollection

List of all members.

Public Types

typedef std::vector< data_type >
::const_iterator 
const_DataIter
typedef std::vector< id_type >
::const_iterator 
const_IdIter
typedef
boost::transform_iterator
< IterHelp,
boost::counting_iterator< int > > 
const_iterator
typedef std::pair
< const_IdIter, const_DataIter
const_IterPair
typedef unsigned short data_type
typedef std::vector< data_typeDataContainer
typedef std::vector< data_type >
::iterator 
DataIter
typedef unsigned int id_type
typedef std::vector< id_typeIdContainer
typedef std::vector< id_type >
::iterator 
IdIter
typedef std::pair< IdIter,
DataIter
IterPair
typedef unsigned int size_type

Public Member Functions

DataFrame back ()
const_iterator begin () const
 DataFrameContainer (size_t istride, int isubdet=0, size_t isize=0)
 DataFrameContainer ()
bool empty () const
const_iterator end () const
const_iterator find (id_type i) const
data_type const * frame (size_t cell) const
id_type id (size_t cell) const
data_type operator() (size_t cell, size_t frame) const
DataFrameContaineroperator= (DataFrameContainer const &rhs)
DataFrame operator[] (size_t i) const
DataFrame operator[] (size_t i)
const_IterPair pair (size_t i) const
IterPair pair (size_t i)
void pop_back ()
void push_back (id_type iid)
void push_back (id_type iid, data_type const *idata)
void reserve (size_t isize)
void resize (size_t isize)
void set_back (data_type const *idata)
void set_back (id_type iid)
void set_back (id_type iid, data_type const *idata)
size_type size () const
void sort ()
size_type stride () const
int subdetId () const
void swap (IdContainer &iic, DataContainer &idc)
void swap (DataFrameContainer &rh)

Private Attributes

DataContainer m_data
IdContainer m_ids
size_type m_stride
int m_subdetId

Classes

struct  IterHelp


Detailed Description

an optitimized container that linearized a "vector of vector".

It corresponds to a set of fixed size array of 16bit words each belonging to a "channel" identified by an 32bit id

FIXME interface to be finalized once use-cases fully identified

although it can be sorted internally it is strongly adviced to fill it already sorted....

Definition at line 23 of file DataFrameContainer.h.


Member Typedef Documentation

typedef std::vector<data_type>::const_iterator edm::DataFrameContainer::const_DataIter

Definition at line 34 of file DataFrameContainer.h.

typedef std::vector<id_type>::const_iterator edm::DataFrameContainer::const_IdIter

Definition at line 33 of file DataFrameContainer.h.

typedef boost::transform_iterator<IterHelp,boost::counting_iterator<int> > edm::DataFrameContainer::const_iterator

Definition at line 50 of file DataFrameContainer.h.

typedef std::pair<const_IdIter,const_DataIter> edm::DataFrameContainer::const_IterPair

Definition at line 35 of file DataFrameContainer.h.

typedef unsigned short edm::DataFrameContainer::data_type

Definition at line 27 of file DataFrameContainer.h.

typedef std::vector<data_type> edm::DataFrameContainer::DataContainer

Definition at line 29 of file DataFrameContainer.h.

typedef std::vector<data_type>::iterator edm::DataFrameContainer::DataIter

Definition at line 31 of file DataFrameContainer.h.

typedef unsigned int edm::DataFrameContainer::id_type

Definition at line 26 of file DataFrameContainer.h.

typedef std::vector<id_type> edm::DataFrameContainer::IdContainer

Definition at line 28 of file DataFrameContainer.h.

typedef std::vector<id_type>::iterator edm::DataFrameContainer::IdIter

Definition at line 30 of file DataFrameContainer.h.

typedef std::pair<IdIter,DataIter> edm::DataFrameContainer::IterPair

Definition at line 32 of file DataFrameContainer.h.

typedef unsigned int edm::DataFrameContainer::size_type

Reimplemented in EcalDigiCollection, EBDigiCollection, and EEDigiCollection.

Definition at line 25 of file DataFrameContainer.h.


Constructor & Destructor Documentation

edm::DataFrameContainer::DataFrameContainer (  )  [inline]

Definition at line 52 of file DataFrameContainer.h.

00052 {}

edm::DataFrameContainer::DataFrameContainer ( size_t  istride,
int  isubdet = 0,
size_t  isize = 0 
) [inline, explicit]

Definition at line 54 of file DataFrameContainer.h.

00054                                                                                :
00055       m_subdetId(isubdet), m_stride(istride),
00056       m_ids(isize), m_data(isize*m_stride){}
    


Member Function Documentation

DataFrame edm::DataFrameContainer::back (  )  [inline]

Definition at line 114 of file DataFrameContainer.h.

References size().

Referenced by EcalTB07DaqFormatter::interpretRawData(), EcalTBDaqFormatter::interpretRawData(), EcalBarrelRecHitsMaker::loadEcalBarrelRecHits(), EcalEndcapRecHitsMaker::loadEcalEndcapRecHits(), and EcalTBReadout::readOut().

00114                      {
00115       return DataFrame(*this,size()-1);
00116     }

const_iterator edm::DataFrameContainer::begin (  )  const [inline]

Definition at line 149 of file DataFrameContainer.h.

Referenced by EcalMaxSampleUncalibRecHitProducer::produce(), EcalWeightUncalibRecHitProducer::produce(), EcalFixedAlphaBetaFitUncalibRecHitProducer::produce(), EcalAnalFitUncalibRecHitProducer::produce(), EcalSelectiveReadoutSuppressor::run(), EcalSelectiveReadoutValidation::setTtEtSums(), and EcalSelectiveReadoutSuppressor::setTtFlags().

00149                                  {
00150       return  boost::make_transform_iterator(boost::counting_iterator<int>(0),
00151                                              IterHelp(*this));
00152     }

bool edm::DataFrameContainer::empty (  )  const [inline]

Definition at line 163 of file DataFrameContainer.h.

References m_ids.

00163 { return m_ids.empty();}

const_iterator edm::DataFrameContainer::end (  )  const [inline]

Definition at line 153 of file DataFrameContainer.h.

References size().

Referenced by EcalEndcapRecHitsValidation::analyze(), EcalSimpleTBAnalyzer::analyze(), EcalBarrelRecHitsValidation::analyze(), EcalTBValidation::analyze(), find(), EcalMaxSampleUncalibRecHitProducer::produce(), EcalWeightUncalibRecHitProducer::produce(), EcalFixedAlphaBetaFitUncalibRecHitProducer::produce(), EcalAnalFitUncalibRecHitProducer::produce(), EcalSelectiveReadoutSuppressor::run(), EcalSelectiveReadoutValidation::setTtEtSums(), and EcalSelectiveReadoutSuppressor::setTtFlags().

00153                                {
00154       return  boost::make_transform_iterator(boost::counting_iterator<int>(size()),
00155                                              IterHelp(*this));
00156     }

const_iterator edm::DataFrameContainer::find ( id_type  i  )  const [inline]

Definition at line 142 of file DataFrameContainer.h.

References end(), m_ids, and p.

Referenced by EcalEndcapRecHitsValidation::analyze(), EcalSimpleTBAnalyzer::analyze(), EcalBarrelRecHitsValidation::analyze(), and EcalTBValidation::analyze().

00142                                          {
00143       const_IdIter p = std::lower_bound(m_ids.begin(),m_ids.end(),i);
00144       return (p==m_ids.end() || (*p)!=i) ? end() :
00145         boost::make_transform_iterator(boost::counting_iterator<int>(p-m_ids.begin()),
00146                                        IterHelp(*this));
00147     }

data_type const* edm::DataFrameContainer::frame ( size_t  cell  )  const [inline]

Definition at line 171 of file DataFrameContainer.h.

References m_data, and m_stride.

Referenced by edm::DataFrame::set().

00171                                                {
00172       return &m_data[cell*m_stride];
00173     }

id_type edm::DataFrameContainer::id ( size_t  cell  )  const [inline]

Definition at line 175 of file DataFrameContainer.h.

References m_ids.

Referenced by edm::DataFrame::set().

00175                                   {
00176       return m_ids[cell];
00177     }

data_type edm::DataFrameContainer::operator() ( size_t  cell,
size_t  frame 
) const [inline]

Definition at line 167 of file DataFrameContainer.h.

References m_data, and m_stride.

00167                                                           {
00168       return m_data[cell*m_stride+frame];
00169     }

DataFrameContainer& edm::DataFrameContainer::operator= ( DataFrameContainer const &  rhs  )  [inline]

Definition at line 65 of file DataFrameContainer.h.

References swap(), and pyDBSRunClass::temp.

00065                                                                  {
00066       DataFrameContainer temp(rhs);
00067       this->swap(temp);
00068       return *this;
00069     }

DataFrame edm::DataFrameContainer::operator[] ( size_t  i  )  const [inline]

Definition at line 137 of file DataFrameContainer.h.

00137                                          {
00138       return DataFrame(*this,i);
00139     }

DataFrame edm::DataFrameContainer::operator[] ( size_t  i  )  [inline]

Definition at line 133 of file DataFrameContainer.h.

00133                                    {
00134       return DataFrame(*this,i);
00135     }

const_IterPair edm::DataFrameContainer::pair ( size_t  i  )  const [inline]

Definition at line 129 of file DataFrameContainer.h.

References m_data, m_ids, and m_stride.

00129                                         {
00130       return const_IterPair(m_ids.begin()+i,m_data.begin()+i*m_stride);
00131     }

IterPair edm::DataFrameContainer::pair ( size_t  i  )  [inline]

Definition at line 125 of file DataFrameContainer.h.

References m_data, m_ids, and m_stride.

00125                             {
00126       return IterPair(m_ids.begin()+i,m_data.begin()+i*m_stride);
00127     }

void edm::DataFrameContainer::pop_back (  )  [inline]

Definition at line 118 of file DataFrameContainer.h.

References m_data, m_ids, and m_stride.

Referenced by EcalTB07DaqFormatter::interpretRawData(), and EcalTBDaqFormatter::interpretRawData().

00118                     {
00119       m_ids.resize(m_ids.size()-1);
00120       m_data.resize(m_data.size()-m_stride);
00121     }

void edm::DataFrameContainer::push_back ( id_type  iid  )  [inline]

Definition at line 96 of file DataFrameContainer.h.

References m_data, m_ids, and m_stride.

00096                                 {
00097       m_ids.push_back(iid);
00098       m_data.resize(m_data.size()+m_stride);
00099     }

void edm::DataFrameContainer::push_back ( id_type  iid,
data_type const *  idata 
) [inline]

Definition at line 89 of file DataFrameContainer.h.

References edmNew::copy(), m_data, m_ids, and m_stride.

Referenced by EcalTB07DaqFormatter::interpretRawData(), EcalTBDaqFormatter::interpretRawData(), EcalBarrelRecHitsMaker::loadEcalBarrelRecHits(), EcalEndcapRecHitsMaker::loadEcalEndcapRecHits(), EcalTBReadout::readOut(), and EcalSelectiveReadoutSuppressor::run().

00089                                                          {
00090       m_ids.push_back(iid);
00091       size_t cs = m_data.size();
00092       m_data.resize(m_data.size()+m_stride);
00093       std::copy(idata,idata+m_stride,m_data.begin()+cs);
00094     }

void edm::DataFrameContainer::reserve ( size_t  isize  )  [inline]

Definition at line 76 of file DataFrameContainer.h.

References m_data, m_ids, and m_stride.

Referenced by EcalTB07DaqFormatter::interpretRawData(), EcalTBDaqFormatter::interpretRawData(), EcalBarrelRecHitsMaker::loadEcalBarrelRecHits(), EcalEndcapRecHitsMaker::loadEcalEndcapRecHits(), and EcalSelectiveReadoutSuppressor::run().

00076                                {
00077       m_ids.reserve(isize);
00078       m_data.reserve(isize*m_stride);
00079     }

void edm::DataFrameContainer::resize ( size_t  isize  )  [inline]

Definition at line 81 of file DataFrameContainer.h.

References m_data, m_ids, and m_stride.

00081                               {
00082       m_ids.resize(isize);
00083       m_data.resize(isize*m_stride);
00084     }

void edm::DataFrameContainer::set_back ( data_type const *  idata  )  [inline]

Definition at line 109 of file DataFrameContainer.h.

References edmNew::copy(), m_data, and m_stride.

00109                                            {
00110       size_t cs = m_data.size()-m_stride;
00111       std::copy(idata,idata+m_stride,m_data.begin()+cs);
00112     }

void edm::DataFrameContainer::set_back ( id_type  iid  )  [inline]

Definition at line 106 of file DataFrameContainer.h.

References m_ids.

00106                                {
00107       m_ids.back() = iid;
00108     }

void edm::DataFrameContainer::set_back ( id_type  iid,
data_type const *  idata 
) [inline]

Definition at line 101 of file DataFrameContainer.h.

References edmNew::copy(), m_data, m_ids, and m_stride.

00101                                                         {
00102       m_ids.back() = iid;
00103       size_t cs = m_data.size()-m_stride;
00104       std::copy(idata,idata+m_stride,m_data.begin()+cs);
00105     }

size_type edm::DataFrameContainer::size ( void   )  const [inline]

Definition at line 165 of file DataFrameContainer.h.

References m_ids.

Referenced by EcalDigisValidation::analyze(), HLTGetDigi::analyze(), EcalMixingModuleValidation::analyze(), back(), end(), EcalZeroSuppressionProducer::produce(), EcalTBWeightUncalibRecHitProducer::produce(), EcalWeightUncalibRecHitProducer::produce(), EcalMaxSampleUncalibRecHitProducer::produce(), EcalFixedAlphaBetaFitUncalibRecHitProducer::produce(), EcalAnalFitUncalibRecHitProducer::produce(), EcalTBReadout::readOut(), EcalSelectiveReadoutSuppressor::run(), and sort().

00165 { return m_ids.size();}

void edm::DataFrameContainer::sort (  ) 

Definition at line 23 of file DataFrameContainer.cc.

References edmNew::copy(), i, j, m_data, m_ids, m_stride, s, size(), python::multivaluedict::sort(), and tmp.

00023                                 {
00024     if (size()<2) return;
00025     std::vector<int> indices(size(),1);
00026     indices[0]=0;
00027     std::partial_sum(indices.begin(),indices.end(),indices.begin());
00028     std::sort(indices.begin(), indices.end(), TypeCompare(m_ids));
00029     {
00030       IdContainer tmp(m_ids.size());
00031       std::copy(
00032                 boost::make_permutation_iterator( m_ids.begin(), indices.begin() ),
00033                 boost::make_permutation_iterator( m_ids.end(), indices.end() ),
00034                 tmp.begin());
00035       tmp.swap(m_ids);
00036     }
00037     {
00038       //      std::transform(indices.begin(),indices.end(),indices.begin(),
00039       //             boost::bind(std::multiplies<int>(),m_stride,_1));
00040       DataContainer tmp(m_data.size());
00041       size_type s = m_stride*sizeof(data_type);
00042       for(size_type j=0, i=0; i!=indices.size(); ++i, j+=m_stride)
00043         ::memcpy(&tmp[j], &m_data[indices[i]*m_stride], s);
00044       tmp.swap(m_data);
00045     }
00046     
00047   }

size_type edm::DataFrameContainer::stride (  )  const [inline]

Definition at line 161 of file DataFrameContainer.h.

References m_stride.

Referenced by edm::DataFrame::set().

00161 { return m_stride; }

int edm::DataFrameContainer::subdetId (  )  const [inline]

Definition at line 159 of file DataFrameContainer.h.

References m_subdetId.

00159 { return m_subdetId; }

void edm::DataFrameContainer::swap ( IdContainer iic,
DataContainer idc 
) [inline]

Definition at line 71 of file DataFrameContainer.h.

References m_data, and m_ids.

00071                                                       {
00072       m_ids.swap(iic);
00073       m_data.swap(idc);
00074     }

void edm::DataFrameContainer::swap ( DataFrameContainer rh  )  [inline]

Definition at line 58 of file DataFrameContainer.h.

References m_data, m_ids, m_stride, m_subdetId, and std::swap().

Referenced by operator=(), edm::swap(), and std::swap().

00058                                        {
00059       std::swap(m_subdetId,rh.m_subdetId);
00060       std::swap(m_stride,rh.m_stride);
00061       m_ids.swap(rh.m_ids);
00062       m_data.swap(rh.m_data);
00063     }


Member Data Documentation

DataContainer edm::DataFrameContainer::m_data [private]

Definition at line 190 of file DataFrameContainer.h.

Referenced by frame(), operator()(), pair(), pop_back(), push_back(), reserve(), resize(), set_back(), sort(), and swap().

IdContainer edm::DataFrameContainer::m_ids [private]

Definition at line 189 of file DataFrameContainer.h.

Referenced by empty(), find(), id(), pair(), pop_back(), push_back(), reserve(), resize(), set_back(), size(), sort(), and swap().

size_type edm::DataFrameContainer::m_stride [private]

Definition at line 187 of file DataFrameContainer.h.

Referenced by frame(), operator()(), pair(), pop_back(), push_back(), reserve(), resize(), set_back(), sort(), stride(), and swap().

int edm::DataFrameContainer::m_subdetId [private]

Definition at line 184 of file DataFrameContainer.h.

Referenced by subdetId(), and swap().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:39:57 2009 for CMSSW by  doxygen 1.5.4