CMS 3D CMS Logo

SummaryGeneratorControlView.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 //
21  const uint32_t& device_key,
22  const float& value,
23  const float& error) {
24  // Check granularity is recognised
26 
31  edm::LogWarning(mlSummaryPlots_) << "[SummaryGeneratorControlView::" << __func__ << "]"
32  << " Unexpected granularity requested: " << gran;
33  return;
34  }
35 
36  // Create key representing "top level" directory
37  SiStripFecKey top(top_level_dir);
38 
39  // Path and std::string for "present working directory" as defined by device key
40  SiStripFecKey path(device_key);
41  const std::string& pwd = path.path();
42 
43  // LogTrace(mlTest_)
44  // << "TEST "
45  // << "top " << top
46  // << "path " << path;
47 
48  if (top.isValid() && path.isValid() && (path.fecCrate() == top.fecCrate() || !top.fecCrate()) &&
49  (path.fecSlot() == top.fecSlot() || !top.fecSlot()) && (path.fecRing() == top.fecRing() || !top.fecRing()) &&
50  (path.ccuAddr() == top.ccuAddr() || !top.ccuAddr()) && (path.ccuChan() == top.ccuChan() || !top.ccuChan())) {
51  // Extract path and std::string corresponding to "top-level down to granularity"
52  std::string sub_dir = pwd;
53  size_t pos = pwd.find(gran);
54  if (pos != std::string::npos) {
55  sub_dir = pwd.substr(0, pwd.find(sistrip::dir_, pos));
56  } else if (granularity == sistrip::UNKNOWN_GRAN) {
57  sub_dir = pwd;
58  }
59 
60  SiStripFecKey sub_path(sub_dir);
61 
62  // LogTrace(mlTest_)
63  // << "TEST "
64  // << "sub_path " << sub_path;
65 
66  // Construct bin label
67  std::stringstream bin;
68  if (sub_path.fecCrate() != sistrip::invalid_) {
69  bin << std::setw(1) << std::setfill('0') << sub_path.fecCrate();
70  }
71  if (sub_path.fecSlot() != sistrip::invalid_) {
72  bin << sistrip::dot_ << std::setw(2) << std::setfill('0') << sub_path.fecSlot();
73  }
74  if (sub_path.fecRing() != sistrip::invalid_) {
75  bin << sistrip::dot_ << std::setw(1) << std::setfill('0') << sub_path.fecRing();
76  }
77  if (sub_path.ccuAddr() != sistrip::invalid_) {
78  bin << sistrip::dot_ << std::setw(3) << std::setfill('0') << sub_path.ccuAddr();
79  }
80  if (sub_path.ccuChan() != sistrip::invalid_) {
81  bin << sistrip::dot_ << std::setw(2) << std::setfill('0') << sub_path.ccuChan();
82  }
84  bin << sistrip::dot_ << path.channel();
85  }
86 
87  // Store "value" in appropriate std::vector within std::map (key is bin label)
88  map_[bin.str()].push_back(Data(value, error));
89  entries_++;
90  // LogTrace(mlTest_)
91  // << "TEST "
92  // << " filling " << bin.str() << " " << value << " " << error << " ";
93  }
94 }
static const char dot_[]
void fill(const std::string &directory_level, const sistrip::Granularity &, const uint32_t &key, const float &value, const float &error) override
const uint16_t & ccuAddr() const
static const char dir_[]
const uint16_t & ccuChan() const
static std::string granularity(const sistrip::Granularity &)
: Fills summary histograms.
sistrip classes
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
Definition: value.py:1
static const char mlSummaryPlots_[]
bool isValid() const override
std::pair< float, float > Data
static const uint16_t invalid_
Definition: Constants.h:16
const uint16_t & fecSlot() const
Log< level::Warning, false > LogWarning
const uint16_t & fecRing() const
const uint16_t & fecCrate() const