CMS 3D CMS Logo

SummaryGeneratorReadoutView.cc
Go to the documentation of this file.
6 #include <iostream>
7 #include <iomanip>
8 #include <sstream>
9 #include <cmath>
10 
11 using namespace sistrip;
12 
13 // -----------------------------------------------------------------------------
14 //
16 
17 // -----------------------------------------------------------------------------
18 //
20  const sistrip::Granularity& granularity,
21  const uint32_t& device_key,
22  const float& value,
23  const float& error) {
24  // Check granularity is recognised
26 
27  if (granularity != sistrip::UNDEFINED_GRAN && granularity != sistrip::FE_DRIVER && granularity != sistrip::FE_UNIT &&
28  granularity != sistrip::FE_CHAN && granularity != sistrip::APV) {
30  edm::LogWarning(mlSummaryPlots_) << "[SummaryGeneratorReadoutView::" << __func__ << "]"
31  << " Unexpected granularity requested: " << gran;
32  return;
33  }
34 
35  // Create key representing "top level" directory
36  SiStripFedKey top(top_level_dir);
37 
38  // Path and std::string for "present working directory" as defined by device key
39  SiStripFedKey path(device_key);
40  const std::string& pwd = path.path();
41 
42  // Check path is "within" top-level directory structure
43  if (top.isValid() && path.isValid() && (path.fedId() == top.fedId() || !top.fedId()) &&
44  (path.feUnit() == top.feUnit() || !top.feUnit()) && (path.feChan() == top.feChan() || !top.feChan())) {
45  // Extract path and std::string corresponding to "top-level down to granularity"
46  std::string sub_dir = pwd;
47  size_t pos = pwd.find(gran);
48  if (pos != std::string::npos) {
49  sub_dir = pwd.substr(0, pwd.find(sistrip::dir_, pos));
50  } else if (granularity == sistrip::UNKNOWN_GRAN) {
51  sub_dir = pwd;
52  }
53 
54  SiStripFedKey sub_path(sub_dir);
55 
56  // LogTrace(mlTest_)
57  // << "TEST "
58  // << "sub_path " << sub_path;
59 
60  // Construct bin label
61  std::stringstream bin;
62  if (sub_path.fedId() && sub_path.fedId() != sistrip::invalid_) {
63  bin << std::setw(3) << std::setfill('0') << sub_path.fedId();
64  }
65  if (sub_path.feUnit() && sub_path.feUnit() != sistrip::invalid_) {
66  bin << sistrip::dir_ << std::setw(1) << std::setfill('0') << sub_path.feUnit();
67  }
68  if (sub_path.feChan() && sub_path.feChan() != sistrip::invalid_) {
69  bin << sistrip::dir_ << std::setw(2) << std::setfill('0') << sub_path.feChan();
70  }
71  if (sub_path.fedApv() && sub_path.fedApv() != sistrip::invalid_) {
72  bin << sistrip::dir_ << std::setw(1) << std::setfill('0') << sub_path.fedApv();
73  }
74  // if ( granularity == sistrip::APV &&
75  // path.fedApv() != sistrip::invalid_ ) { bin << sistrip::dot_ << path.fedApv(); }
76 
77  // Store "value" in appropriate std::vector within std::map (key is bin label)
78  map_[bin.str()].push_back(Data(value, error));
79  entries_ += value;
80  // LogTrace(mlTest_)
81  // << "TEST "
82  // << " filling " << bin.str()
83  // << " " << value
84  // << " " << error;
85 
86  } else {
87  // std::stringstream ss;
88  // ss << "[SummaryGeneratorReadoutView::" << __func__ << "]"
89  // << " Path for 'pwd' is not within top-level directory!" << std::endl
90  // << "Top-level: " << top << std::endl
91  // << "Path: " << path << std::endl;
92  // edm::LogWarning(mlSummaryPlots_) << ss.str();
93  }
94 }
sistrip::Granularity
Granularity
Definition: ConstantsForGranularity.h:60
MessageLogger.h
alignCSCRings.pwd
pwd
Definition: alignCSCRings.py:57
SiStripFedKey::isValid
bool isValid() const override
Definition: SiStripFedKey.cc:157
pos
Definition: PixelAliasList.h:18
SummaryGenerator::entries_
float entries_
Definition: SummaryGenerator.h:119
sistrip::dir_
static const char dir_[]
Definition: ConstantsForDqm.h:17
sistrip::FE_UNIT
Definition: ConstantsForGranularity.h:83
SiStripFedKey
A container class for generic run and event-related info, information required by the commissioning a...
Definition: SiStripFedKey.h:56
sistrip::UNKNOWN_GRAN
Definition: ConstantsForGranularity.h:62
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
relativeConstraints.error
error
Definition: relativeConstraints.py:53
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
SummaryGeneratorReadoutView.h
SummaryGenerator::Data
std::pair< float, float > Data
Definition: SummaryGenerator.h:27
SummaryGeneratorReadoutView::SummaryGeneratorReadoutView
SummaryGeneratorReadoutView()
Definition: SummaryGeneratorReadoutView.cc:15
SiStripEnumsAndStrings::granularity
static std::string granularity(const sistrip::Granularity &)
Definition: SiStripEnumsAndStrings.cc:265
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiStripConstants.h
SiStripFedKey.h
SiStripFedKey::fedApv
const uint16_t & fedApv() const
Definition: SiStripFedKey.h:191
sistrip::APV
Definition: ConstantsForGranularity.h:79
SiStripFedKey::feUnit
const uint16_t & feUnit() const
Definition: SiStripFedKey.h:189
SummaryGeneratorReadoutView::fill
void fill(const std::string &directory_level, const sistrip::Granularity &, const uint32_t &key, const float &value, const float &error) override
Definition: SummaryGeneratorReadoutView.cc:19
value
Definition: value.py:1
sistrip::invalid_
static const uint16_t invalid_
Definition: Constants.h:16
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
SummaryGenerator
: Fills summary histograms.
Definition: SummaryGenerator.h:19
sistrip::mlSummaryPlots_
static const char mlSummaryPlots_[]
Definition: ConstantsForLogger.h:26
relativeConstraints.value
value
Definition: relativeConstraints.py:53
SiStripEnumsAndStrings.h
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
sistrip::FE_DRIVER
Definition: ConstantsForGranularity.h:82
sistrip
sistrip classes
Definition: SiStripQualityHelpers.h:14
sistrip::UNDEFINED_GRAN
Definition: ConstantsForGranularity.h:61
sistrip::FE_CHAN
Definition: ConstantsForGranularity.h:84
SiStripFedKey::fedId
const uint16_t & fedId() const
Definition: SiStripFedKey.h:188
SiStripFedKey::feChan
const uint16_t & feChan() const
Definition: SiStripFedKey.h:190
SummaryGenerator::map_
HistoData map_
Definition: SummaryGenerator.h:117