Go to the documentation of this file.00001 #ifndef RECOLOCALTRACKER_SISTRIPZEROSUPPRESSION_SISTRIPAPVRESTORER_H
00002 #define RECOLOCALTRACKER_SISTRIPZEROSUPPRESSION_SISTRIPAPVRESTORER_H
00003
00004 #include "FWCore/Framework/interface/Event.h"
00005 #include "FWCore/Framework/interface/EventSetup.h"
00006 #include "DataFormats/Common/interface/Handle.h"
00007 #include "FWCore/Framework/interface/EventSetup.h"
00008 #include "FWCore/Framework/interface/ESHandle.h"
00009 #include "CondFormats/SiStripObjects/interface/SiStripNoises.h"
00010 #include "CalibFormats/SiStripObjects/interface/SiStripQuality.h"
00011 #include "CondFormats/DataRecord/interface/SiStripNoisesRcd.h"
00012 #include "CalibTracker/Records/interface/SiStripQualityRcd.h"
00013 #include "DataFormats/Common/interface/DetSet.h"
00014 #include "DataFormats/Common/interface/DetSetVector.h"
00015 #include "DataFormats/DetId/interface/DetId.h"
00016 #include "DataFormats/SiStripDigi/interface/SiStripProcessedRawDigi.h"
00017
00018 #include <vector>
00019 #include <stdint.h>
00020
00021 typedef std::map< uint16_t, int16_t> DigiMap;
00022 typedef std::map< uint16_t, std::vector < int16_t> > RawDigiMap;
00023 typedef std::map< uint16_t, int16_t>::iterator DigiMapIter;
00024 typedef std::map<uint32_t, std::vector<float> > CMMap;
00025
00026
00027 class SiStripAPVRestorer {
00028
00029 friend class SiStripRawProcessingFactory;
00030
00031 public:
00032
00033 virtual ~SiStripAPVRestorer() {};
00034
00035 void init(const edm::EventSetup& es);
00036 int16_t inspect(const uint32_t&, std::vector<int16_t>&, const std::vector< std::pair<short,float> >&);
00037 void restore(std::vector<int16_t>&);
00038 void fixAPVsCM(edm::DetSet<SiStripProcessedRawDigi>& );
00039 void LoadMeanCMMap(edm::Event&);
00040 RawDigiMap& GetBaselineMap(){return BaselineMap_;}
00041 std::vector< DigiMap >& GetSmoothedPoints(){return SmoothedMaps_;}
00042
00043 protected:
00044
00045 SiStripAPVRestorer(const edm::ParameterSet& conf);
00046
00047 private:
00048
00049
00050
00051
00052 template<typename T >int16_t NullInspect(std::vector<T>&);
00053 template<typename T >int16_t AbnormalBaselineInspect(std::vector<T>&);
00054 template<typename T >int16_t BaselineFollowerInspect(std::vector<T>&);
00055 template<typename T >int16_t BaselineAndSaturationInspect(std::vector<T>&);
00056 template<typename T >void FlatRestore( std::vector<T>& , uint16_t);
00057 template<typename T >void BaselineFollowerRestore( std::vector<T>&, uint16_t, float );
00058
00059 void BaselineFollower(DigiMap&, std::vector<int16_t>&, float);
00060 bool FlatRegionsFinder(std::vector<int16_t>&, DigiMap&, float , uint16_t);
00061
00062 void CreateCMMap(const edm::DetSetVector<SiStripProcessedRawDigi>& );
00063
00064 float pairMedian( std::vector<std::pair<float,float> >&);
00065
00066 edm::ESHandle<SiStripQuality> qualityHandle;
00067 uint32_t quality_cache_id;
00068
00069 edm::ESHandle<SiStripNoises> noiseHandle;
00070 uint32_t noise_cache_id;
00071
00072 std::vector<std::string> apvFlags_;
00073 std::vector<float> median_;
00074 std::vector< DigiMap > SmoothedMaps_;
00075 RawDigiMap BaselineMap_;
00076
00077
00078 uint32_t detId_;
00079
00080 CMMap MeanCMmap_;
00081 edm::InputTag inputTag_;
00082
00083
00084 bool ForceNoRestore_;
00085 bool SelfSelectRestoreAlgo_;
00086 std::string InspectAlgo_;
00087 std::string RestoreAlgo_;
00088 bool useRealMeanCM_;
00089
00090
00091
00092
00093
00094 double fraction_;
00095 uint32_t deviation_;
00096 double restoreThreshold_;
00097 uint32_t DeltaCMThreshold_;
00098
00099 uint32_t nSigmaNoiseDerTh_;
00100 uint32_t consecThreshold_;
00101 uint32_t hitStripThreshold_;
00102 uint32_t nSmooth_;
00103 uint32_t minStripsToFit_;
00104 uint32_t distortionThreshold_;
00105 double CutToAvoidSignal_;
00106 uint32_t nSaturatedStrip_;
00107
00108 };
00109
00110 #endif