CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/CondFormats/SiStripObjects/interface/SiStripPedestals.h

Go to the documentation of this file.
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 // #include "CondFormats/SiStripObjects/interface/SiStripBaseObject.h"
00010 #include "CondFormats/SiStripObjects/interface/SiStripDetSummary.h"
00011 
00024 // class SiStripPedestals : public SiStripBaseObject
00025 class SiStripPedestals
00026 {
00027 public:
00028   /*
00029     struct DecodingStructure{  
00030     unsigned int lth :6;
00031     unsigned int hth :6;
00032     unsigned int ped :10;
00033     };*/
00034 
00035   struct DetRegistry{
00036     uint32_t detid;
00037     uint32_t ibegin;
00038     uint32_t iend;
00039   };
00040 
00041   class StrictWeakOrdering{
00042   public:
00043     bool operator() (const DetRegistry& p,const uint32_t& i) const {return p.detid < i;}
00044   };
00045 
00046   typedef std::vector<char>                                Container;  
00047   typedef std::vector<char>::const_iterator                ContainerIterator;  
00048   typedef std::pair<ContainerIterator, ContainerIterator>  Range;      
00049   typedef std::vector<DetRegistry>                         Registry;
00050   typedef Registry::const_iterator                         RegistryIterator;
00051   typedef std::vector<uint16_t>                          InputVector;
00052 
00053   SiStripPedestals(){};
00054   ~SiStripPedestals(){};
00055 
00056   //bool  put(const uint32_t& detID,Range input);
00057   bool  put(const uint32_t& detID,InputVector &input);
00058   const Range getRange(const uint32_t& detID) const;
00059   void  getDetIds(std::vector<uint32_t>& DetIds_) const;
00060 
00061   ContainerIterator getDataVectorBegin()    const {return v_pedestals.begin();}
00062   ContainerIterator getDataVectorEnd()      const {return v_pedestals.end();}
00063   RegistryIterator getRegistryVectorBegin() const {return indexes.begin();}
00064   RegistryIterator getRegistryVectorEnd()   const{return indexes.end();}
00065 
00066   void  setData(float ped, InputVector& vped);
00067   float getPed   (const uint16_t& strip, const Range& range) const;
00068   void  allPeds  (std::vector<int> & pefs,  const Range& range) const;
00069 
00071   void printSummary(std::stringstream& ss) const;
00073   void printDebug(std::stringstream& ss) const;
00074 
00075  private:
00076 
00077   void     encode(InputVector& Vi, std::vector<unsigned char>& Vo_CHAR);
00078   uint16_t decode (const uint16_t& strip, const Range& range) const;
00079   inline uint16_t get10bits(const uint8_t * &ptr, int8_t skip) const ;
00080 
00081   Container v_pedestals; //@@@ blob streaming doesn't work with uint16_t and with SiStripData::Data
00082   Registry indexes;
00083 };
00084 
00085 #endif