File indexing completed on 2023-03-17 10:42:06
0001 #ifndef SiStripObjects_SiStripGain_h
0002 #define SiStripObjects_SiStripGain_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038 #include "CondFormats/SiStripObjects/interface/SiStripApvGain.h"
0039 #include <memory>
0040 #include <vector>
0041
0042 class TrackerTopology;
0043 class SiStripDetInfo;
0044
0045 class SiStripGain {
0046 public:
0047 SiStripGain() {}
0048 SiStripGain(const SiStripGain &) = delete;
0049 const SiStripGain &operator=(const SiStripGain &) = delete;
0050
0051
0052 inline SiStripGain(const SiStripApvGain &apvgain, const double &factor, const SiStripDetInfo &detInfo)
0053 : apvgain_(nullptr) {
0054 multiply(apvgain, factor, std::make_pair("", ""), detInfo);
0055 }
0056
0057 inline SiStripGain(const SiStripApvGain &apvgain,
0058 const double &factor,
0059 const std::pair<std::string, std::string> &recordLabelPair,
0060 const SiStripDetInfo &detInfo)
0061 : apvgain_(nullptr) {
0062 multiply(apvgain, factor, recordLabelPair, detInfo);
0063 }
0064
0065
0066
0067 void multiply(const SiStripApvGain &apvgain,
0068 const double &factor,
0069 const std::pair<std::string, std::string> &recordLabelPair,
0070 const SiStripDetInfo &detInfo);
0071
0072
0073
0074
0075 const SiStripApvGain::Range getRange(uint32_t detID) const { return apvgain_->getRange(detID); }
0076 SiStripApvGain::Range getRangeByPos(unsigned short pos) const { return apvgain_->getRangeByPos(pos); }
0077 static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range) {
0078 return SiStripApvGain::getStripGain(strip, range);
0079 }
0080 static float getApvGain(const uint16_t &apv, const SiStripApvGain::Range &range) {
0081 return SiStripApvGain::getApvGain(apv, range);
0082 }
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092 const SiStripApvGain::Range getRange(const uint32_t &detID, const uint32_t index) const;
0093 float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range, const uint32_t index) const;
0094 float getApvGain(const uint16_t &apv, const SiStripApvGain::Range &range, const uint32_t index) const;
0095
0096
0097 void getDetIds(std::vector<uint32_t> &DetIds_) const;
0098
0099 inline size_t getNumberOfTags() const { return apvgainVector_.size(); }
0100 inline std::string getRcdName(const uint32_t index) const { return recordLabelPair_[index].first; }
0101 inline std::string getLabelName(const uint32_t index) const { return recordLabelPair_[index].second; }
0102 inline double getTagNorm(const uint32_t index) const { return normVector_[index]; }
0103
0104 void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const;
0105 void printSummary(std::stringstream &ss, const TrackerTopology *trackerTopo) const;
0106
0107 private:
0108 void fillNewGain(const SiStripApvGain *apvgain,
0109 const double &factor,
0110 SiStripDetInfo const &detInfo,
0111 const SiStripApvGain *apvgain2 = nullptr,
0112 const double &factor2 = 1.);
0113
0114
0115
0116 std::vector<const SiStripApvGain *> apvgainVector_;
0117 std::vector<double> normVector_;
0118 const SiStripApvGain *apvgain_;
0119 std::unique_ptr<SiStripApvGain> apvgainAutoPtr_;
0120 std::vector<std::pair<std::string, std::string>> recordLabelPair_;
0121 };
0122
0123 #endif