CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 {
10  delays_.push_back(Delay(detId, coarseDelay, fineDelay));
11  return true;
12 }
13 
14 uint16_t SiStripBaseDelay::coarseDelay(const uint32_t detId)
15 {
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 {
25  delayConstIt it = std::find_if(delays_.begin(), delays_.end(), boost::bind(&Delay::detId, _1) == detId);
26  if( it != delays_.end() ) {
27  return it->fineDelay;
28  }
29  return 0;
30 }
31 
32 double SiStripBaseDelay::delay(const uint32_t detId) const
33 {
34  delayConstIt it = std::find_if(delays_.begin(), delays_.end(), boost::bind(&Delay::detId, _1) == detId);
35  if( it != delays_.end() ) {
36  return makeDelay(it->coarseDelay, it->fineDelay);
37  }
38  return 0;
39 }
40 
41 void SiStripBaseDelay::detIds(std::vector<uint32_t> & detIdVector) const
42 {
43  std::vector<Delay>::const_iterator it = delays_.begin();
44  for( ; it != delays_.end(); ++it ) {
45  detIdVector.push_back(it->detId);
46  }
47 }
48 
49 void SiStripBaseDelay::printSummary(std::stringstream & ss) const
50 {
51  ss << "Total number of delays = " << delays_.size() << std::endl;
52  SiStripDetSummary summaryDelays;
53  delayConstIt it = delays_.begin();
54  for( ; it != delays_.end(); ++it ) {
55  summaryDelays.add(it->detId, makeDelay(it->coarseDelay, it->fineDelay));
56  }
57  ss << std::endl << "Summary:" << std::endl;
58  summaryDelays.print(ss);
59 }
60 
61 void SiStripBaseDelay::printDebug(std::stringstream & ss) const
62 {
63  printSummary(ss);
64  delayConstIt it = delays_.begin();
65  ss << std::endl << "All pedestal values:" << std::endl;
66  for( ; it != delays_.end(); ++it ) {
67  ss << "detId = " << it->detId << " delay = " << makeDelay(it->coarseDelay, it->fineDelay) << std::endl;
68  }
69 }
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
double makeDelay(const uint16_t coarseDelay, const uint16_t fineDelay) const
void printSummary(std::stringstream &ss) const
Prints the average value of the delays for all layers and wheels in the SiStripTracker.
double delay(const uint32_t detId) const
void print(std::stringstream &ss, const bool mean=true) const
void printDebug(std::stringstream &ss) const
Prints the delays for all the detIds.
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_
void add(const DetId &detid, const float &value)
Used to compute the mean value of the value variable divided by subdetector, layer and mono/stereo...