CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
EcalContainer< DetId, T > Class Template Reference

#include <EcalContainer.h>

Public Types

typedef std::vector< Item >::const_iterator const_iterator
 
typedef T Item
 
typedef std::vector< ItemItems
 
typedef std::vector< Item >::iterator iterator
 
typedef EcalContainer< DetId, Tself
 
typedef Item value_type
 

Public Member Functions

const_iterator begin () const
 
void checkAndResize ()
 
void checkAndResize (size_t priv_size)
 
void clear ()
 
 EcalContainer ()
 
const_iterator end () const
 
const_iterator find (uint32_t rawId) const
 
void insert (std::pair< uint32_t, Item > const &a)
 
const Itemitem (size_t hashid) const
 
const Itemsitems () const
 
Itemoperator[] (uint32_t rawId)
 
Item const & operator[] (uint32_t rawId) const
 
void setItems (const std::vector< Item > &items)
 
size_t size () const
 

Private Member Functions

bool isValidId (const DetId id) const
 

Static Private Member Functions

static const Itemdummy_item ()
 

Private Attributes

std::vector< Itemm_items
 

Detailed Description

template<typename DetId, typename T>
class EcalContainer< DetId, T >

Definition at line 16 of file EcalContainer.h.

Member Typedef Documentation

◆ const_iterator

template<typename DetId, typename T>
typedef std::vector<Item>::const_iterator EcalContainer< DetId, T >::const_iterator

Definition at line 22 of file EcalContainer.h.

◆ Item

template<typename DetId, typename T>
typedef T EcalContainer< DetId, T >::Item

Definition at line 19 of file EcalContainer.h.

◆ Items

template<typename DetId, typename T>
typedef std::vector<Item> EcalContainer< DetId, T >::Items

Definition at line 21 of file EcalContainer.h.

◆ iterator

template<typename DetId, typename T>
typedef std::vector<Item>::iterator EcalContainer< DetId, T >::iterator

Definition at line 23 of file EcalContainer.h.

◆ self

template<typename DetId, typename T>
typedef EcalContainer<DetId, T> EcalContainer< DetId, T >::self

Definition at line 18 of file EcalContainer.h.

◆ value_type

template<typename DetId, typename T>
typedef Item EcalContainer< DetId, T >::value_type

Definition at line 20 of file EcalContainer.h.

Constructor & Destructor Documentation

◆ EcalContainer()

template<typename DetId, typename T>
EcalContainer< DetId, T >::EcalContainer ( )
inline

Definition at line 25 of file EcalContainer.h.

25 { checkAndResize(); }
void checkAndResize()
Definition: EcalContainer.h:47

Member Function Documentation

◆ begin()

template<typename DetId, typename T>
const_iterator EcalContainer< DetId, T >::begin ( void  ) const
inline

Definition at line 80 of file EcalContainer.h.

Referenced by ESCondObjectContainer< ESStripGroupId >::begin(), and EcalCondTowerObjectContainer< T >::begin().

80 { return m_items.begin(); }
std::vector< Item > m_items

◆ checkAndResize() [1/2]

template<typename DetId, typename T>
void EcalContainer< DetId, T >::checkAndResize ( )
inline

Definition at line 47 of file EcalContainer.h.

Referenced by EcalContainer< EcalTrigTowerDetId, Item >::clear(), EcalCondTowerObjectContainer< T >::EcalCondTowerObjectContainer(), EcalContainer< EcalTrigTowerDetId, Item >::EcalContainer(), and EcalContainer< EcalTrigTowerDetId, Item >::operator[]().

47  {
48  if (m_items.empty()) {
49  // std::cout << "resizing to " << DetId::kSizeForDenseIndexing << std::endl;
50  m_items.resize(DetId::kSizeForDenseIndexing);
51  }
52  }
std::vector< Item > m_items

◆ checkAndResize() [2/2]

template<typename DetId, typename T>
void EcalContainer< DetId, T >::checkAndResize ( size_t  priv_size)
inline

Definition at line 54 of file EcalContainer.h.

54  {
55  // this method allows to resize the vector to a specific size forcing a specific value
56  if (m_items.empty()) {
57  // std::cout << "resizing to " << priv_size << std::endl;
58  m_items.resize(priv_size);
59  }
60  }
std::vector< Item > m_items

