File indexing completed on 2024-04-06 12:08:38
0001 #include "DQM/SiStripCommissioningSummary/interface/SummaryGeneratorReadoutView.h"
0002 #include "DataFormats/SiStripCommon/interface/SiStripEnumsAndStrings.h"
0003 #include "DataFormats/SiStripCommon/interface/SiStripConstants.h"
0004 #include "DataFormats/SiStripCommon/interface/SiStripFedKey.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 SummaryGeneratorReadoutView::SummaryGeneratorReadoutView() : SummaryGenerator("SummaryGeneratorReadoutView") { ; }
0016
0017
0018
0019 void SummaryGeneratorReadoutView::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::FE_DRIVER && granularity != sistrip::FE_UNIT &&
0028 granularity != sistrip::FE_CHAN && granularity != sistrip::APV) {
0029 std::string temp = SiStripEnumsAndStrings::granularity(sistrip::FE_CHAN);
0030 edm::LogWarning(mlSummaryPlots_) << "[SummaryGeneratorReadoutView::" << __func__ << "]"
0031 << " Unexpected granularity requested: " << gran;
0032 return;
0033 }
0034
0035
0036 SiStripFedKey top(top_level_dir);
0037
0038
0039 SiStripFedKey path(device_key);
0040 const std::string& pwd = path.path();
0041
0042
0043 if (top.isValid() && path.isValid() && (path.fedId() == top.fedId() || !top.fedId()) &&
0044 (path.feUnit() == top.feUnit() || !top.feUnit()) && (path.feChan() == top.feChan() || !top.feChan())) {
0045
0046 std::string sub_dir = pwd;
0047 size_t pos = pwd.find(gran);
0048 if (pos != std::string::npos) {
0049 sub_dir = pwd.substr(0, pwd.find(sistrip::dir_, pos));
0050 } else if (granularity == sistrip::UNKNOWN_GRAN) {
0051 sub_dir = pwd;
0052 }
0053
0054 SiStripFedKey sub_path(sub_dir);
0055
0056
0057
0058
0059
0060
0061 std::stringstream bin;
0062 if (sub_path.fedId() && sub_path.fedId() != sistrip::invalid_) {
0063 bin << std::setw(3) << std::setfill('0') << sub_path.fedId();
0064 }
0065 if (sub_path.feUnit() && sub_path.feUnit() != sistrip::invalid_) {
0066 bin << sistrip::dir_ << std::setw(1) << std::setfill('0') << sub_path.feUnit();
0067 }
0068 if (sub_path.feChan() && sub_path.feChan() != sistrip::invalid_) {
0069 bin << sistrip::dir_ << std::setw(2) << std::setfill('0') << sub_path.feChan();
0070 }
0071 if (sub_path.fedApv() && sub_path.fedApv() != sistrip::invalid_) {
0072 bin << sistrip::dir_ << std::setw(1) << std::setfill('0') << sub_path.fedApv();
0073 }
0074
0075
0076
0077
0078 map_[bin.str()].push_back(Data(value, error));
0079 entries_ += value;
0080
0081
0082
0083
0084
0085
0086 } else {
0087
0088
0089
0090
0091
0092
0093 }
0094 }