CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions
FastFedCablingHistosUsingDb Class Reference

#include <FastFedCablingHistosUsingDb.h>

Inheritance diagram for FastFedCablingHistosUsingDb:
CommissioningHistosUsingDb FastFedCablingHistograms CommissioningHistograms CommissioningHistograms

Public Member Functions

void addDcuDetIds () override
 
 FastFedCablingHistosUsingDb (const edm::ParameterSet &pset, DQMStore *, SiStripConfigDb *const, edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken)
 
void uploadConfigurations () override
 
 ~FastFedCablingHistosUsingDb () override
 
- Public Member Functions inherited from CommissioningHistosUsingDb
 CommissioningHistosUsingDb (SiStripConfigDb *const, edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken, sistrip::RunType=sistrip::UNDEFINED_RUN_TYPE)
 
void configure (const edm::ParameterSet &, const edm::EventSetup &) override
 
bool doUploadAnal () const
 
void doUploadAnal (bool)
 
bool doUploadConf () const
 
void doUploadConf (bool)
 
void uploadToConfigDb ()
 
 ~CommissioningHistosUsingDb () override
 
- Public Member Functions inherited from CommissioningHistograms
 CommissioningHistograms (const edm::ParameterSet &pset, DQMStore *const, const sistrip::RunType &)
 
 CommissioningHistograms ()
 
void createCollations (const std::vector< std::string > &)
 
virtual void createSummaryHisto (const sistrip::Monitorable &, const sistrip::Presentation &, const std::string &top_level_dir, const sistrip::Granularity &)
 
void extractHistograms (const std::vector< std::string > &)
 
void remove (std::string pattern="")
 
void save (std::string &filename, uint32_t run_number=0, std::string partitionName="")
 
virtual ~CommissioningHistograms ()
 
- Public Member Functions inherited from FastFedCablingHistograms
 FastFedCablingHistograms (const edm::ParameterSet &pset, DQMStore *)
 
void histoAnalysis (bool debug) override
 
void printAnalyses () override
 
void printSummary () override
 
 ~FastFedCablingHistograms () override
 

Private Member Functions

void connections (SiStripConfigDb::DeviceDescriptionsRange, SiStripConfigDb::DcuDetIdsRange)
 
void create (SiStripConfigDb::AnalysisDescriptionsV &, Analysis) override
 
void update (SiStripConfigDb::FedConnectionsV &, SiStripConfigDb::FedDescriptionsRange, SiStripConfigDb::DeviceDescriptionsRange, SiStripConfigDb::DcuDetIdsRange)
 
void update (SiStripConfigDb::FedDescriptionsRange)
 

Additional Inherited Members

- Public Types inherited from CommissioningHistograms
typedef std::map< uint32_t, CommissioningAnalysis * > Analyses
 
typedef Analyses::iterator Analysis
 
typedef dqm::harvesting::DQMStore DQMStore
 
typedef SummaryPlotFactory< CommissioningAnalysis * > Factory
 
typedef std::map< uint32_t, uint32_t > FedToFecMap
 
typedef std::vector< Histo * > Histos
 
typedef std::map< uint32_t, HistosHistosMap
 
typedef dqm::harvesting::MonitorElement MonitorElement
 
- Static Public Member Functions inherited from CommissioningHistograms
static void copyCustomInformation (DQMStore *const, const std::vector< std::string > &)
 
static uint32_t runNumber (DQMStore *const, const std::vector< std::string > &)
 
static sistrip::RunType runType (DQMStore *const, const std::vector< std::string > &)
 
- Protected Member Functions inherited from CommissioningHistosUsingDb
void buildDetInfo ()
 
SiStripFedCabling *const cabling () const
 
virtual void createAnalyses (SiStripConfigDb::AnalysisDescriptionsV &)
 
SiStripConfigDb *const db () const
 
std::pair< std::string, DetInfodetInfo (const SiStripFecKey &)
 
bool deviceIsPresent (const SiStripFecKey &)
 
void uploadAnalyses ()
 
- Protected Member Functions inherited from CommissioningHistograms
DQMStore *const bei () const
 
void clearHistosMap ()
 
Analysesdata (bool getMaskedData=false)
 
Factory *const factory ()
 
TH1 * histogram (const sistrip::Monitorable &, const sistrip::Presentation &, const sistrip::View &, const std::string &directory, const uint32_t &xbins, const float &xlow=1. *sistrip::invalid_, const float &xhigh=1. *sistrip::invalid_)
 
