CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions
FWItemDetSetAccessor< C, COLL, V > Class Template Reference

#include <FWItemRandomAccessor.h>

Inheritance diagram for FWItemDetSetAccessor< C, COLL, V >:
FWItemRandomAccessorBase FWItemAccessorBase

Public Types

typedef COLL collection_type
 
typedef V collection_value_type
 
typedef C container_type
 

Public Member Functions

template<>
const std::string & classPurpose ()
 
template<>
const std::string & classPurpose ()
 
template<>
const std::string & classRegisterTypeName ()
 
template<>
const std::string & classRegisterTypeName ()
 
template<>
const std::string & classTypeName ()
 
template<>
const std::string & classTypeName ()
 
 FWItemDetSetAccessor (const TClass *iClass)
 
const void * modelData (int iIndex) const override
 
const std::string & purpose () const
 
unsigned int size () const override
 
const std::string & typeName () const
 
- Public Member Functions inherited from FWItemRandomAccessorBase
const void * data () const override
 
bool isCollection () const override
 
const TClass * modelType () const override
 
void reset () override
 
void setData (const edm::ObjectWithDict &) override
 override if id of an object should be different than the index More...
 
const TClass * type () const override
 
 ~FWItemRandomAccessorBase () override
 
- Public Member Functions inherited from FWItemAccessorBase
 FWItemAccessorBase ()
 
virtual ~FWItemAccessorBase ()
 

Static Public Member Functions

static const std::string & classPurpose ()
 
static const std::string & classRegisterTypeName ()
 
static const std::string & classTypeName ()
 

Additional Inherited Members

- Protected Member Functions inherited from FWItemRandomAccessorBase
 FWItemRandomAccessorBase (const TClass *type, const std::type_info &modelTypeName)
 
void * getDataPtr () const
 
- Protected Attributes inherited from FWItemRandomAccessorBase
void * m_data
 
const TClass * m_modelType
 
const TClass * m_type
 

Detailed Description

template<class C, class COLL = typename C::value_type, class V = typename COLL::value_type>
class FWItemDetSetAccessor< C, COLL, V >

Generic class for creating accessors for containers which are implemented as a container of containers. This for example includes DetSetVector hence the name. Both the outer and the inner containers must follow the Random Access Container model and in particular must have a size() method. The outer collection must be iterable, while the inner collections must have an array subscript operator.

Definition at line 103 of file FWItemRandomAccessor.h.

Member Typedef Documentation

◆ collection_type

template<class C , class COLL = typename C::value_type, class V = typename COLL::value_type>
typedef COLL FWItemDetSetAccessor< C, COLL, V >::collection_type

Definition at line 106 of file FWItemRandomAccessor.h.

◆ collection_value_type

template<class C , class COLL = typename C::value_type, class V = typename COLL::value_type>
typedef V FWItemDetSetAccessor< C, COLL, V >::collection_value_type

Definition at line 107 of file FWItemRandomAccessor.h.

◆ container_type

template<class C , class COLL = typename C::value_type, class V = typename COLL::value_type>
typedef C FWItemDetSetAccessor< C, COLL, V >::container_type

Definition at line 105 of file FWItemRandomAccessor.h.

Constructor & Destructor Documentation

◆ FWItemDetSetAccessor()

template<class C , class COLL = typename C::value_type, class V = typename COLL::value_type>
FWItemDetSetAccessor< C, COLL, V >::FWItemDetSetAccessor ( const TClass *  iClass)
inline

Definition at line 109 of file FWItemRandomAccessor.h.

Member Function Documentation

◆ classPurpose() [1/3]

template<>
const std::string & FWItemDetSetAccessor< edm::DetSetVector< SiStripDigi > >::classPurpose ( )

Definition at line 38 of file FWItemTrackAccessors.cc.

◆ classPurpose() [2/3]

template<>
const std::string & FWItemDetSetAccessor< edm::DetSetVector< PixelDigi > >::classPurpose ( )

Definition at line 41 of file FWItemTrackAccessors.cc.

◆ classPurpose() [3/3]

template<class C , class COLL = typename C::value_type, class V = typename COLL::value_type>
static const std::string& FWItemDetSetAccessor< C, COLL, V >::classPurpose ( )
static

◆ classRegisterTypeName() [1/3]

template<>
const std::string & FWItemDetSetAccessor< edm::DetSetVector< SiStripDigi > >::classRegisterTypeName ( )

Definition at line 38 of file FWItemTrackAccessors.cc.

