21 std::map<std::string , int > colM;
22 std::vector<std::string > colNames;
42 colNames.push_back(
"CONFIG_KEY" );
43 colNames.push_back(
"KEY_TYPE" );
44 colNames.push_back(
"KEY_ALIAS" );
45 colNames.push_back(
"VERSION" );
46 colNames.push_back(
"KIND_OF_COND");
47 colNames.push_back(
"TRKFEC_NAME" );
48 colNames.push_back(
"CRATE_LABEL" );
49 colNames.push_back(
"CRATE_NUMBER");
50 colNames.push_back(
"TYPE" );
51 colNames.push_back(
"SLOT_NUMBER" );
52 colNames.push_back(
"VME_ADDR" );
53 colNames.push_back(
"I2CSPEED" );
55 for(
unsigned int c = 0 ;
c < tableMat[0].size() ;
c++)
57 for(
unsigned int n=0;
n<colNames.size();
n++)
59 if(tableMat[0][
c] == colNames[
n])
61 colM[colNames[
n]] =
c;
77 for(
unsigned int r = 1 ;
r < tableMat.size() ;
r++)
80 unsigned int crate = atoi(tableMat[
r][colM[
"CRATE_NUMBER"]].c_str()) ;
82 unsigned int address = strtoul(tableMat[
r][colM[
"VME_ADDR"]].c_str() , 0, 16);
96 std::string mthn =
"]\t[PixelTKFECConfig::PixelTKFECConfig()]\t\t\t " ;
97 std::ifstream
in(filename.c_str());
100 std::cout << __LINE__ << mthn <<
"Could not open: " << filename << std::endl;
101 throw std::runtime_error(
"Failed to open file "+filename);
104 std::cout << __LINE__ << mthn <<
"Opened: " << filename << std::endl;
116 unsigned int address;
118 in >> TKFECID >> std::dec >> crate >>
type;
119 if (type==
"VME" || type==
"PCI")
121 in >> std::hex>> address >>std::dec ;
125 address = strtoul(type.c_str(), 0, 16);
150 if (dir!=
"") dir+=
"/";
151 string filename=dir+
"tkfecconfig.dat";
153 ofstream
out(filename.c_str());
155 cout <<
"Could not open file:"<<filename<<endl;
159 out <<
"#TKFEC ID crate VME/PCI slot/address" <<endl;
226 std::cout <<
"Could not find TKFEC ID:"<<TKFECID<<std::endl;
240 std::cout <<
"Could not find TKFEC ID:"<<TKFECID<<std::endl;
254 std::cout <<
"Could not find TKFEC ID:"<<TKFECID<<std::endl;
266 std::ofstream *outstream,
267 std::ofstream *out1stream,
268 std::ofstream *out2stream)
const
270 std::string mthn =
"[PixelTKFECConfig::writeXMLHeader()]\t\t\t " ;
271 std::stringstream maskFullPath ;
274 std::cout << mthn <<
"Writing to: " << maskFullPath.str() << std::endl ;
276 outstream->open(maskFullPath.str().c_str()) ;
278 *outstream <<
"<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl ;
279 *outstream <<
"<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl ;
280 *outstream <<
"" << std::endl ;
281 *outstream <<
" <HEADER>" << std::endl ;
282 *outstream <<
" <TYPE>" << std::endl ;
283 *outstream <<
" <EXTENSION_TABLE_NAME>TRACKER_FEC_PARAMETERS</EXTENSION_TABLE_NAME>" << std::endl ;
284 *outstream <<
" <NAME>Tracker FEC Parameters</NAME>" << std::endl ;
285 *outstream <<
" </TYPE>" << std::endl ;
286 *outstream <<
" <RUN>" << std::endl ;
287 *outstream <<
" <RUN_TYPE>Tracker FEC Parameters</RUN_TYPE>" << std::endl ;
288 *outstream <<
" <RUN_NUMBER>1</RUN_NUMBER>" << std::endl ;
290 *outstream <<
" <LOCATION>CERN P5</LOCATION>" << std::endl ;
291 *outstream <<
" </RUN>" << std::endl ;
292 *outstream <<
" </HEADER>" << std::endl ;
293 *outstream <<
"" << std::endl ;
294 *outstream <<
" <DATA_SET>" << std::endl ;
295 *outstream <<
"" << std::endl ;
296 *outstream <<
" <VERSION>" << version <<
"</VERSION>" << std::endl ;
297 *outstream <<
" <COMMENT_DESCRIPTION>" <<
getComment() <<
"</COMMENT_DESCRIPTION>" << std::endl ;
298 *outstream <<
" <CREATED_BY_USER>" <<
getAuthor() <<
"</CREATED_BY_USER>" << std::endl ;
299 *outstream <<
"" << std::endl ;
300 *outstream <<
" <PART>" << std::endl ;
301 *outstream <<
" <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl ;
302 *outstream <<
" <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl ;
303 *outstream <<
" </PART>" << std::endl ;
309 std::ofstream *out1stream,
310 std::ofstream *out2stream)
const
312 std::string mthn =
"[PixelTKFECConfig::writeXML()]\t\t\t " ;
315 *outstream <<
" <DATA>" << std::endl ;
316 *outstream <<
" <TRKFEC_NAME>" <<
TKFECconfig_[
i].getTKFECID() <<
"</TRKFEC_NAME>" << std::endl ;
317 *outstream <<
" <CRATE_NUMBER>" <<
TKFECconfig_[
i].getCrate() <<
"</CRATE_NUMBER>"<< std::endl ;
318 *outstream <<
" <VME_ADDR>" <<
"0x" << hex <<
TKFECconfig_[
i].getAddress() << dec <<
"</VME_ADDR>" << std::endl ;
319 *outstream <<
" </DATA>" << std::endl ;
325 std::ofstream *out1stream,
326 std::ofstream *out2stream )
const
328 std::string mthn =
"[PixelTKFECConfig::writeXMLTrailer()]\t\t\t " ;
330 *outstream <<
" </DATA_SET>" << std::endl ;
331 *outstream <<
"</ROOT>" << std::endl ;
334 std::cout << mthn <<
"Data written " << std::endl ;
This class specifies which TKFEC boards are used and how they are addressed.
This file contains the base class for "pixel configuration data" management.
unsigned int crateFromTKFECID(std::string TKFECID) const
unsigned int getCrate(unsigned int i) const
void setTKFECParameters(std::string TKFECID, unsigned int crate, std::string type, unsigned int address)
std::string typeFromTKFECID(std::string TKFECID) const
unsigned int getNTKFECBoards() const
PixelTKFECConfig(std::string filename)
virtual ~PixelTKFECConfig()
std::string getComment() const
std::string getTKFECID(unsigned int i) const
virtual void writeXML(pos::PixelConfigKey key, int version, std::string path) const
std::string getAuthor() const
unsigned int addressFromTKFECID(std::string TKFECID) const
virtual void writeXMLTrailer(std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
std::vector< PixelTKFECParameters > TKFECconfig_
std::vector< std::vector< double > > tmp
std::string getType(unsigned int i) const
virtual void writeXMLHeader(pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
unsigned int getAddress(unsigned int i) const
virtual void writeASCII(std::string dir) const