Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef CondFormats_SiStripObjects_CommissioningAnalysis_H
0002 #define CondFormats_SiStripObjects_CommissioningAnalysis_H
0003 
0004 #include "DataFormats/SiStripCommon/interface/SiStripFecKey.h"
0005 #include "DataFormats/SiStripCommon/interface/SiStripFedKey.h"
0006 #include <sstream>
0007 #include <string>
0008 #include <vector>
0009 #include <cstdint>
0010 
0011 /**
0012    @class CommissioningAnalysis
0013    @author M.Wingham, R.Bainbridge 
0014    
0015    @brief Abstract base for derived classes that provide analysis of
0016    commissioning histograms.
0017 */
0018 class CommissioningAnalysis {
0019 public:
0020   // ---------- con(de)structors ----------
0021 
0022   CommissioningAnalysis(const uint32_t& key, const std::string& my_name);
0023 
0024   CommissioningAnalysis(const std::string& my_name);
0025 
0026   virtual ~CommissioningAnalysis() { ; }
0027 
0028   // ---------- typedefs ----------
0029 
0030   typedef std::vector<float> VFloat;
0031 
0032   typedef std::vector<VFloat> VVFloat;
0033 
0034   typedef std::vector<uint16_t> VInt;
0035 
0036   typedef std::vector<VInt> VVInt;
0037 
0038   typedef std::vector<bool> VBool;
0039 
0040   typedef std::vector<VBool> VVBool;
0041 
0042   typedef std::vector<std::string> VString;
0043 
0044   // ---------- public interface ----------
0045 
0046   /** Identifies if analysis is valid or not. */
0047   virtual bool isValid() const { return true; }
0048 
0049   /** Returns error codes generated by analyses. */
0050   inline const VString& getErrorCodes() const;
0051 
0052   /** Returns FEC key object (encodes control structure). */
0053   inline const uint32_t& fecKey() const;
0054 
0055   /** Returns FED key object (encodes readout structure). */
0056   inline const uint32_t& fedKey() const;
0057 
0058   /** Returns DCU id. */
0059   inline const uint32_t& dcuId() const;
0060 
0061   /** Returns DetId. */
0062   inline const uint32_t& detId() const;
0063 
0064   // ---------- public print methods ----------
0065 
0066   /** Returns object name. */
0067   inline const std::string& myName() const;
0068 
0069   /** Prints analysis results. */
0070   virtual void print(std::stringstream&, uint32_t not_used = 0) = 0;
0071 
0072   /** Header information for analysis print(). */
0073   virtual void header(std::stringstream&) const;
0074 
0075   /** Navigate information for analysis print(). */
0076   virtual void summary(std::stringstream&) const;
0077 
0078   // ---------- public setter methods ----------
0079 
0080   /** Sets FEC key (encodes control structure). */
0081   inline void fecKey(const uint32_t&);
0082 
0083   /** Sets FED key (encodes readout structure). */
0084   inline void fedKey(const uint32_t&);
0085 
0086   /** Sets DCU id. */
0087   inline void dcuId(const uint32_t&);
0088 
0089   /** Sets DetId. */
0090   inline void detId(const uint32_t&);
0091 
0092   /** Sets error codes generated by analyses. */
0093   inline void setErrorCodes(const VString& errors);
0094 
0095   /** Adds error codes generated by analyses. */
0096   inline virtual void addErrorCode(const std::string& error);
0097 
0098   /** Resets analysis member data. */
0099   virtual void reset() = 0;
0100 
0101   // ---------- private methods ----------
0102 
0103 private:
0104   /** Private default constructor. */
0105   CommissioningAnalysis() { ; }
0106 
0107   // ---------- private member data ----------
0108 
0109 private:
0110   /** FEC key object. */
0111   uint32_t fecKey_;
0112 
0113   /** FEC key object. */
0114   uint32_t fedKey_;
0115 
0116   /** DCU Id. */
0117   uint32_t dcuId_;
0118 
0119   /** DetId. */
0120   uint32_t detId_;
0121 
0122   /** Object name. */
0123   std::string myName_;
0124 
0125   /** Error codes. */
0126   VString errors_;
0127 };
0128 
0129 // ---------- inline methods ----------
0130 
0131 const CommissioningAnalysis::VString& CommissioningAnalysis::getErrorCodes() const { return errors_; }
0132 
0133 const uint32_t& CommissioningAnalysis::fecKey() const { return fecKey_; }
0134 const uint32_t& CommissioningAnalysis::fedKey() const { return fedKey_; }
0135 
0136 const uint32_t& CommissioningAnalysis::dcuId() const { return dcuId_; }
0137 const uint32_t& CommissioningAnalysis::detId() const { return detId_; }
0138 
0139 const std::string& CommissioningAnalysis::myName() const { return myName_; }
0140 
0141 void CommissioningAnalysis::fecKey(const uint32_t& key) { fecKey_ = key; }
0142 void CommissioningAnalysis::fedKey(const uint32_t& key) { fedKey_ = key; }
0143 
0144 void CommissioningAnalysis::dcuId(const uint32_t& dcu_id) { dcuId_ = dcu_id; }
0145 void CommissioningAnalysis::detId(const uint32_t& det_id) { detId_ = det_id; }
0146 
0147 void CommissioningAnalysis::setErrorCodes(const VString& errors) { errors_ = errors; }
0148 void CommissioningAnalysis::addErrorCode(const std::string& error) { errors_.push_back(error); }
0149 
0150 #endif  // CondFormats_SiStripObjects_CommissioningAnalysis_H