CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/CondFormats/SiStripObjects/interface/SiStripApvGain.h

Go to the documentation of this file.
00001 #ifndef SiStripApvGain_h
00002 #define SiStripApvGain_h
00003 
00004 #include<vector>
00005 #include<map>
00006 #include<iostream>
00007 #include<boost/cstdint.hpp>
00008 
00020 class SiStripApvGain {
00021 
00022  public:
00023 
00024   typedef std::vector<float>::const_iterator               ContainerIterator;  
00025   typedef std::pair<ContainerIterator, ContainerIterator>  Range;      
00026   typedef std::vector<unsigned int>                        Registry;
00027   typedef Registry::iterator                               RegistryIterator;
00028   typedef Registry::const_iterator                         RegistryConstIterator;
00029   typedef std::vector<float>                               InputVector;
00030 
00031 
00032   struct RegistryPointers{
00033     RegistryConstIterator detid_begin;
00034     RegistryConstIterator detid_end;
00035     RegistryConstIterator ibegin_begin;
00036     RegistryConstIterator ibegin_end;
00037     RegistryConstIterator iend_begin;
00038     RegistryConstIterator iend_end;
00039     ContainerIterator v_begin;
00040     ContainerIterator v_end;
00041 
00042     ContainerIterator getFirstElement(RegistryConstIterator& idet){return v_begin+*(ibegin_begin+(idet-detid_begin));} 
00043     ContainerIterator getLastElement(RegistryConstIterator& idet){return v_begin+*(iend_begin+(idet-detid_begin));} 
00044   };
00045 
00046   SiStripApvGain(){};
00047   ~SiStripApvGain(){};
00048 
00049   RegistryPointers getRegistryPointers() const {
00050     RegistryPointers p;
00051     p.detid_begin=v_detids.begin();
00052     p.detid_end=v_detids.end();
00053     p.ibegin_begin=v_ibegin.begin();
00054     p.ibegin_end=v_ibegin.end();
00055     p.iend_begin=v_iend.begin();
00056     p.iend_end=v_iend.end();
00057     p.v_begin=v_gains.begin();
00058     p.v_end=v_gains.end();
00059 
00060     return p;
00061 }
00062 
00063   
00064   bool put(const uint32_t& detID, Range input);
00065   const Range getRange(const uint32_t& detID) const;
00066   void getDetIds(std::vector<uint32_t>& DetIds_) const;
00067   
00068   float   getStripGain     (const uint16_t& strip, const Range& range) const;
00069   float   getApvGain  (const uint16_t& apv, const Range& range) const;
00070 
00071   void printDebug(std::stringstream & ss) const;
00072   void printSummary(std::stringstream & ss) const;
00073 
00074  private:
00075 
00076   std::vector<float> v_gains;
00077   std::vector<unsigned int>   v_detids;
00078   std::vector<unsigned int>   v_ibegin;
00079   std::vector<unsigned int>   v_iend;
00080 };
00081 
00082 #endif