9 using namespace sistrip;
22 <<
" Constructing object...";
29 <<
" Destructing object...";
39 <<
" NULL pointer to SiStripConfigDb interface!"
40 <<
" Aborting upload...";
46 for (; ip != jp; ++ip) {
55 update(conns, feds, dcus, detids);
59 <<
" Uploading FED connections for partition \"" << ip->second.partitionName()
65 <<
" Completed database upload of " << conns.size() <<
" ConnectionDescriptions!";
68 <<
" TEST only! No FED connections will be uploaded to DB...";
75 <<
" Uploading FED descriptions to DB...";
78 <<
" Completed database upload of " << feds.size()
79 <<
" Fed9UDescriptions (with connected channels enabled)!";
82 <<
" TEST only! No FED descriptions will be uploaded to DB...";
97 Analyses::iterator ianal =
data().begin();
98 Analyses::iterator janal =
data().end();
99 for (; ianal != janal; ++ianal) {
103 <<
" NULL pointer to analysis object!";
114 ConnectionDescription*
conn =
new ConnectionDescription();
115 conn->setFedId(fed_key.fedId());
116 conn->setFedChannel(fed_key.fedChannel());
117 conn->setFecHardwareId(
"");
118 conn->setFecCrateId(fec_key.fecCrate());
119 conn->setFecSlot(fec_key.fecSlot());
120 conn->setRingSlot(fec_key.fecRing());
121 conn->setCcuAddress(fec_key.ccuAddr());
122 conn->setI2cChannel(fec_key.ccuChan());
128 SiStripConfigDb::FedDescriptionsV::const_iterator ifed = feds.begin();
129 while (ifed != feds.end() && !
found) {
131 uint16_t fed_id =
static_cast<uint16_t
>((*ifed)->getFedId());
132 if (fed_key.fedId() == fed_id) {
133 conn->setFedCrateId(static_cast<uint16_t>((*ifed)->getCrateNumber()));
134 conn->setFedSlot(static_cast<uint16_t>((*ifed)->getSlotNumber()));
139 <<
" NULL pointer to Fed9UDescription object!";
146 <<
" Could not find FED id " << fed_key.fedId() <<
" in vector of FED descriptions!"
147 <<
" Unable to set FED crate and slot for this FED!";
150 conns.push_back(conn);
154 SiStripConfigDb::FedConnectionsV::iterator ifed = conns.begin();
155 for (; ifed != conns.end(); ifed++) {
165 SiStripConfigDb::FedDescriptionsV::const_iterator ifed = feds.begin();
166 SiStripConfigDb::FedDescriptionsV::const_iterator jfed = feds.end();
168 for (; ifed != jfed; ++ifed) {
170 Fed9U::Fed9UAddress
addr(ichan);
171 Fed9U::Fed9UAddress addr0(ichan, static_cast<Fed9U::u8>(0));
172 Fed9U::Fed9UAddress addr1(ichan, static_cast<Fed9U::u8>(1));
173 (*ifed)->setFedFeUnitDisable(addr,
true);
174 (*ifed)->setApvDisable(addr0,
true);
175 (*ifed)->setApvDisable(addr1,
true);
178 }
catch (ICUtils::ICException&
e) {
183 uint16_t connected = 0;
184 std::map<uint16_t, std::vector<uint16_t> >
enabled;
187 for (ifed = feds.begin(); ifed != feds.end(); ifed++) {
192 uint32_t fed_key = fed.
key();
195 Analyses::const_iterator iter =
data().find(fed_key);
200 if (!iter->second->isValid()) {
207 <<
" NULL pointer to OptoScanAnalysis object!";
213 uint16_t fed_id =
key.fedId();
214 uint16_t fed_ch =
key.fedChannel();
217 Fed9U::Fed9UAddress
addr(fed_ch);
218 Fed9U::Fed9UAddress addr0(fed_ch, static_cast<Fed9U::u8>(0));
219 Fed9U::Fed9UAddress addr1(fed_ch, static_cast<Fed9U::u8>(1));
220 (*ifed)->setFedFeUnitDisable(addr,
false);
221 (*ifed)->setApvDisable(addr0,
false);
222 (*ifed)->setApvDisable(addr1,
false);
224 enabled[fed_id].push_back(fed_ch);
229 std::stringstream sss;
231 sss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
232 <<
" Enabled a total of " << connected <<
" FED channels and disabled " << feds.size() * 96 - connected
233 <<
" FED channels (" << 100 * connected / (feds.size() * 96) <<
"% of total)";
236 sss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
237 <<
" Found no FEDs! (and therefore no connected channels)";
242 std::stringstream
ss;
243 ss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
244 <<
" Dump of enabled FED channels:" << std::endl;
245 std::map<uint16_t, std::vector<uint16_t> >::const_iterator fed = enabled.begin();
246 for (; fed != enabled.end(); fed++) {
247 ss <<
" Enabled " << fed->second.size() <<
" channels for FED id " << std::setw(3) << fed->first <<
": ";
248 if (!fed->second.empty()) {
249 uint16_t
first = fed->second.front();
250 uint16_t
last = fed->second.front();
251 std::vector<uint16_t>::const_iterator
chan = fed->second.begin();
252 for (; chan != fed->second.end(); chan++) {
253 if (chan != fed->second.begin()) {
254 if (*chan != last + 1) {
255 ss << std::setw(2) << first <<
"->" << std::setw(2) << last <<
", ";
256 if (chan != fed->second.end()) {
264 ss << std::setw(2) << first <<
"->" << std::setw(2) <<
last;
277 <<
" NULL pointer to SiStripFedCabling object!";
287 <<
" No DCU descriptions found!";
291 if (detids.empty()) {
293 <<
" DCU-DetId map is empty!";
296 Analyses::iterator ianal =
data().begin();
297 Analyses::iterator janal =
data().end();
298 for (; ianal != janal; ++ianal) {
300 if (!ianal->second->isValid()) {
309 <<
" NULL pointer to FastFedCablingAnalysis object!";
315 SiStripConfigDb::DeviceDescriptionsV::const_iterator idcu = dcus.begin();
316 SiStripConfigDb::DeviceDescriptionsV::const_iterator jdcu = dcus.end();
317 while (!found && idcu != jdcu) {
318 dcuDescription* dcu =
dynamic_cast<dcuDescription*
>(*idcu);
320 if (dcu->getDcuType() ==
"FEH") {
321 if (dcu->getDcuHardId() == anal->
dcuHardId()) {
323 anal->
dcuId(dcu->getDcuHardId());
329 SiStripConfigDb::DcuDetIdsV::const_iterator idet = detids.end();
331 if (idet != detids.end()) {
332 anal->
detId(idet->second->getDetId());
357 for (uint16_t iapv = 0; iapv < 2; ++iapv) {
359 FastFedCablingAnalysisDescription*
tmp;
360 tmp =
new FastFedCablingAnalysisDescription(anal->
highLevel(),
387 typedef std::vector<std::string>
Strings;
389 Strings::const_iterator istr = errors.begin();
390 Strings::const_iterator jstr = errors.end();
391 for (; istr != jstr; ++istr) {
392 tmp->addComments(*istr);
405 std::vector<std::string> valid;
406 std::vector<std::string> dirty;
407 std::vector<std::string> trimdac;
408 std::vector<std::string>
missing;
409 std::vector<std::string> devices;
410 uint32_t missing_pairs = 0;
413 std::vector<uint32_t> found_dcus;
414 Analyses::iterator ianal =
data().begin();
415 Analyses::iterator janal =
data().end();
416 for (; ianal != janal; ++ianal) {
424 std::stringstream
ss;
429 ss <<
"DcuId= " << std::hex << std::setw(8) << std::setfill(
'0') << anal->
dcuId() <<
std::dec <<
" ";
430 ss <<
"DetId= " << std::hex << std::setw(8) << std::setfill(
'0') << anal->
detId() <<
std::dec;
432 valid.push_back(ss.str());
435 dirty.push_back(ss.str());
438 trimdac.push_back(ss.str());
446 SiStripConfigDb::DeviceDescriptionsV::const_iterator idcu = dcus.begin();
447 SiStripConfigDb::DeviceDescriptionsV::const_iterator jdcu = dcus.end();
448 for (; idcu != jdcu; ++idcu) {
450 dcuDescription* dcu =
dynamic_cast<dcuDescription*
>(*idcu);
454 if (dcu->getDcuType() !=
"FEH") {
460 std::vector<uint32_t>::const_iterator iter =
find(found_dcus.begin(), found_dcus.end(), dcu->getDcuHardId());
461 if (iter != found_dcus.end()) {
466 SiStripConfigDb::DcuDetIdsV::const_iterator idet = detids.end();
468 if (idet == detids.end()) {
476 uint16_t npairs = idet->second->getApvNumber() / 2;
480 addrs.resize(6,
false);
482 SiStripConfigDb::DeviceDescriptionsV::const_iterator iapv = apvs.begin();
483 SiStripConfigDb::DeviceDescriptionsV::const_iterator japv = apvs.end();
484 for (; iapv != japv; ++iapv) {
485 apvDescription* apv =
dynamic_cast<apvDescription*
>(*iapv);
493 uint16_t pos = apv_addr.
i2cAddr_ - 32;
502 if (addrs[0] || addrs[1]) {
504 std::stringstream
ss;
507 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() <<
std::dec;
508 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first <<
std::dec;
509 missing.push_back(ss.str());
511 if (addrs[2] || addrs[3]) {
513 std::stringstream
ss;
516 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() <<
std::dec;
517 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first <<
std::dec;
518 missing.push_back(ss.str());
520 if (addrs[4] || addrs[5]) {
522 std::stringstream
ss;
525 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() <<
std::dec;
526 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first <<
std::dec;
527 missing.push_back(ss.str());
530 if (pairs != npairs) {
531 missing_pairs = npairs - pairs;
534 std::stringstream
ss;
538 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() <<
std::dec;
539 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first <<
std::dec;
540 devices.push_back(ss.str());
544 std::stringstream
ss;
548 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() <<
std::dec;
549 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first <<
std::dec;
550 devices.push_back(ss.str());
553 if (!addrs[2] && npairs == 3) {
554 std::stringstream
ss;
558 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() <<
std::dec;
559 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first <<
std::dec;
560 devices.push_back(ss.str());
563 if (!addrs[3] && npairs == 3) {
564 std::stringstream
ss;
568 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() <<
std::dec;
569 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first <<
std::dec;
570 devices.push_back(ss.str());
574 std::stringstream
ss;
578 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() <<
std::dec;
579 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first <<
std::dec;
580 devices.push_back(ss.str());
584 std::stringstream
ss;
588 ss <<
" DcuId=" << std::hex << std::setw(8) << std::setfill(
'0') << dcu->getDcuHardId() <<
std::dec;
589 ss <<
" DetId=" << std::hex << std::setw(8) << std::setfill(
'0') << idet->first <<
std::dec;
590 devices.push_back(ss.str());
597 std::stringstream
ss;
598 ss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
599 <<
" Summary of connections: " << std::endl
600 <<
" \"Good\" connections : " << valid.size() << std::endl
601 <<
" \"Dirty\" connections : " << dirty.size() << std::endl
602 <<
" \"Bad\" TrimDAQ settings : " << trimdac.size() << std::endl
603 <<
" (\"Missing\" connections : " << missing.size() <<
")" << std::endl
604 <<
" (\"Missing\" APV pairs : " << missing_pairs <<
")" << std::endl
605 <<
" (\"Missing\" APVs : " << devices.size() <<
")" << std::endl;
610 if (!valid.empty()) {
611 std::stringstream
ss;
612 ss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
613 <<
" List of \"good\" connections: " << std::endl;
614 std::vector<std::string>::const_iterator istr = valid.begin();
615 std::vector<std::string>::const_iterator jstr = valid.end();
616 for (; istr != jstr; ++istr) {
617 ss << *istr << std::endl;
623 if (!dirty.empty()) {
624 std::stringstream
ss;
625 ss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
626 <<
" List of \"dirty\" connections: " << std::endl;
627 std::vector<std::string>::const_iterator istr = dirty.begin();
628 std::vector<std::string>::const_iterator jstr = dirty.end();
629 for (; istr != jstr; ++istr) {
630 ss << *istr << std::endl;
636 if (!trimdac.empty()) {
637 std::stringstream
ss;
638 ss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
639 <<
" List of \"bad\" TrimDAC settings: " << std::endl;
640 std::vector<std::string>::const_iterator istr = trimdac.begin();
641 std::vector<std::string>::const_iterator jstr = trimdac.end();
642 for (; istr != jstr; ++istr) {
643 ss << *istr << std::endl;
649 if (!missing.empty()) {
650 std::stringstream
ss;
651 ss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
652 <<
" List of \"missing\" connections: " << std::endl;
653 std::vector<std::string>::const_iterator istr = missing.begin();
654 std::vector<std::string>::const_iterator jstr = missing.end();
655 for (; istr != jstr; ++istr) {
656 ss << *istr << std::endl;
662 if (!devices.empty()) {
663 std::stringstream
ss;
664 ss <<
"[FastFedCablingHistosUsingDb::" << __func__ <<
"]"
665 <<
" List of \"missing\" APVs: " << std::endl;
666 std::vector<std::string>::const_iterator istr = devices.begin();
667 std::vector<std::string>::const_iterator jstr = devices.end();
668 for (; istr != jstr; ++istr) {
669 ss << *istr << std::endl;
Log< level::Info, true > LogVerbatim
const uint16_t & lldCh() const
DcuDetIds::range DcuDetIdsRange
const uint32_t & fedKey() const
Analyses::iterator Analysis
const uint32_t & dcuHardId() const
Analyses & data(bool getMaskedData=false)
A container class for generic run and event-related info, information required by the commissioning a...
static const uint32_t invalid32_
void uploadFedConnections(std::string partition="")
FedDescriptionsRange getFedDescriptions(std::string partition="")
tuple chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
static const float dirtyThreshold_
~FastFedCablingHistosUsingDb() override
FedDescriptions::range FedDescriptionsRange
static const char mlDqmClient_[]
Log< level::Error, false > LogError
const float & lowLevel() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const uint16_t & i2cAddr() const
const float & highLevel() const
const uint32_t & key() const
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
const_iterator_range partitions() const
static const char mlCabling_[]
Histogram-based analysis for connection loop.
static DcuDetIdsV::const_iterator findDcuDetId(DcuDetIdsV::const_iterator begin, DcuDetIdsV::const_iterator end, uint32_t dcu_id)
const float & min() const
bool isValid() const override
DeviceDescriptions::range DeviceDescriptionsRange
const uint32_t & dcuId() const
An interface class to the DeviceFactory.
bool doUploadConf() const
const float & max() const
void terse(std::stringstream &ss) const override
tuple key
prepare the HTCondor submission files and eventually submit them
const uint32_t & fecKey() const
void uploadConfigurations() override
DeviceAddress deviceAddress(const deviceDescription &)
void create(SiStripConfigDb::AnalysisDescriptionsV &, Analysis) override
void clearFedConnections(std::string partition="")
void connections(SiStripConfigDb::DeviceDescriptionsRange, SiStripConfigDb::DcuDetIdsRange)
const uint16_t & feUnit() const
const SiStripDbParams & dbParams() const
void update(SiStripConfigDb::FedConnectionsV &, SiStripConfigDb::FedDescriptionsRange, SiStripConfigDb::DeviceDescriptionsRange, SiStripConfigDb::DcuDetIdsRange)
void uploadFedDescriptions(std::string partition="")
const float & highRms() const
const float & lowRms() const
static const uint16_t FEDCH_PER_FED
void addDcuDetIds() override
std::vector< AnalysisDescription * > AnalysisDescriptionsV
const uint16_t & feChan() const
const uint32_t & detId() const
std::vector< FedConnection * > FedConnectionsV
SiStripConfigDb *const db() const
void addFedConnections(std::string partition, FedConnectionsV &)
DeviceDescriptionsRange getDeviceDescriptions(std::string partition="")
Log< level::Warning, false > LogWarning
DcuDetIdsRange getDcuDetIds(std::string partition="")
SiStripFedCabling *const cabling() const
const VString & getErrorCodes() const
FastFedCablingHistosUsingDb(const edm::ParameterSet &pset, DQMStore *, SiStripConfigDb *const, edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken)
static const float threshold_