CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes | Friends

TT6CMNSubtractor Class Reference

#include <TT6CMNSubtractor.h>

Inheritance diagram for TT6CMNSubtractor:
SiStripCommonModeNoiseSubtractor

List of all members.

Public Member Functions

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

Private Member Functions

template<typename T >
void subtract_ (const uint32_t &, const uint16_t &, std::vector< T > &)
 TT6CMNSubtractor (double in)

Private Attributes

double cut_to_avoid_signal_
uint32_t noise_cache_id
edm::ESHandle< SiStripNoisesnoiseHandle
uint32_t quality_cache_id
edm::ESHandle< SiStripQualityqualityHandle

Friends

class SiStripRawProcessingFactory

Detailed Description

Definition at line 9 of file TT6CMNSubtractor.h.


Constructor & Destructor Documentation

TT6CMNSubtractor::TT6CMNSubtractor ( double  in) [inline, private]

Definition at line 23 of file TT6CMNSubtractor.h.


Member Function Documentation

void TT6CMNSubtractor::init ( const edm::EventSetup es) [virtual]

Reimplemented from SiStripCommonModeNoiseSubtractor.

Definition at line 9 of file TT6CMNSubtractor.cc.

References edm::EventSetup::get(), noise_cache_id, noiseHandle, quality_cache_id, and qualityHandle.

                                                  {
  uint32_t n_cache_id = es.get<SiStripNoisesRcd>().cacheIdentifier();
  uint32_t q_cache_id = es.get<SiStripQualityRcd>().cacheIdentifier();

  if(n_cache_id != noise_cache_id) {
    es.get<SiStripNoisesRcd>().get( noiseHandle );
    noise_cache_id = n_cache_id;
  }
  if(q_cache_id != quality_cache_id) {
    es.get<SiStripQualityRcd>().get( qualityHandle );
    quality_cache_id = q_cache_id;
  }
}
void TT6CMNSubtractor::subtract ( const uint32_t &  detId,
const uint16_t &  firstAPV,
std::vector< int16_t > &  digis 
) [virtual]

Implements SiStripCommonModeNoiseSubtractor.

Definition at line 23 of file TT6CMNSubtractor.cc.

References subtract_().

{ subtract_(detId, firstAPV, digis);}
void TT6CMNSubtractor::subtract ( const uint32_t &  detId,
const uint16_t &  firstAPV,
std::vector< float > &  digis 
) [virtual]

Implements SiStripCommonModeNoiseSubtractor.

Definition at line 24 of file TT6CMNSubtractor.cc.

References subtract_().

{ subtract_(detId,firstAPV, digis);}
template<typename T >
void TT6CMNSubtractor::subtract_ ( const uint32_t &  detId,
const uint16_t &  firstAPV,
std::vector< T > &  digis 
) [inline, private]

Definition at line 29 of file TT6CMNSubtractor.cc.

References cut_to_avoid_signal_, python::rootplot::utilities::ls(), noiseHandle, and qualityHandle.

Referenced by subtract().

                                                                              {

  short FixedBias=128;
  SiStripNoises::Range detNoiseRange = noiseHandle->getRange(detId);
  SiStripQuality::Range detQualityRange = qualityHandle->getRange(detId);

  typename std::vector<T>::iterator fs,ls;
  double sumVal = 0.0;
  double sumWt =  0.0;
  
  for (uint16_t istrip=0; istrip<digis.size(); ++istrip){

    if ( !qualityHandle->IsStripBad(detQualityRange,istrip+firstAPV*128) ) {
      float stripNoise=noiseHandle->getNoiseFast(istrip+firstAPV*128,detNoiseRange);

      if( fabs(digis[istrip]-FixedBias) < cut_to_avoid_signal_*stripNoise ) { 
        double nWeight = 1/(stripNoise*stripNoise);
        sumVal += (digis[istrip]-FixedBias)*nWeight;
        sumWt += nWeight;
      }
    }

    if (istrip%128 == 127){
      double CM = (sumWt) ? sumVal/sumWt :0.0;
      
      fs = digis.begin()+istrip-127;
      ls = digis.begin()+istrip+1;
      
      while (fs < ls) {
        *fs = static_cast<T>(*fs-FixedBias-CM);
        fs++;
      }

      sumVal = 0.0;
      sumWt =  0.0;
    }
  }
}

Friends And Related Function Documentation

friend class SiStripRawProcessingFactory [friend]

Reimplemented from SiStripCommonModeNoiseSubtractor.

Definition at line 11 of file TT6CMNSubtractor.h.


Member Data Documentation

Definition at line 26 of file TT6CMNSubtractor.h.

Referenced by subtract_().

Definition at line 30 of file TT6CMNSubtractor.h.

Referenced by init().

Definition at line 28 of file TT6CMNSubtractor.h.

Referenced by init(), and subtract_().

Definition at line 30 of file TT6CMNSubtractor.h.

Referenced by init().

Definition at line 29 of file TT6CMNSubtractor.h.

Referenced by init(), and subtract_().