00001 #ifndef SiStripPedestals_h 00002 #define SiStripPedestals_h 00003 00004 #include<vector> 00005 #include<map> 00006 #include<iostream> 00007 #include<boost/cstdint.hpp> 00008 00009 00010 class SiStripPedestals { 00011 00012 public: 00013 /* 00014 struct DecodingStructure{ 00015 unsigned int lth :6; 00016 unsigned int hth :6; 00017 unsigned int ped :10; 00018 };*/ 00019 00020 struct DetRegistry{ 00021 uint32_t detid; 00022 uint32_t ibegin; 00023 uint32_t iend; 00024 }; 00025 00026 class StrictWeakOrdering{ 00027 public: 00028 bool operator() (const DetRegistry& p,const uint32_t& i) const {return p.detid < i;} 00029 }; 00030 00031 typedef std::vector<char> Container; 00032 typedef std::vector<char>::const_iterator ContainerIterator; 00033 typedef std::pair<ContainerIterator, ContainerIterator> Range; 00034 typedef std::vector<DetRegistry> Registry; 00035 typedef Registry::const_iterator RegistryIterator; 00036 typedef std::vector<uint16_t> InputVector; 00037 00038 SiStripPedestals(){}; 00039 ~SiStripPedestals(){}; 00040 00041 //bool put(const uint32_t& detID,Range input); 00042 bool put(const uint32_t& detID,InputVector &input); 00043 const Range getRange(const uint32_t& detID) const; 00044 void getDetIds(std::vector<uint32_t>& DetIds_) const; 00045 00046 ContainerIterator getDataVectorBegin() const {return v_pedestals.begin();} 00047 ContainerIterator getDataVectorEnd() const {return v_pedestals.end();} 00048 RegistryIterator getRegistryVectorBegin() const {return indexes.begin();} 00049 RegistryIterator getRegistryVectorEnd() const{return indexes.end();} 00050 00051 void setData(float ped, InputVector& vped); 00052 float getPed (const uint16_t& strip, const Range& range) const; 00053 void allPeds (std::vector<int> & pefs, const Range& range) const; 00054 00055 private: 00056 00057 void encode(InputVector& Vi, std::vector<unsigned char>& Vo_CHAR); 00058 uint16_t decode (const uint16_t& strip, const Range& range) const; 00059 inline uint16_t get10bits(const uint8_t * &ptr, int8_t skip) const ; 00060 00061 Container v_pedestals; //@@@ blob streaming doesn't work with uint16_t and with SiStripData::Data 00062 Registry indexes; 00063 }; 00064 00065 #endif