CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/src/CalibFormats/SiPixelObjects/interface/PixelROCDACSettings.h

Go to the documentation of this file.
00001 #ifndef PixelROCDACSettings_h
00002 #define PixelROCDACSettings_h
00003 
00009 #include <string>
00010 #include <iostream>
00011 #include <vector>
00012 #include <map>
00013 #include <fstream>
00014 #include <sstream>
00015 #include "CalibFormats/SiPixelObjects/interface/PixelConfigKey.h"
00016 #include "CalibFormats/SiPixelObjects/interface/PixelROCName.h"
00017 
00018 namespace pos{
00019   typedef unsigned char bits8;
00020   typedef unsigned char bits4;
00021 
00027   class PixelROCDACSettings{
00028 
00029   public:
00030 
00031     PixelROCDACSettings();
00032 
00033     PixelROCDACSettings(const PixelROCName& rocid){rocid_= rocid;}
00034 
00035     //Build the commands needed to configure ROC
00036     //Need to use the mask bits also for this
00037     std::string getConfigCommand();
00038 
00039     int read(std::ifstream& in, const PixelROCName& rocid);
00040     int read(std::istringstream& in, const PixelROCName& rocid);
00041 
00042     int readBinary(std::ifstream& in, const PixelROCName& rocid);
00043 
00044     void writeBinary(std::ofstream& out) const;
00045 
00046     void writeASCII(std::ostream& out) const;
00047     void         writeXML(      pos::PixelConfigKey key, int version, std::string path)                     const {;}
00048     virtual void writeXMLHeader(pos::PixelConfigKey key, int version, std::string path, std::ofstream *out) const {;}
00049     virtual void writeXML(                                                              std::ofstream *out) const  ;
00050     virtual void writeXMLTrailer(                                                       std::ofstream *out) const {;}
00051 
00052     void getDACs(std::vector<unsigned int>& dacs) const;
00053     void getDACs(std::map<std::string, unsigned int>& dacs) const;
00054 
00055 
00056     void setDAC(unsigned int dacaddress, unsigned int dacvalue);
00057     void setDACs(std::map<std::string, unsigned int>& dacs) ;
00058 
00059     void compareDACs(std::map<std::string, unsigned int> & dacs, 
00060                      std::map<std::string, bool>         & changes,
00061                      std::map<std::string, unsigned int> & previous) ;
00062 
00063     void checkTag(std::string tag, 
00064                   std::string dacName,
00065                   const PixelROCName& rocid);
00066       
00067     void setDac(std::string dacName, int value);
00068 
00069     unsigned int getDac(std::string dacName) const;
00070 
00071     bits4 getVdd() {return Vdd_;}
00072     void setVdd(bits4 vdd) {Vdd_=vdd;}
00073 
00074     bits8 getVana() {return Vana_;}
00075     void setVana(bits8 vana) {Vana_=vana;}
00076 
00077     bits8 getVsf() {return Vsf_;}
00078     void setVsf(bits8 vsf) {Vsf_=vsf;}
00079 
00080     bits4 getVcomp() {return Vcomp_;}
00081     void setVcomp(bits4 vcomp) {Vcomp_=vcomp;}
00082 
00083     bits8 getVleak() {return Vleak_;}
00084     void setVleak(bits8 vleak) {Vleak_=vleak;}
00085 
00086     bits4 getVrgPr() {return VrgPr_;}
00087     void setVrgPr(bits4 vrgPr) {VrgPr_=vrgPr;}
00088 
00089     bits8 getVwllPr() {return VwllPr_;}
00090     void setVwllPr_(bits8 vwllPr) {VwllPr_=vwllPr;}
00091 
00092     bits4 getVrgSh() {return VrgSh_;}
00093     void setVrgSh(bits4 vrgSh) {VrgSh_=vrgSh;}
00094 
00095     bits8 getVwllSh() {return VwllSh_;}
00096     void setVwllSh(bits8 vwllSh) {VwllSh_=vwllSh;}
00097 
00098     bits8 getVHldDel() {return VHldDel_;}
00099     void setVHldDel(bits8 vHldDel) {VHldDel_=vHldDel;}
00100 
00101     bits8 getVtrim() {return Vtrim_;}
00102     void setVtrim(bits8 vtrim) {Vtrim_=vtrim;}
00103 
00104     bits8 getVcThr() {return VcThr_;}
00105     void setVcThr(bits8 vcThr) {VcThr_=vcThr;}
00106 
00107     bits8 getVIbias_bus() {return VIbias_bus_;}
00108     void setVIbias_bus(bits8 vIbias_bus) {VIbias_bus_=vIbias_bus;}
00109 
00110     bits4 getVIbias_sf() {return VIbias_sf_;}
00111     void setVIbias_sf(bits4 vIbias_sf) {VIbias_sf_=vIbias_sf;}
00112 
00113     bits8 getVOffsetOp() {return VOffsetOp_;}
00114     void setVOffsetOp(bits8 vOffsetOp) {VOffsetOp_=vOffsetOp;}
00115 
00116     bits8 getVbiasOp() {return VbiasOp_;}
00117     void setVbiasOp(bits8 vbiasOp) {VbiasOp_=vbiasOp;}
00118 
00119     bits8 getVOffsetRO() {return VOffsetRO_;}
00120     void setVOffsetRO(bits8 vOffsetRO) {VOffsetRO_=vOffsetRO;}
00121 
00122     bits8 getVIon() {return VIon_;}
00123     void setVIon(bits8 vIon) {VIon_=vIon;}
00124 
00125     bits8 getVIbias_PH() {return VIbias_PH_;}
00126     void setVIbias_PH(bits8 vIbias_PH) {VIbias_PH_=vIbias_PH;}
00127 
00128     bits8 getVIbias_DAC() {return VIbias_DAC_;}
00129     void setVIbias_DAC(bits8 vIbias_DAC) {VIbias_DAC_=vIbias_DAC;}
00130 
00131     bits8 getVIbias_roc() {return VIbias_roc_;}
00132     void setVIbias_roc(bits8 vIbias_roc) {VIbias_roc_=vIbias_roc;}
00133 
00134     bits8 getVIColOr() {return VIColOr_;}
00135     void setVIColOr(bits8 vIColOr) {VIColOr_=vIColOr;}
00136 
00137     bits8 getVnpix() {return Vnpix_;}
00138     void setVnpix(bits8 vnpix) {Vnpix_=vnpix;}
00139 
00140     bits8 getVsumCol() {return VsumCol_;}
00141     void setVsumCol(bits8 vsumCol) {VsumCol_=vsumCol;}
00142 
00143     bits8 getVcal() {return Vcal_;}
00144     void setVcal(bits8 vcal) {Vcal_=vcal;}
00145 
00146     bits8 getCalDel() {return CalDel_;}
00147     void setCalDel(bits8 calDel) {CalDel_=calDel;}
00148 
00149     bits8 getTempRange() {return TempRange_;}
00150     void setTempRange(bits8 tempRange) {TempRange_=tempRange;}
00151 
00152     bits8 getWBC() {return WBC_;}
00153     void setWBC(bits8 wbc) {WBC_=wbc;}
00154 
00155     bits8 getControlRegister() const {return ChipContReg_;}
00156     void setControlRegister(bits8 controlregister) {ChipContReg_=controlregister;}
00157 
00158     PixelROCName getROCName() const {return rocid_;} 
00159 
00160     friend std::ostream& operator<<(std::ostream& s, const PixelROCDACSettings& dacs);
00161 
00162   private:
00163 
00164     PixelROCName rocid_;
00165 
00166     //The dac settings used by the ROC
00167 
00168     bits4 Vdd_;              //addr 1
00169     bits8 Vana_;             //addr 2
00170     bits8 Vsf_;              //addr 3
00171     bits4 Vcomp_;            //addr 4
00172     bits8 Vleak_;            //addr 5
00173     bits4 VrgPr_;            //addr 6
00174     bits8 VwllPr_;           //addr 7
00175     bits4 VrgSh_;            //addr 8
00176     bits8 VwllSh_;           //addr 9
00177     bits8 VHldDel_;          //addr 10
00178     bits8 Vtrim_;            //addr 11
00179     bits8 VcThr_;            //addr 12
00180     bits8 VIbias_bus_;       //addr 13
00181     bits4 VIbias_sf_;        //addr 14
00182     bits8 VOffsetOp_;        //addr 15
00183     bits8 VbiasOp_;          //addr 16
00184     bits8 VOffsetRO_;        //addr 17
00185     bits8 VIon_;             //addr 18
00186     bits8 VIbias_PH_;        //addr 19
00187     bits8 VIbias_DAC_;       //addr 20
00188     bits8 VIbias_roc_;       //addr 21
00189     bits8 VIColOr_;          //addr 22
00190     bits8 Vnpix_;            //addr 23
00191     bits8 VsumCol_;          //addr 24
00192     bits8 Vcal_;             //addr 25
00193     bits8 CalDel_;           //addr 26
00194     bits8 TempRange_;        //addr 27
00195     bits8 WBC_;              //addr 254
00196     bits8 ChipContReg_;      //addr 253
00197     
00198     std::string ToLower(std::string) ;
00199     
00200   };
00201 }
00202 #endif