CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/CondFormats/SiStripObjects/src/SiStripBaseDelay.cc

Go to the documentation of this file.
00001 #include "CondFormats/SiStripObjects/interface/SiStripBaseDelay.h"
00002 
00003 #include <algorithm>
00004 #include <iterator>
00005 #include <iostream>
00006 #include <sstream>
00007 
00008 bool SiStripBaseDelay::put( const uint32_t detId, const uint16_t coarseDelay, const uint16_t fineDelay )
00009 {
00010   delays_.push_back(Delay(detId, coarseDelay, fineDelay));
00011   return true;
00012 }
00013 
00014 uint16_t SiStripBaseDelay::coarseDelay(const uint32_t detId)
00015 {
00016   delayConstIt it = std::find_if(delays_.begin(), delays_.end(), boost::bind(&Delay::detId, _1) == detId);
00017   if( it != delays_.end() ) {
00018     return it->coarseDelay;
00019   }
00020   return 0;
00021 }
00022 
00023 uint16_t SiStripBaseDelay::fineDelay(const uint32_t detId) const
00024 {
00025   delayConstIt it = std::find_if(delays_.begin(), delays_.end(), boost::bind(&Delay::detId, _1) == detId);
00026   if( it != delays_.end() ) {
00027     return it->fineDelay;
00028   }
00029   return 0;
00030 }
00031 
00032 double SiStripBaseDelay::delay(const uint32_t detId) const
00033 {
00034   delayConstIt it = std::find_if(delays_.begin(), delays_.end(), boost::bind(&Delay::detId, _1) == detId);
00035   if( it != delays_.end() ) {
00036     return makeDelay(it->coarseDelay, it->fineDelay);
00037   }
00038   return 0;
00039 }
00040 
00041 void SiStripBaseDelay::detIds(std::vector<uint32_t> & detIdVector) const
00042 {
00043   std::vector<Delay>::const_iterator it = delays_.begin();
00044   for( ; it != delays_.end(); ++it ) {
00045     detIdVector.push_back(it->detId);
00046   }
00047 }
00048 
00049 void SiStripBaseDelay::printSummary(std::stringstream & ss) const
00050 {
00051   ss << "Total number of delays = " << delays_.size() << std::endl;
00052   SiStripDetSummary summaryDelays;
00053   delayConstIt it = delays_.begin();
00054   for( ; it != delays_.end(); ++it ) {
00055     summaryDelays.add(it->detId, makeDelay(it->coarseDelay, it->fineDelay));
00056   }
00057   ss << std::endl << "Summary:" << std::endl;
00058   summaryDelays.print(ss);
00059 }
00060 
00061 void SiStripBaseDelay::printDebug(std::stringstream & ss) const
00062 {
00063   printSummary(ss);
00064   delayConstIt it = delays_.begin();
00065   ss << std::endl << "All pedestal values:" << std::endl;
00066   for( ; it != delays_.end(); ++it ) {
00067     ss << "detId = " << it->detId << " delay = " << makeDelay(it->coarseDelay, it->fineDelay) << std::endl;
00068   }
00069 }