CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/RecoLocalTracker/SiStripZeroSuppression/interface/SiStripFedZeroSuppression.h

Go to the documentation of this file.
00001 #ifndef RECOLOCALTRACKER_SISTRIPZEROSUPPRESSION_SISTRIPZEROSUPPRESSOR_H
00002 #define RECOLOCALTRACKER_SISTRIPZEROSUPPRESSION_SISTRIPZEROSUPPRESSOR_H
00003 
00004 #include "DataFormats/Common/interface/DetSetVector.h"
00005 #include "DataFormats/SiStripDigi/interface/SiStripDigi.h"
00006 #include "DataFormats/SiStripDigi/interface/SiStripRawDigi.h"
00007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00008 
00009 #include "FWCore/Framework/interface/EventSetup.h"
00010 #include "FWCore/Framework/interface/ESHandle.h"
00011 
00012 #include <vector>
00013 class SiStripNoises;
00014 class SiStripThreshold;
00015 
00016 
00017 class SiStripFedZeroSuppression {
00018   
00019   friend class SiStripRawProcessingFactory;
00020   
00021  public:
00022   
00023   SiStripFedZeroSuppression(uint16_t fedalgo, bool trunc=true):  
00024     noise_cache_id(0), 
00025     threshold_cache_id(0),
00026     theFEDalgorithm(fedalgo),
00027     doTruncate(trunc) {}
00028   ~SiStripFedZeroSuppression() {};
00029   void init(const edm::EventSetup& es);
00030   void suppress(const std::vector<SiStripDigi>&,std::vector<SiStripDigi>&,const uint32_t&,
00031                 edm::ESHandle<SiStripNoises> &,edm::ESHandle<SiStripThreshold> &);
00032   void suppress(const std::vector<SiStripDigi>&,std::vector<SiStripDigi>&,const uint32_t&);
00033   void suppress(const edm::DetSet<SiStripRawDigi>&,edm::DetSet<SiStripDigi>&);
00034   void suppress(const std::vector<int16_t>&,const uint16_t&, edm::DetSet<SiStripDigi>&);
00035   
00036   bool IsAValidDigi();
00037   
00038  private:
00039   
00040   inline uint16_t truncate(int16_t adc) const{
00041     if(adc>253 && doTruncate) return ((adc==1023) ? 255 : 254);
00042     return adc;
00043   };
00044   
00045   edm::ESHandle<SiStripNoises> noiseHandle;
00046   edm::ESHandle<SiStripThreshold> thresholdHandle;
00047   uint32_t noise_cache_id, threshold_cache_id;
00048   
00049   uint16_t theFEDalgorithm;
00050   bool doTruncate;
00051 
00052   int16_t  theFEDlowThresh;
00053   int16_t  theFEDhighThresh;
00054   
00055   int16_t adc;
00056   int16_t adcPrev;
00057   int16_t adcNext;
00058   int16_t adcMaxNeigh;
00059   int16_t adcPrev2;
00060   int16_t adcNext2;
00061   
00062   int16_t thePrevFEDlowThresh;
00063   int16_t thePrevFEDhighThresh;
00064   int16_t theNextFEDlowThresh;
00065   int16_t theNextFEDhighThresh;
00066   
00067   int16_t theNeighFEDlowThresh;
00068   int16_t theNeighFEDhighThresh;
00069   
00070   int16_t thePrev2FEDlowThresh;
00071   int16_t theNext2FEDlowThresh;
00072   
00073   // working caches
00074   std::vector<int16_t>   highThr_,   lowThr_;   // thresholds in adc counts
00075   std::vector<float>     highThrSN_, lowThrSN_; // thresholds as S/N
00076   std::vector<float>     noises_;
00077   
00078   void fillThresholds_(const uint32_t detID, size_t size) ;
00079   
00080 };
00081 #endif