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) {
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 }
uint16_t coarseDelay(const uint32_t detId)
double delay(const uint32_t detId) const
double makeDelay(const uint16_t coarseDelay, const uint16_t fineDelay) const
void detIds(std::vector< uint32_t > &detIdVector) const
Get the list of all detIds for which a delay is stored.
void printSummary(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Prints the average value of the delays for all layers and wheels in the SiStripTracker.
uint16_t fineDelay(const uint32_t detId) const
bool put(const uint32_t detId, const uint16_t coarseDelay, const uint16_t fineDelay)
std::vector< Delay >::const_iterator delayConstIt
void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Prints the delays for all the detIds.
std::vector< Delay > delays_