CMS 3D CMS Logo

PixelROCDACSettings.h
Go to the documentation of this file.
1 #ifndef PixelROCDACSettings_h
2 #define PixelROCDACSettings_h
3 
9 #include <string>
10 #include <iostream>
11 #include <vector>
12 #include <map>
13 #include <fstream>
14 #include <sstream>
17 
18 namespace pos {
19  typedef unsigned char bits8;
20  typedef unsigned char bits4;
21 
22  class PixelROCDACSettings;
23  std::ostream& operator<<(std::ostream& s, const PixelROCDACSettings& dacs);
24 
31  public:
33  virtual ~PixelROCDACSettings() { ; };
34 
35  PixelROCDACSettings(const PixelROCName& rocid) { rocid_ = rocid; }
36 
37  //Build the commands needed to configure ROC
38  //Need to use the mask bits also for this
40 
41  int read(std::ifstream& in, const PixelROCName& rocid);
42  int read(std::istringstream& in, const PixelROCName& rocid);
43 
44  int readBinary(std::ifstream& in, const PixelROCName& rocid);
45 
46  void writeBinary(std::ofstream& out) const;
47 
48  void writeASCII(std::ostream& out) const;
50  virtual void writeXMLHeader(pos::PixelConfigKey key, int version, std::string path, std::ofstream* out) const { ; }
51  virtual void writeXML(std::ofstream* out) const;
52  virtual void writeXMLTrailer(std::ofstream* out) const { ; }
53 
54  void getDACs(std::vector<unsigned int>& dacs) const;
55  void getDACs(std::map<std::string, unsigned int>& dacs) const;
56 
57  void setDAC(unsigned int dacaddress, unsigned int dacvalue);
58  void setDACs(std::map<std::string, unsigned int>& dacs);
59 
60  void compareDACs(std::map<std::string, unsigned int>& dacs,
61  std::map<std::string, bool>& changes,
62  std::map<std::string, unsigned int>& previous);
63 
64  void checkTag(std::string tag, std::string dacName, const PixelROCName& rocid);
65 
66  void setDac(std::string dacName, int value);
67 
68  unsigned int getDac(std::string dacName) const;
69 
70  bits4 getVdd() { return Vdd_; }
71  void setVdd(bits4 vdd) { Vdd_ = vdd; }
72 
73  bits8 getVana() { return Vana_; }
74  void setVana(bits8 vana) { Vana_ = vana; }
75 
76  bits8 getVsf() { return Vsf_; }
77  void setVsf(bits8 vsf) { Vsf_ = vsf; }
78 
79  bits4 getVcomp() { return Vcomp_; }
80  void setVcomp(bits4 vcomp) { Vcomp_ = vcomp; }
81 
82  bits8 getVleak() { return Vleak_; }
83  void setVleak(bits8 vleak) { Vleak_ = vleak; }
84 
85  bits4 getVrgPr() { return VrgPr_; }
86  void setVrgPr(bits4 vrgPr) { VrgPr_ = vrgPr; }
87 
88  bits8 getVwllPr() { return VwllPr_; }
89  void setVwllPr_(bits8 vwllPr) { VwllPr_ = vwllPr; }
90 
91  bits4 getVrgSh() { return VrgSh_; }
92  void setVrgSh(bits4 vrgSh) { VrgSh_ = vrgSh; }
93 
94  bits8 getVwllSh() { return VwllSh_; }
95  void setVwllSh(bits8 vwllSh) { VwllSh_ = vwllSh; }
96 
97  bits8 getVHldDel() { return VHldDel_; }
98  void setVHldDel(bits8 vHldDel) { VHldDel_ = vHldDel; }
99 
100  bits8 getVtrim() { return Vtrim_; }
101  void setVtrim(bits8 vtrim) { Vtrim_ = vtrim; }
102 
103  bits8 getVcThr() { return VcThr_; }
104  void setVcThr(bits8 vcThr) { VcThr_ = vcThr; }
105 
106  bits8 getVIbias_bus() { return VIbias_bus_; }
107  void setVIbias_bus(bits8 vIbias_bus) { VIbias_bus_ = vIbias_bus; }
108 
109  bits4 getVIbias_sf() { return VIbias_sf_; }
110  void setVIbias_sf(bits4 vIbias_sf) { VIbias_sf_ = vIbias_sf; }
111 
112  bits8 getVOffsetOp() { return VOffsetOp_; }
113  void setVOffsetOp(bits8 vOffsetOp) { VOffsetOp_ = vOffsetOp; }
114 
115  bits8 getVbiasOp() { return VbiasOp_; }
116  void setVbiasOp(bits8 vbiasOp) { VbiasOp_ = vbiasOp; }
117 
118  bits8 getVOffsetRO() { return VOffsetRO_; }
119  void setVOffsetRO(bits8 vOffsetRO) { VOffsetRO_ = vOffsetRO; }
120 
121  bits8 getVIon() { return VIon_; }
122  void setVIon(bits8 vIon) { VIon_ = vIon; }
123 
124  bits8 getVIbias_PH() { return VIbias_PH_; }
125  void setVIbias_PH(bits8 vIbias_PH) { VIbias_PH_ = vIbias_PH; }
126 
127  bits8 getVIbias_DAC() { return VIbias_DAC_; }
128  void setVIbias_DAC(bits8 vIbias_DAC) { VIbias_DAC_ = vIbias_DAC; }
129 
130  bits8 getVIbias_roc() { return VIbias_roc_; }
131  void setVIbias_roc(bits8 vIbias_roc) { VIbias_roc_ = vIbias_roc; }
132 
133  bits8 getVIColOr() { return VIColOr_; }
134  void setVIColOr(bits8 vIColOr) { VIColOr_ = vIColOr; }
135 
136  bits8 getVnpix() { return Vnpix_; }
137  void setVnpix(bits8 vnpix) { Vnpix_ = vnpix; }
138 
139  bits8 getVsumCol() { return VsumCol_; }
140  void setVsumCol(bits8 vsumCol) { VsumCol_ = vsumCol; }
141 
142  bits8 getVcal() { return Vcal_; }
143  void setVcal(bits8 vcal) { Vcal_ = vcal; }
144 
145  bits8 getCalDel() { return CalDel_; }
146  void setCalDel(bits8 calDel) { CalDel_ = calDel; }
147 
148  bits8 getTempRange() { return TempRange_; }
149  void setTempRange(bits8 tempRange) { TempRange_ = tempRange; }
150 
151  bits8 getWBC() { return WBC_; }
152  void setWBC(bits8 wbc) { WBC_ = wbc; }
153 
154  bits8 getControlRegister() const { return ChipContReg_; }
155  void setControlRegister(bits8 controlregister) { ChipContReg_ = controlregister; }
156 
157  PixelROCName getROCName() const { return rocid_; }
158 
159  friend std::ostream& operator<<(std::ostream& s, const PixelROCDACSettings& dacs);
160 
161  private:
163 
164  //The dac settings used by the ROC
165 
166  bits4 Vdd_; //addr 1
167  bits8 Vana_; //addr 2
168  bits8 Vsf_; //addr 3
169  bits4 Vcomp_; //addr 4
170  bits8 Vleak_; //addr 5
171  bits4 VrgPr_; //addr 6
172  bits8 VwllPr_; //addr 7
173  bits4 VrgSh_; //addr 8
174  bits8 VwllSh_; //addr 9
175  bits8 VHldDel_; //addr 10
176  bits8 Vtrim_; //addr 11
177  bits8 VcThr_; //addr 12
178  bits8 VIbias_bus_; //addr 13
179  bits4 VIbias_sf_; //addr 14
180  bits8 VOffsetOp_; //addr 15
181  bits8 VbiasOp_; //addr 16
182  bits8 VOffsetRO_; //addr 17
183  bits8 VIon_; //addr 18
184  bits8 VIbias_PH_; //addr 19
185  bits8 VIbias_DAC_; //addr 20
186  bits8 VIbias_roc_; //addr 21
187  bits8 VIColOr_; //addr 22
188  bits8 Vnpix_; //addr 23
189  bits8 VsumCol_; //addr 24
190  bits8 Vcal_; //addr 25
191  bits8 CalDel_; //addr 26
192  bits8 TempRange_; //addr 27
193  bits8 WBC_; //addr 254
194  bits8 ChipContReg_; //addr 253
195 
197  };
198 } // namespace pos
199 #endif
void setVIbias_roc(bits8 vIbias_roc)
unsigned int getDac(std::string dacName) const
void setVwllPr_(bits8 vwllPr)
unsigned char bits8
void setTempRange(bits8 tempRange)
void setVHldDel(bits8 vHldDel)
void setVwllSh(bits8 vwllSh)
virtual void writeXMLHeader(pos::PixelConfigKey key, int version, std::string path, std::ofstream *out) const
virtual void writeXMLTrailer(std::ofstream *out) const
std::ostream & operator<<(std::ostream &s, const PixelCalibConfiguration &calib)
void getDACs(std::vector< unsigned int > &dacs) const
int read(std::ifstream &in, const PixelROCName &rocid)
void setDAC(unsigned int dacaddress, unsigned int dacvalue)
void setVbiasOp(bits8 vbiasOp)
void setControlRegister(bits8 controlregister)
void writeXML(pos::PixelConfigKey key, int version, std::string path) const
void setDACs(std::map< std::string, unsigned int > &dacs)
std::string ToLower(std::string)
unsigned char bits4
Definition: value.py:1
This class implements..
void setVIbias_sf(bits4 vIbias_sf)
void setVIbias_bus(bits8 vIbias_bus)
void setVsumCol(bits8 vsumCol)
void checkTag(std::string tag, std::string dacName, const PixelROCName &rocid)
void setVIbias_PH(bits8 vIbias_PH)
This class implements the configuration key which actually just is an integer.
PixelROCDACSettings(const PixelROCName &rocid)
void compareDACs(std::map< std::string, unsigned int > &dacs, std::map< std::string, bool > &changes, std::map< std::string, unsigned int > &previous)
void setDac(std::string dacName, int value)
void setVOffsetRO(bits8 vOffsetRO)
This class implements..
Definition: PixelROCName.h:23
void writeBinary(std::ofstream &out) const
friend std::ostream & operator<<(std::ostream &s, const PixelROCDACSettings &dacs)
void setCalDel(bits8 calDel)
void setVIbias_DAC(bits8 vIbias_DAC)
int readBinary(std::ifstream &in, const PixelROCName &rocid)
This class implements..
void setVOffsetOp(bits8 vOffsetOp)
void setVIColOr(bits8 vIColOr)
PixelROCName getROCName() const
This class stores the name and related hardware mappings for a ROC.
void writeASCII(std::ostream &out) const