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 18 of file EcalContainer.h.

Member Typedef Documentation

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

Definition at line 26 of file EcalContainer.h.

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

Definition at line 23 of file EcalContainer.h.

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

Definition at line 25 of file EcalContainer.h.

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

Definition at line 27 of file EcalContainer.h.

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

Definition at line 22 of file EcalContainer.h.

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

Definition at line 24 of file EcalContainer.h.

Constructor & Destructor Documentation

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

Definition at line 30 of file EcalContainer.h.

30 {checkAndResize();}
void checkAndResize()
Definition: EcalContainer.h:58

Member Function Documentation

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

Definition at line 58 of file EcalContainer.h.

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

58  {
59  if (m_items.empty()) {
60  // std::cout << "resizing to " << DetId::kSizeForDenseIndexing << std::endl;
61  m_items.resize(DetId::kSizeForDenseIndexing);
62  }
63  }
std::vector< Item > m_items
template<typename DetId, typename T>
void EcalContainer< DetId, T >::checkAndResize ( size_t  priv_size)
inline

Definition at line 66 of file EcalContainer.h.

66  {
67  // this method allows to resize the vector to a specific size forcing a specific value
68  if (m_items.empty()) {
69  // std::cout << "resizing to " << priv_size << std::endl;
70  m_items.resize(priv_size);
71  }
72  }
std::vector< Item > m_items
template<typename DetId, typename T>
void EcalContainer< DetId, T >::clear ( void  )
inline
template<typename DetId, typename T>
static const Item& EcalContainer< DetId, T >::dummy_item ( )
inlinestaticprivate

Definition at line 110 of file EcalContainer.h.

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

110  {
111  static const Item s_dummy{};
112  return s_dummy;
113  }
template<typename DetId, typename T>
const_iterator EcalContainer< DetId, T >::end ( void  ) const
inline
template<typename DetId, typename T>
const_iterator EcalContainer< DetId, T >::find ( uint32_t  rawId) const
inline

Definition at line 84 of file EcalContainer.h.

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

84  {
85  DetId ib(rawId);
86  if ( !isValidId(ib) ) return m_items.end();
87  return m_items.begin() + ib.hashedIndex();
88  }
std::vector< Item > m_items
Definition: DetId.h:18
bool isValidId(const DetId id) const
ib
Definition: cuy.py:662
template<typename DetId, typename T>
void EcalContainer< DetId, T >::insert ( std::pair< uint32_t, Item > const &  a)
inline
template<typename DetId, typename T>
bool EcalContainer< DetId, T >::isValidId ( const DetId  id) const
inlineprivate

Definition at line 118 of file EcalContainer.h.

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

118  {
119  return id.det() == ::DetId::Ecal;
120  };
template<typename DetId, typename T>
const Item& EcalContainer< DetId, T >::item ( size_t  hashid) const
inline
template<typename DetId, typename T>
const Items& EcalContainer< DetId, T >::items ( ) const
inline
template<typename DetId, typename T>
Item& EcalContainer< DetId, T >::operator[] ( uint32_t  rawId)
inline

Definition at line 49 of file EcalContainer.h.

49  {
51  static Item dummy;
52  DetId id(rawId);
53  if ( !isValidId(id) ) return dummy;
54  return m_items[id.hashedIndex()];
55  }
std::vector< Item > m_items
Definition: DetId.h:18
void checkAndResize()
Definition: EcalContainer.h:58
bool isValidId(const DetId id) const
template<typename DetId, typename T>
Item const& EcalContainer< DetId, T >::operator[] ( uint32_t  rawId) const
inline

Definition at line 74 of file EcalContainer.h.

74  {
75  // if (m_items.size()==0) {
76  // std::cout << "resizing to " << DetId::kSizeForDenseIndexing << std::endl;
77  // m_items.resize((size_t) DetId::kSizeForDenseIndexing);
78  // }
79  DetId id(rawId);
80  if ( !isValidId(id) ) return dummy_item();
81  return m_items[id.hashedIndex()];
82  }
std::vector< Item > m_items
Definition: DetId.h:18
static const Item & dummy_item()
bool isValidId(const DetId id) const
template<typename DetId, typename T>
void EcalContainer< DetId, T >::setItems ( const std::vector< Item > &  items)
inline

Definition at line 102 of file EcalContainer.h.

Referenced by boost::serialization::load().

102  {
103  m_items = items;
104  }
const Items & items() const
Definition: EcalContainer.h:45
std::vector< Item > m_items
template<typename DetId, typename T>
size_t EcalContainer< DetId, T >::size ( void  ) const
inline

Member Data Documentation

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