CMS 3D CMS Logo

PixelPortCardConfig.h
Go to the documentation of this file.
1 #ifndef PixelPortCardConfig_h
2 #define PixelPortCardConfig_h
3 
9 #include <vector>
10 #include <string>
11 #include <map>
13 
14 namespace pos{
15 
28 
29  public:
30 
31  PixelPortCardConfig(std::vector < std::vector< std::string> > &tableMat);
33 
34  void writeASCII(std::string dir="") const override;
35  void writeXML( pos::PixelConfigKey key, int version, std::string path) const override {;}
37  int version,
39  std::ofstream *out,
40  std::ofstream *out1 = nullptr,
41  std::ofstream *out2 = nullptr
42  ) const override ;
43  void writeXML( std::ofstream *out,
44  std::ofstream *out1 = nullptr ,
45  std::ofstream *out2 = nullptr ) const override ;
46  void writeXMLTrailer( std::ofstream *out,
47  std::ofstream *out1 = nullptr,
48  std::ofstream *out2 = nullptr
49  ) const override ;
50 
51  const std::string& getPortCardName() const { return portcardname_; }
53 
54  unsigned int getdevicesize() const;
55  std::string getTKFECID() const;
56  unsigned int getringAddress() const;
57  unsigned int getccuAddress() const;
58  unsigned int getchannelAddress() const;
59  unsigned int geti2cSpeed() const;
60  std::string gettype() const;
61  unsigned int getdeviceAddress(unsigned int i) const;
62  unsigned int getdeviceValues(unsigned int i) const;
63  unsigned int getdeviceAddressForSetting(std::string settingName) const;
64  unsigned int getdeviceValuesForSetting(std::string settingName) const;
65  unsigned int getdeviceValuesForAddress(unsigned int address) const;
66  unsigned int getAOHBias(unsigned int AOHNumber) const {return getdeviceValuesForAddress(AOHBiasAddressFromAOHNumber(AOHNumber));}
67  void setdeviceValues(unsigned int address, unsigned int value);
68  void setdeviceValues(std::string settingName, unsigned int value);
69 
70  unsigned int AOHBiasAddressFromAOHNumber(unsigned int AOHNumber) const;
71  unsigned int AOHGainAddressFromAOHNumber(unsigned int AOHNumber) const;
72 
73  void setAOHGain(unsigned int AOHNumber, unsigned int value) {setAOHGain(AOHGainStringFromAOHNumber(AOHNumber),value);}
74  unsigned int getAOHGain(unsigned int AOHNumber) const;
75 
76  unsigned int new_PLL_CTR2_value(std::string CTR4or5, unsigned int last_CTR2) const;
77 
78  private:
79  void fillNameToAddress();
80  void fillDBToFileAddress();
81 
82  bool containsDeviceAddress(unsigned int deviceAddress) const;
83  bool containsSetting(std::string settingName) const { return containsDeviceAddress(getdeviceAddressForSetting(settingName)); }
84 
85  void setAOHGain(std::string settingName, unsigned int value);
86  void setDataBaseAOHGain(std::string settingName, unsigned int value);
87  std::string AOHGainStringFromAOHNumber(unsigned int AOHNumber) const;
88 
90 
91  std::string TKFECID_;//FEC ID string, as defined in tkfecconfig.dat
92  unsigned int ringAddress_;//ring #
93  unsigned int ccuAddress_;//CCU #
94 
95  unsigned int channelAddress_;//there are 8? channels on a CCU board
96  std::vector < std::pair<unsigned int, unsigned int> > device_;//the address on the portcard, and the value of it
97  unsigned int i2cSpeed_;//for the portcard, the slow i2c speed is 100kHz
98 
100  std::vector < unsigned int > key_;
101  unsigned int aohcount_;
102  void sortDeviceList();
103 
104  std::string type_; // fpix or bpix, used to determine setting names and addresses
105 
106  std::map<std::string, unsigned int> nameToAddress_; // translation from name to address, filled in by fillNameToAddress();
107  std::map<std::string, std::string> nameDBtoFileConversion_; // filled by fillDBToFileAddress() ;
108  };
109 }
110 /* @} */
111 #endif
unsigned int new_PLL_CTR2_value(std::string CTR4or5, unsigned int last_CTR2) const
bool containsDeviceAddress(unsigned int deviceAddress) const
This file contains the base class for "pixel configuration data" management.
unsigned int getchannelAddress() const
void writeASCII(std::string dir="") const override
unsigned int getdeviceValues(unsigned int i) const
std::map< std::string, unsigned int > nameToAddress_
void writeXMLTrailer(std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
std::map< std::string, std::string > nameDBtoFileConversion_
unsigned int getccuAddress() const
unsigned int getdeviceValuesForSetting(std::string settingName) const
string newName
Definition: mps_merge.py:85
PixelPortCardConfig(std::vector< std::vector< std::string > > &tableMat)
unsigned int getdeviceAddressForSetting(std::string settingName) const
unsigned int getAOHBias(unsigned int AOHNumber) const
void writeXMLHeader(pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
unsigned int AOHBiasAddressFromAOHNumber(unsigned int AOHNumber) const
unsigned int AOHGainAddressFromAOHNumber(unsigned int AOHNumber) const
void setDataBaseAOHGain(std::string settingName, unsigned int value)
std::vector< std::pair< unsigned int, unsigned int > > device_
This file contains the base class for "pixel configuration data" management.
std::vector< unsigned int > key_
key used for sorting device_
void writeXML(pos::PixelConfigKey key, int version, std::string path) const override
unsigned int getdeviceAddress(unsigned int i) const
std::string getTKFECID() const
unsigned int getdevicesize() const
Definition: value.py:1
std::string AOHGainStringFromAOHNumber(unsigned int AOHNumber) const
void setdeviceValues(unsigned int address, unsigned int value)
unsigned int getAOHGain(unsigned int AOHNumber) const
const std::string & getPortCardName() const
void setPortCardName(std::string newName)
This is the documentation about PixelNameTranslation...
This class implements..
bool containsSetting(std::string settingName) const
unsigned int getringAddress() const
unsigned int geti2cSpeed() const
dbl *** dir
Definition: mlp_gen.cc:35
void setAOHGain(unsigned int AOHNumber, unsigned int value)
std::string gettype() const
unsigned int getdeviceValuesForAddress(unsigned int address) const