27 const bool readTemperatures =
false;
30 const int temperatureReg = 0x1;
36 std::string mthn =
"[PixelDACSettings::PixelDACSettings()]\t\t\t " ;
38 if (filename[filename.size()-1]==
't'){
40 std::ifstream
in(filename.c_str());
43 std::cout << __LINE__ <<
"]\t" << mthn <<
"Could not open: " << filename << std::endl;
45 throw std::runtime_error(
"Failed to open file "+filename);
83 std::ifstream
in(filename.c_str(),std::ios::binary);
86 std::cout << __LINE__ <<
"]\t" << mthn <<
"Could not open: " << filename << std::endl;
90 std::cout << __LINE__ <<
"]\t" << mthn <<
"Opened: " << filename << std::endl;
100 for(
int i=0;
i< nchar;
i++){
130 if (
in.eof())
continue;
133 for(
int i=0;
i< nchar;
i++){
214 std::vector< std::string >
ins = tableMat[0];
215 std::string mthn(
"[PixelDACSettings::PixelDACSettings()] ") ;
217 std::istringstream dbin ;
219 int skipColumns = 0 ;
220 std::map<std::string , int > colM;
221 std::vector<std::string > colNames;
222 std::map<std::string, std::string> nameTranslation ;
224 colNames.push_back(
"CONFIG_KEY" );
225 colNames.push_back(
"KEY_TYPE" );
226 colNames.push_back(
"KEY_ALIAS" );
227 colNames.push_back(
"VERSION" );
228 colNames.push_back(
"KIND_OF_COND");
229 colNames.push_back(
"ROC_NAME" );
230 colNames.push_back(
"VDD" );
231 colNames.push_back(
"VANA" );
232 colNames.push_back(
"VSF" );
233 colNames.push_back(
"VCOMP" );
234 colNames.push_back(
"VLEAK" );
235 colNames.push_back(
"VRGPR" );
236 colNames.push_back(
"VWLLPR" );
237 colNames.push_back(
"VRGSH" );
238 colNames.push_back(
"VWLLSH" );
239 colNames.push_back(
"VHLDDEL" );
240 colNames.push_back(
"VTRIM" );
241 colNames.push_back(
"VCTHR" );
242 colNames.push_back(
"VIBIAS_BUS" );
243 colNames.push_back(
"VIBIAS_SF" );
244 colNames.push_back(
"VOFFSETOP" );
245 colNames.push_back(
"VBIASOP" );
246 colNames.push_back(
"VOFFSETRO" );
247 colNames.push_back(
"VION" );
248 colNames.push_back(
"VIBIAS_PH" );
249 colNames.push_back(
"VIBIAS_DAC" );
250 colNames.push_back(
"VIBIAS_ROC" );
251 colNames.push_back(
"VICOLOR" );
252 colNames.push_back(
"VNPIX" );
253 colNames.push_back(
"VSUMCOL" );
254 colNames.push_back(
"VCAL" );
255 colNames.push_back(
"CALDEL" );
256 colNames.push_back(
"TEMPRANGE" );
257 colNames.push_back(
"WBC" );
258 colNames.push_back(
"CHIPCONTREG" );
292 for(
unsigned int c = skipColumns ;
c < ins.size() ;
c++){
293 for(
unsigned int n=0;
n<colNames.size();
n++){
294 if(tableMat[0][
c] == colNames[
n]){
295 colM[colNames[
n]] =
c;
300 for(
unsigned int n=skipColumns;
n<colNames.size();
n++){
301 if(colM.find(colNames[
n]) == colM.end()){
302 std::cerr <<
"[PixelDACSettings::PixelDACSettings()]\tCouldn't find in the database the column with name " << colNames[
n] << std::endl;
312 for(
unsigned int r = 1 ;
r < tableMat.size() ;
r++){
324 std::ostringstream dacs(
"") ;
326 for(
unsigned int n=skipColumns+6;
n<colNames.size();
n++)
328 dacs << nameTranslation[colNames[
n]] <<
": "<< atoi(tableMat[
r][colM[colNames[
n]]].c_str()) << std::endl ;
336 dbin.str(dacs.str()) ;
337 tmp.
read(dbin, rocid) ;
396 std::ofstream
out(filename.c_str(),std::ios::binary);
407 std::string mthn =
"[PixelDACSettings::writeASCII()]\t\t\t " ;
411 std::cout << __LINE__ <<
"]\t" << mthn <<
"Writing to file " << filename << std::endl ;
412 std::ofstream
out(filename.c_str());
424 std::ofstream *outstream,
425 std::ofstream *out1stream,
426 std::ofstream *out2stream)
const {
427 std::string mthn =
"[PixelDACSettings::writeXMLHeader()]\t\t\t " ;
428 std::stringstream fullPath ;
431 std::cout << __LINE__ <<
"]\t" << mthn <<
"Writing to: " << fullPath.str() << std::endl ;
433 outstream->open(fullPath.str().c_str()) ;
435 *outstream <<
"<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl ;
436 *outstream <<
"<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl ;
437 *outstream <<
"" << std::endl ;
438 *outstream <<
" <!-- " << mthn <<
"-->" << std::endl ;
439 *outstream <<
"" << std::endl ;
440 *outstream <<
" <HEADER>" << std::endl ;
441 *outstream <<
" <TYPE>" << std::endl ;
442 *outstream <<
" <EXTENSION_TABLE_NAME>ROC_DAC_SETTINGS_COL</EXTENSION_TABLE_NAME>" << std::endl ;
443 *outstream <<
" <NAME>ROC DAC Settings Col</NAME>" << std::endl ;
444 *outstream <<
" </TYPE>" << std::endl ;
445 *outstream <<
" <RUN>" << std::endl ;
446 *outstream <<
" <RUN_TYPE>ROC DAC Settings</RUN_TYPE>" << std::endl ;
447 *outstream <<
" <RUN_NUMBER>1</RUN_NUMBER>" << std::endl ;
449 *outstream <<
" <LOCATION>CERN P5</LOCATION>" << std::endl ;
450 *outstream <<
" </RUN>" << std::endl ;
451 *outstream <<
" </HEADER>" << std::endl ;
452 *outstream <<
"" << std::endl ;
453 *outstream <<
" <DATA_SET>" << std::endl ;
454 *outstream <<
" <VERSION>" << version <<
"</VERSION>" << std::endl ;
455 *outstream <<
" <COMMENT_DESCRIPTION>" <<
getComment() <<
"</COMMENT_DESCRIPTION>" << std::endl ;
456 *outstream <<
" <CREATED_BY_USER>" <<
getAuthor() <<
"</CREATED_BY_USER>" << std::endl ;
457 *outstream <<
" " << std::endl ;
458 *outstream <<
" <PART>" << std::endl ;
459 *outstream <<
" <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl ;
460 *outstream <<
" <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl ;
461 *outstream <<
" </PART>" << std::endl ;
462 *outstream <<
" " << std::endl ;
464 std::cout << __LINE__ <<
"]\t" << mthn <<
"Header written" << std::endl ;
469 std::ofstream *out1stream,
470 std::ofstream *out2stream)
const {
471 std::string mthn =
"[PixelDACSettings::writeXML()]\t\t\t " ;
480 std::ofstream *out1stream,
481 std::ofstream *out2stream)
const {
482 std::string mthn =
"[PixelDACSettings::writeXMLTrailer()]\t\t\t " ;
484 *outstream <<
" </DATA_SET>" << std::endl ;
485 *outstream <<
"</ROOT>" << std::endl ;
488 std::cout << __LINE__ <<
"]\t" << mthn <<
"Data written" << std::endl ;
547 bool bufferData=
true;
549 std::vector<unsigned int> dacs;
575 if (!HVon || disableRoc) dacs[11]=0;
577 pixelFEC->
setAllDAC(theROC,dacs,bufferData);
587 const bool kmeKLUDGE=
false;
606 for(
int dcol=0;dcol<26;dcol++){
617 if (!HVon || disableRoc) {
633 if(readTemperatures) {
639 << dacs[28] <<
" LastDAC=Temp "<<temperatureReg<<std::endl;
647 temperatureReg,bufferData);
654 <<
" ROC control reg to be set to: " << dacs[28] <<
" LastDAC=Vcal"<<std::endl;
680 bool bufferData=
true;
682 std::vector<unsigned int> dacs;
713 if(readTemperatures) {
746 bool bufferData=
true;
748 std::vector<unsigned int> dacs;
787 if(readTemperatures) {
822 const std::map<PixelROCName, PixelROCStatus> & roclist=detconfig->
getROCsList();
823 const std::map<PixelROCName, PixelROCStatus>::const_iterator iroc = roclist.find(rocname);
824 assert(iroc != roclist.end());
unsigned int mfec() const
const std::string k_DACName_VcThr
const std::string k_DACName_VrgPr
const PixelHdwAddress * getHdwAddress(const PixelROCName &aROC) const
PixelROCDACSettings getDACSettings(int ROCId) const
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
bool rocIsDisabled(const PixelDetectorConfig *detconfig, const PixelROCName rocname) const
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
const std::string k_DACName_VIbias_sf
const std::string k_DACName_Vtrim
unsigned int portaddress() 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
unsigned int rocid() const
bool get(ROCstatus stat) const
const std::string k_DACName_VIbias_bus
int read(std::ifstream &in, const PixelROCName &rocid)
unsigned int mfecchannel() const
const std::string k_DACName_VIColOr
This class provide the data structure for the ROC DAC parameters.
const std::string k_DACName_VOffsetOp
void writeBinary(std::string filename) const
This class is responsible for manipulating the DACsettings of a ROC.
void writeASCII(std::string dir) const
std::string getComment() const
unsigned int hubaddress() const
This is the documentation about PixelDetectorConfig...
virtual void writeXMLHeader(pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
Store mfec, mfecchannel etc.
std::vector< PixelROCDACSettings > dacsettings_
std::string getAuthor() const
friend std::ostream & operator<<(std::ostream &s, const PixelDACSettings &mask)
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.
const std::string k_DACName_VrgSh
const std::string k_DACName_VIon
void writeXML(pos::PixelConfigKey key, int version, std::string path) const
const std::string k_DACName_Vcomp
std::string modulename() const
const std::string k_DACName_WBC
const std::string k_DACName_Vdd
const std::string k_DACName_VHldDel
This is the documentation about PixelNameTranslation...
const std::string k_DACName_VsumCol
std::vector< std::vector< double > > tmp
int readBinary(std::ifstream &in, const PixelROCName &rocid)
void generateConfiguration(PixelFECConfigInterface *pixelFEC, PixelNameTranslation *trans, PixelDetectorConfig *detconfig, bool HVon=true) const
A dummy class with ALL public variables.
void setVcthrDisable(PixelFECConfigInterface *pixelFEC, PixelNameTranslation *trans) const
const std::map< PixelROCName, PixelROCStatus > & getROCsList() const
const std::string k_DACName_Vana
virtual void setAllDAC(const PixelHdwAddress &theROC, const std::vector< unsigned int > &dacs, const bool buffermode=false)=0
void setVcthrEnable(PixelFECConfigInterface *pixelFEC, PixelNameTranslation *trans, PixelDetectorConfig *detconfig) const
virtual void writeXMLTrailer(std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
const std::string k_DACName_VwllPr