Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:47:22

0001 #ifndef PixelPortCardConfig_h
0002 #define PixelPortCardConfig_h
0003 /**
0004 * \file CalibFormats/SiPixelObjects/interface/PixelPortCardConfig.h
0005 * \brief This class specifies the settings on the TKPCIFEC and the settings on the portcard
0006 *
0007 *   A longer explanation will be placed here later
0008 */
0009 #include <vector>
0010 #include <string>
0011 #include <map>
0012 #include "CalibFormats/SiPixelObjects/interface/PixelConfigBase.h"
0013 
0014 namespace pos {
0015 
0016   /*!  \ingroup ConfigurationObjects "Configuration Objects"
0017 *    
0018 *  @{
0019 *
0020 *  \class PixelPortCardConfig PixelPortCardConfig.h
0021 *  \brief This is the documentation about PixelNameTranslation...
0022 *
0023 *   
0024 *  This class specifies the settings on the TKPCIFEC and the settings on the portcard 
0025 *   
0026 */
0027   class PixelPortCardConfig : public PixelConfigBase {
0028   public:
0029     PixelPortCardConfig(std::vector<std::vector<std::string> > &tableMat);
0030     PixelPortCardConfig(std::string);
0031 
0032     void writeASCII(std::string dir = "") const override;
0033     void writeXML(pos::PixelConfigKey key, int version, std::string path) const override { ; }
0034     void writeXMLHeader(pos::PixelConfigKey key,
0035                         int version,
0036                         std::string path,
0037                         std::ofstream *out,
0038                         std::ofstream *out1 = nullptr,
0039                         std::ofstream *out2 = nullptr) const override;
0040     void writeXML(std::ofstream *out, std::ofstream *out1 = nullptr, std::ofstream *out2 = nullptr) const override;
0041     void writeXMLTrailer(std::ofstream *out,
0042                          std::ofstream *out1 = nullptr,
0043                          std::ofstream *out2 = nullptr) const override;
0044 
0045     const std::string &getPortCardName() const { return portcardname_; }
0046     void setPortCardName(std::string newName) { portcardname_ = newName; }
0047 
0048     unsigned int getdevicesize() const;
0049     std::string getTKFECID() const;
0050     unsigned int getringAddress() const;
0051     unsigned int getccuAddress() const;
0052     unsigned int getchannelAddress() const;
0053     unsigned int geti2cSpeed() const;
0054     std::string gettype() const;
0055     unsigned int getdeviceAddress(unsigned int i) const;
0056     unsigned int getdeviceValues(unsigned int i) const;
0057     unsigned int getdeviceAddressForSetting(std::string settingName) const;
0058     unsigned int getdeviceValuesForSetting(std::string settingName) const;
0059     unsigned int getdeviceValuesForAddress(unsigned int address) const;
0060     unsigned int getAOHBias(unsigned int AOHNumber) const {
0061       return getdeviceValuesForAddress(AOHBiasAddressFromAOHNumber(AOHNumber));
0062     }
0063     void setdeviceValues(unsigned int address, unsigned int value);
0064     void setdeviceValues(std::string settingName, unsigned int value);
0065 
0066     unsigned int AOHBiasAddressFromAOHNumber(unsigned int AOHNumber) const;
0067     unsigned int AOHGainAddressFromAOHNumber(unsigned int AOHNumber) const;
0068 
0069     void setAOHGain(unsigned int AOHNumber, unsigned int value) {
0070       setAOHGain(AOHGainStringFromAOHNumber(AOHNumber), value);
0071     }
0072     unsigned int getAOHGain(unsigned int AOHNumber) const;
0073 
0074     unsigned int new_PLL_CTR2_value(std::string CTR4or5, unsigned int last_CTR2) const;
0075 
0076   private:
0077     void fillNameToAddress();
0078     void fillDBToFileAddress();
0079 
0080     bool containsDeviceAddress(unsigned int deviceAddress) const;
0081     bool containsSetting(std::string settingName) const {
0082       return containsDeviceAddress(getdeviceAddressForSetting(settingName));
0083     }
0084 
0085     void setAOHGain(std::string settingName, unsigned int value);
0086     void setDataBaseAOHGain(std::string settingName, unsigned int value);
0087     std::string AOHGainStringFromAOHNumber(unsigned int AOHNumber) const;
0088 
0089     std::string portcardname_;
0090 
0091     std::string TKFECID_;       //FEC ID string, as defined in tkfecconfig.dat
0092     unsigned int ringAddress_;  //ring #
0093     unsigned int ccuAddress_;   //CCU #
0094 
0095     unsigned int channelAddress_;                                 //there are 8? channels on a CCU board
0096     std::vector<std::pair<unsigned int, unsigned int> > device_;  //the address on the portcard, and the value of it
0097     unsigned int i2cSpeed_;                                       //for the portcard, the slow i2c speed is 100kHz
0098 
0099     ///key used for sorting device_
0100     std::vector<unsigned int> key_;
0101     unsigned int aohcount_;
0102     void sortDeviceList();
0103 
0104     std::string type_;  // fpix or bpix, used to determine setting names and addresses
0105 
0106     std::map<std::string, unsigned int>
0107         nameToAddress_;  // translation from name to address, filled in by fillNameToAddress();
0108     std::map<std::string, std::string> nameDBtoFileConversion_;  // filled by fillDBToFileAddress() ;
0109   };
0110 }  // namespace pos
0111 /* @} */
0112 #endif