CMS 3D CMS Logo

EcalCondTowerObjectContainer.h
Go to the documentation of this file.
1 #ifndef ECAL_CONDTOWER_OBJECT_CONTAINER_HH
2 #define ECAL_CONDTOWER_OBJECT_CONTAINER_HH
3 
5 
9 
10 // #include <cstdio>
11 
12 template <typename T>
14 public:
15  typedef T Item;
16  typedef Item value_type;
18  typedef typename std::vector<Item> Items;
19  typedef typename std::vector<Item>::const_iterator const_iterator;
20  typedef typename std::vector<Item>::iterator iterator;
21 
23  size_t ebsize = (size_t)EcalTrigTowerDetId::kEBTowersPerSM * 18 * 2;
24  eb_.checkAndResize(ebsize);
25  size_t eesize = (size_t)632;
26  ee_.checkAndResize(eesize);
27  };
29 
30  inline const Items &barrelItems() const { return eb_.items(); };
31 
32  inline const Items &endcapItems() const { return ee_.items(); };
33 
34  inline const Item &barrel(size_t hashedIndex) const { return eb_.item(hashedIndex); }
35 
36  inline const Item &endcap(size_t hashedIndex) const { return ee_.item(hashedIndex); }
37 
38  inline void insert(std::pair<uint32_t, Item> const &a) {
39  DetId id(a.first);
40  if (id.subdetId() == EcalBarrel || id.subdetId() == EcalTriggerTower) {
41  eb_.insert(a);
42  } else if (id.subdetId() == EcalEndcap) {
43  ee_.insert(a);
44  } else {
45  // std::cout <<"*** ERROR it is not barrel nor endcap tower"<< std::endl;
46  }
47  }
48 
49  inline const_iterator find(uint32_t rawId) const {
50  DetId id(rawId);
51  if (id.subdetId() == EcalBarrel || id.subdetId() == EcalTriggerTower) {
53  if (it != eb_.end()) {
54  return it;
55  } else {
56  return ee_.end();
57  }
58  } else if (id.subdetId() == EcalEndcap) {
59  return ee_.find(rawId);
60  } else {
61  return ee_.end();
62  }
63  }
64 
65  inline const_iterator begin() const { return eb_.begin(); }
66 
67  inline const_iterator end() const { return ee_.end(); }
68 
69  inline void setValue(const uint32_t id, const Item &item) { (*this)[id] = item; }
70 
71  inline const self &getMap() const { return *this; }
72 
73  inline size_t size() const { return eb_.size() + ee_.size(); }
74  // add coherent operator++, not needed now -- FIXME
75 
76  inline Item &operator[](uint32_t rawId) {
77  DetId id(rawId);
78  return ((id.subdetId() == EcalBarrel) || (id.subdetId() == EcalTriggerTower)) ? eb_[rawId] : ee_[rawId];
79  }
80 
81  inline Item operator[](uint32_t rawId) const {
82  DetId id(rawId);
83 
84  if (id.subdetId() == EcalBarrel || id.subdetId() == EcalTriggerTower) {
85  return eb_[rawId];
86  } else if (id.subdetId() == EcalEndcap) {
87  return ee_[rawId];
88  } else {
89  return Item();
90  }
91  }
92 
93 private:
96 
98 };
99 
101 #endif
void insert(std::pair< uint32_t, Item > const &a)
size_t size() const
Definition: EcalContainer.h:84
const Item & barrel(size_t hashedIndex) const
const Item & item(size_t hashid) const
Definition: EcalContainer.h:34
void setValue(const uint32_t id, const Item &item)
EcalCondTowerObjectContainer< float > EcalTowerFloatCondObjectContainer
int hashedIndex(int ieta, int iphi)
Definition: EcalPyUtils.cc:36
Item operator[](uint32_t rawId) const
EcalContainer< EcalScDetId, Item > ee_
const Items & items() const
Definition: EcalContainer.h:36
Definition: DetId.h:17
void checkAndResize()
Definition: EcalContainer.h:47
const_iterator end() const
Definition: EcalContainer.h:82
const_iterator find(uint32_t rawId) const
#define COND_SERIALIZABLE
Definition: Serializable.h:39
void insert(std::pair< uint32_t, Item > const &a)
Definition: EcalContainer.h:32
const_iterator begin() const
Definition: EcalContainer.h:80
const Item & endcap(size_t hashedIndex) const
double a
Definition: hdecay.h:121
std::vector< Item >::iterator iterator
EcalContainer< EcalTrigTowerDetId, Item > eb_
std::vector< Item >::const_iterator const_iterator
const_iterator find(uint32_t rawId) const
Definition: EcalContainer.h:73
static const int kEBTowersPerSM
long double T