const HistosMaphistos () const
 
const FedToFecMapmapping () const
 
void printHistosMap ()
 
const edm::ParameterSetpset () const
 
const sistrip::RunTypetask () const
 
- Protected Attributes inherited from CommissioningHistograms
std::unique_ptr< Factoryfactory_
 

Detailed Description

Definition at line 8 of file FastFedCablingHistosUsingDb.h.

Constructor & Destructor Documentation

◆ FastFedCablingHistosUsingDb()

FastFedCablingHistosUsingDb::FastFedCablingHistosUsingDb ( const edm::ParameterSet pset,
DQMStore bei,
SiStripConfigDb * const  db,
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd tTopoToken 
)

Definition at line 13 of file FastFedCablingHistosUsingDb.cc.

References LogTrace, and sistrip::mlDqmClient_.

18  pset.getParameter<edm::ParameterSet>("FastFedCablingParameters"), bei, sistrip::FAST_CABLING),
20  FastFedCablingHistograms(pset.getParameter<edm::ParameterSet>("FastFedCablingParameters"), bei) {
21  LogTrace(mlDqmClient_) << "[FastFedCablingHistosUsingDb::" << __func__ << "]"
22  << " Constructing object...";
23 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
static const char mlDqmClient_[]
#define LogTrace(id)
SiStripConfigDb *const db() const
const edm::ParameterSet & pset() const
DQMStore *const bei() const
FastFedCablingHistograms(const edm::ParameterSet &pset, DQMStore *)

◆ ~FastFedCablingHistosUsingDb()

FastFedCablingHistosUsingDb::~FastFedCablingHistosUsingDb ( )
override

Definition at line 27 of file FastFedCablingHistosUsingDb.cc.

References LogTrace, and sistrip::mlDqmClient_.

27  {
28  LogTrace(mlDqmClient_) << "[FastFedCablingHistosUsingDb::" << __func__ << "]"
29  << " Destructing object...";
30 }
static const char mlDqmClient_[]
#define LogTrace(id)

Member Function Documentation

◆ addDcuDetIds()

void FastFedCablingHistosUsingDb::addDcuDetIds ( )
overridevirtual

Reimplemented from CommissioningHistosUsingDb.

Definition at line 274 of file FastFedCablingHistosUsingDb.cc.

References generateTowerEtThresholdLUT::addr, conversion_template_cfg::anal, CommissioningHistosUsingDb::cabling(), CommissioningHistograms::data(), CommissioningHistosUsingDb::db(), SiStripConfigDb::deviceAddress(), SiStripConfigDb::findDcuDetId(), newFWLiteAna::found, SiStripConfigDb::getDcuDetIds(), SiStripConfigDb::getDeviceDescriptions(), crabWrapper::key, sistrip::mlCabling_, and sistrip::mlDqmClient_.

274  {
275  if (!cabling()) {
276  edm::LogError(mlDqmClient_) << "[FastFedCablingHistosUsingDb::" << __func__ << "]"
277  << " NULL pointer to SiStripFedCabling object!";
278  return;
279  }
280 
281  // retrieve descriptions for dcu id and det id
284 
285  if (dcus.empty()) {
286  edm::LogError(mlCabling_) << "[FastFedCablingHistosUsingDb::" << __func__ << "]"
287  << " No DCU descriptions found!";
288  return;
289  }
290 
291  if (detids.empty()) {
292  edm::LogWarning(mlCabling_) << "[FastFedCablingHistosUsingDb::" << __func__ << "]"
293  << " DCU-DetId map is empty!";
294  }
295 
296  Analyses::iterator ianal = data().begin();
297  Analyses::iterator janal = data().end();
298  for (; ianal != janal; ++ianal) {
299  // check if analysis is valid (ie, dcu id and lld channel have been identified)
300  if (!ianal->second->isValid()) {
301  continue;
302  }
303 
304  // retrieve analysis object
305  FastFedCablingAnalysis* anal = dynamic_cast<FastFedCablingAnalysis*>(ianal->second);
306 
307  if (!anal) {
308  edm::LogError(mlDqmClient_) << "[FastFedCablingHistosUsingDb::" << __func__ << "]"
309  << " NULL pointer to FastFedCablingAnalysis object!";
310  return;
311  }
312 
313  // find dcu that matches analysis result
314  bool found = false;
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);
319  if (dcu) {
320  if (dcu->getDcuType() == "FEH") {
321  if (dcu->getDcuHardId() == anal->dcuHardId()) {
322  found = true;
323  anal->dcuId(dcu->getDcuHardId());
325  uint32_t fec_key =
326  SiStripFecKey(addr.fecCrate_, addr.fecSlot_, addr.fecRing_, addr.ccuAddr_, addr.ccuChan_, anal->lldCh())
327  .key();
328  anal->fecKey(fec_key);
329  SiStripConfigDb::DcuDetIdsV::const_iterator idet = detids.end();
330  idet = SiStripConfigDb::findDcuDetId(detids.begin(), detids.end(), dcu->getDcuHardId());
331  if (idet != detids.end()) {
332  anal->detId(idet->second->getDetId());
333  }
334  }
335  }
336  }
337  idcu++;
338  }
339  }
340 }
DcuDetIds::range DcuDetIdsRange
Analyses & data(bool getMaskedData=false)
static const char mlDqmClient_[]
Log< level::Error, false > LogError
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
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)
Definition: DcuDetIds.cc:412
SiStripConfigDb *const db() const
DeviceDescriptions::range DeviceDescriptionsRange
DeviceAddress deviceAddress(const deviceDescription &)
SiStripFedCabling *const cabling() const
DeviceDescriptionsRange getDeviceDescriptions(std::string partition="")
Log< level::Warning, false > LogWarning
DcuDetIdsRange getDcuDetIds(std::string partition="")
Definition: DcuDetIds.cc:10

