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
90 
91  // event state
93  // state
94  uint32_t detId_;
95  std::vector<std::string> apvFlags_;
96  std::vector<bool> apvFlagsBool_;
97  std::vector<bool> apvFlagsBoolOverride_;
98  std::vector<float> median_;
99  std::vector<bool> badAPVs_;
100  std::map<uint16_t, digimap_t> smoothedMaps_;
102 
103  //--------------------------------------------------
104  // Configurable Parameters of Algorithm
105  //--------------------------------------------------
110  int32_t meanCM_;
111  uint32_t deltaCMThreshold_; // for BaselineFollower inspect
112  double fraction_; // fraction of strips deviating from nominal baseline
113  uint32_t deviation_; // ADC value of deviation from nominal baseline
114  double restoreThreshold_; // for Null inspect (fraction of adc=0 channels)
115  uint32_t nSaturatedStrip_; // for BaselineAndSaturation inspect
116  uint32_t nSigmaNoiseDerTh_; // threshold for rejecting hits strips
117  uint32_t consecThreshold_; // minimum length of flat region
118  uint32_t nSmooth_; // for smoothing and local minimum determination (odd number)
119  uint32_t distortionThreshold_; // (max-min) of flat regions to trigger baseline follower
122  int32_t slopeX_;
123  int32_t slopeY_;
124  uint32_t hitStripThreshold_; // height above median when strip is definitely a hit
125  uint32_t minStripsToFit_; // minimum strips to try spline algo (otherwise default to median)
133 };
134 #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::pedestal_cache_id
uint32_t pedestal_cache_id
Definition: SiStripAPVRestorer.h:89
SiStripAPVRestorer::deviation_
uint32_t deviation_
Definition: SiStripAPVRestorer.h:113
SiStripAPVRestorer::smoothedMaps_
std::map< uint16_t, digimap_t > smoothedMaps_
Definition: SiStripAPVRestorer.h:100
SiStripAPVRestorer::inspectAlgo_
std::string inspectAlgo_
Definition: SiStripAPVRestorer.h:107
ESHandle.h
SiStripAPVRestorer::filteredBaselineDerivativeSumSquare_
double filteredBaselineDerivativeSumSquare_
Definition: SiStripAPVRestorer.h:128
SiStripRawProcessingFactory
Definition: SiStripRawProcessingFactory.h:14
SiStripAPVRestorer::gradient_threshold_
int gradient_threshold_
Definition: SiStripAPVRestorer.h:129
SiStripCommonModeNoiseSubtractor.h
SiStripAPVRestorer::pedestalHandle
edm::ESHandle< SiStripPedestals > pedestalHandle
Definition: SiStripAPVRestorer.h:88
SiStripAPVRestorer::loadMeanCMMap
void loadMeanCMMap(const edm::Event &)
Definition: SiStripAPVRestorer.cc:982
SiStripAPVRestorer::nSmooth_
uint32_t nSmooth_
Definition: SiStripAPVRestorer.h:118
SiStripRawDigi.h
SiStripAPVRestorer::baselineMap_
baselinemap_t baselineMap_
Definition: SiStripAPVRestorer.h:101
SiStripAPVRestorer::forceNoRestore_
bool forceNoRestore_
Definition: SiStripAPVRestorer.h:106
SiStripAPVRestorer::baselineFollower
void baselineFollower(const digimap_t &, digivector_t &baseline, float median)
Definition: SiStripAPVRestorer.cc:636
SiStripNoises.h
SiStripAPVRestorer::nSaturatedStrip_
uint32_t nSaturatedStrip_
Definition: SiStripAPVRestorer.h:115
SiStripAPVRestorer::init
void init(const edm::EventSetup &es)
Definition: SiStripAPVRestorer.cc:54
SiStripAPVRestorer::cleaningSequence_
uint32_t cleaningSequence_
Definition: SiStripAPVRestorer.h:121
SiStripAPVRestorer::minStripsToFit_
uint32_t minStripsToFit_
Definition: SiStripAPVRestorer.h:125
SiStripAPVRestorer::checkBaseline
bool checkBaseline(const std::vector< int16_t > &baseline) const
Definition: SiStripAPVRestorer.cc:682
SiStripAPVRestorer::restoreAlgo_
std::string restoreAlgo_
Definition: SiStripAPVRestorer.h:108
SiStripAPVRestorer::applyBaselineRejection_
bool applyBaselineRejection_
Definition: SiStripAPVRestorer.h:126
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:536
SiStripAPVRestorer::deltaCMThreshold_
uint32_t deltaCMThreshold_
Definition: SiStripAPVRestorer.h:111
SiStripAPVRestorer::getBaselineMap
const baselinemap_t & getBaselineMap() const
Definition: SiStripAPVRestorer.h:53
SiStripAPVRestorer::cleaner_HighSlopeChecker
void cleaner_HighSlopeChecker(digimap_t &smoothedpoints)
Definition: SiStripAPVRestorer.cc:603
SiStripAPVRestorer::slopeY_
int32_t slopeY_
Definition: SiStripAPVRestorer.h:123
SiStripAPVRestorer::nTotStripsPerAPV
constexpr static uint16_t nTotStripsPerAPV
Definition: SiStripAPVRestorer.h:59
SiStripAPVRestorer::fraction_
double fraction_
Definition: SiStripAPVRestorer.h:112
SiStripProcessedRawDigi.h
SiStripAPVRestorer::derivativeFollowerRestore
void derivativeFollowerRestore(uint16_t apvN, uint16_t firstAPV, digivector_t &digis)
Definition: SiStripAPVRestorer.cc:1027
SiStripAPVRestorer::baselineFollowerInspect
uint16_t baselineFollowerInspect(uint16_t firstAPV, const digivector_t &digis)
Definition: SiStripAPVRestorer.cc:188
edm::ESHandle< SiStripQuality >
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:80
SiStripPedestalsRcd.h
SiStripAPVRestorer::createCMMapCMstored
void createCMMapCMstored(const edm::DetSetVector< SiStripProcessedRawDigi > &input)
Definition: SiStripAPVRestorer.cc:1012
SiStripAPVRestorer::flatRestore
void flatRestore(uint16_t apvN, uint16_t firstAPV, digivector_t &digis)
Definition: SiStripAPVRestorer.cc:387
SiStripAPVRestorer::meanCM_
int32_t meanCM_
Definition: SiStripAPVRestorer.h:110
SiStripAPVRestorer::width_cluster_
int width_cluster_
Definition: SiStripAPVRestorer.h:132
SiStripAPVRestorer::nSigmaNoiseDerTh_
uint32_t nSigmaNoiseDerTh_
Definition: SiStripAPVRestorer.h:116
SiStripAPVRestorer::quality_cache_id
uint32_t quality_cache_id
Definition: SiStripAPVRestorer.h:89
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
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:303
SiStripAPVRestorer::hybridEmulationInspect
uint16_t hybridEmulationInspect(uint16_t firstAPV, const digivector_t &digis)
Definition: SiStripAPVRestorer.cc:327
SiStripAPVRestorer::apvFlags_
std::vector< std::string > apvFlags_
Definition: SiStripAPVRestorer.h:95
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
SiStripAPVRestorer::qualityHandle
edm::ESHandle< SiStripQuality > qualityHandle
Definition: SiStripAPVRestorer.h:86
SiStripAPVRestorer::baselinemap_t
std::map< uint16_t, digivector_t > baselinemap_t
Definition: SiStripAPVRestorer.h:38
SiStripAPVRestorer::last_gradient_
int last_gradient_
Definition: SiStripAPVRestorer.h:130
pfParticleNetPreprocessParams_cfi.median
median
Definition: pfParticleNetPreprocessParams_cfi.py:16
SiStripAPVRestorer::apvFlagsBool_
std::vector< bool > apvFlagsBool_
Definition: SiStripAPVRestorer.h:96
SiStripAPVRestorer::filteredBaselineMax_
double filteredBaselineMax_
Definition: SiStripAPVRestorer.h:127
SiStripAPVRestorer::abnormalBaselineInspect
uint16_t abnormalBaselineInspect(uint16_t firstAPV, const digivector_t &digis)
Definition: SiStripAPVRestorer.cc:268
SiStripAPVRestorer::distortionThreshold_
uint32_t distortionThreshold_
Definition: SiStripAPVRestorer.h:119
edm::EventSetup
Definition: EventSetup.h:57
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:495
SiStripAPVRestorer::size_window_
int size_window_
Definition: SiStripAPVRestorer.h:131
SiStripAPVRestorer::hitStripThreshold_
uint32_t hitStripThreshold_
Definition: SiStripAPVRestorer.h:124
SiStripAPVRestorer::restore
void restore(uint16_t firstAPV, digivector_t &digis)
Definition: SiStripAPVRestorer.cc:137
SiStripAPVRestorer::forceRestoreInspect
uint16_t forceRestoreInspect(uint16_t firstAPV, const digivector_t &digis)
Definition: SiStripAPVRestorer.cc:222
SiStripAPVRestorer::flatRegionsFinder
bool flatRegionsFinder(const digivector_t &adcs, digimap_t &smoothedpoints, uint16_t apvN)
Definition: SiStripAPVRestorer.cc:399
SiStripAPVRestorer::cleaner_MonotonyChecker
void cleaner_MonotonyChecker(digimap_t &smoothedpoints)
Definition: SiStripAPVRestorer.cc:514
SiStripAPVRestorer::getAPVFlags
const std::vector< bool > & getAPVFlags() const
Definition: SiStripAPVRestorer.h:55
SiStripAPVRestorer::createCMMapRealPed
void createCMMapRealPed(const edm::DetSetVector< SiStripRawDigi > &input)
Definition: SiStripAPVRestorer.cc:993
SiStripAPVRestorer::CMMap
std::map< uint32_t, std::vector< float > > CMMap
Definition: SiStripAPVRestorer.h:58
SiStripAPVRestorer::consecThreshold_
uint32_t consecThreshold_
Definition: SiStripAPVRestorer.h:117
SiStripAPVRestorer::useRealMeanCM_
bool useRealMeanCM_
Definition: SiStripAPVRestorer.h:109
DetId.h
SiStripAPVRestorer
Definition: SiStripAPVRestorer.h:25
SiStripAPVRestorer::restoreThreshold_
double restoreThreshold_
Definition: SiStripAPVRestorer.h:114
SiStripQuality.h
SiStripAPVRestorer::SiStripAPVRestorer
SiStripAPVRestorer(const edm::ParameterSet &conf)
Definition: SiStripAPVRestorer.cc:9
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:122
SiStripAPVRestorer::hybridFormatInspect
uint16_t hybridFormatInspect(uint16_t firstAPV, const digivector_t &digis)
Definition: SiStripAPVRestorer.cc:160
SiStripAPVRestorer::inspect
uint16_t inspect(uint32_t detId, uint16_t firstAPV, const digivector_t &digis, const medians_t &vmedians)
Definition: SiStripAPVRestorer.cc:90
EventSetup.h
SiStripAPVRestorer::meanCMmap_
CMMap meanCMmap_
Definition: SiStripAPVRestorer.h:92
SiStripAPVRestorer::apvFlagsBoolOverride_
std::vector< bool > apvFlagsBoolOverride_
Definition: SiStripAPVRestorer.h:97
SiStripAPVRestorer::detId_
uint32_t detId_
Definition: SiStripAPVRestorer.h:94
DetSet.h
SiStripNoisesRcd.h
SiStripAPVRestorer::noiseHandle
edm::ESHandle< SiStripNoises > noiseHandle
Definition: SiStripAPVRestorer.h:87
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:352
SiStripAPVRestorer::baselineAndSaturationInspect
uint16_t baselineAndSaturationInspect(uint16_t firstAPV, const digivector_t &digis)
Definition: SiStripAPVRestorer.cc:233
SiStripAPVRestorer::badAPVs_
std::vector< bool > badAPVs_
Definition: SiStripAPVRestorer.h:99
SiStripAPVRestorer::noise_cache_id
uint32_t noise_cache_id
Definition: SiStripAPVRestorer.h:89
SiStripAPVRestorer::applyBaselineCleaner_
bool applyBaselineCleaner_
Definition: SiStripAPVRestorer.h:120
SiStripAPVRestorer::median_
std::vector< float > median_
Definition: SiStripAPVRestorer.h:98