DetRegistry

SiStripSummary

StrictWeakOrdering

TrackerRegion

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
#ifndef SiStripSummary_h
#define SiStripSummary_h

#include "CondFormats/Serialization/interface/Serializable.h"

#include <vector>
#include <map>
#include <iostream>
#include "FWCore/Utilities/interface/Exception.h"
#include <cstdint>

/**
 @class SiStripSummary
 @author D. Giordano, A.-C. Le Bihan
 @class to hold historic DQM summary informations
*/

namespace sistripsummary {
  enum TrackerRegion {
    TRACKER = 0,
    TIB = 1,
    TIB_1 = 11,
    TIB_2 = 12,
    TIB_3 = 13,
    TIB_4 = 14,
    TOB = 2,
    TOB_1 = 21,
    TOB_2 = 22,
    TOB_3 = 23,
    TOB_4 = 24,
    TOB_5 = 25,
    TOB_6 = 26,
    TID = 3,
    TIDM = 31,
    TIDP = 32,
    TIDM_1 = 311,
    TIDM_2 = 312,
    TIDM_3 = 313,
    TIDP_1 = 321,
    TIDP_2 = 322,
    TIDP_3 = 323,
    TEC = 4,
    TECM = 41,
    TECP = 42,
    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,
    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
  };
}

class SiStripSummary {
public:
  struct DetRegistry {
    uint32_t detid;
    uint32_t ibegin;

    COND_SERIALIZABLE;
  };

  class StrictWeakOrdering {
  public:
    bool operator()(const DetRegistry& p, const uint32_t& i) const { return p.detid < i; }
  };

  // SOME DEFINITIONS
  //
  typedef std::vector<float>::const_iterator ContainerIterator;
  typedef std::pair<ContainerIterator, ContainerIterator> Range;
  typedef std::vector<DetRegistry> Registry;
  typedef Registry::const_iterator RegistryIterator;
  typedef std::vector<float> InputVector;

  SiStripSummary(std::vector<std::string>& userDBContent);
  SiStripSummary(const SiStripSummary& input);
  SiStripSummary() {}
  ~SiStripSummary() {}

  ContainerIterator getDataVectorBegin() const { return v_sum_.begin(); }
  ContainerIterator getDataVectorEnd() const { return v_sum_.end(); }
  RegistryIterator getRegistryVectorBegin() const { return indexes_.begin(); }
  RegistryIterator getRegistryVectorEnd() const { return indexes_.end(); }

  // RETURNS POSITION OF DETID IN v_sum_
  //
  const Range getRange(const uint32_t& detID) const;

  // RETURNS LIST OF DETIDS
  //
  std::vector<uint32_t> getDetIds() const;

  // INSERT SUMMARY OBJECTS...
  //
  bool put(const uint32_t& detID, InputVector& input, std::vector<std::string>& userContent);
  bool put(sistripsummary::TrackerRegion region, InputVector& input, std::vector<std::string>& userContent);
  void setObj(const uint32_t& detID, std::string elementName, float value);

  // RETRIEVE SUMMARY OBJECTS...
  //

  // returns a vector of selected infos related to a given detId
  std::vector<float> getSummaryObj(uint32_t& detID, const std::vector<std::string>& list) const;
  std::vector<float> getSummaryObj(sistripsummary::TrackerRegion region, const std::vector<std::string>& list) const;

  // returns a vector filled with "info elementName" for each detId
  // The order is SORTED according to the one used in getDetIds() !
  std::vector<float> getSummaryObj(std::string elementName) const;

  // returns the entire SummaryObj related to one detId
  std::vector<float> getSummaryObj(uint32_t& detID) const;

  // returns everything, all SummaryObjects for all detIds (unsorted !)
  std::vector<float> getSummaryObj() const;

  // INLINE METHODS ABOUT RUN, TIME VALUE...
  //
  inline void setUserDBContent(const std::vector<std::string>& userDBContent) { userDBContent_ = userDBContent; }
  inline void setRunNr(int inputRunNr) { runNr_ = inputRunNr; }
  inline void setTimeValue(unsigned long long inputTimeValue) { timeValue_ = inputTimeValue; }

  inline unsigned long long getTimeValue() const { return timeValue_; }
  inline std::vector<std::string> getUserDBContent() const { return userDBContent_; }
  inline int getRunNr() const { return runNr_; }

  // PRINT METHOD...
  //
  void print();

  // SISTRIPSUMMARY MEMBERS...
  //
  std::vector<std::string> userDBContent_;
  std::vector<float> v_sum_;
  std::vector<DetRegistry> indexes_;

  int runNr_;
  unsigned long long timeValue_;

protected:
  // RETURNS POSITION OF ELEMENTNAME IN userDBContent_
  const short getPosition(std::string elementName) const;

  COND_SERIALIZABLE;
};

#endif