◆ connections()

void FastFedCablingHistosUsingDb::connections ( SiStripConfigDb::DeviceDescriptionsRange  dcus,
SiStripConfigDb::DcuDetIdsRange  detids 
)
private

Definition at line 402 of file FastFedCablingHistosUsingDb.cc.

References conversion_template_cfg::anal, SiStripConfigDb::DeviceAddress::ccuAddr_, SiStripConfigDb::DeviceAddress::ccuChan_, CommissioningHistograms::data(), CommissioningHistosUsingDb::db(), TauDecayModes::dec, SiStripConfigDb::deviceAddress(), cms::alpakatools::devices(), SiStripConfigDb::DeviceAddress::fecCrate_, SiStripConfigDb::DeviceAddress::fecRing_, SiStripConfigDb::DeviceAddress::fecSlot_, spr::find(), SiStripConfigDb::findDcuDetId(), SiStripConfigDb::getDeviceDescriptions(), SiStripConfigDb::DeviceAddress::i2cAddr_, LogTrace, combine::missing, sistrip::mlCabling_, contentValuesCheck::ss, SiStripFecKey::terse(), and validateGeometry_cfg::valid.

Referenced by uploadConfigurations().

403  {
404  // strings
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;
411 
412  // iterate through analyses
413  std::vector<uint32_t> found_dcus;
414  Analyses::iterator ianal = data().begin();
415  Analyses::iterator janal = data().end();
416  for (; ianal != janal; ++ianal) {
417  // extract fast fed cabling object
418  FastFedCablingAnalysis* anal = dynamic_cast<FastFedCablingAnalysis*>(ianal->second);
419  if (!anal) {
420  continue;
421  }
422 
423  // construct strings for various categories of connections
424  std::stringstream ss;
425  SiStripFedKey(anal->fedKey()).terse(ss);
426  ss << " ";
427  SiStripFecKey(anal->fecKey()).terse(ss);
428  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;
431  if (anal->isValid() && !(anal->isDirty()) && !(anal->badTrimDac())) {
432  valid.push_back(ss.str());
433  }
434  if (anal->isDirty()) {
435  dirty.push_back(ss.str());
436  }
437  if (anal->badTrimDac()) {
438  trimdac.push_back(ss.str());
439  }
440 
441  // record "found" dcus
442  found_dcus.push_back(anal->dcuHardId());
443  }
444 
445  // iterate through dcu devices
446  SiStripConfigDb::DeviceDescriptionsV::const_iterator idcu = dcus.begin();
447  SiStripConfigDb::DeviceDescriptionsV::const_iterator jdcu = dcus.end();
448  for (; idcu != jdcu; ++idcu) {
449  // extract dcu description
450  dcuDescription* dcu = dynamic_cast<dcuDescription*>(*idcu);
451  if (!dcu) {
452  continue;
453  }
454  if (dcu->getDcuType() != "FEH") {
455  continue;
456  }
457  SiStripConfigDb::DeviceAddress dcu_addr = db()->deviceAddress(*dcu);
458 
459  // continue if dcu has been "found"
460  std::vector<uint32_t>::const_iterator iter = find(found_dcus.begin(), found_dcus.end(), dcu->getDcuHardId());
461  if (iter != found_dcus.end()) {
462  continue;
463  }
464 
465  // find detid for "missing" dcu
466  SiStripConfigDb::DcuDetIdsV::const_iterator idet = detids.end();
467  idet = SiStripConfigDb::findDcuDetId(detids.begin(), detids.end(), dcu->getDcuHardId());
468  if (idet == detids.end()) {
469  continue;
470  }
471  if (!idet->second) {
472  continue;
473  }
474 
475  // retrieve number of apv pairs
476  uint16_t npairs = idet->second->getApvNumber() / 2;
477 
478  // retrieve apvs for given dcu
479  vector<bool> addrs;
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);
486  if (!apv) {
487  continue;
488  }
489  SiStripConfigDb::DeviceAddress apv_addr = db()->deviceAddress(*apv);
490  if (apv_addr.fecCrate_ == dcu_addr.fecCrate_ && apv_addr.fecSlot_ == dcu_addr.fecSlot_ &&
491  apv_addr.fecRing_ == dcu_addr.fecRing_ && apv_addr.ccuAddr_ == dcu_addr.ccuAddr_ &&
492  apv_addr.ccuChan_ == dcu_addr.ccuChan_) {
493  uint16_t pos = apv_addr.i2cAddr_ - 32;
494  if (pos < 6) {
495  addrs[pos] = true;
496  }
497  }
498  }
499 
500  // construct strings for missing fibres
501  uint16_t pairs = 0;
502  if (addrs[0] || addrs[1]) {
503  pairs++;
504  std::stringstream ss;
505  SiStripFecKey(dcu_addr.fecCrate_, dcu_addr.fecSlot_, dcu_addr.fecRing_, dcu_addr.ccuAddr_, dcu_addr.ccuChan_, 1)
506  .terse(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());
510  }
511  if (addrs[2] || addrs[3]) {
512  pairs++;
513  std::stringstream ss;
514  SiStripFecKey(dcu_addr.fecCrate_, dcu_addr.fecSlot_, dcu_addr.fecRing_, dcu_addr.ccuAddr_, dcu_addr.ccuChan_, 2)
515  .terse(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());
519  }
520  if (addrs[4] || addrs[5]) {
521  pairs++;
522  std::stringstream ss;
523  SiStripFecKey(dcu_addr.fecCrate_, dcu_addr.fecSlot_, dcu_addr.fecRing_, dcu_addr.ccuAddr_, dcu_addr.ccuChan_, 3)
524  .terse(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());
528  }
529 
530  if (pairs != npairs) {
531  missing_pairs = npairs - pairs;
532 
533  if (!addrs[0]) {
534  std::stringstream ss;
536  dcu_addr.fecCrate_, dcu_addr.fecSlot_, dcu_addr.fecRing_, dcu_addr.ccuAddr_, dcu_addr.ccuChan_, 1, 32)
537  .terse(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());
541  }
542 
543  if (!addrs[1]) {
544  std::stringstream ss;
546  dcu_addr.fecCrate_, dcu_addr.fecSlot_, dcu_addr.fecRing_, dcu_addr.ccuAddr_, dcu_addr.ccuChan_, 1, 33)
547  .terse(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());
551  }
552 
553  if (!addrs[2] && npairs == 3) {
554  std::stringstream ss;
556  dcu_addr.fecCrate_, dcu_addr.fecSlot_, dcu_addr.fecRing_, dcu_addr.ccuAddr_, dcu_addr.ccuChan_, 2, 34)
557  .terse(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());
561  }
562 
563  if (!addrs[3] && npairs == 3) {
564  std::stringstream ss;
566  dcu_addr.fecCrate_, dcu_addr.fecSlot_, dcu_addr.fecRing_, dcu_addr.ccuAddr_, dcu_addr.ccuChan_, 2, 35)
567  .terse(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());
571  }
572 
573  if (!addrs[4]) {
574  std::stringstream ss;
576  dcu_addr.fecCrate_, dcu_addr.fecSlot_, dcu_addr.fecRing_, dcu_addr.ccuAddr_, dcu_addr.ccuChan_, 3, 36)
577  .terse(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());
581  }
582 
583  if (!addrs[5]) {
584  std::stringstream ss;
586  dcu_addr.fecCrate_, dcu_addr.fecSlot_, dcu_addr.fecRing_, dcu_addr.ccuAddr_, dcu_addr.ccuChan_, 3, 37)
587  .terse(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());
591  }
592  }
593  }
594 
595  // summary
596  {
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;
606  edm::LogVerbatim(mlCabling_) << ss.str();
607  }
608 
609  // good connections
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;
618  }
619  LogTrace(mlCabling_) << ss.str();
620  }
621 
622  // dirty connections
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;
631  }
632  edm::LogWarning(mlCabling_) << ss.str();
633  }
634 
635  // TrimDAC connections
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;
644  }
645  edm::LogWarning(mlCabling_) << ss.str();
646  }
647 
648  // missing connections
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;
657  }
658  edm::LogError(mlCabling_) << ss.str();
659  }
660 
661  // missing devices
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;
670  }
671  edm::LogError(mlCabling_) << ss.str();
672  }
673 }
Log< level::Info, true > LogVerbatim
Analyses & data(bool getMaskedData=false)
A container class for generic run and event-related info, information required by the commissioning a...
Definition: SiStripFedKey.h:56
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
missing
Definition: combine.py:5
#define LogTrace(id)
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
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)
Definition: DcuDetIds.cc:412
SiStripConfigDb *const db() const
DeviceDescriptions::range DeviceDescriptionsRange
void terse(std::stringstream &ss) const override
DeviceAddress deviceAddress(const deviceDescription &)
std::vector< alpaka::Dev< TPlatform > > const & devices()
Definition: devices.h:35
DeviceDescriptionsRange getDeviceDescriptions(std::string partition="")
Log< level::Warning, false > LogWarning

