26 const bool readTemperatures =
false;
29 const int temperatureReg = 0x1;
33 std::string mthn =
"[PixelDACSettings::PixelDACSettings()]\t\t\t ";
39 std::cout << __LINE__ <<
"]\t" << mthn <<
"Could not open: " <<
filename << std::endl;
41 throw std::runtime_error(
"Failed to open file " +
filename);
72 std::ifstream
in(
filename.c_str(), std::ios::binary);
75 std::cout << __LINE__ <<
"]\t" << mthn <<
"Could not open: " <<
filename << std::endl;
88 for (
int i = 0;
i < nchar;
i++) {
107 tmp.readBinary(
in, rocid);
119 for (
int i = 0;
i < nchar;
i++) {
181 std::vector<std::string>
ins = tableMat[0];
182 std::string mthn(
"[PixelDACSettings::PixelDACSettings()] ");
184 std::istringstream dbin;
187 std::map<std::string, int> colM;
188 std::vector<std::string> colNames;
189 std::map<std::string, std::string> nameTranslation;
191 colNames.push_back(
"CONFIG_KEY");
192 colNames.push_back(
"KEY_TYPE");
193 colNames.push_back(
"KEY_ALIAS");
194 colNames.push_back(
"VERSION");
195 colNames.push_back(
"KIND_OF_COND");
196 colNames.push_back(
"ROC_NAME");
197 colNames.push_back(
"VDD");
198 colNames.push_back(
"VANA");
199 colNames.push_back(
"VSF");
200 colNames.push_back(
"VCOMP");
201 colNames.push_back(
"VLEAK");
202 colNames.push_back(
"VRGPR");
203 colNames.push_back(
"VWLLPR");
204 colNames.push_back(
"VRGSH");
205 colNames.push_back(
"VWLLSH");
206 colNames.push_back(
"VHLDDEL");
207 colNames.push_back(
"VTRIM");
208 colNames.push_back(
"VCTHR");
209 colNames.push_back(
"VIBIAS_BUS");
210 colNames.push_back(
"VIBIAS_SF");
211 colNames.push_back(
"VOFFSETOP");
212 colNames.push_back(
"VBIASOP");
213 colNames.push_back(
"VOFFSETRO");
214 colNames.push_back(
"VION");
215 colNames.push_back(
"VIBIAS_PH");
216 colNames.push_back(
"VIBIAS_DAC");
217 colNames.push_back(
"VIBIAS_ROC");
218 colNames.push_back(
"VICOLOR");
219 colNames.push_back(
"VNPIX");
220 colNames.push_back(
"VSUMCOL");
221 colNames.push_back(
"VCAL");
222 colNames.push_back(
"CALDEL");
223 colNames.push_back(
"TEMPRANGE");
224 colNames.push_back(
"WBC");
225 colNames.push_back(
"CHIPCONTREG");
259 for (
unsigned int c = skipColumns;
c <
ins.size();
c++) {
260 for (
unsigned int n = 0;
n < colNames.size();
n++) {
261 if (tableMat[0][
c] == colNames[
n]) {
262 colM[colNames[
n]] =
c;
267 for (
unsigned int n = skipColumns;
n < colNames.size();
n++) {
268 if (colM.find(colNames[
n]) == colM.end()) {
269 std::cerr <<
"[PixelDACSettings::PixelDACSettings()]\tCouldn't find in the database the column with name " 270 << colNames[
n] << std::endl;
279 for (
unsigned int r = 1; r < tableMat.size(); r++) {
291 std::ostringstream dacs(
"");
293 for (
unsigned int n = skipColumns + 6;
n < colNames.size();
n++) {
294 dacs << nameTranslation[colNames[
n]] <<
": " << atoi(tableMat[r][colM[colNames[
n]]].c_str()) << std::endl;
302 dbin.str(dacs.str());
303 tmp.read(dbin, rocid);
354 std::ofstream
out(
filename.c_str(), std::ios::binary);
362 std::string mthn =
"[PixelDACSettings::writeASCII()]\t\t\t ";
366 std::cout << __LINE__ <<
"]\t" << mthn <<
"Writing to file " <<
filename << std::endl;
378 std::ofstream* outstream,
379 std::ofstream* out1stream,
380 std::ofstream* out2stream)
const {
381 std::string mthn =
"[PixelDACSettings::writeXMLHeader()]\t\t\t ";
385 std::cout << __LINE__ <<
"]\t" << mthn <<
"Writing to: " <<
fullPath.str() << std::endl;
387 outstream->open(
fullPath.str().c_str());
389 *outstream <<
"<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl;
390 *outstream <<
"<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl;
391 *outstream <<
"" << std::endl;
392 *outstream <<
" <!-- " << mthn <<
"-->" << std::endl;
393 *outstream <<
"" << std::endl;
394 *outstream <<
" <HEADER>" << std::endl;
395 *outstream <<
" <TYPE>" << std::endl;
396 *outstream <<
" <EXTENSION_TABLE_NAME>ROC_DAC_SETTINGS_COL</EXTENSION_TABLE_NAME>" << std::endl;
397 *outstream <<
" <NAME>ROC DAC Settings Col</NAME>" << std::endl;
398 *outstream <<
" </TYPE>" << std::endl;
399 *outstream <<
" <RUN>" << std::endl;
400 *outstream <<
" <RUN_TYPE>ROC DAC Settings</RUN_TYPE>" << std::endl;
401 *outstream <<
" <RUN_NUMBER>1</RUN_NUMBER>" << std::endl;
403 *outstream <<
" <LOCATION>CERN P5</LOCATION>" << std::endl;
404 *outstream <<
" </RUN>" << std::endl;
405 *outstream <<
" </HEADER>" << std::endl;
406 *outstream <<
"" << std::endl;
407 *outstream <<
" <DATA_SET>" << std::endl;
408 *outstream <<
" <VERSION>" <<
version <<
"</VERSION>" << std::endl;
409 *outstream <<
" <COMMENT_DESCRIPTION>" <<
getComment() <<
"</COMMENT_DESCRIPTION>" << std::endl;
410 *outstream <<
" <CREATED_BY_USER>" <<
getAuthor() <<
"</CREATED_BY_USER>" << std::endl;
411 *outstream <<
" " << std::endl;
412 *outstream <<
" <PART>" << std::endl;
413 *outstream <<
" <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl;
414 *outstream <<
" <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl;
415 *outstream <<
" </PART>" << std::endl;
416 *outstream <<
" " << std::endl;
418 std::cout << __LINE__ <<
"]\t" << mthn <<
"Header written" << std::endl;
423 std::string mthn =
"[PixelDACSettings::writeXML()]\t\t\t ";
432 std::ofstream* out1stream,
433 std::ofstream* out2stream)
const {
434 std::string mthn =
"[PixelDACSettings::writeXMLTrailer()]\t\t\t ";
436 *outstream <<
" </DATA_SET>" << std::endl;
437 *outstream <<
"</ROOT>" << std::endl;
440 std::cout << __LINE__ <<
"]\t" << mthn <<
"Data written" << std::endl;
500 bool bufferData =
true;
502 std::vector<unsigned int> dacs;
526 if (!HVon || disableRoc)
529 pixelFEC->
setAllDAC(theROC, dacs, bufferData);
535 const bool kmeKLUDGE =
false;
538 unsigned int col = 0;
554 for (
int dcol = 0; dcol < 26; dcol++) {
565 if (!HVon || disableRoc) {
580 if (readTemperatures) {
586 <<
" LastDAC=Temp " << temperatureReg << std::endl;
602 <<
" LastDAC=Vcal" << std::endl;
627 bool bufferData =
true;
629 std::vector<unsigned int> dacs;
660 if (readTemperatures) {
694 bool bufferData =
true;
696 std::vector<unsigned int> dacs;
735 if (readTemperatures) {
767 const std::map<PixelROCName, PixelROCStatus>& roclist = detconfig->
getROCsList();
768 const std::map<PixelROCName, PixelROCStatus>::const_iterator iroc = roclist.find(rocname);
769 assert(iroc != roclist.end());
const std::string k_DACName_VcThr
const std::string k_DACName_VrgPr
void addROC(PixelROCDACSettings &rocname)
virtual int clrcal(int mfec, int fecchannel, int hubaddress, int portaddress, int rocid, bool buffermode=false)=0
This file contains the base class for "pixel configuration data" management.
const std::string k_DACName_ChipContReg
void writeXMLTrailer(std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
virtual int progdac(int mfec, int fecchannel, int hubaddress, int portaddress, int rocid, int dacaddress, int dacvalue, bool buffermode=false)=0
const std::string k_DACName_Vsf
const std::string k_DACName_CalDel
const std::string k_DACName_TempRange
void writeXML(pos::PixelConfigKey key, int version, std::string path) const override
const std::string k_DACName_VIbias_sf
void setVcthrEnable(PixelFECConfigInterface *pixelFEC, PixelNameTranslation *trans, PixelDetectorConfig *detconfig) const
unsigned int mfec() const
const std::string k_DACName_Vtrim
std::string getComment() const
virtual int calpix(int mfec, int mfecchannel, int hubaddress, int portaddress, int rocid, int coladdr, int rowaddress, int caldata, bool buffermode=false)=0
const std::string k_DACName_VIbias_DAC
const std::string k_DACName_VwllSh
const std::string k_DACName_Vnpix
const std::string k_DACName_Vleak
virtual int dcolenable(int mfec, int mfecchannel, int hubaddress, int portaddress, int rocid, int dcol, int dcolstate, bool buffermode=false)=0
const std::string k_DACName_VIbias_PH
const std::string k_DACName_VOffsetRO
const std::string k_DACName_VIbias_bus
std::ostream & operator<<(std::ostream &s, const PixelCalibConfiguration &calib)
const std::string k_DACName_VIColOr
This class provide the data structure for the ROC DAC parameters.
const std::string k_DACName_VOffsetOp
unsigned int portaddress() const
void setVcthrDisable(PixelFECConfigInterface *pixelFEC, PixelNameTranslation *trans) const
PixelROCDACSettings getDACSettings(int ROCId) const
This class is responsible for manipulating the DACsettings of a ROC.
bool rocIsDisabled(const PixelDetectorConfig *detconfig, const PixelROCName rocname) const
This is the documentation about PixelDetectorConfig...
Store mfec, mfecchannel etc.
const std::map< PixelROCName, PixelROCStatus > & getROCsList() const
const PixelHdwAddress * getHdwAddress(const PixelROCName &aROC) const
std::vector< PixelROCDACSettings > dacsettings_
unsigned int mfecchannel() const
void writeBinary(std::string filename) const
const std::string k_DACName_VbiasOp
const std::string k_DACName_VIbias_roc
const std::string k_DACName_Vcal
virtual int qbufsend(void)=0
PixelDACSettings(std::string filename)
This class provide a base class for the pixel ROC dac data for the pixel FEC configuration.
unsigned int rocid() const
const std::string k_DACName_VrgSh
const std::string k_DACName_VIon
const std::string k_DACName_Vcomp
const std::string k_DACName_WBC
void writeASCII(std::string dir) const override
const std::string k_DACName_Vdd
const std::string k_DACName_VHldDel
This is the documentation about PixelNameTranslation...
const std::string k_DACName_VsumCol
void generateConfiguration(PixelFECConfigInterface *pixelFEC, PixelNameTranslation *trans, PixelDetectorConfig *detconfig, bool HVon=true) const
std::string getAuthor() const
A dummy class with ALL public variables.
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 hubaddress() const
const std::string k_DACName_Vana
virtual void setAllDAC(const PixelHdwAddress &theROC, const std::vector< unsigned int > &dacs, const bool buffermode=false)=0
bool get(ROCstatus stat) const
const std::string k_DACName_VwllPr