Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-07 04:35:38

0001 #ifndef ES_COND_OBJECT_CONTAINER_HH
0002 #define ES_COND_OBJECT_CONTAINER_HH
0003 
0004 #include "CondFormats/Serialization/interface/Serializable.h"
0005 
0006 #include "DataFormats/EcalDetId/interface/EcalContainer.h"
0007 #include "DataFormats/EcalDetId/interface/ESDetId.h"
0008 #include "FWCore/Utilities/interface/Exception.h"
0009 
0010 template <typename T>
0011 class ESCondObjectContainer {
0012 public:
0013   typedef T Item;
0014   typedef Item value_type;
0015   typedef ESCondObjectContainer<T> self;
0016   typedef typename std::vector<Item> Items;
0017   typedef typename std::vector<Item>::const_iterator const_iterator;
0018   typedef typename std::vector<Item>::iterator iterator;
0019 
0020   ESCondObjectContainer() {}
0021   ~ESCondObjectContainer() {}
0022 
0023   inline const Items &preshowerItems() const { return es_.items(); };
0024 
0025   inline const Item &preshower(size_t hashedIndex) const { return es_.item(hashedIndex); }
0026 
0027   inline void insert(std::pair<uint32_t, Item> const &a) {
0028     if (DetId(a.first).subdetId() == EcalPreshower) {
0029       es_.insert(a);
0030     }
0031   }
0032 
0033   inline const_iterator find(uint32_t rawId) const { return es_.find(rawId); }
0034 
0035   inline const_iterator begin() const { return es_.begin(); }
0036 
0037   inline const_iterator end() const { return es_.end(); }
0038 
0039   inline void setValue(const uint32_t id, const Item &item) { (*this)[id] = item; }
0040 
0041   inline const self &getMap() const { return *this; }
0042 
0043   inline size_t size() const { return es_.size(); }
0044   // add coherent operator++, not needed now -- FIXME
0045 
0046   inline Item &operator[](uint32_t rawId) { return es_[rawId]; }
0047 
0048   inline Item const &operator[](uint32_t rawId) const { return es_[rawId]; }
0049 
0050 private:
0051   EcalContainer<ESDetId, Item> es_;
0052 
0053   COND_SERIALIZABLE;
0054 };
0055 
0056 typedef ESCondObjectContainer<float> ESFloatCondObjectContainer;
0057 #endif