◆ create()

void FastFedCablingHistosUsingDb::create ( SiStripConfigDb::AnalysisDescriptionsV desc,
Analysis  analysis 
)
overrideprivatevirtual

Reimplemented from CommissioningHistosUsingDb.

Definition at line 344 of file FastFedCablingHistosUsingDb.cc.

References conversion_template_cfg::anal, CommissioningHistosUsingDb::db(), SiStripConfigDb::dbParams(), submitPVResolutionJobs::desc, FastFedCablingAnalysis::dirtyThreshold_, SiStripFecKey::i2cAddr(), sistrip::invalid32_, SiStripDbParams::partitions(), FastFedCablingAnalysis::threshold_, and createJobs::tmp.

344  {
345  FastFedCablingAnalysis* anal = dynamic_cast<FastFedCablingAnalysis*>(analysis->second);
346  if (!anal) {
347  return;
348  }
349 
350  if (!anal->isValid() || anal->dcuId() == sistrip::invalid32_) {
351  return;
352  } //@@ only store valid descriptions!
353 
354  SiStripFecKey fec_key(anal->fecKey());
355  SiStripFedKey fed_key(anal->fedKey());
356 
357  for (uint16_t iapv = 0; iapv < 2; ++iapv) {
358  // Create description
359  FastFedCablingAnalysisDescription* tmp;
360  tmp = new FastFedCablingAnalysisDescription(anal->highLevel(),
361  anal->highRms(),
362  anal->lowLevel(),
363  anal->lowRms(),
364  anal->max(),
365  anal->min(),
366  anal->dcuId(),
367  anal->lldCh(),
368  anal->isDirty(),
371  fec_key.fecCrate(),
372  fec_key.fecSlot(),
373  fec_key.fecRing(),
374  fec_key.ccuAddr(),
375  fec_key.ccuChan(),
376  SiStripFecKey::i2cAddr(fec_key.lldChan(), !iapv),
377  db()->dbParams().partitions().begin()->second.partitionName(),
378  db()->dbParams().partitions().begin()->second.runNumber(),
379  anal->isValid(),
380  "",
381  fed_key.fedId(),
382  fed_key.feUnit(),
383  fed_key.feChan(),
384  fed_key.fedApv());
385 
386  // Add comments
387  typedef std::vector<std::string> Strings;
388  Strings errors = anal->getErrorCodes();
389  Strings::const_iterator istr = errors.begin();
390  Strings::const_iterator jstr = errors.end();
391  for (; istr != jstr; ++istr) {
392  tmp->addComments(*istr);
393  }
394 
395  // Store description
396  desc.push_back(tmp);
397  }
398 }
A container class for generic run and event-related info, information required by the commissioning a...
Definition: SiStripFedKey.h:56
static const uint32_t invalid32_
Definition: Constants.h:15
std::vector< std::string > Strings
Definition: MsgTools.h:18
static const float dirtyThreshold_
const_iterator_range partitions() const
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
Histogram-based analysis for connection loop.
const uint16_t & i2cAddr() const
SiStripConfigDb *const db() const
Definition: errors.py:1
const SiStripDbParams & dbParams() const
tmp
align.sh
Definition: createJobs.py:716
static const float threshold_

