#include <CommonTools/SiStripZeroSuppression/interface/SiStripPedestalsSubtractor.h>
Public Member Functions | |
void | init (const edm::EventSetup &) |
SiStripPedestalsSubtractor () | |
void | subtract (const edm::DetSet< SiStripRawDigi > &, std::vector< int16_t > &) |
~SiStripPedestalsSubtractor () | |
Private Attributes | |
edm::ESHandle< SiStripPedestals > | pedestalsHandle |
std::vector< int > | peds_ |
Definition at line 16 of file SiStripPedestalsSubtractor.h.
SiStripPedestalsSubtractor::SiStripPedestalsSubtractor | ( | ) | [inline] |
SiStripPedestalsSubtractor::~SiStripPedestalsSubtractor | ( | ) | [inline] |
void SiStripPedestalsSubtractor::init | ( | const edm::EventSetup & | es | ) |
Definition at line 6 of file SiStripPedestalsSubtractor.cc.
References edm::EventSetup::get(), and pedestalsHandle.
Referenced by SiStripClusterInfo::rawdigi_algorithm(), and SiStripZeroSuppressionAlgorithm::run().
00006 { 00007 es.get<SiStripPedestalsRcd>().get(pedestalsHandle); 00008 }
void SiStripPedestalsSubtractor::subtract | ( | const edm::DetSet< SiStripRawDigi > & | input, | |
std::vector< int16_t > & | ssrd | |||
) |
Definition at line 11 of file SiStripPedestalsSubtractor.cc.
References edm::DetSet< T >::begin(), e, edm::DetSet< T >::end(), lat::endl(), edm::DetSet< T >::id, edm::isDebugEnabled(), iter, LogDebug, pedestalsHandle, peds_, edm::DetSet< T >::size(), and cms::Exception::what().
Referenced by SiStripClusterInfo::rawdigi_algorithm(), and SiStripZeroSuppressionAlgorithm::run().
00011 { 00012 00013 edm::DetSet<SiStripRawDigi>::const_iterator iter=input.begin(); 00014 std::vector<int16_t>::iterator iout=ssrd.begin(); 00015 SiStripPedestals::Range detPedRange = pedestalsHandle->getRange(input.id); 00016 00017 peds_.resize(input.size()); 00018 try{ 00019 pedestalsHandle->allPeds(peds_, detPedRange); 00020 } catch(cms::Exception& e){ 00021 //throw cms::Exception("CorruptedData") 00022 edm::LogError("SiStripPedestalsSubtractor") 00023 << "[SiStripPedestalsSubtractor::subtract] DetId " << input.id << " propagating error from SiStripPedestal" << e.what(); 00024 ssrd.clear(); 00025 } 00026 00027 std::vector<int>::const_iterator it_ped = peds_.begin(); 00028 for (;iter!=input.end(); ++iter, ++iout, ++it_ped) { 00029 00030 int ped = *it_ped; 00031 // uncomment to check bulk pedestal decoding 00032 //assert( ped == static_cast<int>(pedestalsHandle->getPed(it_ped - peds_.begin(), detPedRange)) ); 00033 00034 if(ped>895) ped -= 1024; 00035 *iout = iter->adc() - ped; 00036 00037 #ifdef DEBUG_SiStripZeroSuppression_ 00038 if (edm::isDebugEnabled()) 00039 LogDebug("SiStripPedestalsSubtractor") 00040 <<"[SiStripPedestalsSubtractor::subtract]: DetID " << input.id << " strip " << (it_ped - peds.begin()) << " adc before sub= " 00041 << iter->adc() 00042 << "\t pedval= " << pedestalsHandle->getPed(it_ped - peds.begin(),detPedRange) 00043 << "\t adc pedsub = " << ssrd[it_ped - peds.begin()] 00044 << std::endl; 00045 #endif 00046 } 00047 }
std::vector<int> SiStripPedestalsSubtractor::peds_ [private] |