19 PixelFEDCard::PixelFEDCard():
29 std::string mthn =
"[PixelFEDCard::PixelFEDCard()]\t\t " ;
30 vector<string>
ins = tableMat[0];
31 map<string , int > colM;
32 vector<string> colNames;
113 colNames.push_back(
"CONFIG_KEY" );
114 colNames.push_back(
"KEY_TYPE" );
115 colNames.push_back(
"KEY_ALIAS" );
116 colNames.push_back(
"VERSION" );
117 colNames.push_back(
"KIND_OF_COND" );
118 colNames.push_back(
"CRATE_LABEL" );
119 colNames.push_back(
"CRATE_NUMBER" );
120 colNames.push_back(
"SLOT_NUMBER" );
121 colNames.push_back(
"VME_ADDRS_HEX" );
122 colNames.push_back(
"PIXEL_FED" );
123 colNames.push_back(
"CHANNEL_ID" );
124 colNames.push_back(
"NUM_ROCS" );
125 colNames.push_back(
"CHAN_OFFST_DAC" );
126 colNames.push_back(
"CHAN_DELAY" );
127 colNames.push_back(
"CHAN_BHIGH" );
128 colNames.push_back(
"CHAN_BLOW" );
129 colNames.push_back(
"CHAN_UB" );
130 colNames.push_back(
"OPT1_CAP" );
131 colNames.push_back(
"OPT2_CAP" );
132 colNames.push_back(
"OPT3_CAP" );
133 colNames.push_back(
"OPT1_INP" );
134 colNames.push_back(
"OPT2_INP" );
135 colNames.push_back(
"OPT3_INP" );
136 colNames.push_back(
"OPT1_OUT" );
137 colNames.push_back(
"OPT2_OUT" );
138 colNames.push_back(
"OPT3_OUT" );
139 colNames.push_back(
"NORTH_CLKPHB" );
140 colNames.push_back(
"NORTHCENTER_CLKPHB" );
141 colNames.push_back(
"SOUTHCENTER_CLKPHB" );
142 colNames.push_back(
"SOUTH_CLKPHB" );
143 colNames.push_back(
"NORTH_CTRL" );
144 colNames.push_back(
"NORTHCENTER_CTRL" );
145 colNames.push_back(
"SOUTHCENTER_CTRL" );
146 colNames.push_back(
"SOUTH_CTRL" );
147 colNames.push_back(
"REG0_TTCRX_FDLA" );
148 colNames.push_back(
"REG1_TTCRX_FDLA" );
149 colNames.push_back(
"REG2_TTCRX_CDLA" );
150 colNames.push_back(
"REG3_TTCRX_CLKD2" );
151 colNames.push_back(
"CENTER_CTRL" );
152 colNames.push_back(
"CENTER_MODE" );
153 colNames.push_back(
"B1_ADCGN" );
154 colNames.push_back(
"B2_ADCGN" );
155 colNames.push_back(
"B3_ADCGN" );
156 colNames.push_back(
"B4_ADCGN" );
157 colNames.push_back(
"NORTH_BADJ" );
158 colNames.push_back(
"NORTHCENTER_BADJ" );
159 colNames.push_back(
"SOUTHCENTER_BADJ" );
160 colNames.push_back(
"SOUTH_BADJ" );
161 colNames.push_back(
"NORTH_TBMMASK" );
162 colNames.push_back(
"NORTHCENTER_TBMMASK" );
163 colNames.push_back(
"SOUTHCENTER_TBMMASK" );
164 colNames.push_back(
"SOUTH_TBMMASK" );
165 colNames.push_back(
"NORTH_PWORD" );
166 colNames.push_back(
"NORTHCENTER_PWORD" );
167 colNames.push_back(
"SOUTH_PWORD" );
168 colNames.push_back(
"SOUTHCENTER_PWORD" );
169 colNames.push_back(
"SPECDAC" );
170 colNames.push_back(
"OOS_LVL" );
171 colNames.push_back(
"ERR_LVL" );
172 colNames.push_back(
"NORTH_FIFO1_BZ_LVL" );
173 colNames.push_back(
"NORTHCENTER_FIFO1_BZ_LVL");
174 colNames.push_back(
"SOUTHCENTER_FIFO1_BZ_LVL");
175 colNames.push_back(
"SOUTH_FIFO1_BZ_LVL" );
176 colNames.push_back(
"FIFO3_WRN_LVL" );
177 colNames.push_back(
"FED_MASTER_DELAY" );
178 colNames.push_back(
"NO_HITLIMIT" );
179 colNames.push_back(
"NC_HITLIMIT" );
180 colNames.push_back(
"SC_HITLIMIT" );
181 colNames.push_back(
"SO_HITLIMIT" );
182 colNames.push_back(
"NO_TESTREG" );
183 colNames.push_back(
"NC_TESTREG" );
184 colNames.push_back(
"SC_TESTREG" );
185 colNames.push_back(
"SO_TESTREG" );
187 for(
unsigned int c = 0 ;
c < ins.size() ;
c++)
189 for(
unsigned int n=0;
n<colNames.size();
n++)
191 if(tableMat[0][
c] == colNames[
n]){
192 colM[colNames[
n]] =
c;
197 for(
unsigned int n=0;
n<colNames.size();
n++)
199 if(colM.find(colNames[
n]) == colM.end())
201 std::cerr <<
"[PixelTBMSettings::PixelTBMSettings()]\tCouldn't find in the database the column with name " << colNames[
n] << std::endl;
208 for(
unsigned int r = 0 ;
r < tableMat.size() ;
r++){
209 if(tableMat[
r].
size() == 0)
212 size[indexsize] =
r ;
217 for(vector<string>::iterator it = tableMat[
r].
begin() ; it != tableMat[
r].end() ; it++)
231 sscanf(tableMat[1][colM[
"VME_ADDRS_HEX"]].c_str(),
"%lx",&
FEDBASE_0);
233 fedNumber = atoi(tableMat[1][colM[
"PIXEL_FED"]].c_str() ) ;
235 opt_cap[0] = atoi(tableMat[1][colM[
"OPT1_CAP"]].c_str() ) ;
236 opt_cap[1] = atoi(tableMat[1][colM[
"OPT2_CAP"]].c_str() ) ;
237 opt_cap[2] = atoi(tableMat[1][colM[
"OPT3_CAP"]].c_str() ) ;
238 opt_inadj[0] = atoi(tableMat[1][colM[
"OPT1_INP"]].c_str() ) ;
239 opt_inadj[1] = atoi(tableMat[1][colM[
"OPT2_INP"]].c_str() ) ;
240 opt_inadj[2] = atoi(tableMat[1][colM[
"OPT3_INP"]].c_str() ) ;
241 opt_ouadj[0] = atoi(tableMat[1][colM[
"OPT1_OUT"]].c_str() ) ;
242 opt_ouadj[1] = atoi(tableMat[1][colM[
"OPT2_OUT"]].c_str() ) ;
243 opt_ouadj[2] = atoi(tableMat[1][colM[
"OPT3_OUT"]].c_str() ) ;
246 clkphs1_9 = atoi(tableMat[1][colM[
"NORTH_CLKPHB"]].c_str() ) ;
247 clkphs10_18 = atoi(tableMat[1][colM[
"NORTHCENTER_CLKPHB"]].c_str() ) ;
248 clkphs19_27 = atoi(tableMat[1][colM[
"SOUTHCENTER_CLKPHB"]].c_str() ) ;
249 clkphs28_36 = atoi(tableMat[1][colM[
"SOUTH_CLKPHB"]].c_str() ) ;
252 CoarseDel = atoi(tableMat[1][colM[
"REG2_TTCRX_CDLA"]].c_str() ) ;
253 ClkDes2 = atoi(tableMat[1][colM[
"REG3_TTCRX_CLKD2"]].c_str() ) ;
254 FineDes2Del = atoi(tableMat[1][colM[
"REG1_TTCRX_FDLA"]].c_str() ) ;
255 FineDes1Del = atoi(tableMat[1][colM[
"REG0_TTCRX_FDLA"]].c_str() ) ;
257 Ccntrl = atoi(tableMat[1][colM[
"CENTER_CTRL"]].c_str() ) ;
258 modeRegister = atoi(tableMat[1][colM[
"CENTER_MODE"]].c_str() ) ;
261 Nfifo1Bzlvl = atoi(tableMat[1][colM[
"NORTH_FIFO1_BZ_LVL"]].c_str() ) ;
262 NCfifo1Bzlvl = atoi(tableMat[1][colM[
"NORTHCENTER_FIFO1_BZ_LVL"]].c_str() ) ;
263 SCfifo1Bzlvl = atoi(tableMat[1][colM[
"SOUTHCENTER_FIFO1_BZ_LVL"]].c_str() ) ;
264 Sfifo1Bzlvl = atoi(tableMat[1][colM[
"SOUTH_FIFO1_BZ_LVL"]].c_str() ) ;
267 N_TBMmask = atoi(tableMat[1][colM[
"NORTH_TBMMASK"]].c_str() ) ;
268 NC_TBMmask = atoi(tableMat[1][colM[
"NORTHCENTER_TBMMASK"]].c_str() ) ;
269 SC_TBMmask = atoi(tableMat[1][colM[
"SOUTHCENTER_TBMMASK"]].c_str() ) ;
270 S_TBMmask = atoi(tableMat[1][colM[
"SOUTH_TBMMASK"]].c_str() ) ;
273 N_Pword = atoi(tableMat[1][colM[
"NORTH_PWORD"]].c_str() ) ;
274 NC_Pword = atoi(tableMat[1][colM[
"NORTHCENTER_PWORD"]].c_str() ) ;
275 SC_Pword = atoi(tableMat[1][colM[
"SOUTHCENTER_PWORD"]].c_str() ) ;
276 S_Pword = atoi(tableMat[1][colM[
"SOUTH_PWORD"]].c_str() ) ;
278 Nbaseln = atoi(tableMat[1][colM[
"NORTH_BADJ"]].c_str() ) ;
279 NCbaseln = atoi(tableMat[1][colM[
"NORTHCENTER_BADJ"]].c_str() ) ;
280 SCbaseln = atoi(tableMat[1][colM[
"SOUTHCENTER_BADJ"]].c_str() ) ;
281 Sbaseln = atoi(tableMat[1][colM[
"SOUTH_BADJ"]].c_str() ) ;
283 Ncntrl = atoi(tableMat[1][colM[
"NORTH_CTRL"]].c_str() ) ;
284 NCcntrl = atoi(tableMat[1][colM[
"NORTHCENTER_CTRL"]].c_str() ) ;
285 SCcntrl = atoi(tableMat[1][colM[
"SOUTHCENTER_CTRL"]].c_str() ) ;
286 Scntrl = atoi(tableMat[1][colM[
"SOUTH_CTRL"]].c_str() ) ;
290 SpecialDac = atoi(tableMat[1][colM[
"SPECDAC"]].c_str() ) ;
293 Ooslvl = atoi(tableMat[1][colM[
"OOS_LVL"]].c_str() ) ;
295 Errlvl = atoi(tableMat[1][colM[
"ERR_LVL"]].c_str() ) ;
298 Nadcg = atoi(tableMat[1][colM[
"B1_ADCGN"]].c_str() ) ;
299 NCadcg = atoi(tableMat[1][colM[
"B2_ADCGN"]].c_str() ) ;
300 SCadcg = atoi(tableMat[1][colM[
"B3_ADCGN"]].c_str() ) ;
301 Sadcg = atoi(tableMat[1][colM[
"B4_ADCGN"]].c_str() ) ;
302 fifo3Wrnlvl = atoi(tableMat[1][colM[
"FIFO3_WRN_LVL"]].c_str() ) ;
303 FedTTCDelay = atoi(tableMat[1][colM[
"FED_MASTER_DELAY"]].c_str() ) ;
304 N_hitlimit = atoi(tableMat[1][colM[
"NO_HITLIMIT"]].c_str() ) ;
305 NC_hitlimit = atoi(tableMat[1][colM[
"NC_HITLIMIT"]].c_str() ) ;
306 SC_hitlimit = atoi(tableMat[1][colM[
"SC_HITLIMIT"]].c_str() ) ;
307 S_hitlimit = atoi(tableMat[1][colM[
"SO_HITLIMIT"]].c_str() ) ;
308 N_testreg = atoi(tableMat[1][colM[
"NO_TESTREG"]].c_str() ) ;
309 NC_testreg = atoi(tableMat[1][colM[
"NC_TESTREG"]].c_str() ) ;
310 SC_testreg = atoi(tableMat[1][colM[
"SC_TESTREG"]].c_str() ) ;
311 S_testreg = atoi(tableMat[1][colM[
"SO_TESTREG"]].c_str() ) ;
314 for(
int r = 1 ;
r < size[0] ;
r++)
317 NRocs[atoi(tableMat[
r][colM[
"CHANNEL_ID"]].c_str())-1] = atoi(tableMat[
r][colM[
"NUM_ROCS"]].c_str() ) ;
319 offs_dac[atoi(tableMat[
r][colM[
"CHANNEL_ID"]].c_str())-1] = atoi(tableMat[
r][colM[
"CHAN_OFFST_DAC"]].c_str() ) ;
321 DelayCh[atoi(tableMat[
r][colM[
"CHANNEL_ID"]].c_str())-1] = atoi(tableMat[
r][colM[
"CHAN_DELAY"]].c_str() ) ;
323 BlackHi[atoi(tableMat[
r][colM[
"CHANNEL_ID"]].c_str())-1] = atoi(tableMat[
r][colM[
"CHAN_BHIGH"]].c_str() ) ;
324 BlackLo[atoi(tableMat[
r][colM[
"CHANNEL_ID"]].c_str())-1] = atoi(tableMat[
r][colM[
"CHAN_BLOW"]].c_str() ) ;
325 Ublack[atoi(tableMat[
r][colM[
"CHANNEL_ID"]].c_str())-1] = atoi(tableMat[
r][colM[
"CHAN_UB"]].c_str() ) ;
352 string mthn =
"[PixelFEDCard::readDBTBMLevels()] ";
353 vector<string> ins = tableMat[firstRow];
354 map<string , int > colM;
355 vector<string> colNames;
385 colNames.push_back(
"CONFIG_KEY" );
386 colNames.push_back(
"KEY_TYPE" );
387 colNames.push_back(
"KEY_ALIAS" );
388 colNames.push_back(
"VERSION" );
389 colNames.push_back(
"KIND_OF_COND" );
390 colNames.push_back(
"TBM_NAME" );
391 colNames.push_back(
"PIXEL_FED" );
392 colNames.push_back(
"FED_CHAN" );
393 colNames.push_back(
"TBMA_HEAD_L0" );
394 colNames.push_back(
"TBMA_HEAD_L1" );
395 colNames.push_back(
"TBMA_HEAD_L2" );
396 colNames.push_back(
"TBMA_HEAD_L3" );
397 colNames.push_back(
"TBMA_HEAD_L4" );
398 colNames.push_back(
"TBMA_TRAIL_L0");
399 colNames.push_back(
"TBMA_TRAIL_L1");
400 colNames.push_back(
"TBMA_TRAIL_L2");
401 colNames.push_back(
"TBMA_TRAIL_L3");
402 colNames.push_back(
"TBMA_TRAIL_L4");
403 colNames.push_back(
"TBMA_HEAD_B" );
404 colNames.push_back(
"TBMA_HEAD_UB" );
405 colNames.push_back(
"TBMA_TRAIL_B" );
406 colNames.push_back(
"TBMA_TRAIL_UB");
432 for(
unsigned int c = 0 ;
c < ins.size() ;
c++)
434 for(
unsigned int n=0; n<colNames.size(); n++)
436 if(tableMat[firstRow][
c] == colNames[n]){
437 colM[colNames[
n]] =
c;
442 for(
unsigned int n=0; n<colNames.size(); n++)
444 if(colM.find(colNames[n]) == colM.end())
446 std::cerr << mthn <<
"\tCouldn't find in the database the column with name " << colNames[
n] << std::endl;
450 for(
int r = firstRow + 1 ;
r < lastRow ;
r++)
453 TBM_L0[atoi(tableMat[
r][colM[
"FED_CHAN"]].c_str())-1] = atoi(tableMat[
r][colM[
"TBMA_HEAD_L0"]].c_str() ) ;
454 TBM_L1[atoi(tableMat[
r][colM[
"FED_CHAN"]].c_str())-1] = atoi(tableMat[
r][colM[
"TBMA_HEAD_L1"]].c_str() ) ;
455 TBM_L2[atoi(tableMat[
r][colM[
"FED_CHAN"]].c_str())-1] = atoi(tableMat[
r][colM[
"TBMA_HEAD_L2"]].c_str() ) ;
456 TBM_L3[atoi(tableMat[
r][colM[
"FED_CHAN"]].c_str())-1] = atoi(tableMat[
r][colM[
"TBMA_HEAD_L3"]].c_str() ) ;
457 TBM_L4[atoi(tableMat[
r][colM[
"FED_CHAN"]].c_str())-1] = atoi(tableMat[
r][colM[
"TBMA_HEAD_L4"]].c_str() ) ;
458 TRL_L0[atoi(tableMat[
r][colM[
"FED_CHAN"]].c_str())-1] = atoi(tableMat[
r][colM[
"TBMA_TRAIL_L0"]].c_str() ) ;
459 TRL_L1[atoi(tableMat[
r][colM[
"FED_CHAN"]].c_str())-1] = atoi(tableMat[
r][colM[
"TBMA_TRAIL_L1"]].c_str() ) ;
460 TRL_L2[atoi(tableMat[
r][colM[
"FED_CHAN"]].c_str())-1] = atoi(tableMat[
r][colM[
"TBMA_TRAIL_L2"]].c_str() ) ;
461 TRL_L3[atoi(tableMat[
r][colM[
"FED_CHAN"]].c_str())-1] = atoi(tableMat[
r][colM[
"TBMA_TRAIL_L3"]].c_str() ) ;
462 TRL_L4[atoi(tableMat[
r][colM[
"FED_CHAN"]].c_str())-1] = atoi(tableMat[
r][colM[
"TBMA_TRAIL_L4"]].c_str() ) ;
468 string mthn =
"[PixelFEDCard::readDBROCLevels()] ";
469 map<string , int > colM;
470 vector<string> colNames;
494 colNames.push_back(
"CONFIG_KEY" );
495 colNames.push_back(
"KEY_TYPE" );
496 colNames.push_back(
"KEY_ALIAS" );
497 colNames.push_back(
"VERSION" );
498 colNames.push_back(
"KIND_OF_COND");
499 colNames.push_back(
"ROC_NAME" );
500 colNames.push_back(
"FED_ROC_NUM" );
501 colNames.push_back(
"PIXEL_FED" );
502 colNames.push_back(
"FED_CHAN" );
503 colNames.push_back(
"ROC_L0" );
504 colNames.push_back(
"ROC_L1" );
505 colNames.push_back(
"ROC_L2" );
506 colNames.push_back(
"ROC_L3" );
507 colNames.push_back(
"ROC_L4" );
508 colNames.push_back(
"ROC_B" );
509 colNames.push_back(
"ROC_UB" );
531 for(
unsigned int c = 0 ;
c < tableMat[firstRow].size() ;
c++)
533 for(
unsigned int n=0; n<colNames.size(); n++)
535 if(tableMat[firstRow][
c] == colNames[n]){
536 colM[colNames[
n]] =
c;
541 for(
unsigned int n=0; n<colNames.size(); n++)
543 if(colM.find(colNames[n]) == colM.end())
545 std::cerr << mthn <<
"\tCouldn't find in the database the column with name " << colNames[
n] << std::endl;
552 for(
int r = firstRow + 1 ;
r < lastRow ;
r++)
554 ROC_L0[atoi(tableMat[
r][colM[
"FED_CHAN"]].c_str())-1][atoi(tableMat[
r][colM[
"FED_ROC_NUM"]].c_str())] = atoi(tableMat[
r][colM[
"ROC_L0"]].c_str()) ;
555 ROC_L1[atoi(tableMat[
r][colM[
"FED_CHAN"]].c_str())-1][atoi(tableMat[
r][colM[
"FED_ROC_NUM"]].c_str())] = atoi(tableMat[
r][colM[
"ROC_L1"]].c_str()) ;
556 ROC_L2[atoi(tableMat[
r][colM[
"FED_CHAN"]].c_str())-1][atoi(tableMat[
r][colM[
"FED_ROC_NUM"]].c_str())] = atoi(tableMat[
r][colM[
"ROC_L2"]].c_str()) ;
557 ROC_L3[atoi(tableMat[
r][colM[
"FED_CHAN"]].c_str())-1][atoi(tableMat[
r][colM[
"FED_ROC_NUM"]].c_str())] = atoi(tableMat[
r][colM[
"ROC_L3"]].c_str()) ;
558 ROC_L4[atoi(tableMat[
r][colM[
"FED_CHAN"]].c_str())-1][atoi(tableMat[
r][colM[
"FED_ROC_NUM"]].c_str())] = atoi(tableMat[
r][colM[
"ROC_L4"]].c_str()) ;
569 std::string mthn =
"]\t[PixelFEDCard::PixelFEDCard()]\t\t\t\t " ;
571 const bool localDEBUG =
false;
577 FILE *
infile = fopen((fileName.c_str()),
"r");
578 if (infile ==
NULL)
throw std::runtime_error(
"Failed to open FED Card parameter file: "+fileName);
581 fscanf(infile,
"FED Base address :%lx\n",
583 fscanf(infile,
"FEDID Number :%lx\n",
594 for(
int i=0;
i<36;
i++){
596 fscanf(infile,
"Number of ROCs Chnl %d:%d \n",&ijx,&
NRocs[
i]);
597 if(localDEBUG)printf(
"Number of ROCs per Chnl %d:%d \n",ijx,
NRocs[
i]);
601 fscanf(infile,
"Optical reciever 1 Capacitor Adjust(0-3):%d\n",&
opt_cap[0]);
602 fscanf(infile,
"Optical reciever 2 Capacitor Adjust(0-3):%d\n",&
opt_cap[1]);
603 fscanf(infile,
"Optical reciever 3 Capacitor Adjust(0-3):%d\n",&
opt_cap[2]);
604 fscanf(infile,
"Optical reciever 1 Input Offset (0-15) :%d\n",&
opt_inadj[0]);
605 fscanf(infile,
"Optical reciever 2 Input Offset (0-15) :%d\n",&
opt_inadj[1]);
606 fscanf(infile,
"Optical reciever 3 Input Offset (0-15) :%d\n",&
opt_inadj[2]);
607 fscanf(infile,
"Optical reciever 1 Output Offset (0-3) :%d\n",&
opt_ouadj[0]);
608 fscanf(infile,
"Optical reciever 2 Output Offset (0-3) :%d\n",&
opt_ouadj[1]);
609 fscanf(infile,
"Optical reciever 3 Output Offset (0-3) :%d\n",&
opt_ouadj[2]);
612 printf(
"Optical reciever 1 Capacitor Adjust(0-3):%d\n",
opt_cap[0]);
613 printf(
"Optical reciever 2 Capacitor Adjust(0-3):%d\n",
opt_cap[1]);
614 printf(
"Optical reciever 3 Capacitor Adjust(0-3):%d\n",
opt_cap[2]);
615 printf(
"Optical reciever 1 Input Offset (0-15) :%d\n",
opt_inadj[0]);
616 printf(
"Optical reciever 2 Input Offset (0-15) :%d\n",
opt_inadj[1]);
617 printf(
"Optical reciever 3 Input Offset (0-15) :%d\n",
opt_inadj[2]);
618 printf(
"Optical reciever 1 Output Offset (0-3) :%d\n",
opt_ouadj[0]);
619 printf(
"Optical reciever 2 Output Offset (0-3) :%d\n",
opt_ouadj[1]);
620 printf(
"Optical reciever 3 Output Offset (0-3) :%d\n",
opt_ouadj[2]);
624 for(
int i=0;
i<36;
i++) {
625 fscanf(infile,
"Offset DAC channel %d:%d\n",&ijx,&
offs_dac[
i]);
626 if(localDEBUG) printf(
"Offset DAC channel %d:%d\n",
i+1,
offs_dac[
i]);
630 fscanf(infile,
"Clock Phase Bits ch 1-9:%x\n",&
clkphs1_9 );
631 fscanf(infile,
"Clock Phase Bits ch 10-18:%x\n",&
clkphs10_18);
632 fscanf(infile,
"Clock Phase Bits ch 19-27:%x\n",&
clkphs19_27);
633 fscanf(infile,
"Clock Phase Bits ch 28-36:%x\n",&
clkphs28_36);
634 if(localDEBUG)printf(
"Clock Phase Bits ch 1-9:%x\n",
clkphs1_9 );
635 if(localDEBUG)printf(
"Clock Phase Bits ch 10-18:%x\n",
clkphs10_18 );
636 if(localDEBUG)printf(
"Clock Phase Bits ch 19-27:%x\n",
clkphs19_27 );
637 if(localDEBUG)printf(
"Clock Phase Bits ch 28-36:%x\n",
clkphs28_36 );
640 for(
int i=0;
i<36;
i++){
641 fscanf(infile,
"Black HiThold ch %d:%d \n",&ijx,&
BlackHi[
i]);
642 fscanf(infile,
"Black LoThold ch %d:%d \n",&ijx,&
BlackLo[
i]);
643 fscanf(infile,
"ULblack Thold ch %d:%d \n",&ijx, &
Ublack[
i]);
644 if(localDEBUG)printf(
"Black HiThold ch %d:%d\n",ijx,
BlackHi[
i]);
645 if(localDEBUG)printf(
"Black LoThold ch %d:%d\n",ijx,
BlackLo[
i]);
646 if(localDEBUG)printf(
"ULblack Thold ch %d:%d\n",ijx,
Ublack[
i]);
650 for(
int i=0;
i<36;
i++) {
651 fscanf(infile,
"Delay channel %d(0-15):%d\n",&ijx,&
DelayCh[
i]);
653 printf(
"Delay channel %d(0-15):%d\n",
i+1,
DelayCh[
i]);
657 for(
int i=0;
i<36;
i++) {
658 fscanf(infile,
"TBM level 0 Channel %d:%d\n",&ijx,&
TBM_L0[
i]);
659 fscanf(infile,
"TBM level 1 Channel %d:%d\n",&ijx,&
TBM_L1[
i]);
660 fscanf(infile,
"TBM level 2 Channel %d:%d\n",&ijx,&
TBM_L2[
i]);
661 fscanf(infile,
"TBM level 3 Channel %d:%d\n",&ijx,&
TBM_L3[
i]);
662 fscanf(infile,
"TBM level 4 Channel %d:%d\n",&ijx,&
TBM_L4[
i]);
663 if(localDEBUG)printf(
"TBM level 0 Channel %d:%d\n",ijx,
TBM_L0[
i]);
664 if(localDEBUG)printf(
"TBM level 1 Channel %d:%d\n",ijx,
TBM_L1[
i]);
665 if(localDEBUG)printf(
"TBM level 2 Channel %d:%d\n",ijx,
TBM_L2[
i]);
666 if(localDEBUG)printf(
"TBM level 3 Channel %d:%d\n",ijx,
TBM_L3[
i]);
667 if(localDEBUG)printf(
"TBM level 4 Channel %d:%d\n",ijx,
TBM_L4[
i]);
671 fscanf(infile,
"ROC%d level 0 Channel %d :%d\n",
673 fscanf(infile,
"ROC%d level 1 Channel %d :%d\n",
675 fscanf(infile,
"ROC%d level 2 Channel %d :%d\n",
677 fscanf(infile,
"ROC%d level 3 Channel %d :%d\n",
679 fscanf(infile,
"ROC%d level 4 Channel %d :%d\n",
682 printf(
"ROC%d level 0 Channel %d :%d\n",ijy,ijx,
ROC_L0[
i][
j]);
684 printf(
"ROC%d level 1 Channel %d :%d\n",ijy,ijx,
ROC_L1[
i][
j]);
686 printf(
"ROC%d level 2 Channel %d :%d\n",ijy,ijx,
ROC_L2[
i][
j]);
688 printf(
"ROC%d level 3 Channel %d :%d\n",ijy,ijx,
ROC_L3[
i][
j]);
690 printf(
"ROC%d level 4 Channel %d :%d\n",ijy,ijx,
ROC_L4[
i][
j]);
693 fscanf(infile,
"TRLR level 0 Channel %d:%d\n",&ijx,&
TRL_L0[
i]);
694 fscanf(infile,
"TRLR level 1 Channel %d:%d\n",&ijx,&
TRL_L1[
i]);
695 fscanf(infile,
"TRLR level 2 Channel %d:%d\n",&ijx,&
TRL_L2[
i]);
696 fscanf(infile,
"TRLR level 3 Channel %d:%d\n",&ijx,&
TRL_L3[
i]);
697 fscanf(infile,
"TRLR level 4 Channel %d:%d\n",&ijx,&
TRL_L4[
i]);
698 if(localDEBUG)printf(
"TRLR level 0 Channel %d:%d\n",ijx,
TRL_L0[
i]);
699 if(localDEBUG)printf(
"TRLR level 1 Channel %d:%d\n",ijx,
TRL_L1[
i]);
700 if(localDEBUG)printf(
"TRLR level 2 Channel %d:%d\n",ijx,
TRL_L2[
i]);
701 if(localDEBUG)printf(
"TRLR level 3 Channel %d:%d\n",ijx,
TRL_L3[
i]);
702 if(localDEBUG)printf(
"TRLR level 4 Channel %d:%d\n",ijx,
TRL_L4[
i]);
707 fscanf(infile,
"Channel Enbable bits chnls 1-9 (on = 0):%x\n",
709 fscanf(infile,
"Channel Enbable bits chnls 10-18(on = 0):%x\n",
711 fscanf(infile,
"Channel Enbable bits chnls 19-27(on = 0):%x\n",
713 fscanf(infile,
"Channel Enbable bits chnls 28-36(on = 0):%x\n",
716 printf(
"Channel Enbable bits chnls 1-9 (on = 0):%x\n",
Ncntrl);
718 printf(
"Channel Enbable bits chnls 10-18(on = 0):%x\n",
NCcntrl);
720 printf(
"Channel Enbable bits chnls 19-27(on = 0):%x\n",
SCcntrl);
722 printf(
"Channel Enbable bits chnls 28-36(on = 0):%x\n",
Scntrl);
725 fscanf(infile,
"TTCrx Coarse Delay Register 2:%d\n",&
CoarseDel);
726 fscanf(infile,
"TTCrc ClkDes2 Register 3:%x\n",&
ClkDes2);
727 fscanf(infile,
"TTCrc Fine Dlay ClkDes2 Reg 1:%d\n",&
FineDes2Del);
728 if(localDEBUG)printf(
"TTCrx Coarse Delay Register 2:%d\n",
CoarseDel);
729 if(localDEBUG)printf(
"TTCrc ClkDes2 Register 3:%x\n",
ClkDes2);
730 if(localDEBUG)printf(
"TTCrc Fine Dlay ClkDes2 Reg 1:%d\n",
FineDes2Del);
733 fscanf(infile,
"Center Chip Control Reg:%x\n",&
Ccntrl);
734 if(localDEBUG)printf(
"Control Reg:0x%x\n",
Ccntrl);
735 fscanf(infile,
"Initial Slink DAQ mode:%d\n",&
modeRegister);
739 fscanf(infile,
"Channel ADC Gain bits chnls 1-12(1Vpp = 0):%x\n",
741 fscanf(infile,
"Channel ADC Gain bits chnls 13-20(1Vpp = 0):%x\n",
743 fscanf(infile,
"Channel ADC Gain bits chnls 21-28(1Vpp = 0):%x\n",
745 fscanf(infile,
"Channel ADC Gain bits chnls 29-36(1Vpp = 0):%x\n",
748 printf(
"Channel ADC Gain bits chnls 1-12(1Vpp = 0):%x\n",
Nadcg);
750 printf(
"Channel ADC Gain bits chnls 13-20(1Vpp = 0):%x\n",
NCadcg);
752 printf(
"Channel ADC Gain bits chnls 21-28(1Vpp = 0):%x\n",
SCadcg);
754 printf(
"Channel ADC Gain bits chnls 29-36(1Vpp = 0):%x\n",
Sadcg);
757 fscanf(infile,
"Channel Baseline Enbable chnls 1-9 (on = (0x1ff<<16)+):%x\n",
759 fscanf(infile,
"Channel Baseline Enbable chnls 10-18(on = (0x1ff<<16)+):%x\n",
761 fscanf(infile,
"Channel Baseline Enbable chnls 19-27(on = (0x1ff<<16)+):%x\n",
763 fscanf(infile,
"Channel Baseline Enbable chnls 28-36(on = (0x1ff<<16)+):%x\n",
766 printf(
"Channel Baseline Enbable chnls 1-9 (on = (0x1ff<<16)+):%x\n",
Nbaseln);
768 printf(
"Channel Baseline Enbable chnls 10-18(on = (0x1ff<<16)+):%x\n",
NCbaseln);
770 printf(
"Channel Baseline Enbable chnls 19-27(on = (0x1ff<<16)+):%x\n",
SCbaseln);
772 printf(
"Channel Baseline Enbable chnls 28-36(on = (0x1ff<<16)+):%x\n",
Sbaseln);
775 fscanf(infile,
"TBM trailer mask chnls 1-9 (0xff = all masked):%x\n",
777 fscanf(infile,
"TBM trailer mask chnls 10-18(0xff = all masked):%x\n",
779 fscanf(infile,
"TBM trailer mask chnls 19-27(0xff = all masked):%x\n",
781 fscanf(infile,
"TBM trailer mask chnls 28-36(0xff = all masked):%x\n",
784 printf(
"TBM trailer mask chnls 1-9 (0xff = all masked):%x\n",
N_TBMmask);
786 printf(
"TBM trailer mask chnls 10-18(0xff = all masked):%x\n",
NC_TBMmask);
788 printf(
"TBM trailer mask chnls 19-27(0xff = all masked):%x\n",
SC_TBMmask);
790 printf(
"TBM trailer mask chnls 28-36(0xff = all masked):%x\n",
S_TBMmask);
793 fscanf(infile,
"Private 8 bit word chnls 1-9 :%x\n",
795 fscanf(infile,
"Private 8 bit word chnls 10-18:%x\n",
797 fscanf(infile,
"Private 8 bit word chnls 19-27:%x\n",
799 fscanf(infile,
"Private 8 bit word chnls 28-36:%x\n",
802 printf(
"Private 8 bit word chnls 1-9 :%x\n",
N_Pword);
804 printf(
"Private 8 bit word chnls 10-18:%x\n",
NC_Pword);
806 printf(
"Private 8 bit word chnls 19-27:%x\n",
SC_Pword);
808 printf(
"Private 8 bit word chnls 28-36:%x\n",
S_Pword);
811 fscanf(infile,
"Special Random testDAC mode (on = 0x1, off=0x0):%x\n",
814 printf(
"Special Random testDAC mode (on = 0x1, off=0x0):%x\n",
SpecialDac);
818 fscanf(infile,
"Number of Consecutive (max 1023) Out of Syncs till TTs OOS set:%d\n",
821 printf(
"Number of Consecutive (max 1023) Out of Syncs till TTs OOS set:%d\n",
Ooslvl);
824 fscanf(infile,
"Number of Consecutive (max 1023) Empty events till TTs ERR set:%d\n",
827 printf(
"Number of Consecutive (max 1023) Empty events till TTs ERR set:%d\n",
Errlvl);
830 fscanf(infile,
"N Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",
833 printf(
"N Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",
Nfifo1Bzlvl);
836 fscanf(infile,
"NC Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",
839 printf(
"NC Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",
NCfifo1Bzlvl);
842 fscanf(infile,
"SC Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",
845 printf(
"SC Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",
SCfifo1Bzlvl);
848 fscanf(infile,
"S Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",
851 printf(
"S Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",
Sfifo1Bzlvl);
854 fscanf(infile,
"Fifo-3 almost full level,sets TTs WARN (max 8191):%d\n",
857 printf(
"Fifo-3 almost full level,sets TTs WARN (max 8191):%d\n",
fifo3Wrnlvl);
859 fscanf(infile,
"FED Master delay 0=0,1=32,2=48,3=64:%d\n",
862 printf(
"FED Master delay 0=0,1=32,2=48,3=64:%d\n",
FedTTCDelay);
864 fscanf(infile,
"TTCrx Register 0 fine delay ClkDes1:%d\n",&
FineDes1Del);
866 printf(
"TTCrx Register 0 fine delay ClkDes1:%d\n",
FineDes1Del);
869 fscanf(infile,
"Params FED file check word:%d\n",
871 if(checkword!=90508&&checkword!=91509)
cout << __LINE__ <<
"]\t" << mthn
873 <<
" Params FED File read error. Checkword read " << checkword
874 <<
" check word expected 090508 or 91509" << endl;
875 assert((checkword==90508)|(checkword==91509));
878 cout << __LINE__ <<
"]\t" << mthn <<
"Params FED file check word: " << checkword << endl;
882 if(checkword==91509){
884 fscanf(infile,
"N fifo-1 hit limit (max 1023 (hard) 900 (soft):%d\n",&
N_hitlimit);
886 printf(
"N fifo-1 hit limit (max 1023 (hard) 900 (soft):%d\n",
N_hitlimit);
887 fscanf(infile,
"NC fifo-1 hit limit (max 1023 (hard) 900 (soft):%d\n",&
NC_hitlimit);
889 printf(
"NC fifo-1 hit limit (max 1023 (hard) 900 (soft):%d\n",
NC_hitlimit);
890 fscanf(infile,
"SC fifo-1 hit limit (max 1023 (hard) 900 (soft):%d\n",&
SC_hitlimit);
892 printf(
"SC fifo-1 hit limit (max 1023 (hard) 900 (soft):%d\n",
SC_hitlimit);
893 fscanf(infile,
"S fifo-1 hit limit (max 1023 (hard) 900 (soft):%d\n",&
S_hitlimit);
895 printf(
"S fifo-1 hit limit (max 1023 (hard) 900 (soft):%d\n",
S_hitlimit);
898 fscanf(infile,
"Skip a ROC in ch 1-9, bits 10-5 chnl, bits 0-4 ROC-1:%d\n",&
N_testreg);
900 printf(
"Skip a ROC in ch 1-9, bits 10-5 chnl, bits 0-4 ROC-1:%d\n",
N_testreg);
901 fscanf(infile,
"Skip a ROC in ch 10-18, bits 10-5 chnl, bits 0-4 ROC-1:%d\n",&
NC_testreg);
903 printf(
"Skip a ROC in ch 10-18, bits 10-5 chnl, bits 0-4 ROC-1:%d\n",
NC_testreg);
904 fscanf(infile,
"Skip a ROC in ch 19-27, bits 10-5 chnl, bits 0-4 ROC-1:%d\n",&
SC_testreg);
906 printf(
"Skip a ROC in ch 19-27, bits 10-5 chnl, bits 0-4 ROC-1:%d\n",
SC_testreg);
907 fscanf(infile,
"Skip a ROC in ch 28-36, bits 10-5 chnl, bits 0-4 ROC-1:%d\n",&
S_testreg);
909 printf(
"Skip a ROC in ch 28-36, bits 10-5 chnl, bits 0-4 ROC-1:%d\n",
S_testreg);
948 for(
int i=0;
i<36;
i++){
966 for(
int i=0;
i<3;
i++){
976 for(
int i=0;
i<36;
i++) {
977 for(
int j=0;
j<26;
j++) {
1024 std::string mthn =
"[PixelFEDCard::writeASCII()]\t\t\t\t " ;
1030 if (dir!=
"") dir+=
"/";
1034 FILE *
outfile = fopen((filename.c_str()),
"w");
1035 if (outfile ==
NULL) {
1036 cout<< __LINE__ <<
"]\t" << mthn <<
"Could not open file: " << filename <<
" for writing" << endl;
1041 fprintf(outfile,
"FED Base address :0x%lx\n",
1043 fprintf(outfile,
"FEDID Number :0x%lx\n",
1048 for(
int i=0;
i<36;
i++){
1050 fprintf(outfile,
"Number of ROCs Chnl %d:%d\n",ijx,NRocs[
i]);
1054 fprintf(outfile,
"Optical reciever 1 Capacitor Adjust(0-3):%d\n",
opt_cap[0]);
1055 fprintf(outfile,
"Optical reciever 2 Capacitor Adjust(0-3):%d\n",
opt_cap[1]);
1056 fprintf(outfile,
"Optical reciever 3 Capacitor Adjust(0-3):%d\n",
opt_cap[2]);
1057 fprintf(outfile,
"Optical reciever 1 Input Offset (0-15) :%d\n",
opt_inadj[0]);
1058 fprintf(outfile,
"Optical reciever 2 Input Offset (0-15) :%d\n",
opt_inadj[1]);
1059 fprintf(outfile,
"Optical reciever 3 Input Offset (0-15) :%d\n",
opt_inadj[2]);
1060 fprintf(outfile,
"Optical reciever 1 Output Offset (0-3) :%d\n",
opt_ouadj[0]);
1061 fprintf(outfile,
"Optical reciever 2 Output Offset (0-3) :%d\n",
opt_ouadj[1]);
1062 fprintf(outfile,
"Optical reciever 3 Output Offset (0-3) :%d\n",
opt_ouadj[2]);
1065 for(
int i=0;
i<36;
i++) {
1066 fprintf(outfile,
"Offset DAC channel %d:%d\n",
i+1,
offs_dac[
i]);
1070 fprintf(outfile,
"Clock Phase Bits ch 1-9:0x%x\n",
clkphs1_9 );
1071 fprintf(outfile,
"Clock Phase Bits ch 10-18:0x%x\n",
clkphs10_18);
1072 fprintf(outfile,
"Clock Phase Bits ch 19-27:0x%x\n",
clkphs19_27);
1073 fprintf(outfile,
"Clock Phase Bits ch 28-36:0x%x\n",
clkphs28_36);
1076 for(
int i=0;
i<36;
i++){
1077 fprintf(outfile,
"Black HiThold ch %d:%d \n",
i+1,
BlackHi[
i]);
1078 fprintf(outfile,
"Black LoThold ch %d:%d \n",i+1,
BlackLo[i]);
1079 fprintf(outfile,
"ULblack Thold ch %d:%d \n",i+1,
Ublack[i]);
1083 for(
int i=0;
i<36;
i++) {
1084 fprintf(outfile,
"Delay channel %d(0-15):%d\n",
i+1,
DelayCh[
i]);
1088 for(
int i=0;
i<36;
i++) {
1089 fprintf(outfile,
"TBM level 0 Channel %d:%d\n",
i+1,
TBM_L0[
i]);
1090 fprintf(outfile,
"TBM level 1 Channel %d:%d\n",i+1,
TBM_L1[i]);
1091 fprintf(outfile,
"TBM level 2 Channel %d:%d\n",i+1,
TBM_L2[i]);
1092 fprintf(outfile,
"TBM level 3 Channel %d:%d\n",i+1,
TBM_L3[i]);
1093 fprintf(outfile,
"TBM level 4 Channel %d:%d\n",i+1,
TBM_L4[i]);
1095 for(
int j=0;
j<NRocs[
i];
j++) {
1096 fprintf(outfile,
"ROC%d level 0 Channel %d :%d\n",
1098 fprintf(outfile,
"ROC%d level 1 Channel %d :%d\n",
1100 fprintf(outfile,
"ROC%d level 2 Channel %d :%d\n",
1102 fprintf(outfile,
"ROC%d level 3 Channel %d :%d\n",
1104 fprintf(outfile,
"ROC%d level 4 Channel %d :%d\n",
1108 fprintf(outfile,
"TRLR level 0 Channel %d:%d\n",i+1,
TRL_L0[i]);
1109 fprintf(outfile,
"TRLR level 1 Channel %d:%d\n",i+1,
TRL_L1[i]);
1110 fprintf(outfile,
"TRLR level 2 Channel %d:%d\n",i+1,
TRL_L2[i]);
1111 fprintf(outfile,
"TRLR level 3 Channel %d:%d\n",i+1,
TRL_L3[i]);
1112 fprintf(outfile,
"TRLR level 4 Channel %d:%d\n",i+1,
TRL_L4[i]);
1117 fprintf(outfile,
"Channel Enbable bits chnls 1-9 (on = 0):0x%x\n",
1119 fprintf(outfile,
"Channel Enbable bits chnls 10-18(on = 0):0x%x\n",
1121 fprintf(outfile,
"Channel Enbable bits chnls 19-27(on = 0):0x%x\n",
1123 fprintf(outfile,
"Channel Enbable bits chnls 28-36(on = 0):0x%x\n",
1127 fprintf(outfile,
"TTCrx Coarse Delay Register 2:%d\n",
CoarseDel);
1128 fprintf(outfile,
"TTCrc ClkDes2 Register 3:0x%x\n",
ClkDes2);
1129 fprintf(outfile,
"TTCrc Fine Dlay ClkDes2 Reg 1:%d\n",
FineDes2Del);
1132 fprintf(outfile,
"Center Chip Control Reg:0x%x\n",
Ccntrl);
1133 fprintf(outfile,
"Initial Slink DAQ mode:%d\n",
modeRegister);
1136 fprintf(outfile,
"Channel ADC Gain bits chnls 1-12(1Vpp = 0):0x%x\n",
1138 fprintf(outfile,
"Channel ADC Gain bits chnls 13-20(1Vpp = 0):0x%x\n",
1140 fprintf(outfile,
"Channel ADC Gain bits chnls 21-28(1Vpp = 0):0x%x\n",
1142 fprintf(outfile,
"Channel ADC Gain bits chnls 29-36(1Vpp = 0):0x%x\n",
1146 fprintf(outfile,
"Channel Baseline Enbable chnls 1-9 (on = (0x1ff<<16)+):0x%x\n",
1148 fprintf(outfile,
"Channel Baseline Enbable chnls 10-18(on = (0x1ff<<16)+):0x%x\n",
1150 fprintf(outfile,
"Channel Baseline Enbable chnls 19-27(on = (0x1ff<<16)+):0x%x\n",
1152 fprintf(outfile,
"Channel Baseline Enbable chnls 28-36(on = (0x1ff<<16)+):0x%x\n",
1156 fprintf(outfile,
"TBM trailer mask chnls 1-9 (0xff = all masked):0x%x\n",
1158 fprintf(outfile,
"TBM trailer mask chnls 10-18(0xff = all masked):0x%x\n",
1160 fprintf(outfile,
"TBM trailer mask chnls 19-27(0xff = all masked):0x%x\n",
1162 fprintf(outfile,
"TBM trailer mask chnls 28-36(0xff = all masked):0x%x\n",
1166 fprintf(outfile,
"Private 8 bit word chnls 1-9 :0x%x\n",
1168 fprintf(outfile,
"Private 8 bit word chnls 10-18:0x%x\n",
1170 fprintf(outfile,
"Private 8 bit word chnls 19-27:0x%x\n",
1172 fprintf(outfile,
"Private 8 bit word chnls 28-36:0x%x\n",
1176 fprintf(outfile,
"Special Random testDAC mode (on = 0x1, off=0x0):0x%x\n",
1180 fprintf(outfile,
"Number of Consecutive (max 1023) Out of Syncs till TTs OOS set:%d\n",
1184 fprintf(outfile,
"Number of Consecutive (max 1023) Empty events till TTs ERR set:%d\n",
1188 fprintf(outfile,
"N Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",
1192 fprintf(outfile,
"NC Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",
1196 fprintf(outfile,
"SC Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",
1200 fprintf(outfile,
"S Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",
1204 fprintf(outfile,
"Fifo-3 almost full level,sets TTs WARN (max 8191):%d\n",
1207 fprintf(outfile,
"FED Master delay 0=0,1=32,2=48,3=64:%d\n",
1210 fprintf(outfile,
"TTCrx Register 0 fine delay ClkDes1:%d\n",
1213 int checkword=91509;
1215 fprintf(outfile,
"Params FED file check word:%d\n",
1220 fprintf(outfile,
"N fifo-1 hit limit (max 1023 (hard) 900 (soft):%d\n",
1223 fprintf(outfile,
"NC fifo-1 hit limit (max 1023 (hard) 900 (soft):%d\n",
1226 fprintf(outfile,
"SC fifo-1 hit limit (max 1023 (hard) 900 (soft):%d\n",
1229 fprintf(outfile,
"S fifo-1 hit limit (max 1023 (hard) 900 (soft):%d\n",
1234 fprintf(outfile,
"Skip a ROC in ch 1-9, bits 10-5 chnl, bits 0-4 ROC-1:%d\n",
1237 fprintf(outfile,
"Skip a ROC in ch 10-18, bits 10-5 chnl, bits 0-4 ROC-1:%d\n",
1240 fprintf(outfile,
"Skip a ROC in ch 19-27, bits 10-5 chnl, bits 0-4 ROC-1:%d\n",
1243 fprintf(outfile,
"Skip a ROC in ch 28-36, bits 10-5 chnl, bits 0-4 ROC-1:%d\n",
1258 std::ofstream *fedstream,
1259 std::ofstream *rocstream,
1260 std::ofstream *tbmstream)
const
1262 std::string mthn =
"[PixelFEDCard::writeXMLHeader()]\t\t\t " ;
1263 std::stringstream fedfullPath ;
1264 std::stringstream rocfullPath ;
1265 std::stringstream tbmfullPath ;
1270 std::cout << __LINE__ <<
"]\t" << mthn <<
"Writing to: " << fedfullPath.str() <<
"" << std::endl ;
1272 fedstream->open(fedfullPath.str().c_str()) ;
1274 *fedstream <<
"<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl ;
1275 *fedstream <<
"<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl ;
1276 *fedstream <<
"" << std::endl ;
1277 *fedstream <<
" <HEADER>" << std::endl ;
1278 *fedstream <<
" <HINTS mode='load-as-group' /> " << std::endl ;
1279 *fedstream <<
" <TYPE>" << std::endl ;
1280 *fedstream <<
" <EXTENSION_TABLE_NAME>FED_CONFIGURATION</EXTENSION_TABLE_NAME>" << std::endl ;
1281 *fedstream <<
" <NAME>Pixel FED Configuration</NAME>" << std::endl ;
1282 *fedstream <<
" </TYPE>" << std::endl ;
1283 *fedstream <<
" <RUN>" << std::endl ;
1284 *fedstream <<
" <RUN_TYPE>Pixel FED Configuration</RUN_TYPE>" << std::endl ;
1285 *fedstream <<
" <RUN_NUMBER>1</RUN_NUMBER>" << std::endl ;
1287 *fedstream <<
" <LOCATION>CERN P5</LOCATION>" << std::endl ;
1288 *fedstream <<
" </RUN>" << std::endl ;
1289 *fedstream <<
" </HEADER>" << std::endl ;
1290 *fedstream <<
"" << std::endl ;
1291 *fedstream <<
" <DATA_SET>" << std::endl ;
1292 *fedstream <<
"" << std::endl ;
1293 *fedstream <<
" <VERSION>" << version <<
"</VERSION>" << std::endl ;
1294 *fedstream <<
" <COMMENT_DESCRIPTION>" <<
getComment() <<
"</COMMENT_DESCRIPTION>" << std::endl ;
1295 *fedstream <<
" <CREATED_BY_USER>" <<
getAuthor() <<
"</CREATED_BY_USER>" << std::endl ;
1296 *fedstream <<
"" << std::endl ;
1297 *fedstream <<
" <PART>" << std::endl ;
1298 *fedstream <<
" <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl ;
1299 *fedstream <<
" <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl ;
1300 *fedstream <<
" </PART>" << std::endl ;
1304 std::cout << __LINE__ <<
"]\t" << mthn <<
"Writing to: " << rocfullPath.str() <<
"" << std::endl ;
1306 rocstream->open(rocfullPath.str().c_str()) ;
1309 *rocstream <<
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" << std::endl ;
1310 *rocstream <<
"<ROOT xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" << std::endl ;
1311 *rocstream <<
"" << std::endl ;
1312 *rocstream <<
" <HEADER>" << std::endl ;
1313 *rocstream <<
" <HINTS mode='only-det-root,load-as-group'/>" << std::endl ;
1314 *rocstream <<
" <TYPE>" << std::endl ;
1315 *rocstream <<
" <EXTENSION_TABLE_NAME>ROC_ANALOG_LEVELS</EXTENSION_TABLE_NAME>" << std::endl ;
1316 *rocstream <<
" <NAME>ROC Analog Levels</NAME>" << std::endl ;
1317 *rocstream <<
" </TYPE>" << std::endl ;
1318 *rocstream <<
" <RUN>" << std::endl ;
1319 *rocstream <<
" <RUN_TYPE>ROC Analog Levels</RUN_TYPE>" << std::endl ;
1320 *rocstream <<
" <RUN_NUMBER>1</RUN_NUMBER> " << std::endl ;
1322 *rocstream <<
" <CREATED_BY_USER>Umesh Joshi</CREATED_BY_USER> " << std::endl ;
1323 *rocstream <<
" <LOCATION>CERN</LOCATION> " << std::endl ;
1324 *rocstream <<
" <COMMENT_DESCRIPTION>ROC Analog Levels Template</COMMENT_DESCRIPTION>" << std::endl ;
1325 *rocstream <<
" </RUN>" << std::endl ;
1326 *rocstream <<
" </HEADER>" << std::endl ;
1327 *rocstream <<
"" << std::endl ;
1328 *rocstream <<
" <DATA_SET>" << std::endl ;
1329 *rocstream <<
" <COMMENT_DESCRIPTION>ROC Analog Levels Template</COMMENT_DESCRIPTION>" << std::endl ;
1330 *rocstream <<
" <VERSION>" << version <<
"</VERSION>" << std::endl ;
1331 *rocstream <<
" " << std::endl ;
1332 *rocstream <<
" <PART>" << std::endl ;
1333 *rocstream <<
" <SERIAL_NUMBER>CMS-PIXEL-ROOT</SERIAL_NUMBER>" << std::endl ;
1334 *rocstream <<
" <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl ;
1335 *rocstream <<
" </PART>" << std::endl ;
1339 std::cout << __LINE__ <<
"]\t" << mthn <<
"Writing to: " << tbmfullPath.str() <<
"" << std::endl ;
1341 tbmstream->open(tbmfullPath.str().c_str()) ;
1344 *tbmstream <<
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" << std::endl ;
1345 *tbmstream <<
"<ROOT xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" << std::endl ;
1346 *tbmstream <<
"" << std::endl ;
1347 *tbmstream <<
" <HEADER>" << std::endl ;
1348 *tbmstream <<
" <HINTS mode='only-det-root,load-as-group' />" << std::endl ;
1349 *tbmstream <<
" <TYPE>" << std::endl ;
1350 *tbmstream <<
" <EXTENSION_TABLE_NAME>TBM_ANALOG_LEVELS</EXTENSION_TABLE_NAME>" << std::endl ;
1351 *tbmstream <<
" <NAME>TBM Analog Levels</NAME>" << std::endl ;
1352 *tbmstream <<
" </TYPE>" << std::endl ;
1353 *tbmstream <<
" <RUN>" << std::endl ;
1354 *tbmstream <<
" <RUN_TYPE>TBM Analog Levels</RUN_TYPE>" << std::endl ;
1355 *tbmstream <<
" <RUN_NUMBER>1</RUN_NUMBER>" << std::endl ;
1357 *tbmstream <<
" <CREATED_BY_USER>Umesh Joshi</CREATED_BY_USER> " << std::endl ;
1358 *tbmstream <<
" <LOCATION>CERN</LOCATION> " << std::endl ;
1359 *tbmstream <<
" <COMMENT_DESCRIPTION>TBM Analog Levels</COMMENT_DESCRIPTION>" << std::endl ;
1360 *tbmstream <<
" </RUN>" << std::endl ;
1361 *tbmstream <<
" </HEADER>" << std::endl ;
1362 *tbmstream <<
"" << std::endl ;
1363 *tbmstream <<
" <DATA_SET>" << std::endl ;
1364 *tbmstream <<
" <VERSION>" << version <<
"</VERSION>" << std::endl ;
1365 *tbmstream <<
" " << std::endl ;
1366 *tbmstream <<
" <PART>" << std::endl ;
1367 *tbmstream <<
" <SERIAL_NUMBER>CMS-PIXEL-ROOT</SERIAL_NUMBER>" << std::endl ;
1368 *tbmstream <<
" <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl ;
1369 *tbmstream <<
" </PART>" << std::endl ;
1375 std::string mthn =
"[PixelFEDCard::writeXMLHeader()]\t\t\t " ;
1379 std::cout << __LINE__ <<
"]\t" << mthn <<
"Writing to: " << fullPath.str() <<
"" << std::endl ;
1381 out->open(fullPath.str().c_str()) ;
1383 *out <<
"<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl ;
1384 *out <<
"<ROOT>" << std::endl ;
1385 *out <<
"" << std::endl ;
1386 *out <<
" <HEADER>" << std::endl ;
1387 *out <<
" <TYPE>" << std::endl ;
1388 *out <<
" <EXTENSION_TABLE_NAME>FED_CONFIGURATION</EXTENSION_TABLE_NAME>" << std::endl ;
1389 *out <<
" <NAME>Pixel FED Configuration</NAME>" << std::endl ;
1390 *out <<
" </TYPE>" << std::endl ;
1391 *out <<
" <RUN>" << std::endl ;
1392 *out <<
" <RUN_TYPE>Pixel FED Configuration</RUN_TYPE>" << std::endl ;
1393 *out <<
" <RUN_NUMBER>1</RUN_NUMBER>" << std::endl ;
1395 *out <<
" <COMMENT_DESCRIPTION>Pixel FED Configuration</COMMENT_DESCRIPTION>" << std::endl ;
1396 *out <<
" <LOCATION>CERN TAC</LOCATION>" << std::endl ;
1397 *out <<
" <CREATED_BY_USER>Dario Menasce</CREATED_BY_USER>" << std::endl ;
1398 *out <<
" </RUN>" << std::endl ;
1399 *out <<
" </HEADER>" << std::endl ;
1400 *out <<
"" << std::endl ;
1401 *out <<
" <DATA_SET>" << std::endl ;
1402 *out <<
"" << std::endl ;
1403 *out <<
" <VERSION>" << version <<
"</VERSION>" << std::endl ;
1404 *out <<
" <COMMENT_DESCRIPTION>Pixel FED Configuration</COMMENT_DESCRIPTION>" << std::endl ;
1405 *out <<
"" << std::endl ;
1406 *out <<
" <PART>" << std::endl ;
1407 *out <<
" <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl ;
1408 *out <<
" <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl ;
1409 *out <<
" </PART>" << std::endl ;
1413 std::string mthn =
"[PixelFEDCard::writeXML()]\t\t\t " ;
1415 *out <<
" <DATA>" << std::endl ;
1416 *out <<
" " << std::endl ;
1417 *out <<
" <PXLFED_NAME>PxlFED_" <<
fedNumber<<
"</PXLFED_NAME>" << std::endl ;
1418 *out <<
" <VME_ADDRESS>268435456</VME_ADDRESS>" << std::endl ;
1423 *out <<
"" << std::endl ;
1424 *out <<
" <CHANNEL_ID>1</CHANNEL_ID>" << std::endl ;
1425 *out <<
" <NUMBER_OF_ROCS>21</NUMBER_OF_ROCS>" << std::endl ;
1426 *out <<
" <CHANNEL_OFFSET_DAC_SETTINGS>0</CHANNEL_OFFSET_DAC_SETTINGS>" << std::endl ;
1427 *out <<
" <CHANNEL_DELAY_SETTINGS>3</CHANNEL_DELAY_SETTINGS>" << std::endl ;
1428 *out <<
" <CHANNEL_BLACK_HIGH>400</CHANNEL_BLACK_HIGH>" << std::endl ;
1429 *out <<
" <CHANNEL_BLACK_LOW>150</CHANNEL_BLACK_LOW>" << std::endl ;
1430 *out <<
" <CHANNEL_ULTRA_BLACK>120</CHANNEL_ULTRA_BLACK>" << std::endl ;
1431 *out <<
"" << std::endl ;
1432 *out <<
" <OPT1_CAP>0</OPT1_CAP>" << std::endl ;
1433 *out <<
" <OPT2_CAP>0</OPT2_CAP>" << std::endl ;
1434 *out <<
" <OPT3_CAP>0</OPT3_CAP>" << std::endl ;
1435 *out <<
" <OPT1_INP>0</OPT1_INP>" << std::endl ;
1436 *out <<
" <OPT2_INP>0</OPT2_INP>" << std::endl ;
1437 *out <<
" <OPT3_INP>0</OPT3_INP>" << std::endl ;
1438 *out <<
" <OPT1_OUT>0</OPT1_OUT>" << std::endl ;
1439 *out <<
" <OPT2_OUT>0</OPT2_OUT>" << std::endl ;
1440 *out <<
" <OPT3_OUT>0</OPT3_OUT>" << std::endl ;
1441 *out <<
" <NORTH_CLKPHB>511</NORTH_CLKPHB>" << std::endl ;
1442 *out <<
" <NORTHCENTER_CLKPHB>511</NORTHCENTER_CLKPHB>" << std::endl ;
1443 *out <<
" <SOUTHCENTER_CLKPHB>511</SOUTHCENTER_CLKPHB>" << std::endl ;
1444 *out <<
" <SOUTH_CLKPHB>511</SOUTH_CLKPHB>" << std::endl ;
1445 *out <<
" <NORTH_CTRL>0</NORTH_CTRL> " << std::endl ;
1446 *out <<
" <NORTHCENTER_CTRL>0</NORTHCENTER_CTRL>" << std::endl ;
1447 *out <<
" <SOUTHCENTER_CTRL>0</SOUTHCENTER_CTRL>" << std::endl ;
1448 *out <<
" <SOUTH_CTRL>0</SOUTH_CTRL>" << std::endl ;
1449 *out <<
" <REG1_TTCRX_FDLA>5</REG1_TTCRX_FDLA>" << std::endl ;
1450 *out <<
" <REG2_TTCRX_CDLA>0</REG2_TTCRX_CDLA>" << std::endl ;
1451 *out <<
" <REG3_TTCRX_CLKD2>155</REG3_TTCRX_CLKD2>" << std::endl ;
1452 *out <<
" <CENTER_CTRL>0</CENTER_CTRL>" << std::endl ;
1453 *out <<
" <CENTER_MODE>0</CENTER_MODE>" << std::endl ;
1454 *out <<
" <B1_ADCGN>0</B1_ADCGN>" << std::endl ;
1455 *out <<
" <B2_ADCGN>0</B2_ADCGN>" << std::endl ;
1456 *out <<
" <B3_ADCGN>0</B3_ADCGN>" << std::endl ;
1457 *out <<
" <B4_ADCGN>0</B4_ADCGN>" << std::endl ;
1458 *out <<
" <NORTH_BADJ>330</NORTH_BADJ>" << std::endl ;
1459 *out <<
" <NORTHCENTER_BADJ>330</NORTHCENTER_BADJ>" << std::endl ;
1460 *out <<
" <SOUTHCENTER_BADJ>330</SOUTHCENTER_BADJ>" << std::endl ;
1461 *out <<
" <SOUTH_BADJ>330</SOUTH_BADJ>" << std::endl ;
1462 *out <<
" <NORTH_TBMMASK>2</NORTH_TBMMASK>" << std::endl ;
1463 *out <<
" <NORTHCENTER_TBMMASK>2</NORTHCENTER_TBMMASK>" << std::endl ;
1464 *out <<
" <SOUTHCENTER_TBMMASK>2</SOUTHCENTER_TBMMASK>" << std::endl ;
1465 *out <<
" <SOUTH_TBMMASK>2</SOUTH_TBMMASK>" << std::endl ;
1466 *out <<
" <NORTH_PWORD>177</NORTH_PWORD>" << std::endl ;
1467 *out <<
" <NORTHCENTER_PWORD>178</NORTHCENTER_PWORD>" << std::endl ;
1468 *out <<
" <SOUTHCENTER_PWORD>179</SOUTHCENTER_PWORD>" << std::endl ;
1469 *out <<
" <SOUTH_PWORD>180</SOUTH_PWORD>" << std::endl ;
1470 *out <<
" <SPECDAC>0</SPECDAC>" << std::endl ;
1471 *out <<
" <OOS_LVL>0</OOS_LVL>" << std::endl ;
1472 *out <<
" <ERR_LVL>0</ERR_LVL>" << std::endl ;
1473 *out <<
" <NORTH_FIFO1_BZ_LVL>900</NORTH_FIFO1_BZ_LVL>" << std::endl ;
1474 *out <<
" <NORTHCENTER_FIFO1_BZ_LVL>900</NORTHCENTER_FIFO1_BZ_LVL>" << std::endl ;
1475 *out <<
" <SOUTHCENTER_FIFO1_BZ_LVL>900</SOUTHCENTER_FIFO1_BZ_LVL>" << std::endl ;
1476 *out <<
" <SOUTH_FIFO1_BZ_LVL>900</SOUTH_FIFO1_BZ_LVL>" << std::endl ;
1477 *out <<
" <FIFO3_WRN_LVL>7680</FIFO3_WRN_LVL> " << std::endl ;
1478 *out <<
" <FED_MASTER_DELAY>0</FED_MASTER_DELAY>" << std::endl ;
1479 *out <<
" <NO_HITLIMIT>0</NO_HITLIMIT>" << std::endl ;
1480 *out <<
" <NC_HITLIMIT>0</NC_HITLIMIT>" << std::endl ;
1481 *out <<
" <SC_HITLIMIT>0</SC_HITLIMIT>" << std::endl ;
1482 *out <<
" <SO_HITLIMIT>0</SO_HITLIMIT>" << std::endl ;
1483 *out <<
" <NO_TESTREG>0</NO_TESTREG>" << std::endl ;
1484 *out <<
" <NC_TESTREG>0</NC_TESTREG>" << std::endl ;
1485 *out <<
" <SC_TESTREG>0</SC_TESTREG>" << std::endl ;
1486 *out <<
" <SO_TESTREG>0</SO_TESTREG>" << std::endl ;
1487 *out <<
" " << std::endl ;
1488 *out <<
" </DATA>" << std::endl ;
1489 *out <<
" " << std::endl ;
1494 std::ofstream *rocstream,
1495 std::ofstream *tbmstream)
const
1497 std::string mthn =
"[PixelFEDCard::writeXML()]\t\t\t " ;
1499 for(
int i=0;
i<36;
i++)
1501 *fedstream <<
" <DATA>" << std::endl ;
1502 *fedstream <<
" " << std::endl ;
1503 *fedstream <<
" <PIXEL_FED>" <<
fedNumber <<
"</PIXEL_FED>" << std::endl ;
1504 *fedstream <<
" <VME_ADDRS_HEX>0x" << hex <<
FEDBASE_0 << dec <<
"</VME_ADDRS_HEX>" << std::endl ;
1505 *fedstream <<
"" << std::endl ;
1506 *fedstream <<
" <CHANNEL_ID>" <<
i+1 <<
"</CHANNEL_ID>" << std::endl ;
1507 *fedstream <<
" <NUM_ROCS>" << NRocs[
i] <<
"</NUM_ROCS>" << std::endl ;
1508 *fedstream <<
" <CHAN_OFFST_DAC>" <<
offs_dac[
i] <<
"</CHAN_OFFST_DAC>" << std::endl ;
1509 *fedstream <<
" <CHAN_DELAY>" <<
DelayCh[
i] <<
"</CHAN_DELAY>" << std::endl ;
1510 *fedstream <<
" <CHAN_BHIGH>" <<
BlackHi[
i] <<
"</CHAN_BHIGH>" << std::endl ;
1511 *fedstream <<
" <CHAN_BLOW>" <<
BlackLo[
i] <<
"</CHAN_BLOW>" << std::endl ;
1512 *fedstream <<
" <CHAN_UB>" <<
Ublack[
i] <<
"</CHAN_UB>" << std::endl ;
1513 *fedstream <<
"" << std::endl ;
1514 *fedstream <<
" <OPT1_CAP>" <<
opt_cap[0] <<
"</OPT1_CAP>" << std::endl ;
1515 *fedstream <<
" <OPT2_CAP>" <<
opt_cap[1] <<
"</OPT2_CAP>" << std::endl ;
1516 *fedstream <<
" <OPT3_CAP>" <<
opt_cap[2] <<
"</OPT3_CAP>" << std::endl ;
1517 *fedstream <<
" <OPT1_INP>" <<
opt_inadj[0] <<
"</OPT1_INP>" << std::endl ;
1518 *fedstream <<
" <OPT2_INP>" <<
opt_inadj[1] <<
"</OPT2_INP>" << std::endl ;
1519 *fedstream <<
" <OPT3_INP>" <<
opt_inadj[2] <<
"</OPT3_INP>" << std::endl ;
1520 *fedstream <<
" <OPT1_OUT>" <<
opt_ouadj[0] <<
"</OPT1_OUT>" << std::endl ;
1521 *fedstream <<
" <OPT2_OUT>" <<
opt_ouadj[1] <<
"</OPT2_OUT>" << std::endl ;
1522 *fedstream <<
" <OPT3_OUT>" <<
opt_ouadj[2] <<
"</OPT3_OUT>" << std::endl ;
1523 *fedstream <<
" <NORTH_CLKPHB>" <<
clkphs1_9 <<
"</NORTH_CLKPHB>" << std::endl ;
1524 *fedstream <<
" <NORTHCENTER_CLKPHB>" <<
clkphs10_18 <<
"</NORTHCENTER_CLKPHB>" << std::endl ;
1525 *fedstream <<
" <SOUTHCENTER_CLKPHB>" <<
clkphs19_27 <<
"</SOUTHCENTER_CLKPHB>" << std::endl ;
1526 *fedstream <<
" <SOUTH_CLKPHB>" <<
clkphs28_36 <<
"</SOUTH_CLKPHB>" << std::endl ;
1527 *fedstream <<
" <NORTH_CTRL>" <<
Ncntrl <<
"</NORTH_CTRL> " << std::endl ;
1528 *fedstream <<
" <NORTHCENTER_CTRL>" <<
NCcntrl <<
"</NORTHCENTER_CTRL>" << std::endl ;
1529 *fedstream <<
" <SOUTHCENTER_CTRL>" <<
SCcntrl <<
"</SOUTHCENTER_CTRL>" << std::endl ;
1530 *fedstream <<
" <SOUTH_CTRL>" <<
Scntrl <<
"</SOUTH_CTRL>" << std::endl ;
1531 *fedstream <<
" <REG0_TTCRX_FDLA>" <<
FineDes1Del <<
"</REG0_TTCRX_FDLA>" << std::endl ;
1532 *fedstream <<
" <REG1_TTCRX_FDLA>" <<
FineDes2Del <<
"</REG1_TTCRX_FDLA>" << std::endl ;
1533 *fedstream <<
" <REG2_TTCRX_CDLA>" <<
CoarseDel <<
"</REG2_TTCRX_CDLA>" << std::endl ;
1534 *fedstream <<
" <REG3_TTCRX_CLKD2>" <<
ClkDes2 <<
"</REG3_TTCRX_CLKD2>" << std::endl ;
1535 *fedstream <<
" <CENTER_CTRL>" <<
Ccntrl <<
"</CENTER_CTRL>" << std::endl ;
1536 *fedstream <<
" <CENTER_MODE>" <<
modeRegister <<
"</CENTER_MODE>" << std::endl ;
1537 *fedstream <<
" <B1_ADCGN>" <<
Nadcg <<
"</B1_ADCGN>" << std::endl ;
1538 *fedstream <<
" <B2_ADCGN>" <<
NCadcg <<
"</B2_ADCGN>" << std::endl ;
1539 *fedstream <<
" <B3_ADCGN>" <<
SCadcg <<
"</B3_ADCGN>" << std::endl ;
1540 *fedstream <<
" <B4_ADCGN>" <<
Sadcg <<
"</B4_ADCGN>" << std::endl ;
1543 *fedstream <<
" <NORTH_BADJ>" <<
Nbaseln <<
"</NORTH_BADJ>" << std::endl ;
1544 *fedstream <<
" <NORTHCENTER_BADJ>" <<
NCbaseln <<
"</NORTHCENTER_BADJ>" << std::endl ;
1545 *fedstream <<
" <SOUTHCENTER_BADJ>" <<
SCbaseln <<
"</SOUTHCENTER_BADJ>" << std::endl ;
1546 *fedstream <<
" <SOUTH_BADJ>" <<
Sbaseln <<
"</SOUTH_BADJ>" << std::endl ;
1547 *fedstream <<
" <NORTH_TBMMASK>" <<
N_TBMmask <<
"</NORTH_TBMMASK>" << std::endl ;
1548 *fedstream <<
" <NORTHCENTER_TBMMASK>" <<
NC_TBMmask <<
"</NORTHCENTER_TBMMASK>" << std::endl ;
1549 *fedstream <<
" <SOUTHCENTER_TBMMASK>" <<
SC_TBMmask <<
"</SOUTHCENTER_TBMMASK>" << std::endl ;
1550 *fedstream <<
" <SOUTH_TBMMASK>" <<
S_TBMmask <<
"</SOUTH_TBMMASK>" << std::endl ;
1551 *fedstream <<
" <NORTH_PWORD>" <<
N_Pword <<
"</NORTH_PWORD>" << std::endl ;
1552 *fedstream <<
" <NORTHCENTER_PWORD>" <<
NC_Pword <<
"</NORTHCENTER_PWORD>" << std::endl ;
1553 *fedstream <<
" <SOUTHCENTER_PWORD>" <<
SC_Pword <<
"</SOUTHCENTER_PWORD>" << std::endl ;
1554 *fedstream <<
" <SOUTH_PWORD>" <<
S_Pword <<
"</SOUTH_PWORD>" << std::endl ;
1555 *fedstream <<
" <SPECDAC>" <<
SpecialDac <<
"</SPECDAC>" << std::endl ;
1556 *fedstream <<
" <OOS_LVL>" <<
Ooslvl <<
"</OOS_LVL>" << std::endl ;
1557 *fedstream <<
" <ERR_LVL>" <<
Errlvl <<
"</ERR_LVL>" << std::endl ;
1558 *fedstream <<
" <NORTH_FIFO1_BZ_LVL>" <<
Nfifo1Bzlvl <<
"</NORTH_FIFO1_BZ_LVL>" << std::endl ;
1559 *fedstream <<
" <NORTHCENTER_FIFO1_BZ_LVL>" <<
NCfifo1Bzlvl <<
"</NORTHCENTER_FIFO1_BZ_LVL>" << std::endl ;
1560 *fedstream <<
" <SOUTHCENTER_FIFO1_BZ_LVL>" <<
SCfifo1Bzlvl <<
"</SOUTHCENTER_FIFO1_BZ_LVL>" << std::endl ;
1561 *fedstream <<
" <SOUTH_FIFO1_BZ_LVL>" <<
Sfifo1Bzlvl <<
"</SOUTH_FIFO1_BZ_LVL>" << std::endl ;
1562 *fedstream <<
" <FIFO3_WRN_LVL>" <<
fifo3Wrnlvl <<
"</FIFO3_WRN_LVL>" << std::endl ;
1563 *fedstream <<
" <FED_MASTER_DELAY>" <<
FedTTCDelay <<
"</FED_MASTER_DELAY>" << std::endl ;
1564 *fedstream <<
" <NO_HITLIMIT>" <<
N_hitlimit <<
"</NO_HITLIMIT>" << std::endl ;
1565 *fedstream <<
" <NC_HITLIMIT>" <<
NC_hitlimit <<
"</NC_HITLIMIT>" << std::endl ;
1566 *fedstream <<
" <SC_HITLIMIT>" <<
SC_hitlimit <<
"</SC_HITLIMIT>" << std::endl ;
1567 *fedstream <<
" <SO_HITLIMIT>" <<
S_hitlimit <<
"</SO_HITLIMIT>" << std::endl ;
1568 *fedstream <<
" <NO_TESTREG>" <<
N_testreg <<
"</NO_TESTREG>" << std::endl ;
1569 *fedstream <<
" <NC_TESTREG>" <<
NC_testreg <<
"</NC_TESTREG>" << std::endl ;
1570 *fedstream <<
" <SC_TESTREG>" <<
SC_testreg <<
"</SC_TESTREG>" << std::endl ;
1571 *fedstream <<
" <SO_TESTREG>" <<
S_testreg <<
"</SO_TESTREG>" << std::endl ;
1573 *fedstream <<
" " << std::endl ;
1574 *fedstream <<
" </DATA>" << std::endl ;
1575 *fedstream <<
" " << std::endl ;
1579 for(
int i=0;
i<36;
i++)
1581 for(
int j=0;
j<NRocs[
i];
j++)
1583 *rocstream <<
"" << std::endl ;
1584 *rocstream <<
" <DATA>" << std::endl ;
1585 *rocstream <<
" <PIXEL_FED>" <<
fedNumber <<
"</PIXEL_FED>" << std::endl ;
1586 *rocstream <<
" <FED_CHAN>" <<
i+1 <<
"</FED_CHAN>" << std::endl ;
1587 *rocstream <<
" <FED_ROC_NUM>" <<
j <<
"</FED_ROC_NUM>" << std::endl ;
1588 *rocstream <<
" <ROC_L0>" <<
ROC_L0[
i][
j] <<
"</ROC_L0>" << std::endl ;
1589 *rocstream <<
" <ROC_L1>" <<
ROC_L1[
i][
j] <<
"</ROC_L1>" << std::endl ;
1590 *rocstream <<
" <ROC_L2>" <<
ROC_L2[
i][
j] <<
"</ROC_L2>" << std::endl ;
1591 *rocstream <<
" <ROC_L3>" <<
ROC_L3[
i][
j] <<
"</ROC_L3>" << std::endl ;
1592 *rocstream <<
" <ROC_L4>" <<
ROC_L4[
i][
j] <<
"</ROC_L4>" << std::endl ;
1593 *rocstream <<
" </DATA>" << std::endl << std::endl ;
1594 *rocstream <<
" " << std::endl ;
1597 *tbmstream <<
"" << std::endl ;
1598 *tbmstream <<
" <DATA>" << std::endl ;
1599 *tbmstream <<
" <PIXEL_FED>" <<
fedNumber <<
"</PIXEL_FED>" << std::endl ;
1600 *tbmstream <<
" <FED_CHAN>" <<
i+1 <<
"</FED_CHAN>" << std::endl ;
1601 *tbmstream <<
" <TBMA_HEAD_L0>" <<
TBM_L0[
i] <<
"</TBMA_HEAD_L0>" << std::endl ;
1602 *tbmstream <<
" <TBMA_HEAD_L1>" <<
TBM_L1[
i] <<
"</TBMA_HEAD_L1>" << std::endl ;
1603 *tbmstream <<
" <TBMA_HEAD_L2>" <<
TBM_L2[
i] <<
"</TBMA_HEAD_L2>" << std::endl ;
1604 *tbmstream <<
" <TBMA_HEAD_L3>" <<
TBM_L3[
i] <<
"</TBMA_HEAD_L3>" << std::endl ;
1605 *tbmstream <<
" <TBMA_HEAD_L4>" <<
TBM_L4[
i] <<
"</TBMA_HEAD_L4>" << std::endl ;
1606 *tbmstream <<
" <TBMA_TRAIL_L0>" <<
TRL_L0[
i] <<
"</TBMA_TRAIL_L0>" << std::endl ;
1607 *tbmstream <<
" <TBMA_TRAIL_L1>" <<
TRL_L1[
i] <<
"</TBMA_TRAIL_L1>" << std::endl ;
1608 *tbmstream <<
" <TBMA_TRAIL_L2>" <<
TRL_L2[
i] <<
"</TBMA_TRAIL_L2>" << std::endl ;
1609 *tbmstream <<
" <TBMA_TRAIL_L3>" <<
TRL_L3[
i] <<
"</TBMA_TRAIL_L3>" << std::endl ;
1610 *tbmstream <<
" <TBMA_TRAIL_L4>" <<
TRL_L4[
i] <<
"</TBMA_TRAIL_L4>" << std::endl ;
1611 *tbmstream <<
" </DATA>" << std::endl << std::endl ;
1612 *tbmstream <<
"" << std::endl ;
1618 std::ofstream *rocstream,
1619 std::ofstream *tbmstream )
const
1621 std::string mthn =
"[PixelFEDCard::writeXMLTrailer()]\t\t\t " ;
1624 *fedstream <<
" </DATA_SET>" << std::endl ;
1625 *fedstream <<
"</ROOT>" << std::endl ;
1627 fedstream->close() ;
1628 std::cout << __LINE__ <<
"]\t" << mthn <<
"Data written for main fed" << std::endl ;
1631 *rocstream <<
" </DATA_SET>" << std::endl ;
1632 *rocstream <<
"</ROOT>" << std::endl ;
1634 rocstream->close() ;
1635 std::cout << __LINE__ <<
"]\t" << mthn <<
"Data written for roc analog levels" << std::endl ;
1638 *tbmstream <<
" </DATA_SET>" << std::endl ;
1639 *tbmstream <<
"</ROOT>" << std::endl ;
1641 tbmstream->close() ;
1642 std::cout << __LINE__ <<
"]\t" << mthn <<
"Data written for tbm analog levels" << std::endl ;
1647 std::string mthn =
"[PixelFEDCard::writeXMLTrailer()]\t\t\t " ;
1649 *out <<
" </DATA_SET>" << std::endl ;
1650 *out <<
"</ROOT>" << std::endl ;
1653 std::cout << __LINE__ <<
"]\t" << mthn <<
"Data written" << std::endl ;
1658 std::string mthn =
"[PixelFEDCard::writeXML()]\t\t\t " ;
1661 fullPath << path <<
"/fedcard.xml" ;
1662 std::cout << __LINE__ <<
"]\t" << mthn <<
"Writing to: |" << fullPath.str() <<
"|" << std::endl ;
1664 std::ofstream
out(fullPath.str().c_str()) ;
1666 out <<
"<ROOT>" << std::endl ;
1667 out <<
"" << std::endl ;
1668 out <<
" <HEADER>" << std::endl ;
1669 out <<
" <TYPE>" << std::endl ;
1670 out <<
" <EXTENSION_TABLE_NAME>FED_CONFIGURATION</EXTENSION_TABLE_NAME>" << std::endl ;
1671 out <<
" <NAME>Pixel FED Configuration</NAME>" << std::endl ;
1672 out <<
" </TYPE>" << std::endl ;
1673 out <<
" <RUN>" << std::endl ;
1674 out <<
" <RUN_TYPE>Pixel FED Configuration</RUN_TYPE>" << std::endl ;
1675 out <<
" <RUN_NUMBER>1</RUN_NUMBER>" << std::endl ;
1677 out <<
" <COMMENT_DESCRIPTION>Pixel FED Configuration</COMMENT_DESCRIPTION>" << std::endl ;
1678 out <<
" <LOCATION>CERN TAC</LOCATION>" << std::endl ;
1679 out <<
" <CREATED_BY_USER>Dario Menasce</CREATED_BY_USER>" << std::endl ;
1680 out <<
" </RUN>" << std::endl ;
1681 out <<
" </HEADER>" << std::endl ;
1682 out <<
"" << std::endl ;
1683 out <<
" <DATA_SET>" << std::endl ;
1684 out <<
"" << std::endl ;
1685 out <<
" <VERSION>T_E_S_T</VERSION>" << std::endl ;
1686 out <<
" <COMMENT_DESCRIPTION>Pixel FED Configuration</COMMENT_DESCRIPTION>" << std::endl ;
1687 out <<
"" << std::endl ;
1688 out <<
" <PART>" << std::endl ;
1689 out <<
" <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl ;
1690 out <<
" <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl ;
1691 out <<
" </PART>" << std::endl ;
1692 out <<
"" << std::endl ;
1693 out <<
" <DATA>" << std::endl ;
1694 out <<
" <PXLFED_NAME>PxlFED_32</PXLFED_NAME>" << std::endl ;
1695 out <<
" <CRATE_NUMBER>1</CRATE_NUMBER>" << std::endl ;
1696 out <<
" <SLOT_NUMBER>5</SLOT_NUMBER> " << std::endl ;
1697 out <<
" <VME_ADDRESS>268435456</VME_ADDRESS>" << std::endl ;
1698 out <<
" <CRATE_LABEL>S1G03e</CRATE_LABEL>" << std::endl ;
1699 out <<
"" << std::endl ;
1700 out <<
" <CHANNEL_ID>1</CHANNEL_ID>" << std::endl ;
1701 out <<
" <NUMBER_OF_ROCS>21</NUMBER_OF_ROCS>" << std::endl ;
1702 out <<
" <CHANNEL_OFFSET_DAC_SETTINGS>0</CHANNEL_OFFSET_DAC_SETTINGS>" << std::endl ;
1703 out <<
" <CHANNEL_DELAY_SETTINGS>3</CHANNEL_DELAY_SETTINGS>" << std::endl ;
1704 out <<
" <CHANNEL_BLACK_HIGH>400</CHANNEL_BLACK_HIGH>" << std::endl ;
1705 out <<
" <CHANNEL_BLACK_LOW>150</CHANNEL_BLACK_LOW>" << std::endl ;
1706 out <<
" <CHANNEL_ULTRA_BLACK>120</CHANNEL_ULTRA_BLACK>" << std::endl ;
1707 out <<
"" << std::endl ;
1708 out <<
" <OPT1_CAP>0</OPT1_CAP>" << std::endl ;
1709 out <<
" <OPT2_CAP>0</OPT2_CAP>" << std::endl ;
1710 out <<
" <OPT3_CAP>0</OPT3_CAP>" << std::endl ;
1711 out <<
" <OPT1_INP>0</OPT1_INP>" << std::endl ;
1712 out <<
" <OPT2_INP>0</OPT2_INP>" << std::endl ;
1713 out <<
" <OPT3_INP>0</OPT3_INP>" << std::endl ;
1714 out <<
" <OPT1_OUT>0</OPT1_OUT>" << std::endl ;
1715 out <<
" <OPT2_OUT>0</OPT2_OUT>" << std::endl ;
1716 out <<
" <OPT3_OUT>0</OPT3_OUT>" << std::endl ;
1717 out <<
" <NORTH_CLKPHB>511</NORTH_CLKPHB>" << std::endl ;
1718 out <<
" <NORTHCENTER_CLKPHB>511</NORTHCENTER_CLKPHB>" << std::endl ;
1719 out <<
" <SOUTHCENTER_CLKPHB>511</SOUTHCENTER_CLKPHB>" << std::endl ;
1720 out <<
" <SOUTH_CLKPHB>511</SOUTH_CLKPHB>" << std::endl ;
1721 out <<
" <NORTH_CTRL>0</NORTH_CTRL> " << std::endl ;
1722 out <<
" <NORTHCENTER_CTRL>0</NORTHCENTER_CTRL>" << std::endl ;
1723 out <<
" <SOUTHCENTER_CTRL>0</SOUTHCENTER_CTRL>" << std::endl ;
1724 out <<
" <SOUTH_CTRL>0</SOUTH_CTRL>" << std::endl ;
1725 out <<
" <REG1_TTCRX_FDLA>5</REG1_TTCRX_FDLA>" << std::endl ;
1726 out <<
" <REG2_TTCRX_CDLA>0</REG2_TTCRX_CDLA>" << std::endl ;
1727 out <<
" <REG3_TTCRX_CLKD2>155</REG3_TTCRX_CLKD2>" << std::endl ;
1728 out <<
" <CENTER_CTRL>0</CENTER_CTRL>" << std::endl ;
1729 out <<
" <CENTER_MODE>0</CENTER_MODE>" << std::endl ;
1730 out <<
" <B1_ADCGN>0</B1_ADCGN>" << std::endl ;
1731 out <<
" <B2_ADCGN>0</B2_ADCGN>" << std::endl ;
1732 out <<
" <B3_ADCGN>0</B3_ADCGN>" << std::endl ;
1733 out <<
" <B4_ADCGN>0</B4_ADCGN>" << std::endl ;
1734 out <<
" <NORTH_BADJ>330</NORTH_BADJ>" << std::endl ;
1735 out <<
" <NORTHCENTER_BADJ>330</NORTHCENTER_BADJ>" << std::endl ;
1736 out <<
" <SOUTHCENTER_BADJ>330</SOUTHCENTER_BADJ>" << std::endl ;
1737 out <<
" <SOUTH_BADJ>330</SOUTH_BADJ>" << std::endl ;
1738 out <<
" <NORTH_TBMMASK>2</NORTH_TBMMASK>" << std::endl ;
1739 out <<
" <NORTHCENTER_TBMMASK>2</NORTHCENTER_TBMMASK>" << std::endl ;
1740 out <<
" <SOUTHCENTER_TBMMASK>2</SOUTHCENTER_TBMMASK>" << std::endl ;
1741 out <<
" <SOUTH_TBMMASK>2</SOUTH_TBMMASK>" << std::endl ;
1742 out <<
" <NORTH_PWORD>177</NORTH_PWORD>" << std::endl ;
1743 out <<
" <NORTHCENTER_PWORD>178</NORTHCENTER_PWORD>" << std::endl ;
1744 out <<
" <SOUTHCENTER_PWORD>179</SOUTHCENTER_PWORD>" << std::endl ;
1745 out <<
" <SOUTH_PWORD>180</SOUTH_PWORD>" << std::endl ;
1746 out <<
" <SPECDAC>0</SPECDAC>" << std::endl ;
1747 out <<
" <OOS_LVL>0</OOS_LVL>" << std::endl ;
1748 out <<
" <ERR_LVL>0</ERR_LVL>" << std::endl ;
1749 out <<
" <NORTH_FIFO1_BZ_LVL>900</NORTH_FIFO1_BZ_LVL>" << std::endl ;
1750 out <<
" <NORTHCENTER_FIFO1_BZ_LVL>900</NORTHCENTER_FIFO1_BZ_LVL>" << std::endl ;
1751 out <<
" <SOUTHCENTER_FIFO1_BZ_LVL>900</SOUTHCENTER_FIFO1_BZ_LVL>" << std::endl ;
1752 out <<
" <SOUTH_FIFO1_BZ_LVL>900</SOUTH_FIFO1_BZ_LVL>" << std::endl ;
1753 out <<
" <FIFO3_WRN_LVL>7680</FIFO3_WRN_LVL> " << std::endl ;
1754 out <<
" <FED_MASTER_DELAY>0</FED_MASTER_DELAY>" << std::endl ;
1755 out <<
" <NO_HITLIMIT>0</NO_HITLIMIT>" << std::endl ;
1756 out <<
" <NC_HITLIMIT>0</NC_HITLIMIT>" << std::endl ;
1757 out <<
" <SC_HITLIMIT>0</SC_HITLIMIT>" << std::endl ;
1758 out <<
" <SO_HITLIMIT>0</SO_HITLIMIT>" << std::endl ;
1759 out <<
" <NO_TESTREG>0</NO_TESTREG>" << std::endl ;
1760 out <<
" <NC_TESTREG>0</NC_TESTREG>" << std::endl ;
1761 out <<
" <SC_TESTREG>0</SC_TESTREG>" << std::endl ;
1762 out <<
" <SO_TESTREG>0</SO_TESTREG>" << std::endl ;
1763 out <<
" </DATA>" << std::endl ;
1820 std::cout << __LINE__ <<
"]\t" << mthn <<
"Data written" << std::endl ;
1825 unsigned long long channels=0;
1829 channels = (
Ncntrl & 0x1ffLL);
1830 channels += (
NCcntrl & 0x1ffLL) << 9;
1831 channels += (
SCcntrl & 0x1ffLL) << 18;
1832 channels += (
Scntrl & 0x1ffLL) << 27;
1837 assert(iChannel>0&&iChannel<37);
1842 assert(iChannel>0&&iChannel<37);
1844 long long bit=0x1LL<<(iChannel-1);
This file contains the base class for "pixel configuration data" management.
void restoreBaselinAndChannelMasks()
virtual void writeXMLTrailer(std::ofstream *out) const
unsigned long long enabledChannels()
void restoreControlAndModeRegister()
void readDBROCLevels(std::vector< std::vector< std::string > > &tableMat, int first, int last)
bool useChannel(unsigned int iChannel)
tuple path
else: Piece not in the list, fine.
void readDBTBMLevels(std::vector< std::vector< std::string > > &tableMat, int first, int last)
std::string getComment() const
std::string getAuthor() const
unsigned int NCcntrl_original
int modeRegister_original
unsigned int Ncntrl_original
void writeXML(pos::PixelConfigKey key, int version, std::string path) const
void setChannel(unsigned int iChannel, bool mode)
unsigned int Scntrl_original
volatile std::atomic< bool > shutdown_flag false
void writeASCII(std::string dir="") const
virtual void writeXMLHeader(pos::PixelConfigKey key, int version, std::string path, std::ofstream *out) const
tuple size
Write out results.
unsigned int SCcntrl_original