◆ classRegisterTypeName() [2/3]

template<>
const std::string & FWItemDetSetAccessor< edm::DetSetVector< PixelDigi > >::classRegisterTypeName ( )

Definition at line 41 of file FWItemTrackAccessors.cc.

◆ classRegisterTypeName() [3/3]

template<class C , class COLL = typename C::value_type, class V = typename COLL::value_type>
static const std::string& FWItemDetSetAccessor< C, COLL, V >::classRegisterTypeName ( )
static

◆ classTypeName() [1/3]

template<>
const std::string & FWItemDetSetAccessor< edm::DetSetVector< SiStripDigi > >::classTypeName ( )

Definition at line 38 of file FWItemTrackAccessors.cc.

◆ classTypeName() [2/3]

template<>
const std::string & FWItemDetSetAccessor< edm::DetSetVector< PixelDigi > >::classTypeName ( )

Definition at line 41 of file FWItemTrackAccessors.cc.

◆ classTypeName() [3/3]

template<class C , class COLL = typename C::value_type, class V = typename COLL::value_type>
static const std::string& FWItemDetSetAccessor< C, COLL, V >::classTypeName ( )
static

◆ modelData()

template<class C , class COLL = typename C::value_type, class V = typename COLL::value_type>
const void* FWItemDetSetAccessor< C, COLL, V >::modelData ( int  iIndex) const
inlineoverridevirtual

Implements FWItemAccessorBase.

Definition at line 113 of file FWItemRandomAccessor.h.

113  {
114  if (!getDataPtr())
115  return nullptr;
116  const container_type *c = reinterpret_cast<const container_type *>(getDataPtr());
117  size_t collectionOffset = 0;
118  for (typename container_type::const_iterator ci = c->begin(), ce = c->end(); ci != ce; ++ci) {
119  size_t i = iIndex - collectionOffset;
120  if (i < ci->size())
121  return &(ci->operator[](i));
122  collectionOffset += ci->size();
123  }
124 
125  return nullptr;
126  }

References HltBtagPostValidation_cff::c, FWItemRandomAccessorBase::getDataPtr(), mps_fire::i, and FWItemDetSetAccessor< C, COLL, V >::size().

◆ purpose()

template<class C , class COLL = typename C::value_type, class V = typename COLL::value_type>
const std::string& FWItemDetSetAccessor< C, COLL, V >::purpose ( ) const
inline

Definition at line 111 of file FWItemRandomAccessor.h.

113 {

◆ size()

template<class C , class COLL = typename C::value_type, class V = typename COLL::value_type>
unsigned int FWItemDetSetAccessor< C, COLL, V >::size ( void  ) const
inlineoverridevirtual

Implements FWItemAccessorBase.

Definition at line 128 of file FWItemRandomAccessor.h.

128  {
129  if (!getDataPtr())
130  return 0;
131  const container_type *c = reinterpret_cast<const container_type *>(getDataPtr());
132  size_t finalSize = 0;
133 
134  for (typename container_type::const_iterator i = c->begin(), e = c->end(); i != e; ++i)
135  finalSize += i->size();
136 
137  return finalSize;
138  }

References HltBtagPostValidation_cff::c, MillePedeFileConverter_cfg::e, FWItemRandomAccessorBase::getDataPtr(), and mps_fire::i.

Referenced by ntupleDataFormat._Collection::__iter__(), ntupleDataFormat._Collection::__len__(), and FWItemDetSetAccessor< C, COLL, V >::modelData().

◆ typeName()

template<class C , class COLL = typename C::value_type, class V = typename COLL::value_type>
const std::string& FWItemDetSetAccessor< C, COLL, V >::typeName ( ) const
inline

Definition at line 111 of file FWItemRandomAccessor.h.

113 {
mps_fire.i
i
Definition: mps_fire.py:428
FWItemDetSetAccessor::size
unsigned int size() const override
Definition: FWItemRandomAccessor.h:128
FWItemDetSetAccessor::collection_value_type
V collection_value_type
Definition: FWItemRandomAccessor.h:107
FWItemRandomAccessorBase::getDataPtr
void * getDataPtr() const
Definition: FWItemRandomAccessor.cc:66
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
FWItemRandomAccessorBase::FWItemRandomAccessorBase
FWItemRandomAccessorBase(const TClass *type, const std::type_info &modelTypeName)
Definition: FWItemRandomAccessor.cc:24
FWItemDetSetAccessor::container_type
C container_type
Definition: FWItemRandomAccessor.h:105
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37