CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/CalibFormats/SiStripObjects/interface/SiStripGain.h

Go to the documentation of this file.
00001 #ifndef SiStripObjects_SiStripGain_h
00002 #define SiStripObjects_SiStripGain_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     SiStripObjects
00006 // Class  :     SiStripGain
00007 // 
00037 #include "CondFormats/SiStripObjects/interface/SiStripApvGain.h"
00038 #include <vector>
00039 #include <memory>
00040 
00041 class SiStripGain
00042 {
00043  public:
00044   SiStripGain() {};
00045   virtual ~SiStripGain() {};
00046 
00048   inline SiStripGain(const SiStripApvGain& apvgain, const double & factor) :
00049     apvgain_(0)
00050   {
00051     multiply(apvgain, factor, std::make_pair("", ""));
00052   }
00053 
00054   inline SiStripGain(const SiStripApvGain& apvgain, const double & factor,
00055                      const std::pair<std::string, std::string> & recordLabelPair) :
00056     apvgain_(0)
00057   {
00058     multiply(apvgain, factor, recordLabelPair);
00059   }
00060 
00062   void multiply(const SiStripApvGain & apvgain, const double & factor,
00063                 const std::pair<std::string, std::string> & recordLabelPair);
00064 
00065   // getters
00066   // For the product of all apvGains
00067   // -------------------------------
00068   const SiStripApvGain::Range getRange(const uint32_t& detID) const;
00069   float getStripGain(const uint16_t& strip, const SiStripApvGain::Range& range) const;
00070   float getApvGain(const uint16_t& apv, const SiStripApvGain::Range& range) const;
00071 
00072   // For a specific apvGain
00073   // ----------------------
00080   const SiStripApvGain::Range getRange(const uint32_t& detID, const uint32_t index) const;
00081   float getStripGain(const uint16_t& strip, const SiStripApvGain::Range& range, const uint32_t index) const;
00082   float getApvGain(const uint16_t& apv, const SiStripApvGain::Range& range, const uint32_t index) const;
00083 
00085   void getDetIds(std::vector<uint32_t>& DetIds_) const;
00086 
00087   inline size_t getNumberOfTags() const
00088   {
00089     return apvgainVector_.size();
00090   }
00091   inline std::string getRcdName(const uint32_t index) const
00092   {
00093     return recordLabelPair_[index].first;
00094   }
00095   inline std::string getLabelName(const uint32_t index) const
00096   {
00097     return recordLabelPair_[index].second;
00098   }
00099   inline double getTagNorm(const uint32_t index) const
00100   {
00101     return normVector_[index];
00102   }
00103 
00104   void printDebug(std::stringstream& ss) const;
00105   void printSummary(std::stringstream& ss) const;
00106 
00107  private:
00108 
00109   void fillNewGain(const SiStripApvGain * apvgain, const double & factor,
00110                    const SiStripApvGain * apvgain2 = 0, const double & factor2 = 1.);
00111   SiStripGain(const SiStripGain&); // stop default
00112   const SiStripGain& operator=(const SiStripGain&); // stop default
00113 
00114   // ---------- member data --------------------------------
00115 
00116   std::vector<const SiStripApvGain *> apvgainVector_;
00117   std::vector<double> normVector_;
00118   const SiStripApvGain * apvgain_;
00119   std::auto_ptr<SiStripApvGain> apvgainAutoPtr_;
00120   std::vector<std::pair<std::string, std::string> > recordLabelPair_;
00121 };
00122 
00123 #endif