CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 class SiStripDetInfo;
44 
45 class SiStripGain {
46 public:
48  SiStripGain(const SiStripGain &) = delete;
49  const SiStripGain &operator=(const SiStripGain &) = delete;
50 
52  inline SiStripGain(const SiStripApvGain &apvgain, const double &factor, const SiStripDetInfo &detInfo)
53  : apvgain_(nullptr) {
54  multiply(apvgain, factor, std::make_pair("", ""), detInfo);
55  }
56 
57  inline SiStripGain(const SiStripApvGain &apvgain,
58  const double &factor,
59  const std::pair<std::string, std::string> &recordLabelPair,
60  const SiStripDetInfo &detInfo)
61  : apvgain_(nullptr) {
62  multiply(apvgain, factor, recordLabelPair, detInfo);
63  }
64 
67  void multiply(const SiStripApvGain &apvgain,
68  const double &factor,
69  const std::pair<std::string, std::string> &recordLabelPair,
70  const SiStripDetInfo &detInfo);
71 
72  // getters
73  // For the product of all apvGains
74  // -------------------------------
75  const SiStripApvGain::Range getRange(uint32_t detID) const { return apvgain_->getRange(detID); }
76  SiStripApvGain::Range getRangeByPos(unsigned short pos) const { return apvgain_->getRangeByPos(pos); }
77  static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range) {
78  return SiStripApvGain::getStripGain(strip, range);
79  }
80  static float getApvGain(const uint16_t &apv, const SiStripApvGain::Range &range) {
81  return SiStripApvGain::getApvGain(apv, range);
82  }
83 
84  // For a specific apvGain
85  // ----------------------
92  const SiStripApvGain::Range getRange(const uint32_t &detID, const uint32_t index) const;
93  float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range, const uint32_t index) const;
94  float getApvGain(const uint16_t &apv, const SiStripApvGain::Range &range, const uint32_t index) const;
95 
97  void getDetIds(std::vector<uint32_t> &DetIds_) const;
98 
99  inline size_t getNumberOfTags() const { return apvgainVector_.size(); }
100  inline std::string getRcdName(const uint32_t index) const { return recordLabelPair_[index].first; }
101  inline std::string getLabelName(const uint32_t index) const { return recordLabelPair_[index].second; }
102  inline double getTagNorm(const uint32_t index) const { return normVector_[index]; }
103 
104  void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const;
105  void printSummary(std::stringstream &ss, const TrackerTopology *trackerTopo) const;
106 
107 private:
108  void fillNewGain(const SiStripApvGain *apvgain,
109  const double &factor,
110  SiStripDetInfo const &detInfo,
111  const SiStripApvGain *apvgain2 = nullptr,
112  const double &factor2 = 1.);
113 
114  // ---------- member data --------------------------------
115 
116  std::vector<const SiStripApvGain *> apvgainVector_;
117  std::vector<double> normVector_;
119  std::unique_ptr<SiStripApvGain> apvgainAutoPtr_;
120  std::vector<std::pair<std::string, std::string>> recordLabelPair_;
121 };
122 
123 #endif
const SiStripGain & operator=(const SiStripGain &)=delete
std::string getLabelName(const uint32_t index) const
Definition: SiStripGain.h:101
static float getApvGain(uint16_t apv, const Range &range)
std::vector< const SiStripApvGain * > apvgainVector_
Definition: SiStripGain.h:116
size_t getNumberOfTags() const
Definition: SiStripGain.h:99
std::unique_ptr< SiStripApvGain > apvgainAutoPtr_
Definition: SiStripGain.h:119
void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Definition: SiStripGain.cc:111
std::vector< double > normVector_
Definition: SiStripGain.h:117
std::vector< std::pair< std::string, std::string > > recordLabelPair_
Definition: SiStripGain.h:120
Range getRangeByPos(unsigned short pos) const
const SiStripApvGain * apvgain_
Definition: SiStripGain.h:118
std::string getRcdName(const uint32_t index) const
Definition: SiStripGain.h:100
const uint16_t range(const Frame &aFrame)
static float getApvGain(const uint16_t &apv, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:80
void fillNewGain(const SiStripApvGain *apvgain, const double &factor, SiStripDetInfo const &detInfo, const SiStripApvGain *apvgain2=nullptr, const double &factor2=1.)
Definition: SiStripGain.cc:40
static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:77
SiStripGain(const SiStripApvGain &apvgain, const double &factor, const std::pair< std::string, std::string > &recordLabelPair, const SiStripDetInfo &detInfo)
Definition: SiStripGain.h:57
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:102
SiStripApvGain::Range getRangeByPos(unsigned short pos) const
Definition: SiStripGain.h:76
void printSummary(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Definition: SiStripGain.cc:127
void multiply(const SiStripApvGain &apvgain, const double &factor, const std::pair< std::string, std::string > &recordLabelPair, const SiStripDetInfo &detInfo)
Definition: SiStripGain.cc:17
static float getStripGain(uint16_t strip, const Range &range)
const Range getRange(const uint32_t detID) const
SiStripGain(const SiStripApvGain &apvgain, const double &factor, const SiStripDetInfo &detInfo)
Kept for compatibility.
Definition: SiStripGain.h:52
const SiStripApvGain::Range getRange(uint32_t detID) const
Definition: SiStripGain.h:75