21 std::string mthn =
"]\t[PixelTBMSettings::PixelTBMSettings()]\t\t\t ";
22 std::vector<std::string>
ins = tableMat[0];
23 std::map<std::string, int> colM;
24 std::vector<std::string> colNames;
49 colNames.push_back(
"CONFIG_KEY");
50 colNames.push_back(
"KEY_TYPE");
51 colNames.push_back(
"KEY_ALIAS");
52 colNames.push_back(
"VERSION");
53 colNames.push_back(
"KIND_OF_COND");
54 colNames.push_back(
"TBM_NAME");
55 colNames.push_back(
"MODULE_NAME");
56 colNames.push_back(
"HUB_ADDRS");
57 colNames.push_back(
"TBM_MODE");
58 colNames.push_back(
"ANLG_INBIAS_ADDR");
59 colNames.push_back(
"ANLG_INBIAS_VAL");
60 colNames.push_back(
"ANLG_OUTBIAS_ADDR");
61 colNames.push_back(
"ANLG_OUTBIAS_VAL");
62 colNames.push_back(
"ANLG_OUTGAIN_ADDR");
63 colNames.push_back(
"ANLG_OUTGAIN_VAL");
65 for (
unsigned int c = 0;
c < ins.size();
c++) {
66 for (
unsigned int n = 0;
n < colNames.size();
n++) {
67 if (tableMat[0][
c] == colNames[
n]) {
68 colM[colNames[
n]] =
c;
73 for (
unsigned int n = 0;
n < colNames.size();
n++) {
74 if (colM.find(colNames[
n]) == colM.end()) {
75 std::cerr << __LINE__ << mthn <<
"Couldn't find in the database the column with name " << colNames[
n]
81 if (tableMat.size() > 1) {
91 if (tableMat[1][colM[
"TBM_MODE"]] ==
"SingleMode") {
102 std::string mthn =
"]\t[PixelTBMSettings::PixelTBMSettings()]\t\t\t ";
103 if (filename[filename.size() - 1] ==
't') {
104 std::ifstream
in(filename.c_str());
107 std::cout << __LINE__ << mthn <<
"Could not open:" << filename << std::endl;
108 throw std::runtime_error(
"Failed to open file " + filename);
123 assert(tag ==
"AnalogInputBias:");
129 assert(tag ==
"AnalogOutputBias:");
135 assert(tag ==
"AnalogOutputGain:");
143 assert(tag ==
"SingleMode" || tag ==
"DualMode");
147 if (tag ==
"DualMode")
153 std::ifstream
in(filename.c_str(), std::ios::binary);
156 std::cout << __LINE__ << mthn <<
"Could not open:" << filename << std::endl;
159 std::cout << __LINE__ << mthn <<
"Opened:" << filename << std::endl;
170 for (
int i = 0;
i < nchar;
i++) {
190 if (what ==
"analogInputBias") {
192 }
else if (what ==
"analogOutputBias") {
194 }
else if (what ==
"analogOutputGain") {
196 }
else if (what ==
"Mode") {
199 std::cout << __LINE__ <<
"]\t[PixelTBMSettings::setTBMGenericValue()]\t\tFATAL: invalid key/value pair: " << what
200 <<
"/" << value << std::endl;
206 std::ofstream
out(filename.c_str(), std::ios::binary);
224 std::ofstream
out(filename.c_str());
233 out <<
"SingleMode" << std::endl;
235 out <<
"DualMode" << std::endl;
242 bool doResets)
const {
245 int mfec = theROC.
mfec();
248 int tbmchannelB = 15;
264 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannel, hubaddress, 4, 2, 0x14, 0);
266 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannel, hubaddress, 4, 0, 1, 0);
272 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannel, hubaddress, 4, 1, 0xc0, 0);
275 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannel, hubaddress, 4, 4, 0x0, 0);
285 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannelB, hubaddress, 4, 0, 1, 0);
287 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannelB, hubaddress, 4, 1, 0xc0, 0);
290 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannelB, hubaddress, 4, 2, 0x14, 0);
293 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannelB, hubaddress, 4, 4, 0x3, 0);
295 pixelFEC->
tbmcmd(mfec, mfecchannel, tbmchannelB, hubaddress, 4, 4, 0x0, 0);
305 s <<
"mode :Singlemode" << std::endl;
307 s <<
"mode :Dualmode" << std::endl;
316 std::ofstream *outstream,
317 std::ofstream *out1stream,
318 std::ofstream *out2stream)
const {
319 std::string mthn =
"]\t[PixelTBMSettings::writeXMLHeader()]\t\t\t ";
322 std::cout << __LINE__ << mthn <<
"Writing to: " << fullPath.str() << std::endl;
324 outstream->open(fullPath.str().c_str());
326 *outstream <<
"<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl;
327 *outstream <<
"<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl;
328 *outstream <<
" <HEADER>" << std::endl;
329 *outstream <<
" <TYPE>" << std::endl;
330 *outstream <<
" <EXTENSION_TABLE_NAME>PIXEL_TBM_PARAMETERS</EXTENSION_TABLE_NAME>" << std::endl;
331 *outstream <<
" <NAME>Pixel TBM Parameters</NAME>" << std::endl;
332 *outstream <<
" </TYPE>" << std::endl;
333 *outstream <<
" <RUN>" << std::endl;
334 *outstream <<
" <RUN_TYPE>Pixel TBM Parameters</RUN_TYPE>" << std::endl;
335 *outstream <<
" <RUN_NUMBER>1</RUN_NUMBER>" << std::endl;
338 *outstream <<
" <LOCATION>CERN P5</LOCATION>" << std::endl;
339 *outstream <<
" </RUN>" << std::endl;
340 *outstream <<
" </HEADER>" << std::endl;
341 *outstream <<
"" << std::endl;
342 *outstream <<
" <DATA_SET>" << std::endl;
343 *outstream <<
" <PART>" << std::endl;
344 *outstream <<
" <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl;
345 *outstream <<
" <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl;
346 *outstream <<
" </PART>" << std::endl;
347 *outstream <<
" <VERSION>" << version <<
"</VERSION>" << std::endl;
348 *outstream <<
" <COMMENT_DESCRIPTION>" <<
getComment() <<
"</COMMENT_DESCRIPTION>" << std::endl;
349 *outstream <<
" <CREATED_BY_USER>" <<
getAuthor() <<
"</CREATED_BY_USER>" << std::endl;
350 *outstream <<
" " << std::endl;
355 std::string mthn =
"]\t[PixelTBMSettings::writeXML()]\t\t\t ";
359 *outstream <<
" <DATA>" << std::endl;
360 *outstream <<
" <MODULE_NAME>" <<
rocid_.
rocname() <<
"</MODULE_NAME>" << std::endl;
361 *outstream <<
" <ANLG_INBIAS_VAL>" << (int)
analogInputBias_ <<
"</ANLG_INBIAS_VAL>" << std::endl;
362 *outstream <<
" <ANLG_OUTBIAS_VAL>" << (int)
analogOutputBias_ <<
"</ANLG_OUTBIAS_VAL>" << std::endl;
363 *outstream <<
" <ANLG_OUTGAIN_VAL>" << (int)
analogOutputGain_ <<
"</ANLG_OUTGAIN_VAL>" << std::endl;
365 *outstream <<
" <TBM_MODE>SingleMode</TBM_MODE>" << std::endl;
367 *outstream <<
" <TBM_MODE>DualMode</TBM_MODE>" << std::endl;
369 *outstream <<
" </DATA>" << std::endl;
374 std::ofstream *out1stream,
375 std::ofstream *out2stream)
const {
376 std::string mthn =
"]\t[PixelTBMSettings::writeXMLTrailer()]\t\t\t ";
378 *outstream <<
" " << std::endl;
379 *outstream <<
" </DATA_SET>" << std::endl;
380 *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
This file contains the base class for "pixel configuration data" management.
const edm::EventSetup & c
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 writeXMLTrailer(std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
std::string rocname() const
std::ostream & operator<<(std::ostream &s, const PixelCalibConfiguration &calib)
virtual int injecttrigger(const int mfec, const int bitstate)=0
void writeXMLHeader(pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
unsigned int mfecchannel() const
void writeASCII(std::string dir) const override
void setTBMGenericValue(std::string, int)
virtual int disableexttrigger(const int mfec, const int bitstate)=0
std::string getComment() const
unsigned int hubaddress() const
tuple key
prepare the HTCondor submission files and eventually submit them
void writeBinary(std::string filename) const
Store mfec, mfecchannel etc.
virtual int injectrstroc(const int mfec, const int bitstate)=0
void writeXML(pos::PixelConfigKey key, int version, std::string path) const override
std::string getAuthor() const
unsigned char analogInputBias_
This is the documentation about PixelNameTranslation...
unsigned char getAnalogOutputGain() const
PixelROCName const & getROCName() const
virtual int callatencycount(const int mfec, const int latency)=0
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...