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 }
TrackerTopology
Definition: TrackerTopology.h:16
SiStripBaseDelay::coarseDelay
uint16_t coarseDelay(const uint32_t detId)
Definition: SiStripBaseDelay.cc:15
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
SiStripBaseDelay::makeDelay
double makeDelay(const uint16_t coarseDelay, const uint16_t fineDelay) const
Definition: SiStripBaseDelay.h:63
SiStripBaseDelay::Delay::detId
uint32_t detId
Definition: SiStripBaseDelay.h:34
SiStripBaseDelay.h
SiStripBaseDelay::delays_
std::vector< Delay > delays_
Definition: SiStripBaseDelay.h:67
SiStripBaseDelay::delayConstIt
std::vector< Delay >::const_iterator delayConstIt
Definition: SiStripBaseDelay.h:41
SiStripBaseDelay::fineDelay
uint16_t fineDelay(const uint32_t detId) const
Definition: SiStripBaseDelay.cc:23
SiStripBaseDelay::delay
double delay(const uint32_t detId) const
Definition: SiStripBaseDelay.cc:31
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:39
SiStripBaseDelay::put
bool put(const uint32_t detId, const uint16_t coarseDelay, const uint16_t fineDelay)
Definition: SiStripBaseDelay.cc:10
SiStripBaseDelay::printDebug
void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Prints the delays for all the detIds.
Definition: SiStripBaseDelay.cc:57
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:46
SiStripBaseDelay::Delay
Definition: SiStripBaseDelay.h:29