Go to the documentation of this file.00001 #ifndef PixelPortCardConfig_h
00002 #define PixelPortCardConfig_h
00003
00009 #include <vector>
00010 #include <string>
00011 #include <map>
00012 #include "CalibFormats/SiPixelObjects/interface/PixelConfigBase.h"
00013
00014 namespace pos{
00015
00027 class PixelPortCardConfig: public PixelConfigBase{
00028
00029 public:
00030
00031 PixelPortCardConfig(std::vector < std::vector< std::string> > &tableMat);
00032 PixelPortCardConfig(std::string);
00033
00034 void writeASCII(std::string dir="") const;
00035 void writeXML( pos::PixelConfigKey key, int version, std::string path) const {;}
00036 virtual void writeXMLHeader( pos::PixelConfigKey key,
00037 int version,
00038 std::string path,
00039 std::ofstream *out,
00040 std::ofstream *out1 = NULL,
00041 std::ofstream *out2 = NULL
00042 ) const ;
00043 virtual void writeXML( std::ofstream *out,
00044 std::ofstream *out1 = NULL ,
00045 std::ofstream *out2 = NULL ) const ;
00046 virtual void writeXMLTrailer( std::ofstream *out,
00047 std::ofstream *out1 = NULL,
00048 std::ofstream *out2 = NULL
00049 ) const ;
00050
00051 const std::string& getPortCardName() const { return portcardname_; }
00052 void setPortCardName(std::string newName) { portcardname_ = newName; }
00053
00054 unsigned int getdevicesize() const;
00055 std::string getTKFECID() const;
00056 unsigned int getringAddress() const;
00057 unsigned int getccuAddress() const;
00058 unsigned int getchannelAddress() const;
00059 unsigned int geti2cSpeed() const;
00060 std::string gettype() const;
00061 unsigned int getdeviceAddress(unsigned int i) const;
00062 unsigned int getdeviceValues(unsigned int i) const;
00063 unsigned int getdeviceAddressForSetting(std::string settingName) const;
00064 unsigned int getdeviceValuesForSetting(std::string settingName) const;
00065 unsigned int getdeviceValuesForAddress(unsigned int address) const;
00066 unsigned int getAOHBias(unsigned int AOHNumber) const {return getdeviceValuesForAddress(AOHBiasAddressFromAOHNumber(AOHNumber));}
00067 void setdeviceValues(unsigned int address, unsigned int value);
00068 void setdeviceValues(std::string settingName, unsigned int value);
00069
00070 unsigned int AOHBiasAddressFromAOHNumber(unsigned int AOHNumber) const;
00071 unsigned int AOHGainAddressFromAOHNumber(unsigned int AOHNumber) const;
00072
00073 void setAOHGain(unsigned int AOHNumber, unsigned int value) {setAOHGain(AOHGainStringFromAOHNumber(AOHNumber),value);}
00074 unsigned int getAOHGain(unsigned int AOHNumber) const;
00075
00076 unsigned int new_PLL_CTR2_value(std::string CTR4or5, unsigned int last_CTR2) const;
00077
00078 private:
00079 void fillNameToAddress();
00080 void fillDBToFileAddress();
00081
00082 bool containsDeviceAddress(unsigned int deviceAddress) const;
00083 bool containsSetting(std::string settingName) const { return containsDeviceAddress(getdeviceAddressForSetting(settingName)); }
00084
00085 void setAOHGain(std::string settingName, unsigned int value);
00086 void setDataBaseAOHGain(std::string settingName, unsigned int value);
00087 std::string AOHGainStringFromAOHNumber(unsigned int AOHNumber) const;
00088
00089 std::string portcardname_;
00090
00091 std::string TKFECID_;
00092 unsigned int ringAddress_;
00093 unsigned int ccuAddress_;
00094
00095 unsigned int channelAddress_;
00096 std::vector < std::pair<unsigned int, unsigned int> > device_;
00097 unsigned int i2cSpeed_;
00098
00100 std::vector < unsigned int > key_;
00101 unsigned int aohcount_;
00102 void sortDeviceList();
00103
00104 std::string type_;
00105
00106 std::map<std::string, unsigned int> nameToAddress_;
00107 std::map<std::string, std::string> nameDBtoFileConversion_;
00108 };
00109 }
00110
00111 #endif