CMS 3D CMS Logo

SiStripMedianCommonModeNoiseSubtraction Class Reference

#include <CommonTools/SiStripZeroSuppression/interface/SiStripMedianCommonModeNoiseSubtraction.h>

Inheritance diagram for SiStripMedianCommonModeNoiseSubtraction:

SiStripCommonModeNoiseSubtractor

List of all members.

Public Member Functions

void init (const edm::EventSetup &es)
 SiStripMedianCommonModeNoiseSubtraction ()
void subtract (const uint32_t &, std::vector< int16_t > &)
 ~SiStripMedianCommonModeNoiseSubtraction ()


Detailed Description

Definition at line 7 of file SiStripMedianCommonModeNoiseSubtraction.h.


Constructor & Destructor Documentation

SiStripMedianCommonModeNoiseSubtraction::SiStripMedianCommonModeNoiseSubtraction (  )  [inline]

Definition at line 10 of file SiStripMedianCommonModeNoiseSubtraction.h.

00010 {};

SiStripMedianCommonModeNoiseSubtraction::~SiStripMedianCommonModeNoiseSubtraction (  )  [inline]

Definition at line 11 of file SiStripMedianCommonModeNoiseSubtraction.h.

00011 {};


Member Function Documentation

void SiStripMedianCommonModeNoiseSubtraction::init ( const edm::EventSetup es  )  [inline, virtual]

Implements SiStripCommonModeNoiseSubtractor.

Definition at line 13 of file SiStripMedianCommonModeNoiseSubtraction.h.

00013 {};

void SiStripMedianCommonModeNoiseSubtraction::subtract ( const uint32_t &  detId,
std::vector< int16_t > &  digis 
) [virtual]

Implements SiStripCommonModeNoiseSubtractor.

Definition at line 4 of file SiStripMedianCommonModeNoiseSubtraction.cc.

References lat::endl(), edm::isDebugEnabled(), LogDebug, ls, and ss.

00004                                                                                                      {
00005   
00006 #ifdef DEBUG_SiStripZeroSuppression_
00007   LogDebug("SiStripZeroSuppression") << "[SiStripMedianCommonModeNoiseSubtraction::subtract] digis.size()= " << digis.size();
00008 #endif
00009   std::vector<int16_t> APVdigis;
00010   std::vector<int16_t>::iterator fs;
00011   std::vector<int16_t>::iterator ls;
00012   float CM;
00013   APVdigis.reserve(128);
00014   int nAPV = digis.size()/128;
00015   std::vector<int16_t>::iterator mid = APVdigis.begin() + 64;
00016   
00017 #ifdef DEBUG_SiStripZeroSuppression_
00018   if (edm::isDebugEnabled())
00019     LogDebug("SiStripZeroSuppression") << "[SiStripMedianCommonModeNoiseSubtraction::subtract] DetId " << detId << " number of apvs: nAPV= " << nAPV;
00020 #endif
00021   for (int iAPV=0; iAPV<nAPV; iAPV++){
00022     APVdigis.clear(); //added verify
00023     fs = digis.begin()+iAPV*128;
00024     ls = digis.begin()+(iAPV+1)*128;
00025     APVdigis.insert(APVdigis.end(), fs, ls );
00026 
00028     // std::sort(APVdigis.begin(),APVdigis.end());
00029     // CM = (APVdigis[63]+APVdigis[64])/2.;
00033     std::nth_element(APVdigis.begin(), mid, APVdigis.end());
00034     std::vector<int16_t>::iterator i63 = std::max_element(APVdigis.begin(), mid);
00035     CM = (*mid + *i63)/2.;
00036 
00037 #ifdef DEBUG_SiStripZeroSuppression_
00038     std::stringstream ss;
00039     if (edm::isDebugEnabled())
00040       ss << "[SiStripMedianCommonModeNoiseSubtraction::subtract] DetId " << detId << " iApv= " <<iAPV << " CM= " << CM << std::endl;
00041 #endif    
00042 
00043     while (fs < ls) {
00044       *fs = (int16_t) (*fs-CM);
00045 #ifdef DEBUG_SiStripZeroSuppression_
00046       if (edm::isDebugEnabled())
00047         ss << "[SiStripMedianCommonModeNoiseSubtraction::subtract] DetId " << detId << " strip " << fs-digis.begin() << " adc CM subtr " << *fs << std::endl;
00048 #endif
00049       fs++;
00050     }
00051 #ifdef DEBUG_SiStripZeroSuppression_
00052     LogDebug("SiStripZeroSuppression") << ss.str().c_str();
00053 #endif
00054   }
00055 }


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:32:24 2009 for CMSSW by  doxygen 1.5.4