CMS 3D CMS Logo

Public Types | Public Member Functions

FWItemMuonDigiAccessor< C, V > Class Template Reference

#include <FWItemRandomAccessor.h>

Inheritance diagram for FWItemMuonDigiAccessor< C, V >:
FWItemRandomAccessorBase FWItemAccessorBase

List of all members.

Public Types

typedef C container_type
typedef V value_type

Public Member Functions

 FWItemMuonDigiAccessor (const TClass *iClass)
const void * modelData (int iIndex) const
 REGISTER_FWITEMACCESSOR_METHODS ()
unsigned int size () const

Detailed Description

template<class C, class V>
class FWItemMuonDigiAccessor< C, V >

Definition at line 235 of file FWItemRandomAccessor.h.


Member Typedef Documentation

template<class C , class V >
typedef C FWItemMuonDigiAccessor< C, V >::container_type

Definition at line 238 of file FWItemRandomAccessor.h.

template<class C , class V >
typedef V FWItemMuonDigiAccessor< C, V >::value_type

Definition at line 239 of file FWItemRandomAccessor.h.


Constructor & Destructor Documentation

template<class C , class V >
FWItemMuonDigiAccessor< C, V >::FWItemMuonDigiAccessor ( const TClass *  iClass) [inline]

Definition at line 241 of file FWItemRandomAccessor.h.

      : FWItemRandomAccessorBase(iClass, typeid(value_type))
      {}

Member Function Documentation

template<class C , class V >
const void* FWItemMuonDigiAccessor< C, V >::modelData ( int  iIndex) const [inline, virtual]

Implements FWItemAccessorBase.

Definition at line 247 of file FWItemRandomAccessor.h.

References trackerHits::c, FWItemRandomAccessorBase::getDataPtr(), and i.

      {
         if (!getDataPtr())
            return 0;
         const container_type *c = reinterpret_cast<const container_type*>(getDataPtr());
         size_t collectionOffset = 0;

         for (typename container_type::DigiRangeIterator ci = c->begin(), ce = c->end(); ci != ce; ++ci)
         {
            int i = iIndex - collectionOffset;

            typename container_type::DigiRangeIterator::value_type vt = *ci;


            if (i < std::distance(vt.second.first, vt.second.second))
               return &(*(vt.second.first + i));
            collectionOffset += std::distance(vt.second.first, vt.second.second);
         }

         return 0;
      }
template<class C , class V >
FWItemMuonDigiAccessor< C, V >::REGISTER_FWITEMACCESSOR_METHODS ( )
template<class C , class V >
unsigned int FWItemMuonDigiAccessor< C, V >::size ( void  ) const [inline, virtual]

Implements FWItemAccessorBase.

Definition at line 269 of file FWItemRandomAccessor.h.

References trackerHits::c, and FWItemRandomAccessorBase::getDataPtr().

      {
         if (!getDataPtr())
            return 0;
         const container_type *c = reinterpret_cast<const container_type*>(getDataPtr());
         size_t finalSize = 0;

         for (typename container_type::DigiRangeIterator ci = c->begin(), ce = c->end(); ci != ce; ++ci)
         {
           typename container_type::DigiRangeIterator::value_type vt = *ci;
           finalSize += std::distance(vt.second.first, vt.second.second);
         }
         
         return finalSize;
      }