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 //
38 #include <vector>
39 #include <memory>
40 
42 {
43  public:
45  virtual ~SiStripGain() {};
46 
48  inline SiStripGain(const SiStripApvGain& apvgain, const double & factor) :
49  apvgain_(0)
50  {
51  multiply(apvgain, factor, std::make_pair("", ""));
52  }
53 
54  inline SiStripGain(const SiStripApvGain& apvgain, const double & factor,
55  const std::pair<std::string, std::string> & recordLabelPair) :
56  apvgain_(0)
57  {
58  multiply(apvgain, factor, recordLabelPair);
59  }
60 
62  void multiply(const SiStripApvGain & apvgain, const double & factor,
63  const std::pair<std::string, std::string> & recordLabelPair);
64 
65  // getters
66  // For the product of all apvGains
67  // -------------------------------
68  const SiStripApvGain::Range getRange(const uint32_t& detID) const;
69  float getStripGain(const uint16_t& strip, const SiStripApvGain::Range& range) const;
70  float getApvGain(const uint16_t& apv, const SiStripApvGain::Range& range) const;
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:18
void printDebug(std::stringstream &ss) const
Definition: SiStripGain.cc:139
std::string getLabelName(const uint32_t index) const
Definition: SiStripGain.h:95
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
std::vector< const SiStripApvGain * > apvgainVector_
Definition: SiStripGain.h:116
size_t getNumberOfTags() const
Definition: SiStripGain.h:87
float getApvGain(const uint16_t &apv, const SiStripApvGain::Range &range) const
Definition: SiStripGain.cc:105
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
float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range) const
Definition: SiStripGain.cc:87
const SiStripApvGain * apvgain_
Definition: SiStripGain.h:118
std::string getRcdName(const uint32_t index) const
Definition: SiStripGain.h:91
virtual ~SiStripGain()
Definition: SiStripGain.h:45
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:123
double getTagNorm(const uint32_t index) const
Definition: SiStripGain.h:99
SiStripGain(const SiStripApvGain &apvgain, const double &factor)
Kept for compatibility.
Definition: SiStripGain.h:48
void printSummary(std::stringstream &ss) const
Definition: SiStripGain.cc:158
void fillNewGain(const SiStripApvGain *apvgain, const double &factor, const SiStripApvGain *apvgain2=0, const double &factor2=1.)
Definition: SiStripGain.cc:40
const SiStripApvGain::Range getRange(const uint32_t &detID) const
Definition: SiStripGain.cc:129
SiStripGain(const SiStripApvGain &apvgain, const double &factor, const std::pair< std::string, std::string > &recordLabelPair)
Definition: SiStripGain.h:54