#include <CommonTools/SiStripZeroSuppression/interface/SiStripFastLinearCommonModeNoiseSubtraction.h>
Public Member Functions | |
void | init (const edm::EventSetup &es) |
SiStripFastLinearCommonModeNoiseSubtraction () | |
void | subtract (const uint32_t &, std::vector< int16_t > &) |
~SiStripFastLinearCommonModeNoiseSubtraction () |
Definition at line 7 of file SiStripFastLinearCommonModeNoiseSubtraction.h.
SiStripFastLinearCommonModeNoiseSubtraction::SiStripFastLinearCommonModeNoiseSubtraction | ( | ) | [inline] |
SiStripFastLinearCommonModeNoiseSubtraction::~SiStripFastLinearCommonModeNoiseSubtraction | ( | ) | [inline] |
void SiStripFastLinearCommonModeNoiseSubtraction::init | ( | const edm::EventSetup & | es | ) | [inline, virtual] |
Implements SiStripCommonModeNoiseSubtractor.
Definition at line 13 of file SiStripFastLinearCommonModeNoiseSubtraction.h.
void SiStripFastLinearCommonModeNoiseSubtraction::subtract | ( | const uint32_t & | detId, | |
std::vector< int16_t > & | digis | |||
) | [virtual] |
Implements SiStripCommonModeNoiseSubtractor.
Definition at line 8 of file SiStripFastLinearCommonModeNoiseSubtraction.cc.
References lat::endl(), edm::isDebugEnabled(), LogDebug, ls, offset, s, slope, python::multivaluedict::sort(), ss, and strip().
00008 { 00009 #ifdef DEBUG_SiStripZeroSuppression_ 00010 LogDebug("SiStripZeroSuppression") << "[SiStripFastLinearCommonModeNoiseSubtraction::subtract] digis.size()= " << digis.size(); 00011 #endif 00012 00013 std::vector<int16_t> APVdiff; 00014 std::vector<int16_t> APVdigis; 00015 std::vector<int16_t>::iterator fs; 00016 std::vector<int16_t>::iterator ls; 00017 APVdiff.reserve(64); 00018 APVdigis.reserve(128); 00019 int nAPV = digis.size()/128; 00020 double slope; 00021 double offset; 00022 00023 #ifdef DEBUG_SiStripZeroSuppression_ 00024 LogDebug("SiStripZeroSuppression") << "[SiStripFastLinearCommonModeNoiseSubtraction::subtract] number of apvs: nAPV= " << nAPV; 00025 #endif 00026 00027 for (int iAPV=0; iAPV<nAPV; iAPV++){ 00028 APVdigis.clear(); 00029 fs = digis.begin()+iAPV*128; 00030 ls = digis.begin()+(iAPV+1)*128; 00031 APVdigis.insert(APVdigis.end(), fs, ls ); 00032 std::sort(APVdigis.begin(),APVdigis.end()); 00033 offset = (APVdigis[63]+APVdigis[64])/2.; 00034 00035 // Here we get the slope according to a proposal by D. Abbaneo 00036 // Details on https://abbaneo.web.cern.ch/abbaneo/cmode/cm.html 00037 APVdiff.clear(); 00038 for(int s=0;s<64;s++) 00039 APVdiff.push_back(digis[s+64+iAPV*128]-digis[s+iAPV*128]); 00040 std::sort(APVdiff.begin(),APVdiff.end()); 00041 slope = (APVdiff[31]+APVdiff[32])/2./64.; 00042 00043 #ifdef DEBUG_SiStripZeroSuppression_ 00044 std::stringstream ss; 00045 if (edm::isDebugEnabled()) 00046 ss << "[SiStripFastLinearCommonModeNoiseSubtraction::subtract] iApv= " <<iAPV << " slope= " << slope << " offset= " << offset << std::endl; 00047 #endif 00048 00049 int strip=1; 00050 while (fs < ls) { 00051 #ifdef DEBUG_SiStripZeroSuppression_ 00052 if (edm::isDebugEnabled()) 00053 ss << "[SiStripFastLinearCommonModeNoiseSubtraction::subtract] initial strip "<<strip<<": " << *fs << " - " << (offset+(strip-64)*slope); 00054 #endif 00055 *fs = (int16_t) (*fs-(offset+(strip-64)*slope)); 00056 #ifdef DEBUG_SiStripZeroSuppression_ 00057 ss << " ==>> adc CM subtr " << *fs << std::endl; 00058 #endif 00059 fs++; 00060 strip++; 00061 } 00062 #ifdef DEBUG_SiStripZeroSuppression_ 00063 LogDebug("SiStripZeroSuppression") << ss.str().c_str(); 00064 #endif 00065 }// end APV loop 00066 00067 }