21 std::string mthn =
"[PixelGlobalDelay25::PixelGlobalDelay25()]\t\t ";
22 vector<string>
ins = tableMat[0];
23 map<string, int> colM;
24 vector<string> colNames;
40 colNames.push_back(
"CONFIG_KEY");
41 colNames.push_back(
"KEY_TYPE");
42 colNames.push_back(
"KEY_ALIAS_ID");
43 colNames.push_back(
"KEY_ALIAS");
44 colNames.push_back(
"VERSION");
45 colNames.push_back(
"KIND_OF_COND");
46 colNames.push_back(
"GLOBALDELAY25");
47 for (
unsigned int c = 0;
c <
ins.size();
c++) {
48 for (
unsigned int n = 0;
n < colNames.size();
n++) {
49 if (tableMat[0][
c] == colNames[
n]) {
50 colM[colNames[
n]] =
c;
55 for (
unsigned int n = 0;
n < colNames.size();
n++) {
56 if (colM.find(colNames[
n]) == colM.end()) {
57 std::cerr <<
"[PixelGlobalDelay25::PixelGlobalDelay25()]\tCouldn't find in the database the column with name " 58 << colNames[
n] << std::endl;
62 sscanf(tableMat[1][colM[
"GLOBALDELAY25"]].c_str(),
"%x", &delay_);
63 std::cout << __LINE__ <<
"]\t" << mthn <<
"[DB] read global delay 0x" << std::hex << delay_ <<
std::dec << endl;
66 std::cout << __LINE__ <<
"]\t" << mthn <<
"global delay is out of range (>= 1 Tclk)." << std::endl;
67 std::cout << __LINE__ <<
"]\t" << mthn <<
"will not apply any global delays." << std::endl;
68 std::cout << __LINE__ <<
"]\t" << mthn <<
"increase the delays in the TPLL if needed." << std::endl;
74 std::string mthn =
"[PixelGlobalDelay25::PixelGlobalDelay25()]\t\t\t ";
78 std::cout << __LINE__ <<
"]\t" << mthn <<
"Could not open: " <<
filename << std::endl;
79 throw std::runtime_error(
"Failed to open file " +
filename);
90 std::cout << __LINE__ <<
"]\t" << mthn <<
"global delay is out of range (>= 1 Tclk)." << std::endl;
91 std::cout << __LINE__ <<
"]\t" << mthn <<
"will not apply any global delays." << std::endl;
92 std::cout << __LINE__ <<
"]\t" << mthn <<
"increase the delays in the TPLL if needed." << std::endl;
100 std::string mthn =
"[PixelGlobalDelay25::getDelay()]\t\t\t ";
103 std::cout << __LINE__ <<
"]\t" << mthn <<
"the required total delay " <<
ret <<
" is out of range." << endl;
104 std::cout << __LINE__ <<
"]\t" << mthn <<
"original setting: " <<
offset <<
", global delay: " <<
delay_ << endl;
105 std::cout << __LINE__ <<
"]\t" << mthn <<
"we will keep the default delay setting..." << endl;
110 std::cout << __LINE__ <<
"]\t" << mthn <<
"getDelay(" <<
offset <<
") returns " <<
ret << endl;
115 std::string mthn =
"[PixelGlobalDelay25::getCyclicDelay()]\t\t\t ";
119 std::cout << __LINE__ <<
"]\t" << mthn <<
"getCyclicDelay(" <<
offset <<
") returns " <<
ret << endl;
131 std::string mthn =
"[PixelGlobalDelay25::getTTCrxDelay()]\t\t\t ";
132 unsigned int K = (
offset / 16 * 16 +
offset % 16 * 15 + 30) % 240;
133 K += (
unsigned int)floor((
delay_ * 0.499) / 0.1039583 + 0.5);
137 std::cout << __LINE__ <<
"]\t" << mthn <<
"the required TTCrx fine delay " << K <<
" is out of range." << endl;
138 std::cout << __LINE__ <<
"]\t" << mthn <<
"this can happen if the register was initialized to 0" << endl;
139 std::cout << __LINE__ <<
"]\t" << mthn <<
"(i.e. delay of 3.1 ns) and the required delay is >21.7 ns." << endl;
140 std::cout << __LINE__ <<
"]\t" << mthn <<
"we will keep the current delay setting..." << endl;
143 unsigned int n = K % 15;
144 unsigned int m = ((K / 15) -
n + 14) % 16;
148 std::cout << __LINE__ <<
"]\t" << mthn <<
"getTTCrxDelay(" <<
offset <<
") returns " <<
ret << endl;
165 std::string mthn =
"[PixelGlobalDelay25::writeASCII()]\t\t\t ";
172 cout << __LINE__ <<
"]\t" << mthn <<
"Could not open file:" <<
filename << endl;
185 std::ofstream *outstream,
186 std::ofstream *out1stream,
187 std::ofstream *out2stream)
const {
189 s << __LINE__ <<
"]\t[[PixelGlobalDelay25::writeXMLHeader()]\t\t\t ";
193 cout << mthn <<
"Writing to: " <<
fullPath.str() << endl;
195 outstream->open(
fullPath.str().c_str());
197 *outstream <<
"<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl;
198 *outstream <<
"<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl;
199 *outstream <<
"" << std::endl;
200 *outstream <<
" <!-- " << mthn <<
"-->" << std::endl;
201 *outstream <<
"" << std::endl;
202 *outstream <<
" <HEADER>" << std::endl;
203 *outstream <<
" <TYPE>" << std::endl;
204 *outstream <<
" <EXTENSION_TABLE_NAME>PIXEL_GLOBAL_DELAY25</EXTENSION_TABLE_NAME>" << std::endl;
205 *outstream <<
" <NAME>Pixel Global Delay25</NAME>" << std::endl;
206 *outstream <<
" </TYPE>" << std::endl;
207 *outstream <<
" <RUN>" << std::endl;
208 *outstream <<
" <RUN_TYPE>Pixel Global Delay25</RUN_TYPE>" << std::endl;
209 *outstream <<
" <RUN_NUMBER>1</RUN_NUMBER>" << std::endl;
212 *outstream <<
" <LOCATION>CERN P5</LOCATION>" << std::endl;
213 *outstream <<
" </RUN>" << std::endl;
214 *outstream <<
" </HEADER>" << std::endl;
215 *outstream <<
"" << std::endl;
216 *outstream <<
" <DATA_SET>" << std::endl;
217 *outstream <<
" " << std::endl;
218 *outstream <<
" <VERSION>" <<
version <<
"</VERSION>" << std::endl;
219 *outstream <<
" <COMMENT_DESCRIPTION>" <<
getComment() <<
"</COMMENT_DESCRIPTION>" << std::endl;
220 *outstream <<
" <CREATED_BY_USER>" <<
getAuthor() <<
"</CREATED_BY_USER>" << std::endl;
221 *outstream <<
" " << std::endl;
222 *outstream <<
" <PART>" << std::endl;
223 *outstream <<
" <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl;
224 *outstream <<
" <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl;
225 *outstream <<
" </PART>" << std::endl;
230 std::ofstream *out1stream,
231 std::ofstream *out2stream)
const {
233 s << __LINE__ <<
"]\t[PixelGlobalDelay25::writeXML()]\t\t\t ";
236 *outstream <<
" <DATA>" << std::endl;
237 *outstream <<
" <GLOBALDELAY25>0x" << hex <<
delay_ <<
dec <<
"</GLOBALDELAY25>" << std::endl;
238 *outstream <<
" </DATA>" << std::endl;
239 *outstream <<
" " << std::endl;
244 std::ofstream *out1stream,
245 std::ofstream *out2stream)
const {
247 s << __LINE__ <<
"]\t[PixelGlobalDelay25::writeASCII()]\t\t\t ";
250 *outstream <<
" " << std::endl;
251 *outstream <<
" </DATA_SET>" << std::endl;
252 *outstream <<
"</ROOT> " << std::endl;
This file contains the base class for "pixel configuration data" management.
ret
prodAgent to be discontinued
std::string getComment() const
PixelGlobalDelay25(std::string filename)
void writeASCII(std::string dir) const override
~PixelGlobalDelay25() override
unsigned int getCyclicDelay(unsigned int offset=0) const
void writeXMLTrailer(std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override
unsigned int getDelay(unsigned int offset=0) const
std::string getAuthor() const
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 getTTCrxDelay() const
This class specifies which delay25 channels are delayed over the entire pixel detector and by how muc...
void writeXML(std::ofstream *out, std::ofstream *out1=nullptr, std::ofstream *out2=nullptr) const override