CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Private Attributes

edm::DataFrameContainer Class Reference

#include <DataFrameContainer.h>

Inheritance diagram for edm::DataFrameContainer:
EcalDigiCollection EBDigiCollection EEDigiCollection ESDigiCollection

List of all members.

Classes

struct  IterHelp

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)
DataFrame operator[] (size_t i) const
IterPair pair (size_t i)
const_IterPair pair (size_t i) const
void pop_back ()
void push_back (id_type iid, data_type const *idata)
void push_back (id_type iid)
void reserve (size_t isize)
void resize (size_t isize)
void set_back (data_type const *idata)
void set_back (id_type iid, data_type const *idata)
void set_back (id_type iid)
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

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 24 of file DataFrameContainer.h.


Member Typedef Documentation

Definition at line 35 of file DataFrameContainer.h.

Definition at line 34 of file DataFrameContainer.h.

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

Definition at line 51 of file DataFrameContainer.h.

Definition at line 36 of file DataFrameContainer.h.

typedef unsigned short edm::DataFrameContainer::data_type

Definition at line 28 of file DataFrameContainer.h.

Definition at line 30 of file DataFrameContainer.h.

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

Definition at line 32 of file DataFrameContainer.h.

typedef unsigned int edm::DataFrameContainer::id_type

Definition at line 27 of file DataFrameContainer.h.

Definition at line 29 of file DataFrameContainer.h.

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

Definition at line 31 of file DataFrameContainer.h.

Definition at line 33 of file DataFrameContainer.h.

typedef unsigned int edm::DataFrameContainer::size_type

Reimplemented in EcalDigiCollection, EBDigiCollection, EEDigiCollection, and ESDigiCollection.

Definition at line 26 of file DataFrameContainer.h.


Constructor & Destructor Documentation

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

Definition at line 53 of file DataFrameContainer.h.

                         :
      m_subdetId(0), m_stride(0),
      m_ids(), m_data(){}
edm::DataFrameContainer::DataFrameContainer ( size_t  istride,
int  isubdet = 0,
size_t  isize = 0 
) [inline, explicit]

Definition at line 57 of file DataFrameContainer.h.

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

Member Function Documentation

DataFrame edm::DataFrameContainer::back ( ) [inline]
const_iterator edm::DataFrameContainer::begin ( void  ) const [inline]
bool edm::DataFrameContainer::empty ( ) const [inline]

Definition at line 166 of file DataFrameContainer.h.

References m_ids.

{ return m_ids.empty();}
const_iterator edm::DataFrameContainer::end ( void  ) const [inline]
const_iterator edm::DataFrameContainer::find ( id_type  i) const [inline]

Definition at line 145 of file DataFrameContainer.h.

References end(), i, m_ids, and AlCaHLTBitMon_ParallelJobs::p.

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

                                         {
      const_IdIter p = std::lower_bound(m_ids.begin(),m_ids.end(),i);
      return (p==m_ids.end() || (*p)!=i) ? end() :
        boost::make_transform_iterator(boost::counting_iterator<int>(p-m_ids.begin()),
                                       IterHelp(*this));
    }
data_type const* edm::DataFrameContainer::frame ( size_t  cell) const [inline]

Definition at line 174 of file DataFrameContainer.h.

References m_data, and m_stride.

Referenced by operator()(), and edm::DataFrame::set().

                                               {
      return &m_data[cell*m_stride];
    }
id_type edm::DataFrameContainer::id ( size_t  cell) const [inline]

Definition at line 178 of file DataFrameContainer.h.

References m_ids.

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

                                  {
      return m_ids[cell];
    }
data_type edm::DataFrameContainer::operator() ( size_t  cell,
size_t  frame 
) const [inline]

Definition at line 170 of file DataFrameContainer.h.

References frame(), m_data, and m_stride.

                                                          {
      return m_data[cell*m_stride+frame];
    }
DataFrameContainer& edm::DataFrameContainer::operator= ( DataFrameContainer const &  rhs) [inline]

Definition at line 68 of file DataFrameContainer.h.

References swap(), and groupFilesInBlocks::temp.

                                                                 {
      DataFrameContainer temp(rhs);
      this->swap(temp);
      return *this;
    }
DataFrame edm::DataFrameContainer::operator[] ( size_t  i) [inline]

Definition at line 136 of file DataFrameContainer.h.

                                   {
      return DataFrame(*this,i);
    }
DataFrame edm::DataFrameContainer::operator[] ( size_t  i) const [inline]

Definition at line 140 of file DataFrameContainer.h.

                                         {
      return DataFrame(*this,i);
    }
IterPair edm::DataFrameContainer::pair ( size_t  i) [inline]

Definition at line 128 of file DataFrameContainer.h.

References i, m_data, m_ids, and m_stride.

                            {
      return IterPair(m_ids.begin()+i,m_data.begin()+i*m_stride);
    }
