CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripAPVRestorer.h
Go to the documentation of this file.
1 #ifndef RECOLOCALTRACKER_SISTRIPZEROSUPPRESSION_SISTRIPAPVRESTORER_H
2 #define RECOLOCALTRACKER_SISTRIPZEROSUPPRESSION_SISTRIPAPVRESTORER_H
3 
21 
22 #include <vector>
23 #include <stdint.h>
24 
25 typedef std::map<uint16_t, int16_t> DigiMap;
26 typedef std::map<uint16_t, std::vector < int16_t> > RawDigiMap;
27 typedef std::map<uint16_t, int16_t>::iterator DigiMapIter;
28 typedef std::map<uint32_t, std::vector<float> > CMMap; //detId, Vector of MeanCM per detId
29 
30 
32 
34 
35  public:
36 
37  virtual ~SiStripAPVRestorer() {};
38 
39  void init(const edm::EventSetup& es);
40  int16_t inspect(const uint32_t&, const uint16_t&, std::vector<int16_t>&, const std::vector< std::pair<short,float> >&);
41  void restore(const uint16_t&, std::vector<int16_t>&);
42  int16_t InspectAndRestore(const uint32_t&, const uint16_t&, std::vector<int16_t>&, std::vector<int16_t>&, const std::vector< std::pair<short,float> >&);
43  //void fixAPVsCM(edm::DetSet<SiStripProcessedRawDigi>& );
44  void LoadMeanCMMap(const edm::Event&);
45 
47  //std::vector< DigiMap >& GetSmoothedPoints(){return SmoothedMaps_;}
48  std::map< uint16_t, DigiMap >& GetSmoothedPoints(){return SmoothedMaps_;}
49  std::vector<bool>& GetAPVFlags();
50 
51  protected:
52 
54 
55  private:
56 
57  //template<typename T>float median( std::vector<T>& );
58  //template<typename T>void IterativeMedian(std::vector<T>&, uint16_t);
59 
60  template<typename T >int16_t NullInspect(const uint16_t&, std::vector<T>&);
61  template<typename T >int16_t AbnormalBaselineInspect(const uint16_t&, std::vector<T>&);
62  template<typename T >int16_t BaselineFollowerInspect(const uint16_t&, std::vector<T>&);
63  template<typename T >int16_t BaselineAndSaturationInspect(const uint16_t&, std::vector<T>&);
64 
65  void FlatRestore(const uint16_t&, const uint16_t&, std::vector<int16_t>& );
66  bool CheckBaseline(const std::vector<int16_t> &) const;
67  void BaselineFollowerRestore(const uint16_t&, const uint16_t&, const float&, std::vector<int16_t>& );
68 
69  void BaselineFollower(DigiMap&, std::vector<int16_t>&, const float&);
70  bool FlatRegionsFinder(const std::vector<int16_t>&, DigiMap&, const uint16_t&);
71 
72  void BaselineCleaner(const std::vector<int16_t>&, DigiMap&, const uint16_t& );
75  void Cleaner_LocalMinimumAdder(const std::vector<int16_t>&, DigiMap&, const uint16_t& );
76 
77 
80 
81  float pairMedian( std::vector<std::pair<float,float> >&);
82 
83 
85  uint32_t quality_cache_id;
86 
88  uint32_t noise_cache_id;
89 
92 
93  std::vector<std::string> apvFlags_;
94  std::vector<bool> apvFlagsBool_;
95  std::vector<bool> apvFlagsBoolOverride_;
96  std::vector<float> median_;
97  std::vector<bool> badAPVs_;
98  std::map<uint16_t, DigiMap> SmoothedMaps_;
100 
101 
102  uint32_t detId_;
103 
106 
107 
110  std::string InspectAlgo_;
111  std::string RestoreAlgo_;
113 
114  //--------------------------------------------------
115  // Configurable Parameters of Algorithm
116  //--------------------------------------------------
117 
118  double fraction_; // fraction of strips deviating from nominal baseline
119  uint32_t deviation_; // ADC value of deviation from nominal baseline
120  double restoreThreshold_; // for Null inspect (fraction of adc=0 channels)
121  uint32_t DeltaCMThreshold_; // for BaselineFollower inspect
122 
123  uint32_t nSigmaNoiseDerTh_; // threshold for rejecting hits strips
124  uint32_t consecThreshold_; // minimum length of flat region
125  uint32_t hitStripThreshold_; // height above median when strip is definitely a hit
126  uint32_t nSmooth_; // for smoothing and local minimum determination (odd number)
127  uint32_t minStripsToFit_; // minimum strips to try spline algo (otherwise default to median)
128  uint32_t distortionThreshold_; // (max-min) of flat regions to trigger baseline follower
129  double CutToAvoidSignal_; // for iterative median implementation internal to APV restorer
130  uint32_t nSaturatedStrip_; // for BaselineAndSaturation inspect
132  int32_t slopeX_;
133  int32_t slopeY_;
136  int32_t MeanCM_;
139 
140 };
141 
142 #endif
int16_t AbnormalBaselineInspect(const uint16_t &, std::vector< T > &)
int16_t BaselineFollowerInspect(const uint16_t &, std::vector< T > &)
void CreateCMMapRealPed(const edm::DetSetVector< SiStripRawDigi > &)
void restore(const uint16_t &, std::vector< int16_t > &)
void init(const edm::EventSetup &es)
std::vector< bool > & GetAPVFlags()
bool FlatRegionsFinder(const std::vector< int16_t > &, DigiMap &, const uint16_t &)
void LoadMeanCMMap(const edm::Event &)
std::map< uint16_t, int16_t > DigiMap
double filteredBaselineDerivativeSumSquare_
std::map< uint16_t, DigiMap > & GetSmoothedPoints()
edm::ESHandle< SiStripPedestals > pedestalHandle
void Cleaner_MonotonyChecker(DigiMap &)
std::map< uint16_t, DigiMap > SmoothedMaps_
RawDigiMap & GetBaselineMap()
std::map< uint16_t, int16_t >::iterator DigiMapIter
float pairMedian(std::vector< std::pair< float, float > > &)
std::vector< std::string > apvFlags_
void BaselineFollowerRestore(const uint16_t &, const uint16_t &, const float &, std::vector< int16_t > &)
bool CheckBaseline(const std::vector< int16_t > &) const
edm::ESHandle< SiStripQuality > qualityHandle
void BaselineFollower(DigiMap &, std::vector< int16_t > &, const float &)
int16_t InspectAndRestore(const uint32_t &, const uint16_t &, std::vector< int16_t > &, std::vector< int16_t > &, const std::vector< std::pair< short, float > > &)
int16_t NullInspect(const uint16_t &, std::vector< T > &)
int16_t BaselineAndSaturationInspect(const uint16_t &, std::vector< T > &)
void FlatRestore(const uint16_t &, const uint16_t &, std::vector< int16_t > &)
tuple conf
Definition: dbtoconf.py:185
void Cleaner_HighSlopeChecker(DigiMap &)
std::vector< bool > apvFlagsBoolOverride_
edm::ESHandle< SiStripNoises > noiseHandle
int16_t inspect(const uint32_t &, const uint16_t &, std::vector< int16_t > &, const std::vector< std::pair< short, float > > &)
std::map< uint32_t, std::vector< float > > CMMap
void BaselineCleaner(const std::vector< int16_t > &, DigiMap &, const uint16_t &)
std::vector< bool > badAPVs_
std::vector< bool > apvFlagsBool_
std::map< uint16_t, std::vector< int16_t > > RawDigiMap
std::vector< float > median_
void CreateCMMapCMstored(const edm::DetSetVector< SiStripProcessedRawDigi > &)
void Cleaner_LocalMinimumAdder(const std::vector< int16_t > &, DigiMap &, const uint16_t &)
SiStripAPVRestorer(const edm::ParameterSet &conf)