00001
00002
00003
00004 #include <iostream>
00005
00006 #include "CalibFormats/SiPixelObjects/interface/PixelFEDCard.h"
00007 #include "CalibFormats/SiPixelObjects/interface/PixelTimeFormatter.h"
00008
00009 #include <cassert>
00010 #include <sstream>
00011 #include <map>
00012 #include <stdexcept>
00013
00014 using namespace std;
00015
00016 using namespace pos;
00017
00018
00019 PixelFEDCard::PixelFEDCard():
00020 PixelConfigBase(" "," "," ")
00021 {
00022 clear();
00023 }
00024
00025
00026
00027 PixelFEDCard::PixelFEDCard(vector<vector<string> > &tableMat):PixelConfigBase(" "," "," ")
00028 {
00029 std::string mthn = "[PixelFEDCard::PixelFEDCard()]\t\t " ;
00030 vector<string> ins = tableMat[0];
00031 map<string , int > colM;
00032 vector<string> colNames;
00033 bool first = true ;
00113 colNames.push_back("CONFIG_KEY" );
00114 colNames.push_back("KEY_TYPE" );
00115 colNames.push_back("KEY_ALIAS" );
00116 colNames.push_back("VERSION" );
00117 colNames.push_back("KIND_OF_COND" );
00118 colNames.push_back("CRATE_LABEL" );
00119 colNames.push_back("CRATE_NUMBER" );
00120 colNames.push_back("SLOT_NUMBER" );
00121 colNames.push_back("VME_ADDRS_HEX" );
00122 colNames.push_back("PIXEL_FED" );
00123 colNames.push_back("CHANNEL_ID" );
00124 colNames.push_back("NUM_ROCS" );
00125 colNames.push_back("CHAN_OFFST_DAC" );
00126 colNames.push_back("CHAN_DELAY" );
00127 colNames.push_back("CHAN_BHIGH" );
00128 colNames.push_back("CHAN_BLOW" );
00129 colNames.push_back("CHAN_UB" );
00130 colNames.push_back("OPT1_CAP" );
00131 colNames.push_back("OPT2_CAP" );
00132 colNames.push_back("OPT3_CAP" );
00133 colNames.push_back("OPT1_INP" );
00134 colNames.push_back("OPT2_INP" );
00135 colNames.push_back("OPT3_INP" );
00136 colNames.push_back("OPT1_OUT" );
00137 colNames.push_back("OPT2_OUT" );
00138 colNames.push_back("OPT3_OUT" );
00139 colNames.push_back("NORTH_CLKPHB" );
00140 colNames.push_back("NORTHCENTER_CLKPHB" );
00141 colNames.push_back("SOUTHCENTER_CLKPHB" );
00142 colNames.push_back("SOUTH_CLKPHB" );
00143 colNames.push_back("NORTH_CTRL" );
00144 colNames.push_back("NORTHCENTER_CTRL" );
00145 colNames.push_back("SOUTHCENTER_CTRL" );
00146 colNames.push_back("SOUTH_CTRL" );
00147 colNames.push_back("REG0_TTCRX_FDLA" );
00148 colNames.push_back("REG1_TTCRX_FDLA" );
00149 colNames.push_back("REG2_TTCRX_CDLA" );
00150 colNames.push_back("REG3_TTCRX_CLKD2" );
00151 colNames.push_back("CENTER_CTRL" );
00152 colNames.push_back("CENTER_MODE" );
00153 colNames.push_back("B1_ADCGN" );
00154 colNames.push_back("B2_ADCGN" );
00155 colNames.push_back("B3_ADCGN" );
00156 colNames.push_back("B4_ADCGN" );
00157 colNames.push_back("NORTH_BADJ" );
00158 colNames.push_back("NORTHCENTER_BADJ" );
00159 colNames.push_back("SOUTHCENTER_BADJ" );
00160 colNames.push_back("SOUTH_BADJ" );
00161 colNames.push_back("NORTH_TBMMASK" );
00162 colNames.push_back("NORTHCENTER_TBMMASK" );
00163 colNames.push_back("SOUTHCENTER_TBMMASK" );
00164 colNames.push_back("SOUTH_TBMMASK" );
00165 colNames.push_back("NORTH_PWORD" );
00166 colNames.push_back("NORTHCENTER_PWORD" );
00167 colNames.push_back("SOUTH_PWORD" );
00168 colNames.push_back("SOUTHCENTER_PWORD" );
00169 colNames.push_back("SPECDAC" );
00170 colNames.push_back("OOS_LVL" );
00171 colNames.push_back("ERR_LVL" );
00172 colNames.push_back("NORTH_FIFO1_BZ_LVL" );
00173 colNames.push_back("NORTHCENTER_FIFO1_BZ_LVL");
00174 colNames.push_back("SOUTHCENTER_FIFO1_BZ_LVL");
00175 colNames.push_back("SOUTH_FIFO1_BZ_LVL" );
00176 colNames.push_back("FIFO3_WRN_LVL" );
00177 colNames.push_back("FED_MASTER_DELAY" );
00178 colNames.push_back("NO_HITLIMIT" );
00179 colNames.push_back("NC_HITLIMIT" );
00180 colNames.push_back("SC_HITLIMIT" );
00181 colNames.push_back("SO_HITLIMIT" );
00182 colNames.push_back("NO_TESTREG" );
00183 colNames.push_back("NC_TESTREG" );
00184 colNames.push_back("SC_TESTREG" );
00185 colNames.push_back("SO_TESTREG" );
00186
00187 for(unsigned int c = 0 ; c < ins.size() ; c++)
00188 {
00189 for(unsigned int n=0; n<colNames.size(); n++)
00190 {
00191 if(tableMat[0][c] == colNames[n]){
00192 colM[colNames[n]] = c;
00193 break;
00194 }
00195 }
00196 }
00197 for(unsigned int n=0; n<colNames.size(); n++)
00198 {
00199 if(colM.find(colNames[n]) == colM.end())
00200 {
00201 std::cerr << "[PixelTBMSettings::PixelTBMSettings()]\tCouldn't find in the database the column with name " << colNames[n] << std::endl;
00202 assert(0);
00203 }
00204 }
00205
00206 int size[3] ;
00207 int indexsize = 0 ;
00208 for(unsigned int r = 0 ; r < tableMat.size() ; r++){
00209 if(tableMat[r].size() == 0)
00210 {
00211
00212 size[indexsize] = r ;
00213
00214 indexsize++ ;
00215 continue ;
00216 }
00217 for(vector<string>::iterator it = tableMat[r].begin() ; it != tableMat[r].end() ; it++)
00218 {
00219
00220
00221 }
00222
00223 }
00224
00225
00226 if(first)
00227 {
00228 first = false ;
00229
00230
00231 sscanf(tableMat[1][colM["VME_ADDRS_HEX"]].c_str(),"%lx",&FEDBASE_0);
00232
00233 fedNumber = atoi(tableMat[1][colM["PIXEL_FED"]].c_str() ) ;
00234
00235 opt_cap[0] = atoi(tableMat[1][colM["OPT1_CAP"]].c_str() ) ;
00236 opt_cap[1] = atoi(tableMat[1][colM["OPT2_CAP"]].c_str() ) ;
00237 opt_cap[2] = atoi(tableMat[1][colM["OPT3_CAP"]].c_str() ) ;
00238 opt_inadj[0] = atoi(tableMat[1][colM["OPT1_INP"]].c_str() ) ;
00239 opt_inadj[1] = atoi(tableMat[1][colM["OPT2_INP"]].c_str() ) ;
00240 opt_inadj[2] = atoi(tableMat[1][colM["OPT3_INP"]].c_str() ) ;
00241 opt_ouadj[0] = atoi(tableMat[1][colM["OPT1_OUT"]].c_str() ) ;
00242 opt_ouadj[1] = atoi(tableMat[1][colM["OPT2_OUT"]].c_str() ) ;
00243 opt_ouadj[2] = atoi(tableMat[1][colM["OPT3_OUT"]].c_str() ) ;
00244
00245
00246 clkphs1_9 = atoi(tableMat[1][colM["NORTH_CLKPHB"]].c_str() ) ;
00247 clkphs10_18 = atoi(tableMat[1][colM["NORTHCENTER_CLKPHB"]].c_str() ) ;
00248 clkphs19_27 = atoi(tableMat[1][colM["SOUTHCENTER_CLKPHB"]].c_str() ) ;
00249 clkphs28_36 = atoi(tableMat[1][colM["SOUTH_CLKPHB"]].c_str() ) ;
00250
00251
00252 CoarseDel = atoi(tableMat[1][colM["REG2_TTCRX_CDLA"]].c_str() ) ;
00253 ClkDes2 = atoi(tableMat[1][colM["REG3_TTCRX_CLKD2"]].c_str() ) ;
00254 FineDes2Del = atoi(tableMat[1][colM["REG1_TTCRX_FDLA"]].c_str() ) ;
00255 FineDes1Del = atoi(tableMat[1][colM["REG0_TTCRX_FDLA"]].c_str() ) ;
00256
00257 Ccntrl = atoi(tableMat[1][colM["CENTER_CTRL"]].c_str() ) ;
00258 modeRegister = atoi(tableMat[1][colM["CENTER_MODE"]].c_str() ) ;
00259
00260
00261 Nfifo1Bzlvl = atoi(tableMat[1][colM["NORTH_FIFO1_BZ_LVL"]].c_str() ) ;
00262 NCfifo1Bzlvl = atoi(tableMat[1][colM["NORTHCENTER_FIFO1_BZ_LVL"]].c_str() ) ;
00263 SCfifo1Bzlvl = atoi(tableMat[1][colM["SOUTHCENTER_FIFO1_BZ_LVL"]].c_str() ) ;
00264 Sfifo1Bzlvl = atoi(tableMat[1][colM["SOUTH_FIFO1_BZ_LVL"]].c_str() ) ;
00265
00266
00267 N_TBMmask = atoi(tableMat[1][colM["NORTH_TBMMASK"]].c_str() ) ;
00268 NC_TBMmask = atoi(tableMat[1][colM["NORTHCENTER_TBMMASK"]].c_str() ) ;
00269 SC_TBMmask = atoi(tableMat[1][colM["SOUTHCENTER_TBMMASK"]].c_str() ) ;
00270 S_TBMmask = atoi(tableMat[1][colM["SOUTH_TBMMASK"]].c_str() ) ;
00271
00272
00273 N_Pword = atoi(tableMat[1][colM["NORTH_PWORD"]].c_str() ) ;
00274 NC_Pword = atoi(tableMat[1][colM["NORTHCENTER_PWORD"]].c_str() ) ;
00275 SC_Pword = atoi(tableMat[1][colM["SOUTHCENTER_PWORD"]].c_str() ) ;
00276 S_Pword = atoi(tableMat[1][colM["SOUTH_PWORD"]].c_str() ) ;
00277
00278 Nbaseln = atoi(tableMat[1][colM["NORTH_BADJ"]].c_str() ) ;
00279 NCbaseln = atoi(tableMat[1][colM["NORTHCENTER_BADJ"]].c_str() ) ;
00280 SCbaseln = atoi(tableMat[1][colM["SOUTHCENTER_BADJ"]].c_str() ) ;
00281 Sbaseln = atoi(tableMat[1][colM["SOUTH_BADJ"]].c_str() ) ;
00282
00283 Ncntrl = atoi(tableMat[1][colM["NORTH_CTRL"]].c_str() ) ;
00284 NCcntrl = atoi(tableMat[1][colM["NORTHCENTER_CTRL"]].c_str() ) ;
00285 SCcntrl = atoi(tableMat[1][colM["SOUTHCENTER_CTRL"]].c_str() ) ;
00286 Scntrl = atoi(tableMat[1][colM["SOUTH_CTRL"]].c_str() ) ;
00287
00288
00289
00290 SpecialDac = atoi(tableMat[1][colM["SPECDAC"]].c_str() ) ;
00291
00292
00293 Ooslvl = atoi(tableMat[1][colM["OOS_LVL"]].c_str() ) ;
00294
00295 Errlvl = atoi(tableMat[1][colM["ERR_LVL"]].c_str() ) ;
00296
00297
00298 Nadcg = atoi(tableMat[1][colM["B1_ADCGN"]].c_str() ) ;
00299 NCadcg = atoi(tableMat[1][colM["B2_ADCGN"]].c_str() ) ;
00300 SCadcg = atoi(tableMat[1][colM["B3_ADCGN"]].c_str() ) ;
00301 Sadcg = atoi(tableMat[1][colM["B4_ADCGN"]].c_str() ) ;
00302 fifo3Wrnlvl = atoi(tableMat[1][colM["FIFO3_WRN_LVL"]].c_str() ) ;
00303 FedTTCDelay = atoi(tableMat[1][colM["FED_MASTER_DELAY"]].c_str() ) ;
00304 N_hitlimit = atoi(tableMat[1][colM["NO_HITLIMIT"]].c_str() ) ;
00305 NC_hitlimit = atoi(tableMat[1][colM["NC_HITLIMIT"]].c_str() ) ;
00306 SC_hitlimit = atoi(tableMat[1][colM["SC_HITLIMIT"]].c_str() ) ;
00307 S_hitlimit = atoi(tableMat[1][colM["SO_HITLIMIT"]].c_str() ) ;
00308 N_testreg = atoi(tableMat[1][colM["NO_TESTREG"]].c_str() ) ;
00309 NC_testreg = atoi(tableMat[1][colM["NC_TESTREG"]].c_str() ) ;
00310 SC_testreg = atoi(tableMat[1][colM["SC_TESTREG"]].c_str() ) ;
00311 S_testreg = atoi(tableMat[1][colM["SO_TESTREG"]].c_str() ) ;
00312
00313 }
00314 for(int r = 1 ; r < size[0] ; r++)
00315 {
00316
00317 NRocs[atoi(tableMat[r][colM["CHANNEL_ID"]].c_str())-1] = atoi(tableMat[r][colM["NUM_ROCS"]].c_str() ) ;
00318
00319 offs_dac[atoi(tableMat[r][colM["CHANNEL_ID"]].c_str())-1] = atoi(tableMat[r][colM["CHAN_OFFST_DAC"]].c_str() ) ;
00320
00321 DelayCh[atoi(tableMat[r][colM["CHANNEL_ID"]].c_str())-1] = atoi(tableMat[r][colM["CHAN_DELAY"]].c_str() ) ;
00322
00323 BlackHi[atoi(tableMat[r][colM["CHANNEL_ID"]].c_str())-1] = atoi(tableMat[r][colM["CHAN_BHIGH"]].c_str() ) ;
00324 BlackLo[atoi(tableMat[r][colM["CHANNEL_ID"]].c_str())-1] = atoi(tableMat[r][colM["CHAN_BLOW"]].c_str() ) ;
00325 Ublack[atoi(tableMat[r][colM["CHANNEL_ID"]].c_str())-1] = atoi(tableMat[r][colM["CHAN_UB"]].c_str() ) ;
00326 }
00327
00328 readDBTBMLevels(tableMat, size[0]+1, size[1]) ;
00329 readDBROCLevels(tableMat, size[1]+1, size[2]) ;
00330 Ccntrl_original=Ccntrl;
00331 modeRegister_original=modeRegister;
00332
00333
00334 Ncntrl_original=Ncntrl;
00335 NCcntrl_original=NCcntrl;
00336 SCcntrl_original=SCcntrl;
00337 Scntrl_original=Scntrl;
00338
00339 Nbaseln_original=Nbaseln;
00340 NCbaseln_original=NCbaseln;
00341 SCbaseln_original=SCbaseln;
00342 Sbaseln_original=Sbaseln;
00343
00344
00345
00346
00347 FineDes1Del = 14 ;
00348 }
00349
00350 void PixelFEDCard::readDBTBMLevels(std::vector<std::vector<std::string> > &tableMat, int firstRow, int lastRow)
00351 {
00352 string mthn = "[PixelFEDCard::readDBTBMLevels()] ";
00353 vector<string> ins = tableMat[firstRow];
00354 map<string , int > colM;
00355 vector<string> colNames;
00356
00385 colNames.push_back("CONFIG_KEY" );
00386 colNames.push_back("KEY_TYPE" );
00387 colNames.push_back("KEY_ALIAS" );
00388 colNames.push_back("VERSION" );
00389 colNames.push_back("KIND_OF_COND" );
00390 colNames.push_back("TBM_NAME" );
00391 colNames.push_back("PIXEL_FED" );
00392 colNames.push_back("FED_CHAN" );
00393 colNames.push_back("TBMA_HEAD_L0" );
00394 colNames.push_back("TBMA_HEAD_L1" );
00395 colNames.push_back("TBMA_HEAD_L2" );
00396 colNames.push_back("TBMA_HEAD_L3" );
00397 colNames.push_back("TBMA_HEAD_L4" );
00398 colNames.push_back("TBMA_TRAIL_L0");
00399 colNames.push_back("TBMA_TRAIL_L1");
00400 colNames.push_back("TBMA_TRAIL_L2");
00401 colNames.push_back("TBMA_TRAIL_L3");
00402 colNames.push_back("TBMA_TRAIL_L4");
00403 colNames.push_back("TBMA_HEAD_B" );
00404 colNames.push_back("TBMA_HEAD_UB" );
00405 colNames.push_back("TBMA_TRAIL_B" );
00406 colNames.push_back("TBMA_TRAIL_UB");
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432 for(unsigned int c = 0 ; c < ins.size() ; c++)
00433 {
00434 for(unsigned int n=0; n<colNames.size(); n++)
00435 {
00436 if(tableMat[firstRow][c] == colNames[n]){
00437 colM[colNames[n]] = c;
00438 break;
00439 }
00440 }
00441 }
00442 for(unsigned int n=0; n<colNames.size(); n++)
00443 {
00444 if(colM.find(colNames[n]) == colM.end())
00445 {
00446 std::cerr << mthn << "\tCouldn't find in the database the column with name " << colNames[n] << std::endl;
00447 assert(0);
00448 }
00449 }
00450 for(int r = firstRow + 1 ; r < lastRow ; r++)
00451 {
00452
00453 TBM_L0[atoi(tableMat[r][colM["FED_CHAN"]].c_str())-1] = atoi(tableMat[r][colM["TBMA_HEAD_L0"]].c_str() ) ;
00454 TBM_L1[atoi(tableMat[r][colM["FED_CHAN"]].c_str())-1] = atoi(tableMat[r][colM["TBMA_HEAD_L1"]].c_str() ) ;
00455 TBM_L2[atoi(tableMat[r][colM["FED_CHAN"]].c_str())-1] = atoi(tableMat[r][colM["TBMA_HEAD_L2"]].c_str() ) ;
00456 TBM_L3[atoi(tableMat[r][colM["FED_CHAN"]].c_str())-1] = atoi(tableMat[r][colM["TBMA_HEAD_L3"]].c_str() ) ;
00457 TBM_L4[atoi(tableMat[r][colM["FED_CHAN"]].c_str())-1] = atoi(tableMat[r][colM["TBMA_HEAD_L4"]].c_str() ) ;
00458 TRL_L0[atoi(tableMat[r][colM["FED_CHAN"]].c_str())-1] = atoi(tableMat[r][colM["TBMA_TRAIL_L0"]].c_str() ) ;
00459 TRL_L1[atoi(tableMat[r][colM["FED_CHAN"]].c_str())-1] = atoi(tableMat[r][colM["TBMA_TRAIL_L1"]].c_str() ) ;
00460 TRL_L2[atoi(tableMat[r][colM["FED_CHAN"]].c_str())-1] = atoi(tableMat[r][colM["TBMA_TRAIL_L2"]].c_str() ) ;
00461 TRL_L3[atoi(tableMat[r][colM["FED_CHAN"]].c_str())-1] = atoi(tableMat[r][colM["TBMA_TRAIL_L3"]].c_str() ) ;
00462 TRL_L4[atoi(tableMat[r][colM["FED_CHAN"]].c_str())-1] = atoi(tableMat[r][colM["TBMA_TRAIL_L4"]].c_str() ) ;
00463 }
00464 }
00465
00466 void PixelFEDCard::readDBROCLevels(std::vector<std::vector<std::string> > &tableMat, int firstRow, int lastRow)
00467 {
00468 string mthn = "[PixelFEDCard::readDBROCLevels()] ";
00469 map<string , int > colM;
00470 vector<string> colNames;
00471
00494 colNames.push_back("CONFIG_KEY" );
00495 colNames.push_back("KEY_TYPE" );
00496 colNames.push_back("KEY_ALIAS" );
00497 colNames.push_back("VERSION" );
00498 colNames.push_back("KIND_OF_COND");
00499 colNames.push_back("ROC_NAME" );
00500 colNames.push_back("FED_ROC_NUM" );
00501 colNames.push_back("PIXEL_FED" );
00502 colNames.push_back("FED_CHAN" );
00503 colNames.push_back("ROC_L0" );
00504 colNames.push_back("ROC_L1" );
00505 colNames.push_back("ROC_L2" );
00506 colNames.push_back("ROC_L3" );
00507 colNames.push_back("ROC_L4" );
00508 colNames.push_back("ROC_B" );
00509 colNames.push_back("ROC_UB" );
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531 for(unsigned int c = 0 ; c < tableMat[firstRow].size() ; c++)
00532 {
00533 for(unsigned int n=0; n<colNames.size(); n++)
00534 {
00535 if(tableMat[firstRow][c] == colNames[n]){
00536 colM[colNames[n]] = c;
00537 break;
00538 }
00539 }
00540 }
00541 for(unsigned int n=0; n<colNames.size(); n++)
00542 {
00543 if(colM.find(colNames[n]) == colM.end())
00544 {
00545 std::cerr << mthn << "\tCouldn't find in the database the column with name " << colNames[n] << std::endl;
00546 assert(0);
00547 }
00548 }
00549
00550
00551
00552 for(int r = firstRow + 1 ; r < lastRow ; r++)
00553 {
00554 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()) ;
00555 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()) ;
00556 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()) ;
00557 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()) ;
00558 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()) ;
00559 }
00560
00561 }
00562
00563
00564
00565 PixelFEDCard::PixelFEDCard(string fileName):
00566 PixelConfigBase(" "," "," ")
00567 {
00568
00569 std::string mthn = "]\t[PixelFEDCard::PixelFEDCard()]\t\t\t\t " ;
00570
00571 const bool localDEBUG = false;
00572
00573
00574 clear() ;
00575
00576
00577 FILE *infile = fopen((fileName.c_str()),"r");
00578 if (infile == NULL) throw std::runtime_error("Failed to open FED Card parameter file: "+fileName);
00579
00580
00581 fscanf(infile,"FED Base address :%lx\n",
00582 &FEDBASE_0);
00583 fscanf(infile,"FEDID Number :%lx\n",
00584 &fedNumber);
00585
00586
00587
00588
00589
00590
00591
00592
00593 int ijx=0;
00594 for(int i=0;i<36;i++){
00595 ijx=i+1;
00596 fscanf(infile,"Number of ROCs Chnl %d:%d \n",&ijx,&NRocs[i]);
00597 if(localDEBUG)printf("Number of ROCs per Chnl %d:%d \n",ijx,NRocs[i]);
00598 }
00599
00600
00601 fscanf(infile,"Optical reciever 1 Capacitor Adjust(0-3):%d\n",&opt_cap[0]);
00602 fscanf(infile,"Optical reciever 2 Capacitor Adjust(0-3):%d\n",&opt_cap[1]);
00603 fscanf(infile,"Optical reciever 3 Capacitor Adjust(0-3):%d\n",&opt_cap[2]);
00604 fscanf(infile,"Optical reciever 1 Input Offset (0-15) :%d\n",&opt_inadj[0]);
00605 fscanf(infile,"Optical reciever 2 Input Offset (0-15) :%d\n",&opt_inadj[1]);
00606 fscanf(infile,"Optical reciever 3 Input Offset (0-15) :%d\n",&opt_inadj[2]);
00607 fscanf(infile,"Optical reciever 1 Output Offset (0-3) :%d\n",&opt_ouadj[0]);
00608 fscanf(infile,"Optical reciever 2 Output Offset (0-3) :%d\n",&opt_ouadj[1]);
00609 fscanf(infile,"Optical reciever 3 Output Offset (0-3) :%d\n",&opt_ouadj[2]);
00610
00611 if(localDEBUG) {
00612 printf("Optical reciever 1 Capacitor Adjust(0-3):%d\n",opt_cap[0]);
00613 printf("Optical reciever 2 Capacitor Adjust(0-3):%d\n",opt_cap[1]);
00614 printf("Optical reciever 3 Capacitor Adjust(0-3):%d\n",opt_cap[2]);
00615 printf("Optical reciever 1 Input Offset (0-15) :%d\n",opt_inadj[0]);
00616 printf("Optical reciever 2 Input Offset (0-15) :%d\n",opt_inadj[1]);
00617 printf("Optical reciever 3 Input Offset (0-15) :%d\n",opt_inadj[2]);
00618 printf("Optical reciever 1 Output Offset (0-3) :%d\n",opt_ouadj[0]);
00619 printf("Optical reciever 2 Output Offset (0-3) :%d\n",opt_ouadj[1]);
00620 printf("Optical reciever 3 Output Offset (0-3) :%d\n",opt_ouadj[2]);
00621 }
00622
00623
00624 for(int i=0;i<36;i++) {
00625 fscanf(infile,"Offset DAC channel %d:%d\n",&ijx,&offs_dac[i]);
00626 if(localDEBUG) printf("Offset DAC channel %d:%d\n",i+1,offs_dac[i]);
00627 }
00628
00629
00630 fscanf(infile,"Clock Phase Bits ch 1-9:%x\n",& clkphs1_9 );
00631 fscanf(infile,"Clock Phase Bits ch 10-18:%x\n",&clkphs10_18);
00632 fscanf(infile,"Clock Phase Bits ch 19-27:%x\n",&clkphs19_27);
00633 fscanf(infile,"Clock Phase Bits ch 28-36:%x\n",&clkphs28_36);
00634 if(localDEBUG)printf("Clock Phase Bits ch 1-9:%x\n",clkphs1_9 );
00635 if(localDEBUG)printf("Clock Phase Bits ch 10-18:%x\n",clkphs10_18 );
00636 if(localDEBUG)printf("Clock Phase Bits ch 19-27:%x\n",clkphs19_27 );
00637 if(localDEBUG)printf("Clock Phase Bits ch 28-36:%x\n",clkphs28_36 );
00638
00639
00640 for(int i=0;i<36;i++){
00641 fscanf(infile,"Black HiThold ch %d:%d \n",&ijx,&BlackHi[i]);
00642 fscanf(infile,"Black LoThold ch %d:%d \n",&ijx,&BlackLo[i]);
00643 fscanf(infile,"ULblack Thold ch %d:%d \n",&ijx, &Ublack[i]);
00644 if(localDEBUG)printf("Black HiThold ch %d:%d\n",ijx,BlackHi[i]);
00645 if(localDEBUG)printf("Black LoThold ch %d:%d\n",ijx,BlackLo[i]);
00646 if(localDEBUG)printf("ULblack Thold ch %d:%d\n",ijx, Ublack[i]);
00647 }
00648
00649
00650 for(int i=0;i<36;i++) {
00651 fscanf(infile,"Delay channel %d(0-15):%d\n",&ijx,&DelayCh[i]);
00652 if(localDEBUG)
00653 printf("Delay channel %d(0-15):%d\n",i+1,DelayCh[i]);
00654 }
00655
00656
00657 for(int i=0;i<36;i++) {
00658 fscanf(infile,"TBM level 0 Channel %d:%d\n",&ijx,&TBM_L0[i]);
00659 fscanf(infile,"TBM level 1 Channel %d:%d\n",&ijx,&TBM_L1[i]);
00660 fscanf(infile,"TBM level 2 Channel %d:%d\n",&ijx,&TBM_L2[i]);
00661 fscanf(infile,"TBM level 3 Channel %d:%d\n",&ijx,&TBM_L3[i]);
00662 fscanf(infile,"TBM level 4 Channel %d:%d\n",&ijx,&TBM_L4[i]);
00663 if(localDEBUG)printf("TBM level 0 Channel %d:%d\n",ijx,TBM_L0[i]);
00664 if(localDEBUG)printf("TBM level 1 Channel %d:%d\n",ijx,TBM_L1[i]);
00665 if(localDEBUG)printf("TBM level 2 Channel %d:%d\n",ijx,TBM_L2[i]);
00666 if(localDEBUG)printf("TBM level 3 Channel %d:%d\n",ijx,TBM_L3[i]);
00667 if(localDEBUG)printf("TBM level 4 Channel %d:%d\n",ijx,TBM_L4[i]);
00668
00669 int ijy=0;
00670 for(int j=0;j<NRocs[i];j++) {
00671 fscanf(infile,"ROC%d level 0 Channel %d :%d\n",
00672 &ijy,&ijx,&ROC_L0[i][j]);
00673 fscanf(infile,"ROC%d level 1 Channel %d :%d\n",
00674 &ijy,&ijx,&ROC_L1[i][j]);
00675 fscanf(infile,"ROC%d level 2 Channel %d :%d\n",
00676 &ijy,&ijx,&ROC_L2[i][j]);
00677 fscanf(infile,"ROC%d level 3 Channel %d :%d\n",
00678 &ijy,&ijx,&ROC_L3[i][j]);
00679 fscanf(infile,"ROC%d level 4 Channel %d :%d\n",
00680 &ijy,&ijx,&ROC_L4[i][j]);
00681 if(localDEBUG)
00682 printf("ROC%d level 0 Channel %d :%d\n",ijy,ijx,ROC_L0[i][j]);
00683 if(localDEBUG)
00684 printf("ROC%d level 1 Channel %d :%d\n",ijy,ijx,ROC_L1[i][j]);
00685 if(localDEBUG)
00686 printf("ROC%d level 2 Channel %d :%d\n",ijy,ijx,ROC_L2[i][j]);
00687 if(localDEBUG)
00688 printf("ROC%d level 3 Channel %d :%d\n",ijy,ijx,ROC_L3[i][j]);
00689 if(localDEBUG)
00690 printf("ROC%d level 4 Channel %d :%d\n",ijy,ijx,ROC_L4[i][j]);
00691 }
00692
00693 fscanf(infile,"TRLR level 0 Channel %d:%d\n",&ijx,&TRL_L0[i]);
00694 fscanf(infile,"TRLR level 1 Channel %d:%d\n",&ijx,&TRL_L1[i]);
00695 fscanf(infile,"TRLR level 2 Channel %d:%d\n",&ijx,&TRL_L2[i]);
00696 fscanf(infile,"TRLR level 3 Channel %d:%d\n",&ijx,&TRL_L3[i]);
00697 fscanf(infile,"TRLR level 4 Channel %d:%d\n",&ijx,&TRL_L4[i]);
00698 if(localDEBUG)printf("TRLR level 0 Channel %d:%d\n",ijx,TRL_L0[i]);
00699 if(localDEBUG)printf("TRLR level 1 Channel %d:%d\n",ijx,TRL_L1[i]);
00700 if(localDEBUG)printf("TRLR level 2 Channel %d:%d\n",ijx,TRL_L2[i]);
00701 if(localDEBUG)printf("TRLR level 3 Channel %d:%d\n",ijx,TRL_L3[i]);
00702 if(localDEBUG)printf("TRLR level 4 Channel %d:%d\n",ijx,TRL_L4[i]);
00703 }
00704
00705
00706
00707 fscanf(infile,"Channel Enbable bits chnls 1-9 (on = 0):%x\n",
00708 &Ncntrl);
00709 fscanf(infile,"Channel Enbable bits chnls 10-18(on = 0):%x\n",
00710 &NCcntrl);
00711 fscanf(infile,"Channel Enbable bits chnls 19-27(on = 0):%x\n",
00712 &SCcntrl);
00713 fscanf(infile,"Channel Enbable bits chnls 28-36(on = 0):%x\n",
00714 &Scntrl);
00715 if(localDEBUG)
00716 printf("Channel Enbable bits chnls 1-9 (on = 0):%x\n",Ncntrl);
00717 if(localDEBUG)
00718 printf("Channel Enbable bits chnls 10-18(on = 0):%x\n",NCcntrl);
00719 if(localDEBUG)
00720 printf("Channel Enbable bits chnls 19-27(on = 0):%x\n",SCcntrl);
00721 if(localDEBUG)
00722 printf("Channel Enbable bits chnls 28-36(on = 0):%x\n",Scntrl);
00723
00724
00725 fscanf(infile,"TTCrx Coarse Delay Register 2:%d\n",&CoarseDel);
00726 fscanf(infile,"TTCrc ClkDes2 Register 3:%x\n",&ClkDes2);
00727 fscanf(infile,"TTCrc Fine Dlay ClkDes2 Reg 1:%d\n",&FineDes2Del);
00728 if(localDEBUG)printf("TTCrx Coarse Delay Register 2:%d\n",CoarseDel);
00729 if(localDEBUG)printf("TTCrc ClkDes2 Register 3:%x\n",ClkDes2);
00730 if(localDEBUG)printf("TTCrc Fine Dlay ClkDes2 Reg 1:%d\n",FineDes2Del);
00731
00732
00733 fscanf(infile,"Center Chip Control Reg:%x\n",&Ccntrl);
00734 if(localDEBUG)printf("Control Reg:0x%x\n",Ccntrl);
00735 fscanf(infile,"Initial Slink DAQ mode:%d\n",&modeRegister);
00736 if(localDEBUG)printf("Mode Reg:%d\n",modeRegister);
00737
00738
00739 fscanf(infile,"Channel ADC Gain bits chnls 1-12(1Vpp = 0):%x\n",
00740 &Nadcg);
00741 fscanf(infile,"Channel ADC Gain bits chnls 13-20(1Vpp = 0):%x\n",
00742 &NCadcg);
00743 fscanf(infile,"Channel ADC Gain bits chnls 21-28(1Vpp = 0):%x\n",
00744 &SCadcg);
00745 fscanf(infile,"Channel ADC Gain bits chnls 29-36(1Vpp = 0):%x\n",
00746 &Sadcg);
00747 if(localDEBUG)
00748 printf("Channel ADC Gain bits chnls 1-12(1Vpp = 0):%x\n",Nadcg);
00749 if(localDEBUG)
00750 printf("Channel ADC Gain bits chnls 13-20(1Vpp = 0):%x\n",NCadcg);
00751 if(localDEBUG)
00752 printf("Channel ADC Gain bits chnls 21-28(1Vpp = 0):%x\n",SCadcg);
00753 if(localDEBUG)
00754 printf("Channel ADC Gain bits chnls 29-36(1Vpp = 0):%x\n",Sadcg);
00755
00756
00757 fscanf(infile,"Channel Baseline Enbable chnls 1-9 (on = (0x1ff<<16)+):%x\n",
00758 &Nbaseln);
00759 fscanf(infile,"Channel Baseline Enbable chnls 10-18(on = (0x1ff<<16)+):%x\n",
00760 &NCbaseln);
00761 fscanf(infile,"Channel Baseline Enbable chnls 19-27(on = (0x1ff<<16)+):%x\n",
00762 &SCbaseln);
00763 fscanf(infile,"Channel Baseline Enbable chnls 28-36(on = (0x1ff<<16)+):%x\n",
00764 &Sbaseln);
00765 if(localDEBUG)
00766 printf("Channel Baseline Enbable chnls 1-9 (on = (0x1ff<<16)+):%x\n",Nbaseln);
00767 if(localDEBUG)
00768 printf("Channel Baseline Enbable chnls 10-18(on = (0x1ff<<16)+):%x\n",NCbaseln);
00769 if(localDEBUG)
00770 printf("Channel Baseline Enbable chnls 19-27(on = (0x1ff<<16)+):%x\n",SCbaseln);
00771 if(localDEBUG)
00772 printf("Channel Baseline Enbable chnls 28-36(on = (0x1ff<<16)+):%x\n",Sbaseln);
00773
00774
00775 fscanf(infile,"TBM trailer mask chnls 1-9 (0xff = all masked):%x\n",
00776 &N_TBMmask);
00777 fscanf(infile,"TBM trailer mask chnls 10-18(0xff = all masked):%x\n",
00778 &NC_TBMmask);
00779 fscanf(infile,"TBM trailer mask chnls 19-27(0xff = all masked):%x\n",
00780 &SC_TBMmask);
00781 fscanf(infile,"TBM trailer mask chnls 28-36(0xff = all masked):%x\n",
00782 &S_TBMmask);
00783 if(localDEBUG)
00784 printf("TBM trailer mask chnls 1-9 (0xff = all masked):%x\n",N_TBMmask);
00785 if(localDEBUG)
00786 printf("TBM trailer mask chnls 10-18(0xff = all masked):%x\n",NC_TBMmask);
00787 if(localDEBUG)
00788 printf("TBM trailer mask chnls 19-27(0xff = all masked):%x\n",SC_TBMmask);
00789 if(localDEBUG)
00790 printf("TBM trailer mask chnls 28-36(0xff = all masked):%x\n",S_TBMmask);
00791
00792
00793 fscanf(infile,"Private 8 bit word chnls 1-9 :%x\n",
00794 &N_Pword);
00795 fscanf(infile,"Private 8 bit word chnls 10-18:%x\n",
00796 &NC_Pword);
00797 fscanf(infile,"Private 8 bit word chnls 19-27:%x\n",
00798 &SC_Pword);
00799 fscanf(infile,"Private 8 bit word chnls 28-36:%x\n",
00800 &S_Pword);
00801 if(localDEBUG)
00802 printf("Private 8 bit word chnls 1-9 :%x\n",N_Pword);
00803 if(localDEBUG)
00804 printf("Private 8 bit word chnls 10-18:%x\n",NC_Pword);
00805 if(localDEBUG)
00806 printf("Private 8 bit word chnls 19-27:%x\n",SC_Pword);
00807 if(localDEBUG)
00808 printf("Private 8 bit word chnls 28-36:%x\n",S_Pword);
00809
00810
00811 fscanf(infile,"Special Random testDAC mode (on = 0x1, off=0x0):%x\n",
00812 &SpecialDac);
00813 if(localDEBUG)
00814 printf("Special Random testDAC mode (on = 0x1, off=0x0):%x\n",SpecialDac);
00815
00816
00817
00818 fscanf(infile,"Number of Consecutive (max 1023) Out of Syncs till TTs OOS set:%d\n",
00819 &Ooslvl);
00820 if(localDEBUG)
00821 printf("Number of Consecutive (max 1023) Out of Syncs till TTs OOS set:%d\n",Ooslvl);
00822
00823
00824 fscanf(infile,"Number of Consecutive (max 1023) Empty events till TTs ERR set:%d\n",
00825 &Errlvl);
00826 if(localDEBUG)
00827 printf("Number of Consecutive (max 1023) Empty events till TTs ERR set:%d\n",Errlvl);
00828
00829
00830 fscanf(infile,"N Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",
00831 &Nfifo1Bzlvl);
00832 if(localDEBUG)
00833 printf("N Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",Nfifo1Bzlvl);
00834
00835
00836 fscanf(infile,"NC Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",
00837 &NCfifo1Bzlvl);
00838 if(localDEBUG)
00839 printf("NC Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",NCfifo1Bzlvl);
00840
00841
00842 fscanf(infile,"SC Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",
00843 &SCfifo1Bzlvl);
00844 if(localDEBUG)
00845 printf("SC Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",SCfifo1Bzlvl);
00846
00847
00848 fscanf(infile,"S Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",
00849 &Sfifo1Bzlvl);
00850 if(localDEBUG)
00851 printf("S Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",Sfifo1Bzlvl);
00852
00853
00854 fscanf(infile,"Fifo-3 almost full level,sets TTs WARN (max 8191):%d\n",
00855 &fifo3Wrnlvl);
00856 if(localDEBUG)
00857 printf("Fifo-3 almost full level,sets TTs WARN (max 8191):%d\n",fifo3Wrnlvl);
00858
00859 fscanf(infile,"FED Master delay 0=0,1=32,2=48,3=64:%d\n",
00860 &FedTTCDelay);
00861 if(localDEBUG)
00862 printf("FED Master delay 0=0,1=32,2=48,3=64:%d\n",FedTTCDelay);
00863
00864 fscanf(infile,"TTCrx Register 0 fine delay ClkDes1:%d\n",&FineDes1Del);
00865 if(localDEBUG)
00866 printf("TTCrx Register 0 fine delay ClkDes1:%d\n",FineDes1Del);
00867
00868 int checkword=0;
00869 fscanf(infile,"Params FED file check word:%d\n",
00870 &checkword);
00871 if(checkword!=90508&&checkword!=91509) cout << __LINE__ << "]\t" << mthn
00872 << "FEDID: " << fedNumber
00873 << " Params FED File read error. Checkword read " << checkword
00874 <<" check word expected 090508 or 91509" << endl;
00875 assert((checkword==90508)|(checkword==91509));
00876
00877 if(localDEBUG)
00878 cout << __LINE__ << "]\t" << mthn << "Params FED file check word: " << checkword << endl;
00879
00880
00881
00882 if(checkword==91509){
00883
00884 fscanf(infile,"N fifo-1 hit limit (max 1023 (hard) 900 (soft):%d\n",&N_hitlimit);
00885 if(localDEBUG)
00886 printf("N fifo-1 hit limit (max 1023 (hard) 900 (soft):%d\n",N_hitlimit);
00887 fscanf(infile,"NC fifo-1 hit limit (max 1023 (hard) 900 (soft):%d\n",&NC_hitlimit);
00888 if(localDEBUG)
00889 printf("NC fifo-1 hit limit (max 1023 (hard) 900 (soft):%d\n",NC_hitlimit);
00890 fscanf(infile,"SC fifo-1 hit limit (max 1023 (hard) 900 (soft):%d\n",&SC_hitlimit);
00891 if(localDEBUG)
00892 printf("SC fifo-1 hit limit (max 1023 (hard) 900 (soft):%d\n",SC_hitlimit);
00893 fscanf(infile,"S fifo-1 hit limit (max 1023 (hard) 900 (soft):%d\n",&S_hitlimit);
00894 if(localDEBUG)
00895 printf("S fifo-1 hit limit (max 1023 (hard) 900 (soft):%d\n",S_hitlimit);
00896
00897
00898 fscanf(infile,"Skip a ROC in ch 1-9, bits 10-5 chnl, bits 0-4 ROC-1:%d\n",&N_testreg);
00899 if(localDEBUG)
00900 printf("Skip a ROC in ch 1-9, bits 10-5 chnl, bits 0-4 ROC-1:%d\n",N_testreg);
00901 fscanf(infile,"Skip a ROC in ch 10-18, bits 10-5 chnl, bits 0-4 ROC-1:%d\n",&NC_testreg);
00902 if(localDEBUG)
00903 printf("Skip a ROC in ch 10-18, bits 10-5 chnl, bits 0-4 ROC-1:%d\n",NC_testreg);
00904 fscanf(infile,"Skip a ROC in ch 19-27, bits 10-5 chnl, bits 0-4 ROC-1:%d\n",&SC_testreg);
00905 if(localDEBUG)
00906 printf("Skip a ROC in ch 19-27, bits 10-5 chnl, bits 0-4 ROC-1:%d\n",SC_testreg);
00907 fscanf(infile,"Skip a ROC in ch 28-36, bits 10-5 chnl, bits 0-4 ROC-1:%d\n",&S_testreg);
00908 if(localDEBUG)
00909 printf("Skip a ROC in ch 28-36, bits 10-5 chnl, bits 0-4 ROC-1:%d\n",S_testreg);
00910 } else {
00911
00912 N_hitlimit=192;
00913 NC_hitlimit=192;
00914 SC_hitlimit=192;
00915 S_hitlimit=192;
00916
00917 N_testreg=0;
00918 NC_testreg=0;
00919 SC_testreg=0;
00920 S_testreg=0;
00921 }
00922
00923 fclose(infile);
00924
00925 Ccntrl_original=Ccntrl;
00926 modeRegister_original=modeRegister;
00927
00928
00929 Ncntrl_original=Ncntrl;
00930 NCcntrl_original=NCcntrl;
00931 SCcntrl_original=SCcntrl;
00932 Scntrl_original=Scntrl;
00933
00934 Nbaseln_original=Nbaseln;
00935 NCbaseln_original=NCbaseln;
00936 SCbaseln_original=SCbaseln;
00937 Sbaseln_original=Sbaseln;
00938
00939 return;
00940 }
00941
00942
00943
00944 void PixelFEDCard::clear(void)
00945 {
00946 FEDBASE_0 = 0 ;
00947 fedNumber = 999 ;
00948 for(int i=0;i<36;i++){
00949 NRocs[i] = 0;
00950 offs_dac[i] = 0;
00951 BlackHi[i] = 0;
00952 BlackLo[i] = 0;
00953 Ublack[i] = 0;
00954 DelayCh[i] = 0;
00955 TBM_L0[i] = 0;
00956 TBM_L1[i] = 0;
00957 TBM_L2[i] = 0;
00958 TBM_L3[i] = 0;
00959 TBM_L4[i] = 0;
00960 TRL_L0[i] = 0;
00961 TRL_L1[i] = 0;
00962 TRL_L2[i] = 0;
00963 TRL_L3[i] = 0;
00964 TRL_L4[i] = 0;
00965 }
00966 for(int i=0;i<3;i++){
00967 opt_cap[i] = 0;
00968 opt_inadj[i] = 0;
00969 opt_ouadj[i] = 0;
00970 }
00971 clkphs1_9 = 0;
00972 clkphs10_18 = 0;
00973 clkphs19_27 = 0;
00974 clkphs28_36 = 0;
00975
00976 for(int i=0;i<36;i++) {
00977 for(int j=0;j<26;j++) {
00978 ROC_L0[i][j] = 0;
00979 ROC_L1[i][j] = 0;
00980 ROC_L2[i][j] = 0;
00981 ROC_L3[i][j] = 0;
00982 ROC_L4[i][j] = 0;
00983 }
00984 }
00985 Ncntrl = 0;
00986 NCcntrl = 0;
00987 SCcntrl = 0;
00988 Scntrl = 0;
00989 CoarseDel = 0;
00990 ClkDes2 = 0;
00991 FineDes2Del = 0;
00992 FineDes1Del = 0;
00993 Ccntrl = 0;
00994 modeRegister = 0;
00995 Nadcg = 0;
00996 NCadcg = 0;
00997 SCadcg = 0;
00998 Sadcg = 0;
00999 Nbaseln = 0;
01000 NCbaseln = 0;
01001 SCbaseln = 0;
01002 Sbaseln = 0;
01003 N_TBMmask = 0;
01004 NC_TBMmask = 0;
01005 SC_TBMmask = 0;
01006 S_TBMmask = 0;
01007 N_Pword = 0;
01008 NC_Pword = 0;
01009 SC_Pword = 0;
01010 S_Pword = 0;
01011 SpecialDac = 0;
01012 Ooslvl = 0;
01013 Errlvl = 0;
01014 Nfifo1Bzlvl = 0;
01015 NCfifo1Bzlvl = 0;
01016 SCfifo1Bzlvl = 0;
01017 Sfifo1Bzlvl = 0;
01018 fifo3Wrnlvl = 0;
01019 }
01020
01021
01022 void PixelFEDCard::writeASCII(std::string dir) const{
01023
01024 std::string mthn = "[PixelFEDCard::writeASCII()]\t\t\t\t " ;
01025
01026 ostringstream s1;
01027 s1<<fedNumber;
01028 std::string fedNum=s1.str();
01029
01030 if (dir!="") dir+="/";
01031
01032 std::string filename=dir+"params_fed_"+fedNum+".dat";
01033
01034 FILE *outfile = fopen((filename.c_str()),"w");
01035 if (outfile == NULL) {
01036 cout<< __LINE__ << "]\t" << mthn << "Could not open file: " << filename << " for writing" << endl;
01037 return;
01038 }
01039
01040
01041 fprintf(outfile,"FED Base address :0x%lx\n",
01042 FEDBASE_0);
01043 fprintf(outfile,"FEDID Number :0x%lx\n",
01044 fedNumber);
01045
01046
01047 int ijx=0;
01048 for(int i=0;i<36;i++){
01049 ijx=i+1;
01050 fprintf(outfile,"Number of ROCs Chnl %d:%d\n",ijx,NRocs[i]);
01051 }
01052
01053
01054 fprintf(outfile,"Optical reciever 1 Capacitor Adjust(0-3):%d\n",opt_cap[0]);
01055 fprintf(outfile,"Optical reciever 2 Capacitor Adjust(0-3):%d\n",opt_cap[1]);
01056 fprintf(outfile,"Optical reciever 3 Capacitor Adjust(0-3):%d\n",opt_cap[2]);
01057 fprintf(outfile,"Optical reciever 1 Input Offset (0-15) :%d\n",opt_inadj[0]);
01058 fprintf(outfile,"Optical reciever 2 Input Offset (0-15) :%d\n",opt_inadj[1]);
01059 fprintf(outfile,"Optical reciever 3 Input Offset (0-15) :%d\n",opt_inadj[2]);
01060 fprintf(outfile,"Optical reciever 1 Output Offset (0-3) :%d\n",opt_ouadj[0]);
01061 fprintf(outfile,"Optical reciever 2 Output Offset (0-3) :%d\n",opt_ouadj[1]);
01062 fprintf(outfile,"Optical reciever 3 Output Offset (0-3) :%d\n",opt_ouadj[2]);
01063
01064
01065 for(int i=0;i<36;i++) {
01066 fprintf(outfile,"Offset DAC channel %d:%d\n",i+1,offs_dac[i]);
01067 }
01068
01069
01070 fprintf(outfile,"Clock Phase Bits ch 1-9:0x%x\n",clkphs1_9 );
01071 fprintf(outfile,"Clock Phase Bits ch 10-18:0x%x\n",clkphs10_18);
01072 fprintf(outfile,"Clock Phase Bits ch 19-27:0x%x\n",clkphs19_27);
01073 fprintf(outfile,"Clock Phase Bits ch 28-36:0x%x\n",clkphs28_36);
01074
01075
01076 for(int i=0;i<36;i++){
01077 fprintf(outfile,"Black HiThold ch %d:%d \n",i+1,BlackHi[i]);
01078 fprintf(outfile,"Black LoThold ch %d:%d \n",i+1,BlackLo[i]);
01079 fprintf(outfile,"ULblack Thold ch %d:%d \n",i+1,Ublack[i]);
01080 }
01081
01082
01083 for(int i=0;i<36;i++) {
01084 fprintf(outfile,"Delay channel %d(0-15):%d\n",i+1,DelayCh[i]);
01085 }
01086
01087
01088 for(int i=0;i<36;i++) {
01089 fprintf(outfile,"TBM level 0 Channel %d:%d\n",i+1,TBM_L0[i]);
01090 fprintf(outfile,"TBM level 1 Channel %d:%d\n",i+1,TBM_L1[i]);
01091 fprintf(outfile,"TBM level 2 Channel %d:%d\n",i+1,TBM_L2[i]);
01092 fprintf(outfile,"TBM level 3 Channel %d:%d\n",i+1,TBM_L3[i]);
01093 fprintf(outfile,"TBM level 4 Channel %d:%d\n",i+1,TBM_L4[i]);
01094
01095 for(int j=0;j<NRocs[i];j++) {
01096 fprintf(outfile,"ROC%d level 0 Channel %d :%d\n",
01097 j,i+1,ROC_L0[i][j]);
01098 fprintf(outfile,"ROC%d level 1 Channel %d :%d\n",
01099 j,i+1,ROC_L1[i][j]);
01100 fprintf(outfile,"ROC%d level 2 Channel %d :%d\n",
01101 j,i+1,ROC_L2[i][j]);
01102 fprintf(outfile,"ROC%d level 3 Channel %d :%d\n",
01103 j,i+1,ROC_L3[i][j]);
01104 fprintf(outfile,"ROC%d level 4 Channel %d :%d\n",
01105 j,i+1,ROC_L4[i][j]);
01106 }
01107
01108 fprintf(outfile,"TRLR level 0 Channel %d:%d\n",i+1,TRL_L0[i]);
01109 fprintf(outfile,"TRLR level 1 Channel %d:%d\n",i+1,TRL_L1[i]);
01110 fprintf(outfile,"TRLR level 2 Channel %d:%d\n",i+1,TRL_L2[i]);
01111 fprintf(outfile,"TRLR level 3 Channel %d:%d\n",i+1,TRL_L3[i]);
01112 fprintf(outfile,"TRLR level 4 Channel %d:%d\n",i+1,TRL_L4[i]);
01113 }
01114
01115
01116
01117 fprintf(outfile,"Channel Enbable bits chnls 1-9 (on = 0):0x%x\n",
01118 Ncntrl);
01119 fprintf(outfile,"Channel Enbable bits chnls 10-18(on = 0):0x%x\n",
01120 NCcntrl);
01121 fprintf(outfile,"Channel Enbable bits chnls 19-27(on = 0):0x%x\n",
01122 SCcntrl);
01123 fprintf(outfile,"Channel Enbable bits chnls 28-36(on = 0):0x%x\n",
01124 Scntrl);
01125
01126
01127 fprintf(outfile,"TTCrx Coarse Delay Register 2:%d\n",CoarseDel);
01128 fprintf(outfile,"TTCrc ClkDes2 Register 3:0x%x\n",ClkDes2);
01129 fprintf(outfile,"TTCrc Fine Dlay ClkDes2 Reg 1:%d\n",FineDes2Del);
01130
01131
01132 fprintf(outfile,"Center Chip Control Reg:0x%x\n",Ccntrl);
01133 fprintf(outfile,"Initial Slink DAQ mode:%d\n",modeRegister);
01134
01135
01136 fprintf(outfile,"Channel ADC Gain bits chnls 1-12(1Vpp = 0):0x%x\n",
01137 Nadcg);
01138 fprintf(outfile,"Channel ADC Gain bits chnls 13-20(1Vpp = 0):0x%x\n",
01139 NCadcg);
01140 fprintf(outfile,"Channel ADC Gain bits chnls 21-28(1Vpp = 0):0x%x\n",
01141 SCadcg);
01142 fprintf(outfile,"Channel ADC Gain bits chnls 29-36(1Vpp = 0):0x%x\n",
01143 Sadcg);
01144
01145
01146 fprintf(outfile,"Channel Baseline Enbable chnls 1-9 (on = (0x1ff<<16)+):0x%x\n",
01147 Nbaseln);
01148 fprintf(outfile,"Channel Baseline Enbable chnls 10-18(on = (0x1ff<<16)+):0x%x\n",
01149 NCbaseln);
01150 fprintf(outfile,"Channel Baseline Enbable chnls 19-27(on = (0x1ff<<16)+):0x%x\n",
01151 SCbaseln);
01152 fprintf(outfile,"Channel Baseline Enbable chnls 28-36(on = (0x1ff<<16)+):0x%x\n",
01153 Sbaseln);
01154
01155
01156 fprintf(outfile,"TBM trailer mask chnls 1-9 (0xff = all masked):0x%x\n",
01157 N_TBMmask);
01158 fprintf(outfile,"TBM trailer mask chnls 10-18(0xff = all masked):0x%x\n",
01159 NC_TBMmask);
01160 fprintf(outfile,"TBM trailer mask chnls 19-27(0xff = all masked):0x%x\n",
01161 SC_TBMmask);
01162 fprintf(outfile,"TBM trailer mask chnls 28-36(0xff = all masked):0x%x\n",
01163 S_TBMmask);
01164
01165
01166 fprintf(outfile,"Private 8 bit word chnls 1-9 :0x%x\n",
01167 N_Pword);
01168 fprintf(outfile,"Private 8 bit word chnls 10-18:0x%x\n",
01169 NC_Pword);
01170 fprintf(outfile,"Private 8 bit word chnls 19-27:0x%x\n",
01171 SC_Pword);
01172 fprintf(outfile,"Private 8 bit word chnls 28-36:0x%x\n",
01173 S_Pword);
01174
01175
01176 fprintf(outfile,"Special Random testDAC mode (on = 0x1, off=0x0):0x%x\n",
01177 SpecialDac);
01178
01179
01180 fprintf(outfile,"Number of Consecutive (max 1023) Out of Syncs till TTs OOS set:%d\n",
01181 Ooslvl);
01182
01183
01184 fprintf(outfile,"Number of Consecutive (max 1023) Empty events till TTs ERR set:%d\n",
01185 Errlvl);
01186
01187
01188 fprintf(outfile,"N Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",
01189 Nfifo1Bzlvl);
01190
01191
01192 fprintf(outfile,"NC Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",
01193 NCfifo1Bzlvl);
01194
01195
01196 fprintf(outfile,"SC Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",
01197 SCfifo1Bzlvl);
01198
01199
01200 fprintf(outfile,"S Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",
01201 Sfifo1Bzlvl);
01202
01203
01204 fprintf(outfile,"Fifo-3 almost full level,sets TTs WARN (max 8191):%d\n",
01205 fifo3Wrnlvl);
01206
01207 fprintf(outfile,"FED Master delay 0=0,1=32,2=48,3=64:%d\n",
01208 FedTTCDelay);
01209
01210 fprintf(outfile,"TTCrx Register 0 fine delay ClkDes1:%d\n",
01211 FineDes1Del);
01212
01213 int checkword=91509;
01214
01215 fprintf(outfile,"Params FED file check word:%d\n",
01216 checkword);
01217
01218
01219
01220 fprintf(outfile,"N fifo-1 hit limit (max 1023 (hard) 900 (soft):%d\n",
01221 N_hitlimit);
01222
01223 fprintf(outfile,"NC fifo-1 hit limit (max 1023 (hard) 900 (soft):%d\n",
01224 NC_hitlimit);
01225
01226 fprintf(outfile,"SC fifo-1 hit limit (max 1023 (hard) 900 (soft):%d\n",
01227 SC_hitlimit);
01228
01229 fprintf(outfile,"S fifo-1 hit limit (max 1023 (hard) 900 (soft):%d\n",
01230 S_hitlimit);
01231
01232
01233
01234 fprintf(outfile,"Skip a ROC in ch 1-9, bits 10-5 chnl, bits 0-4 ROC-1:%d\n",
01235 N_testreg);
01236
01237 fprintf(outfile,"Skip a ROC in ch 10-18, bits 10-5 chnl, bits 0-4 ROC-1:%d\n",
01238 NC_testreg);
01239
01240 fprintf(outfile,"Skip a ROC in ch 19-27, bits 10-5 chnl, bits 0-4 ROC-1:%d\n",
01241 SC_testreg);
01242
01243 fprintf(outfile,"Skip a ROC in ch 28-36, bits 10-5 chnl, bits 0-4 ROC-1:%d\n",
01244 S_testreg);
01245
01246
01247
01248 fclose(outfile);
01249
01250
01251 }
01252
01253
01254
01255 void PixelFEDCard::writeXMLHeader(pos::PixelConfigKey key,
01256 int version,
01257 std::string path,
01258 std::ofstream *fedstream,
01259 std::ofstream *rocstream,
01260 std::ofstream *tbmstream) const
01261 {
01262 std::string mthn = "[PixelFEDCard::writeXMLHeader()]\t\t\t " ;
01263 std::stringstream fedfullPath ;
01264 std::stringstream rocfullPath ;
01265 std::stringstream tbmfullPath ;
01266
01267
01268
01269 fedfullPath << path << "/FedConfiguration_Template_" << PixelTimeFormatter::getmSecTime() << ".xml" ;
01270 std::cout << __LINE__ << "]\t" << mthn << "Writing to: " << fedfullPath.str() << "" << std::endl ;
01271
01272 fedstream->open(fedfullPath.str().c_str()) ;
01273
01274 *fedstream << "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl ;
01275 *fedstream << "<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl ;
01276 *fedstream << "" << std::endl ;
01277 *fedstream << " <HEADER>" << std::endl ;
01278 *fedstream << " <HINTS mode='load-as-group' /> " << std::endl ;
01279 *fedstream << " <TYPE>" << std::endl ;
01280 *fedstream << " <EXTENSION_TABLE_NAME>FED_CONFIGURATION</EXTENSION_TABLE_NAME>" << std::endl ;
01281 *fedstream << " <NAME>Pixel FED Configuration</NAME>" << std::endl ;
01282 *fedstream << " </TYPE>" << std::endl ;
01283 *fedstream << " <RUN>" << std::endl ;
01284 *fedstream << " <RUN_TYPE>Pixel FED Configuration</RUN_TYPE>" << std::endl ;
01285 *fedstream << " <RUN_NUMBER>1</RUN_NUMBER>" << std::endl ;
01286 *fedstream << " <RUN_BEGIN_TIMESTAMP>" << PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>" << std::endl ;
01287 *fedstream << " <LOCATION>CERN P5</LOCATION>" << std::endl ;
01288 *fedstream << " </RUN>" << std::endl ;
01289 *fedstream << " </HEADER>" << std::endl ;
01290 *fedstream << "" << std::endl ;
01291 *fedstream << " <DATA_SET>" << std::endl ;
01292 *fedstream << "" << std::endl ;
01293 *fedstream << " <VERSION>" << version << "</VERSION>" << std::endl ;
01294 *fedstream << " <COMMENT_DESCRIPTION>" << getComment() << "</COMMENT_DESCRIPTION>" << std::endl ;
01295 *fedstream << " <CREATED_BY_USER>" << getAuthor() << "</CREATED_BY_USER>" << std::endl ;
01296 *fedstream << "" << std::endl ;
01297 *fedstream << " <PART>" << std::endl ;
01298 *fedstream << " <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl ;
01299 *fedstream << " <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl ;
01300 *fedstream << " </PART>" << std::endl ;
01301
01302
01303 rocfullPath << path << "/Pixel_RocAnalogLevels_" << PixelTimeFormatter::getmSecTime() << ".xml" ;
01304 std::cout << __LINE__ << "]\t" << mthn << "Writing to: " << rocfullPath.str() << "" << std::endl ;
01305
01306 rocstream->open(rocfullPath.str().c_str()) ;
01307
01308
01309 *rocstream << "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" << std::endl ;
01310 *rocstream << "<ROOT xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" << std::endl ;
01311 *rocstream << "" << std::endl ;
01312 *rocstream << " <HEADER>" << std::endl ;
01313 *rocstream << " <HINTS mode='only-det-root,load-as-group'/>" << std::endl ;
01314 *rocstream << " <TYPE>" << std::endl ;
01315 *rocstream << " <EXTENSION_TABLE_NAME>ROC_ANALOG_LEVELS</EXTENSION_TABLE_NAME>" << std::endl ;
01316 *rocstream << " <NAME>ROC Analog Levels</NAME>" << std::endl ;
01317 *rocstream << " </TYPE>" << std::endl ;
01318 *rocstream << " <RUN>" << std::endl ;
01319 *rocstream << " <RUN_TYPE>ROC Analog Levels</RUN_TYPE>" << std::endl ;
01320 *rocstream << " <RUN_NUMBER>1</RUN_NUMBER> " << std::endl ;
01321 *rocstream << " <RUN_BEGIN_TIMESTAMP>" << PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>" << std::endl ;
01322 *rocstream << " <CREATED_BY_USER>Umesh Joshi</CREATED_BY_USER> " << std::endl ;
01323 *rocstream << " <LOCATION>CERN</LOCATION> " << std::endl ;
01324 *rocstream << " <COMMENT_DESCRIPTION>ROC Analog Levels Template</COMMENT_DESCRIPTION>" << std::endl ;
01325 *rocstream << " </RUN>" << std::endl ;
01326 *rocstream << " </HEADER>" << std::endl ;
01327 *rocstream << "" << std::endl ;
01328 *rocstream << " <DATA_SET>" << std::endl ;
01329 *rocstream << " <COMMENT_DESCRIPTION>ROC Analog Levels Template</COMMENT_DESCRIPTION>" << std::endl ;
01330 *rocstream << " <VERSION>" << version << "</VERSION>" << std::endl ;
01331 *rocstream << " " << std::endl ;
01332 *rocstream << " <PART>" << std::endl ;
01333 *rocstream << " <SERIAL_NUMBER>CMS-PIXEL-ROOT</SERIAL_NUMBER>" << std::endl ;
01334 *rocstream << " <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl ;
01335 *rocstream << " </PART>" << std::endl ;
01336
01337
01338 tbmfullPath << path << "/Pixel_TbmAnalogLevels_" << PixelTimeFormatter::getmSecTime() << ".xml" ;
01339 std::cout << __LINE__ << "]\t" << mthn << "Writing to: " << tbmfullPath.str() << "" << std::endl ;
01340
01341 tbmstream->open(tbmfullPath.str().c_str()) ;
01342
01343
01344 *tbmstream << "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" << std::endl ;
01345 *tbmstream << "<ROOT xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" << std::endl ;
01346 *tbmstream << "" << std::endl ;
01347 *tbmstream << " <HEADER>" << std::endl ;
01348 *tbmstream << " <HINTS mode='only-det-root,load-as-group' />" << std::endl ;
01349 *tbmstream << " <TYPE>" << std::endl ;
01350 *tbmstream << " <EXTENSION_TABLE_NAME>TBM_ANALOG_LEVELS</EXTENSION_TABLE_NAME>" << std::endl ;
01351 *tbmstream << " <NAME>TBM Analog Levels</NAME>" << std::endl ;
01352 *tbmstream << " </TYPE>" << std::endl ;
01353 *tbmstream << " <RUN>" << std::endl ;
01354 *tbmstream << " <RUN_TYPE>TBM Analog Levels</RUN_TYPE>" << std::endl ;
01355 *tbmstream << " <RUN_NUMBER>1</RUN_NUMBER>" << std::endl ;
01356 *tbmstream << " <RUN_BEGIN_TIMESTAMP>" << PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>" << std::endl ;
01357 *tbmstream << " <CREATED_BY_USER>Umesh Joshi</CREATED_BY_USER> " << std::endl ;
01358 *tbmstream << " <LOCATION>CERN</LOCATION> " << std::endl ;
01359 *tbmstream << " <COMMENT_DESCRIPTION>TBM Analog Levels</COMMENT_DESCRIPTION>" << std::endl ;
01360 *tbmstream << " </RUN>" << std::endl ;
01361 *tbmstream << " </HEADER>" << std::endl ;
01362 *tbmstream << "" << std::endl ;
01363 *tbmstream << " <DATA_SET>" << std::endl ;
01364 *tbmstream << " <VERSION>" << version << "</VERSION>" << std::endl ;
01365 *tbmstream << " " << std::endl ;
01366 *tbmstream << " <PART>" << std::endl ;
01367 *tbmstream << " <SERIAL_NUMBER>CMS-PIXEL-ROOT</SERIAL_NUMBER>" << std::endl ;
01368 *tbmstream << " <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl ;
01369 *tbmstream << " </PART>" << std::endl ;
01370
01371 }
01372
01373
01374 void PixelFEDCard::writeXMLHeader(pos::PixelConfigKey key, int version, std::string path, std::ofstream *out) const {
01375 std::string mthn = "[PixelFEDCard::writeXMLHeader()]\t\t\t " ;
01376 std::stringstream fullPath ;
01377
01378 fullPath << path << "/fedcard_" << PixelTimeFormatter::getmSecTime() << ".xml" ;
01379 std::cout << __LINE__ << "]\t" << mthn << "Writing to: " << fullPath.str() << "" << std::endl ;
01380
01381 out->open(fullPath.str().c_str()) ;
01382
01383 *out << "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl ;
01384 *out << "<ROOT>" << std::endl ;
01385 *out << "" << std::endl ;
01386 *out << " <HEADER>" << std::endl ;
01387 *out << " <TYPE>" << std::endl ;
01388 *out << " <EXTENSION_TABLE_NAME>FED_CONFIGURATION</EXTENSION_TABLE_NAME>" << std::endl ;
01389 *out << " <NAME>Pixel FED Configuration</NAME>" << std::endl ;
01390 *out << " </TYPE>" << std::endl ;
01391 *out << " <RUN>" << std::endl ;
01392 *out << " <RUN_TYPE>Pixel FED Configuration</RUN_TYPE>" << std::endl ;
01393 *out << " <RUN_NUMBER>1</RUN_NUMBER>" << std::endl ;
01394 *out << " <RUN_BEGIN_TIMESTAMP>" << PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>" << std::endl ;
01395 *out << " <COMMENT_DESCRIPTION>Pixel FED Configuration</COMMENT_DESCRIPTION>" << std::endl ;
01396 *out << " <LOCATION>CERN TAC</LOCATION>" << std::endl ;
01397 *out << " <CREATED_BY_USER>Dario Menasce</CREATED_BY_USER>" << std::endl ;
01398 *out << " </RUN>" << std::endl ;
01399 *out << " </HEADER>" << std::endl ;
01400 *out << "" << std::endl ;
01401 *out << " <DATA_SET>" << std::endl ;
01402 *out << "" << std::endl ;
01403 *out << " <VERSION>" << version << "</VERSION>" << std::endl ;
01404 *out << " <COMMENT_DESCRIPTION>Pixel FED Configuration</COMMENT_DESCRIPTION>" << std::endl ;
01405 *out << "" << std::endl ;
01406 *out << " <PART>" << std::endl ;
01407 *out << " <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl ;
01408 *out << " <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl ;
01409 *out << " </PART>" << std::endl ;
01410 }
01411
01412 void PixelFEDCard::writeXML( std::ofstream *out) const {
01413 std::string mthn = "[PixelFEDCard::writeXML()]\t\t\t " ;
01414
01415 *out << " <DATA>" << std::endl ;
01416 *out << " " << std::endl ;
01417 *out << " <PXLFED_NAME>PxlFED_" << fedNumber<< "</PXLFED_NAME>" << std::endl ;
01418 *out << " <VME_ADDRESS>268435456</VME_ADDRESS>" << std::endl ;
01419
01420
01421
01422
01423 *out << "" << std::endl ;
01424 *out << " <CHANNEL_ID>1</CHANNEL_ID>" << std::endl ;
01425 *out << " <NUMBER_OF_ROCS>21</NUMBER_OF_ROCS>" << std::endl ;
01426 *out << " <CHANNEL_OFFSET_DAC_SETTINGS>0</CHANNEL_OFFSET_DAC_SETTINGS>" << std::endl ;
01427 *out << " <CHANNEL_DELAY_SETTINGS>3</CHANNEL_DELAY_SETTINGS>" << std::endl ;
01428 *out << " <CHANNEL_BLACK_HIGH>400</CHANNEL_BLACK_HIGH>" << std::endl ;
01429 *out << " <CHANNEL_BLACK_LOW>150</CHANNEL_BLACK_LOW>" << std::endl ;
01430 *out << " <CHANNEL_ULTRA_BLACK>120</CHANNEL_ULTRA_BLACK>" << std::endl ;
01431 *out << "" << std::endl ;
01432 *out << " <OPT1_CAP>0</OPT1_CAP>" << std::endl ;
01433 *out << " <OPT2_CAP>0</OPT2_CAP>" << std::endl ;
01434 *out << " <OPT3_CAP>0</OPT3_CAP>" << std::endl ;
01435 *out << " <OPT1_INP>0</OPT1_INP>" << std::endl ;
01436 *out << " <OPT2_INP>0</OPT2_INP>" << std::endl ;
01437 *out << " <OPT3_INP>0</OPT3_INP>" << std::endl ;
01438 *out << " <OPT1_OUT>0</OPT1_OUT>" << std::endl ;
01439 *out << " <OPT2_OUT>0</OPT2_OUT>" << std::endl ;
01440 *out << " <OPT3_OUT>0</OPT3_OUT>" << std::endl ;
01441 *out << " <NORTH_CLKPHB>511</NORTH_CLKPHB>" << std::endl ;
01442 *out << " <NORTHCENTER_CLKPHB>511</NORTHCENTER_CLKPHB>" << std::endl ;
01443 *out << " <SOUTHCENTER_CLKPHB>511</SOUTHCENTER_CLKPHB>" << std::endl ;
01444 *out << " <SOUTH_CLKPHB>511</SOUTH_CLKPHB>" << std::endl ;
01445 *out << " <NORTH_CTRL>0</NORTH_CTRL> " << std::endl ;
01446 *out << " <NORTHCENTER_CTRL>0</NORTHCENTER_CTRL>" << std::endl ;
01447 *out << " <SOUTHCENTER_CTRL>0</SOUTHCENTER_CTRL>" << std::endl ;
01448 *out << " <SOUTH_CTRL>0</SOUTH_CTRL>" << std::endl ;
01449 *out << " <REG1_TTCRX_FDLA>5</REG1_TTCRX_FDLA>" << std::endl ;
01450 *out << " <REG2_TTCRX_CDLA>0</REG2_TTCRX_CDLA>" << std::endl ;
01451 *out << " <REG3_TTCRX_CLKD2>155</REG3_TTCRX_CLKD2>" << std::endl ;
01452 *out << " <CENTER_CTRL>0</CENTER_CTRL>" << std::endl ;
01453 *out << " <CENTER_MODE>0</CENTER_MODE>" << std::endl ;
01454 *out << " <B1_ADCGN>0</B1_ADCGN>" << std::endl ;
01455 *out << " <B2_ADCGN>0</B2_ADCGN>" << std::endl ;
01456 *out << " <B3_ADCGN>0</B3_ADCGN>" << std::endl ;
01457 *out << " <B4_ADCGN>0</B4_ADCGN>" << std::endl ;
01458 *out << " <NORTH_BADJ>330</NORTH_BADJ>" << std::endl ;
01459 *out << " <NORTHCENTER_BADJ>330</NORTHCENTER_BADJ>" << std::endl ;
01460 *out << " <SOUTHCENTER_BADJ>330</SOUTHCENTER_BADJ>" << std::endl ;
01461 *out << " <SOUTH_BADJ>330</SOUTH_BADJ>" << std::endl ;
01462 *out << " <NORTH_TBMMASK>2</NORTH_TBMMASK>" << std::endl ;
01463 *out << " <NORTHCENTER_TBMMASK>2</NORTHCENTER_TBMMASK>" << std::endl ;
01464 *out << " <SOUTHCENTER_TBMMASK>2</SOUTHCENTER_TBMMASK>" << std::endl ;
01465 *out << " <SOUTH_TBMMASK>2</SOUTH_TBMMASK>" << std::endl ;
01466 *out << " <NORTH_PWORD>177</NORTH_PWORD>" << std::endl ;
01467 *out << " <NORTHCENTER_PWORD>178</NORTHCENTER_PWORD>" << std::endl ;
01468 *out << " <SOUTHCENTER_PWORD>179</SOUTHCENTER_PWORD>" << std::endl ;
01469 *out << " <SOUTH_PWORD>180</SOUTH_PWORD>" << std::endl ;
01470 *out << " <SPECDAC>0</SPECDAC>" << std::endl ;
01471 *out << " <OOS_LVL>0</OOS_LVL>" << std::endl ;
01472 *out << " <ERR_LVL>0</ERR_LVL>" << std::endl ;
01473 *out << " <NORTH_FIFO1_BZ_LVL>900</NORTH_FIFO1_BZ_LVL>" << std::endl ;
01474 *out << " <NORTHCENTER_FIFO1_BZ_LVL>900</NORTHCENTER_FIFO1_BZ_LVL>" << std::endl ;
01475 *out << " <SOUTHCENTER_FIFO1_BZ_LVL>900</SOUTHCENTER_FIFO1_BZ_LVL>" << std::endl ;
01476 *out << " <SOUTH_FIFO1_BZ_LVL>900</SOUTH_FIFO1_BZ_LVL>" << std::endl ;
01477 *out << " <FIFO3_WRN_LVL>7680</FIFO3_WRN_LVL> " << std::endl ;
01478 *out << " <FED_MASTER_DELAY>0</FED_MASTER_DELAY>" << std::endl ;
01479 *out << " <NO_HITLIMIT>0</NO_HITLIMIT>" << std::endl ;
01480 *out << " <NC_HITLIMIT>0</NC_HITLIMIT>" << std::endl ;
01481 *out << " <SC_HITLIMIT>0</SC_HITLIMIT>" << std::endl ;
01482 *out << " <SO_HITLIMIT>0</SO_HITLIMIT>" << std::endl ;
01483 *out << " <NO_TESTREG>0</NO_TESTREG>" << std::endl ;
01484 *out << " <NC_TESTREG>0</NC_TESTREG>" << std::endl ;
01485 *out << " <SC_TESTREG>0</SC_TESTREG>" << std::endl ;
01486 *out << " <SO_TESTREG>0</SO_TESTREG>" << std::endl ;
01487 *out << " " << std::endl ;
01488 *out << " </DATA>" << std::endl ;
01489 *out << " " << std::endl ;
01490 }
01491
01492
01493 void PixelFEDCard::writeXML( std::ofstream *fedstream,
01494 std::ofstream *rocstream,
01495 std::ofstream *tbmstream) const
01496 {
01497 std::string mthn = "[PixelFEDCard::writeXML()]\t\t\t " ;
01498
01499 for(int i=0;i<36;i++)
01500 {
01501 *fedstream << " <DATA>" << std::endl ;
01502 *fedstream << " " << std::endl ;
01503 *fedstream << " <PIXEL_FED>" << fedNumber << "</PIXEL_FED>" << std::endl ;
01504 *fedstream << " <VME_ADDRS_HEX>0x" << hex << FEDBASE_0 << dec << "</VME_ADDRS_HEX>" << std::endl ;
01505 *fedstream << "" << std::endl ;
01506 *fedstream << " <CHANNEL_ID>" << i+1 << "</CHANNEL_ID>" << std::endl ;
01507 *fedstream << " <NUM_ROCS>" << NRocs[i] << "</NUM_ROCS>" << std::endl ;
01508 *fedstream << " <CHAN_OFFST_DAC>" << offs_dac[i] << "</CHAN_OFFST_DAC>" << std::endl ;
01509 *fedstream << " <CHAN_DELAY>" << DelayCh[i] << "</CHAN_DELAY>" << std::endl ;
01510 *fedstream << " <CHAN_BHIGH>" << BlackHi[i] << "</CHAN_BHIGH>" << std::endl ;
01511 *fedstream << " <CHAN_BLOW>" << BlackLo[i] << "</CHAN_BLOW>" << std::endl ;
01512 *fedstream << " <CHAN_UB>" << Ublack[i] << "</CHAN_UB>" << std::endl ;
01513 *fedstream << "" << std::endl ;
01514 *fedstream << " <OPT1_CAP>" << opt_cap[0] << "</OPT1_CAP>" << std::endl ;
01515 *fedstream << " <OPT2_CAP>" << opt_cap[1] << "</OPT2_CAP>" << std::endl ;
01516 *fedstream << " <OPT3_CAP>" << opt_cap[2] << "</OPT3_CAP>" << std::endl ;
01517 *fedstream << " <OPT1_INP>" << opt_inadj[0] << "</OPT1_INP>" << std::endl ;
01518 *fedstream << " <OPT2_INP>" << opt_inadj[1] << "</OPT2_INP>" << std::endl ;
01519 *fedstream << " <OPT3_INP>" << opt_inadj[2] << "</OPT3_INP>" << std::endl ;
01520 *fedstream << " <OPT1_OUT>" << opt_ouadj[0] << "</OPT1_OUT>" << std::endl ;
01521 *fedstream << " <OPT2_OUT>" << opt_ouadj[1] << "</OPT2_OUT>" << std::endl ;
01522 *fedstream << " <OPT3_OUT>" << opt_ouadj[2] << "</OPT3_OUT>" << std::endl ;
01523 *fedstream << " <NORTH_CLKPHB>" << clkphs1_9 << "</NORTH_CLKPHB>" << std::endl ;
01524 *fedstream << " <NORTHCENTER_CLKPHB>" << clkphs10_18 << "</NORTHCENTER_CLKPHB>" << std::endl ;
01525 *fedstream << " <SOUTHCENTER_CLKPHB>" << clkphs19_27 << "</SOUTHCENTER_CLKPHB>" << std::endl ;
01526 *fedstream << " <SOUTH_CLKPHB>" << clkphs28_36 << "</SOUTH_CLKPHB>" << std::endl ;
01527 *fedstream << " <NORTH_CTRL>" << Ncntrl << "</NORTH_CTRL> " << std::endl ;
01528 *fedstream << " <NORTHCENTER_CTRL>" << NCcntrl << "</NORTHCENTER_CTRL>" << std::endl ;
01529 *fedstream << " <SOUTHCENTER_CTRL>" << SCcntrl << "</SOUTHCENTER_CTRL>" << std::endl ;
01530 *fedstream << " <SOUTH_CTRL>" << Scntrl << "</SOUTH_CTRL>" << std::endl ;
01531 *fedstream << " <REG0_TTCRX_FDLA>" << FineDes1Del << "</REG0_TTCRX_FDLA>" << std::endl ;
01532 *fedstream << " <REG1_TTCRX_FDLA>" << FineDes2Del << "</REG1_TTCRX_FDLA>" << std::endl ;
01533 *fedstream << " <REG2_TTCRX_CDLA>" << CoarseDel << "</REG2_TTCRX_CDLA>" << std::endl ;
01534 *fedstream << " <REG3_TTCRX_CLKD2>" << ClkDes2 << "</REG3_TTCRX_CLKD2>" << std::endl ;
01535 *fedstream << " <CENTER_CTRL>" << Ccntrl << "</CENTER_CTRL>" << std::endl ;
01536 *fedstream << " <CENTER_MODE>" << modeRegister << "</CENTER_MODE>" << std::endl ;
01537 *fedstream << " <B1_ADCGN>" << Nadcg << "</B1_ADCGN>" << std::endl ;
01538 *fedstream << " <B2_ADCGN>" << NCadcg << "</B2_ADCGN>" << std::endl ;
01539 *fedstream << " <B3_ADCGN>" << SCadcg << "</B3_ADCGN>" << std::endl ;
01540 *fedstream << " <B4_ADCGN>" << Sadcg << "</B4_ADCGN>" << std::endl ;
01541
01542
01543 *fedstream << " <NORTH_BADJ>" << Nbaseln << "</NORTH_BADJ>" << std::endl ;
01544 *fedstream << " <NORTHCENTER_BADJ>" << NCbaseln << "</NORTHCENTER_BADJ>" << std::endl ;
01545 *fedstream << " <SOUTHCENTER_BADJ>" << SCbaseln << "</SOUTHCENTER_BADJ>" << std::endl ;
01546 *fedstream << " <SOUTH_BADJ>" << Sbaseln << "</SOUTH_BADJ>" << std::endl ;
01547 *fedstream << " <NORTH_TBMMASK>" << N_TBMmask << "</NORTH_TBMMASK>" << std::endl ;
01548 *fedstream << " <NORTHCENTER_TBMMASK>" << NC_TBMmask << "</NORTHCENTER_TBMMASK>" << std::endl ;
01549 *fedstream << " <SOUTHCENTER_TBMMASK>" << SC_TBMmask << "</SOUTHCENTER_TBMMASK>" << std::endl ;
01550 *fedstream << " <SOUTH_TBMMASK>" << S_TBMmask << "</SOUTH_TBMMASK>" << std::endl ;
01551 *fedstream << " <NORTH_PWORD>" << N_Pword << "</NORTH_PWORD>" << std::endl ;
01552 *fedstream << " <NORTHCENTER_PWORD>" << NC_Pword << "</NORTHCENTER_PWORD>" << std::endl ;
01553 *fedstream << " <SOUTHCENTER_PWORD>" << SC_Pword << "</SOUTHCENTER_PWORD>" << std::endl ;
01554 *fedstream << " <SOUTH_PWORD>" << S_Pword << "</SOUTH_PWORD>" << std::endl ;
01555 *fedstream << " <SPECDAC>" << SpecialDac << "</SPECDAC>" << std::endl ;
01556 *fedstream << " <OOS_LVL>" << Ooslvl << "</OOS_LVL>" << std::endl ;
01557 *fedstream << " <ERR_LVL>" << Errlvl << "</ERR_LVL>" << std::endl ;
01558 *fedstream << " <NORTH_FIFO1_BZ_LVL>" << Nfifo1Bzlvl << "</NORTH_FIFO1_BZ_LVL>" << std::endl ;
01559 *fedstream << " <NORTHCENTER_FIFO1_BZ_LVL>" << NCfifo1Bzlvl << "</NORTHCENTER_FIFO1_BZ_LVL>" << std::endl ;
01560 *fedstream << " <SOUTHCENTER_FIFO1_BZ_LVL>" << SCfifo1Bzlvl << "</SOUTHCENTER_FIFO1_BZ_LVL>" << std::endl ;
01561 *fedstream << " <SOUTH_FIFO1_BZ_LVL>" << Sfifo1Bzlvl << "</SOUTH_FIFO1_BZ_LVL>" << std::endl ;
01562 *fedstream << " <FIFO3_WRN_LVL>" << fifo3Wrnlvl << "</FIFO3_WRN_LVL>" << std::endl ;
01563 *fedstream << " <FED_MASTER_DELAY>" << FedTTCDelay << "</FED_MASTER_DELAY>" << std::endl ;
01564 *fedstream << " <NO_HITLIMIT>" << N_hitlimit << "</NO_HITLIMIT>" << std::endl ;
01565 *fedstream << " <NC_HITLIMIT>" << NC_hitlimit << "</NC_HITLIMIT>" << std::endl ;
01566 *fedstream << " <SC_HITLIMIT>" << SC_hitlimit << "</SC_HITLIMIT>" << std::endl ;
01567 *fedstream << " <SO_HITLIMIT>" << S_hitlimit << "</SO_HITLIMIT>" << std::endl ;
01568 *fedstream << " <NO_TESTREG>" << N_testreg << "</NO_TESTREG>" << std::endl ;
01569 *fedstream << " <NC_TESTREG>" << NC_testreg << "</NC_TESTREG>" << std::endl ;
01570 *fedstream << " <SC_TESTREG>" << SC_testreg << "</SC_TESTREG>" << std::endl ;
01571 *fedstream << " <SO_TESTREG>" << S_testreg << "</SO_TESTREG>" << std::endl ;
01572
01573 *fedstream << " " << std::endl ;
01574 *fedstream << " </DATA>" << std::endl ;
01575 *fedstream << " " << std::endl ;
01576 }
01577
01578
01579 for(int i=0;i<36;i++)
01580 {
01581 for(int j=0;j<NRocs[i];j++)
01582 {
01583 *rocstream << "" << std::endl ;
01584 *rocstream << " <DATA>" << std::endl ;
01585 *rocstream << " <PIXEL_FED>" << fedNumber << "</PIXEL_FED>" << std::endl ;
01586 *rocstream << " <FED_CHAN>" << i+1 << "</FED_CHAN>" << std::endl ;
01587 *rocstream << " <FED_ROC_NUM>" << j << "</FED_ROC_NUM>" << std::endl ;
01588 *rocstream << " <ROC_L0>" << ROC_L0[i][j] << "</ROC_L0>" << std::endl ;
01589 *rocstream << " <ROC_L1>" << ROC_L1[i][j] << "</ROC_L1>" << std::endl ;
01590 *rocstream << " <ROC_L2>" << ROC_L2[i][j] << "</ROC_L2>" << std::endl ;
01591 *rocstream << " <ROC_L3>" << ROC_L3[i][j] << "</ROC_L3>" << std::endl ;
01592 *rocstream << " <ROC_L4>" << ROC_L4[i][j] << "</ROC_L4>" << std::endl ;
01593 *rocstream << " </DATA>" << std::endl << std::endl ;
01594 *rocstream << " " << std::endl ;
01595 }
01596
01597 *tbmstream << "" << std::endl ;
01598 *tbmstream << " <DATA>" << std::endl ;
01599 *tbmstream << " <PIXEL_FED>" << fedNumber << "</PIXEL_FED>" << std::endl ;
01600 *tbmstream << " <FED_CHAN>" << i+1 << "</FED_CHAN>" << std::endl ;
01601 *tbmstream << " <TBMA_HEAD_L0>" << TBM_L0[i] << "</TBMA_HEAD_L0>" << std::endl ;
01602 *tbmstream << " <TBMA_HEAD_L1>" << TBM_L1[i] << "</TBMA_HEAD_L1>" << std::endl ;
01603 *tbmstream << " <TBMA_HEAD_L2>" << TBM_L2[i] << "</TBMA_HEAD_L2>" << std::endl ;
01604 *tbmstream << " <TBMA_HEAD_L3>" << TBM_L3[i] << "</TBMA_HEAD_L3>" << std::endl ;
01605 *tbmstream << " <TBMA_HEAD_L4>" << TBM_L4[i] << "</TBMA_HEAD_L4>" << std::endl ;
01606 *tbmstream << " <TBMA_TRAIL_L0>" << TRL_L0[i] << "</TBMA_TRAIL_L0>" << std::endl ;
01607 *tbmstream << " <TBMA_TRAIL_L1>" << TRL_L1[i] << "</TBMA_TRAIL_L1>" << std::endl ;
01608 *tbmstream << " <TBMA_TRAIL_L2>" << TRL_L2[i] << "</TBMA_TRAIL_L2>" << std::endl ;
01609 *tbmstream << " <TBMA_TRAIL_L3>" << TRL_L3[i] << "</TBMA_TRAIL_L3>" << std::endl ;
01610 *tbmstream << " <TBMA_TRAIL_L4>" << TRL_L4[i] << "</TBMA_TRAIL_L4>" << std::endl ;
01611 *tbmstream << " </DATA>" << std::endl << std::endl ;
01612 *tbmstream << "" << std::endl ;
01613 }
01614 }
01615
01616
01617 void PixelFEDCard::writeXMLTrailer(std::ofstream *fedstream,
01618 std::ofstream *rocstream,
01619 std::ofstream *tbmstream ) const
01620 {
01621 std::string mthn = "[PixelFEDCard::writeXMLTrailer()]\t\t\t " ;
01622
01623
01624 *fedstream << " </DATA_SET>" << std::endl ;
01625 *fedstream << "</ROOT>" << std::endl ;
01626
01627 fedstream->close() ;
01628 std::cout << __LINE__ << "]\t" << mthn << "Data written for main fed" << std::endl ;
01629
01630
01631 *rocstream << " </DATA_SET>" << std::endl ;
01632 *rocstream << "</ROOT>" << std::endl ;
01633
01634 rocstream->close() ;
01635 std::cout << __LINE__ << "]\t" << mthn << "Data written for roc analog levels" << std::endl ;
01636
01637
01638 *tbmstream << " </DATA_SET>" << std::endl ;
01639 *tbmstream << "</ROOT>" << std::endl ;
01640
01641 tbmstream->close() ;
01642 std::cout << __LINE__ << "]\t" << mthn << "Data written for tbm analog levels" << std::endl ;
01643 }
01644
01645
01646 void PixelFEDCard::writeXMLTrailer(std::ofstream *out) const {
01647 std::string mthn = "[PixelFEDCard::writeXMLTrailer()]\t\t\t " ;
01648
01649 *out << " </DATA_SET>" << std::endl ;
01650 *out << "</ROOT>" << std::endl ;
01651
01652 out->close() ;
01653 std::cout << __LINE__ << "]\t" << mthn << "Data written" << std::endl ;
01654 }
01655
01656
01657 void PixelFEDCard::writeXML(pos::PixelConfigKey key, int version, std::string path) const {
01658 std::string mthn = "[PixelFEDCard::writeXML()]\t\t\t " ;
01659 std::stringstream fullPath ;
01660
01661 fullPath << path << "/fedcard.xml" ;
01662 std::cout << __LINE__ << "]\t" << mthn << "Writing to: |" << fullPath.str() << "|" << std::endl ;
01663
01664 std::ofstream out(fullPath.str().c_str()) ;
01665
01666 out << "<ROOT>" << std::endl ;
01667 out << "" << std::endl ;
01668 out << " <HEADER>" << std::endl ;
01669 out << " <TYPE>" << std::endl ;
01670 out << " <EXTENSION_TABLE_NAME>FED_CONFIGURATION</EXTENSION_TABLE_NAME>" << std::endl ;
01671 out << " <NAME>Pixel FED Configuration</NAME>" << std::endl ;
01672 out << " </TYPE>" << std::endl ;
01673 out << " <RUN>" << std::endl ;
01674 out << " <RUN_TYPE>Pixel FED Configuration</RUN_TYPE>" << std::endl ;
01675 out << " <RUN_NUMBER>1</RUN_NUMBER>" << std::endl ;
01676 out << " <RUN_BEGIN_TIMESTAMP>" << PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>" << std::endl ;
01677 out << " <COMMENT_DESCRIPTION>Pixel FED Configuration</COMMENT_DESCRIPTION>" << std::endl ;
01678 out << " <LOCATION>CERN TAC</LOCATION>" << std::endl ;
01679 out << " <CREATED_BY_USER>Dario Menasce</CREATED_BY_USER>" << std::endl ;
01680 out << " </RUN>" << std::endl ;
01681 out << " </HEADER>" << std::endl ;
01682 out << "" << std::endl ;
01683 out << " <DATA_SET>" << std::endl ;
01684 out << "" << std::endl ;
01685 out << " <VERSION>T_E_S_T</VERSION>" << std::endl ;
01686 out << " <COMMENT_DESCRIPTION>Pixel FED Configuration</COMMENT_DESCRIPTION>" << std::endl ;
01687 out << "" << std::endl ;
01688 out << " <PART>" << std::endl ;
01689 out << " <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl ;
01690 out << " <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl ;
01691 out << " </PART>" << std::endl ;
01692 out << "" << std::endl ;
01693 out << " <DATA>" << std::endl ;
01694 out << " <PXLFED_NAME>PxlFED_32</PXLFED_NAME>" << std::endl ;
01695 out << " <CRATE_NUMBER>1</CRATE_NUMBER>" << std::endl ;
01696 out << " <SLOT_NUMBER>5</SLOT_NUMBER> " << std::endl ;
01697 out << " <VME_ADDRESS>268435456</VME_ADDRESS>" << std::endl ;
01698 out << " <CRATE_LABEL>S1G03e</CRATE_LABEL>" << std::endl ;
01699 out << "" << std::endl ;
01700 out << " <CHANNEL_ID>1</CHANNEL_ID>" << std::endl ;
01701 out << " <NUMBER_OF_ROCS>21</NUMBER_OF_ROCS>" << std::endl ;
01702 out << " <CHANNEL_OFFSET_DAC_SETTINGS>0</CHANNEL_OFFSET_DAC_SETTINGS>" << std::endl ;
01703 out << " <CHANNEL_DELAY_SETTINGS>3</CHANNEL_DELAY_SETTINGS>" << std::endl ;
01704 out << " <CHANNEL_BLACK_HIGH>400</CHANNEL_BLACK_HIGH>" << std::endl ;
01705 out << " <CHANNEL_BLACK_LOW>150</CHANNEL_BLACK_LOW>" << std::endl ;
01706 out << " <CHANNEL_ULTRA_BLACK>120</CHANNEL_ULTRA_BLACK>" << std::endl ;
01707 out << "" << std::endl ;
01708 out << " <OPT1_CAP>0</OPT1_CAP>" << std::endl ;
01709 out << " <OPT2_CAP>0</OPT2_CAP>" << std::endl ;
01710 out << " <OPT3_CAP>0</OPT3_CAP>" << std::endl ;
01711 out << " <OPT1_INP>0</OPT1_INP>" << std::endl ;
01712 out << " <OPT2_INP>0</OPT2_INP>" << std::endl ;
01713 out << " <OPT3_INP>0</OPT3_INP>" << std::endl ;
01714 out << " <OPT1_OUT>0</OPT1_OUT>" << std::endl ;
01715 out << " <OPT2_OUT>0</OPT2_OUT>" << std::endl ;
01716 out << " <OPT3_OUT>0</OPT3_OUT>" << std::endl ;
01717 out << " <NORTH_CLKPHB>511</NORTH_CLKPHB>" << std::endl ;
01718 out << " <NORTHCENTER_CLKPHB>511</NORTHCENTER_CLKPHB>" << std::endl ;
01719 out << " <SOUTHCENTER_CLKPHB>511</SOUTHCENTER_CLKPHB>" << std::endl ;
01720 out << " <SOUTH_CLKPHB>511</SOUTH_CLKPHB>" << std::endl ;
01721 out << " <NORTH_CTRL>0</NORTH_CTRL> " << std::endl ;
01722 out << " <NORTHCENTER_CTRL>0</NORTHCENTER_CTRL>" << std::endl ;
01723 out << " <SOUTHCENTER_CTRL>0</SOUTHCENTER_CTRL>" << std::endl ;
01724 out << " <SOUTH_CTRL>0</SOUTH_CTRL>" << std::endl ;
01725 out << " <REG1_TTCRX_FDLA>5</REG1_TTCRX_FDLA>" << std::endl ;
01726 out << " <REG2_TTCRX_CDLA>0</REG2_TTCRX_CDLA>" << std::endl ;
01727 out << " <REG3_TTCRX_CLKD2>155</REG3_TTCRX_CLKD2>" << std::endl ;
01728 out << " <CENTER_CTRL>0</CENTER_CTRL>" << std::endl ;
01729 out << " <CENTER_MODE>0</CENTER_MODE>" << std::endl ;
01730 out << " <B1_ADCGN>0</B1_ADCGN>" << std::endl ;
01731 out << " <B2_ADCGN>0</B2_ADCGN>" << std::endl ;
01732 out << " <B3_ADCGN>0</B3_ADCGN>" << std::endl ;
01733 out << " <B4_ADCGN>0</B4_ADCGN>" << std::endl ;
01734 out << " <NORTH_BADJ>330</NORTH_BADJ>" << std::endl ;
01735 out << " <NORTHCENTER_BADJ>330</NORTHCENTER_BADJ>" << std::endl ;
01736 out << " <SOUTHCENTER_BADJ>330</SOUTHCENTER_BADJ>" << std::endl ;
01737 out << " <SOUTH_BADJ>330</SOUTH_BADJ>" << std::endl ;
01738 out << " <NORTH_TBMMASK>2</NORTH_TBMMASK>" << std::endl ;
01739 out << " <NORTHCENTER_TBMMASK>2</NORTHCENTER_TBMMASK>" << std::endl ;
01740 out << " <SOUTHCENTER_TBMMASK>2</SOUTHCENTER_TBMMASK>" << std::endl ;
01741 out << " <SOUTH_TBMMASK>2</SOUTH_TBMMASK>" << std::endl ;
01742 out << " <NORTH_PWORD>177</NORTH_PWORD>" << std::endl ;
01743 out << " <NORTHCENTER_PWORD>178</NORTHCENTER_PWORD>" << std::endl ;
01744 out << " <SOUTHCENTER_PWORD>179</SOUTHCENTER_PWORD>" << std::endl ;
01745 out << " <SOUTH_PWORD>180</SOUTH_PWORD>" << std::endl ;
01746 out << " <SPECDAC>0</SPECDAC>" << std::endl ;
01747 out << " <OOS_LVL>0</OOS_LVL>" << std::endl ;
01748 out << " <ERR_LVL>0</ERR_LVL>" << std::endl ;
01749 out << " <NORTH_FIFO1_BZ_LVL>900</NORTH_FIFO1_BZ_LVL>" << std::endl ;
01750 out << " <NORTHCENTER_FIFO1_BZ_LVL>900</NORTHCENTER_FIFO1_BZ_LVL>" << std::endl ;
01751 out << " <SOUTHCENTER_FIFO1_BZ_LVL>900</SOUTHCENTER_FIFO1_BZ_LVL>" << std::endl ;
01752 out << " <SOUTH_FIFO1_BZ_LVL>900</SOUTH_FIFO1_BZ_LVL>" << std::endl ;
01753 out << " <FIFO3_WRN_LVL>7680</FIFO3_WRN_LVL> " << std::endl ;
01754 out << " <FED_MASTER_DELAY>0</FED_MASTER_DELAY>" << std::endl ;
01755 out << " <NO_HITLIMIT>0</NO_HITLIMIT>" << std::endl ;
01756 out << " <NC_HITLIMIT>0</NC_HITLIMIT>" << std::endl ;
01757 out << " <SC_HITLIMIT>0</SC_HITLIMIT>" << std::endl ;
01758 out << " <SO_HITLIMIT>0</SO_HITLIMIT>" << std::endl ;
01759 out << " <NO_TESTREG>0</NO_TESTREG>" << std::endl ;
01760 out << " <NC_TESTREG>0</NC_TESTREG>" << std::endl ;
01761 out << " <SC_TESTREG>0</SC_TESTREG>" << std::endl ;
01762 out << " <SO_TESTREG>0</SO_TESTREG>" << std::endl ;
01763 out << " </DATA>" << std::endl ;
01764
01765
01766
01767
01768
01769
01770
01771
01772
01773
01774
01775
01776
01777
01778
01779
01780
01781
01782
01783
01784
01785
01786
01787
01788
01789
01790
01791
01792
01793
01794
01795
01796
01797
01798
01799
01800
01801
01802
01803
01804
01805
01806
01807
01808
01809
01810
01811
01812
01813
01814
01815
01816
01817
01818
01819
01820 std::cout << __LINE__ << "]\t" << mthn << "Data written" << std::endl ;
01821 }
01822
01823
01824 unsigned long long PixelFEDCard::enabledChannels() {
01825 unsigned long long channels=0;
01826
01827
01828
01829 channels = (Ncntrl & 0x1ffLL);
01830 channels += (NCcntrl & 0x1ffLL) << 9;
01831 channels += (SCcntrl & 0x1ffLL) << 18;
01832 channels += (Scntrl & 0x1ffLL) << 27;
01833 return ~channels;
01834 }
01835
01836 bool PixelFEDCard::useChannel(unsigned int iChannel){
01837 assert(iChannel>0&&iChannel<37);
01838 return (enabledChannels()>>(iChannel-1))&0x1LL;
01839 }
01840
01841 void PixelFEDCard::setChannel(unsigned int iChannel, bool mode){
01842 assert(iChannel>0&&iChannel<37);
01843 long long mask=enabledChannels();
01844 long long bit=0x1LL<<(iChannel-1);
01845 if (mode) {
01846 mask=mask|bit;
01847 }
01848 else{
01849 bit=~bit;
01850 mask=mask&bit;
01851 }
01852 mask=~mask;
01853 Ncntrl=mask & 0x1ffLL;
01854 mask=mask>>9;
01855 NCcntrl=mask & 0x1ffLL;
01856 mask=mask>>9;
01857 SCcntrl=mask & 0x1ffLL;
01858 mask=mask>>9;
01859 Scntrl=mask & 0x1ffLL;
01860
01861 }
01862
01863 void PixelFEDCard::restoreBaselinAndChannelMasks(){
01864
01865 Ncntrl=Ncntrl_original;
01866 NCcntrl=NCcntrl_original;
01867 SCcntrl=SCcntrl_original;
01868 Scntrl=Scntrl_original;
01869
01870 Nbaseln=Nbaseln_original;
01871 NCbaseln=NCbaseln_original;
01872 SCbaseln=SCbaseln_original;
01873 Sbaseln=Sbaseln_original;
01874
01875
01876 }
01877
01878
01879 void PixelFEDCard::restoreControlAndModeRegister(){
01880
01881 Ccntrl=Ccntrl_original;
01882 modeRegister=modeRegister_original;
01883
01884 }
01885
01886
01887
01888
01889
01890
01891