test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalCondObjectContainer.h
Go to the documentation of this file.
1 #ifndef ECAL_COND_OBJECT_CONTAINER_HH
2 #define ECAL_COND_OBJECT_CONTAINER_HH
3 
5 
9 
10 template < typename T >
12  public:
13  typedef T Item;
14  typedef Item value_type;
16  typedef typename std::vector<Item> Items;
17  typedef typename std::vector<Item>::const_iterator const_iterator;
18  typedef typename std::vector<Item>::iterator iterator;
19 
22 
23  inline
24  const Items & barrelItems() const { return eb_.items(); };
25 
26  inline
27  const Items & endcapItems() const { return ee_.items(); };
28 
29  inline
30  const Item & barrel( size_t hashedIndex ) const {
31  return eb_.item(hashedIndex);
32  }
33 
34  inline
35  const Item & endcap( size_t hashedIndex ) const {
36  return ee_.item(hashedIndex);
37  }
38 
39  inline
40  void insert( std::pair<uint32_t, Item> const &a ) {
41  DetId id(a.first);
42  switch (id.subdetId()) {
43  case EcalBarrel :
44  {
45  eb_.insert(a);
46  }
47  break;
48  case EcalEndcap :
49  {
50  ee_.insert(a);
51  }
52  break;
53  default:
54  // FIXME (add throw)
55  return;
56  }
57  }
58 
59  inline
60  const_iterator find( uint32_t rawId ) const {
61  DetId id(rawId);
62  switch (id.subdetId()) {
63  case EcalBarrel :
64  {
65  const_iterator it = eb_.find(rawId);
66  if ( it != eb_.end() ) {
67  return it;
68  } else {
69  return ee_.end();
70  }
71  }
72  break;
73  case EcalEndcap :
74  {
75  return ee_.find(rawId);
76  }
77  break;
78  default:
79  // FIXME (add throw)
80  return ee_.end();
81  }
82  }
83 
84  inline
86  return eb_.begin();
87  }
88 
89  inline
90  const_iterator end() const {
91  return ee_.end();
92  }
93 
94  inline
95  void setValue(const uint32_t id, const Item &item) {
96  (*this)[id] = item;
97  }
98 
99  inline
100  const self & getMap() const {
101  return *this;
102  }
103 
104  inline
105  size_t size() const {
106  return eb_.size() + ee_.size();
107  }
108  // add coherent operator++, not needed now -- FIXME
109 
110  inline
111  Item & operator[]( uint32_t rawId )
112  {
113  DetId id(rawId);
114  return (id.subdetId()==EcalBarrel) ? eb_[rawId] : ee_[rawId];
115 
116  }
117 
118  inline
119  Item operator[]( uint32_t rawId ) const {
120  DetId id(rawId);
121  switch (id.subdetId()) {
122  case EcalBarrel :
123  {
124  return eb_[rawId];
125  }
126  break;
127  case EcalEndcap :
128  {
129  return ee_[rawId];
130  }
131  break;
132  default:
133  // FIXME (add throw)
134  // sizeof(Item) <= sizeof(int64_t) for all Items.
135  return Item();
136  }
137  }
138 
139  private:
140 
143 
145 };
146 
148 #endif
const_iterator begin() const
Definition: EcalContainer.h:85
std::vector< Item >::iterator iterator
const Item & item(size_t hashid) const
Definition: EcalContainer.h:36
const self & getMap() const
const Items & items() const
Definition: EcalContainer.h:40
const_iterator end() const
Definition: EcalContainer.h:89
const Items & barrelItems() const
Item & operator[](uint32_t rawId)
Item operator[](uint32_t rawId) const
void setValue(const uint32_t id, const Item &item)
int hashedIndex(int ieta, int iphi)
Definition: EcalPyUtils.cc:42
EcalContainer< EBDetId, Item > eb_
const_iterator find(uint32_t rawId) const
Definition: EcalContainer.h:79
const_iterator begin() const
void insert(std::pair< uint32_t, Item > const &a)
Definition: DetId.h:18
std::vector< Item >::const_iterator const_iterator
#define COND_SERIALIZABLE
Definition: Serializable.h:37
void insert(std::pair< uint32_t, Item > const &a)
Definition: EcalContainer.h:32
double a
Definition: hdecay.h:121
const_iterator find(uint32_t rawId) const
EcalContainer< EEDetId, Item > ee_
const_iterator end() const
const Item & barrel(size_t hashedIndex) const
const Items & endcapItems() const
size_t size() const
Definition: EcalContainer.h:93
const Item & endcap(size_t hashedIndex) const
long double T
EcalCondObjectContainer< float > EcalFloatCondObjectContainer