00001 #ifndef ClusterProducerFP420_h 00002 #define ClusterProducerFP420_h 00003 00004 #include "RecoRomanPot/RecoFP420/interface/ClusterNoiseFP420.h" 00005 00006 #include "DataFormats/FP420Cluster/interface/ClusterFP420.h" 00007 #include "DataFormats/FP420Digi/interface/HDigiFP420.h" 00008 00009 #include <vector> 00010 #include <algorithm> 00011 #include <cmath> 00012 00013 00014 class ClusterProducerFP420 { 00015 public: 00016 00017 typedef std::vector<HDigiFP420>::const_iterator HDigiFP420Iter; 00018 00019 ClusterProducerFP420(float electrode_thr, float seed_thr,float clust_thr, int max_voids) : 00020 theChannelThreshold(electrode_thr), 00021 theSeedThreshold(seed_thr), 00022 theClusterThreshold(clust_thr), 00023 max_voids_(max_voids){}; 00024 00025 00026 std::vector<ClusterFP420> clusterizeDetUnit(HDigiFP420Iter begin, HDigiFP420Iter end, 00027 unsigned int detid, const ElectrodNoiseVector& vnoise); 00028 std::vector<ClusterFP420> clusterizeDetUnitPixels(HDigiFP420Iter begin, HDigiFP420Iter end, 00029 unsigned int detid, const ElectrodNoiseVector& vnoise, unsigned int zside); 00030 00031 int difNarr(unsigned int zside, HDigiFP420Iter ichannel, 00032 HDigiFP420Iter jchannel); 00033 int difWide(unsigned int zside, HDigiFP420Iter ichannel, 00034 HDigiFP420Iter jchannel); 00035 00036 float channelThresholdInNoiseSigma() const { return theChannelThreshold;} 00037 float seedThresholdInNoiseSigma() const { return theSeedThreshold;} 00038 float clusterThresholdInNoiseSigma() const { return theClusterThreshold;} 00039 00040 private: 00041 00042 float theChannelThreshold; 00043 float theSeedThreshold; 00044 float theClusterThreshold; 00045 int max_voids_; 00046 00047 bool badChannel( int channel, const std::vector<short>& badChannels) const; 00048 00049 }; 00050 00051 class AboveSeed { 00052 public: 00053 AboveSeed(float aseed,const ElectrodNoiseVector& vnoise) : seed(aseed), vnoise_(vnoise) {}; 00054 00055 bool operator()(const HDigiFP420& digi) { return ( !vnoise_[digi.channel()].getDisable() && 00056 digi.adc() >= seed * vnoise_[digi.channel()].getNoise()) ;} 00057 private: 00058 float seed; 00059 const ElectrodNoiseVector& vnoise_; 00060 }; 00061 00062 #endif