CMS 3D CMS Logo

SiStripBaseDelay.cc
Go to the documentation of this file.
2 
3 #include <algorithm>
4 #include <iterator>
5 #include <iostream>
6 #include <sstream>
7 
8 bool SiStripBaseDelay::put(const uint32_t detId, const uint16_t coarseDelay, const uint16_t fineDelay) {
9  delays_.push_back(Delay(detId, coarseDelay, fineDelay));
10  return true;
11 }
12 
13 uint16_t SiStripBaseDelay::coarseDelay(const uint32_t detId) {
14  delayConstIt it = std::find_if(delays_.begin(), delays_.end(), [&](auto& x) { return x.detId == detId; });
15  if (it != delays_.end()) {
16  return it->coarseDelay;
17  }
18  return 0;
19 }
20 
21 uint16_t SiStripBaseDelay::fineDelay(const uint32_t detId) const {
22  delayConstIt it = std::find_if(delays_.begin(), delays_.end(), [&](auto& x) { return x.detId == detId; });
23  if (it != delays_.end()) {
24  return it->fineDelay;
25  }
26  return 0;
27 }
28 
29 double SiStripBaseDelay::delay(const uint32_t detId) const {
30  delayConstIt it = std::find_if(delays_.begin(), delays_.end(), [&](auto& x) { return x.detId == detId; });
31  if (it != delays_.end()) {
32  return makeDelay(it->coarseDelay, it->fineDelay);
33  }
34  return 0;
35 }
36 
37 void SiStripBaseDelay::detIds(std::vector<uint32_t>& detIdVector) const {
38  std::vector<Delay>::const_iterator it = delays_.begin();
39  for (; it != delays_.end(); ++it) {
40  detIdVector.push_back(it->detId);
41  }
42 }
43 
44 void SiStripBaseDelay::printSummary(std::stringstream& ss, const TrackerTopology* trackerTopo) const {
45  ss << "Total number of delays = " << delays_.size() << std::endl;
46  SiStripDetSummary summaryDelays{trackerTopo};
47  delayConstIt it = delays_.begin();
48  for (; it != delays_.end(); ++it) {
49  summaryDelays.add(it->detId, makeDelay(it->coarseDelay, it->fineDelay));
50  }
51  ss << std::endl << "Summary:" << std::endl;
52  summaryDelays.print(ss);
53 }
54 
55 void SiStripBaseDelay::printDebug(std::stringstream& ss, const TrackerTopology* trackerTopo) const {
56  printSummary(ss, trackerTopo);
57  delayConstIt it = delays_.begin();
58  ss << std::endl << "All pedestal values:" << std::endl;
59  for (; it != delays_.end(); ++it) {
60  ss << "detId = " << it->detId << " delay = " << makeDelay(it->coarseDelay, it->fineDelay) << std::endl;
61  }
62 }
TrackerTopology
Definition: TrackerTopology.h:16
DDAxes::x
SiStripBaseDelay::coarseDelay
uint16_t coarseDelay(const uint32_t detId)
Definition: SiStripBaseDelay.cc:13
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
SiStripBaseDelay::makeDelay
double makeDelay(const uint16_t coarseDelay, const uint16_t fineDelay) const
Definition: SiStripBaseDelay.h:62
SiStripBaseDelay.h
SiStripBaseDelay::delays_
std::vector< Delay > delays_
Definition: SiStripBaseDelay.h:66
SiStripBaseDelay::delayConstIt
std::vector< Delay >::const_iterator delayConstIt
Definition: SiStripBaseDelay.h:40
SiStripBaseDelay::fineDelay
uint16_t fineDelay(const uint32_t detId) const
Definition: SiStripBaseDelay.cc:21
SiStripBaseDelay::delay
double delay(const uint32_t detId) const
Definition: SiStripBaseDelay.cc:29
SiStripBaseDelay::detIds
void detIds(std::vector< uint32_t > &detIdVector) const
Get the list of all detIds for which a delay is stored.
Definition: SiStripBaseDelay.cc:37
SiStripBaseDelay::put
bool put(const uint32_t detId, const uint16_t coarseDelay, const uint16_t fineDelay)
Definition: SiStripBaseDelay.cc:8
SiStripBaseDelay::printDebug
void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Prints the delays for all the detIds.
Definition: SiStripBaseDelay.cc:55
SiStripDetSummary
Definition: SiStripDetSummary.h:28
SiStripBaseDelay::printSummary
void printSummary(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Prints the average value of the delays for all layers and wheels in the SiStripTracker.
Definition: SiStripBaseDelay.cc:44
SiStripBaseDelay::Delay
Definition: SiStripBaseDelay.h:28