const_IterPair edm::DataFrameContainer::pair ( size_t  i) const [inline]

Definition at line 132 of file DataFrameContainer.h.

References i, m_data, m_ids, and m_stride.

                                        {
      return const_IterPair(m_ids.begin()+i,m_data.begin()+i*m_stride);
    }
void edm::DataFrameContainer::pop_back ( ) [inline]

Definition at line 121 of file DataFrameContainer.h.

References m_data, m_ids, and m_stride.

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

                    {
      m_ids.resize(m_ids.size()-1);
      m_data.resize(m_data.size()-m_stride);
    }
void edm::DataFrameContainer::push_back ( id_type  iid) [inline]

Reimplemented in ESDigiCollection.

Definition at line 99 of file DataFrameContainer.h.

References m_data, m_ids, and m_stride.

                                {
      m_ids.push_back(iid);
      m_data.resize(m_data.size()+m_stride);
    }
void edm::DataFrameContainer::push_back ( id_type  iid,
data_type const *  idata 
) [inline]
void edm::DataFrameContainer::reserve ( size_t  isize) [inline]
void edm::DataFrameContainer::resize ( size_t  isize) [inline]

Definition at line 84 of file DataFrameContainer.h.

References m_data, m_ids, and m_stride.

                              {
      m_ids.resize(isize);
      m_data.resize(isize*m_stride);
    }
void edm::DataFrameContainer::set_back ( id_type  iid,
data_type const *  idata 
) [inline]

Definition at line 104 of file DataFrameContainer.h.

References filterCSVwithJSON::copy, fwrapper::cs, m_data, m_ids, and m_stride.

                                                        {
      m_ids.back() = iid;
      size_t cs = m_data.size()-m_stride;
      std::copy(idata,idata+m_stride,m_data.begin()+cs);
    }
void edm::DataFrameContainer::set_back ( id_type  iid) [inline]

Definition at line 109 of file DataFrameContainer.h.

References m_ids.

                               {
      m_ids.back() = iid;
    }
void edm::DataFrameContainer::set_back ( data_type const *  idata) [inline]

Definition at line 112 of file DataFrameContainer.h.

References filterCSVwithJSON::copy, fwrapper::cs, m_data, and m_stride.

                                           {
      size_t cs = m_data.size()-m_stride;
      std::copy(idata,idata+m_stride,m_data.begin()+cs);
    }
size_type edm::DataFrameContainer::size ( void  ) const [inline]
void edm::DataFrameContainer::sort ( )

Definition at line 22 of file DataFrameContainer.cc.

References filterCSVwithJSON::copy, i, j, m_data, m_ids, m_stride, alignCSCRings::s, size(), and tmp.

                                {
    if (size()<2) return;
    std::vector<int> indices(size(),1);
    indices[0]=0;
    std::partial_sum(indices.begin(),indices.end(),indices.begin());
    std::sort(indices.begin(), indices.end(), TypeCompare(m_ids));
    {
      IdContainer tmp(m_ids.size());
      std::copy(
                boost::make_permutation_iterator( m_ids.begin(), indices.begin() ),
                boost::make_permutation_iterator( m_ids.end(), indices.end() ),
                tmp.begin());
      tmp.swap(m_ids);
    }
    {
      //      std::transform(indices.begin(),indices.end(),indices.begin(),
      //             boost::bind(std::multiplies<int>(),m_stride,_1));
      DataContainer tmp(m_data.size());
      size_type s = m_stride*sizeof(data_type);
      for(size_type j=0, i=0; i!=indices.size(); ++i, j+=m_stride)
        ::memcpy(&tmp[j], &m_data[indices[i]*m_stride], s);
      tmp.swap(m_data);
    }
    
  }
size_type edm::DataFrameContainer::stride ( ) const [inline]

Definition at line 164 of file DataFrameContainer.h.

References m_stride.

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

{ return m_stride; }
int edm::DataFrameContainer::subdetId ( ) const [inline]

Definition at line 162 of file DataFrameContainer.h.

References m_subdetId.

{ return m_subdetId; }
void edm::DataFrameContainer::swap ( DataFrameContainer rh) [inline]

Definition at line 61 of file DataFrameContainer.h.

References m_data, m_ids, m_stride, and m_subdetId.

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

                                       {
      std::swap(m_subdetId,rh.m_subdetId);
      std::swap(m_stride,rh.m_stride);
      m_ids.swap(rh.m_ids);
      m_data.swap(rh.m_data);
    }
void edm::DataFrameContainer::swap ( IdContainer iic,
DataContainer idc 
) [inline]

Definition at line 74 of file DataFrameContainer.h.

References m_data, and m_ids.

                                                      {
      m_ids.swap(iic);
      m_data.swap(idc);
    }

Member Data Documentation

Definition at line 187 of file DataFrameContainer.h.

Referenced by subdetId(), and swap().