Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:08:36

0001 #include "DQM/SiStripCommissioningSources/interface/FedCablingTask.h"
0002 #include "DataFormats/SiStripCommon/interface/SiStripConstants.h"
0003 #include "DataFormats/SiStripCommon/interface/SiStripHistoTitle.h"
0004 #include "DQMServices/Core/interface/DQMStore.h"
0005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0006 #include <algorithm>
0007 #include <sstream>
0008 #include <iomanip>
0009 
0010 using namespace sistrip;
0011 
0012 // -----------------------------------------------------------------------------
0013 //
0014 FedCablingTask::FedCablingTask(DQMStore* dqm, const FedChannelConnection& conn)
0015     : CommissioningTask(dqm, conn, "FedCablingTask"), histos_() {}
0016 
0017 // -----------------------------------------------------------------------------
0018 //
0019 FedCablingTask::~FedCablingTask() {}
0020 
0021 // -----------------------------------------------------------------------------
0022 //
0023 void FedCablingTask::book() {
0024   histos_.resize(2);
0025 
0026   std::string title;
0027   uint16_t nbins = 0;
0028   std::string extra_info = "";
0029   for (uint16_t iter = 0; iter < 2; iter++) {
0030     // Define number of histo bins and title
0031     if (iter == 0) {
0032       nbins = 1024;
0033       extra_info = sistrip::feDriver_;
0034     } else if (iter == 1) {
0035       nbins = 96;
0036       extra_info = sistrip::fedChannel_;
0037     } else {
0038       edm::LogWarning(mlDqmSource_) << "[FedCablingTask::" << __func__ << "]"
0039                                     << " Unexpected number of HistoSets: " << iter;
0040     }
0041 
0042     title = SiStripHistoTitle(sistrip::EXPERT_HISTO,
0043                               sistrip::FED_CABLING,
0044                               sistrip::FED_KEY,
0045                               fedKey(),
0046                               sistrip::LLD_CHAN,
0047                               connection().lldChannel(),
0048                               extra_info)
0049                 .title();
0050 
0051     histos_[iter].histo(dqm()->bookProfile(title, title, nbins, -0.5, nbins * 1. - 0.5, 1025, 0., 1025.));
0052 
0053     histos_[iter].vNumOfEntries_.resize(nbins, 0);
0054     histos_[iter].vSumOfContents_.resize(nbins, 0);
0055     histos_[iter].vSumOfSquares_.resize(nbins, 0);
0056   }
0057 }
0058 
0059 // -----------------------------------------------------------------------------
0060 //
0061 void FedCablingTask::fill(const SiStripEventSummary& summary,
0062                           const uint16_t& fed_id,
0063                           const std::map<uint16_t, float>& fed_ch) {
0064   if (fed_ch.empty()) {
0065     edm::LogWarning(mlDqmSource_) << "[FedCablingTask::" << __func__ << "]"
0066                                   << " No FED channels with high signal!";
0067     return;
0068   } else {
0069     LogTrace(mlDqmSource_) << "[FedCablingTask::" << __func__ << "]"
0070                            << " Found " << fed_ch.size() << " FED channels with high signal!";
0071   }
0072 
0073   std::map<uint16_t, float>::const_iterator ichan = fed_ch.begin();
0074   for (; ichan != fed_ch.end(); ichan++) {
0075     updateHistoSet(histos_[0], fed_id, ichan->second);
0076     updateHistoSet(histos_[1], ichan->first, ichan->second);
0077   }
0078 }
0079 
0080 // -----------------------------------------------------------------------------
0081 //
0082 void FedCablingTask::update() {
0083   for (uint32_t iter = 0; iter < histos_.size(); iter++) {
0084     updateHistoSet(histos_[iter]);
0085   }
0086 }