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 {
12  delays_.push_back(Delay(detId, coarseDelay, fineDelay));
13  return true;
14 }
15 
16 uint16_t SiStripBaseDelay::coarseDelay(const uint32_t detId)
17 {
18  delayConstIt it = std::find_if(delays_.begin(), delays_.end(), boost::bind(&Delay::detId, _1) == detId);
19  if( it != delays_.end() ) {
20  return it->coarseDelay;
21  }
22  return 0;
23 }
24 
25 uint16_t SiStripBaseDelay::fineDelay(const uint32_t detId) const
26 {
27  delayConstIt it = std::find_if(delays_.begin(), delays_.end(), boost::bind(&Delay::detId, _1) == detId);
28  if( it != delays_.end() ) {
29  return it->fineDelay;
30  }
31  return 0;
32 }
33 
34 double SiStripBaseDelay::delay(const uint32_t detId) const
35 {
36  delayConstIt it = std::find_if(delays_.begin(), delays_.end(), boost::bind(&Delay::detId, _1) == detId);
37  if( it != delays_.end() ) {
38  return makeDelay(it->coarseDelay, it->fineDelay);
39  }
40  return 0;
41 }
42 
43 void SiStripBaseDelay::detIds(std::vector<uint32_t> & detIdVector) const
44 {
45  std::vector<Delay>::const_iterator it = delays_.begin();
46  for( ; it != delays_.end(); ++it ) {
47  detIdVector.push_back(it->detId);
48  }
49 }
50 
51 void SiStripBaseDelay::printSummary(std::stringstream & ss, const TrackerTopology* trackerTopo) const
52 {
53  ss << "Total number of delays = " << delays_.size() << std::endl;
54  SiStripDetSummary summaryDelays{trackerTopo};
55  delayConstIt it = delays_.begin();
56  for( ; it != delays_.end(); ++it ) {
57  summaryDelays.add(it->detId, makeDelay(it->coarseDelay, it->fineDelay));
58  }
59  ss << std::endl << "Summary:" << std::endl;
60  summaryDelays.print(ss);
61 }
62 
63 void SiStripBaseDelay::printDebug(std::stringstream & ss, const TrackerTopology* trackerTopo) const
64 {
65  printSummary(ss, trackerTopo);
66  delayConstIt it = delays_.begin();
67  ss << std::endl << "All pedestal values:" << std::endl;
68  for( ; it != delays_.end(); ++it ) {
69  ss << "detId = " << it->detId << " delay = " << makeDelay(it->coarseDelay, it->fineDelay) << std::endl;
70  }
71 }
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_