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) {
52  const_iterator it = eb_.find(rawId);
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
EcalContainer::end
const_iterator end() const
Definition: EcalContainer.h:82
EcalContainer::items
const Items & items() const
Definition: EcalContainer.h:36
EcalContainer::item
const Item & item(size_t hashid) const
Definition: EcalContainer.h:34
EcalCondTowerObjectContainer::operator[]
Item operator[](uint32_t rawId) const
Definition: EcalCondTowerObjectContainer.h:81
EcalContainer< EcalTrigTowerDetId, Item >
EcalCondTowerObjectContainer::endcap
const Item & endcap(size_t hashedIndex) const
Definition: EcalCondTowerObjectContainer.h:36
COND_SERIALIZABLE
#define COND_SERIALIZABLE
Definition: Serializable.h:39
EcalCondTowerObjectContainer::~EcalCondTowerObjectContainer
~EcalCondTowerObjectContainer()
Definition: EcalCondTowerObjectContainer.h:28
EcalCondTowerObjectContainer::eb_
EcalContainer< EcalTrigTowerDetId, Item > eb_
Definition: EcalCondTowerObjectContainer.h:94
EcalContainer::checkAndResize
void checkAndResize()
Definition: EcalContainer.h:47
EcalCondTowerObjectContainer::end
const_iterator end() const
Definition: EcalCondTowerObjectContainer.h:67
EcalBarrel
Definition: EcalSubdetector.h:10
EcalContainer.h
EcalCondTowerObjectContainer::iterator
std::vector< Item >::iterator iterator
Definition: EcalCondTowerObjectContainer.h:20
EcalCondTowerObjectContainer
Definition: EcalCondTowerObjectContainer.h:13
DetId
Definition: DetId.h:17
EcalTowerFloatCondObjectContainer
EcalCondTowerObjectContainer< float > EcalTowerFloatCondObjectContainer
Definition: EcalCondTowerObjectContainer.h:100
EcalCondTowerObjectContainer::const_iterator
std::vector< Item >::const_iterator const_iterator
Definition: EcalCondTowerObjectContainer.h:19
EcalCondTowerObjectContainer::begin
const_iterator begin() const
Definition: EcalCondTowerObjectContainer.h:65
EcalCondTowerObjectContainer::Items
std::vector< Item > Items
Definition: EcalCondTowerObjectContainer.h:18
EcalCondTowerObjectContainer::find
const_iterator find(uint32_t rawId) const
Definition: EcalCondTowerObjectContainer.h:49
EcalCondTowerObjectContainer::EcalCondTowerObjectContainer
EcalCondTowerObjectContainer()
Definition: EcalCondTowerObjectContainer.h:22
EcalTrigTowerDetId.h
EcalEndcap
Definition: EcalSubdetector.h:10
a
double a
Definition: hdecay.h:119
EcalCondTowerObjectContainer::Item
T Item
Definition: EcalCondTowerObjectContainer.h:15
Serializable.h
EcalContainer::find
const_iterator find(uint32_t rawId) const
Definition: EcalContainer.h:73
EcalCondTowerObjectContainer::size
size_t size() const
Definition: EcalCondTowerObjectContainer.h:73
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
EcalCondTowerObjectContainer::value_type
Item value_type
Definition: EcalCondTowerObjectContainer.h:16
EcalCondTowerObjectContainer::getMap
const self & getMap() const
Definition: EcalCondTowerObjectContainer.h:71
EcalTrigTowerDetId::kEBTowersPerSM
static const int kEBTowersPerSM
Definition: EcalTrigTowerDetId.h:101
EcalTriggerTower
Definition: EcalSubdetector.h:10
EcalCondTowerObjectContainer::operator[]
Item & operator[](uint32_t rawId)
Definition: EcalCondTowerObjectContainer.h:76
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
T
long double T
Definition: Basic3DVectorLD.h:48
EcalScDetId.h
EcalCondTowerObjectContainer::barrel
const Item & barrel(size_t hashedIndex) const
Definition: EcalCondTowerObjectContainer.h:34
EcalCondTowerObjectContainer::insert
void insert(std::pair< uint32_t, Item > const &a)
Definition: EcalCondTowerObjectContainer.h:38
EcalCondTowerObjectContainer::setValue
void setValue(const uint32_t id, const Item &item)
Definition: EcalCondTowerObjectContainer.h:69
EcalContainer::insert
void insert(std::pair< uint32_t, Item > const &a)
Definition: EcalContainer.h:32
EcalContainer::begin
const_iterator begin() const
Definition: EcalContainer.h:80
ecalpyutils::hashedIndex
int hashedIndex(int ieta, int iphi)
Definition: EcalPyUtils.cc:38
EcalContainer::size
size_t size() const
Definition: EcalContainer.h:84
EcalCondTowerObjectContainer::barrelItems
const Items & barrelItems() const
Definition: EcalCondTowerObjectContainer.h:30
EcalCondTowerObjectContainer::ee_
EcalContainer< EcalScDetId, Item > ee_
Definition: EcalCondTowerObjectContainer.h:95
EcalCondTowerObjectContainer::endcapItems
const Items & endcapItems() const
Definition: EcalCondTowerObjectContainer.h:32