29 std::string mthn =
"[PixelDACSettings::PixelDACSettings()]\t\t\t " ;
31 if (filename[filename.size()-1]==
't'){
33 std::ifstream
in(filename.c_str());
36 std::cout << __LINE__ <<
"]\t" << mthn <<
"Could not open: " << filename << std::endl;
38 throw std::runtime_error(
"Failed to open file "+filename);
76 std::ifstream
in(filename.c_str(),std::ios::binary);
79 std::cout << __LINE__ <<
"]\t" << mthn <<
"Could not open: " << filename << std::endl;
83 std::cout << __LINE__ <<
"]\t" << mthn <<
"Opened: " << filename << std::endl;
93 for(
int i=0;
i< nchar;
i++){
123 if (
in.eof())
continue;
126 for(
int i=0;
i< nchar;
i++){
202 std::vector< std::string >
ins = tableMat[0];
203 std::string mthn(
"[PixelDACSettings::PixelDACSettings()] ") ;
205 std::istringstream dbin ;
207 int skipColumns = 0 ;
208 std::map<std::string , int > colM;
209 std::vector<std::string > colNames;
210 std::map<std::string, std::string> nameTranslation ;
212 colNames.push_back(
"CONFIG_KEY" );
213 colNames.push_back(
"KEY_TYPE" );
214 colNames.push_back(
"KEY_ALIAS" );
215 colNames.push_back(
"VERSION" );
216 colNames.push_back(
"KIND_OF_COND");
217 colNames.push_back(
"ROC_NAME" );
218 colNames.push_back(
"VDD" );
219 colNames.push_back(
"VANA" );
220 colNames.push_back(
"VSF" );
221 colNames.push_back(
"VCOMP" );
222 colNames.push_back(
"VLEAK" );
223 colNames.push_back(
"VRGPR" );
224 colNames.push_back(
"VWLLPR" );
225 colNames.push_back(
"VRGSH" );
226 colNames.push_back(
"VWLLSH" );
227 colNames.push_back(
"VHLDDEL" );
228 colNames.push_back(
"VTRIM" );
229 colNames.push_back(
"VCTHR" );
230 colNames.push_back(
"VIBIAS_BUS" );
231 colNames.push_back(
"VIBIAS_SF" );
232 colNames.push_back(
"VOFFSETOP" );
233 colNames.push_back(
"VBIASOP" );
234 colNames.push_back(
"VOFFSETRO" );
235 colNames.push_back(
"VION" );
236 colNames.push_back(
"VIBIAS_PH" );
237 colNames.push_back(
"VIBIAS_DAC" );
238 colNames.push_back(
"VIBIAS_ROC" );
239 colNames.push_back(
"VICOLOR" );
240 colNames.push_back(
"VNPIX" );
241 colNames.push_back(
"VSUMCOL" );
242 colNames.push_back(
"VCAL" );
243 colNames.push_back(
"CALDEL" );
244 colNames.push_back(
"TEMPRANGE" );
245 colNames.push_back(
"WBC" );
246 colNames.push_back(
"CHIPCONTREG" );
280 for(
unsigned int c = skipColumns ;
c < ins.size() ;
c++){
281 for(
unsigned int n=0;
n<colNames.size();
n++){
282 if(tableMat[0][
c] == colNames[
n]){
283 colM[colNames[
n]] =
c;
288 for(
unsigned int n=skipColumns;
n<colNames.size();
n++){
289 if(colM.find(colNames[
n]) == colM.end()){
290 std::cerr <<
"[PixelDACSettings::PixelDACSettings()]\tCouldn't find in the database the column with name " << colNames[
n] << std::endl;
300 for(
unsigned int r = 1 ;
r < tableMat.size() ;
r++){
312 std::ostringstream dacs(
"") ;
314 for(
unsigned int n=skipColumns+6;
n<colNames.size();
n++)
316 dacs << nameTranslation[colNames[
n]] <<
": "<< atoi(tableMat[
r][colM[colNames[
n]]].c_str()) << std::endl ;
324 dbin.str(dacs.str()) ;
325 tmp.
read(dbin, rocid) ;
383 std::ofstream
out(filename.c_str(),std::ios::binary);
394 std::string mthn =
"[PixelDACSettings::writeASCII()]\t\t\t " ;
398 std::cout << __LINE__ <<
"]\t" << mthn <<
"Writing to file " << filename << std::endl ;
399 std::ofstream
out(filename.c_str());
411 std::ofstream *outstream,
412 std::ofstream *out1stream,
413 std::ofstream *out2stream)
const {
414 std::string mthn =
"[PixelDACSettings::writeXMLHeader()]\t\t\t " ;
418 std::cout << __LINE__ <<
"]\t" << mthn <<
"Writing to: " << fullPath.str() << std::endl ;
420 outstream->open(fullPath.str().c_str()) ;
422 *outstream <<
"<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl ;
423 *outstream <<
"<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl ;
424 *outstream <<
"" << std::endl ;
425 *outstream <<
" <!-- " << mthn <<
"-->" << std::endl ;
426 *outstream <<
"" << std::endl ;
427 *outstream <<
" <HEADER>" << std::endl ;
428 *outstream <<
" <TYPE>" << std::endl ;
429 *outstream <<
" <EXTENSION_TABLE_NAME>ROC_DAC_SETTINGS_COL</EXTENSION_TABLE_NAME>" << std::endl ;
430 *outstream <<
" <NAME>ROC DAC Settings Col</NAME>" << std::endl ;
431 *outstream <<
" </TYPE>" << std::endl ;
432 *outstream <<
" <RUN>" << std::endl ;
433 *outstream <<
" <RUN_TYPE>ROC DAC Settings</RUN_TYPE>" << std::endl ;
434 *outstream <<
" <RUN_NUMBER>1</RUN_NUMBER>" << std::endl ;
436 *outstream <<
" <LOCATION>CERN P5</LOCATION>" << std::endl ;
437 *outstream <<
" </RUN>" << std::endl ;
438 *outstream <<
" </HEADER>" << std::endl ;
439 *outstream <<
"" << std::endl ;
440 *outstream <<
" <DATA_SET>" << std::endl ;
441 *outstream <<
" <VERSION>" << version <<
"</VERSION>" << std::endl ;
442 *outstream <<
" <COMMENT_DESCRIPTION>" <<
getComment() <<
"</COMMENT_DESCRIPTION>" << std::endl ;
443 *outstream <<
" <CREATED_BY_USER>" <<
getAuthor() <<
"</CREATED_BY_USER>" << std::endl ;
444 *outstream <<
" " << std::endl ;
445 *outstream <<
" <PART>" << std::endl ;
446 *outstream <<
" <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl ;
447 *outstream <<
" <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl ;
448 *outstream <<
" </PART>" << std::endl ;
449 *outstream <<
" " << std::endl ;
451 std::cout << __LINE__ <<
"]\t" << mthn <<
"Header written" << std::endl ;
456 std::ofstream *out1stream,
457 std::ofstream *out2stream)
const {
458 std::string mthn =
"[PixelDACSettings::writeXML()]\t\t\t " ;
467 std::ofstream *out1stream,
468 std::ofstream *out2stream)
const {
469 std::string mthn =
"[PixelDACSettings::writeXMLTrailer()]\t\t\t " ;
471 *outstream <<
" </DATA_SET>" << std::endl ;
472 *outstream <<
"</ROOT>" << std::endl ;
475 std::cout << __LINE__ <<
"]\t" << mthn <<
"Data written" << std::endl ;
534 bool bufferData=
true;
536 std::vector<unsigned int> dacs;
563 if (!HVon || disableRoc) dacs[11]=0;
565 pixelFEC->
setAllDAC(theROC,dacs,bufferData);
576 for(
int dcol=0;dcol<26;dcol++){
587 if (!HVon || disableRoc) {
612 bool bufferData=
true;
614 std::vector<unsigned int> dacs;
654 bool bufferData=
true;
656 std::vector<unsigned int> dacs;
702 const std::map<PixelROCName, PixelROCStatus> & roclist=detconfig->
getROCsList();
703 const std::map<PixelROCName, PixelROCStatus>::const_iterator iroc = roclist.find(rocname);
704 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
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
std::ostream & operator<<(std::ostream &s, const PixelCalibConfiguration &calib)
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.
tuple path
else: Piece not in the list, fine.
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
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