21 <<
" Constructing object...";
28 <<
" Destructing object...";
38 <<
" NULL pointer to SiStripConfigDb interface!"
39 <<
" Aborting upload...";
45 for (; ip != jp; ++ip) {
58 <<
" Uploading FED connections for partition \"" << ip->second.partitionName()
64 <<
" Completed database upload of " << conns.size() <<
" ConnectionDescriptions!";
67 <<
" TEST only! No FED connections will be uploaded to DB...";
74 <<
" Uploading FED descriptions to DB...";
77 <<
" Completed database upload of " <<
feds.size()
78 <<
" Fed9UDescriptions (with connected channels enabled)!";
81 <<
" TEST only! No FED descriptions will be uploaded to DB...";
96 Analyses::iterator ianal =
data().begin();
97 Analyses::iterator janal =
data().end();
98 for (; ianal != janal; ++ianal) {
102 <<
" NULL pointer to analysis object!";
113 ConnectionDescription*
conn =
new ConnectionDescription();
114 conn->setFedId(fed_key.fedId());
115 conn->setFedChannel(fed_key.fedChannel());
116 conn->setFecHardwareId(
"");
117 conn->setFecCrateId(fec_key.fecCrate());
118 conn->setFecSlot(fec_key.fecSlot());
119 conn->setRingSlot(fec_key.fecRing());
120 conn->setCcuAddress(fec_key.ccuAddr());
121 conn->setI2cChannel(fec_key.ccuChan());
123 conn->setDcuHardId(
anal->dcuHardId());
127 SiStripConfigDb::FedDescriptionsV::const_iterator ifed =
feds.begin();
130 uint16_t fed_id = static_cast<uint16_t>((*ifed)->getFedId());
131 if (fed_key.fedId() == fed_id) {
132 conn->setFedCrateId(static_cast<uint16_t>((*ifed)->getCrateNumber()));
133 conn->setFedSlot(static_cast<uint16_t>((*ifed)->getSlotNumber()));
138 <<
" NULL pointer to Fed9UDescription object!";
145 <<
" Could not find FED id " << fed_key.fedId() <<
" in vector of FED descriptions!"
146 <<
" Unable to set FED crate and slot for this FED!";
149 conns.push_back(
conn);
153 SiStripConfigDb::FedConnectionsV::iterator ifed = conns.begin();
154 for (; ifed != conns.end(); ifed++) {
164 SiStripConfigDb::FedDescriptionsV::const_iterator ifed =
feds.begin();
165 SiStripConfigDb::FedDescriptionsV::const_iterator jfed =
feds.end();
167 for (; ifed != jfed; ++ifed) {
169 Fed9U::Fed9UAddress
addr(ichan);
170 Fed9U::Fed9UAddress addr0(ichan, static_cast<Fed9U::u8>(0));
171 Fed9U::Fed9UAddress addr1(ichan, static_cast<Fed9U::u8>(1));
172 (*ifed)->setFedFeUnitDisable(
addr,
true);
173 (*ifed)->setApvDisable(addr0,
true);
174 (*ifed)->setApvDisable(addr1,
true);
177 }
catch (ICUtils::ICException&
e) {
182 uint16_t connected = 0;
183 std::map<uint16_t, std::vector<uint16_t> >
enabled;
186 for (ifed =
feds.begin(); ifed !=
feds.end(); ifed++) {
191 uint32_t fed_key = fed.
key();
194 Analyses::const_iterator iter =
data().find(fed_key);
199 if (!iter->second->isValid()) {
206 <<
" NULL pointer to OptoScanAnalysis object!";
212 uint16_t fed_id =
key.fedId();
213 uint16_t fed_ch =
key.fedChannel();
216 Fed9U::Fed9UAddress
addr(fed_ch);
217 Fed9U::Fed9UAddress addr0(fed_ch, static_cast<Fed9U::u8>(0));
218 Fed9U::Fed9UAddress addr1(fed_ch, static_cast<Fed9U::u8>(1));
219 (*ifed)->setFedFeUnitDisable(
addr,
false);
220 (*ifed)->setApvDisable(addr0,
false);
221 (*ifed)->setApvDisable(addr1,
false);
223 enabled[fed_id].push_back(fed_ch);
228 std::stringstream sss;
230 sss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
231 <<
" Enabled a total of " << connected <<
" FED channels and disabled " <<
feds.size() * 96 - connected
232 <<
" FED channels (" << 100 * connected / (
feds.size() * 96) <<
"% of total)";
235 sss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
236 <<
" Found no FEDs! (and therefore no connected channels)";
241 std::stringstream
ss;
242 ss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
243 <<
" Dump of enabled FED channels:" << std::endl;
244 std::map<uint16_t, std::vector<uint16_t> >::const_iterator fed =
enabled.begin();
245 for (; fed !=
enabled.end(); fed++) {
246 ss <<
" Enabled " << fed->second.size() <<
" channels for FED id " << std::setw(3) << fed->first <<
": ";
247 if (!fed->second.empty()) {
248 uint16_t
first = fed->second.front();
249 uint16_t
last = fed->second.front();
250 std::vector<uint16_t>::const_iterator
chan = fed->second.begin();
251 for (;
chan != fed->second.end();
chan++) {
252 if (
chan != fed->second.begin()) {
254 ss << std::setw(2) <<
first <<
"->" << std::setw(2) <<
last <<
", ";
255 if (
chan != fed->second.end()) {
263 ss << std::setw(2) <<
first <<
"->" << std::setw(2) <<
last;
276 <<
" NULL pointer to SiStripFedCabling object!";
286 <<
" No DCU descriptions found!";
290 if (detids.empty()) {
292 <<
" DCU-DetId map is empty!";
295 Analyses::iterator ianal =
data().begin();
296 Analyses::iterator janal =
data().end();
297 for (; ianal != janal; ++ianal) {
299 if (!ianal->second->isValid()) {
308 <<
" NULL pointer to FastFedCablingAnalysis object!";
314 SiStripConfigDb::DeviceDescriptionsV::const_iterator idcu = dcus.begin();
315 SiStripConfigDb::DeviceDescriptionsV::const_iterator jdcu = dcus.end();
316 while (!
found && idcu != jdcu) {
317 dcuDescription* dcu = dynamic_cast<dcuDescription*>(*idcu);
319 if (dcu->getDcuType() ==
"FEH") {
320 if (dcu->getDcuHardId() ==
anal->dcuHardId()) {
322 anal->dcuId(dcu->getDcuHardId());
327 anal->fecKey(fec_key);
328 SiStripConfigDb::DcuDetIdsV::const_iterator idet = detids.end();
330 if (idet != detids.end()) {
331 anal->detId(idet->second->getDetId());
356 for (uint16_t iapv = 0; iapv < 2; ++iapv) {
358 FastFedCablingAnalysisDescription*
tmp;
359 tmp =
new FastFedCablingAnalysisDescription(
anal->highLevel(),
386 typedef std::vector<std::string>
Strings;
388 Strings::const_iterator istr =
errors.begin();
389 Strings::const_iterator jstr =
errors.end();
390 for (; istr != jstr; ++istr) {
391 tmp->addComments(*istr);
404 std::vector<std::string>
valid;
405 std::vector<std::string> dirty;
406 std::vector<std::string> trimdac;
407 std::vector<std::string>
missing;
408 std::vector<std::string> devices;
409 uint32_t missing_pairs = 0;
412 std::vector<uint32_t> found_dcus;
413 Analyses::iterator ianal =
data().begin();
414 Analyses::iterator janal =
data().end();
415 for (; ianal != janal; ++ianal) {
423 std::stringstream
ss;
428 ss <<
"DcuId= " << std::hex << std::setw(8) << std::setfill(
'0') <<
anal->dcuId() <<
std::dec <<
" ";
429 ss <<
"DetId= " << std::hex << std::setw(8) << std::setfill(
'0') <<
anal->detId() <<
std::dec;
430 if (
anal->isValid() && !(
anal->isDirty()) && !(
anal->badTrimDac())) {
433 if (
anal->isDirty()) {
434 dirty.push_back(
ss.str());
436 if (
anal->badTrimDac()) {
437 trimdac.push_back(
ss.str());
441 found_dcus.push_back(
anal->dcuHardId());
445 SiStripConfigDb::DeviceDescriptionsV::const_iterator idcu = dcus.begin();
446 SiStripConfigDb::DeviceDescriptionsV::const_iterator jdcu = dcus.end();
447 for (; idcu != jdcu; ++idcu) {
449 dcuDescription* dcu = dynamic_cast<dcuDescription*>(*idcu);
453 if (dcu->getDcuType() !=
"FEH") {
459 std::vector<uint32_t>::const_iterator iter =
find(found_dcus.begin(), found_dcus.end(), dcu->getDcuHardId());
460 if (iter != found_dcus.end()) {
465 SiStripConfigDb::DcuDetIdsV::const_iterator idet = detids.end();
467 if (idet == detids.end()) {
475 uint16_t npairs = idet->second->getApvNumber() / 2;
479 addrs.resize(6,
false);
481 SiStripConfigDb::DeviceDescriptionsV::const_iterator iapv = apvs.begin();
482 SiStripConfigDb::DeviceDescriptionsV::const_iterator japv = apvs.end();
483 for (; iapv != japv; ++iapv) {
484 apvDescription* apv = dynamic_cast<apvDescription*>(*iapv);
501 if (addrs[0] || addrs[1]) {
503 std::stringstream
ss;
506 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() <<
std::dec;
507 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first <<
std::dec;
510 if (addrs[2] || addrs[3]) {
512 std::stringstream
ss;
515 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() <<
std::dec;
516 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first <<
std::dec;
519 if (addrs[4] || addrs[5]) {
521 std::stringstream
ss;
524 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() <<
std::dec;
525 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first <<
std::dec;
529 if (pairs != npairs) {
530 missing_pairs = npairs - pairs;
533 std::stringstream
ss;
537 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() <<
std::dec;
538 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first <<
std::dec;
539 devices.push_back(
ss.str());
543 std::stringstream
ss;
547 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() <<
std::dec;
548 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first <<
std::dec;
549 devices.push_back(
ss.str());
552 if (!addrs[2] && npairs == 3) {
553 std::stringstream
ss;
557 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() <<
std::dec;
558 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first <<
std::dec;
559 devices.push_back(
ss.str());
562 if (!addrs[3] && npairs == 3) {
563 std::stringstream
ss;
567 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() <<
std::dec;
568 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first <<
std::dec;
569 devices.push_back(
ss.str());
573 std::stringstream
ss;
577 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() <<
std::dec;
578 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first <<
std::dec;
579 devices.push_back(
ss.str());
583 std::stringstream
ss;
587 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() <<
std::dec;
588 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first <<
std::dec;
589 devices.push_back(
ss.str());
596 std::stringstream
ss;
597 ss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
598 <<
" Summary of connections: " << std::endl
599 <<
" \"Good\" connections : " <<
valid.size() << std::endl
600 <<
" \"Dirty\" connections : " << dirty.size() << std::endl
601 <<
" \"Bad\" TrimDAQ settings : " << trimdac.size() << std::endl
602 <<
" (\"Missing\" connections : " <<
missing.size() <<
")" << std::endl
603 <<
" (\"Missing\" APV pairs : " << missing_pairs <<
")" << std::endl
604 <<
" (\"Missing\" APVs : " << devices.size() <<
")" << std::endl;
609 if (!
valid.empty()) {
610 std::stringstream
ss;
611 ss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
612 <<
" List of \"good\" connections: " << std::endl;
613 std::vector<std::string>::const_iterator istr =
valid.begin();
614 std::vector<std::string>::const_iterator jstr =
valid.end();
615 for (; istr != jstr; ++istr) {
616 ss << *istr << std::endl;
622 if (!dirty.empty()) {
623 std::stringstream
ss;
624 ss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
625 <<
" List of \"dirty\" connections: " << std::endl;
626 std::vector<std::string>::const_iterator istr = dirty.begin();
627 std::vector<std::string>::const_iterator jstr = dirty.end();
628 for (; istr != jstr; ++istr) {
629 ss << *istr << std::endl;
635 if (!trimdac.empty()) {
636 std::stringstream
ss;
637 ss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
638 <<
" List of \"bad\" TrimDAC settings: " << std::endl;
639 std::vector<std::string>::const_iterator istr = trimdac.begin();
640 std::vector<std::string>::const_iterator jstr = trimdac.end();
641 for (; istr != jstr; ++istr) {
642 ss << *istr << std::endl;
649 std::stringstream
ss;
650 ss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
651 <<
" List of \"missing\" connections: " << std::endl;
652 std::vector<std::string>::const_iterator istr =
missing.begin();
653 std::vector<std::string>::const_iterator jstr =
missing.end();
654 for (; istr != jstr; ++istr) {
655 ss << *istr << std::endl;
661 if (!devices.empty()) {
662 std::stringstream
ss;
663 ss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
664 <<
" List of \"missing\" APVs: " << std::endl;
665 std::vector<std::string>::const_iterator istr = devices.begin();
666 std::vector<std::string>::const_iterator jstr = devices.end();
667 for (; istr != jstr; ++istr) {
668 ss << *istr << std::endl;