CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/CondFormats/SiStripObjects/interface/SiStripSummary.h

Go to the documentation of this file.
00001 #ifndef SiStripSummary_h
00002 #define SiStripSummary_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 namespace sistripsummary {
00017   enum TrackerRegion { TRACKER = 0, 
00018                        TIB = 1, 
00019                        TIB_1 = 11, TIB_2 = 12, TIB_3 = 13, TIB_4 = 14,
00020                        TOB = 2, 
00021                        TOB_1 = 21, TOB_2 = 22, TOB_3 = 23, TOB_4 = 24, TOB_5 = 25, TOB_6 = 26, 
00022                        TID = 3, 
00023                        TIDM = 31, 
00024                        TIDP = 32, 
00025                        TIDM_1 = 311, TIDM_2 = 312, TIDM_3 = 313,
00026                        TIDP_1 = 321, TIDP_2 = 322, TIDP_3 = 323,
00027                        TEC = 4, 
00028                        TECM = 41, 
00029                        TECP = 42, 
00030                        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,
00031                        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
00032   };
00033 }
00034 
00035 class SiStripSummary {
00036 
00037         public:
00038 
00039                 struct DetRegistry{
00040                         uint32_t detid;
00041                         uint32_t ibegin;
00042                 };
00043                 
00044                 class StrictWeakOrdering{
00045                         public:
00046                                 bool operator() (const DetRegistry& p,const uint32_t& i) const {return p.detid < i;}
00047                 };
00048 
00049 
00050                 // SOME DEFINITIONS
00051                 //
00052                 typedef std::vector<float>::const_iterator               ContainerIterator;  
00053                 typedef std::pair<ContainerIterator, ContainerIterator>  Range;                      
00054                 typedef std::vector<DetRegistry>                         Registry;
00055                 typedef Registry::const_iterator                         RegistryIterator;
00056                 typedef std::vector<float>                               InputVector;
00057                 
00058                 
00059                 SiStripSummary(std::vector<std::string>& userDBContent);
00060                 SiStripSummary(const SiStripSummary& input);
00061                 SiStripSummary(){};
00062                 ~SiStripSummary(){};
00063                 
00064              
00065                 ContainerIterator getDataVectorBegin()     const {return v_sum_.begin();  }
00066                 ContainerIterator getDataVectorEnd()       const {return v_sum_.end();    } 
00067                 RegistryIterator  getRegistryVectorBegin() const {return indexes_.begin();}
00068                 RegistryIterator  getRegistryVectorEnd()   const {return indexes_.end();  }
00069 
00070                 // RETURNS POSITION OF DETID IN v_sum_
00071                 //
00072                 const Range getRange(const uint32_t& detID) const;
00073                 
00074                 
00075                 // RETURNS LIST OF DETIDS 
00076                 //
00077                 std::vector<uint32_t> getDetIds() const;
00078                 
00079                 
00080                 // INSERT SUMMARY OBJECTS...
00081                 //
00082                 bool put(const uint32_t& detID, InputVector &input, std::vector<std::string>& userContent );
00083                 bool put(sistripsummary::TrackerRegion region, InputVector &input, std::vector<std::string>& userContent );
00084                 void setObj(const uint32_t& detID, std::string elementName, float value);
00085                 
00086                 
00087                 // RETRIEVE SUMMARY OBJECTS...
00088                 //
00089                 
00090                 // returns a vector of selected infos related to a given detId 
00091                 std::vector<float> getSummaryObj(uint32_t& detID, std::vector<std::string> list) const; 
00092                 std::vector<float> getSummaryObj(sistripsummary::TrackerRegion region, 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                 // SISTRIPSUMMARY 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