CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/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) :
00051     theChannelThreshold(strip_thr), 
00052     theSeedThreshold(seed_thr),
00053     theClusterThreshold(clust_thr),
00054     max_holes_(max_holes),
00055     qualityLabel_(qualityLabel){};
00056 
00057   //  SiStripNoiseService* SiStripNoiseService_; 
00058   template<typename InputDetSet>
00059     void clusterizeDetUnit_(const InputDetSet & digis, edmNew::DetSetVector<SiStripCluster>::FastFiller & output);
00060 
00061   float theChannelThreshold;
00062   float theSeedThreshold;
00063   float theClusterThreshold;
00064   int max_holes_;
00065   std::string qualityLabel_;
00066 
00067   edm::ESHandle<SiStripGain> gainHandle_;
00068   edm::ESHandle<SiStripNoises> noiseHandle_;
00069   edm::ESHandle<SiStripQuality> qualityHandle_;
00070 
00071   std::vector<SiStripDigi> cluster_digis_;  // so it's not recreated for each det for each event!
00072 };
00073 
00074 class AboveSeed {
00075  public:
00076 
00077 
00078   //  AboveSeed(float aseed,SiStripNoiseService* noise,const uint32_t& detID) : seed(aseed), noise_(noise),detID_(detID) {};
00079 
00080   AboveSeed(float aseed, const edm::ESHandle<SiStripNoises> & noiseHandle, const SiStripNoises::Range & noiseRange, const edm::ESHandle<SiStripQuality> & qualityHandle, const SiStripQuality::Range & qualityRange) 
00081     : seed(aseed), noise_(noiseHandle), noiseRange_(noiseRange),quality_(qualityHandle), qualityRange_(qualityRange)
00082     {};
00083   //,detID_(detID) {};
00084 
00085   inline bool operator()(const SiStripDigi& digi) { 
00086     return ( 
00087             !quality_->IsStripBad(qualityRange_,digi.strip()) 
00088                 && 
00089             digi.adc() >= seed * noise_->getNoise(digi.strip(), noiseRange_)
00090             );
00091   }
00092  private:
00093   float seed;
00094   const edm::ESHandle<SiStripNoises> & noise_;
00095   const SiStripNoises::Range & noiseRange_;
00096   const edm::ESHandle<SiStripQuality> & quality_;
00097   const SiStripQuality::Range & qualityRange_;
00098 };
00099 
00100 #endif