Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:05

0001 #ifndef HDQMSummary_h
0002 #define HDQMSummary_h
0003 
0004 #include "CondFormats/Serialization/interface/Serializable.h"
0005 
0006 #include <vector>
0007 #include <map>
0008 #include <iostream>
0009 #include "FWCore/Utilities/interface/Exception.h"
0010 #include <cstdint>
0011 
0012 /**
0013  @class HDQMSummary
0014  @author D. Giordano, A.-C. Le Bihan
0015  @class to hold historic DQM summary informations
0016 */
0017 
0018 /* 
0019 namespace hdqmsummary {
0020   enum CMSRegion { TRACKER = 0, 
0021            TIB = 1, 
0022            TIB_1 = 11, TIB_2 = 12, TIB_3 = 13, TIB_4 = 14,
0023            TOB = 2, 
0024            TOB_1 = 21, TOB_2 = 22, TOB_3 = 23, TOB_4 = 24, TOB_5 = 25, TOB_6 = 26, 
0025            TID = 3, 
0026            TIDM = 31, 
0027            TIDP = 32, 
0028            TIDM_1 = 311, TIDM_2 = 312, TIDM_3 = 313,
0029            TIDP_1 = 321, TIDP_2 = 322, TIDP_3 = 323,
0030            TEC = 4, 
0031            TECM = 41, 
0032            TECP = 42, 
0033            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,
0034            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
0035   };
0036 }
0037 */
0038 
0039 class HDQMSummary {
0040 public:
0041   struct DetRegistry {
0042     uint32_t detid;
0043     uint32_t ibegin;
0044 
0045     COND_SERIALIZABLE;
0046   };
0047 
0048   class StrictWeakOrdering {
0049   public:
0050     bool operator()(const DetRegistry& p, const uint32_t& i) const { return p.detid < i; }
0051   };
0052 
0053   // SOME DEFINITIONS
0054   //
0055   typedef std::vector<float>::const_iterator ContainerIterator;
0056   typedef std::pair<ContainerIterator, ContainerIterator> Range;
0057   typedef std::vector<DetRegistry> Registry;
0058   typedef Registry::const_iterator RegistryIterator;
0059   typedef std::vector<float> InputVector;
0060 
0061   HDQMSummary(std::vector<std::string>& userDBContent);
0062   HDQMSummary(const HDQMSummary& input);
0063   HDQMSummary(){};
0064   ~HDQMSummary(){};
0065 
0066   ContainerIterator getDataVectorBegin() const { return v_sum_.begin(); }
0067   ContainerIterator getDataVectorEnd() const { return v_sum_.end(); }
0068   RegistryIterator getRegistryVectorBegin() const { return indexes_.begin(); }
0069   RegistryIterator getRegistryVectorEnd() const { return indexes_.end(); }
0070 
0071   // RETURNS POSITION OF DETID IN v_sum_
0072   //
0073   const Range getRange(const uint32_t& detID) const;
0074 
0075   // RETURNS LIST OF DETIDS
0076   //
0077   std::vector<uint32_t> getDetIds() const;
0078 
0079   // INSERT SUMMARY OBJECTS...
0080   //
0081   bool put(const uint32_t& detID, InputVector& input, std::vector<std::string>& userContent);
0082   void setObj(const uint32_t& detID, std::string elementName, float value);
0083 
0084   // RETRIEVE SUMMARY OBJECTS...
0085   //
0086 
0087   // returns a vector of selected infos related to a given detId
0088   std::vector<float> getSummaryObj(uint32_t& detID, const std::vector<std::string>& list) const;
0089 
0090   // returns a vector filled with "info elementName" for each detId
0091   // The order is SORTED according to the one used in getDetIds() !
0092   std::vector<float> getSummaryObj(std::string elementName) const;
0093 
0094   // returns the entire SummaryObj related to one detId
0095   std::vector<float> getSummaryObj(uint32_t& detID) const;
0096 
0097   // returns everything, all SummaryObjects for all detIds (unsorted !)
0098   std::vector<float> getSummaryObj() const;
0099 
0100   // INLINE METHODS ABOUT RUN, TIME VALUE...
0101   //
0102   inline void setUserDBContent(const std::vector<std::string>& userDBContent) { userDBContent_ = userDBContent; }
0103   inline void setRunNr(int inputRunNr) { runNr_ = inputRunNr; }
0104   inline void setTimeValue(unsigned long long inputTimeValue) { timeValue_ = inputTimeValue; }
0105 
0106   inline unsigned long long getTimeValue() const { return timeValue_; }
0107   inline std::vector<std::string> getUserDBContent() const { return userDBContent_; }
0108   inline int getRunNr() const { return runNr_; }
0109 
0110   // PRINT METHOD...
0111   //
0112   void print();
0113 
0114   // HDQMSummary MEMBERS...
0115   //
0116   std::vector<std::string> userDBContent_;
0117   std::vector<float> v_sum_;
0118   std::vector<DetRegistry> indexes_;
0119 
0120   int runNr_;
0121   unsigned long long timeValue_;
0122 
0123 protected:
0124   // RETURNS POSITION OF ELEMENTNAME IN userDBContent_
0125   const short getPosition(std::string elementName) const;
0126 
0127   COND_SERIALIZABLE;
0128 };
0129 
0130 #endif