CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripAPVRestorer.cc
Go to the documentation of this file.
2 
3 #include <cmath>
4 #include <iostream>
5 #include <algorithm>
6 
7 
8 
9 
11  quality_cache_id(-1), noise_cache_id(-1),
12  ForceNoRestore_(conf.getParameter<bool>("ForceNoRestore")),
13  SelfSelectRestoreAlgo_(conf.getParameter<bool>("SelfSelectRestoreAlgo")),
14  InspectAlgo_(conf.getParameter<std::string>("APVInspectMode")),
15  RestoreAlgo_(conf.getParameter<std::string>("APVRestoreMode")),
16  useRealMeanCM_(conf.getParameter<bool>("useRealMeanCM")),
17  fraction_(conf.getParameter<double>("Fraction")),
18  deviation_(conf.getParameter<uint32_t>("Deviation")),
19  restoreThreshold_(conf.getParameter<double>("restoreThreshold")),
20  DeltaCMThreshold_(conf.getParameter<uint32_t>("DeltaCMThreshold")),
21  nSigmaNoiseDerTh_(conf.getParameter<uint32_t>("nSigmaNoiseDerTh")),
22  consecThreshold_(conf.getParameter<uint32_t>("consecThreshold")),
23  hitStripThreshold_(conf.getParameter<uint32_t>("hitStripThreshold")),
24  nSmooth_(conf.getParameter<uint32_t>("nSmooth")),
25  minStripsToFit_(conf.getParameter<uint32_t>("minStripsToFit")),
26  distortionThreshold_(conf.getParameter<uint32_t>("distortionThreshold")),
27  CutToAvoidSignal_(conf.getParameter<double>("CutToAvoidSignal")),
28  nSaturatedStrip_(conf.getParameter<uint32_t>("nSaturatedStrip"))
29 
30 
31 {
32  apvFlags_.clear();
33  median_.clear();
34  SmoothedMaps_.clear();
35  BaselineMap_.erase(BaselineMap_.begin(), BaselineMap_.end());
36 }
37 
38 
40  uint32_t n_cache_id = es.get<SiStripNoisesRcd>().cacheIdentifier();
41  uint32_t q_cache_id = es.get<SiStripQualityRcd>().cacheIdentifier();
42 
43  if(n_cache_id != noise_cache_id) {
44  es.get<SiStripNoisesRcd>().get( noiseHandle );
45  noise_cache_id = n_cache_id;
46  } else {
47  noise_cache_id = n_cache_id;
48  }
49  if(q_cache_id != quality_cache_id) {
50  es.get<SiStripQualityRcd>().get( qualityHandle );
51  quality_cache_id = q_cache_id;
52  }else {
53  quality_cache_id = q_cache_id;
54  }
55 
56 
57 }
58 
59 
60 int16_t SiStripAPVRestorer::inspect( const uint32_t& detId,std::vector<int16_t>& digis, const std::vector< std::pair<short,float> >& vmedians) {
61 
62  detId_ = detId;
63 
64  apvFlags_.clear();
65  median_.clear();
66  SmoothedMaps_.clear();
67  BaselineMap_.erase(BaselineMap_.begin(), BaselineMap_.end());
68 
69  for(size_t i=0; i< vmedians.size(); ++i) median_.push_back(vmedians[i].second);
70 
71  if(InspectAlgo_=="BaselineFollower") return this->BaselineFollowerInspect(digis);
72  if(InspectAlgo_=="AbnormalBaseline") return this->AbnormalBaselineInspect(digis);
73  if(InspectAlgo_=="Null") return this->NullInspect(digis);
74  if(InspectAlgo_=="BaselineAndSaturation") return this->BaselineAndSaturationInspect(digis);
75  throw cms::Exception("Unregistered Inspect Algorithm") << "SiStripAPVRestorer possibilities: (Null), (AbnormalBaseline),(BaselineFollower)";
76 
77 }
78 
79 
80 void SiStripAPVRestorer::restore( std::vector<int16_t>& digis ) {
81 
82  if(ForceNoRestore_) return;
83 
84  for( uint16_t APV=0; APV< digis.size()/128; ++APV){
85  std::string algoToUse = *( apvFlags_.begin() + APV );
86 
87  if ( algoToUse != ""){
88  if(!SelfSelectRestoreAlgo_) algoToUse = RestoreAlgo_;
89 
90  if(algoToUse=="Flat"){
91  this->FlatRestore(digis, APV);
92  }else if(algoToUse=="BaselineFollower"){
93 
94  this->BaselineFollowerRestore(digis, APV, median_[APV]);
95  // }else if(algoToUse=="IterativeMedian"){
96  //this->IterativeMedian(digis, APV);
97  }else{
98  throw cms::Exception("Unregistered Restore Algorithm") << "SiStripAPVRestorer possibilities: (Flat), (BaselineFollower)";
99  }
100  }
101  }
102 
103 }
104 
105 
106 //Inspect method implementation ==========================================
107 //========================================================================
108 template<typename T>
109 inline
110 int16_t SiStripAPVRestorer::BaselineFollowerInspect(std::vector<T>& digis){
111  SiStripQuality::Range detQualityRange = qualityHandle->getRange(detId_);
112 
113  std::vector<T> singleAPVdigi;
114  singleAPVdigi.clear();
115 
116 
117  int16_t nAPVflagged = 0;
118 
119  CMMap::iterator itCMMap;
120  if(useRealMeanCM_) itCMMap = MeanCMmap_.find(detId_);
121 
122  for( uint16_t APV=0; APV< digis.size()/128; ++APV){
123 
124  int MeanAPVCM = 128;
125  if(useRealMeanCM_&&itCMMap!= MeanCMmap_.end()) MeanAPVCM =(itCMMap->second)[APV];
126 
127  singleAPVdigi.clear();
128  for(int16_t strip = APV*128; strip < (APV+1)*128; ++strip){
129  singleAPVdigi.push_back(digis[strip]);
130 
131  }
132 
133 
134  float DeltaCM = median_[APV] -MeanAPVCM;
135  //if(DeltaCM > DeltaCMThreshold_){ //to be modified when code is extended
136  // apvFlags_.push_back( RestoreAlgo_ );
137  // nAPVflagged++;
138  //}else
139 
140  DigiMap smoothedmap;
141  if(DeltaCM < 0 && std::abs(DeltaCM) > DeltaCMThreshold_){
142 
143  bool isFlat= FlatRegionsFinder(singleAPVdigi,smoothedmap, median_[APV], APV);
144  if(!isFlat){
145  apvFlags_.push_back( "BaselineFollower" ); //specify any algo to make the restore
146  nAPVflagged++;
147  }else{
148  apvFlags_.push_back( "" );
149  }
150  } else{
151  apvFlags_.push_back( "" );
152  }
153  SmoothedMaps_.push_back(smoothedmap);
154 
155  }
156 
157  return nAPVflagged;
158 }
159 
160 
161 template<typename T>
162 inline
164  SiStripQuality::Range detQualityRange = qualityHandle->getRange(detId_);
165 
166 
167  std::vector<T> singleAPVdigi;
168  singleAPVdigi.clear();
169 
170 
171  int16_t nAPVflagged = 0;
172 
173  CMMap::iterator itCMMap;
174  if(useRealMeanCM_) itCMMap = MeanCMmap_.find(detId_);
175 
176  for( uint16_t APV=0; APV< digis.size()/128; ++APV){
177 
178  int MeanAPVCM = 128;
179  if(useRealMeanCM_&&itCMMap!= MeanCMmap_.end()) MeanAPVCM =(itCMMap->second)[APV];
180 
181  singleAPVdigi.clear();
182 
183  uint16_t nSatStrip =0;
184  for(int16_t strip = APV*128; strip < (APV+1)*128; ++strip){
185  singleAPVdigi.push_back(digis[strip]);
186  if(digis[strip] >=1023) ++nSatStrip;
187  }
188 
189  float DeltaCM = median_[APV] -MeanAPVCM;
190 
191 
192  if(DeltaCM < 0 && std::abs(DeltaCM) > DeltaCMThreshold_&&nSatStrip>= nSaturatedStrip_){
193 
194  apvFlags_.push_back( "RestoreAlgo_" ); //specify any algo to make the restore
195  nAPVflagged++;
196  } else{
197  apvFlags_.push_back( "" );
198  }
199 
200  }
201 
202  return nAPVflagged;
203 }
204 
205 
206 template<typename T>
207 inline
208 int16_t SiStripAPVRestorer::AbnormalBaselineInspect(std::vector<T>& digis){
209 
210  SiStripQuality::Range detQualityRange = qualityHandle->getRange(detId_);
211 
212  typename std::vector<T>::iterator fs;
213 
214  int16_t nAPVflagged=0;
215 
216  CMMap::iterator itCMMap;
217  if(useRealMeanCM_) itCMMap = MeanCMmap_.find(detId_);
218 
219 
220  int devCount = 0, qualityCount = 0, minstrip = 0;
221  for( uint16_t APV=0; APV< digis.size()/128; ++APV){
222  int MeanAPVCM = 128;
223  if(useRealMeanCM_&&itCMMap!= MeanCMmap_.end()) MeanAPVCM =(itCMMap->second)[APV];
224  for (uint16_t istrip=APV*128; istrip<(APV+1)*128; ++istrip){
225  fs = digis.begin() + istrip;
226  if ( !qualityHandle->IsStripBad(detQualityRange,istrip) ){
227  qualityCount++;
228  if ( std::abs((int) *fs - MeanAPVCM) > (int)deviation_ ) devCount++;
229  minstrip = std::min((int) *fs, minstrip);
230  }
231  }
232 
233  if( devCount > fraction_ * qualityCount ) {
234  apvFlags_.push_back( RestoreAlgo_ ); //specify any algo to make the restore
235  nAPVflagged++;
236  } else {
237  apvFlags_.push_back( "" );
238  }
239 
240  }
241 
242  return nAPVflagged;
243 
244 }
245 
246 
247 
248 template<typename T>
249 inline
250 int16_t SiStripAPVRestorer::NullInspect(std::vector<T>& digis){
251 
252  SiStripQuality::Range detQualityRange = qualityHandle->getRange(detId_);
253 
254  typename std::vector<T>::iterator fs;
255 
256  int16_t nAPVflagged = 0;
257 
258  for( uint16_t APV=0; APV< digis.size()/128; ++APV){
259  int zeroCount = 0, qualityCount = 0;
260  for (uint16_t istrip=APV*128; istrip<(APV+1)*128; ++istrip){
261  fs = digis.begin() + istrip;
262  if ( !qualityHandle->IsStripBad(detQualityRange,istrip) ){
263  qualityCount++;
264  if ( (int) *fs < 1 ) zeroCount++;
265  }
266  }
267 
268  if( zeroCount > restoreThreshold_ * qualityCount ) {
269  apvFlags_.push_back( RestoreAlgo_ ); //specify any algo to make the restore
270  nAPVflagged++;
271  } else {
272  apvFlags_.push_back( "" );
273  }
274 
275  }
276 
277  return nAPVflagged;
278 
279 }
280 
281 
282 
283 
284 
285 //Restore method implementation =====================================
286 //===================================================================
287 template<typename T>
288 inline
289 void SiStripAPVRestorer::BaselineFollowerRestore( std::vector<T>& digis, uint16_t APVn , float median){
290  typename std::vector<T>::iterator firstStrip(digis.begin() + APVn*128), lastStrip(firstStrip + 128), actualStrip;
291 
292  std::vector<int16_t> baseline;
293  baseline.clear();
294  baseline.insert(baseline.begin(),128, 0);
295 
296  std::vector<int16_t> adcs;
297  adcs.clear();
298 
299 
300  //============================= Copying only ADCs of one APV =============================
301  for(actualStrip= firstStrip; actualStrip < lastStrip; ++actualStrip ) adcs.push_back(*actualStrip);
302 
303  //============================= Calculate Median =========================================
304  //this code was here in order to use the median calculated during the inspect
305  //but actually now we use the one calculated by the cmnsubtractor
306  //float median;
307  //if(median_.size()) median = median_[APVn];
308  //else median = this->median(adcs);
309 
310  //============================= Find Flat Regions & Interpolating the baseline & subtracting the baseline =================
311 
312  if(SmoothedMaps_.size()){
313  this->BaselineFollower(SmoothedMaps_[APVn], baseline, median);
314 
315  } else {
316  median=0;
317  DigiMap smoothedpoints;
318  this->FlatRegionsFinder(adcs,smoothedpoints, median, APVn );
319  this->BaselineFollower(smoothedpoints, baseline, median);
320 
321  }
322 
323  //============================= subtracting the baseline =============================================
324 
325  for(int16_t itStrip= 0 ; itStrip< 128; ++itStrip){
326  //int tempDigi = digis[itStrip+APVn*128] - baseline[itStrip] + median;
327  //std::cout << "BaselineFollowerRestore - detId: " << detId_ << " APV: " << APVn << " strip: " << itStrip << " digis: " << digis[itStrip+APVn*128] << " baseline: " << baseline[itStrip] << " median: " << median << " digis after baseline subtraction: " << tempDigi << std::endl;
328  digis[itStrip+APVn*128] -= baseline[itStrip] - median;
329  }
330 
331 
332  //============================= storing baseline to the map =============================================
333  BaselineMap_.insert(BaselineMap_.end(), std::pair< uint16_t, std::vector < int16_t> >(APVn, baseline));
334 
335 
336 }
337 
338 
339 template<typename T>
340 inline
341 void SiStripAPVRestorer::FlatRestore( std::vector<T>& digis, uint16_t APVn ){
342 
343  std::vector<int16_t> baseline;
344  baseline.clear();
345  baseline.insert(baseline.begin(),128, 150);
346  baseline[0]=0; baseline[127]=0;
347  BaselineMap_.insert(BaselineMap_.end(), std::pair< uint16_t, std::vector < int16_t> >(APVn, baseline));
348 
349  typename std::vector<T>::iterator strip(digis.begin() + APVn*128), lastStrip(strip + 128);
350 
351  int counter = 0;
352  while (strip < lastStrip) {
353  *strip = baseline[counter];
354  counter++;
355  strip++;
356  }
357 
358 }
359 
360 
361 
362 //Baseline calculation implementation =======================================
363 //===========================================================================
364 
365 bool inline SiStripAPVRestorer::FlatRegionsFinder(std::vector<int16_t>& adcs, DigiMap& smoothedpoints, float median, uint16_t APVn ){
366  SiStripNoises::Range detNoiseRange = noiseHandle->getRange(detId_);
367 
368  DigiMap consecpoints;
369  DigiMapIter itConsecpoints, itSmoothedpoints;
370  consecpoints.erase(consecpoints.begin(), consecpoints.end());
371  smoothedpoints.erase(smoothedpoints.begin(), smoothedpoints.end());
372 
373 
374  //uint32_t idToLook = 369120382; //to be removed
375  //============================= Height above local minimum ===============================
376  std::vector<float> adcsLocalMinSubtracted;
377  adcsLocalMinSubtracted.clear();
378  adcsLocalMinSubtracted.insert(adcsLocalMinSubtracted.begin(), 128,0);
379  for(uint32_t istrip=0; istrip<128; ++istrip) {
380  float localmin = 999.9;
381  for(uint16_t jstrip=std::max(0,(int)(istrip-nSmooth_/2)); jstrip<std::min(128,(int)(istrip+nSmooth_/2)); ++jstrip) {
382  float nextvalue = adcs[jstrip];
383  if(nextvalue < localmin) localmin=nextvalue;
384  }
385  adcsLocalMinSubtracted[istrip] = adcs[istrip] - localmin;
386  }
387 
388 
389  //============================= Find regions with stable slopes ========================
390  std::vector<uint16_t> nConsStrip;
391  nConsStrip.clear();
392 
393  //Creating maps with all the neighborhood strip and putting in a nCosntStip vector how many we have
394  uint16_t consecStrips=0;
395  for(uint32_t istrip=0; istrip<128; ++istrip) {
396  int16_t adc = adcs[istrip];
397 
398 
399  if( adcsLocalMinSubtracted[istrip] < nSigmaNoiseDerTh_ * (float)noiseHandle->getNoiseFast(istrip+APVn*128,detNoiseRange)
400  && adc - median < hitStripThreshold_) {
401  //&& std::abs(adc - adcsLocalMinSubtracted[istrip]) < hitStripThreshold_) { //count of many consecutive strips
402  consecpoints.insert(consecpoints.end(), std::pair<uint16_t, int16_t >(istrip, adc));
403  ++consecStrips;
404 
405  } else if (consecStrips >0){
406  nConsStrip.push_back(consecStrips);
407  consecStrips = 0;
408  }
409 
410 
411  }
412 
413  //to cope with the last flat region of the APV
414  if(consecStrips >0) nConsStrip.push_back(consecStrips);
415 
416 
417  //removing from the map the fist and last points in wide flat regions and erasing from the map too small regions
418  itConsecpoints = consecpoints.begin();
419  float MinSmoothValue=2000., MaxSmoothValue=0.;
420  for(std::vector<uint16_t>::iterator itnConsStrip = nConsStrip.begin(); itnConsStrip < nConsStrip.end(); ++itnConsStrip){
421 
422  consecStrips = *itnConsStrip;
423  if(consecStrips >=consecThreshold_){
424  ++itConsecpoints; //skipping first point
425  uint16_t nFirstStrip = itConsecpoints->first;
426  uint16_t nLastStrip;
427  float smoothValue = 0.0;
428  float stripCount =1;
429  for(uint16_t n =0; n < consecStrips-2; ++n){
430  smoothValue += itConsecpoints->second;
431  if(stripCount == consecThreshold_){
432  smoothValue /= (float)stripCount;
433  nLastStrip = nFirstStrip + stripCount -1;
434  smoothedpoints.insert(smoothedpoints.end(), std::pair<uint16_t, int16_t >(nFirstStrip, smoothValue));
435  smoothedpoints.insert(smoothedpoints.end(), std::pair<uint16_t, int16_t >(nLastStrip, smoothValue));
436  if(smoothValue > MaxSmoothValue) MaxSmoothValue = smoothValue;
437  if(smoothValue < MinSmoothValue) MinSmoothValue = smoothValue;
438  nFirstStrip = nLastStrip+1;
439  smoothValue=0;
440  stripCount=0;
441  }
442  ++stripCount;
443  ++itConsecpoints;
444  }
445  ++itConsecpoints; //and putting the pointer to the new seies of point
446 
447  if(smoothValue>0){
448  --stripCount;
449  smoothValue /= (float)(stripCount);
450  nLastStrip = nFirstStrip + stripCount -1;
451  smoothedpoints.insert(smoothedpoints.end(), std::pair<uint16_t, int16_t >(nFirstStrip, smoothValue));
452  smoothedpoints.insert(smoothedpoints.end(), std::pair<uint16_t, int16_t >(nLastStrip, smoothValue));
453  if(smoothValue > MaxSmoothValue) MaxSmoothValue = smoothValue;
454  if(smoothValue < MinSmoothValue) MinSmoothValue = smoothValue;
455  }
456  } else{
457  for(int n =0; n< consecStrips ; ++n) ++itConsecpoints;
458 
459  }
460  }
461 
462  if( (MaxSmoothValue-MinSmoothValue) > distortionThreshold_) return false;
463  return true;
464 }
465 
466 
467 void inline SiStripAPVRestorer::BaselineFollower(DigiMap& smoothedpoints, std::vector<int16_t>& baseline, float median){
468 
469  baseline.clear();
470  DigiMapIter itSmoothedpoints;
471 
472  //if not enough points
473  if(smoothedpoints.size() < minStripsToFit_){
474  baseline.clear();
475  baseline.insert(baseline.begin(),128, median);
476  } else {
477  baseline.insert(baseline.begin(),128, 0);
478 
479  DigiMapIter itSmoothedpointsBegin, itSmoothedpointsEnd;
480  itSmoothedpointsBegin = smoothedpoints.begin();
481  itSmoothedpointsEnd = --(smoothedpoints.end());
482 
483 
484  uint16_t firstStripFlat = itSmoothedpointsBegin->first;
485  uint16_t lastStripFlat = itSmoothedpointsEnd->first;
486  int16_t firstStipFlatADC= itSmoothedpointsBegin->second;
487  int16_t lastStipFlatADC= itSmoothedpointsEnd->second;
488 
489  //adding here the costant line at the extremities
490  baseline.erase(baseline.begin(), baseline.begin()+firstStripFlat);
491  baseline.insert(baseline.begin(), firstStripFlat, firstStipFlatADC);
492 
493  baseline.erase(baseline.begin()+lastStripFlat, baseline.end());
494  baseline.insert(baseline.end(), 128 - lastStripFlat, lastStipFlatADC);
495 
496 
497  //IMPORTANT: the itSmoothedpointsEnd should be at least smaller than smoothedpoints.end() -1
498  for(itSmoothedpoints = itSmoothedpointsBegin; itSmoothedpoints != itSmoothedpointsEnd; ++itSmoothedpoints){
499  DigiMapIter itSmoothedpointsNext = itSmoothedpoints;
500  ++itSmoothedpointsNext;
501  float strip1 = itSmoothedpoints->first;
502  float strip2 = itSmoothedpointsNext->first;
503  float adc1 = itSmoothedpoints->second;
504  float adc2 = itSmoothedpointsNext->second;
505 
506  baseline[strip1] = adc1;
507  baseline[strip2] = adc2;
508  float m = (adc2 -adc1)/(strip2 -strip1);
509  uint16_t itStrip = strip1 +1;
510  float stripadc = adc1 + m;
511  while(itStrip < strip2){
512  baseline[itStrip] = stripadc;
513  ++itStrip;
514  stripadc+=m;
515  }
516 
517  }
518 
519  }
520 }
521 
522 
523 //CM subtracion method implementation ================================
524 //====================================================================
525 /*
526 template<typename T>
527 inline
528 float SiStripAPVRestorer::median( std::vector<T>& sample) {
529 
530  typename std::vector<T>::iterator mid = sample.begin() + sample.size()/2;
531  std::nth_element(sample.begin(), mid, sample.end());
532  if( sample.size() & 1 ) //odd size
533  return *mid;
534  return ( *std::max_element(sample.begin(), mid) + *mid ) / 2.;
535 }
536 */
537 
538 
539 
540 
541 
542 
543 
544 //Other method implementation ==============================================
545 //==========================================================================
546 
548 
549  // cmdigis should be the same size as apvFlags_
550  // otherwise something pathological has happened and we do nothing
551  if ( cmdigis.size() != apvFlags_.size() ) return;
552 
554  std::vector<std::string>::const_iterator apvf_iter = apvFlags_.begin();
555 
556  // No way to change the adc value of a SiStripProcessedRawDigi
557  // so we just extract the values, clear the DetSet, and
558  // replace with the proper values.
559 
560  std::vector<float> cmvalues;
561  for( ; cm_iter != cmdigis.end(); ++cm_iter ) cmvalues.push_back( (*cm_iter).adc() );
562  cmdigis.clear();
563 
564  std::vector<float>::const_iterator cmv_iter = cmvalues.begin();
565  while( apvf_iter != apvFlags_.end() ){
566  if( *apvf_iter != "") {
567  //std::cout << " apvFlag was " << *apvf_iter << std::endl;
568  //std::cout << " baseline was " << *cmv_iter << std::endl;
569  cmdigis.push_back( SiStripProcessedRawDigi( -999.) );
570  }
571  else
572  cmdigis.push_back( SiStripProcessedRawDigi( *cmv_iter ) );
573  apvf_iter++;
574  cmv_iter++;
575  }
576 }
577 
579  if(useRealMeanCM_){
581  iEvent.getByLabel(inputTag_,inputCM);
582  this->CreateCMMap(*inputCM);
583  }
584 }
585 
587 
588  MeanCMmap_.erase(MeanCMmap_.begin(), MeanCMmap_.end());
589 
590  uint32_t detId_;
593  std::vector<float> MeanCMNValue;
594 
595  for(itInput = Input.begin(); itInput != Input.end(); ++itInput){
596  detId_ = itInput->id;
597  MeanCMNValue.clear();
598  for(itCM = itInput->begin(); itCM != itInput->end(); ++itCM) MeanCMNValue.push_back(itCM->adc());
599  MeanCMmap_.insert(std::pair<uint32_t, std::vector<float> >(detId_,MeanCMNValue));
600  }
601 
602 }
int adc(sample_type sample)
get the ADC sample (12 bits)
iterator end()
Definition: DetSet.h:59
void BaselineFollowerRestore(std::vector< T > &, uint16_t, float)
int i
Definition: DBlmapReader.cc:9
int16_t AbnormalBaselineInspect(std::vector< T > &)
#define Input(cl)
Definition: vmac.h:189
void CreateCMMap(const edm::DetSetVector< SiStripProcessedRawDigi > &)
void push_back(const T &t)
Definition: DetSet.h:67
void init(const edm::EventSetup &es)
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
collection_type::iterator iterator
Definition: DetSet.h:31
void restore(std::vector< int16_t > &)
std::vector< DigiMap > SmoothedMaps_
A signed Digi for the silicon strip detector, containing only adc information, and suitable for stori...
int16_t NullInspect(std::vector< T > &)
#define abs(x)
Definition: mlp_lapack.h:159
#define min(a, b)
Definition: mlp_lapack.h:161
std::map< uint16_t, int16_t > DigiMap
void fixAPVsCM(edm::DetSet< SiStripProcessedRawDigi > &)
size_type size() const
Definition: DetSet.h:62
std::vector< std::string > apvFlags_
edm::InputTag inputTag_
int iEvent
Definition: GenABIO.cc:243
edm::ESHandle< SiStripQuality > qualityHandle
const T & max(const T &a, const T &b)
int16_t BaselineFollowerInspect(std::vector< T > &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:356
tuple conf
Definition: dbtoconf.py:185
int16_t BaselineAndSaturationInspect(std::vector< T > &)
iterator begin()
Definition: DetSet.h:58
void LoadMeanCMMap(edm::Event &)
edm::ESHandle< SiStripNoises > noiseHandle
const T & get() const
Definition: EventSetup.h:55
bool FlatRegionsFinder(std::vector< int16_t > &, DigiMap &, float, uint16_t)
std::map< uint16_t, int16_t >::iterator DigiMapIter
void BaselineFollower(DigiMap &, std::vector< int16_t > &, float)
std::pair< ContainerIterator, ContainerIterator > Range
int16_t inspect(const uint32_t &, std::vector< int16_t > &, const std::vector< std::pair< short, float > > &)
std::vector< float > median_
void clear()
Definition: DetSet.h:68
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:341
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripNoises.h:41
collection_type::const_iterator const_iterator
Definition: DetSet.h:32
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:106
SiStripAPVRestorer(const edm::ParameterSet &conf)
void FlatRestore(std::vector< T > &, uint16_t)