◆ update() [1/2]

void FastFedCablingHistosUsingDb::update ( SiStripConfigDb::FedConnectionsV conns,
SiStripConfigDb::FedDescriptionsRange  feds,
SiStripConfigDb::DeviceDescriptionsRange  dcus,
SiStripConfigDb::DcuDetIdsRange  detids 
)
private

Definition at line 92 of file FastFedCablingHistosUsingDb.cc.

References conversion_template_cfg::anal, getInfo::conn, CommissioningHistograms::data(), l1tstage2emulator_dqm_sourceclient-live_cfg::feds, newFWLiteAna::found, SiStripFecKey::i2cAddr(), sistrip::invalid32_, and sistrip::mlDqmClient_.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), dqm-mbProfile.Profile::finish(), progressbar.ProgressBar::finish(), MatrixUtil.Steps::overwrite(), and uploadConfigurations().

95  {
96  // Update FED-FEC mapping in base class, based on analysis results
97  Analyses::iterator ianal = data().begin();
98  Analyses::iterator janal = data().end();
99  for (; ianal != janal; ++ianal) {
100  FastFedCablingAnalysis* anal = dynamic_cast<FastFedCablingAnalysis*>(ianal->second);
101  if (!anal) {
102  edm::LogError(mlDqmClient_) << "[FastFedCablingHistosUsingDb::" << __func__ << "]"
103  << " NULL pointer to analysis object!";
104  continue;
105  }
106 
107  if (!anal->isValid() || anal->dcuId() == sistrip::invalid32_) {
108  continue;
109  }
110 
111  SiStripFecKey fec_key(anal->fecKey());
112  SiStripFedKey fed_key(anal->fedKey());
113 
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());
123  conn->setApvAddress(SiStripFecKey::i2cAddr(anal->lldCh(), true));
124  conn->setDcuHardId(anal->dcuHardId());
125 
126  // Retrieve FED crate and slot numbers
127  bool found = false;
128  SiStripConfigDb::FedDescriptionsV::const_iterator ifed = feds.begin();
129  while (ifed != feds.end() && !found) {
130  if (*ifed) {
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()));
135  found = true;
136  }
137  } else {
138  edm::LogError(mlDqmClient_) << "[FastFedCablingHistosUsingDb::" << __func__ << "]"
139  << " NULL pointer to Fed9UDescription object!";
140  continue;
141  }
142  ++ifed;
143  }
144  if (!found) {
145  edm::LogError(mlDqmClient_) << "[FastFedCablingHistosUsingDb::" << __func__ << "]"
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!";
148  }
149 
150  conns.push_back(conn);
151  }
152 
153  if (false) {
154  SiStripConfigDb::FedConnectionsV::iterator ifed = conns.begin();
155  for (; ifed != conns.end(); ifed++) {
156  (*ifed)->display();
157  }
158  }
159 }
Analyses & data(bool getMaskedData=false)
A container class for generic run and event-related info, information required by the commissioning a...
Definition: SiStripFedKey.h:56
static const uint32_t invalid32_
Definition: Constants.h:15
static const char mlDqmClient_[]
Log< level::Error, false > LogError
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
Histogram-based analysis for connection loop.
const uint16_t & i2cAddr() const
conn
Definition: getInfo.py:9

