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