CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/RecoLocalTracker/SiStripClusterizer/interface/OldThreeThresholdAlgorithm.h

Go to the documentation of this file.
00001 #ifndef RECOLOCALTRACKER_SISTRIPCLUSTERIZER_THREETHRESHOLDSTRIPCLUSTERIZER_H
00002 #define RECOLOCALTRACKER_SISTRIPCLUSTERIZER_THREETHRESHOLDSTRIPCLUSTERIZER_H
00003 
00004 //Data Formats
00005 #include "DataFormats/Common/interface/DetSetVector.h"
00006 #include "DataFormats/Common/interface/DetSetVectorNew.h"
00007 #include "DataFormats/SiStripDigi/interface/SiStripDigi.h"
00008 #include "DataFormats/SiStripCluster/interface/SiStripCluster.h"
00009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00010 
00011 #include "FWCore/Framework/interface/EventSetup.h"
00012 #include "FWCore/Framework/interface/ESHandle.h"
00013 #include "CalibFormats/SiStripObjects/interface/SiStripGain.h"
00014 #include "CalibTracker/Records/interface/SiStripGainRcd.h"
00015 #include "CondFormats/SiStripObjects/interface/SiStripNoises.h"
00016 #include "CondFormats/DataRecord/interface/SiStripNoisesRcd.h"
00017 #include "CalibFormats/SiStripObjects/interface/SiStripQuality.h"
00018 #include "CalibTracker/Records/interface/SiStripQualityRcd.h"
00019 
00020 #include <vector>
00021 #include <algorithm>
00022 #include <cmath>
00023 #include <string>
00024 
00025 #include "RecoLocalTracker/SiStripClusterizer/interface/StripClusterizerAlgorithm.h"
00026 class StripClusterizerAlgorithmFactory;
00027 
00028 class OldThreeThresholdAlgorithm : public StripClusterizerAlgorithm {
00029 
00030   friend class StripClusterizerAlgorithmFactory;
00031 
00032  public:
00033   
00034   //  void setSiStripNoiseService( SiStripNoiseService* in ){ SiStripNoiseService_=in;}
00035   void clusterizeDetUnit(const edm::DetSet<SiStripDigi>    & digis, edmNew::DetSetVector<SiStripCluster>::FastFiller & output);
00036   void clusterizeDetUnit(const edmNew::DetSet<SiStripDigi> & digis, edmNew::DetSetVector<SiStripCluster>::FastFiller & output);
00037 
00038   void initialize(const edm::EventSetup&);
00039 
00040   bool stripByStripBegin(uint32_t id) {return false;}
00041   void stripByStripAdd(uint16_t strip, uint16_t adc, std::vector<SiStripCluster>& out) {}
00042   void stripByStripEnd(std::vector<SiStripCluster>& out) {}
00043 
00044   float channelThresholdInNoiseSigma() const { return theChannelThreshold;}
00045   float seedThresholdInNoiseSigma()    const { return theSeedThreshold;}
00046   float clusterThresholdInNoiseSigma() const { return theClusterThreshold;}
00047 
00048  private:
00049 
00050   OldThreeThresholdAlgorithm(float strip_thr, float seed_thr,float clust_thr, int max_holes,std::string qualityLabel,bool setDetId) :
00051     theChannelThreshold(strip_thr), 
00052     theSeedThreshold(seed_thr),
00053     theClusterThreshold(clust_thr),
00054     max_holes_(max_holes),
00055     qualityLabel_(qualityLabel){
00056     _setDetId=setDetId;};
00057 
00058   //  SiStripNoiseService* SiStripNoiseService_; 
00059   template<typename InputDetSet>
00060     void clusterizeDetUnit_(const InputDetSet & digis, edmNew::DetSetVector<SiStripCluster>::FastFiller & output);
00061 
00062   float theChannelThreshold;
00063   float theSeedThreshold;
00064   float theClusterThreshold;
00065   int max_holes_;
00066   std::string qualityLabel_;
00067 
00068   edm::ESHandle<SiStripGain> gainHandle_;
00069   edm::ESHandle<SiStripNoises> noiseHandle_;
00070   edm::ESHandle<SiStripQuality> qualityHandle_;
00071 
00072   std::vector<SiStripDigi> cluster_digis_;  // so it's not recreated for each det for each event!
00073 };
00074 
00075 class AboveSeed {
00076  public:
00077 
00078 
00079   //  AboveSeed(float aseed,SiStripNoiseService* noise,const uint32_t& detID) : seed(aseed), noise_(noise),detID_(detID) {};
00080 
00081   AboveSeed(float aseed, const edm::ESHandle<SiStripNoises> & noiseHandle, const SiStripNoises::Range & noiseRange, const edm::ESHandle<SiStripQuality> & qualityHandle, const SiStripQuality::Range & qualityRange) 
00082     : seed(aseed), noise_(noiseHandle), noiseRange_(noiseRange),quality_(qualityHandle), qualityRange_(qualityRange)
00083     {};
00084   //,detID_(detID) {};
00085 
00086   inline bool operator()(const SiStripDigi& digi) { 
00087     return ( 
00088             !quality_->IsStripBad(qualityRange_,digi.strip()) 
00089                 && 
00090             digi.adc() >= seed * noise_->getNoise(digi.strip(), noiseRange_)
00091             );
00092   }
00093  private:
00094   float seed;
00095   const edm::ESHandle<SiStripNoises> & noise_;
00096   const SiStripNoises::Range & noiseRange_;
00097   const edm::ESHandle<SiStripQuality> & quality_;
00098   const SiStripQuality::Range & qualityRange_;
00099 };
00100 
00101 #endif