CMS 3D CMS Logo

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 <cstdint>
24 
27 
28 protected:
30 
31 public:
32  virtual ~SiStripAPVRestorer(){};
33 
34  using digi_t = int16_t;
35  using digivector_t = std::vector<digi_t>;
36  using digimap_t = std::map<uint16_t, digi_t>;
37  using medians_t = std::vector<std::pair<short, float>>;
38  using baselinemap_t = std::map<uint16_t, digivector_t>;
39 
40  void init(const edm::EventSetup& es);
41 
42  uint16_t inspect(uint32_t detId, uint16_t firstAPV, const digivector_t& digis, const medians_t& vmedians);
43  void restore(uint16_t firstAPV, digivector_t& digis);
44 
45  uint16_t inspectAndRestore(uint32_t detId,
46  uint16_t firstAPV,
47  const digivector_t& rawDigisPedSubtracted,
48  digivector_t& processedRawDigi,
49  const medians_t& vmedians);
50 
51  void loadMeanCMMap(const edm::Event&);
52 
53  const baselinemap_t& getBaselineMap() const { return baselineMap_; }
54  const std::map<uint16_t, digimap_t>& getSmoothedPoints() const { return smoothedMaps_; }
55  const std::vector<bool>& getAPVFlags() const { return apvFlagsBool_; }
56 
57 private:
58  using CMMap = std::map<uint32_t, std::vector<float>>; //detId, Vector of MeanCM per detId
59  constexpr static uint16_t nTotStripsPerAPV = 128;
60 
61  uint16_t nullInspect(uint16_t firstAPV, const digivector_t& digis);
62  uint16_t abnormalBaselineInspect(uint16_t firstAPV, const digivector_t& digis);
63  uint16_t baselineFollowerInspect(uint16_t firstAPV, const digivector_t& digis);
64  uint16_t baselineAndSaturationInspect(uint16_t firstAPV, const digivector_t& digis);
65  uint16_t forceRestoreInspect(uint16_t firstAPV, const digivector_t& digis);
66  uint16_t hybridFormatInspect(uint16_t firstAPV, const digivector_t& digis);
67  uint16_t hybridEmulationInspect(uint16_t firstAPV, const digivector_t& digis);
68 
69  void flatRestore(uint16_t apvN, uint16_t firstAPV, digivector_t& digis);
70  bool checkBaseline(const std::vector<int16_t>& baseline) const;
71  void baselineFollowerRestore(uint16_t apvN, uint16_t firstAPV, float median, digivector_t& digis);
72  void derivativeFollowerRestore(uint16_t apvN, uint16_t firstAPV, digivector_t& digis);
73 
74  void baselineFollower(const digimap_t&, digivector_t& baseline, float median);
75  bool flatRegionsFinder(const digivector_t& adcs, digimap_t& smoothedpoints, uint16_t apvN);
76 
77  void baselineCleaner(const digivector_t& adcs, digimap_t& smoothedpoints, uint16_t apvN);
78  void cleaner_MonotonyChecker(digimap_t& smoothedpoints);
79  void cleaner_HighSlopeChecker(digimap_t& smoothedpoints);
80  void cleaner_LocalMinimumAdder(const digivector_t& adcs, digimap_t& smoothedpoints, uint16_t apvN);
81 
84 
85 private: // members
95 
96  // event state
98  // state
99  uint32_t detId_;
100  std::vector<std::string> apvFlags_;
101  std::vector<bool> apvFlagsBool_;
102  std::vector<bool> apvFlagsBoolOverride_;
103  std::vector<float> median_;
104  std::vector<bool> badAPVs_;
105  std::map<uint16_t, digimap_t> smoothedMaps_;
107 
108  //--------------------------------------------------
109  // Configurable Parameters of Algorithm
110  //--------------------------------------------------
115  int32_t meanCM_;
116  uint32_t deltaCMThreshold_; // for BaselineFollower inspect
117  double fraction_; // fraction of strips deviating from nominal baseline
118  uint32_t deviation_; // ADC value of deviation from nominal baseline
119  double restoreThreshold_; // for Null inspect (fraction of adc=0 channels)
120  uint32_t nSaturatedStrip_; // for BaselineAndSaturation inspect
121  uint32_t nSigmaNoiseDerTh_; // threshold for rejecting hits strips
122  uint32_t consecThreshold_; // minimum length of flat region
123  uint32_t nSmooth_; // for smoothing and local minimum determination (odd number)
124  uint32_t distortionThreshold_; // (max-min) of flat regions to trigger baseline follower
127  int32_t slopeX_;
128  int32_t slopeY_;
129  uint32_t hitStripThreshold_; // height above median when strip is definitely a hit
130  uint32_t minStripsToFit_; // minimum strips to try spline algo (otherwise default to median)
138 };
139 #endif
edm::DetSetVector< SiStripRawDigi >
Handle.h
SiStripAPVRestorer::digi_t
int16_t digi_t
Definition: SiStripAPVRestorer.h:34
input
static const std::string input
Definition: EdmProvDump.cc:48
SiStripAPVRestorer::deviation_
uint32_t deviation_
Definition: SiStripAPVRestorer.h:118
SiStripAPVRestorer::smoothedMaps_
std::map< uint16_t, digimap_t > smoothedMaps_
Definition: SiStripAPVRestorer.h:105
SiStripAPVRestorer::inspectAlgo_
std::string inspectAlgo_
Definition: SiStripAPVRestorer.h:112
edm::ESWatcher< SiStripQualityRcd >
SiStripAPVRestorer::filteredBaselineDerivativeSumSquare_
double filteredBaselineDerivativeSumSquare_
Definition: SiStripAPVRestorer.h:133
SiStripNoises
Definition: SiStripNoises.h:25
SiStripRawProcessingFactory
Definition: SiStripRawProcessingFactory.h:15
SiStripAPVRestorer::gradient_threshold_
int gradient_threshold_
Definition: SiStripAPVRestorer.h:134
SiStripCommonModeNoiseSubtractor.h
SiStripAPVRestorer::qualityToken_
edm::ESGetToken< SiStripQuality, SiStripQualityRcd > qualityToken_
Definition: SiStripAPVRestorer.h:86
SiStripAPVRestorer::loadMeanCMMap
void loadMeanCMMap(const edm::Event &)
Definition: SiStripAPVRestorer.cc:969
SiStripAPVRestorer::nSmooth_
uint32_t nSmooth_
Definition: SiStripAPVRestorer.h:123
SiStripRawDigi.h
pfDeepBoostedJetPreprocessParams_cfi.median
median
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:12
SiStripAPVRestorer::baselineMap_
baselinemap_t baselineMap_
Definition: SiStripAPVRestorer.h:106
SiStripAPVRestorer::forceNoRestore_
bool forceNoRestore_
Definition: SiStripAPVRestorer.h:111
SiStripAPVRestorer::baselineFollower
void baselineFollower(const digimap_t &, digivector_t &baseline, float median)
Definition: SiStripAPVRestorer.cc:623
SiStripAPVRestorer::SiStripAPVRestorer
SiStripAPVRestorer(const edm::ParameterSet &conf, edm::ConsumesCollector)
Definition: SiStripAPVRestorer.cc:10
SiStripAPVRestorer::qualityHandle
const SiStripQuality * qualityHandle
Definition: SiStripAPVRestorer.h:89
SiStripNoises.h
SiStripAPVRestorer::nSaturatedStrip_
uint32_t nSaturatedStrip_
Definition: SiStripAPVRestorer.h:120
SiStripAPVRestorer::init
void init(const edm::EventSetup &es)
Definition: SiStripAPVRestorer.cc:55
SiStripAPVRestorer::cleaningSequence_
uint32_t cleaningSequence_
Definition: SiStripAPVRestorer.h:126
SiStripAPVRestorer::minStripsToFit_
uint32_t minStripsToFit_
Definition: SiStripAPVRestorer.h:130
SiStripAPVRestorer::checkBaseline
bool checkBaseline(const std::vector< int16_t > &baseline) const
Definition: SiStripAPVRestorer.cc:669
SiStripAPVRestorer::restoreAlgo_
std::string restoreAlgo_
Definition: SiStripAPVRestorer.h:113
SiStripAPVRestorer::applyBaselineRejection_
bool applyBaselineRejection_
Definition: SiStripAPVRestorer.h:131
SiStripAPVRestorer::~SiStripAPVRestorer
virtual ~SiStripAPVRestorer()
Definition: SiStripAPVRestorer.h:32
SiStripAPVRestorer::cleaner_LocalMinimumAdder
void cleaner_LocalMinimumAdder(const digivector_t &adcs, digimap_t &smoothedpoints, uint16_t apvN)
Definition: SiStripAPVRestorer.cc:523
SiStripAPVRestorer::deltaCMThreshold_
uint32_t deltaCMThreshold_
Definition: SiStripAPVRestorer.h:116
SiStripAPVRestorer::getBaselineMap
const baselinemap_t & getBaselineMap() const
Definition: SiStripAPVRestorer.h:53
SiStripAPVRestorer::cleaner_HighSlopeChecker
void cleaner_HighSlopeChecker(digimap_t &smoothedpoints)
Definition: SiStripAPVRestorer.cc:590
SiStripAPVRestorer::slopeY_
int32_t slopeY_
Definition: SiStripAPVRestorer.h:128
SiStripAPVRestorer::nTotStripsPerAPV
constexpr static uint16_t nTotStripsPerAPV
Definition: SiStripAPVRestorer.h:59
SiStripAPVRestorer::fraction_
double fraction_
Definition: SiStripAPVRestorer.h:117
SiStripProcessedRawDigi.h
SiStripAPVRestorer::derivativeFollowerRestore
void derivativeFollowerRestore(uint16_t apvN, uint16_t firstAPV, digivector_t &digis)
Definition: SiStripAPVRestorer.cc:1014
SiStripAPVRestorer::noiseHandle
const SiStripNoises * noiseHandle
Definition: SiStripAPVRestorer.h:90
SiStripAPVRestorer::pedestalHandle
const SiStripPedestals * pedestalHandle
Definition: SiStripAPVRestorer.h:91
SiStripAPVRestorer::baselineFollowerInspect
uint16_t baselineFollowerInspect(uint16_t firstAPV, const digivector_t &digis)
Definition: SiStripAPVRestorer.cc:175
SiStripAPVRestorer::inspectAndRestore
uint16_t inspectAndRestore(uint32_t detId, uint16_t firstAPV, const digivector_t &rawDigisPedSubtracted, digivector_t &processedRawDigi, const medians_t &vmedians)
Definition: SiStripAPVRestorer.cc:67
SiStripPedestalsRcd.h
SiStripAPVRestorer::createCMMapCMstored
void createCMMapCMstored(const edm::DetSetVector< SiStripProcessedRawDigi > &input)
Definition: SiStripAPVRestorer.cc:999
SiStripAPVRestorer::flatRestore
void flatRestore(uint16_t apvN, uint16_t firstAPV, digivector_t &digis)
Definition: SiStripAPVRestorer.cc:374
SiStripAPVRestorer::noiseToken_
edm::ESGetToken< SiStripNoises, SiStripNoisesRcd > noiseToken_
Definition: SiStripAPVRestorer.h:87
SiStripAPVRestorer::meanCM_
int32_t meanCM_
Definition: SiStripAPVRestorer.h:115
SiStripAPVRestorer::width_cluster_
int width_cluster_
Definition: SiStripAPVRestorer.h:137
SiStripAPVRestorer::nSigmaNoiseDerTh_
uint32_t nSigmaNoiseDerTh_
Definition: SiStripAPVRestorer.h:121
SiStripAPVRestorer::noiseWatcher_
edm::ESWatcher< SiStripNoisesRcd > noiseWatcher_
Definition: SiStripAPVRestorer.h:93
SiStripAPVRestorer::digimap_t
std::map< uint16_t, digi_t > digimap_t
Definition: SiStripAPVRestorer.h:36
SiStripAPVRestorer::nullInspect
uint16_t nullInspect(uint16_t firstAPV, const digivector_t &digis)
Definition: SiStripAPVRestorer.cc:290
SiStripAPVRestorer::hybridEmulationInspect
uint16_t hybridEmulationInspect(uint16_t firstAPV, const digivector_t &digis)
Definition: SiStripAPVRestorer.cc:314
SiStripAPVRestorer::apvFlags_
std::vector< std::string > apvFlags_
Definition: SiStripAPVRestorer.h:100
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
SiStripAPVRestorer::baselinemap_t
std::map< uint16_t, digivector_t > baselinemap_t
Definition: SiStripAPVRestorer.h:38
SiStripAPVRestorer::last_gradient_
int last_gradient_
Definition: SiStripAPVRestorer.h:135
SiStripAPVRestorer::apvFlagsBool_
std::vector< bool > apvFlagsBool_
Definition: SiStripAPVRestorer.h:101
SiStripAPVRestorer::filteredBaselineMax_
double filteredBaselineMax_
Definition: SiStripAPVRestorer.h:132
SiStripAPVRestorer::abnormalBaselineInspect
uint16_t abnormalBaselineInspect(uint16_t firstAPV, const digivector_t &digis)
Definition: SiStripAPVRestorer.cc:255
SiStripAPVRestorer::distortionThreshold_
uint32_t distortionThreshold_
Definition: SiStripAPVRestorer.h:124
edm::EventSetup
Definition: EventSetup.h:58
SiStripAPVRestorer::digivector_t
std::vector< digi_t > digivector_t
Definition: SiStripAPVRestorer.h:35
DetSetVector.h
SiStripAPVRestorer::baselineCleaner
void baselineCleaner(const digivector_t &adcs, digimap_t &smoothedpoints, uint16_t apvN)
Definition: SiStripAPVRestorer.cc:482
SiStripAPVRestorer::size_window_
int size_window_
Definition: SiStripAPVRestorer.h:136
SiStripAPVRestorer::hitStripThreshold_
uint32_t hitStripThreshold_
Definition: SiStripAPVRestorer.h:129
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ESGetToken< SiStripQuality, SiStripQualityRcd >
SiStripAPVRestorer::restore
void restore(uint16_t firstAPV, digivector_t &digis)
Definition: SiStripAPVRestorer.cc:124
SiStripAPVRestorer::forceRestoreInspect
uint16_t forceRestoreInspect(uint16_t firstAPV, const digivector_t &digis)
Definition: SiStripAPVRestorer.cc:209
SiStripAPVRestorer::flatRegionsFinder
bool flatRegionsFinder(const digivector_t &adcs, digimap_t &smoothedpoints, uint16_t apvN)
Definition: SiStripAPVRestorer.cc:386
SiStripAPVRestorer::cleaner_MonotonyChecker
void cleaner_MonotonyChecker(digimap_t &smoothedpoints)
Definition: SiStripAPVRestorer.cc:501
SiStripAPVRestorer::getAPVFlags
const std::vector< bool > & getAPVFlags() const
Definition: SiStripAPVRestorer.h:55
SiStripAPVRestorer::createCMMapRealPed
void createCMMapRealPed(const edm::DetSetVector< SiStripRawDigi > &input)
Definition: SiStripAPVRestorer.cc:980
SiStripAPVRestorer::CMMap
std::map< uint32_t, std::vector< float > > CMMap
Definition: SiStripAPVRestorer.h:58
SiStripAPVRestorer::pedestalToken_
edm::ESGetToken< SiStripPedestals, SiStripPedestalsRcd > pedestalToken_
Definition: SiStripAPVRestorer.h:88
SiStripAPVRestorer::consecThreshold_
uint32_t consecThreshold_
Definition: SiStripAPVRestorer.h:122
SiStripAPVRestorer::useRealMeanCM_
bool useRealMeanCM_
Definition: SiStripAPVRestorer.h:114
DetId.h
ESWatcher.h
SiStripAPVRestorer
Definition: SiStripAPVRestorer.h:25
SiStripAPVRestorer::qualityWatcher_
edm::ESWatcher< SiStripQualityRcd > qualityWatcher_
Definition: SiStripAPVRestorer.h:92
SiStripAPVRestorer::restoreThreshold_
double restoreThreshold_
Definition: SiStripAPVRestorer.h:119
SiStripQuality.h
SiStripQualityRcd.h
SiStripPedestals.h
SiStripAPVRestorer::getSmoothedPoints
const std::map< uint16_t, digimap_t > & getSmoothedPoints() const
Definition: SiStripAPVRestorer.h:54
SiStripAPVRestorer::slopeX_
int32_t slopeX_
Definition: SiStripAPVRestorer.h:127
SiStripAPVRestorer::hybridFormatInspect
uint16_t hybridFormatInspect(uint16_t firstAPV, const digivector_t &digis)
Definition: SiStripAPVRestorer.cc:147
SiStripAPVRestorer::inspect
uint16_t inspect(uint32_t detId, uint16_t firstAPV, const digivector_t &digis, const medians_t &vmedians)
Definition: SiStripAPVRestorer.cc:77
EventSetup.h
SiStripAPVRestorer::meanCMmap_
CMMap meanCMmap_
Definition: SiStripAPVRestorer.h:97
SiStripAPVRestorer::pedestalWatcher_
edm::ESWatcher< SiStripPedestalsRcd > pedestalWatcher_
Definition: SiStripAPVRestorer.h:94
SiStripAPVRestorer::apvFlagsBoolOverride_
std::vector< bool > apvFlagsBoolOverride_
Definition: SiStripAPVRestorer.h:102
SiStripAPVRestorer::detId_
uint32_t detId_
Definition: SiStripAPVRestorer.h:99
DetSet.h
SiStripNoisesRcd.h
SiStripPedestals
Definition: SiStripPedestals.h:27
edm::Event
Definition: Event.h:73
SiStripAPVRestorer::medians_t
std::vector< std::pair< short, float > > medians_t
Definition: SiStripAPVRestorer.h:37
SiStripAPVRestorer::baselineFollowerRestore
void baselineFollowerRestore(uint16_t apvN, uint16_t firstAPV, float median, digivector_t &digis)
Definition: SiStripAPVRestorer.cc:339
SiStripAPVRestorer::baselineAndSaturationInspect
uint16_t baselineAndSaturationInspect(uint16_t firstAPV, const digivector_t &digis)
Definition: SiStripAPVRestorer.cc:220
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
SiStripAPVRestorer::badAPVs_
std::vector< bool > badAPVs_
Definition: SiStripAPVRestorer.h:104
SiStripAPVRestorer::applyBaselineCleaner_
bool applyBaselineCleaner_
Definition: SiStripAPVRestorer.h:125
SiStripAPVRestorer::median_
std::vector< float > median_
Definition: SiStripAPVRestorer.h:103
SiStripQuality
Definition: SiStripQuality.h:32