23 std::string mthn =
"]\t[PixelTBMSettings::PixelTBMSettings()]\t\t\t " ;
24 std::vector< std::string >
ins = tableMat[0];
25 std::map<std::string , int > colM;
26 std::vector<std::string > colNames;
51 colNames.push_back(
"CONFIG_KEY" );
52 colNames.push_back(
"KEY_TYPE" );
53 colNames.push_back(
"KEY_ALIAS" );
54 colNames.push_back(
"VERSION" );
55 colNames.push_back(
"KIND_OF_COND" );
56 colNames.push_back(
"TBM_NAME" );
57 colNames.push_back(
"MODULE_NAME" );
58 colNames.push_back(
"HUB_ADDRS" );
59 colNames.push_back(
"TBM_MODE" );
60 colNames.push_back(
"ANLG_INBIAS_ADDR" );
61 colNames.push_back(
"ANLG_INBIAS_VAL" );
62 colNames.push_back(
"ANLG_OUTBIAS_ADDR");
63 colNames.push_back(
"ANLG_OUTBIAS_VAL" );
64 colNames.push_back(
"ANLG_OUTGAIN_ADDR");
65 colNames.push_back(
"ANLG_OUTGAIN_VAL" );
67 for(
unsigned int c = 0 ;
c < ins.size() ;
c++){
68 for(
unsigned int n=0;
n<colNames.size();
n++){
69 if(tableMat[0][
c] == colNames[
n]){
70 colM[colNames[
n]] =
c;
75 for(
unsigned int n=0;
n<colNames.size();
n++){
76 if(colM.find(colNames[
n]) == colM.end()){
77 std::cerr << __LINE__ << mthn <<
"Couldn't find in the database the column with name " << colNames[
n] << std::endl;
82 if(tableMat.size() >1)
93 if( tableMat[1][colM[
"TBM_MODE"]] ==
"SingleMode"){
107 std::string mthn =
"]\t[PixelTBMSettings::PixelTBMSettings()]\t\t\t " ;
108 if (filename[filename.size()-1]==
't'){
110 std::ifstream
in(filename.c_str());
113 std::cout << __LINE__ << mthn <<
"Could not open:"<<filename<<std::endl;
114 throw std::runtime_error(
"Failed to open file "+filename);
130 assert(tag==
"AnalogInputBias:");
136 assert(tag==
"AnalogOutputBias:");
142 assert(tag==
"AnalogOutputGain:");
148 assert(tag==
"Mode:");
150 assert(tag==
"SingleMode"||tag==
"DualMode");
161 std::ifstream
in(filename.c_str(),std::ios::binary);
164 std::cout << __LINE__ << mthn <<
"Could not open:"<<filename<<std::endl;
168 std::cout << __LINE__ << mthn <<
"Opened:"<<filename<<std::endl;
179 for(
int i=0;
i< nchar;
i++){
208 else if( what ==
"Mode" ) {
singlemode_ = (bool)value; }
211 std::cout << __LINE__ <<
"]\t[PixelTBMSettings::setTBMGenericValue()]\t\tFATAL: invalid key/value pair: " << what <<
"/" << value << std::endl ;
218 std::ofstream
out(filename.c_str(),std::ios::binary);
235 if (dir!=
"") dir+=
"/";
238 std::ofstream
out(filename.c_str());
247 out <<
"SingleMode" << std::endl;
250 out <<
"DualMode" << std::endl;
261 int mfec=theROC.
mfec();
277 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannel, hubaddress, 4, 2, 0x14, 0);
279 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannel, hubaddress, 4, 0, 1, 0);
285 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannel, hubaddress, 4, 1, 0xc0, 0);
288 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannel, hubaddress, 4, 4, 0x0, 0);
291 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannel, hubaddress, 4, 5,
294 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannel, hubaddress, 4, 6,
297 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannel, hubaddress, 4, 7,
302 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannelB, hubaddress, 4, 0, 1, 0);
304 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannelB, hubaddress, 4, 1, 0xc0, 0);
306 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannelB, hubaddress, 4, 2, 0x14, 0);
309 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannelB, hubaddress, 4, 4, 0x3, 0);
312 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannelB, hubaddress, 4, 4, 0x0, 0);
324 s <<
"mode :Singlemode"<<std::endl;
327 s <<
"mode :Dualmode"<<std::endl;
337 std::ofstream *outstream,
338 std::ofstream *out1stream,
339 std::ofstream *out2stream)
const
341 std::string mthn =
"]\t[PixelTBMSettings::writeXMLHeader()]\t\t\t " ;
342 std::stringstream fullPath ;
344 std::cout << __LINE__ << mthn <<
"Writing to: " << fullPath.str() << std::endl ;
346 outstream->open(fullPath.str().c_str()) ;
348 *outstream <<
"<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl ;
349 *outstream <<
"<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl ;
350 *outstream <<
" <HEADER>" << std::endl ;
351 *outstream <<
" <TYPE>" << std::endl ;
352 *outstream <<
" <EXTENSION_TABLE_NAME>PIXEL_TBM_PARAMETERS</EXTENSION_TABLE_NAME>" << std::endl ;
353 *outstream <<
" <NAME>Pixel TBM Parameters</NAME>" << std::endl ;
354 *outstream <<
" </TYPE>" << std::endl ;
355 *outstream <<
" <RUN>" << std::endl ;
356 *outstream <<
" <RUN_TYPE>Pixel TBM Parameters</RUN_TYPE>" << std::endl ;
357 *outstream <<
" <RUN_NUMBER>1</RUN_NUMBER>" << std::endl ;
359 *outstream <<
" <LOCATION>CERN P5</LOCATION>" << std::endl ;
360 *outstream <<
" </RUN>" << std::endl ;
361 *outstream <<
" </HEADER>" << std::endl ;
362 *outstream <<
"" << std::endl ;
363 *outstream <<
" <DATA_SET>" << std::endl ;
364 *outstream <<
" <PART>" << std::endl ;
365 *outstream <<
" <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl ;
366 *outstream <<
" <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl ;
367 *outstream <<
" </PART>" << std::endl ;
368 *outstream <<
" <VERSION>" << version <<
"</VERSION>" << std::endl ;
369 *outstream <<
" <COMMENT_DESCRIPTION>" <<
getComment() <<
"</COMMENT_DESCRIPTION>" << std::endl ;
370 *outstream <<
" <CREATED_BY_USER>" <<
getAuthor() <<
"</CREATED_BY_USER>" << std::endl ;
371 *outstream <<
" " << std::endl ;
376 std::ofstream *out1stream,
377 std::ofstream *out2stream)
const
379 std::string mthn =
"]\t[PixelTBMSettings::writeXML()]\t\t\t " ;
383 *outstream <<
" <DATA>" << std::endl ;
384 *outstream <<
" <MODULE_NAME>" <<
rocid_.
rocname() <<
"</MODULE_NAME>" << std::endl ;
385 *outstream <<
" <ANLG_INBIAS_VAL>" <<(int)
analogInputBias_ <<
"</ANLG_INBIAS_VAL>" << std::endl ;
386 *outstream <<
" <ANLG_OUTBIAS_VAL>" <<(int)
analogOutputBias_ <<
"</ANLG_OUTBIAS_VAL>" << std::endl ;
387 *outstream <<
" <ANLG_OUTGAIN_VAL>" <<(int)
analogOutputGain_ <<
"</ANLG_OUTGAIN_VAL>" << std::endl ;
389 *outstream <<
" <TBM_MODE>SingleMode</TBM_MODE>" << std::endl ;
392 *outstream <<
" <TBM_MODE>DualMode</TBM_MODE>" << std::endl ;
394 *outstream <<
" </DATA>" << std::endl ;
399 std::ofstream *out1stream,
400 std::ofstream *out2stream)
const
402 std::string mthn =
"]\t[PixelTBMSettings::writeXMLTrailer()]\t\t\t " ;
404 *outstream <<
" " << std::endl ;
405 *outstream <<
" </DATA_SET>" << std::endl ;
406 *outstream <<
"</ROOT> " << std::endl ;
unsigned int mfec() const
virtual int tbmcmd(int mfec, int fecchannel, int tbmchannel, int hubaddress, int portaddress, int offset, int databyte, int direction)=0
const PixelHdwAddress * getHdwAddress(const PixelROCName &aROC) const
void writeASCII(std::string dir) const
This file contains the base class for "pixel configuration data" management.
unsigned char analogOutputBias_
void generateConfiguration(PixelFECConfigInterface *pixelFEC, PixelNameTranslation *trans, bool physics=false) const
virtual int enablecallatency(const int mfec, const int bitstate)=0
unsigned char analogOutputGain_
void writeXML(pos::PixelConfigKey key, int version, std::string path) const
std::string rocname() const
std::ostream & operator<<(std::ostream &s, const PixelCalibConfiguration &calib)
virtual int injecttrigger(const int mfec, const int bitstate)=0
unsigned int mfecchannel() const
virtual void writeXMLTrailer(std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
void setTBMGenericValue(std::string, int)
virtual int disableexttrigger(const int mfec, const int bitstate)=0
std::string getComment() const
unsigned int hubaddress() const
void writeBinary(std::string filename) const
Store mfec, mfecchannel etc.
virtual int injectrstroc(const int mfec, const int bitstate)=0
std::string getAuthor() const
unsigned char analogInputBias_
This is the documentation about PixelNameTranslation...
std::vector< std::vector< double > > tmp
virtual int callatencycount(const int mfec, const int latency)=0
virtual void writeXMLHeader(pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
virtual int injectrsttbm(const int mfec, const int bitstate)=0
This is the documentation about PixelTBMSettings...