#include <SiStripPedestalsSubtractor.h>
Public Member Functions | |
void | init (const edm::EventSetup &) |
void | subtract (const edm::DetSet< SiStripRawDigi > &, std::vector< int16_t > &) |
void | subtract (const uint32_t &, const uint16_t &, std::vector< int16_t > &) |
Private Member Functions | |
const int16_t & | eval (const int16_t &in) |
const uint16_t & | eval (const SiStripRawDigi &in) |
SiStripPedestalsSubtractor (bool mode) | |
template<class input_t > | |
void | subtract_ (const uint32_t &, const uint16_t &, const input_t &, std::vector< int16_t > &) |
Private Attributes | |
bool | fedmode_ |
std::vector< int > | pedestals |
edm::ESHandle< SiStripPedestals > | pedestalsHandle |
uint32_t | peds_cache_id |
Friends | |
class | SiStripRawProcessingFactory |
Definition at line 12 of file SiStripPedestalsSubtractor.h.
SiStripPedestalsSubtractor::SiStripPedestalsSubtractor | ( | bool | mode | ) | [inline, private] |
Definition at line 24 of file SiStripPedestalsSubtractor.h.
: peds_cache_id(0), fedmode_(mode) {};
const int16_t& SiStripPedestalsSubtractor::eval | ( | const int16_t & | in | ) | [inline, private] |
Definition at line 31 of file SiStripPedestalsSubtractor.h.
References recoMuon::in.
Referenced by subtract_().
{ return in;}
const uint16_t& SiStripPedestalsSubtractor::eval | ( | const SiStripRawDigi & | in | ) | [inline, private] |
Definition at line 32 of file SiStripPedestalsSubtractor.h.
References SiStripRawDigi::adc().
{ return in.adc();}
void SiStripPedestalsSubtractor::init | ( | const edm::EventSetup & | es | ) |
Definition at line 6 of file SiStripPedestalsSubtractor.cc.
References edm::EventSetup::get(), pedestalsHandle, and peds_cache_id.
{ uint32_t p_cache_id = es.get<SiStripPedestalsRcd>().cacheIdentifier(); if(p_cache_id != peds_cache_id) { es.get<SiStripPedestalsRcd>().get(pedestalsHandle); peds_cache_id = p_cache_id; } }
void SiStripPedestalsSubtractor::subtract | ( | const uint32_t & | id, |
const uint16_t & | firstStrip, | ||
std::vector< int16_t > & | digis | ||
) |
Definition at line 14 of file SiStripPedestalsSubtractor.cc.
References subtract_().
{subtract_(id, firstStrip, digis, digis);}
void SiStripPedestalsSubtractor::subtract | ( | const edm::DetSet< SiStripRawDigi > & | input, |
std::vector< int16_t > & | output | ||
) |
Definition at line 15 of file SiStripPedestalsSubtractor.cc.
References edm::DetSet< T >::id, and subtract_().
void SiStripPedestalsSubtractor::subtract_ | ( | const uint32_t & | id, |
const uint16_t & | firstStrip, | ||
const input_t & | input, | ||
std::vector< int16_t > & | output | ||
) | [inline, private] |
Definition at line 20 of file SiStripPedestalsSubtractor.cc.
References eval(), fedmode_, pedestals, pedestalsHandle, and cms::Exception::what().
Referenced by subtract().
{ try { pedestals.resize(firstStrip + input.size()); SiStripPedestals::Range pedestalsRange = pedestalsHandle->getRange(id); pedestalsHandle->allPeds(pedestals, pedestalsRange); typename input_t::const_iterator inDigi = input.begin(); std::vector<int>::const_iterator ped = pedestals.begin() + firstStrip; std::vector<int16_t>::iterator outDigi = output.begin(); while( inDigi != input.end() ) { *outDigi = ( *ped > 895 ) ? eval(*inDigi) - *ped + 1024 : eval(*inDigi) - *ped; if(fedmode_ && *outDigi < 0) //FED bottoms out at 0 *outDigi=0; ++inDigi; ++ped; ++outDigi; } } catch(cms::Exception& e){ edm::LogError("SiStripPedestalsSubtractor") << "[SiStripPedestalsSubtractor::subtract] DetId " << id << " propagating error from SiStripPedestal" << e.what(); output.clear(); } }
friend class SiStripRawProcessingFactory [friend] |
Definition at line 14 of file SiStripPedestalsSubtractor.h.
bool SiStripPedestalsSubtractor::fedmode_ [private] |
Definition at line 28 of file SiStripPedestalsSubtractor.h.
Referenced by subtract_().
std::vector<int> SiStripPedestalsSubtractor::pedestals [private] |
Definition at line 26 of file SiStripPedestalsSubtractor.h.
Referenced by subtract_().
Definition at line 24 of file SiStripPedestalsSubtractor.h.
Referenced by init(), and subtract_().
uint32_t SiStripPedestalsSubtractor::peds_cache_id [private] |
Definition at line 27 of file SiStripPedestalsSubtractor.h.
Referenced by init().