◆ clear()

template<typename DetId, typename T>
void EcalContainer< DetId, T >::clear ( void  )
inline

Definition at line 27 of file EcalContainer.h.

Referenced by EcalCondObjectContainer< Values >::clear(), and BeautifulSoup.Tag::setString().

27  {
28  m_items.clear();
30  }
std::vector< Item > m_items
void checkAndResize()
Definition: EcalContainer.h:47

◆ dummy_item()

template<typename DetId, typename T>
static const Item& EcalContainer< DetId, T >::dummy_item ( )
inlinestaticprivate

Definition at line 92 of file EcalContainer.h.

Referenced by EcalContainer< EcalTrigTowerDetId, Item >::operator[]().

92  {
93  static const Item s_dummy{};
94  return s_dummy;
95  }

◆ end()

template<typename DetId, typename T>
const_iterator EcalContainer< DetId, T >::end ( void  ) const
inline

◆ find()

template<typename DetId, typename T>
const_iterator EcalContainer< DetId, T >::find ( uint32_t  rawId) const
inline

Definition at line 73 of file EcalContainer.h.

Referenced by BeautifulSoup.Tag::__getattr__(), ESCondObjectContainer< ESStripGroupId >::find(), EcalCondTowerObjectContainer< T >::find(), EcalCondObjectContainer< Values >::find(), and BeautifulSoup.Tag::firstText().

73  {
74  DetId ib(rawId);
75  if (!isValidId(ib))
76  return m_items.end();
77  return m_items.begin() + ib.hashedIndex();
78  }
std::vector< Item > m_items
bool isValidId(const DetId id) const
Definition: DetId.h:17
ib
Definition: cuy.py:661

◆ insert()

template<typename DetId, typename T>
void EcalContainer< DetId, T >::insert ( std::pair< uint32_t, Item > const &  a)
inline

◆ isValidId()

template<typename DetId, typename T>
bool EcalContainer< DetId, T >::isValidId ( const DetId  id) const
inlineprivate

◆ item()

template<typename DetId, typename T>
const Item& EcalContainer< DetId, T >::item ( size_t  hashid) const
inline

◆ items()

template<typename DetId, typename T>
const Items& EcalContainer< DetId, T >::items ( ) const
inline

◆ operator[]() [1/2]

template<typename DetId, typename T>
Item& EcalContainer< DetId, T >::operator[] ( uint32_t  rawId)
inline

Definition at line 38 of file EcalContainer.h.

38  {
40  static Item dummy;
41  DetId id(rawId);
42  if (!isValidId(id))
43  return dummy;
44  return m_items[id.hashedIndex()];
45  }
std::vector< Item > m_items
bool isValidId(const DetId id) const
Definition: DetId.h:17
void checkAndResize()
Definition: EcalContainer.h:47

◆ operator[]() [2/2]

template<typename DetId, typename T>
Item const& EcalContainer< DetId, T >::operator[] ( uint32_t  rawId) const
inline

Definition at line 62 of file EcalContainer.h.

62  {
63  // if (m_items.size()==0) {
64  // std::cout << "resizing to " << DetId::kSizeForDenseIndexing << std::endl;
65  // m_items.resize((size_t) DetId::kSizeForDenseIndexing);
66  // }
67  DetId id(rawId);
68  if (!isValidId(id))
69  return dummy_item();
70  return m_items[id.hashedIndex()];
71  }
std::vector< Item > m_items
bool isValidId(const DetId id) const
Definition: DetId.h:17
static const Item & dummy_item()
Definition: EcalContainer.h:92

◆ setItems()

template<typename DetId, typename T>
void EcalContainer< DetId, T >::setItems ( const std::vector< Item > &  items)
inline

Definition at line 86 of file EcalContainer.h.

86 { m_items = items; }
std::vector< Item > m_items
const Items & items() const
Definition: EcalContainer.h:36

◆ size()

template<typename DetId, typename T>
size_t EcalContainer< DetId, T >::size ( void  ) const
inline

Member Data Documentation

◆ m_items

template<typename DetId, typename T>
std::vector<Item> EcalContainer< DetId, T >::m_items
private