CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_6/src/DQM/SiPixelHistoricInfoClient/interface/SiPixelSummary.h

Go to the documentation of this file.
00001 #ifndef SiPixelSummary_h
00002 #define SiPixelSummary_h
00003 
00004 #include<vector>
00005 #include<map>
00006 #include <string>
00007 #include<iostream>
00008 #include<boost/cstdint.hpp>
00009 #include "FWCore/Utilities/interface/Exception.h"
00010 
00017 namespace sipixelsummary {
00018   enum TrackerRegion {
00019     TRACKER = 0, 
00020     Barrel = 1,
00021     Shell_mI = 2,
00022     Shell_mO = 3,
00023     Shell_pI = 4,
00024     Shell_pO = 5,
00025     Endcap = 6,
00026     HalfCylinder_mI = 7,
00027     HalfCylinder_mO = 8,
00028     HalfCylinder_pI = 9,
00029     HalfCylinder_pO = 10
00030   };
00031 
00032 
00033 
00034 }
00035 
00036 class SiPixelSummary {
00037 
00038   public:
00039 
00040     struct DetRegistry{
00041       uint32_t detid;
00042       uint32_t ibegin;
00043     };
00044 
00045     class StrictWeakOrdering{
00046       public:
00047         bool operator() (const DetRegistry& p,const uint32_t& i) const {return p.detid < i;}
00048     };
00049 
00050 
00051 
00052     // SOME DEFINITIONS
00053     //
00054     typedef std::vector<float>::const_iterator               ContainerIterator;  
00055     typedef std::pair<ContainerIterator, ContainerIterator>  Range;                  
00056     typedef std::vector<DetRegistry>                         Registry;
00057     typedef Registry::const_iterator                         RegistryIterator;
00058     typedef std::vector<float>                           InputVector;
00059 
00060 
00061     SiPixelSummary(std::vector<std::string>& userDBContent);
00062     SiPixelSummary(const SiPixelSummary& input);
00063     SiPixelSummary(){};
00064     ~SiPixelSummary(){};
00065 
00066 
00067     ContainerIterator getDataVectorBegin()     const {return v_sum_.begin();  }
00068     ContainerIterator getDataVectorEnd()       const {return v_sum_.end();    } 
00069     RegistryIterator  getRegistryVectorBegin() const {return indexes_.begin();}
00070     RegistryIterator  getRegistryVectorEnd()   const {return indexes_.end();  }
00071 
00072     // RETURNS POSITION OF DETID IN v_sum_
00073     //
00074     const Range getRange(const uint32_t& detID) const;
00075 
00076 
00077     // RETURNS LIST OF DETIDS 
00078     //
00079     std::vector<uint32_t> getDetIds() const;
00080 
00081 
00082     // INSERT SUMMARY OBJECTS...
00083     //
00084     bool put(const uint32_t& detID, InputVector &input, std::vector<std::string>& userContent );
00085     bool put(sipixelsummary::TrackerRegion region, InputVector &input, std::vector<std::string>& userContent );
00086     void setObj(const uint32_t& detID, std::string elementName, float value);
00087 
00088 
00089     // RETRIEVE SUMMARY OBJECTS...
00090     //
00091 
00092     // returns a vector of selected infos related to a given detId 
00093     std::vector<float> getSummaryObj(uint32_t& detID, std::vector<std::string> list) const; 
00094     std::vector<float> getSummaryObj(sipixelsummary::TrackerRegion region, std::vector<std::string> list) const; 
00095 
00096     // returns a vector filled with "info elementName" for each detId 
00097     // The order is SORTED according to the one used in getDetIds() !
00098     std::vector<float> getSummaryObj(std::string elementName) const;     
00099 
00100     // returns the entire SummaryObj related to one detId
00101     std::vector<float> getSummaryObj(uint32_t& detID) const;
00102 
00103     // returns everything, all SummaryObjects for all detIds (unsorted !)
00104     std::vector<float> getSummaryObj() const;                 
00105 
00106 
00107     // INLINE METHODS ABOUT RUN, TIME VALUE...
00108     //
00109     inline void setUserDBContent(std::vector<std::string> userDBContent)  { userDBContent_ = userDBContent;}
00110     inline void setRunNr(int inputRunNr)                       { runNr_ = inputRunNr;      }
00111     inline void setTimeValue(unsigned long long inputTimeValue){ timeValue_=inputTimeValue;}
00112 
00113     inline unsigned long long getTimeValue() const             { return timeValue_;        }
00114     inline std::vector<std::string>  getUserDBContent() const  { return userDBContent_;    }
00115     inline int getRunNr() const                                { return runNr_;            }
00116 
00117 
00118     // PRINT METHOD...
00119     //
00120     void print();
00121 
00122 
00123     // SISTRIPSUMMARY MEMBERS...
00124     //
00125     std::vector<std::string>        userDBContent_;
00126     std::vector<float>          v_sum_; 
00127     std::vector<DetRegistry>    indexes_;
00128 
00129     int runNr_; 
00130     unsigned long long timeValue_;
00131 
00132 
00133   protected:    
00134 
00135     // RETURNS POSITION OF ELEMENTNAME IN userDBContent_
00136     const short getPosition(std::string elementName) const;
00137 
00138 
00139 };
00140 
00141 
00142 #endif