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 #include <boost/bind.hpp>
9 
10 bool SiStripBaseDelay::put(const uint32_t detId, const uint16_t coarseDelay, const uint16_t fineDelay) {
11  delays_.push_back(Delay(detId, coarseDelay, fineDelay));
12  return true;
13 }
14 
15 uint16_t SiStripBaseDelay::coarseDelay(const uint32_t detId) {
16  delayConstIt it = std::find_if(delays_.begin(), delays_.end(), boost::bind(&Delay::detId, _1) == detId);
17  if (it != delays_.end()) {
18  return it->coarseDelay;
19  }
20  return 0;
21 }
22 
23 uint16_t SiStripBaseDelay::fineDelay(const uint32_t detId) const {
24  delayConstIt it = std::find_if(delays_.begin(), delays_.end(), boost::bind(&Delay::detId, _1) == detId);
25  if (it != delays_.end()) {
26  return it->fineDelay;
27  }
28  return 0;
29 }
30 
31 double SiStripBaseDelay::delay(const uint32_t detId) const {
32  delayConstIt it = std::find_if(delays_.begin(), delays_.end(), boost::bind(&Delay::detId, _1) == detId);
33  if (it != delays_.end()) {
34  return makeDelay(it->coarseDelay, it->fineDelay);
35  }
36  return 0;
37 }
38 
39 void SiStripBaseDelay::detIds(std::vector<uint32_t>& detIdVector) const {
40  std::vector<Delay>::const_iterator it = delays_.begin();
41  for (; it != delays_.end(); ++it) {
42  detIdVector.push_back(it->detId);
43  }
44 }
45 
46 void SiStripBaseDelay::printSummary(std::stringstream& ss, const TrackerTopology* trackerTopo) const {
47  ss << "Total number of delays = " << delays_.size() << std::endl;
48  SiStripDetSummary summaryDelays{trackerTopo};
49  delayConstIt it = delays_.begin();
50  for (; it != delays_.end(); ++it) {
51  summaryDelays.add(it->detId, makeDelay(it->coarseDelay, it->fineDelay));
52  }
53  ss << std::endl << "Summary:" << std::endl;
54  summaryDelays.print(ss);
55 }
56 
57 void SiStripBaseDelay::printDebug(std::stringstream& ss, const TrackerTopology* trackerTopo) const {
58  printSummary(ss, trackerTopo);
59  delayConstIt it = delays_.begin();
60  ss << std::endl << "All pedestal values:" << std::endl;
61  for (; it != delays_.end(); ++it) {
62  ss << "detId = " << it->detId << " delay = " << makeDelay(it->coarseDelay, it->fineDelay) << std::endl;
63  }
64 }
uint16_t coarseDelay(const uint32_t detId)
bool put(const uint32_t detId, const uint16_t coarseDelay, const uint16_t fineDelay)
std::vector< Delay >::const_iterator delayConstIt
void printSummary(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Prints the average value of the delays for all layers and wheels in the SiStripTracker.
double makeDelay(const uint16_t coarseDelay, const uint16_t fineDelay) const
void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Prints the delays for all the detIds.
double delay(const uint32_t detId) const
uint16_t fineDelay(const uint32_t detId) const
void detIds(std::vector< uint32_t > &detIdVector) const
Get the list of all detIds for which a delay is stored.
std::vector< Delay > delays_