CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
VpspScanTask.cc
Go to the documentation of this file.
7 #include <algorithm>
8 
9 using namespace sistrip;
10 
11 // -----------------------------------------------------------------------------
12 //
14  : CommissioningTask(dqm, conn, "VpspScanTask"), vpsp_() {}
15 
16 // -----------------------------------------------------------------------------
17 //
19 
20 // -----------------------------------------------------------------------------
21 //
23  uint16_t nbins = 60;
24 
26 
27  vpsp_.resize(2);
28  for (uint16_t iapv = 0; iapv < 2; iapv++) {
29  if (connection().i2cAddr(iapv)) {
30  std::stringstream extra_info;
31  extra_info << sistrip::apv_ << iapv;
32 
36  fedKey(),
38  connection().lldChannel(),
39  extra_info.str())
40  .title();
41 
42  vpsp_[iapv].histo(dqm()->bookProfile(title, title, nbins, -0.5, nbins * 1. - 0.5, 1025, 0., 1025.));
43 
44  vpsp_[iapv].vNumOfEntries_.resize(nbins, 0);
45  vpsp_[iapv].vSumOfContents_.resize(nbins, 0);
46  vpsp_[iapv].vSumOfSquares_.resize(nbins, 0);
47  }
48  }
49 }
50 
51 // -----------------------------------------------------------------------------
52 //
54  // Retrieve VPSP setting and CCU channel
55  uint32_t vpsp = summary.vpsp();
56  uint32_t ccu_chan = summary.vpspCcuChan();
57 
58  // Check CCU channel from EventSummary is consistent with this module
59  if (SiStripFecKey(fecKey()).ccuChan() != ccu_chan) {
60  return;
61  }
62 
63  if (digis.data.size() != 256) {
64  edm::LogWarning(mlDqmSource_) << "[VpspScanTask::" << __func__ << "]"
65  << " Unexpected number of digis! " << digis.data.size();
66  return;
67  }
68 
69  // Fill histo with baseline(calc'ed from median value of data)
70  for (uint16_t iapv = 0; iapv < 2; iapv++) {
71  if (vpsp >= vpsp_[iapv].vNumOfEntries_.size()) {
72  edm::LogWarning(mlDqmSource_) << "[VpspScanTask::" << __func__ << "]"
73  << " Unexpected VPSP value! " << vpsp;
74  return;
75  }
76 
77  std::vector<uint16_t> baseline;
78  baseline.reserve(128);
79  for (uint16_t idigi = 128 * iapv; idigi < 128 * (iapv + 1); idigi++) {
80  baseline.push_back(digis.data[idigi].adc());
81  }
82  sort(baseline.begin(), baseline.end());
83  uint16_t index = baseline.size() % 2 ? baseline.size() / 2 : baseline.size() / 2 - 1;
84 
85  if (!baseline.empty()) {
86  updateHistoSet(vpsp_[iapv], vpsp, baseline[index]);
87  }
88  }
89 }
90 
91 // -----------------------------------------------------------------------------
92 //
94  for (uint32_t iapv = 0; iapv < vpsp_.size(); iapv++) {
95  updateHistoSet(vpsp_[iapv]);
96  }
97 }
~VpspScanTask() override
Definition: VpspScanTask.cc:18
Utility class that holds histogram title.
std::vector< HistoSet > vpsp_
Definition: VpspScanTask.h:19
static const char mlDqmSource_[]
void fill(const SiStripEventSummary &, const edm::DetSet< SiStripRawDigi > &) override
Definition: VpspScanTask.cc:53
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
void updateHistoSet(HistoSet &, const uint32_t &bin, const float &value)
DQMStore *const dqm() const
Class containning control, module, detector and connection information, at the level of a FED channel...
void book() override
Definition: VpspScanTask.cc:22
static const char apv_[]
const uint32_t & vpspCcuChan() const
VpspScanTask(DQMStore *, const FedChannelConnection &)
Definition: VpspScanTask.cc:13
collection_type data
Definition: DetSet.h:80
tuple conn
Definition: getInfo.py:9
const uint32_t & fedKey() const
const FedChannelConnection & connection() const
Log< level::Warning, false > LogWarning
void update() override
Definition: VpspScanTask.cc:93
const uint32_t & vpsp() const
const uint32_t & fecKey() const