Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:51:31

0001 #ifndef CondFormats_SiPixelObjects_SiPixelCPEGenericErrorParm_h
0002 #define CondFormats_SiPixelObjects_SiPixelCPEGenericErrorParm_h 1
0003 
0004 #include "CondFormats/Serialization/interface/Serializable.h"
0005 
0006 #include <vector>
0007 #include <iosfwd>
0008 
0009 //--- Maybe should make this a class const, but that'd be too much work.
0010 //--- This usage is not worth it, since in the debugger will be obvious
0011 //--- what this is! ;)
0012 #define NONSENSE -99999.9
0013 #define NONSENSE_I -99999
0014 
0015 class SiPixelCPEGenericErrorParm {
0016 public:
0017   //! A struct to hold information for a given (alpha,beta,size)
0018   struct DbEntry {
0019     float sigma;
0020     float rms;
0021     float bias;        // For irradiated pixels
0022     float pix_height;  // For decapitation
0023     float ave_Qclus;   // Average cluster charge, For
0024     DbEntry() : sigma(NONSENSE), rms(NONSENSE), bias(NONSENSE), pix_height(NONSENSE), ave_Qclus(NONSENSE) {}
0025     ~DbEntry() {}
0026 
0027     COND_SERIALIZABLE;
0028   };
0029   typedef std::vector<DbEntry> DbVector;
0030 
0031   //! A struct to hold the binning information for (part, size, alpha, beta)
0032   struct DbEntryBinSize {
0033     int partBin_size;
0034     int sizeBin_size;
0035     int alphaBin_size;
0036     int betaBin_size;
0037     DbEntryBinSize()
0038         : partBin_size(NONSENSE_I), sizeBin_size(NONSENSE_I), alphaBin_size(NONSENSE_I), betaBin_size(NONSENSE_I) {}
0039     ~DbEntryBinSize() {}
0040 
0041     COND_SERIALIZABLE;
0042   };
0043   typedef std::vector<DbEntryBinSize> DbBinSizeVector;
0044 
0045   SiPixelCPEGenericErrorParm() : errors_(), errorsBinSize_() {}
0046   virtual ~SiPixelCPEGenericErrorParm() {}
0047 
0048   //!  Function to output the contents of the db object
0049   friend std::ostream& operator<<(std::ostream& s, const SiPixelCPEGenericErrorParm& genericErrors);
0050 
0051   //!  Function to fill the db object given a filename
0052   void fillCPEGenericErrorParm(double version, std::string file);
0053 
0054   //!  Accessors for the vectors -- non-const version
0055   inline DbVector& errors() { return errors_; }
0056   inline DbBinSizeVector& errorsBin() { return errorsBinSize_; }
0057   inline double& version() { return version_; }
0058 
0059   //!  Accessors for the vectors -- const version
0060   inline const DbVector& errors() const { return errors_; }
0061   inline const DbBinSizeVector& errorsBinSize() const { return errorsBinSize_; }
0062   inline const double& version() const { return version_; }
0063 
0064   //!  Reserve some reasonable sizes for the vectors.
0065   inline void reserve() {
0066     errors_.reserve(1000);
0067     errorsBinSize_.reserve(4);
0068   }
0069   //  &&& Should these sizes be computed on the fly from other
0070   //  &&& variables (which are currently not stored in this object,
0071   //  &&& but maybe should be?)
0072 
0073   //inline void push_back( DbEntry e) {errors_.push_back(e);}
0074   //    inline void push_back_bin( DbEntryBinSize e) {errorsBinSize_.push_back(e);}
0075   inline void set_version(double v) { version_ = v; }
0076 
0077   // &&& Should we be able to read this from an iostream?  See PxCPEdbUploader...
0078 
0079 private:
0080   DbVector errors_;
0081   DbBinSizeVector errorsBinSize_;
0082   double version_;
0083 
0084   COND_SERIALIZABLE;
0085 };
0086 
0087 #endif