CMS 3D CMS Logo

SiStripGain.h
Go to the documentation of this file.
1 #ifndef SiStripObjects_SiStripGain_h
2 #define SiStripObjects_SiStripGain_h
3 // -*- C++ -*-
4 //
5 // Package: SiStripObjects
6 // Class : SiStripGain
7 //
39 #include <memory>
40 #include <vector>
41 
42 class TrackerTopology;
43 
44 class SiStripGain {
45 public:
47  SiStripGain(const SiStripGain &) = delete;
48  const SiStripGain &operator=(const SiStripGain &) = delete;
49 
51  inline SiStripGain(const SiStripApvGain &apvgain, const double &factor) : apvgain_(nullptr) {
52  multiply(apvgain, factor, std::make_pair("", ""));
53  }
54 
55  inline SiStripGain(const SiStripApvGain &apvgain,
56  const double &factor,
57  const std::pair<std::string, std::string> &recordLabelPair)
58  : apvgain_(nullptr) {
59  multiply(apvgain, factor, recordLabelPair);
60  }
61 
64  void multiply(const SiStripApvGain &apvgain,
65  const double &factor,
66  const std::pair<std::string, std::string> &recordLabelPair);
67 
68  // getters
69  // For the product of all apvGains
70  // -------------------------------
71  const SiStripApvGain::Range getRange(uint32_t detID) const { return apvgain_->getRange(detID); }
72  SiStripApvGain::Range getRangeByPos(unsigned short pos) const { return apvgain_->getRangeByPos(pos); }
73  static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range) {
74  return SiStripApvGain::getStripGain(strip, range);
75  }
76  static float getApvGain(const uint16_t &apv, const SiStripApvGain::Range &range) {
77  return SiStripApvGain::getApvGain(apv, range);
78  }
79 
80  // For a specific apvGain
81  // ----------------------
88  const SiStripApvGain::Range getRange(const uint32_t &detID, const uint32_t index) const;
89  float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range, const uint32_t index) const;
90  float getApvGain(const uint16_t &apv, const SiStripApvGain::Range &range, const uint32_t index) const;
91 
93  void getDetIds(std::vector<uint32_t> &DetIds_) const;
94 
95  inline size_t getNumberOfTags() const { return apvgainVector_.size(); }
96  inline std::string getRcdName(const uint32_t index) const { return recordLabelPair_[index].first; }
97  inline std::string getLabelName(const uint32_t index) const { return recordLabelPair_[index].second; }
98  inline double getTagNorm(const uint32_t index) const { return normVector_[index]; }
99 
100  void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const;
101  void printSummary(std::stringstream &ss, const TrackerTopology *trackerTopo) const;
102 
103 private:
104  void fillNewGain(const SiStripApvGain *apvgain,
105  const double &factor,
106  const SiStripApvGain *apvgain2 = nullptr,
107  const double &factor2 = 1.);
108 
109  // ---------- member data --------------------------------
110 
111  std::vector<const SiStripApvGain *> apvgainVector_;
112  std::vector<double> normVector_;
114  std::unique_ptr<SiStripApvGain> apvgainAutoPtr_;
115  std::vector<std::pair<std::string, std::string>> recordLabelPair_;
116 };
117 
118 #endif
void multiply(const SiStripApvGain &apvgain, const double &factor, const std::pair< std::string, std::string > &recordLabelPair)
Definition: SiStripGain.cc:17
const SiStripGain & operator=(const SiStripGain &)=delete
std::string getLabelName(const uint32_t index) const
Definition: SiStripGain.h:97
static float getApvGain(uint16_t apv, const Range &range)
std::vector< const SiStripApvGain * > apvgainVector_
Definition: SiStripGain.h:111
size_t getNumberOfTags() const
Definition: SiStripGain.h:95
std::unique_ptr< SiStripApvGain > apvgainAutoPtr_
Definition: SiStripGain.h:114
void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Definition: SiStripGain.cc:111
#define nullptr
std::vector< double > normVector_
Definition: SiStripGain.h:112
std::vector< std::pair< std::string, std::string > > recordLabelPair_
Definition: SiStripGain.h:115
Range getRangeByPos(unsigned short pos) const
const SiStripApvGain * apvgain_
Definition: SiStripGain.h:113
std::string getRcdName(const uint32_t index) const
Definition: SiStripGain.h:96
static float getApvGain(const uint16_t &apv, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:76
static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:73
std::pair< ContainerIterator, ContainerIterator > Range
void getDetIds(std::vector< uint32_t > &DetIds_) const
ATTENTION: we assume the detIds are the same as those from the first gain.
Definition: SiStripGain.cc:102
double getTagNorm(const uint32_t index) const
Definition: SiStripGain.h:98
SiStripGain(const SiStripApvGain &apvgain, const double &factor)
Kept for compatibility.
Definition: SiStripGain.h:51
SiStripApvGain::Range getRangeByPos(unsigned short pos) const
Definition: SiStripGain.h:72
void printSummary(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Definition: SiStripGain.cc:127
static float getStripGain(uint16_t strip, const Range &range)
void fillNewGain(const SiStripApvGain *apvgain, const double &factor, const SiStripApvGain *apvgain2=0, const double &factor2=1.)
Definition: SiStripGain.cc:39
const Range getRange(const uint32_t detID) const
SiStripGain(const SiStripApvGain &apvgain, const double &factor, const std::pair< std::string, std::string > &recordLabelPair)
Definition: SiStripGain.h:55
const SiStripApvGain::Range getRange(uint32_t detID) const
Definition: SiStripGain.h:71