Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:25:14

0001 
0002 #ifndef RECOLOCALTRACKER_SISTRIPZEROSUPPRESSION_SISTRIPITERATEDMEDIANCOMMONMODENOISESUBTRACTION_H
0003 #define RECOLOCALTRACKER_SISTRIPZEROSUPPRESSION_SISTRIPITERATEDMEDIANCOMMONMODENOISESUBTRACTION_H
0004 #include "RecoLocalTracker/SiStripZeroSuppression/interface/SiStripCommonModeNoiseSubtractor.h"
0005 
0006 #include "CondFormats/DataRecord/interface/SiStripNoisesRcd.h"
0007 #include "CalibTracker/Records/interface/SiStripQualityRcd.h"
0008 #include "FWCore/Framework/interface/ESWatcher.h"
0009 #include "FWCore/Framework/interface/ConsumesCollector.h"
0010 
0011 class SiStripNoises;
0012 class SiStripQuality;
0013 
0014 class IteratedMedianCMNSubtractor : public SiStripCommonModeNoiseSubtractor {
0015   friend class SiStripRawProcessingFactory;
0016 
0017 public:
0018   void init(const edm::EventSetup& es) override;
0019   void subtract(uint32_t detId, uint16_t firstAPV, std::vector<int16_t>& digis) override;
0020   void subtract(uint32_t detId, uint16_t firstAPV, std::vector<float>& digis) override;
0021 
0022 private:
0023   template <typename T>
0024   void subtract_(uint32_t detId, uint16_t firstAPV, std::vector<T>& digis);
0025   inline float pairMedian(std::vector<std::pair<float, float> >& sample);
0026 
0027   IteratedMedianCMNSubtractor(double sigma, int iterations, edm::ConsumesCollector iC)
0028       : cut_to_avoid_signal_(sigma),
0029         iterations_(iterations),
0030         noiseToken_(iC.esConsumes<SiStripNoises, SiStripNoisesRcd>()),
0031         qualityToken_(iC.esConsumes<SiStripQuality, SiStripQualityRcd>()){};
0032   double cut_to_avoid_signal_;
0033   int iterations_;
0034   edm::ESGetToken<SiStripNoises, SiStripNoisesRcd> noiseToken_;
0035   edm::ESGetToken<SiStripQuality, SiStripQualityRcd> qualityToken_;
0036   const SiStripNoises* noiseHandle;
0037   const SiStripQuality* qualityHandle;
0038   edm::ESWatcher<SiStripNoisesRcd> noiseWatcher_;
0039   edm::ESWatcher<SiStripQualityRcd> qualityWatcher_;
0040 };
0041 #endif