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 //
37 #include <vector>
38 #include <memory>
39 
40 class TrackerTopology;
41 
43 {
44  public:
46  SiStripGain(const SiStripGain&) = delete;
47  const SiStripGain& operator=(const SiStripGain&) = delete;
48 
50  inline SiStripGain(const SiStripApvGain& apvgain, const double & factor) :
52  {
53  multiply(apvgain, factor, std::make_pair("", ""));
54  }
55 
56  inline SiStripGain(const SiStripApvGain& apvgain, const double & factor,
57  const std::pair<std::string, std::string> & recordLabelPair) :
59  {
60  multiply(apvgain, factor, recordLabelPair);
61  }
62 
64  void multiply(const SiStripApvGain & apvgain, const double & factor,
65  const std::pair<std::string, std::string> & recordLabelPair);
66 
67  // getters
68  // For the product of all apvGains
69  // -------------------------------
70  const SiStripApvGain::Range getRange(uint32_t detID) const { return apvgain_->getRange(detID);}
71  SiStripApvGain::Range getRangeByPos(unsigned short pos) const { return apvgain_->getRangeByPos(pos);}
72  static float getStripGain(const uint16_t& strip, const SiStripApvGain::Range& range) { return SiStripApvGain::getStripGain(strip, range);}
73  static float getApvGain(const uint16_t& apv, const SiStripApvGain::Range& range) { return SiStripApvGain::getApvGain(apv, range); }
74 
75 
76  // For a specific apvGain
77  // ----------------------
84  const SiStripApvGain::Range getRange(const uint32_t& detID, const uint32_t index) const;
85  float getStripGain(const uint16_t& strip, const SiStripApvGain::Range& range, const uint32_t index) const;
86  float getApvGain(const uint16_t& apv, const SiStripApvGain::Range& range, const uint32_t index) const;
87 
89  void getDetIds(std::vector<uint32_t>& DetIds_) const;
90 
91  inline size_t getNumberOfTags() const
92  {
93  return apvgainVector_.size();
94  }
95  inline std::string getRcdName(const uint32_t index) const
96  {
97  return recordLabelPair_[index].first;
98  }
99  inline std::string getLabelName(const uint32_t index) const
100  {
101  return recordLabelPair_[index].second;
102  }
103  inline double getTagNorm(const uint32_t index) const
104  {
105  return normVector_[index];
106  }
107 
108  void printDebug(std::stringstream& ss, const TrackerTopology* trackerTopo) const;
109  void printSummary(std::stringstream& ss, const TrackerTopology* trackerTopo) const;
110 
111  private:
112 
113  void fillNewGain(const SiStripApvGain * apvgain, const double & factor,
114  const SiStripApvGain * apvgain2 = nullptr, const double & factor2 = 1.);
115 
116  // ---------- member data --------------------------------
117 
118  std::vector<const SiStripApvGain *> apvgainVector_;
119  std::vector<double> normVector_;
121  std::unique_ptr<SiStripApvGain> apvgainAutoPtr_;
122  std::vector<std::pair<std::string, std::string> > recordLabelPair_;
123 };
124 
125 #endif
void multiply(const SiStripApvGain &apvgain, const double &factor, const std::pair< std::string, std::string > &recordLabelPair)
Used to input additional gain values that will be multiplied to the first one.
Definition: SiStripGain.cc:17
const SiStripGain & operator=(const SiStripGain &)=delete
std::string getLabelName(const uint32_t index) const
Definition: SiStripGain.h:99
static float getApvGain(uint16_t apv, const Range &range)
std::vector< const SiStripApvGain * > apvgainVector_
Definition: SiStripGain.h:118
size_t getNumberOfTags() const
Definition: SiStripGain.h:91
std::unique_ptr< SiStripApvGain > apvgainAutoPtr_
Definition: SiStripGain.h:121
void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Definition: SiStripGain.cc:120
std::vector< double > normVector_
Definition: SiStripGain.h:119
std::vector< std::pair< std::string, std::string > > recordLabelPair_
Definition: SiStripGain.h:122
Range getRangeByPos(unsigned short pos) const
#define nullptr
const SiStripApvGain * apvgain_
Definition: SiStripGain.h:120
std::string getRcdName(const uint32_t index) const
Definition: SiStripGain.h:95
static float getApvGain(const uint16_t &apv, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:73
static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:72
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:108
double getTagNorm(const uint32_t index) const
Definition: SiStripGain.h:103
SiStripGain(const SiStripApvGain &apvgain, const double &factor)
Kept for compatibility.
Definition: SiStripGain.h:50
SiStripApvGain::Range getRangeByPos(unsigned short pos) const
Definition: SiStripGain.h:71
void printSummary(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Definition: SiStripGain.cc:139
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:56
const SiStripApvGain::Range getRange(uint32_t detID) const
Definition: SiStripGain.h:70