◆ update() [2/2]

void FastFedCablingHistosUsingDb::update ( SiStripConfigDb::FedDescriptionsRange  feds)
private

Definition at line 163 of file FastFedCablingHistosUsingDb.cc.

References generateTowerEtThresholdLUT::addr, conversion_template_cfg::anal, officialStyle::chan, CommissioningHistograms::data(), MillePedeFileConverter_cfg::e, cms::soa::RestrictQualify::enabled, mps_fire::end, SiStripFedKey::feChan(), sistrip::FEDCH_PER_FED, l1tstage2emulator_dqm_sourceclient-live_cfg::feds, SiStripFedKey::feUnit(), dqmdumpme::first, crabWrapper::key, SiStripKey::key(), dqmdumpme::last, LogTrace, sistrip::mlDqmClient_, and contentValuesCheck::ss.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), dqm-mbProfile.Profile::finish(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

163  {
164  // Iterate through feds and disable all channels
165  SiStripConfigDb::FedDescriptionsV::const_iterator ifed = feds.begin();
166  SiStripConfigDb::FedDescriptionsV::const_iterator jfed = feds.end();
167  try {
168  for (; ifed != jfed; ++ifed) {
169  for (uint16_t ichan = 0; ichan < sistrip::FEDCH_PER_FED; ichan++) {
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);
176  }
177  }
178  } catch (ICUtils::ICException& e) {
179  edm::LogWarning(mlDqmClient_) << e.what();
180  }
181 
182  // Counters for number of connected / enabled channels
183  uint16_t connected = 0;
184  std::map<uint16_t, std::vector<uint16_t> > enabled;
185 
186  // Iterate through feds and enable connected channels
187  for (ifed = feds.begin(); ifed != feds.end(); ifed++) {
188  for (uint16_t ichan = 0; ichan < sistrip::FEDCH_PER_FED; ichan++) {
189  // Retrieve FEC key from FED-FEC map
190  SiStripFedKey fed(
191  static_cast<uint16_t>((*ifed)->getFedId()), SiStripFedKey::feUnit(ichan), SiStripFedKey::feChan(ichan));
192  uint32_t fed_key = fed.key();
193 
194  // Retrieve analysis for given FED id and channel
195  Analyses::const_iterator iter = data().find(fed_key);
196  if (iter == data().end()) {
197  continue;
198  }
199 
200  if (!iter->second->isValid()) {
201  continue;
202  }
203 
204  FastFedCablingAnalysis* anal = dynamic_cast<FastFedCablingAnalysis*>(iter->second);
205  if (!anal) {
206  edm::LogError(mlDqmClient_) << "[FastFedCablingHistosUsingDb::" << __func__ << "]"
207  << " NULL pointer to OptoScanAnalysis object!";
208  continue;
209  }
210 
211  // Retrieve FED id and channel
212  SiStripFedKey key(anal->fedKey());
213  uint16_t fed_id = key.fedId();
214  uint16_t fed_ch = key.fedChannel();
215 
216  // Enable front-end unit and channel
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);
223  connected++;
224  enabled[fed_id].push_back(fed_ch);
225  }
226  }
227 
228  // Some debug
229  std::stringstream sss;
230  if (!feds.empty()) {
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)";
234  edm::LogVerbatim(mlDqmClient_) << sss.str();
235  } else {
236  sss << "[FastFedCablingHistosUsingDb::" << __func__ << "]"
237  << " Found no FEDs! (and therefore no connected channels)";
238  edm::LogWarning(mlDqmClient_) << sss.str();
239  }
240 
241  // Some debug
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()) {
257  first = *(chan + 1);
258  }
259  }
260  }
261  last = *chan;
262  }
263  if (first != last) {
264  ss << std::setw(2) << first << "->" << std::setw(2) << last;
265  }
266  ss << std::endl;
267  }
268  }
269  LogTrace(mlDqmClient_) << ss.str();
270 }
Log< level::Info, true > LogVerbatim
const uint16_t & feChan() const
Analyses & data(bool getMaskedData=false)
const uint16_t & feUnit() const
A container class for generic run and event-related info, information required by the commissioning a...
Definition: SiStripFedKey.h:56
static const char mlDqmClient_[]
Log< level::Error, false > LogError
constexpr bool enabled
Definition: SoACommon.h:71
#define LogTrace(id)
Histogram-based analysis for connection loop.
const uint32_t & key() const
Definition: SiStripKey.h:120
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
static const uint16_t FEDCH_PER_FED
Log< level::Warning, false > LogWarning

