test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 //
37 #include <vector>
38 #include <memory>
39 
41 {
42  public:
44 
46  inline SiStripGain(const SiStripApvGain& apvgain, const double & factor) :
47  apvgain_(0)
48  {
49  multiply(apvgain, factor, std::make_pair("", ""));
50  }
51 
52  inline SiStripGain(const SiStripApvGain& apvgain, const double & factor,
53  const std::pair<std::string, std::string> & recordLabelPair) :
54  apvgain_(0)
55  {
56  multiply(apvgain, factor, recordLabelPair);
57  }
58 
60  void multiply(const SiStripApvGain & apvgain, const double & factor,
61  const std::pair<std::string, std::string> & recordLabelPair);
62 
63  // getters
64  // For the product of all apvGains
65  // -------------------------------
66  const SiStripApvGain::Range getRange(uint32_t detID) const { return apvgain_->getRange(detID);}
67  SiStripApvGain::Range getRangeByPos(unsigned short pos) const { return apvgain_->getRangeByPos(pos);}
68  static float getStripGain(const uint16_t& strip, const SiStripApvGain::Range& range) { return SiStripApvGain::getStripGain(strip, range);}
69  static float getApvGain(const uint16_t& apv, const SiStripApvGain::Range& range) { return SiStripApvGain::getApvGain(apv, range); }
70 
71 
72  // For a specific apvGain
73  // ----------------------
80  const SiStripApvGain::Range getRange(const uint32_t& detID, const uint32_t index) const;
81  float getStripGain(const uint16_t& strip, const SiStripApvGain::Range& range, const uint32_t index) const;
82  float getApvGain(const uint16_t& apv, const SiStripApvGain::Range& range, const uint32_t index) const;
83 
85  void getDetIds(std::vector<uint32_t>& DetIds_) const;
86 
87  inline size_t getNumberOfTags() const
88  {
89  return apvgainVector_.size();
90  }
91  inline std::string getRcdName(const uint32_t index) const
92  {
93  return recordLabelPair_[index].first;
94  }
95  inline std::string getLabelName(const uint32_t index) const
96  {
97  return recordLabelPair_[index].second;
98  }
99  inline double getTagNorm(const uint32_t index) const
100  {
101  return normVector_[index];
102  }
103 
104  void printDebug(std::stringstream& ss) const;
105  void printSummary(std::stringstream& ss) const;
106 
107  private:
108 
109  void fillNewGain(const SiStripApvGain * apvgain, const double & factor,
110  const SiStripApvGain * apvgain2 = 0, const double & factor2 = 1.);
111  SiStripGain(const SiStripGain&); // stop default
112  const SiStripGain& operator=(const SiStripGain&); // stop default
113 
114  // ---------- member data --------------------------------
115 
116  std::vector<const SiStripApvGain *> apvgainVector_;
117  std::vector<double> normVector_;
119  std::auto_ptr<SiStripApvGain> apvgainAutoPtr_;
120  std::vector<std::pair<std::string, std::string> > recordLabelPair_;
121 };
122 
123 #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
void printDebug(std::stringstream &ss) const
Definition: SiStripGain.cc:120
std::string getLabelName(const uint32_t index) const
Definition: SiStripGain.h:95
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:87
std::auto_ptr< SiStripApvGain > apvgainAutoPtr_
Definition: SiStripGain.h:119
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:91
static float getApvGain(const uint16_t &apv, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:69
const SiStripGain & operator=(const SiStripGain &)
static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:68
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:99
SiStripGain(const SiStripApvGain &apvgain, const double &factor)
Kept for compatibility.
Definition: SiStripGain.h:46
SiStripApvGain::Range getRangeByPos(unsigned short pos) const
Definition: SiStripGain.h:67
void printSummary(std::stringstream &ss) 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:52
const SiStripApvGain::Range getRange(uint32_t detID) const
Definition: SiStripGain.h:66