CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/CondFormats/DQMObjects/interface/HDQMSummary.h

Go to the documentation of this file.
00001 #ifndef HDQMSummary_h
00002 #define HDQMSummary_h
00003 
00004 #include<vector>
00005 #include<map>
00006 #include<iostream>
00007 #include<boost/cstdint.hpp>
00008 #include "FWCore/Utilities/interface/Exception.h"
00009 
00016 /* 
00017 namespace hdqmsummary {
00018   enum CMSRegion { TRACKER = 0, 
00019                    TIB = 1, 
00020                    TIB_1 = 11, TIB_2 = 12, TIB_3 = 13, TIB_4 = 14,
00021                    TOB = 2, 
00022                    TOB_1 = 21, TOB_2 = 22, TOB_3 = 23, TOB_4 = 24, TOB_5 = 25, TOB_6 = 26, 
00023                    TID = 3, 
00024                    TIDM = 31, 
00025                    TIDP = 32, 
00026                    TIDM_1 = 311, TIDM_2 = 312, TIDM_3 = 313,
00027                    TIDP_1 = 321, TIDP_2 = 322, TIDP_3 = 323,
00028                    TEC = 4, 
00029                    TECM = 41, 
00030                    TECP = 42, 
00031                    TECM_1 = 411, TECM_2 = 412, TECM_3 = 413, TECM_4 = 414, TECM_5 = 415, TECM_6 = 416, TECM_7 = 417, TECM_8 = 418, TECM_9 = 419,
00032                    TECP_1 = 421, TECP_2 = 422, TECP_3 = 423, TECP_4 = 424, TECP_5 = 425, TECP_6 = 426, TECP_7 = 427, TECP_8 = 428, TECP_9 = 429
00033   };
00034 }
00035 */
00036 
00037 class HDQMSummary {
00038 
00039         public:
00040 
00041                 struct DetRegistry{
00042                         uint32_t detid;
00043                         uint32_t ibegin;
00044                 };
00045                 
00046                 class StrictWeakOrdering{
00047                         public:
00048                                 bool operator() (const DetRegistry& p,const uint32_t& i) const {return p.detid < i;}
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                 HDQMSummary(std::vector<std::string>& userDBContent);
00062                 HDQMSummary(const HDQMSummary& input);
00063                 HDQMSummary(){};
00064                 ~HDQMSummary(){};
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                 void setObj(const uint32_t& detID, std::string elementName, float value);
00086                 
00087                 
00088                 // RETRIEVE SUMMARY OBJECTS...
00089                 //
00090                 
00091                 // returns a vector of selected infos related to a given detId 
00092                 std::vector<float> getSummaryObj(uint32_t& detID, std::vector<std::string> list) const; 
00093                  
00094                 // returns a vector filled with "info elementName" for each detId 
00095                 // The order is SORTED according to the one used in getDetIds() !
00096                 std::vector<float> getSummaryObj(std::string elementName) const;     
00097                                                                       
00098                 // returns the entire SummaryObj related to one detId
00099                 std::vector<float> getSummaryObj(uint32_t& detID) const;
00100                         
00101                 // returns everything, all SummaryObjects for all detIds (unsorted !)
00102                 std::vector<float> getSummaryObj() const;                     
00103                 
00104         
00105                 // INLINE METHODS ABOUT RUN, TIME VALUE...
00106                 //
00107                 inline void setUserDBContent(std::vector<std::string> userDBContent)  { userDBContent_ = userDBContent;}
00108                 inline void setRunNr(int inputRunNr)                       { runNr_ = inputRunNr;      }
00109                 inline void setTimeValue(unsigned long long inputTimeValue){ timeValue_=inputTimeValue;}
00110                 
00111                 inline unsigned long long getTimeValue() const             { return timeValue_;        }
00112                 inline std::vector<std::string>  getUserDBContent() const  { return userDBContent_;    }
00113                 inline int getRunNr() const                                { return runNr_;            }
00114                
00115                
00116                 // PRINT METHOD...
00117                 //
00118                 void print();
00119                 
00120                 
00121                 // HDQMSummary MEMBERS...
00122                 //
00123                 std::vector<std::string>        userDBContent_;
00124                 std::vector<float>              v_sum_; 
00125                 std::vector<DetRegistry>        indexes_;
00126                 
00127                 int runNr_; 
00128                 unsigned long long timeValue_;
00129                 
00130                 
00131         protected:      
00132         
00133                 // RETURNS POSITION OF ELEMENTNAME IN userDBContent_
00134                 const short getPosition(std::string elementName) const;
00135         
00136         
00137    };
00138                 
00139 
00140 #endif