◆ uploadConfigurations()

void FastFedCablingHistosUsingDb::uploadConfigurations ( )
overridevirtual

Reimplemented from CommissioningHistosUsingDb.

Definition at line 34 of file FastFedCablingHistosUsingDb.cc.

References SiStripConfigDb::addFedConnections(), SiStripConfigDb::clearFedConnections(), connections(), CommissioningHistosUsingDb::db(), SiStripConfigDb::dbParams(), CommissioningHistosUsingDb::doUploadConf(), l1tstage2emulator_dqm_sourceclient-live_cfg::feds, SiStripConfigDb::getDcuDetIds(), SiStripConfigDb::getDeviceDescriptions(), SiStripConfigDb::getFedDescriptions(), LogTrace, sistrip::mlDqmClient_, SiStripDbParams::partitions(), update(), SiStripConfigDb::uploadFedConnections(), and SiStripConfigDb::uploadFedDescriptions().

34  {
35  LogTrace(mlDqmClient_) << "[FastFedCablingHistosUsingDb::" << __func__ << "]";
36 
37  if (!db()) {
38  edm::LogError(mlDqmClient_) << "[FastFedCablingHistosUsingDb::" << __func__ << "]"
39  << " NULL pointer to SiStripConfigDb interface!"
40  << " Aborting upload...";
41  return;
42  }
43 
44  SiStripDbParams::SiStripPartitions::const_iterator ip = db()->dbParams().partitions().begin();
45  SiStripDbParams::SiStripPartitions::const_iterator jp = db()->dbParams().partitions().end();
46  for (; ip != jp; ++ip) {
47  // Retrieve descriptions
49  SiStripConfigDb::FedDescriptionsRange feds = db()->getFedDescriptions(ip->second.partitionName());
50  SiStripConfigDb::DeviceDescriptionsRange dcus = db()->getDeviceDescriptions(DCU, ip->second.partitionName());
51  SiStripConfigDb::DcuDetIdsRange detids = db()->getDcuDetIds(ip->second.partitionName());
52 
53  // Update FED connection descriptions
55  update(conns, feds, dcus, detids);
56 
57  if (doUploadConf()) {
58  edm::LogVerbatim(mlDqmClient_) << "[FastFedCablingHistosUsingDb::" << __func__ << "]"
59  << " Uploading FED connections for partition \"" << ip->second.partitionName()
60  << "\" to DB...";
61  db()->clearFedConnections(ip->second.partitionName());
62  db()->addFedConnections(ip->second.partitionName(), conns);
63  db()->uploadFedConnections(ip->second.partitionName());
64  edm::LogVerbatim(mlDqmClient_) << "[FastFedCablingHistosUsingDb::" << __func__ << "]"
65  << " Completed database upload of " << conns.size() << " ConnectionDescriptions!";
66  } else {
67  edm::LogWarning(mlDqmClient_) << "[FastFedCablingHistosUsingDb::" << __func__ << "]"
68  << " TEST only! No FED connections will be uploaded to DB...";
69  }
70 
71  // Update FED descriptions with enabled/disabled channels
72  update(feds);
73  if (doUploadConf()) {
74  edm::LogVerbatim(mlDqmClient_) << "[FastFedCablingHistosUsingDb::" << __func__ << "]"
75  << " Uploading FED descriptions to DB...";
76  db()->uploadFedDescriptions(ip->second.partitionName());
77  edm::LogVerbatim(mlDqmClient_) << "[FastFedCablingHistosUsingDb::" << __func__ << "]"
78  << " Completed database upload of " << feds.size()
79  << " Fed9UDescriptions (with connected channels enabled)!";
80  } else {
81  edm::LogWarning(mlDqmClient_) << "[FastFedCablingHistosUsingDb::" << __func__ << "]"
82  << " TEST only! No FED descriptions will be uploaded to DB...";
83  }
84 
85  // Some debug on good / dirty / missing connections
86  connections(dcus, detids);
87  }
88 }
Log< level::Info, true > LogVerbatim
DcuDetIds::range DcuDetIdsRange
void uploadFedConnections(std::string partition="")
FedDescriptionsRange getFedDescriptions(std::string partition="")
FedDescriptions::range FedDescriptionsRange
static const char mlDqmClient_[]
Log< level::Error, false > LogError
const_iterator_range partitions() const
#define LogTrace(id)
SiStripConfigDb *const db() const
DeviceDescriptions::range DeviceDescriptionsRange
void clearFedConnections(std::string partition="")
void connections(SiStripConfigDb::DeviceDescriptionsRange, SiStripConfigDb::DcuDetIdsRange)
void update(SiStripConfigDb::FedConnectionsV &, SiStripConfigDb::FedDescriptionsRange, SiStripConfigDb::DeviceDescriptionsRange, SiStripConfigDb::DcuDetIdsRange)
void uploadFedDescriptions(std::string partition="")
std::vector< FedConnection * > FedConnectionsV
const SiStripDbParams & dbParams() const
void addFedConnections(std::string partition, FedConnectionsV &)
DeviceDescriptionsRange getDeviceDescriptions(std::string partition="")
Log< level::Warning, false > LogWarning
DcuDetIdsRange getDcuDetIds(std::string partition="")
Definition: DcuDetIds.cc:10