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++){
206 else if( what ==
"analogOutputBias" ) {
analogOutputBias_ = (
unsigned char)value;}
207 else if( what ==
"analogOutputGain" ) {
analogOutputGain_ = (
unsigned char)value;}
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;
256 bool physics,
bool doResets)
const{
261 int mfec=theROC.
mfec();
279 if (doResets) pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannel, hubaddress, 4, 2, 0x14, 0);
281 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannel, hubaddress, 4, 0, 1, 0);
287 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannel, hubaddress, 4, 1, 0xc0, 0);
290 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannel, hubaddress, 4, 4, 0x0, 0);
293 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannel, hubaddress, 4, 5,
296 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannel, hubaddress, 4, 6,
299 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannel, hubaddress, 4, 7,
304 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannelB, hubaddress, 4, 0, 1, 0);
306 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannelB, hubaddress, 4, 1, 0xc0, 0);
308 if (doResets) pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannelB, hubaddress, 4, 2, 0x14, 0);
311 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannelB, hubaddress, 4, 4, 0x3, 0);
314 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannelB, hubaddress, 4, 4, 0x0, 0);
326 s <<
"mode :Singlemode"<<std::endl;
329 s <<
"mode :Dualmode"<<std::endl;
339 std::ofstream *outstream,
340 std::ofstream *out1stream,
341 std::ofstream *out2stream)
const 343 std::string mthn =
"]\t[PixelTBMSettings::writeXMLHeader()]\t\t\t " ;
344 std::stringstream fullPath ;
346 std::cout << __LINE__ << mthn <<
"Writing to: " << fullPath.str() << std::endl ;
348 outstream->open(fullPath.str().c_str()) ;
350 *outstream <<
"<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl ;
351 *outstream <<
"<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl ;
352 *outstream <<
" <HEADER>" << std::endl ;
353 *outstream <<
" <TYPE>" << std::endl ;
354 *outstream <<
" <EXTENSION_TABLE_NAME>PIXEL_TBM_PARAMETERS</EXTENSION_TABLE_NAME>" << std::endl ;
355 *outstream <<
" <NAME>Pixel TBM Parameters</NAME>" << std::endl ;
356 *outstream <<
" </TYPE>" << std::endl ;
357 *outstream <<
" <RUN>" << std::endl ;
358 *outstream <<
" <RUN_TYPE>Pixel TBM Parameters</RUN_TYPE>" << std::endl ;
359 *outstream <<
" <RUN_NUMBER>1</RUN_NUMBER>" << std::endl ;
361 *outstream <<
" <LOCATION>CERN P5</LOCATION>" << std::endl ;
362 *outstream <<
" </RUN>" << std::endl ;
363 *outstream <<
" </HEADER>" << std::endl ;
364 *outstream <<
"" << std::endl ;
365 *outstream <<
" <DATA_SET>" << std::endl ;
366 *outstream <<
" <PART>" << std::endl ;
367 *outstream <<
" <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl ;
368 *outstream <<
" <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl ;
369 *outstream <<
" </PART>" << std::endl ;
370 *outstream <<
" <VERSION>" << version <<
"</VERSION>" << std::endl ;
371 *outstream <<
" <COMMENT_DESCRIPTION>" <<
getComment() <<
"</COMMENT_DESCRIPTION>" << std::endl ;
372 *outstream <<
" <CREATED_BY_USER>" <<
getAuthor() <<
"</CREATED_BY_USER>" << std::endl ;
373 *outstream <<
" " << std::endl ;
378 std::ofstream *out1stream,
379 std::ofstream *out2stream)
const 381 std::string mthn =
"]\t[PixelTBMSettings::writeXML()]\t\t\t " ;
385 *outstream <<
" <DATA>" << std::endl ;
386 *outstream <<
" <MODULE_NAME>" <<
rocid_.
rocname() <<
"</MODULE_NAME>" << std::endl ;
387 *outstream <<
" <ANLG_INBIAS_VAL>" <<(
int)
analogInputBias_ <<
"</ANLG_INBIAS_VAL>" << std::endl ;
388 *outstream <<
" <ANLG_OUTBIAS_VAL>" <<(
int)
analogOutputBias_ <<
"</ANLG_OUTBIAS_VAL>" << std::endl ;
389 *outstream <<
" <ANLG_OUTGAIN_VAL>" <<(
int)
analogOutputGain_ <<
"</ANLG_OUTGAIN_VAL>" << std::endl ;
391 *outstream <<
" <TBM_MODE>SingleMode</TBM_MODE>" << std::endl ;
394 *outstream <<
" <TBM_MODE>DualMode</TBM_MODE>" << std::endl ;
396 *outstream <<
" </DATA>" << std::endl ;
401 std::ofstream *out1stream,
402 std::ofstream *out2stream)
const 404 std::string mthn =
"]\t[PixelTBMSettings::writeXMLTrailer()]\t\t\t " ;
406 *outstream <<
" " << std::endl ;
407 *outstream <<
" </DATA_SET>" << std::endl ;
408 *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 getAnalogInputBias() const
unsigned char analogOutputBias_
virtual int enablecallatency(const int mfec, const int bitstate)=0
unsigned char getAnalogOutputBias() const
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
unsigned char getAnalogOutputGain() const
PixelROCName const & getROCName() const
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
void generateConfiguration(PixelFECConfigInterface *pixelFEC, PixelNameTranslation *trans, bool physics=false, bool doResets=true) const
virtual int injectrsttbm(const int mfec, const int bitstate)=0
This is the documentation about PixelTBMSettings...