File indexing completed on 2024-04-06 12:08:38
0001 #include "DQM/SiStripCommissioningSummary/interface/SummaryGeneratorControlView.h"
0002 #include "DataFormats/SiStripCommon/interface/SiStripEnumsAndStrings.h"
0003 #include "DataFormats/SiStripCommon/interface/SiStripConstants.h"
0004 #include "DataFormats/SiStripCommon/interface/SiStripFecKey.h"
0005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0006 #include <iostream>
0007 #include <iomanip>
0008 #include <sstream>
0009 #include <cmath>
0010
0011 using namespace sistrip;
0012
0013
0014
0015 SummaryGeneratorControlView::SummaryGeneratorControlView() : SummaryGenerator("SummaryGeneratorControlView") { ; }
0016
0017
0018
0019 void SummaryGeneratorControlView::fill(const std::string& top_level_dir,
0020 const sistrip::Granularity& granularity,
0021 const uint32_t& device_key,
0022 const float& value,
0023 const float& error) {
0024
0025 std::string gran = SiStripEnumsAndStrings::granularity(granularity);
0026
0027 if (granularity != sistrip::UNDEFINED_GRAN && granularity != sistrip::FEC_CRATE && granularity != sistrip::FEC_SLOT &&
0028 granularity != sistrip::FEC_RING && granularity != sistrip::CCU_ADDR && granularity != sistrip::CCU_CHAN &&
0029 granularity != sistrip::LLD_CHAN && granularity != sistrip::APV) {
0030 std::string temp = SiStripEnumsAndStrings::granularity(sistrip::LLD_CHAN);
0031 edm::LogWarning(mlSummaryPlots_) << "[SummaryGeneratorControlView::" << __func__ << "]"
0032 << " Unexpected granularity requested: " << gran;
0033 return;
0034 }
0035
0036
0037 SiStripFecKey top(top_level_dir);
0038
0039
0040 SiStripFecKey path(device_key);
0041 const std::string& pwd = path.path();
0042
0043
0044
0045
0046
0047
0048 if (top.isValid() && path.isValid() && (path.fecCrate() == top.fecCrate() || !top.fecCrate()) &&
0049 (path.fecSlot() == top.fecSlot() || !top.fecSlot()) && (path.fecRing() == top.fecRing() || !top.fecRing()) &&
0050 (path.ccuAddr() == top.ccuAddr() || !top.ccuAddr()) && (path.ccuChan() == top.ccuChan() || !top.ccuChan())) {
0051
0052 std::string sub_dir = pwd;
0053 size_t pos = pwd.find(gran);
0054 if (pos != std::string::npos) {
0055 sub_dir = pwd.substr(0, pwd.find(sistrip::dir_, pos));
0056 } else if (granularity == sistrip::UNKNOWN_GRAN) {
0057 sub_dir = pwd;
0058 }
0059
0060 SiStripFecKey sub_path(sub_dir);
0061
0062
0063
0064
0065
0066
0067 std::stringstream bin;
0068 if (sub_path.fecCrate() != sistrip::invalid_) {
0069 bin << std::setw(1) << std::setfill('0') << sub_path.fecCrate();
0070 }
0071 if (sub_path.fecSlot() != sistrip::invalid_) {
0072 bin << sistrip::dot_ << std::setw(2) << std::setfill('0') << sub_path.fecSlot();
0073 }
0074 if (sub_path.fecRing() != sistrip::invalid_) {
0075 bin << sistrip::dot_ << std::setw(1) << std::setfill('0') << sub_path.fecRing();
0076 }
0077 if (sub_path.ccuAddr() != sistrip::invalid_) {
0078 bin << sistrip::dot_ << std::setw(3) << std::setfill('0') << sub_path.ccuAddr();
0079 }
0080 if (sub_path.ccuChan() != sistrip::invalid_) {
0081 bin << sistrip::dot_ << std::setw(2) << std::setfill('0') << sub_path.ccuChan();
0082 }
0083 if ((granularity == sistrip::LLD_CHAN || granularity == sistrip::APV) && path.channel() != sistrip::invalid_) {
0084 bin << sistrip::dot_ << path.channel();
0085 }
0086
0087
0088 map_[bin.str()].push_back(Data(value, error));
0089 entries_++;
0090
0091
0092
0093 }
0094 }