22 using namespace pos::PortCardSettingNames;
26 PixelPortCardConfig::PixelPortCardConfig(vector < vector< string> > &tableMat):
PixelConfigBase(
" ",
" ",
" ")
28 string mthn =
"]\t[PixelPortCardConfig::PixelPortCardConfig()]\t\t " ;
29 map<string , int > colM;
30 vector<string> colNames;
123 colNames.push_back(
"CONFIG_KEY" );
124 colNames.push_back(
"KEY_TYPE" );
125 colNames.push_back(
"KEY_ALIAS" );
126 colNames.push_back(
"VERSION" );
127 colNames.push_back(
"KIND_OF_COND");
128 colNames.push_back(
"PORT_CARD" );
129 colNames.push_back(
"TRKFEC" );
130 colNames.push_back(
"RING" );
131 colNames.push_back(
"CHANNEL" );
132 colNames.push_back(
"CCU_ADDR" );
133 colNames.push_back(
"I2C_CNTRL" );
134 colNames.push_back(
"I2C_SPEED" );
135 colNames.push_back(
"AOH_BIAS1" );
136 colNames.push_back(
"AOH_BIAS2" );
137 colNames.push_back(
"AOH_BIAS3" );
138 colNames.push_back(
"AOH_BIAS4" );
139 colNames.push_back(
"AOH_BIAS5" );
140 colNames.push_back(
"AOH_BIAS6" );
141 colNames.push_back(
"AOH_GAIN1" );
142 colNames.push_back(
"AOH_GAIN2" );
143 colNames.push_back(
"AOH_GAIN3" );
144 colNames.push_back(
"AOH_GAIN4" );
145 colNames.push_back(
"AOH_GAIN5" );
146 colNames.push_back(
"AOH_GAIN6" );
147 colNames.push_back(
"AOH1_BIAS1" );
148 colNames.push_back(
"AOH1_BIAS2" );
149 colNames.push_back(
"AOH1_BIAS3" );
150 colNames.push_back(
"AOH1_BIAS4" );
151 colNames.push_back(
"AOH1_BIAS5" );
152 colNames.push_back(
"AOH1_BIAS6" );
153 colNames.push_back(
"AOH1_GAIN1" );
154 colNames.push_back(
"AOH1_GAIN2" );
155 colNames.push_back(
"AOH1_GAIN3" );
156 colNames.push_back(
"AOH1_GAIN4" );
157 colNames.push_back(
"AOH1_GAIN5" );
158 colNames.push_back(
"AOH1_GAIN6" );
159 colNames.push_back(
"AOH2_BIAS1" );
160 colNames.push_back(
"AOH2_BIAS2" );
161 colNames.push_back(
"AOH2_BIAS3" );
162 colNames.push_back(
"AOH2_BIAS4" );
163 colNames.push_back(
"AOH2_BIAS5" );
164 colNames.push_back(
"AOH2_BIAS6" );
165 colNames.push_back(
"AOH2_GAIN1" );
166 colNames.push_back(
"AOH2_GAIN2" );
167 colNames.push_back(
"AOH2_GAIN3" );
168 colNames.push_back(
"AOH2_GAIN4" );
169 colNames.push_back(
"AOH2_GAIN5" );
170 colNames.push_back(
"AOH2_GAIN6" );
171 colNames.push_back(
"AOH3_BIAS1" );
172 colNames.push_back(
"AOH3_BIAS2" );
173 colNames.push_back(
"AOH3_BIAS3" );
174 colNames.push_back(
"AOH3_BIAS4" );
175 colNames.push_back(
"AOH3_BIAS5" );
176 colNames.push_back(
"AOH3_BIAS6" );
177 colNames.push_back(
"AOH3_GAIN1" );
178 colNames.push_back(
"AOH3_GAIN2" );
179 colNames.push_back(
"AOH3_GAIN3" );
180 colNames.push_back(
"AOH3_GAIN4" );
181 colNames.push_back(
"AOH3_GAIN5" );
182 colNames.push_back(
"AOH3_GAIN6" );
183 colNames.push_back(
"AOH4_BIAS1" );
184 colNames.push_back(
"AOH4_BIAS2" );
185 colNames.push_back(
"AOH4_BIAS3" );
186 colNames.push_back(
"AOH4_BIAS4" );
187 colNames.push_back(
"AOH4_BIAS5" );
188 colNames.push_back(
"AOH4_BIAS6" );
189 colNames.push_back(
"AOH4_GAIN1" );
190 colNames.push_back(
"AOH4_GAIN2" );
191 colNames.push_back(
"AOH4_GAIN3" );
192 colNames.push_back(
"AOH4_GAIN4" );
193 colNames.push_back(
"AOH4_GAIN5" );
194 colNames.push_back(
"AOH4_GAIN6" );
195 colNames.push_back(
"DELAY25_GCR" );
196 colNames.push_back(
"DELAY25_SCL" );
197 colNames.push_back(
"DELAY25_TRG" );
198 colNames.push_back(
"DELAY25_SDA" );
199 colNames.push_back(
"DELAY25_RCL" );
200 colNames.push_back(
"DELAY25_RDA" );
201 colNames.push_back(
"DOH_BIAS0" );
202 colNames.push_back(
"DOH_BIAS1" );
203 colNames.push_back(
"DOH_SEU_GAIN");
204 colNames.push_back(
"PLL_CTR1" );
205 colNames.push_back(
"PLL_CTR2" );
206 colNames.push_back(
"PLL_CTR3" );
207 colNames.push_back(
"PLL_CTR4" );
208 colNames.push_back(
"PLL_CTR5" );
211 unsigned int othercount=100;
212 unsigned int delay25count=50;
214 unsigned int pllcount=1;
216 for(
unsigned int c = 0 ;
c < tableMat[0].size() ;
c++)
218 for(
unsigned int n=0;
n<colNames.size();
n++)
220 if(tableMat[0][
c] == colNames[
n]){
221 colM[colNames[
n]] =
c;
226 for(
unsigned int n=0;
n<colNames.size();
n++)
228 if(colM.find(colNames[
n]) == colM.end())
230 std::cerr << __LINE__ << mthn <<
"\tCouldn't find in the database the column with name " << colNames[
n] << std::endl;
235 portcardname_ = tableMat[1][colM[
"PORT_CARD"]] ;
237 if(portcardname_.find(
"FPix") != std::string::npos)
241 else if(portcardname_.find(
"BPix") != std::string::npos)
246 fillDBToFileAddress() ;
248 TKFECID_ = tableMat[1][colM[
"TRKFEC"]] ;
249 ringAddress_ = atoi(tableMat[1][colM[
"RING"]].c_str() ) ;
250 ccuAddress_ = atoi(tableMat[1][colM[
"CCU_ADDR"]].c_str() ) ;
251 channelAddress_ = atoi(tableMat[1][colM[
"CHANNEL"]].c_str() ) ;
252 i2cSpeed_ = atoi(tableMat[1][colM[
"I2C_SPEED"]].c_str() ) ;
262 for(
unsigned int col = 0 ; col < tableMat[1].size() ; col++)
264 std::string settingName;
265 unsigned int i2c_address;
266 unsigned int i2c_values;
268 settingName = tableMat[0][col] ;
269 i2c_values = atoi(tableMat[1][col].c_str()) ;
272 if( type_ ==
"fpix" && settingName.find(
"AOH_") != string::npos && settingName.find(
"GAIN") != string::npos
273 && settingName.find(
"123") == string::npos && settingName.find(
"456") == string::npos )
275 setDataBaseAOHGain(settingName, i2c_values);
278 else if(type_ ==
"bpix" && settingName.find(
"AOH") != string::npos && settingName.find(
"GAIN") != string::npos
279 && settingName.find(
"AOH_") == string::npos
280 && settingName.find(
"123") == string::npos && settingName.find(
"456") == string::npos )
282 if(portcardname_.find(
"PRT2")!=std::string::npos &&
283 (settingName.find(
"AOH3_")!=std::string::npos ||
284 settingName.find(
"AOH4_")!=std::string::npos ) ) continue ;
285 setDataBaseAOHGain(settingName, i2c_values);
291 unsigned int last_CTR2 = 0x0;
294 device_.push_back( make_pair(getdeviceAddressForSetting(
k_PLL_CTR2), new_PLL_CTR2_value(settingName, last_CTR2)) );
295 device_.push_back( make_pair(getdeviceAddressForSetting(
k_PLL_CTR4or5), i2c_values) );
297 key_.push_back( pllcount++);
298 key_.push_back(pllcount++);
303 if((settingName.find(
"DELAY25_") != std::string::npos) ||
304 (settingName.find(
"_BIAS") != std::string::npos) ||
305 (settingName.find(
"PLL_CTR2") != std::string::npos) ||
306 (settingName.find(
"PLL_CTR5") != std::string::npos) ||
307 ((settingName.find(
"DOH_SEU_GAIN") != std::string::npos) && type_==
"bpix"))
310 map<string,string>::iterator iter = nameDBtoFileConversion_.find(settingName);
311 if(iter == nameDBtoFileConversion_.end())
continue ;
312 map<string, unsigned int>::iterator foundName_itr = nameToAddress_.find(nameDBtoFileConversion_[settingName]);
314 if ( foundName_itr != nameToAddress_.end() )
316 if(portcardname_.find(
"PRT2")!=std::string::npos &&
317 (settingName.find(
"AOH3_")!=std::string::npos ||
318 settingName.find(
"AOH4_")!=std::string::npos )) continue ;
319 i2c_address = foundName_itr->second;
323 i2c_address = strtoul(settingName.c_str(), 0, 16);
325 if(type_ ==
"fpix" &&
327 settingName.find(
"AOH1_")!=std::string::npos ||
328 settingName.find(
"AOH2_")!=std::string::npos ||
329 settingName.find(
"AOH3_")!=std::string::npos ||
330 settingName.find(
"AOH4_")!=std::string::npos
334 pair<unsigned int, unsigned int>
p(i2c_address, i2c_values);
349 device_.push_back(
p);
350 if (settingName.find(
"AOH")!=string::npos) key_.push_back(aohcount_++);
351 else if (settingName.find(
"Delay25")!=string::npos) key_.push_back(delay25count++);
352 else if (settingName.find(
"PLL")!=string::npos) key_.push_back(pllcount++);
353 else key_.push_back(othercount++);
368 string mthn =
"[PixelPortCardConfig::PixelPortCardConfig()]\t\t " ;
371 size_t portcardpos=filename.find(std::string(
"portcard_"));
373 assert(portcardpos!=std::string::npos);
374 size_t datpos=filename.find(std::string(
".dat"));
376 assert(datpos!=std::string::npos);
377 assert(datpos>portcardpos);
379 portcardname_=filename.substr(portcardpos+9,datpos-portcardpos-9);
383 std::ifstream
in(filename.c_str());
386 std::cout << __LINE__ <<
"]\t" << mthn <<
"Could not open: " << filename << std::endl;
387 throw std::runtime_error(
"Failed to open file "+filename);
390 std::cout << __LINE__ <<
"]\t" << mthn <<
"Opened: " << filename << std::endl;
396 if ( dummy ==
"Name:" )
401 if ( dummy ==
"Type:" )
404 assert( type_ ==
"fpix" || type_ ==
"bpix" );
415 in >> dummy; assert(dummy==
"ccuAddress:");
in >> std::hex >>
ccuAddress_;
417 in >> dummy; assert(dummy==
"i2cSpeed:");
in >> std::hex >>
i2cSpeed_;
425 std::string settingName;
426 unsigned int i2c_address;
427 unsigned int i2c_values;
429 in >> settingName >> std::hex >> i2c_values >> std::dec;
432 if ( settingName[settingName.size()-1] ==
':' ) settingName.resize( settingName.size()-1 );
435 if ( settingName.find(
"AOH") != string::npos && settingName.find(
"Gain") != string::npos
436 && settingName.find(
"123") == string::npos && settingName.find(
"456") == string::npos )
442 unsigned int last_CTR2 = 0x0;
450 std::map<std::string, unsigned int>::iterator foundName_itr =
nameToAddress_.find(settingName);
454 i2c_address = foundName_itr->second;
458 i2c_address = strtoul(settingName.c_str(), 0, 16);
460 pair<unsigned int, unsigned int>
p(i2c_address, i2c_values);
472 std::set < pair < unsigned int, pair <unsigned int, unsigned int> > > sorted;
474 for (
unsigned int i=0;
i<
device_.size();
i++ ) {
481 for ( set < pair <
unsigned int, pair <unsigned int, unsigned int> > >::iterator
i=sorted.begin() ;
i!=sorted.end() ; ++
i) {
494 if ( CTR4or5 ==
k_PLL_CTR4 )
return 0xdf & last_CTR2;
495 else if ( CTR4or5 ==
k_PLL_CTR5 )
return 0x20 | last_CTR2;
501 assert( settingName.find(
"AOH") != string::npos && settingName.find(
"Gain") != string::npos
502 && settingName.find(
"123") == string::npos && settingName.find(
"456") == string::npos );
504 unsigned int i2c_address;
508 unsigned int whichAOH;
509 if ( settingName[GainPosition-2] ==
'H' ) whichAOH = 0;
512 char whichAOHDigit[2]={0,0};
513 whichAOHDigit[0]=settingName[GainPosition-2];
514 whichAOH = atoi( whichAOHDigit );
517 digit[0]=settingName[GainPosition+4];
518 unsigned int channelOnAOH = atoi( digit );
519 assert( (
type_==
"fpix" && whichAOH==0)||(
type_==
"bpix" && 1 <= whichAOH&&whichAOH <= 4) );
520 assert( 1 <= channelOnAOH && channelOnAOH <= 6 );
535 bool foundOne =
false;
541 unsigned int oldValue =
device_[
i].second;
542 if ( channelOnAOH%3 == 1 )
543 device_[
i].second = (0x3c & oldValue) + ((value & 0x3)<<0);
544 else if ( channelOnAOH%3 == 2 )
545 device_[
i].second = (0x33 & oldValue) + ((value & 0x3)<<2);
546 else if ( channelOnAOH%3 == 0 )
547 device_[
i].second = (0x0f & oldValue) + ((value & 0x3)<<4);
552 if ( foundOne )
return;
555 unsigned int i2c_value;
556 if ( channelOnAOH%3 == 1 ) i2c_value = ((value & 0x3)<<0);
557 else if ( channelOnAOH%3 == 2 ) i2c_value = ((value & 0x3)<<2);
558 else if ( channelOnAOH%3 == 0 ) i2c_value = ((value & 0x3)<<4);
561 pair<unsigned int, unsigned int>
p(i2c_address, i2c_value);
569 unsigned int i2c_address;
573 unsigned int whichAOH;
580 char whichAOHDigit[2]={0,0};
581 whichAOHDigit[0]=settingName[GainPosition-2];
582 whichAOH = atoi( whichAOHDigit );
585 digit[0]=settingName[GainPosition+4];
586 unsigned int channelOnAOH = atoi( digit );
587 assert( (
type_==
"fpix" && whichAOH==0)||(
type_==
"bpix" && 1 <= whichAOH&&whichAOH <= 4) );
588 assert( 1 <= channelOnAOH && channelOnAOH <= 6 );
603 bool foundOne =
false;
609 unsigned int oldValue =
device_[
i].second;
610 if ( channelOnAOH%3 == 1 )
611 device_[
i].second = (0x3c & oldValue) + ((value & 0x3)<<0);
612 else if ( channelOnAOH%3 == 2 )
613 device_[
i].second = (0x33 & oldValue) + ((value & 0x3)<<2);
614 else if ( channelOnAOH%3 == 0 )
615 device_[
i].second = (0x0f & oldValue) + ((value & 0x3)<<4);
620 if ( foundOne )
return;
623 unsigned int i2c_value;
624 if ( channelOnAOH%3 == 1 ) i2c_value = ((value & 0x3)<<0);
625 else if ( channelOnAOH%3 == 2 ) i2c_value = ((value & 0x3)<<2);
626 else if ( channelOnAOH%3 == 0 ) i2c_value = ((value & 0x3)<<4);
629 pair<unsigned int, unsigned int>
p(i2c_address, i2c_value);
640 if (
type_ ==
"fpix" )
668 else if (
type_ ==
"bpix" )
853 else if(
type_ ==
"bpix")
977 std::string mthn =
"[PixelPortCardConfig::writeASCII()]\t\t\t\t " ;
978 if (dir!=
"") dir+=
"/";
981 std::ofstream
out(filename.c_str());
983 std::cout << __LINE__ <<
"]\t" << mthn <<
"Could not open file: " << filename.c_str() << std::endl;
987 out <<
"Name: " << portcardname_ << std::endl;
988 out <<
"Type: " <<
type_ << std::endl;
990 out <<
"ringAddress: 0x" <<std::hex<<
ringAddress_ <<std::dec<< std::endl;
991 out <<
"ccuAddress: 0x" <<std::hex<<
ccuAddress_ <<std::dec<< std::endl;
995 out <<
"i2cSpeed: 0x" <<std::hex<<
i2cSpeed_ <<std::dec<< std::endl;
997 bool found_PLL_CTR2 =
false;
998 unsigned int last_PLL_CTR2_value = 0x0;
1001 unsigned int deviceAddress =
device_.at(
i).first;
1016 std::string whichAOHString;
1017 unsigned int zeroOrThree;
1030 out <<
"AOH"<<whichAOHString<<
"_Gain"<<zeroOrThree+1<<
": 0x"<< (((
device_[
i].second) & 0x03)>>0) << std::endl;
1031 out <<
"AOH"<<whichAOHString<<
"_Gain"<<zeroOrThree+2<<
": 0x"<< (((
device_[
i].second) & 0x0c)>>2) << std::endl;
1032 out <<
"AOH"<<whichAOHString<<
"_Gain"<<zeroOrThree+3<<
": 0x"<< (((
device_[
i].second) & 0x30)>>4) << std::endl;
1038 std::string settingName =
"";
1039 for ( std::map<std::string, unsigned int>::const_iterator nameToAddress_itr =
nameToAddress_.begin(); nameToAddress_itr !=
nameToAddress_.end(); ++nameToAddress_itr )
1044 if ( nameToAddress_itr->second == deviceAddress ) {settingName = nameToAddress_itr->first;
break;}
1047 cout <<
"[PixelPortCardConfig::WriteASCII()]\tdeviceAddress: " << deviceAddress <<
" NOT FOUND" << endl ;
1055 if ( found_PLL_CTR2 && last_PLL_CTR2_value ==
device_.at(
i).second )
continue;
1056 found_PLL_CTR2 =
true;
1057 last_PLL_CTR2_value =
device_.at(
i).second;
1061 if ( (last_PLL_CTR2_value & 0x20) == 0x0 ) settingName =
k_PLL_CTR4;
1066 if ( settingName==
"" )
out <<
"0x" <<std::hex<<
device_.at(
i).first <<std::dec;
1067 else out << settingName <<
":";
1069 out <<
" 0x" <<std::hex<<
device_.at(
i).second <<std::dec<< std::endl;
1124 pair<unsigned int, unsigned int>
p(address, value);
1139 std::map<std::string, unsigned int>::const_iterator foundName_itr =
nameToAddress_.find(settingName);
1141 return foundName_itr->second;
1164 for ( std::vector<std::pair<unsigned int, unsigned int> >::const_iterator device_itr =
device_.begin(); device_itr !=
device_.end(); device_itr++ )
1166 if ( device_itr->first == deviceAddress )
return true;
1173 std::string mthn =
"[PixelPortCardConfig::AOHBiasAddressFromAOHNumber()] " ;
1174 if (
type_ ==
"fpix" )
1182 else {
std::cout << __LINE__ <<
"]\t" << mthn
1183 <<
"ERROR: For fpix, AOH number must be in the range 1-6, but the given AOH number was "
1189 else if (
type_ ==
"bpix" )
1215 else {
std::cout << __LINE__ <<
"]\t" << mthn
1216 <<
"ERROR: For bpix, AOH number must be in the range 1-24, but the given AOH number was "
1227 std::string mthn =
"[PixelPortCardConfig::AOHGainStringFromAOHNumber()] " ;
1228 if (
type_ ==
"fpix" )
1230 if (AOHNumber == 1)
return "AOH_Gain1";
1231 else if (AOHNumber == 2)
return "AOH_Gain2";
1232 else if (AOHNumber == 3)
return "AOH_Gain3";
1233 else if (AOHNumber == 4)
return "AOH_Gain4";
1234 else if (AOHNumber == 5)
return "AOH_Gain5";
1235 else if (AOHNumber == 6)
return "AOH_Gain6";
1236 else {
std::cout << __LINE__ <<
"]\t" << mthn
1237 <<
"ERROR: For fpix, AOH number must be in the range 1-6, but the given AOH number was "
1243 else if (
type_ ==
"bpix" )
1245 if (AOHNumber == 1)
return "AOH1_Gain1";
1246 else if (AOHNumber == 2)
return "AOH1_Gain2";
1247 else if (AOHNumber == 3)
return "AOH1_Gain3";
1248 else if (AOHNumber == 4)
return "AOH1_Gain4";
1249 else if (AOHNumber == 5)
return "AOH1_Gain5";
1250 else if (AOHNumber == 6)
return "AOH1_Gain6";
1251 else if (AOHNumber == 7)
return "AOH2_Gain1";
1252 else if (AOHNumber == 8)
return "AOH2_Gain2";
1253 else if (AOHNumber == 9)
return "AOH2_Gain3";
1254 else if (AOHNumber ==10)
return "AOH2_Gain4";
1255 else if (AOHNumber ==11)
return "AOH2_Gain5";
1256 else if (AOHNumber ==12)
return "AOH2_Gain6";
1257 else if (AOHNumber ==13)
return "AOH3_Gain1";
1258 else if (AOHNumber ==14)
return "AOH3_Gain2";
1259 else if (AOHNumber ==15)
return "AOH3_Gain3";
1260 else if (AOHNumber ==16)
return "AOH3_Gain4";
1261 else if (AOHNumber ==17)
return "AOH3_Gain5";
1262 else if (AOHNumber ==18)
return "AOH3_Gain6";
1263 else if (AOHNumber ==19)
return "AOH4_Gain1";
1264 else if (AOHNumber ==20)
return "AOH4_Gain2";
1265 else if (AOHNumber ==21)
return "AOH4_Gain3";
1266 else if (AOHNumber ==22)
return "AOH4_Gain4";
1267 else if (AOHNumber ==23)
return "AOH4_Gain5";
1268 else if (AOHNumber ==24)
return "AOH4_Gain6";
1269 else {
std::cout << __LINE__ <<
"]\t" << mthn
1270 <<
"ERROR: For bpix, AOH number must be in the range 1-24, but the given AOH number was "
1281 std::string mthn =
"[PixelPortCardConfig::AOHGainAddressFromAOHNumber()] " ;
1283 if (
type_ ==
"fpix" )
1291 else {
std::cout << __LINE__ <<
"]\t" << mthn
1292 <<
"ERROR: For fpix, AOH number must be in the range 1-6, but the given AOH number was "
1298 else if (
type_ ==
"bpix" )
1324 else {
std::cout << __LINE__ <<
"]\t" << mthn
1325 <<
"ERROR: For bpix, AOH number must be in the range 1-24, but the given AOH number was "
1341 if ( AOHNumber%3 == 1 )
return (((threeGainsValue) & 0x03)>>0);
1342 if ( AOHNumber%3 == 2 )
return (((threeGainsValue) & 0x0c)>>2);
1343 if ( AOHNumber%3 == 0 )
return (((threeGainsValue) & 0x30)>>4);
1351 std::ofstream *outstream,
1352 std::ofstream *out1stream,
1353 std::ofstream *out2stream)
const
1355 std::string mthn =
"[PixelPortCardConfig::writeXMLHeader()]\t\t\t " ;
1356 std::stringstream fullPath ;
1358 std::cout << __LINE__ <<
"]\t" << mthn <<
"Writing to: " << fullPath.str() << std::endl ;
1360 outstream->open(fullPath.str().c_str()) ;
1362 *outstream <<
"<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl ;
1363 *outstream <<
"<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl ;
1364 *outstream <<
" <HEADER>" << std::endl ;
1365 *outstream <<
" <TYPE>" << std::endl ;
1366 *outstream <<
" <EXTENSION_TABLE_NAME>PIXEL_PORTCARD_SETTINGS</EXTENSION_TABLE_NAME>" << std::endl ;
1367 *outstream <<
" <NAME>Pixel Port Card Settings</NAME>" << std::endl ;
1368 *outstream <<
" </TYPE>" << std::endl ;
1369 *outstream <<
" <RUN>" << std::endl ;
1370 *outstream <<
" <RUN_TYPE>Pixel Port Card Settings</RUN_TYPE>" << std::endl ;
1371 *outstream <<
" <RUN_NUMBER>1</RUN_NUMBER>" << std::endl ;
1373 *outstream <<
" <LOCATION>CERN P5</LOCATION>" << std::endl ;
1374 *outstream <<
" </RUN>" << std::endl ;
1375 *outstream <<
" </HEADER>" << std::endl ;
1376 *outstream <<
"" << std::endl ;
1377 *outstream <<
" <DATA_SET>" << std::endl ;
1378 *outstream <<
" <PART>" << std::endl ;
1379 *outstream <<
" <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl ;
1380 *outstream <<
" <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl ;
1381 *outstream <<
" </PART>" << std::endl ;
1382 *outstream <<
" <VERSION>" << version <<
"</VERSION>" << std::endl ;
1383 *outstream <<
" <COMMENT_DESCRIPTION>" <<
getComment() <<
"</COMMENT_DESCRIPTION>" << std::endl ;
1384 *outstream <<
" <CREATED_BY_USER>" <<
getAuthor() <<
"</CREATED_BY_USER>" << std::endl ;
1385 *outstream <<
"" << std::endl ;
1390 std::ofstream *out1stream,
1391 std::ofstream *out2stream)
const
1393 std::string mthn =
"[PixelPortCardConfig::writeXML()]\t\t\t " ;
1396 *outstream <<
" <DATA>" << std::endl;
1397 *outstream <<
" <PORT_CARD>" <<
portcardname_ <<
"</PORT_CARD>" << std::endl;
1398 *outstream <<
" <TRKFEC>" <<
TKFECID_ <<
"</TRKFEC>" << std::endl;
1399 *outstream <<
" <RING>" <<
ringAddress_ <<
"</RING>" << std::endl;
1400 *outstream <<
" <CCU_ADDR>" <<
ccuAddress_ <<
"</CCU_ADDR>" << std::endl;
1401 *outstream <<
" <CHANNEL>" <<
channelAddress_ <<
"</CHANNEL>" << std::endl;
1402 *outstream <<
" <I2C_SPEED>" <<
i2cSpeed_ <<
"</I2C_SPEED>" << std::endl;
1404 bool found_PLL_CTR2 =
false;
1405 unsigned int last_PLL_CTR2_value = 0x0;
1408 unsigned int deviceAddress =
device_.at(
i).first;
1423 std::string whichAOHString;
1424 unsigned int zeroOrThree;
1437 *outstream <<
" <AOH" << whichAOHString <<
"_GAIN" << zeroOrThree+1 <<
">" << (((
device_[
i].second) & 0x03)>>0) <<
"</AOH" << whichAOHString <<
"_GAIN" << zeroOrThree+1 <<
">" << std::endl;
1438 *outstream <<
" <AOH" << whichAOHString <<
"_GAIN" << zeroOrThree+2 <<
">" << (((
device_[
i].second) & 0x0c)>>2) <<
"</AOH" << whichAOHString <<
"_GAIN" << zeroOrThree+2 <<
">" << std::endl;
1439 *outstream <<
" <AOH" << whichAOHString <<
"_GAIN" << zeroOrThree+3 <<
">" << (((
device_[
i].second) & 0x30)>>4) <<
"</AOH" << whichAOHString <<
"_GAIN" << zeroOrThree+3 <<
">" << std::endl;
1445 std::string settingName =
"";
1446 for ( std::map<std::string, unsigned int>::const_iterator nameToAddress_itr =
nameToAddress_.begin(); nameToAddress_itr !=
nameToAddress_.end(); ++nameToAddress_itr )
1448 if ( nameToAddress_itr->second == deviceAddress ) {settingName = nameToAddress_itr->first;
break;}
1452 if ( nameDBtoFileConversion_itr->second.find(settingName) != std::string::npos ) {settingName = nameDBtoFileConversion_itr->first;
break;}
1458 if ( found_PLL_CTR2 && last_PLL_CTR2_value ==
device_.at(
i).second )
continue;
1459 found_PLL_CTR2 =
true;
1460 last_PLL_CTR2_value =
device_.at(
i).second;
1464 if ( (last_PLL_CTR2_value & 0x20) == 0x0 ) settingName =
k_PLL_CTR4;
1469 if ( settingName==
"" ) *outstream <<
device_.at(
i).first;
1470 else *outstream <<
" <" << settingName <<
">" ;
1472 *outstream <<
device_.at(
i).second <<
"</" << settingName <<
">" << std::endl;
1475 *outstream <<
" </DATA>" << std::endl;
1480 std::ofstream *out1stream,
1481 std::ofstream *out2stream)
const
1483 std::string mthn =
"[PixelPortCardConfig::writeXMLTrailer()]\t\t\t " ;
1485 *outstream <<
" </DATA_SET>" << std::endl ;
1486 *outstream <<
"</ROOT> " << std::endl ;
1488 outstream->close() ;
const unsigned int k_bpix_AOH4_Bias6_address
const std::string k_AOH_Bias6
unsigned int new_PLL_CTR2_value(std::string CTR4or5, unsigned int last_CTR2) const
const unsigned int k_fpix_AOH_Bias6_address
bool containsDeviceAddress(unsigned int deviceAddress) const
const std::string k_AOH2_Bias1
This file contains the base class for "pixel configuration data" management.
const unsigned int k_fpix_PLL_CTR4or5_address
const std::string k_AOH3_Gain123
void writeASCII(std::string dir="") const
const unsigned int k_bpix_AOH1_Gain123_address
const unsigned int k_bpix_AOH3_Bias4_address
const unsigned int k_fpix_DOH_Ch1Bias_Data_address
const unsigned int k_bpix_AOH3_Bias3_address
const std::string k_Delay25_RCL
std::string portcardname_
const std::string k_AOH4_Bias6
const std::string k_Delay25_GCR
const std::string k_AOH2_Bias2
const unsigned int k_bpix_AOH2_Bias3_address
const unsigned int k_fpix_DOH_Dummy_address
const std::string k_PLL_CTR4
unsigned int getchannelAddress() const
const unsigned int k_bpix_DOH_Dummy_address
const unsigned int k_bpix_AOH2_Bias5_address
unsigned int getdeviceValues(unsigned int i) const
const std::string k_Delay25_SDA
const unsigned int k_fpix_Delay25_GCR_address
std::map< std::string, unsigned int > nameToAddress_
const unsigned int k_fpix_PLL_CTR1_address
const std::string k_AOH_Gain456
const std::string k_AOH2_Bias4
std::map< std::string, std::string > nameDBtoFileConversion_
const unsigned int k_bpix_AOH4_Bias2_address
const std::string k_AOH_Gain123
const unsigned int k_bpix_AOH1_Gain456_address
unsigned int getccuAddress() const
const std::string k_AOH3_Bias3
unsigned int getdeviceValuesForSetting(std::string settingName) const
const unsigned int k_bpix_DOH_Ch1Bias_Data_address
const std::string k_PLL_CTR5
const std::string k_AOH3_Bias5
const unsigned int k_bpix_AOH1_Bias4_address
const std::string k_AOH1_Gain456
unsigned int ringAddress_
const unsigned int k_bpix_AOH3_Bias1_address
PixelPortCardConfig(std::vector< std::vector< std::string > > &tableMat)
unsigned int getdeviceAddressForSetting(std::string settingName) const
const unsigned int k_bpix_AOH4_Gain456_address
const unsigned int k_bpix_AOH3_Bias5_address
const unsigned int k_bpix_Delay25_SDA_address
const std::string k_AOH2_Bias5
const unsigned int k_bpix_AOH2_Bias2_address
const std::string k_AOH4_Bias1
const std::string k_DOH_Ch1Bias_Data
unsigned int channelAddress_
const unsigned int k_bpix_Delay25_SCL_address
const unsigned int k_bpix_PLL_CTR2_address
unsigned int AOHBiasAddressFromAOHNumber(unsigned int AOHNumber) const
const unsigned int k_bpix_Delay25_TRG_address
const unsigned int k_bpix_AOH1_Bias2_address
const unsigned int k_bpix_AOH2_Gain456_address
const unsigned int k_bpix_AOH1_Bias3_address
const std::string k_AOH_Bias2
const unsigned int k_bpix_PLL_CTR3_address
const unsigned int k_bpix_AOH4_Bias4_address
const std::string k_AOH4_Bias4
unsigned int AOHGainAddressFromAOHNumber(unsigned int AOHNumber) const
const unsigned int k_bpix_PLL_CTR4or5_address
const std::string k_Delay25_RDA
void setDataBaseAOHGain(std::string settingName, unsigned int value)
const std::string k_AOH2_Gain123
const unsigned int k_bpix_AOH3_Bias6_address
std::vector< std::pair< unsigned int, unsigned int > > device_
const unsigned int k_bpix_AOH4_Gain123_address
const std::string k_AOH2_Gain456
const unsigned int k_bpix_AOH4_Bias3_address
const std::string k_PLL_CTR2
const unsigned int k_fpix_AOH_Bias5_address
std::vector< unsigned int > key_
key used for sorting device_
const std::string k_DOH_Gain_SEU
const std::string k_PLL_CTR4or5
const std::string k_AOH1_Bias2
const unsigned int k_bpix_AOH4_Bias1_address
const unsigned int k_bpix_AOH1_Bias6_address
const unsigned int k_fpix_AOH_Bias2_address
std::string getComment() const
const unsigned int k_bpix_AOH1_Bias1_address
const unsigned int k_fpix_AOH_Gain123_address
void fillDBToFileAddress()
unsigned int getdeviceAddress(unsigned int i) const
std::string getTKFECID() const
const std::string k_AOH1_Bias6
const unsigned int k_fpix_Delay25_TRG_address
const unsigned int k_fpix_AOH_Bias4_address
const unsigned int k_bpix_AOH2_Gain123_address
unsigned int getdevicesize() const
const unsigned int k_bpix_AOH3_Gain123_address
const unsigned int k_bpix_DOH_Gain_SEU_address
std::string getAuthor() const
const unsigned int k_bpix_Delay25_RCL_address
const std::string k_AOH4_Bias5
std::string AOHGainStringFromAOHNumber(unsigned int AOHNumber) const
const std::string k_AOH4_Gain456
const std::string k_AOH_Bias5
void setdeviceValues(unsigned int address, unsigned int value)
unsigned int getAOHGain(unsigned int AOHNumber) const
const unsigned int k_bpix_DOH_Ch0Bias_CLK_address
const unsigned int k_bpix_Delay25_RDA_address
const std::string k_AOH4_Bias2
const std::string k_Delay25_SCL
const std::string k_AOH3_Bias1
const std::string k_AOH1_Bias4
const std::string k_PLL_CTR3
const unsigned int k_bpix_Delay25_GCR_address
const std::string k_AOH1_Bias3
const std::string k_Delay25_TRG
const unsigned int k_fpix_Delay25_SDA_address
bool containsSetting(std::string settingName) const
const std::string k_AOH_Bias4
unsigned int getringAddress() const
const unsigned int k_fpix_DOH_Ch0Bias_CLK_address
const std::string k_AOH_Bias1
const unsigned int k_fpix_DOH_Gain_SEU_address
const unsigned int k_fpix_PLL_CTR2_address
const unsigned int k_bpix_PLL_CTR1_address
const unsigned int k_fpix_Delay25_RCL_address
const unsigned int k_fpix_Delay25_SCL_address
const std::string k_AOH2_Bias6
const std::string k_AOH1_Bias5
const std::string k_AOH_Bias3
const std::string k_AOH1_Bias1
unsigned int geti2cSpeed() const
virtual void writeXMLTrailer(std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
const unsigned int k_fpix_AOH_Bias3_address
const std::string k_AOH3_Gain456
const unsigned int k_bpix_AOH1_Bias5_address
const unsigned int k_fpix_AOH_Gain456_address
const std::string k_AOH1_Gain123
const std::string k_DOH_Ch0Bias_CLK
const std::string k_AOH3_Bias4
const std::string k_DOH_Dummy
void setAOHGain(unsigned int AOHNumber, unsigned int value)
const unsigned int k_bpix_AOH3_Bias2_address
const unsigned int k_fpix_PLL_CTR3_address
const unsigned int k_bpix_AOH3_Gain456_address
virtual void writeXMLHeader(pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1=NULL, std::ofstream *out2=NULL) const
const unsigned int k_bpix_AOH2_Bias1_address
This class specifies the settings on the TKPCIFEC and the settings on the portcard.
const std::string k_AOH2_Bias3
const unsigned int k_bpix_AOH2_Bias6_address
const std::string k_AOH4_Gain123
const unsigned int k_bpix_AOH4_Bias5_address
const std::string k_PLL_CTR1
std::string gettype() const
const std::string k_AOH3_Bias6
const std::string k_AOH4_Bias3
const unsigned int k_fpix_AOH_Bias1_address
const std::string k_AOH3_Bias2
void writeXML(pos::PixelConfigKey key, int version, std::string path) const
unsigned int getdeviceValuesForAddress(unsigned int address) const
const unsigned int k_fpix_Delay25_RDA_address
const unsigned int k_bpix_AOH2_Bias4_address