19 std::map<std::string, int> colM;
20 std::vector<std::string> colNames;
40 colNames.push_back(
"CONFIG_KEY");
41 colNames.push_back(
"KEY_TYPE");
42 colNames.push_back(
"KEY_ALIAS");
43 colNames.push_back(
"VERSION");
44 colNames.push_back(
"KIND_OF_COND");
45 colNames.push_back(
"TRKFEC_NAME");
46 colNames.push_back(
"CRATE_LABEL");
47 colNames.push_back(
"CRATE_NUMBER");
48 colNames.push_back(
"TYPE");
49 colNames.push_back(
"SLOT_NUMBER");
50 colNames.push_back(
"VME_ADDR");
51 colNames.push_back(
"I2CSPEED");
53 for (
unsigned int c = 0;
c < tableMat[0].size();
c++) {
54 for (
unsigned int n = 0;
n < colNames.size();
n++) {
55 if (tableMat[0][
c] == colNames[
n]) {
56 colM[colNames[
n]] =
c;
72 for (
unsigned int r = 1; r < tableMat.size(); r++)
74 std::string TKFECID = tableMat[r][colM[
"TRKFEC_NAME"]];
75 unsigned int crate = atoi(tableMat[r][colM[
"CRATE_NUMBER"]].c_str());
77 unsigned int address = strtoul(tableMat[r][colM[
"VME_ADDR"]].c_str(),
nullptr, 16);
88 std::string mthn =
"]\t[PixelTKFECConfig::PixelTKFECConfig()]\t\t\t ";
93 throw std::runtime_error(
"Failed to open file " +
filename);
106 unsigned int address;
109 if (
type ==
"VME" ||
type ==
"PCI") {
113 address = strtoul(
type.c_str(),
nullptr, 16);
145 out <<
"#TKFEC ID crate VME/PCI slot/address" << endl;
195 std::cout <<
"Could not find TKFEC ID:" << TKFECID << std::endl;
208 std::cout <<
"Could not find TKFEC ID:" << TKFECID << std::endl;
221 std::cout <<
"Could not find TKFEC ID:" << TKFECID << std::endl;
232 std::ofstream *outstream,
233 std::ofstream *out1stream,
234 std::ofstream *out2stream)
const {
235 std::string mthn =
"[PixelTKFECConfig::writeXMLHeader()]\t\t\t ";
236 std::stringstream maskFullPath;
239 std::cout << mthn <<
"Writing to: " << maskFullPath.str() << std::endl;
241 outstream->open(maskFullPath.str().c_str());
243 *outstream <<
"<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl;
244 *outstream <<
"<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl;
245 *outstream <<
"" << std::endl;
246 *outstream <<
" <HEADER>" << std::endl;
247 *outstream <<
" <TYPE>" << std::endl;
248 *outstream <<
" <EXTENSION_TABLE_NAME>TRACKER_FEC_PARAMETERS</EXTENSION_TABLE_NAME>" << std::endl;
249 *outstream <<
" <NAME>Tracker FEC Parameters</NAME>" << std::endl;
250 *outstream <<
" </TYPE>" << std::endl;
251 *outstream <<
" <RUN>" << std::endl;
252 *outstream <<
" <RUN_TYPE>Tracker FEC Parameters</RUN_TYPE>" << std::endl;
253 *outstream <<
" <RUN_NUMBER>1</RUN_NUMBER>" << std::endl;
255 *outstream <<
" <LOCATION>CERN P5</LOCATION>" << std::endl;
256 *outstream <<
" </RUN>" << std::endl;
257 *outstream <<
" </HEADER>" << std::endl;
258 *outstream <<
"" << std::endl;
259 *outstream <<
" <DATA_SET>" << std::endl;
260 *outstream <<
"" << std::endl;
261 *outstream <<
" <VERSION>" <<
version <<
"</VERSION>" << std::endl;
262 *outstream <<
" <COMMENT_DESCRIPTION>" <<
getComment() <<
"</COMMENT_DESCRIPTION>" << std::endl;
263 *outstream <<
" <CREATED_BY_USER>" <<
getAuthor() <<
"</CREATED_BY_USER>" << std::endl;
264 *outstream <<
"" << std::endl;
265 *outstream <<
" <PART>" << std::endl;
266 *outstream <<
" <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl;
267 *outstream <<
" <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl;
268 *outstream <<
" </PART>" << std::endl;
273 std::string mthn =
"[PixelTKFECConfig::writeXML()]\t\t\t ";
276 *outstream <<
" <DATA>" << std::endl;
277 *outstream <<
" <TRKFEC_NAME>" <<
TKFECconfig_[
i].getTKFECID() <<
"</TRKFEC_NAME>" << std::endl;
278 *outstream <<
" <CRATE_NUMBER>" <<
TKFECconfig_[
i].getCrate() <<
"</CRATE_NUMBER>" << std::endl;
279 *outstream <<
" <VME_ADDR>" 280 <<
"0x" << hex <<
TKFECconfig_[
i].getAddress() <<
dec <<
"</VME_ADDR>" << std::endl;
281 *outstream <<
" </DATA>" << std::endl;
287 std::ofstream *out1stream,
288 std::ofstream *out2stream)
const {
289 std::string mthn =
"[PixelTKFECConfig::writeXMLTrailer()]\t\t\t ";
291 *outstream <<
" </DATA_SET>" << std::endl;
292 *outstream <<
"</ROOT>" << std::endl;
295 std::cout << mthn <<
"Data written " << std::endl;
This class specifies which TKFEC boards are used and how they are addressed.
std::string typeFromTKFECID(std::string TKFECID) const
This file contains the base class for "pixel configuration data" management.
std::string getType(unsigned int i) const
unsigned int getCrate(unsigned int i) const
unsigned int crateFromTKFECID(std::string TKFECID) const
std::string getComment() const
unsigned int getNTKFECBoards() const
void writeASCII(std::string dir) const override
void writeXMLHeader(pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
~PixelTKFECConfig() override
void writeXML(pos::PixelConfigKey key, int version, std::string path) const override
PixelTKFECConfig(std::string filename)
unsigned int getAddress(unsigned int i) const
std::string getTKFECID(unsigned int i) const
void writeXMLTrailer(std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
key
prepare the HTCondor submission files and eventually submit them
unsigned int addressFromTKFECID(std::string TKFECID) const
std::string getAuthor() const
std::vector< PixelTKFECParameters > TKFECconfig_